patches for DPDK stable branches
 help / color / mirror / Atom feed
From: <agupta3@marvell.com>
To: Jerin Jacob <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: [dpdk-stable] [PATCH] net/thunderx: fix nicvf cleanup on detaching PCI dev
Date: Mon, 5 Aug 2019 13:30:44 +0530	[thread overview]
Message-ID: <1564992051-11150-1-git-send-email-agupta3@marvell.com> (raw)

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


             reply	other threads:[~2019-08-05  8:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-05  8:00 agupta3 [this message]
2019-08-05 17:05 ` Jerin Jacob Kollanukkaran

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1564992051-11150-1-git-send-email-agupta3@marvell.com \
    --to=agupta3@marvell.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=mczekaj@marvell.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).