MCPcopy Create free account
hub / github.com/F-Stack/f-stack / eth_virtio_pci_init

Function eth_virtio_pci_init

dpdk/drivers/net/virtio/virtio_pci_ethdev.c:71–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71static int
72eth_virtio_pci_init(struct rte_eth_dev *eth_dev)
73{
74 struct virtio_pci_dev *dev = eth_dev->data->dev_private;
75 struct virtio_hw *hw = &dev->hw;
76 struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
77 int ret;
78
79 if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
80 hw->port_id = eth_dev->data->port_id;
81 VTPCI_DEV(hw) = pci_dev;
82 ret = vtpci_init(RTE_ETH_DEV_TO_PCI(eth_dev), dev);
83 if (ret) {
84 PMD_INIT_LOG(ERR, "Failed to init PCI device");
85 return -1;
86 }
87 } else {
88 VTPCI_DEV(hw) = pci_dev;
89 if (dev->modern)
90 VIRTIO_OPS(hw) = &modern_ops;
91 else
92 VIRTIO_OPS(hw) = &legacy_ops;
93
94 ret = virtio_remap_pci(RTE_ETH_DEV_TO_PCI(eth_dev), dev);
95 if (ret < 0) {
96 PMD_INIT_LOG(ERR, "Failed to remap PCI device");
97 return -1;
98 }
99 }
100
101 ret = eth_virtio_dev_init(eth_dev);
102 if (ret < 0) {
103 PMD_INIT_LOG(ERR, "Failed to init virtio device");
104 goto err_unmap;
105 }
106
107 PMD_INIT_LOG(DEBUG, "port %d vendorID=0x%x deviceID=0x%x",
108 eth_dev->data->port_id, pci_dev->id.vendor_id,
109 pci_dev->id.device_id);
110
111 return 0;
112
113err_unmap:
114 rte_pci_unmap_device(RTE_ETH_DEV_TO_PCI(eth_dev));
115 if (!dev->modern)
116 vtpci_legacy_ioport_unmap(hw);
117
118 return ret;
119}
120
121static int
122eth_virtio_pci_uninit(struct rte_eth_dev *eth_dev)

Callers

nothing calls this directly

Calls 6

rte_eal_process_typeFunction · 0.85
vtpci_initFunction · 0.85
virtio_remap_pciFunction · 0.85
eth_virtio_dev_initFunction · 0.85
rte_pci_unmap_deviceFunction · 0.50

Tested by

no test coverage detected