Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: lorenzo.bianconi@oss.qualcomm.com
Cc: maxime.chevallier@bootlin.com, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, mcoquelin.stm32@gmail.com,
	alexandre.torgue@foss.st.com, ast@kernel.org,
	daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com,
	sdf@fomichev.me, Jose.Abreu@synopsys.com,
	boon.leong.ong@intel.com, horms@kernel.org, andrii@kernel.org,
	eddyz87@gmail.com, memxor@gmail.com, martin.lau@linux.dev,
	song@kernel.org, yonghong.song@linux.dev, jolsa@kernel.org,
	emil@etsalapatis.com, ihor.solodrai@linux.dev,
	netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	bpf@vger.kernel.org, nb@tipi-net.de
Subject: Re: [PATCH net-next v10 1/4] net: xdp: add __xdp_build_skb_from_buff() helper
Date: Mon, 16 Nov 2026 17:20:14 +0000	[thread overview]
Message-ID: <179484961485.3136.18371294575845722948@kernel.org> (raw)
In-Reply-To: <20261112-stmmac-rx-mb-v10-1-d3d04b65c6bc@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The kerneldoc for the newly exported __xdp_build_skb_from_buff()
  (net/core/xdp.c:622-633) says only "Protocol parsing is left to the…

--

net: xdp: add __xdp_build_skb_from_buff() helper

This patch splits xdp_build_skb_from_buff() in two. The new exported
__xdp_build_skb_from_buff() builds the skb without calling
eth_type_trans(). A static inline wrapper in include/net/xdp.h keeps the
old behaviour and still calls eth_type_trans(). The goal is to let stmmac
process the L2 header (software VLAN) before protocol parsing.

> diff --git a/net/core/xdp.c b/net/core/xdp.c
> index 1d679e8fd6493..470bf90d93ef2 100644
> --- a/net/core/xdp.c
> +++ b/net/core/xdp.c
> @@ -620,17 +620,18 @@ void xdp_warn(const char *msg, const char *func, const int line)
>  EXPORT_SYMBOL_GPL(xdp_warn);
>  
>  /**
> - * xdp_build_skb_from_buff - create an skb from &xdp_buff
> + * __xdp_build_skb_from_buff - create an skb from &xdp_buff
>   * @xdp: &xdp_buff to convert to an skb
>   *
>   * Perform common operations to create a new skb to pass up the stack from
>   * &xdp_buff: allocate an skb head from the NAPI percpu cache, initialize
>   * skb data pointers and offsets, set the recycle bit if the buff is
> - * PP-backed, Rx queue index, protocol and update frags info.
> + * PP-backed, record the Rx queue index and update frags info. Protocol
> + * parsing is left to the caller.

[Severity: Low]
Does "Protocol parsing is left to the caller" fully describe what the
caller now has to do?

Moving eth_type_trans() out of __xdp_build_skb_from_buff() also moves out
the other work it does:

net/ethernet/eth.c:eth_type_trans() {
	skb->dev = dev;
	skb_reset_mac_header(skb);

	eth = eth_skb_pull_mac(skb);
	eth_skb_pkt_type(skb, dev);
    ...
}

So the skb returned by __xdp_build_skb_from_buff() has skb->dev == NULL
and no mac header, and protocol and pkt_type are not set. This is true
even though rxq->dev is available inside the helper.

The peer helper __xdp_build_skb_from_frame() still sets these:

	/* Essential SKB info: protocol and skb->dev */
	skb->protocol = eth_type_trans(skb, dev);

As a result, the two __xdp_build_skb_* helpers now return different
minimal skb state.

Nothing breaks today. The only in-tree user of the underscore variant
later in the series is stmmac_rx(), and it calls
eth_type_trans(skb, priv->dev) before napi_gro_receive(). A future caller
that does its own L2 handling and reads "protocol parsing" as just
skb->protocol could pass an skb with no dev to napi_gro_receive() or
netif_receive_skb().

Could the kerneldoc say that the caller must also set skb->dev and reset
the mac header, for example by calling eth_type_trans()?

A smaller point: the public xdp_build_skb_from_buff() wrapper in
include/net/xdp.h no longer has any kerneldoc. The kerneldoc for
xdp_build_skb_from_zc() still refers readers to it:

 * Similar to xdp_build_skb_from_buff(), but for XSk frames. Allocate an skb

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112-stmmac-rx-mb-v10-0-d3d04b65c6bc%40oss.qualcomm.com

  reply	other threads:[~2026-11-16 17:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12 16:34 [PATCH net-next v10 0/4] net: stmmac: introduce XDP rx multi-buff support Lorenzo Bianconi
2026-11-12 16:34 ` [PATCH net-next v10 1/4] net: xdp: add __xdp_build_skb_from_buff() helper Lorenzo Bianconi
2026-11-16 17:20   ` netdev-bot+sashiko [this message]
2026-11-12 16:34 ` [PATCH net-next v10 2/4] net: xdp: add xdp_buff_shrink_tail() helper Lorenzo Bianconi
2026-11-16 17:20   ` netdev-bot+sashiko
2026-11-12 16:34 ` [PATCH net-next v10 3/4] net: xdp: add __xdp_return_buff() helper Lorenzo Bianconi
2026-11-12 16:34 ` [PATCH net-next v10 4/4] net: stmmac: rework stmmac_rx to support XDP rx multi-buff Lorenzo Bianconi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179484961485.3136.18371294575845722948@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=Jose.Abreu@synopsys.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=boon.leong.ong@intel.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=eddyz87@gmail.com \
    --cc=edumazet@kernel.org \
    --cc=emil@etsalapatis.com \
    --cc=hawk@kernel.org \
    --cc=horms@kernel.org \
    --cc=ihor.solodrai@linux.dev \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=lorenzo.bianconi@oss.qualcomm.com \
    --cc=martin.lau@linux.dev \
    --cc=maxime.chevallier@bootlin.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=memxor@gmail.com \
    --cc=nb@tipi-net.de \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox