From 230dce6461b92f36c819f1cf29c0c0e0f8d11ea8 Mon Sep 17 00:00:00 2001 From: Amit Gupta Date: Mon, 5 Aug 2019 13:30:44 +0530 Subject: [PATCH] net/thunderx: fix crash on detach Fix the PCIe detach segfault by releasing eth_dev resources by adding nicvf cleanup support on PCI detach. Fixes: fdf91e0f2fac ("drivers/net: do not use ethdev driver") Cc: stable@dpdk.org Signed-off-by: Amit Gupta Acked-by: Jerin Jacob --- 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 ec57692fb7..56769ef859 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -2083,6 +2083,16 @@ kvlist_free: 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 = { -- 2.20.1