I built the dpdk environment step by step according to the tutorial on the official website. When I ran dpdk/examples/skeleton/build/basicfwd.This program does not run as expected.
My env:
Virtual machine started by Virtual box.
DPDK version: v24.03.
NIC:
[root@localhost build]# dpdk-devbind –status
Network devices using DPDK-compatible driver
0000:00:09.0 ‘82540EM Gigabit Ethernet Controller 100e’ drv=vfio-pci unused=e1000,uio_pci_generic
0000:00:0a.0 ‘82540EM Gigabit Ethernet Controller 100e’ drv=vfio-pci unused=e1000,uio_pci_generic
HugePage:
[root@localhost ~]# cat /proc/meminfo | grep Huge
AnonHugePages: 59392 kB
ShmemHugePages: 0 kB
FileHugePages: 0 kB
HugePages_Total: 1024
HugePages_Free: 1004
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
Hugetlb: 2097152 kB
I tried to modify the code and found that nb_rx was always 0. How should I run this example correctly? Does this code require me to pass in data packets after it is run? what should I do?
Code:
for (;;) {
/*
* Receive packets on a port and forward them on the paired
* port. The mapping is 0 -> 1, 1 -> 0, 2 -> 3, 3 -> 2, etc.
*/
RTE_ETH_FOREACH_DEV(port) {
/* Get burst of RX packets, from first port of pair. */
struct rte_mbuf *bufs[BURST_SIZE];
const uint16_t nb_rx = rte_eth_rx_burst(port, 0,
bufs, BURST_SIZE);
if (unlikely(nb_rx == 0)) {
printf("nb_rx == 0");
continue;
}
/* Send burst of TX packets, to second port of pair. */
const uint16_t nb_tx = rte_eth_tx_burst(port ^ 1, 0,
bufs, nb_rx);
/* Free any unsent packets. */
if (unlikely(nb_tx < nb_rx)) {
uint16_t buf;
for (buf = nb_tx; buf < nb_rx; buf++)
rte_pktmbuf_free(bufs[buf]);
}
}
}
Output:
[root@localhost build]# ./basicfwd -l 1 -n 4
EAL: Detected CPU lcores: 8
EAL: Detected NUMA nodes: 1
EAL: Detected shared linkage of DPDK
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode ‘PA’
EAL: VFIO support initialized
EAL: Using IOMMU type 8 (No-IOMMU)
EAL: Ignore mapping IO port bar(2)
EAL: Probe PCI driver: net_e1000_em (8086:100e) device: 0000:00:09.0 (socket -1)
EAL: Ignore mapping IO port bar(2)
EAL: Probe PCI driver: net_e1000_em (8086:100e) device: 0000:00:0a.0 (socket -1)
TELEMETRY: No legacy callbacks, legacy socket not created
EAL: Error enabling MSI-X interrupts for fd 20
Port 0 MAC: 08 00 27 c0 75 f5
EAL: Error enabling MSI-X interrupts for fd 27
Port 1 MAC: 08 00 27 b0 c9 f0
Core 1 forwarding packets. [Ctrl+C to quit]
nb_rx == 0nb_rx == 0nb_rx == 0nb_rx == 0nb_rx == 0nb_rx == 0nb_rx == 0nb_rx == 0nb_rx == 0nb_rx == 0nb_rx == 0nb_rx == 0nb_rx == 0nb_rx == 0nb_rx == 0nb_rx == 0……..
This problem has troubled me for many days.I expect this example to run normally.Thanks.
zhendewokusi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.