From: Magnus Lindholm <linmag7@gmail.com>
To: netdev@vger.kernel.org
Cc: pavan.chebbi@broadcom.com, michael.chan@broadcom.com,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com,
Magnus Lindholm <linmag7@gmail.com>
Subject: [PATCH net 4/6] tg3: honor NAPI completion before rearming interrupts
Date: Fri, 4 Dec 2026 19:54:48 +0100 [thread overview]
Message-ID: <20261204185640.2332668-5-linmag7@gmail.com> (raw)
In-Reply-To: <20261204185640.2332668-1-linmag7@gmail.com>
Both tg3 poll callbacks rearm the interrupt mailbox when
napi_complete_done() returns false. This can defeat interrupt deferral
during busy polling or software IRQ coalescing. Honor the completion
result before rearming or kicking the MSI-X refill path, as described in
Documentation/networking/napi.rst under "Scheduling and IRQ masking".
The Broadcom NetXtreme/NetLink BCM5718 Family Programmer's Guide
(5718-PG107-R), pp. 232 and 234, describes returning the status tag to
the mailbox after RX and TX processing finishes.
A driver audit with Codex identified the unconditional rearm. In a QEMU
guest the reproducer ran both tg3 poll callbacks on empty rings with the
NAPI busy-poll state set. Each callback wrote the interrupt mailbox once
before the fix and left it untouched afterwards. I tested traffic on an
M3000 BCM5718 with three MSI-X vectors. I did not measure a change in
hardware IRQ rate.
With all six patches on a BCM5718, ring_reconfig.py passed channels and
skipped reconfig_tx_stall (no combined channels). Changing ring sizes
resets the PHY on this 5717-class ASIC. The ringparam traffic check
timed out at 1 RX / 31 TX with a nominal five-second startup window.
Peer reachability took 8.7 seconds at that depth in a separate run. TCP
then passed in both directions.
Fixes: 364b6055738b ("net: busy-poll: return busypolling status to drivers")
Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
---
drivers/net/ethernet/broadcom/tg3.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index d267d1e94322..88f2062f062a 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -7317,7 +7317,8 @@ static int tg3_poll_msix(struct napi_struct *napi, int budget)
if (tnapi == &tp->napi[1] && tp->rx_refill)
continue;
- napi_complete_done(napi, work_done);
+ if (!napi_complete_done(napi, work_done))
+ break;
/* Reenable interrupts. */
tw32_mailbox(tnapi->int_mbox, tnapi->last_tag << 24);
@@ -7410,8 +7411,8 @@ static int tg3_poll(struct napi_struct *napi, int budget)
sblk->status &= ~SD_STATUS_UPDATED;
if (likely(!tg3_has_work(tnapi))) {
- napi_complete_done(napi, work_done);
- tg3_int_reenable(tnapi);
+ if (napi_complete_done(napi, work_done))
+ tg3_int_reenable(tnapi);
break;
}
}
--
2.43.0
next prev parent reply other threads:[~2026-12-04 18:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 18:54 [PATCH net 0/6] tg3: fix reset and NAPI ordering and reject empty RX rings Magnus Lindholm
2026-12-04 18:54 ` [PATCH net 1/6] tg3: defer reset work when RTNL is busy Magnus Lindholm
2026-12-04 18:54 ` [PATCH net 2/6] tg3: gate reset work across device teardown Magnus Lindholm
2026-12-04 18:54 ` [PATCH net 3/6] tg3: unregister the netdevice before releasing its resources Magnus Lindholm
2026-12-04 18:54 ` Magnus Lindholm [this message]
2026-12-04 18:54 ` [PATCH net 5/6] tg3: wait for NAPI poll callbacks before resetting hardware Magnus Lindholm
2026-12-04 18:54 ` [PATCH net 6/6] tg3: reject an empty standard RX ring Magnus Lindholm
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=20261204185640.2332668-5-linmag7@gmail.com \
--to=linmag7@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pavan.chebbi@broadcom.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