]> git.droids-corp.org - dpdk.git/commit
net/af_packet: fix ignoring full ring on Tx
authorTudor Cornea <tudor.cornea@gmail.com>
Tue, 2 Nov 2021 15:47:24 +0000 (17:47 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 4 Nov 2021 11:56:32 +0000 (12:56 +0100)
commitf86d553cc180f9a65e115edb5641a49bbf2cf2f0
tree2c62a3f9d9ba022b4df4c4e51c9f4c0f9bfa96c4
parentb75d85b7668a132f72cbda92d65296b73e964780
net/af_packet: fix ignoring full ring on Tx

The poll call can return POLLERR which is ignored, or it can return
POLLOUT, even if there are no free frames in the mmap-ed area.

We can account for both of these cases by re-checking if the next
frame is empty before writing into it.

We have attempted to reproduce this issue with pktgen-dpdk, using the
following configuration.

pktgen -l 1-4 -n 4 --proc-type=primary --no-pci --no-telemetry \
    --no-huge -m 512 \
    --vdev=net_af_packet0,iface=eth1,blocksz=16384,framesz=8192, \
    framecnt=2048,qpairs=1,qdisc_bypass=0 \
    -- \
    -P \
    -T \
    -m "3.0" \
    -f themes/black-yellow.theme

We configure a low tx rate (~ 335 packets / second) and a small
packet size, of about 300 Bytes from the pktgen CLI.

set 0 size 300
set 0 rate 0.008
set 0 burst 1
start 0

After bringing the interface down, and up again, we seem to arrive
in a state in which the tx rate is inconsistent, and does not recover.

ifconfig eth1 down; sleep 7; ifconfig eth1 up

[1] http://code.dpdk.org/pktgen-dpdk/pktgen-20.11.2/source/INSTALL.md

Fixes: 364e08f2bbc0 ("af_packet: add PMD for AF_PACKET-based virtual devices")
Cc: stable@dpdk.org
Signed-off-by: Mihai Pogonaru <pogonarumihai@gmail.com>
Signed-off-by: Tudor Cornea <tudor.cornea@gmail.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
drivers/net/af_packet/rte_eth_af_packet.c