]> git.baikalelectronics.ru Git - kernel.git/commit
xdp: Fix spurious packet loss in generic XDP TX path
authorJohan Almbladh <johan.almbladh@anyfinetworks.com>
Tue, 5 Jul 2022 08:23:45 +0000 (10:23 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 6 Jul 2022 14:43:53 +0000 (16:43 +0200)
commit384122009f2f2b8b059a59f347ab1ae0005dd5b9
tree926b8eea48ab4d54f7d3b0284557b52f1a0f7e66
parent156181d45340f8f1b754a5dd3ad159905ec5d321
xdp: Fix spurious packet loss in generic XDP TX path

The byte queue limits (BQL) mechanism is intended to move queuing from
the driver to the network stack in order to reduce latency caused by
excessive queuing in hardware. However, when transmitting or redirecting
a packet using generic XDP, the qdisc layer is bypassed and there are no
additional queues. Since netif_xmit_stopped() also takes BQL limits into
account, but without having any alternative queuing, packets are
silently dropped.

This patch modifies the drop condition to only consider cases when the
driver itself cannot accept any more packets. This is analogous to the
condition in __dev_direct_xmit(). Dropped packets are also counted on
the device.

Bypassing the qdisc layer in the generic XDP TX path means that XDP
packets are able to starve other packets going through a qdisc, and
DDOS attacks will be more effective. In-driver-XDP use dedicated TX
queues, so they do not have this starvation issue.

Signed-off-by: Johan Almbladh <johan.almbladh@anyfinetworks.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20220705082345.2494312-1-johan.almbladh@anyfinetworks.com
net/core/dev.c