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>,
Satish Baddipadige <satish.baddipadige@broadcom.com>,
Siva Reddy Kallam <siva.kallam@broadcom.com>,
Prashant Sreedharan <prashant.sreedharan@broadcom.com>
Subject: [PATCH net 5/6] tg3: wait for NAPI poll callbacks before resetting hardware
Date: Fri, 4 Dec 2026 19:54:49 +0100 [thread overview]
Message-ID: <20261204185640.2332668-6-linmag7@gmail.com> (raw)
In-Reply-To: <20261204185640.2332668-1-linmag7@gmail.com>
After NAPI completion a poll callback can still write the interrupt
mailbox or the APE heartbeat. As described under "Call sequence" in
Documentation/networking/napi.rst, napi_disable() waits for release of
NAPI ownership. A callback can therefore still be running when reset
masks interrupts. Wait for a network grace period after disabling NAPI
and stopping TX.
The Broadcom NetXtreme/NetLink BCM5718 Family Programmer's Guide
(5718-PG107-R), pp. 148-149, describes masking interrupts at the start
of device close. Pages 232 and 234 describe tagged mailbox rearm.
A driver audit with Codex identified the window. A modified QEMU guest
used memory-backed device registers to record write order. Holding a
poll callback after NAPI completion let mailbox and heartbeat writes
follow the modeled reset mask. With the fix the writes preceded the
mask. Loaded watchdog resets on a BCM5718 showed no late writes on
either build.
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: 38f3843ed6bd ("[TG3]: Use status tag to check for new events")
Fixes: 506b0a395f26 ("tg3: APE heartbeat changes")
Cc: Satish Baddipadige <satish.baddipadige@broadcom.com>
Cc: Siva Reddy Kallam <siva.kallam@broadcom.com>
Cc: Prashant Sreedharan <prashant.sreedharan@broadcom.com>
Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
---
drivers/net/ethernet/broadcom/tg3.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 88f2062f062a..7ccb78222518 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -7500,6 +7500,9 @@ static inline void tg3_netif_stop(struct tg3 *tp)
tg3_napi_disable(tp);
netif_carrier_off(tp->dev);
netif_tx_disable(tp->dev);
+
+ /* Let pollers that completed NAPI finish their last MMIO. */
+ synchronize_net();
}
/* tp->lock must be held */
--
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 ` [PATCH net 4/6] tg3: honor NAPI completion before rearming interrupts Magnus Lindholm
2026-12-04 18:54 ` Magnus Lindholm [this message]
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-6-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 \
--cc=prashant.sreedharan@broadcom.com \
--cc=satish.baddipadige@broadcom.com \
--cc=siva.kallam@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