[dpdk-dev] [PATCH] net/af_packet: fix for stale sockets

Subsystems: networking drivers, the rest

3 messages, 3 authors, 2019-08-27 · open the first message on its own page

[dpdk-dev] [PATCH] net/af_packet: fix for stale sockets

From: Abhishek Sachan <hidden>
Date: 2019-08-22 06:29:21

af_packet driver is leaving stale socket after device is removed.
Ring buffers are memory mapped when device is added using rte_dev_probe.
There is no corresponding munmap call when device is removed/closed.
This commit fixes the issue by calling munmap
from rte_pmd_af_packet_remove().

Bugzilla ID: 339
Cc: stable@dpdk.org

Signed-off-by: Abhishek Sachan <redacted>
Reviewed-by: John W. Linville <redacted>
---
 drivers/net/af_packet/rte_eth_af_packet.c | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 82bf2cd..6df09f2 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -972,6 +972,7 @@ rte_pmd_af_packet_remove(struct rte_vdev_device *dev)
 {
 	struct rte_eth_dev *eth_dev = NULL;
 	struct pmd_internals *internals;
+	struct tpacket_req *req;
 	unsigned q;
 
 	PMD_LOG(INFO, "Closing AF_PACKET ethdev on numa socket %u",
@@ -992,7 +993,10 @@ rte_pmd_af_packet_remove(struct rte_vdev_device *dev)
 		return rte_eth_dev_release_port(eth_dev);
 
 	internals = eth_dev->data->dev_private;
+	req = &internals->req;
 	for (q = 0; q < internals->nb_queues; q++) {
+		munmap(internals->rx_queue[q].map,
+			2 * req->tp_block_size * req->tp_block_nr);
 		rte_free(internals->rx_queue[q].rd);
 		rte_free(internals->tx_queue[q].rd);
 	}
-- 
2.7.4

Re: [dpdk-dev] [PATCH] net/af_packet: fix for stale sockets

From: John W. Linville <hidden>
Date: 2019-08-23 15:30:18

On Thu, Aug 22, 2019 at 11:55:36AM +0530, Abhishek Sachan wrote:
af_packet driver is leaving stale socket after device is removed.
Ring buffers are memory mapped when device is added using rte_dev_probe.
There is no corresponding munmap call when device is removed/closed.
This commit fixes the issue by calling munmap
from rte_pmd_af_packet_remove().

Bugzilla ID: 339
Cc: stable@dpdk.org

Signed-off-by: Abhishek Sachan <redacted>
Reviewed-by: John W. Linville <redacted>
Confirmed...

Reviewed-by: John W. Linville <redacted>

John
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

Re: [dpdk-dev] [dpdk-stable] [PATCH] net/af_packet: fix for stale sockets

From: Ferruh Yigit <hidden>
Date: 2019-08-27 13:37:49

On 8/23/2019 4:28 PM, John W. Linville wrote:
On Thu, Aug 22, 2019 at 11:55:36AM +0530, Abhishek Sachan wrote:
quoted
af_packet driver is leaving stale socket after device is removed.
Ring buffers are memory mapped when device is added using rte_dev_probe.
There is no corresponding munmap call when device is removed/closed.
This commit fixes the issue by calling munmap
from rte_pmd_af_packet_remove().

Bugzilla ID: 339
Cc: stable@dpdk.org

Signed-off-by: Abhishek Sachan <redacted>
Reviewed-by: John W. Linville <redacted>
Confirmed...

Reviewed-by: John W. Linville <redacted>
Applied to dpdk-next-net/master, thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help