net/virtio: introduce PCI device metadata
This patch initiate refactoring of Virtio PCI, by introducing a new device structure for PCI-specific metadata. Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com> Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
This commit is contained in:
parent
65832c82e6
commit
f305ecbbb7
@ -2154,7 +2154,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);
|
||||
}
|
||||
|
||||
|
@ -689,6 +689,8 @@ next:
|
||||
int
|
||||
vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw)
|
||||
{
|
||||
RTE_BUILD_BUG_ON(offsetof(struct virtio_pci_dev, hw) != 0);
|
||||
|
||||
/*
|
||||
* Try if we can succeed reading virtio pci caps, which exists
|
||||
* only on modern pci device. If failed, we fallback to legacy
|
||||
|
@ -289,6 +289,11 @@ struct virtio_hw {
|
||||
struct virtqueue **vqs;
|
||||
};
|
||||
|
||||
struct virtio_pci_dev {
|
||||
struct virtio_hw hw;
|
||||
};
|
||||
|
||||
#define virtio_pci_get_dev(hwp) container_of(hwp, struct virtio_pci_dev, hw)
|
||||
|
||||
/*
|
||||
* While virtio_hw is stored in shared memory, this structure stores
|
||||
|
Loading…
x
Reference in New Issue
Block a user