BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Lorenzo Bianconi" <lorenzo.bianconi@oss.qualcomm.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next v6 2/4] net: stmmac: drop split frames on AF_XDP zero-copy RX
Date: Tue, 13 Oct 2026 16:45:07 +0000	[thread overview]
Message-ID: <sashiko-outbox-170147@kernel.org> (raw)
In-Reply-To: <20261012-stmmac-rx-mb-v6-2-2225050915c1@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] net: stmmac: inverted likely() branch prediction hint penalizes fast path
--

commit 4d2daa16c79cba581290a2a573499971819eb3dc
Author: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>

net: stmmac: drop split frames on AF_XDP zero-copy RX

This commit fixes the AF_XDP zero-copy receive path to properly drop and
drain frames that span multiple RX descriptors. It ensures the fragmented
descriptors are released without being incorrectly processed as a new frame.

> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

[ ... ]

> @@ -5721,8 +5724,9 @@ static int stmmac_rx_zc(struct stmmac_priv *priv, int limit, u32 queue)
>  		if (likely(status & rx_not_ls)) {

[Severity: Low]
Does this use of likely() invert the branch prediction hint?

Since XDP limits MTU to 1500, valid frames should fit completely into a 
single buffer, making rx_not_ls 0 in the normal fast path. By using likely() 
here, the compiler is instructed to optimize for split or dropped frames.

Would it be better to use unlikely() so the fast path for valid packets isn't
penalized? A few lines further down, stmmac_rx_zc() correctly uses 
likely(!(status & rx_not_ls)) for the valid packet case.

>  			xsk_buff_free(buf->xdp);
>  			buf->xdp = NULL;
> +			rx_dropped++;
> +			error = 1;
>  			dirty++;
> -			count++;
>  			goto read_again;
>  		}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261012-stmmac-rx-mb-v6-0-2225050915c1@oss.qualcomm.com?part=2

  parent reply	other threads:[~2026-10-13 16:45 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-12 16:44 [PATCH net-next v6 0/4] net: stmmac: introduce XDP rx multi-buff support Lorenzo Bianconi
2026-10-12 16:44 ` [PATCH net-next v6 1/4] net: stmmac: take ownership of saved RX state at poll entry Lorenzo Bianconi
2026-10-12 20:58   ` Nicolai Buchwitz
2026-10-12 16:44 ` [PATCH net-next v6 2/4] net: stmmac: drop split frames on AF_XDP zero-copy RX Lorenzo Bianconi
2026-10-12 20:59   ` Nicolai Buchwitz
2026-10-13 16:45   ` sashiko-bot [this message]
2026-10-13 17:33   ` netdev-bot+sashiko
2026-10-12 16:44 ` [PATCH net-next v6 3/4] net: stmmac: drop multi-buffer frames in XDP mode Lorenzo Bianconi
2026-10-12 21:04   ` Nicolai Buchwitz
2026-10-13  8:17     ` Lorenzo Bianconi
2026-10-13  8:24       ` Nicolai Buchwitz
2026-10-13  8:32         ` Lorenzo Bianconi
2026-10-13 16:45   ` sashiko-bot
2026-10-13 17:33   ` netdev-bot+sashiko
2026-10-12 16:44 ` [PATCH net-next v6 4/4] net: stmmac: rework stmmac_rx to support XDP rx multi-buff Lorenzo Bianconi
2026-10-12 21:10   ` Nicolai Buchwitz
2026-10-13  9:12     ` Lorenzo Bianconi
2026-10-13 10:16       ` Lorenzo Bianconi
2026-10-13 17:33   ` netdev-bot+sashiko
2026-10-12 16:50 ` [PATCH net-next v6 0/4] net: stmmac: introduce XDP rx multi-buff support netdev-bot+sinfo
2026-10-12 20:40   ` 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=sashiko-outbox-170147@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=lorenzo.bianconi@oss.qualcomm.com \
    --cc=sashiko-reviews@lists.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