patches for DPDK stable branches
 help / color / Atom feed
* [dpdk-stable] [PATCH] net/thunderx: fix nicvf cleanup on detaching PCI dev
@ 2019-08-05  8:00 agupta3
  2019-08-05 17:05 ` Jerin Jacob Kollanukkaran
  0 siblings, 1 reply; 2+ messages in thread
From: agupta3 @ 2019-08-05  8:00 UTC (permalink / raw)
  To: Jerin Jacob, Maciej Czekaj, Anatoly Burakov; +Cc: dev, stable, Amit Gupta

From: Amit Gupta <agupta3@marvell.com>

There was a bug while doing PCI detach because of that
app gets seg fault as eth_dev is released without
stopping/cleaning up mapped nicvf.

Fixed this bug by adding nicvf cleanup stupport on PCI detach.

Fixes: fdf91e0f2fac ("drivers/net: do not use ethdev driver")
Signed-off-by: Amit Gupta <agupta3@marvell.com>
---
 drivers/net/thunderx/nicvf_ethdev.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index ec57692..56769ef 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -2083,6 +2083,16 @@ static void nicvf_vf_stop(struct rte_eth_dev *dev, struct nicvf *nic,
 	return ret;
 }
 static int
+nicvf_eth_dev_uninit(struct rte_eth_dev *dev)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
+		nicvf_dev_close(dev);
+
+	return 0;
+}
+static int
 nicvf_eth_dev_init(struct rte_eth_dev *eth_dev)
 {
 	int ret;
@@ -2256,7 +2266,7 @@ static int nicvf_eth_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 
 static int nicvf_eth_pci_remove(struct rte_pci_device *pci_dev)
 {
-	return rte_eth_dev_pci_generic_remove(pci_dev, NULL);
+	return rte_eth_dev_pci_generic_remove(pci_dev, nicvf_eth_dev_uninit);
 }
 
 static struct rte_pci_driver rte_nicvf_pmd = {
-- 
1.8.3.1


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

* Re: [dpdk-stable] [PATCH] net/thunderx: fix nicvf cleanup on detaching PCI dev
  2019-08-05  8:00 [dpdk-stable] [PATCH] net/thunderx: fix nicvf cleanup on detaching PCI dev agupta3
@ 2019-08-05 17:05 ` Jerin Jacob Kollanukkaran
  0 siblings, 0 replies; 2+ messages in thread
From: Jerin Jacob Kollanukkaran @ 2019-08-05 17:05 UTC (permalink / raw)
  To: Amit Gupta, Maciej Czekaj, Anatoly Burakov; +Cc: dev, stable, Amit Gupta

> -----Original Message-----
> From: agupta3@marvell.com <agupta3@marvell.com>
> Sent: Monday, August 5, 2019 1:31 PM
> To: Jerin Jacob Kollanukkaran <jerinj@marvell.com>; Maciej Czekaj
> <mczekaj@marvell.com>; Anatoly Burakov <anatoly.burakov@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org; Amit Gupta <agupta3@marvell.com>
> Subject: [PATCH] net/thunderx: fix nicvf cleanup on detaching PCI dev
> 
> From: Amit Gupta <agupta3@marvell.com>
> 
> There was a bug while doing PCI detach because of that app gets seg fault as
> eth_dev is released without stopping/cleaning up mapped nicvf.
> 
> Fixed this bug by adding nicvf cleanup stupport on PCI detach.
> 
> Fixes: fdf91e0f2fac ("drivers/net: do not use ethdev driver")
> Signed-off-by: Amit Gupta <agupta3@marvell.com>

Cc: stable@dpdk.org

Acked-by: Jerin Jacob <jerinj@marvell.com>

Fixed check-git-log.sh issues and applied to dpdk-next-net-mrvl/master. Thanks

> ---
>  drivers/net/thunderx/nicvf_ethdev.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/thunderx/nicvf_ethdev.c
> b/drivers/net/thunderx/nicvf_ethdev.c
> index ec57692..56769ef 100644
> --- a/drivers/net/thunderx/nicvf_ethdev.c
> +++ b/drivers/net/thunderx/nicvf_ethdev.c
> @@ -2083,6 +2083,16 @@ static void nicvf_vf_stop(struct rte_eth_dev *dev,
> struct nicvf *nic,
>  	return ret;
>  }
>  static int
> +nicvf_eth_dev_uninit(struct rte_eth_dev *dev) {
> +	PMD_INIT_FUNC_TRACE();
> +
> +	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
> +		nicvf_dev_close(dev);
> +
> +	return 0;
> +}
> +static int
>  nicvf_eth_dev_init(struct rte_eth_dev *eth_dev)  {
>  	int ret;
> @@ -2256,7 +2266,7 @@ static int nicvf_eth_pci_probe(struct rte_pci_driver
> *pci_drv __rte_unused,
> 
>  static int nicvf_eth_pci_remove(struct rte_pci_device *pci_dev)  {
> -	return rte_eth_dev_pci_generic_remove(pci_dev, NULL);
> +	return rte_eth_dev_pci_generic_remove(pci_dev,
> nicvf_eth_dev_uninit);
>  }
> 
>  static struct rte_pci_driver rte_nicvf_pmd = {
> --
> 1.8.3.1


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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-05  8:00 [dpdk-stable] [PATCH] net/thunderx: fix nicvf cleanup on detaching PCI dev agupta3
2019-08-05 17:05 ` Jerin Jacob Kollanukkaran

patches for DPDK stable branches

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/ public-inbox