• Johan Almbladh's avatar
    xdp: Fix spurious packet loss in generic XDP TX path · 1fd6e567
    Johan Almbladh authored
    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: default avatarJohan Almbladh <johan.almbladh@anyfinetworks.com>
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    Link: https://lore.kernel.org/bpf/20220705082345.2494312-1-johan.almbladh@anyfinetworks.com
    1fd6e567
dev.c 286 KB