summaryrefslogtreecommitdiff
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMichael Chan <mchan@broadcom.com>2006-10-18 20:55:18 -0700
committerDavid S. Miller <davem@davemloft.net>2006-10-18 20:55:18 -0700
commitbc3a9254a7925b6278f6d882746fe6a0bdf6f610 (patch)
tree862059bc23a8b602da144adef1f237afb0668489 /drivers/net/tg3.c
parent42952231c6a8623117ee3cc89c82d382dc69ca30 (diff)
downloadlwn-bc3a9254a7925b6278f6d882746fe6a0bdf6f610.tar.gz
lwn-bc3a9254a7925b6278f6d882746fe6a0bdf6f610.zip
[TG3]: Add lower bound checks for tx ring size.
The minimum tx ring size must be greater than MAX_SKB_FRAGS or 3 times that on some chips with TSO bugs. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 39e483308a44..7ba9dd2b1f80 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -8106,7 +8106,10 @@ static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *e
if ((ering->rx_pending > TG3_RX_RING_SIZE - 1) ||
(ering->rx_jumbo_pending > TG3_RX_JUMBO_RING_SIZE - 1) ||
- (ering->tx_pending > TG3_TX_RING_SIZE - 1))
+ (ering->tx_pending > TG3_TX_RING_SIZE - 1) ||
+ (ering->tx_pending <= MAX_SKB_FRAGS) ||
+ ((tp->tg3_flags2 & TG3_FLG2_HW_TSO_1_BUG) &&
+ (ering->tx_pending <= (MAX_SKB_FRAGS * 3))))
return -EINVAL;
if (netif_running(dev)) {