Subject: Re: [PATCH bpf-next V2 0/7] xdp: Allow BPF to set RX hints for XDP_REDIRECTed packets

From: Martin KaFai Lau <[email-masked]>
Date: Tue, 5 Aug 2025 18:24:18 -0700

On 8/4/25 6:18 AM, Jesper Dangaard Brouer wrote:
> Do keep-in-mind that "moving skb allocation out of the driver" is not
> part of this patchset and a moonshot goal that will take a long time
> (but we are already "simulation" this via XDP-redirect for years now).

The XDP_PASS was first done in the very early days of BPF in 2016. The 
XDP-redirect then followed a similar setup. A lot has improved since then. A 
moonshot in 2016 does not necessarily mean it is still hard to do now. e.g. Loop 
is feasible. Directly reading/writing skb is also easier.

Let’s first quantify what the performance loss would be if the skb is allocated 
and field-set by the xdp prog (for the general XDP_PASS case and the 
redirect+cpumap case). If it’s really worth it, let’s see what it would take for 
the XDP program to achieve similar optimizations.

> Drivers should obviously not unconditionally populate the xdp_frame's
> rx_meta area.  It is first time to populate rx_meta, once driver reach

afaict, the rx_meta is reserved regardless though. The xdp prog cannot use that 
space for data_meta. The rx_meta will grow in time.

My preference is to allow xdp prog to decide what needs to write in data_meta 
and decides what needs to set in the skb directly. This is the general case it 
should support first and then optimize.