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 <linm…@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