To abstract pci access method, the patch moves below function
to "virtio_pci.c".
 - rte_eal_pci_unmap_device()

Signed-off-by: Tetsuya Mukawa <mukawa at igel.co.jp>
---
 drivers/net/virtio/virtio_ethdev.c |  2 +-
 drivers/net/virtio/virtio_pci.c    | 11 +++++++++++
 drivers/net/virtio/virtio_pci.h    |  1 +
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c 
b/drivers/net/virtio/virtio_ethdev.c
index deb0382..37833a8 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1177,7 +1177,7 @@ eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev)
                rte_intr_callback_unregister(&pci_dev->intr_handle,
                                                virtio_interrupt_handler,
                                                eth_dev);
-       rte_eal_pci_unmap_device(pci_dev);
+       vtpci_uninit(pci_dev, hw);

        PMD_INIT_LOG(DEBUG, "dev_uninit completed");

diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index 1fca39f..3e6be8c 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -892,3 +892,14 @@ vtpci_init(struct rte_pci_device *dev, struct virtio_hw 
*hw)

        return 0;
 }
+
+void
+vtpci_uninit(struct rte_pci_device *dev, struct virtio_hw *hw)
+{
+       hw->dev  = NULL;
+       hw->vtpci_ops = NULL;
+       hw->use_msix = 0;
+       hw->io_base  = 0;
+       hw->modern   = 0;
+       rte_eal_pci_unmap_device(dev);
+}
diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h
index 0544a07..17c7972 100644
--- a/drivers/net/virtio/virtio_pci.h
+++ b/drivers/net/virtio/virtio_pci.h
@@ -328,6 +328,7 @@ vtpci_with_feature(struct virtio_hw *hw, uint64_t bit)
  * Function declaration from virtio_pci.c
  */
 int vtpci_init(struct rte_pci_device *, struct virtio_hw *);
+void vtpci_uninit(struct rte_pci_device *dev, struct virtio_hw *);
 void vtpci_reset(struct virtio_hw *);

 void vtpci_reinit_complete(struct virtio_hw *);
-- 
2.1.4

Reply via email to