Re: [RFC bpf-next 0/4] Add XDP rx hw hints support performing XDP_REDIRECT

Alexander Lobakin
2024-09-21T20:17:23Z

From: Lorenzo Bianconi <lorenzo@kernel.org>
Date: Sat, 21 Sep 2024 18:52:56 +0200

> This series introduces the xdp_rx_meta struct in the xdp_buff/xdp_frame

&xdp_buff is on the stack.
&xdp_frame consumes headroom.

IOW they're size-sensitive and putting metadata directly there might
play bad; if not now, then later.

Our idea (me + Toke) was as follows:

- new BPF kfunc to build generic meta. If called, the driver builds a
generic meta with hash, csum etc., in the data_meta area.
Yes, this also consumes headroom, but only when the corresponding func
is called. Introducing new fields like you're doing will consume it
unconditionally;
- when &xdp_frame gets converted to sk_buff, the function checks whether
data_meta contains a generic structure filled with hints.

We also thought about &skb_shared_info, but it's also size-sensitive as
it consumes tailroom.

> one as a container to store the already supported xdp rx hw hints (rx_hash
> and rx_vlan, rx_timestamp will be stored in skb_shared_info area) when the
> eBPF program running on the nic performs XDP_REDIRECT. Doing so, we are able
> to set the skb metadata converting the xdp_buff/xdp_frame to a skb.

Thanks,
Olek