[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <996136f1-9271-42db-8b8f-8d595098a3a7@intel.com>
Date: Wed, 18 Jun 2025 18:43:50 +0200
From: Alexander Lobakin <aleksander.lobakin@...el.com>
To: Til Kaiser <mail@...54.de>
CC: Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann
<daniel@...earbox.net>, "David S. Miller" <davem@...emloft.net>, "Jakub
Kicinski" <kuba@...nel.org>, Jesper Dangaard Brouer <hawk@...nel.org>, "John
Fastabend" <john.fastabend@...il.com>, <netdev@...r.kernel.org>,
<bpf@...r.kernel.org>
Subject: Re: Configurable XDP Generic Packet Headroom to avoid SKB
re-allocation
From: Til Kaiser <mail@...54.de>
Date: Wed, 18 Jun 2025 17:03:49 +0200
> 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].
Every more or less serious driver implements driver-side XDP and the
generic one is not performance-oriented due to being generic and how it
does work.
>
> 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.
What I also thought of:
1. Can we notify the drivers that the user installed an XDP prog, so
that the driver could adjust its headroom even in case of generic
XDP?
2. Can we maybe extract the needed headroom from the program itself in
the verifier?
>
> Kind regards
> Til
>
> [1] https://patchwork.kernel.org/project/netdevbpf/
> patch/039064e87f19f93e0d0347fc8e5c692c789774e6.1647630686.git.lorenzo@...nel.org
> [2] https://patchwork.kernel.org/project/netdevbpf/
> patch/20220314102210.92329-1-nbd@....name
> [3] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
> tree/net/core/dev.c?h=v6.15.2#n5279
Thanks,
Olek
Powered by blists - more mailing lists