[PATCH net-next v12 1/4] net: xdp: add __xdp_build_skb_from_buff() helper

Nicolai Buchwitz nb at tipi-net.de
Sun Nov 22 11:21:49 PST 2026


On 21.11.2026 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.
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi at oss.qualcomm.com>
> ---

> [...]

Reviewed-by: Nicolai Buchwitz <nb at tipi-net.de>



More information about the linux-arm-kernel mailing list