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>
Subject: [PATCH net 6/6] tg3: reject an empty standard RX ring
Date: Fri,  4 Dec 2026 19:54:50 +0100	[thread overview]
Message-ID: <20261204185640.2332668-7-linmag7@gmail.com> (raw)
In-Reply-To: <20261204185640.2332668-1-linmag7@gmail.com>

tg3_set_ringparam() accepts zero standard RX entries. Ring setup then
skips the RX allocation loop and posts no standard receive buffers.
Reject zero before stopping the interface.

The ringparam case of ring_reconfig.py exposed this on a BCM5718. With
the preceding fixes, its traffic check failed at zero RX and 31 TX
entries. At the same TX depth, 64 RX entries carried traffic in both
directions. The missing lower bound is present in the initial Git
import.

With this fix the same BCM5718 returned EINVAL for zero RX entries and
kept its ring settings and carrier. Changing ring sizes resets the PHY
on this 5717-class ASIC. The ringparam traffic check timed out at 1 RX /
31 TX within its nominal five-second startup window. In a separate run,
peer reachability took 8.7 seconds at that depth. TCP then passed in
both directions.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
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 7ccb78222518..0f4343a79cb7 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -12585,7 +12585,8 @@ static int tg3_set_ringparam(struct net_device *dev,
 	int i, irq_sync = 0, err = 0;
 	bool reset_phy = false;
 
-	if ((ering->rx_pending > tp->rx_std_ring_mask) ||
+	if (!ering->rx_pending ||
+	    (ering->rx_pending > tp->rx_std_ring_mask) ||
 	    (ering->rx_jumbo_pending > tp->rx_jmb_ring_mask) ||
 	    (ering->tx_pending > TG3_TX_RING_SIZE - 1) ||
 	    (ering->tx_pending <= MAX_SKB_FRAGS) ||
-- 
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 ` [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 ` Magnus Lindholm [this message]

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-7-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