[dpdk-dev] [PATCH 2/3] virtio: move rte_eal_pci_unmap_device() to virtio_pci.c
Tetsuya Mukawa
mukawa at igel.co.jp
Mon Jan 18 10:13:08 CET 2016
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..b98d195 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(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 f1a6ee9..ffcd2fa 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -872,3 +872,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 99572a0..ec1d46b 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
More information about the dev
mailing list