Thread View: linux.kernel.netdev
2 messages
2 total messages
Started by Stanislav Fomichev
Wed, 11 Nov 2026 22:25
Re: [PATCH bpf-next 00/15] xdp: add SKB core extensions to keep RX metadata until skb creation
Author: Stanislav Fomichev
Date: Wed, 11 Nov 2026 22:25
Date: Wed, 11 Nov 2026 22:25
38 lines
14442 bytes
14442 bytes
On 11/11, Tianyi Gao wrote: > Hi Stanislav, > > On 11/10, Stanislav Fomichev wrote: > > Awhile ago we discussed the alternative of adding setters for xdp > > metadata. Then the veth (or whoever turns xdp frame into an skb) can > > apply whatever metadata it needs (and there is some magic behind the > > scenes that takes it into account when creating an skb). That keeps > > the layout and most of the code outside of kernel. Have we considered > > that here? > > Thanks for the reminder. Yes, we considered [1] and [2], and took > parts of them. > > The alternative setter model in [1] requires a program on veth or > cpumap to call the setters for the RX metadata. We want to avoid that: > > - On veth, an XDP program removes software GSO from the peer, limits > its MTU, and can copy skbs from the peer. > - On cpumap, each entry would need a program only for this. > > This series achieves the same with only the XDP program on the NIC, > which stores the values with kfuncs in the skb core extension area > after the xdp_frame. cpumap and veth take this area into account when > they create the skb, which is the "magic behind the scenes". > > [1] https://lore.kernel.org/all/20250616145523.63bd2577@kernel.org/ > [2] https://lore.kernel.org/all/aGvcb53APFXR8eJb@mini-arch/ My main concern is that we are adding a lot of code and one more special way to plumb the metadata (and another metadata area), another set of kfuncs and slowly creeping more features into xdp making it more and more like skb. For containers in general, and for fast af_/xdp, we seem to have been moving into netkit with queue leasing. Maybe that's something that can help with your veth performance?
Re: [PATCH bpf-next 00/15] xdp: add SKB core extensions to keep RX metadata until skb creation
Author: Jesper Dangaard Brouer
Date: Tue, 01 Dec 2026 13:57
Date: Tue, 01 Dec 2026 13:57
58 lines
12256 bytes
12256 bytes
On 11/12/26 00:46, Tianyi Gao wrote:
>
> On 11/11, Stanislav Fomichev wrote:
[...]
>
>> and slowly creeping more features into xdp making it
>> more and more like skb.
>
> I will leave this to Jesper.
>
Stanislav, you made the key point yourself: an XDP prog that changes
the packet needs a way to correct the HW offload info [3]. After a
decap, the outer csum status no longer holds, and today BPF cannot
flip it to NONE. The prog also cannot change a stripped VLAN tag.
So this is not a new feature. It fixes what Jakub called "a known bug"
[6]: after XDP changes the packet, the HW offload info is stale, and
XDP has no way to tell the kernel which part it changed.
And it is not another metadata area. It is part of the xdp_frame. In
Alexei's sketch, struct xdp_rx_meta sits right after struct xdp_frame,
in the same cache line, and flag bits in xdp->flags say which fields
are valid. It also has the same life as the xdp_frame. The prog writes
only the values it changed. In my proposal [7], the driver fills the
rest after the prog has run, and only for a frame that survives XDP.
So XDP_DROP does not touch it, and XDP_DROP performance stays the same.
data_meta and this area have different owners and different readers:
- data_meta belongs to the BPF progs. They define the format, and
BPF progs (XDP, TC) or AF_XDP read it.
- This area belongs to the kernel. The kernel defines the format, and
the kernel reads it when it builds the skb.
So they do not overlap. The kernel cannot use data_meta, because it
does not know the format.
A driver-local setter would also work, but only while the driver
builds the skb itself, on XDP_PASS. It does not work after
XDP_REDIRECT: the descriptor is recycled, and cpumap or veth builds
the skb on another CPU. And it cannot support the mini-SKB direction
[7], where the driver hands the xdp_frame to core code, and core code
builds the skb. Core code cannot read driver-local state. A
kernel-known area works in all three cases.
On feature creep: yes, the xdp_frame grows towards a mini-SKB. But it
only gets the fields that the skb needs from the HW offloads: hash,
VLAN and csum, and later maybe RX timestamp and RX queue index. These
are core skb fields, and they rarely change. So the list is short, and
it stays short.
--Jesper
[3]
https://lore.kernel.org/all/amEojEGsIGkUjIWn@devvm7509.cco0.facebook.com/
[6] https://lore.kernel.org/all/20260722113525.34092660@kernel.org/
[7]
https://lore.kernel.org/all/b3e67ffc-5610-4598-9291-ee0264983a4a@kernel.org/
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads