🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #27078

[PATCH net 0/6] tg3: fix reset and NAPI ordering and reject empty RX rings

#27078
From: Magnus Lindholm
Date: Fri, 04 Dec 2026 18:54
74 lines
13918 bytes
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
Technical Details
Message-ID: <20261204185640.2332668-1-linmag7@gmail.com>
Path: mbox-mo1.pugleaf.net!news-fra.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377560-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-fra.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377560-linux-kernel-netdev=dewy.ru
From: linmag7@gmail.com (Magnus Lindholm)
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <20261204185640.2332668-1-linmag7@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network; logging-data="2836627"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:6oFlMyUOXArsJmAnzc8EtIZ945c= sha256:zHKTPNw5ES9ND2N4xo2kuIt5JjGbxjOW5aJmljP3lzg= sha1:Tipy9YhVyYYCe2t5PhKM7xPfVn0= sha256:Moa/khboux9bvvBYTqNbmGE+6BtMZUOG5lqmW4hGsvE=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id ADE90117CA2; Fri,  4 Dec 2026 21:57:15 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.397
X-Spam-Status: No, score=-3.397 tagged_above=-9999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.001, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5MZDQxlmH9Cg; Fri,  4 Dec 2026 21:57:12 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-377560-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id D514C117C9A; Fri,  4 Dec 2026 21:57:02 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 9BF022294D; Fri,  4 Dec 2026 18:57:01 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796410619; b=Q60lkzqzAbtVu/GOlefwHbqiDOuygAwNg1DdRdLRy6SEgLz6Ru02V9UWPBZRkxQzSgCk 3pGvRSI/jo9T5gIpMqmlUO28MsmZzHMt0C4WyxdMDgcXx2Lhys9OiKDzzxNlp6Y5LUwB4 Je9d5ywa1cy+2jX/9oWYG8jjc0a7Jx2Q4oqWCcmKGcamyJSeQauUHF6/rE/6IsVdr2PaB wc9JJcDcH196ClXQsVbgbBTQu8bG6s96qc+Q6onYUYaciVKxVwod/5D0BhVa4Gk8hmcUf 0aIONnL22oAoU/ChUoCK0Jrnr30mOFfVuuPndicG4bXbYpUDUer2RwDUcFQMfOrvRhA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796410619; h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature: X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received: Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:X-Mailing-List: List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe: List-Owner:Precedence:MIME-Version:Content-Transfer-Encoding; bh=J3bwi883YZGym/fjv5PLPx4g/DLpIZDLOZ0v+EUAp/E=; b=2Gr59g8LK/8sxGt/WFrXIEEQJa68hr2MCiPnzU7sGyUnL4yMg5CZN0tUpI/d+nYF+q95 IzGe3TPTEULaEUBx3P1cZPsnex2L5HaK4IJGMLwVRIIqR7//Fp/ZpCTGrmeJWYWUr0+9j pybukpJ3SLb+8t9Hf0X1ueSurj4staTRhCTM+V/oTtEd1dAy+/zhvXx/SXeZSEfC+vNsW n0ZrnBESiPiMhYMUanWuBVXC//V2UY7GKwmULxT1fiRhzVsIrh2YJ0/FizmN7cocTiJD3 kaLk/mRGR+/oelJZZPLDruczFQxpXJVnVNyVNS1key/hclgYy/XfI/guFnN69WqdA/g==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=gp4Vx+Rp; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4A997606A334; Fri,  4 Dec 2026 18:56:59 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=gp4Vx+Rp
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.208.50
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796410618; b=Mvucss3oI9SB2cqwXw2Ad+odEhlrVXOcyWVS2AgAee0uK7S1Q5jA9lJIw1mcCTnP2un3 btjeYJOpgsTzuZeWcjyp+KosQcgcWlv0OABiiiy15KVZiZ63+pHHs6X8kML9lZTpUm5dF 8BcLEMa0pnQYfEcinB1Tm+sAVL0pJm5mefhK8f4+CSVZY7D9zxJm63jQd/YvhB1HFdgUt 6gIjFqDr3DcOEMcMIQPcb8A9M01wuHA2mNMUpx6PcU6BC4/luVPBfZVNuNcNQJqEiQvug GIclPtZtkgEKug4/H8l5SKSQs8P/F9QGlyEN38LdrvKHEcxA7nYRq47D8omNjYqsjig==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796410618; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=J3bwi883YZGym/fjv5PLPx4g/DLpIZDLOZ0v+EUAp/E=; b=2Sq4HuK+MPpMFpwAYepE+1ltQ/DdhfPiLCP9YVBAn1GU4ZFIr/FOcKf6t4Uszci4So2j KQNEb2e7EPv5Q742r1p00sAzkZT5plxg+1h8OcimefQ4TeVf1dQ5iEB5F1NLrLUhbp0xN FFdH52Ml6Fdyfw5HG78Jo495rlM4ulBUh6DqlMXPAYB9nxR0uOX6YJsbsI1iVniyD2hYt ybD5cSvwTGcWWtnKFQU6hujEV22sAEozIiBkajmTDC1PLEDY9qd7Me7pvwY4m9qeV7F08 1bY8jxHzwzaStRXPXrJAvHLPc5khiTAoi93kgZEQqBMplT5wbP+Z14T5Gp63+UwSG6A==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=gp4Vx+Rp; arc=none smtp.remote-ip=209.85.208.50
X-Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 156F4606A322 for <netdev@vger.kernel.org>; Fri,  4 Dec 2026 18:56:57 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 156F4606A322
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-6b8977f2785so1341463a12.3 for <netdev@vger.kernel.org>; Fri, 04 Dec 2026 10:56:57 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796410616; x=1797015416; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=J3bwi883YZGym/fjv5PLPx4g/DLpIZDLOZ0v+EUAp/E=; b=gp4Vx+RpH+kuSck5HyzRPrvMcpg2tIleChrjI1bMeUEaHBBVFAuJVlHac/bpZP2Dlg 36TCfURrP8kxbtow8mcV97Z1xU8ueueKhTbq+J7iFMxcHxKxEWlFBWNpSIVJUsO3jse6 iuWwVMCz442XnpiQZg9z8MzPMwgDWrXgEUEVnaZxmZrl6vmTcV/wGuzwKJ1ppkueh4MO pxRJWShW/Mq/uiaqfih6N3KQXhURufmMFtoDDCywlWaVt+7k/HykPShEQWnqoJFkDiah 1aZmWPz7KCKLOV1P56FAuRUsXu2A84PpWJTNWzbqMPB09Ie38VS37/gFrkIfSNjVvmEk MCLQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796410616; x=1797015416; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=J3bwi883YZGym/fjv5PLPx4g/DLpIZDLOZ0v+EUAp/E=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M+mP/t+1r0 OJRE7zkp+ZJDd6VgSr6YzXvtWT0dAqOa6wA2R9XxE1DETjdiDgdBYGV8k9psn2j2s/wGYs4=
X-Received: by 2002:a05:6402:501e:b0:6b7:6485:23cf with SMTP id 4fb4d7f45d1cf-6bcc203d263mr1806566a12.42.1796410616291; Fri, 04 Dec 2026 10:56:56 -0800 (PST)
X-Received: from buildhost.darklands.se ([2001:9b1:ff:d701:51eb:176f:63d9:53f8]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6bcbc00d2b2sm1197070a12.35.2026.12.04.10.56.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 10:56:56 -0800 (PST)
X-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>
X-Mailer: git-send-email 2.56.0
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list