patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 18.11] net/af_packet: fix for stale sockets
@ 2019-08-19 13:14 abhishek.sachan
  2019-08-19 18:35 ` John W. Linville
  2019-08-23 16:36 ` Kevin Traynor
  0 siblings, 2 replies; 3+ messages in thread
From: abhishek.sachan @ 2019-08-19 13:14 UTC (permalink / raw)
  To: linville; +Cc: stable, abhishek sachan

From: abhishek sachan <abhishek.sachan@altran.com>

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

Signed-off-by: abhishek sachan <abhishek.sachan@altran.com>
Reviewed-by: John W. Linville <linville@redhat.com>
---
 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 264cfc0..657ad85 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-stable] [PATCH 18.11] net/af_packet: fix for stale sockets
  2019-08-19 13:14 [dpdk-stable] [PATCH 18.11] net/af_packet: fix for stale sockets abhishek.sachan
@ 2019-08-19 18:35 ` John W. Linville
  2019-08-23 16:36 ` Kevin Traynor
  1 sibling, 0 replies; 3+ messages in thread
From: John W. Linville @ 2019-08-19 18:35 UTC (permalink / raw)
  To: abhishek.sachan; +Cc: stable

As indicated, I've already seen this patch. Please merge it as Abhishek
is requesting.

Thanks,

John

On Mon, Aug 19, 2019 at 06:44:20PM +0530, abhishek.sachan@altran.com wrote:
> From: abhishek sachan <abhishek.sachan@altran.com>
> 
> 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
> 
> Signed-off-by: abhishek sachan <abhishek.sachan@altran.com>
> Reviewed-by: John W. Linville <linville@redhat.com>
> ---
>  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 264cfc0..657ad85 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
> 
> 

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-stable] [PATCH 18.11] net/af_packet: fix for stale sockets
  2019-08-19 13:14 [dpdk-stable] [PATCH 18.11] net/af_packet: fix for stale sockets abhishek.sachan
  2019-08-19 18:35 ` John W. Linville
@ 2019-08-23 16:36 ` Kevin Traynor
  1 sibling, 0 replies; 3+ messages in thread
From: Kevin Traynor @ 2019-08-23 16:36 UTC (permalink / raw)
  To: abhishek.sachan, linville; +Cc: stable

On 19/08/2019 14:14, abhishek.sachan@altran.com wrote:
> From: abhishek sachan <abhishek.sachan@altran.com>
> 
> 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
> 

Thank you for the backport. I also see the patch on the ML for master -
will pick up for stable after it is merged into master.

Btw, if a patch on master has the right Fixes:/Cc:stable tags and
applies reasonably cleanly to stable, then it will be picked up for
stables as part of the normal process. Just fyi as it might save you
some effort sometime.

thanks,
Kevin.

> Signed-off-by: abhishek sachan <abhishek.sachan@altran.com>
> Reviewed-by: John W. Linville <linville@redhat.com>
> ---
>  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 264cfc0..657ad85 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);
>  	}
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-08-23 16:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-19 13:14 [dpdk-stable] [PATCH 18.11] net/af_packet: fix for stale sockets abhishek.sachan
2019-08-19 18:35 ` John W. Linville
2019-08-23 16:36 ` Kevin Traynor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).