If a pci probe operation creates a port but, for any reason, fails to finish this operation and decides to delete the newly created port, then the last created port id can not be trusted anymore and any subsequent attach operations will fail. This problem was noticed while working on a vm that had a virtio-net management interface bound to the virtio-net kernel driver and no port whitelisted in the commandline: root@ubuntu1404:~/dpdk# ./build/app/testpmd -c 0x6 -- -i --total-num-mbufs=2049 EAL: Detected 3 lcore(s) EAL: Probing VFIO support... EAL: Debug logs available - lower performance EAL: WARNING: cpu flags constant_tsc=yes nonstop_tsc=no -> using unreliable clock cycles ! EAL: PCI device 0000:00:03.0 on NUMA socket -1 EAL: probe driver: 1af4:1000 (null) rte_eth_dev_pci_probe: driver (null): eth_dev_init(vendor_id=0x6900 device_id=0x1000) failed EAL: No probed ethernet devices ^ | Here, rte_eth_dev_pci_probe() fails since vtpci_init() reports an error. This results in a rte_eth_dev_release_port() right after a rte_eth_dev_allocate(). Then, if we try to attach a port using rte_eth_dev_attach: testpmd> port attach net_ring0 Attaching a new port... PMD: Initializing pmd_ring for net_ring0 PMD: Creating rings-backed ethdev on numa socket 0 Two solutions: - either update the last created port index to something invalid (when freeing a ethdev port), - or rely on the port count, before and after the eal attach. The latter solution seems (well not really more robust but at least) less fragile than the former. We still have some issues with drivers that create multiple ethdev ports with a single probe operation, but this was already the case. Fixes: b0fb26685570 ("ethdev: convert to EAL hotplug") Reported-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com> Signed-off-by: David Marchand <david.marchand@6wind.com>
DPDK is a set of libraries and drivers for fast packet processing. It supports many processor architectures and both FreeBSD and Linux. The DPDK uses the Open Source BSD license for the core libraries and drivers. The kernel components are GPLv2 licensed. Please check the doc directory for release notes, API documentation, and sample application information. For questions and usage discussions, subscribe to: users@dpdk.org Report bugs and issues to the development mailing list: dev@dpdk.org
Description
Languages
C
99.1%
Meson
0.5%
Python
0.2%
Shell
0.1%