diff options
author | Eric Dumazet <edumazet@google.com> | 2012-06-13 05:45:16 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-15 18:30:15 -0400 |
commit | bc14786a100cc6a81cd060e8031ec481241b418c (patch) | |
tree | 344e33a1e1ee80906eb9aaaa339cd3bad257385a /drivers/net/ethernet | |
parent | d9cb9bd63eb27ac19f26a8547128c053f43a5da8 (diff) |
bnx2x: fix panic when TX ring is full
There is a off by one error in the minimal number of BD in
bnx2x_start_xmit() and bnx2x_tx_int() before stopping/resuming tx queue.
A full size GSO packet, with data included in skb->head really needs
(MAX_SKB_FRAGS + 4) BDs, because of bnx2x_tx_split()
This error triggers if BQL is disabled and heavy TCP transmit traffic
occurs.
bnx2x_tx_split() definitely can be called, remove a wrong comment.
Reported-by: Tomas Hruby <thruby@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Eilon Greenstein <eilong@broadcom.com>
Cc: Yaniv Rosner <yanivr@broadcom.com>
Cc: Merav Sicron <meravs@broadcom.com>
Cc: Tom Herbert <therbert@google.com>
Cc: Robert Evans <evansr@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index cbc56f274e0..8098eea9704 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
@@ -190,7 +190,7 @@ int bnx2x_tx_int(struct bnx2x *bp, struct bnx2x_fp_txdata *txdata) | |||
190 | 190 | ||
191 | if ((netif_tx_queue_stopped(txq)) && | 191 | if ((netif_tx_queue_stopped(txq)) && |
192 | (bp->state == BNX2X_STATE_OPEN) && | 192 | (bp->state == BNX2X_STATE_OPEN) && |
193 | (bnx2x_tx_avail(bp, txdata) >= MAX_SKB_FRAGS + 3)) | 193 | (bnx2x_tx_avail(bp, txdata) >= MAX_SKB_FRAGS + 4)) |
194 | netif_tx_wake_queue(txq); | 194 | netif_tx_wake_queue(txq); |
195 | 195 | ||
196 | __netif_tx_unlock(txq); | 196 | __netif_tx_unlock(txq); |
@@ -2516,8 +2516,6 @@ int bnx2x_poll(struct napi_struct *napi, int budget) | |||
2516 | /* we split the first BD into headers and data BDs | 2516 | /* we split the first BD into headers and data BDs |
2517 | * to ease the pain of our fellow microcode engineers | 2517 | * to ease the pain of our fellow microcode engineers |
2518 | * we use one mapping for both BDs | 2518 | * we use one mapping for both BDs |
2519 | * So far this has only been observed to happen | ||
2520 | * in Other Operating Systems(TM) | ||
2521 | */ | 2519 | */ |
2522 | static noinline u16 bnx2x_tx_split(struct bnx2x *bp, | 2520 | static noinline u16 bnx2x_tx_split(struct bnx2x *bp, |
2523 | struct bnx2x_fp_txdata *txdata, | 2521 | struct bnx2x_fp_txdata *txdata, |
@@ -3171,7 +3169,7 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3171 | 3169 | ||
3172 | txdata->tx_bd_prod += nbd; | 3170 | txdata->tx_bd_prod += nbd; |
3173 | 3171 | ||
3174 | if (unlikely(bnx2x_tx_avail(bp, txdata) < MAX_SKB_FRAGS + 3)) { | 3172 | if (unlikely(bnx2x_tx_avail(bp, txdata) < MAX_SKB_FRAGS + 4)) { |
3175 | netif_tx_stop_queue(txq); | 3173 | netif_tx_stop_queue(txq); |
3176 | 3174 | ||
3177 | /* paired memory barrier is in bnx2x_tx_int(), we have to keep | 3175 | /* paired memory barrier is in bnx2x_tx_int(), we have to keep |
@@ -3180,7 +3178,7 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3180 | smp_mb(); | 3178 | smp_mb(); |
3181 | 3179 | ||
3182 | fp->eth_q_stats.driver_xoff++; | 3180 | fp->eth_q_stats.driver_xoff++; |
3183 | if (bnx2x_tx_avail(bp, txdata) >= MAX_SKB_FRAGS + 3) | 3181 | if (bnx2x_tx_avail(bp, txdata) >= MAX_SKB_FRAGS + 4) |
3184 | netif_tx_wake_queue(txq); | 3182 | netif_tx_wake_queue(txq); |
3185 | } | 3183 | } |
3186 | txdata->tx_pkt++; | 3184 | txdata->tx_pkt++; |