Netdev List
 help / color / mirror / Atom feed
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>,
	Benjamin Li <benli@broadcom.com>,
	Matt Carlson <mcarlson@broadcom.com>,
	Jaswinder Singh Rajput <jaswinderrajput@gmail.com>,
	Ivan Vecera <ivecera@redhat.com>,
	Prashant Sreedharan <prashant@broadcom.com>
Subject: [PATCH net 3/6] tg3: unregister the netdevice before releasing its resources
Date: Fri,  4 Dec 2026 19:54:47 +0100	[thread overview]
Message-ID: <20261204185640.2332668-4-linmag7@gmail.com> (raw)
In-Reply-To: <20261204185640.2332668-1-linmag7@gmail.com>

Removal releases PTP, firmware and PHY resources while the netdevice can
still be opened. Unregister it first so ndo_stop and outstanding netdev
operations finish while those resources are available.

A driver audit with Codex identified the teardown order. A modified
BCM5718 kernel paused removal before unregister. Concurrent opens and
closes completed before the driver released its resources. This port
uses neither PTP, PHYLIB nor host-loaded firmware, so the resource race
itself was not reproduced. PCI unbind also completed during watchdog
recovery.

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: 158d7abdae85 ("tg3: Add mdio bus registration")
Fixes: 077f849de42e ("firmware: convert tg3 driver to request_firmware()")
Fixes: 20d14a5d377a ("tg3: move init/deinit from open/close to probe/remove")
Cc: Benjamin Li <benli@broadcom.com>
Cc: Matt Carlson <mcarlson@broadcom.com>
Cc: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
Cc: Ivan Vecera <ivecera@redhat.com>
Cc: Prashant Sreedharan <prashant@broadcom.com>
Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
---
 drivers/net/ethernet/broadcom/tg3.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 1cd7fc92aa96..d267d1e94322 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -18195,6 +18195,8 @@ static void tg3_remove_one(struct pci_dev *pdev)
 		tg3_reset_task_stop(tp);
 		rtnl_unlock();
 
+		unregister_netdev(dev);
+
 		tg3_ptp_fini(tp);
 
 		release_firmware(tp->fw);
@@ -18204,7 +18206,6 @@ static void tg3_remove_one(struct pci_dev *pdev)
 			tg3_mdio_fini(tp);
 		}
 
-		unregister_netdev(dev);
 		if (tp->aperegs) {
 			iounmap(tp->aperegs);
 			tp->aperegs = NULL;
-- 
2.43.0


  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 ` Magnus Lindholm [this message]
2026-12-04 18:54 ` [PATCH net 4/6] tg3: honor NAPI completion before rearming interrupts Magnus Lindholm
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-4-linmag7@gmail.com \
    --to=linmag7@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=benli@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=ivecera@redhat.com \
    --cc=jaswinderrajput@gmail.com \
    --cc=kuba@kernel.org \
    --cc=mcarlson@broadcom.com \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pavan.chebbi@broadcom.com \
    --cc=prashant@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