Hello,
While investigating performance issues with XDP in generic mode, I
noticed frequent SKB re-allocations due to insufficient headroom, an
issue also discussed in earlier proposals such as [1] and [2].
Currently, netif_receive_generic_xdp() checks against a fixed
XDP_PACKET_HEADROOM (256 Bytes) [3].
I would like to propose making the generic XDP headroom configurable per
interface via a new member in struct net_device, e.g.,
xdp_generic_headroom initialized to XDP_PACKET_HEADROOM at device
allocation. The user can change its value via Netlink and/or sysfs
before the XDP Generic program is attached to the interface, and
netif_receive_generic_xdp() then uses this instead of the hardcoded
headroom. When the XDP Generic program is detached, it is automatically
reset to the default XDP_PACKET_HEADROOM value to avoid conflicts with
future programs.
This would allow users to avoid unnecessary SKB re-allocations if they
know their program’s headroom requirements in advance.
Would this be a viable alternative? I’d be happy to prototype a patch.
Kind regards
Til
[1]
https://patchwork.kernel.org/project/netdevbpf/patch/039064e87f19f93e0d0347fc8e5c692c789774e6.1647630686.git.lorenzo@xxxxxxxxxx
[2]
https://patchwork.kernel.org/project/netdevbpf/patch/20220314102210.92329-1-nbd@xxxxxxxx
[3]
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/net/core/dev.c?h=v6.15.2#n5279