From: netdev-bot+sashiko@kernel.org
To: rosenp@gmail.com
Cc: netdev@vger.kernel.org, rafal@milecki.pl,
bcm-kernel-feedback-list@broadcom.com, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net: bgmac: don't process RX with a zero NAPI budget
Date: Sun, 18 Oct 2026 00:34:28 +0000 [thread overview]
Message-ID: <179228366859.3135.9158616222630607774@kernel.org> (raw)
In-Reply-To: <20261014001912.141532-1-rosenp@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] In drivers/net/ethernet/broadcom/bgmac.c, bgmac_poll() still
acknowledges every interrupt source, including BGMAC_IS_RX, with…
--
net: bgmac: don't process RX with a zero NAPI budget
When bgmac_poll() is called with a zero budget, this patch makes it
return right after TX completion cleanup. The goal is to stop netpoll
from processing an RX frame and tripping the "exceeded budget in poll"
WARN_ONCE() in poll_one_napi().
> diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
> index 3e9c57196a397..a545c0cc25977 100644
> --- a/drivers/net/ethernet/broadcom/bgmac.c
> +++ b/drivers/net/ethernet/broadcom/bgmac.c
> @@ -1154,6 +1154,11 @@ static int bgmac_poll(struct napi_struct *napi, int weight)
> bgmac_write(bgmac, BGMAC_INT_STATUS, ~0);
>
> bgmac_dma_tx_free(bgmac, &bgmac->tx_ring[0]);
> +
> + /* A zero budget (netpoll) means only TX may be cleaned */
> + if (unlikely(!weight))
> + return 0;
[Severity: Medium]
Can this leave received frames stuck in the RX ring?
Before it reaches the new zero budget return, bgmac_poll() still clears
every interrupt status bit, including BGMAC_IS_RX, with a write-1-clear:
bgmac_write(bgmac, BGMAC_INT_STATUS, ~0);
The commit message says:
NAPI stays scheduled, so the pending RX frames are picked up by the
next regular poll.
Is that guaranteed?
poll_napi() calls poll_one_napi() for every NAPI on dev->napi_list
whose poll_owner it can take. poll_one_napi() then calls
napi->poll(napi, 0) without checking NAPI_STATE_SCHED.
bgmac_netdev_ops has no ndo_poll_controller, so bgmac_interrupt() is not
run first. As a result, bgmac_poll(napi, 0) can run while the NAPI is
idle and chip interrupts are on.
Suppose a frame arrives while netpoll is transmitting. One example is
__netpoll_send_skb() running with IRQs disabled while the TX queue is
stopped. The sequence would be:
netpoll_poll_dev()->poll_napi()->poll_one_napi()->bgmac_poll(napi, 0)
bgmac_write(bgmac, BGMAC_INT_STATUS, ~0); /* clears BGMAC_IS_RX */
bgmac_dma_tx_free(bgmac, &bgmac->tx_ring[0]);
return 0; /* NAPI not scheduled */
After that, bgmac_interrupt() finds nothing pending:
u32 int_status = bgmac_read(bgmac, BGMAC_INT_STATUS);
int_status &= bgmac->int_mask;
if (!int_status)
return IRQ_NONE;
bgmac_interrupt() is the only caller of napi_schedule() here. Frames
already in the RX ring would sit there until another frame raises
BGMAC_IS_RX. On a quiet link, for example after a single ARP or ping
reply, that wait has no upper bound.
The unconditional ack existed before this patch. However, one RX slot
used to be processed in this window, and now none are.
Would it work to ack only BGMAC_IS_TX0 when the budget is 0? That would
leave BGMAC_IS_RX set, so the interrupt handler still schedules NAPI.
The new comment says "only TX may be cleaned". The NAPI documentation
says a zero budget means processing "only skb Tx completions and no Rx".
This path still consumes RX interrupt state, which doesn't match either
statement.
> +
> handled += bgmac_dma_rx_read(bgmac, &bgmac->rx_ring[0], weight);
>
> /* Poll again if more events arrived in the meantime */
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261014001912.141532-1-rosenp%40gmail.com
prev parent reply other threads:[~2026-10-18 0:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 0:19 [PATCH net] net: bgmac: don't process RX with a zero NAPI budget Rosen Penev
2026-10-14 0:24 ` netdev-bot+sinfo
2026-10-18 0:34 ` netdev-bot+sashiko [this message]
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=179228366859.3135.9158616222630607774@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rafal@milecki.pl \
--cc=rosenp@gmail.com \
/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