Yzgeav Zohar
Yzgeav Zohar

Reputation: 175

DPDK "number of ports must be even" one ethernet device

I am trying to run the skeleton example from DPDK source but whenever I am trying to build the code after a make process I get an error says: "number of ports must be even" however when I try to see the list of my Ethernet devices all I can see is only one device (I'm running the skeleton example in Ubuntu under vmware workstation environment)

I thought about trying to simulate another Ethernet device, is that possible? what should I do to make the skeleton example run?

Upvotes: 3

Views: 2747

Answers (1)

kso
kso

Reputation: 141

I am using virtualbox (with Ubuntu 16.04 guest) and followed most of the instructions in these two guides to have two virtual Ethernet devices to test on:

http://plvision.eu/blog/deploying-intel-dpdk-in-oracle-virtualbox/ http://dpdk.org/doc/quick-start

The things I did were:

a. In virtualbox to enable the two bridged NIC in virtual machine I picked the desktop version of Intel Pro/1000 MT instead:

Settings > Network > Adaptor 1 > Bridged > Adaptor Type > Intel Pro/1000 MT Desktop (82540EM)

In the virtual machine make sure your environment shows two Ethernet devices.

$ ip addr
2: enp0s3: 
[ more output ommitted ]
3: enp0s8: 
[ more output ommitted ]

b. Install DPDK prerequisites.

$ sudo apt-get install libpcap-dev gcc make hugepages nim
$ sudo apt-get install linux-headers-generic

Download DPDK, untar and

$ make config T=x86_64-native-linuxapp-gcc
$ sed -ri 's,(PMD_PCAP=).*,\1y,' build/.config
$ make -j2
$ sudo make install

c. Export environment variables in ~/.bashrc

export RTE_SDK=/usr/local/share/dpdk/
export RTE_TARGET=x86_64-native-linuxapp-gcc

Restart console to source the newly exported variables.

d. Enable hugepages:

$ sudo sh -c 'echo 64 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages'

e. Then I ran the skeleton example like this, specifying the two ports:

$ sudo ./basicfwd -c1 -n1 --vdev=eth_pcap0,iface=enp0s3 --vdev=eth_pcap1,iface=enp0s8
[sudo] password for ubuntu: 
EAL: Detected 2 lcore(s)
EAL: Probing VFIO support...
EAL: WARNING: cpu flags constant_tsc=yes nonstop_tsc=no -> using unreliable clock cycles !
PMD: Initializing pmd_pcap for eth_pcap0
PMD: Creating pcap-backed ethdev on numa socket 0
PMD: Initializing pmd_pcap for eth_pcap1
PMD: Creating pcap-backed ethdev on numa socket 0
PMD: bnxt_rte_pmd_init() called for (null)
EAL: PCI device 0000:00:03.0 on NUMA socket -1
EAL:   probe driver: 8086:100e rte_em_pmd
EAL: PCI device 0000:00:08.0 on NUMA socket -1
EAL:   probe driver: 8086:100e rte_em_pmd
Port 0 MAC: 00 00 00 01 02 03
Port 1 MAC: 00 00 00 01 02 03
Core 0 forwarding packets. [Ctrl+C to quit]

Upvotes: 3

Related Questions