]> git.droids-corp.org - dpdk.git/commitdiff
net/virtio: unmap PCI device in secondary process
authorYuan Wang <yuanx.wang@intel.com>
Mon, 6 Jun 2022 15:55:43 +0000 (23:55 +0800)
committerMaxime Coquelin <maxime.coquelin@redhat.com>
Tue, 21 Jun 2022 09:24:15 +0000 (11:24 +0200)
In multi-process, the secondary process will remap PCI during
initialization, but the mapping is not removed in the uninit path,
the device is not closed, and the device busy error will be reported
when the device is hotplugged.

This patch unmaps PCI device at secondary process uninitialization
based on virtio_rempa_pci.

Fixes: 36a7a2e7a53f ("net/virtio: move PCI device init in dedicated file")
Cc: stable@dpdk.org
Signed-off-by: Yuan Wang <yuanx.wang@intel.com>
Tested-by: Wei Ling <weix.ling@intel.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
drivers/net/virtio/virtio_pci_ethdev.c

index 54645dc62ec1af7c36d42091fb349552e15149a9..1f6bdedddab38fcf95714d211d405c3677bc0190 100644 (file)
@@ -122,10 +122,20 @@ static int
 eth_virtio_pci_uninit(struct rte_eth_dev *eth_dev)
 {
        int ret;
+       struct virtio_pci_dev *dev;
+       struct virtio_hw *hw;
        PMD_INIT_FUNC_TRACE();
 
-       if (rte_eal_process_type() == RTE_PROC_SECONDARY)
+       if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+               dev = eth_dev->data->dev_private;
+               hw = &dev->hw;
+
+               if (dev->modern)
+                       rte_pci_unmap_device(RTE_ETH_DEV_TO_PCI(eth_dev));
+               else
+                       vtpci_legacy_ioport_unmap(hw);
                return 0;
+       }
 
        ret = virtio_dev_stop(eth_dev);
        virtio_dev_close(eth_dev);