I'm using an dual-port NIC, Mellanox ConnectX-5, and the DPDK version is dpdk-stable-19.11.3. After configuration, the call of rte_eth_dev_count_avail()
returns 2
. But only one port of my ConnectX-5 NIC is connected to the other machine. All I can find is to init all available ports like this.
RTE_ETH_FOREACH_DEV(portid)
if (port_init(portid, mbuf_pool) != 0)
rte_exit(EXIT_FAILURE, "Cannot init port %u\n", portid);
Can dpdk selectively init ports? Or is there any way to make rte_eth_dev_count_avail()
returning 1
?
Yes one can selectively init ports by passing the right PCIe
Bus:Device:Function
address as a whitelist. Hence only desired ports will pop up in the application.How to do it:
rte_eth_dev_stop & rte_eth_dev_close
for link down ports.execv
to invoke your desired DPDK application.this way you can run your application with valid ports to it.
But relying on
rte_eth_link_get
is tricky becauseifconfig [other nic] up
link.link_speed
if its valid.Hence safest and recommended way to use is
identify the NIC PCIe B:D:F in Linux driver and then whitelist the ports by using option -w for the desired port under igb_uio/virtio-pci
. This can be done by bind all NIC back in linux bylshw -c network -businfo
will list NIC and PCIeBus:Device:Function
with kerel device name and driver.ethtool [eth device name] | grep Link
to identify the link is connected.for reference, you can use https://github.com/vipinpv85/DPDK-APP_SAMPLES/blob/master/auto-baseaddr-selector.c as template for dummy applciation.