This patch initiate refactoring of Virtio PCI, by introducing
a new device structure for PCI-specific metadata.

Signed-off-by: Maxime Coquelin <maxime.coque...@redhat.com>
---
 drivers/net/virtio/virtio_ethdev.c | 2 +-
 drivers/net/virtio/virtio_pci.h    | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c 
b/drivers/net/virtio/virtio_ethdev.c
index 3ace25ac80..99a5a1bb88 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -2151,7 +2151,7 @@ static int eth_virtio_pci_probe(struct rte_pci_driver 
*pci_drv __rte_unused,
        if (vdpa == 1)
                return 1;
 
-       return rte_eth_dev_pci_generic_probe(pci_dev, sizeof(struct virtio_hw),
+       return rte_eth_dev_pci_generic_probe(pci_dev, sizeof(struct 
virtio_pci_dev),
                eth_virtio_dev_init);
 }
 
diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h
index b35a596169..8d3dc0e22e 100644
--- a/drivers/net/virtio/virtio_pci.h
+++ b/drivers/net/virtio/virtio_pci.h
@@ -289,6 +289,11 @@ struct virtio_hw {
        struct virtqueue **vqs;
 };
 
+struct virtio_pci_dev {
+       struct virtio_hw hw;
+};
+
+#define virtio_pci_get_dev(hw) container_of(hw, struct virtio_pci_dev, hw)
 
 /*
  * While virtio_hw is stored in shared memory, this structure stores
-- 
2.29.2

Reply via email to