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 0/6] tg3: fix reset and NAPI ordering and reject empty RX rings
Date: Fri, 4 Dec 2026 19:54:44 +0100 [thread overview]
Message-ID: <20261204185640.2332668-1-linmag7@gmail.com> (raw)
This is a series for the tg3 driver, which I stared working on while
adding support for M3000 sparc VII+. The box uses the tg3 driver.
My main objective was to get Linux running on the M3000.
Close and suspend can wait under RTNL for a reset worker that also needs
RTNL. Reset producers can also queue work after teardown has drained it,
and NAPI poll callbacks can still access registers after reset masks
interrupts.
The first three patches let the worker retry if RTNL is busy, gate new
reset work during teardown and unregister the netdevice before freeing
its resources. Patches 4 and 5 honor the result of napi_complete_done()
and wait for poll callbacks to finish their final register accesses. The
ringparam selftest also showed that tg3 accepted an empty standard RX
ring and stopped receiving traffic. Patch 6 rejects that setting before
stopping the interface and can also be applied directly to net.
I tested GLAN2 on a Fujitsu M3000 with a BCM5718 and three MSI-X
vectors. The hardware kernels carried Oberon MSI-X support and a tg3
delivery-loss callback [1]. The recovery code gates reset enable and TX
restart after a terminal MSI failure. These tests used normal MSI-X
delivery. The series applies in order to net without those changes.
With patch 6, requesting zero RX entries returned EINVAL and preserved
the settings and carrier. On all three runs of ring_reconfig.py,
channels passed, reconfig_tx_stall skipped (no combined channels), and
ringparam failed to start traffic at one RX entry and 31 TX entries.
On this 5717-class ASIC, tg3_set_ringparam() resets the PHY on a ring
change while the interface is up. The test starts traffic immediately
and samples RX packets 50 times at 100 ms intervals. Carrier was down
during part of that window. In separate runs, two consecutive pings
succeeded after 8.7 seconds at 1 RX / 31 TX and 8.9 seconds at 2047 RX /
511 TX. Starting the same traffic generator then delivered over 10,000
packets at each size. TCP passed in both directions with one RX entry.
On the same BCM5718, stopping an idle TX queue triggered the real
watchdog. Close and PCI unbind each canceled delayed reset work. With a
reset already in progress, two closes and two unbinds requested RTNL
after the first chip-reset flush and acquired it after hardware
reinitialization. Nine transfer pairs passed SHA-256 checks in both
directions across the watchdog tests.
I also reran the earlier x86-64 QEMU fixture. It runs both tg3 poll
callbacks on a synthetic netdevice and records writes to memory-backed
registers. All 22 cases passed with both lazy and full preemption,
including busy-poll completion refusal and mailbox and heartbeat
ordering around the modeled reset mask. I have not measured an IRQ-rate
change on the BCM5718 or exercised hardware suspend/resume or PCI error
recovery.
Each patch built tg3.o with W=1 and -Werror for x86-64 allmodconfig and
SPARC64. I used Codex to help audit the driver, prepare the patches and
run the tests.
[1] https://github.com/linmag7/linux-sparc/commit/5b6eaad22926a8158e04f0d209900f666a293382
Magnus Lindholm (6):
tg3: defer reset work when RTNL is busy
tg3: gate reset work across device teardown
tg3: unregister the netdevice before releasing its resources
tg3: honor NAPI completion before rearming interrupts
tg3: wait for NAPI poll callbacks before resetting hardware
tg3: reject an empty standard RX ring
drivers/net/ethernet/broadcom/tg3.c | 98 +++++++++++++++++++++--------
drivers/net/ethernet/broadcom/tg3.h | 5 +-
2 files changed, 77 insertions(+), 26 deletions(-)
base-commit: af6737b9066832a2017c281159950ba92385ce00
--
2.43.0
next reply other threads:[~2026-12-04 18:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 18:54 Magnus Lindholm [this message]
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 ` [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-1-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