Can DPDK selectively init NIC ports

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?

Have you tried ‘-w’ parameter in order to let know what port should be used by DPDK application?

Please try to debug DPDK more and see if the issue is strictly related to Mellanox PMD and if not, it is better to raise the question on DPDK forum.