ethdev: fix PCI device release in secondary process
authorHuisong Li <lihuisong@huawei.com>
Thu, 21 Oct 2021 02:24:21 +0000 (10:24 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 21 Oct 2021 21:15:34 +0000 (23:15 +0200)
commit17faaed85449b58b209150906d2ad2cbfd853150
treecbce894bbe3ec73778a189b366de69f75f8f52b6
parent00ea15e7a39617903ad39a9b89280a028ec7783a
ethdev: fix PCI device release in secondary process

In secondary process, rte_eth_dev_close() doesn't clear eth_dev->data.
If calling rte_dev_remove() after rte_eth_dev_close(), in
rte_eth_dev_pci_generic_remove() function, the released eth device still
can be found by its name in shared memory. As a result, the eth device
will be released repeatedly. The state of the eth device is modified to
RTE_ETH_DEV_UNUSED after rte_eth_dev_close(). So this state can be used
to avoid this problem.

Fixes: dcd5c8112bc3 ("ethdev: add PCI driver helpers")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
lib/ethdev/ethdev_pci.h