[PATCH net-next v12 1/4] net: xdp: add __xdp_build_skb_from_buff() helper
Maxime Chevallier
maxime.chevallier at bootlin.com
Tue Nov 24 01:14:13 PST 2026
Hi,
On 11/24/26 10:04, Lorenzo Bianconi wrote:
>> Hi Lorenzo,
>>
>> On 11/21/26 18:28, Lorenzo Bianconi wrote:
>>> xdp_build_skb_from_buff() always calls eth_type_trans() on the skb it
>>> builds, which pulls the Ethernet header and advances skb->data. Drivers
>>> that still need to process the L2 header before protocol parsing
>>> therefore cannot use the helper.
>>>
>>> stmmac is such a driver: its software VLAN path (stmmac_rx_vlan()) reads
>>> the VLAN tag at skb->data and shifts the MAC addresses over it, so it has
>>> to run before eth_type_trans().
>>>
>>> Split the implementation into __xdp_build_skb_from_buff(), which builds
>>> the skb (including the recycle mark, the Rx queue index and the frags
>>> info) but leaves skb->dev, skb->protocol, skb->pkt_type and the mac
>>> header unset, so the caller must initialize them, usually by calling
>>> eth_type_trans(). Make xdp_build_skb_from_buff() a static inline wrapper
>>> that still calls eth_type_trans() as before, preserving the behavior of
>>> existing in-tree users. A follow-up patch will let stmmac use it.
>>
>> I've been questionning why we even do that in stmmac in the first place
>> actually. This pretends to offload, but it's just to deal with the tag
>> in the driver instead of later down the road.
>>
>> The original idea was for GRO back when it didn't handle vlan tags, but
>> this isn't necessary anymore.
>>
>> There was a series in-flight to remove stmmac_rx_vlan altogether, but it
>> seems to have stalled [1]:
>>
>> [1]: https://lore.kernel.org/all/20260914150612.9798-3-peilinhe2020@163.com/
>>
>> Peilin He, do you have any plans to continue this ? If not, it may be good
>> to pick this up instead of working around this.
>
> I am fine to rebase my series on top of that one or pick the required patch.
There's been no activity on this since september, I think you can pick this
one up and have Peilin He in CC + Author then, your multi-buff XDP has been
going on for long enough, let's not block it further.
Maxime
More information about the linux-arm-kernel
mailing list