[PATCH net-next v12 1/4] net: xdp: add __xdp_build_skb_from_buff() helper
Lorenzo Bianconi
lorenzo.bianconi at oss.qualcomm.com
Tue Nov 24 01:04:53 PST 2026
> 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.
Regards,
Lorenzo
>
> Maxime
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20261124/0a4e5825/attachment.sig>
More information about the linux-arm-kernel
mailing list