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