I'm studying DPDK and trying to create a simple application, however it can't see a NIC bound to DPDK.
- Here is a list of network devices I have on my machine
$ dpdk-devbind.py --status-dev net
Network devices using kernel driver
===================================
0000:01:00.0 'RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller 8168' if=enp1s0 drv=r8169 unused=vfio-pci *Active*
0000:02:00.0 'RTL8822BE 802.11a/b/g/n/ac WiFi adapter b822' if=wlp2s0 drv=rtw_8822be unused=rtw88_8822be,vfio-pci *Active*
- I disable my ethernet NIC (it can't be bound to DPDK while it is active) and bind it to vfio-pci driver successfully
$ ip link set enp1s0 down
$ dpdk-devbind.py -b vfio-pci enp1s0
- Now dpdk-devbind.py shows that the NIC is using DPDK-compatible driver
$ dpdk-devbind.py --status-dev net
Network devices using DPDK-compatible driver
============================================
0000:01:00.0 'RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller 8168' drv=vfio-pci unused=r8169
Network devices using kernel driver
===================================
0000:02:00.0 'RTL8822BE 802.11a/b/g/n/ac WiFi adapter b822' if=wlp2s0 drv=rtw_8822be unused=rtw88_8822be,vfio-pci *Active*
- However when I run any example DPDK application it says that there are no available NIC ports. For instance I wrote a simple application
int main(int argc, char *argv[])
{
int ret;
int total_ports, avail_ports;
ret = rte_eal_init(argc, argv);
if( ret < 0 )
rte_exit(EXIT_FAILURE, "EAL initialization failed\n");
total_ports = rte_eth_dev_count_total();
avail_ports = rte_eth_dev_count_avail();
printf("ETH PORTS %d %d\n", total_ports, avail_ports);
rte_eal_cleanup();
return 0;
}
and both rte_eth_dev_count_total() and rte_eth_dev_count_avail() return 0.
What am I doing wrong?
CodePudding user response:
The main reason why DPDK ports are not identified in your environment is because the NIC in use is not having a supported vendor Poll Mode Driver. Please refer to list of supported NIC from various vendor Realtek is not among them.
Work around: you can use PCAP PMD to solve the problem. Please follow the steps for your environment as
- ensure your ethernet port is linked to kernel driver
r8169
- isntall libpacp-dev for your enviorment (linux/bsd)
- rebuild dpdk with PCAP support.
- start your application with following args
--no-pci --vdev=net_pcap0,iface=enp1s0
This will use libpcap PMD as wrapper for RX and TX over non supported NIC