aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEilon Greenstein <eilong@broadcom.com>2008-08-25 18:19:17 -0400
committerDavid S. Miller <davem@davemloft.net>2008-08-25 18:19:17 -0400
commit2772f9037355a031725987661621290380e58f52 (patch)
treee5553fb83bf504ffd632742999cc13fcfdbcbd18
parentce3113ec57abcd41cc5a2fed02474aee3f63d12c (diff)
bnx2x: Rx work check
The has Rx work check was wrong: when the FW was at the end of the page, the driver was already at the beginning of the next page. Since the check only validated that both driver and FW are pointing to the same place, it concluded that there is still work to be done. This caused some serious issues including long latency results on ping-pong test and lockups while unloading the driver in that condition. Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/bnx2x.h2
-rw-r--r--drivers/net/bnx2x_main.c7
2 files changed, 8 insertions, 1 deletions
diff --git a/drivers/net/bnx2x.h b/drivers/net/bnx2x.h
index b468f904c7f8..a14dba1afcc5 100644
--- a/drivers/net/bnx2x.h
+++ b/drivers/net/bnx2x.h
@@ -271,7 +271,7 @@ struct bnx2x_fastpath {
271 (fp->tx_pkt_prod != fp->tx_pkt_cons)) 271 (fp->tx_pkt_prod != fp->tx_pkt_cons))
272 272
273#define BNX2X_HAS_RX_WORK(fp) \ 273#define BNX2X_HAS_RX_WORK(fp) \
274 (fp->rx_comp_cons != le16_to_cpu(*fp->rx_cons_sb)) 274 (fp->rx_comp_cons != rx_cons_sb)
275 275
276#define BNX2X_HAS_WORK(fp) (BNX2X_HAS_RX_WORK(fp) || BNX2X_HAS_TX_WORK(fp)) 276#define BNX2X_HAS_WORK(fp) (BNX2X_HAS_RX_WORK(fp) || BNX2X_HAS_TX_WORK(fp))
277 277
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
index 971576b43687..272f5d112bb3 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -9250,6 +9250,7 @@ static int bnx2x_poll(struct napi_struct *napi, int budget)
9250 napi); 9250 napi);
9251 struct bnx2x *bp = fp->bp; 9251 struct bnx2x *bp = fp->bp;
9252 int work_done = 0; 9252 int work_done = 0;
9253 u16 rx_cons_sb;
9253 9254
9254#ifdef BNX2X_STOP_ON_ERROR 9255#ifdef BNX2X_STOP_ON_ERROR
9255 if (unlikely(bp->panic)) 9256 if (unlikely(bp->panic))
@@ -9265,10 +9266,16 @@ static int bnx2x_poll(struct napi_struct *napi, int budget)
9265 if (BNX2X_HAS_TX_WORK(fp)) 9266 if (BNX2X_HAS_TX_WORK(fp))
9266 bnx2x_tx_int(fp, budget); 9267 bnx2x_tx_int(fp, budget);
9267 9268
9269 rx_cons_sb = le16_to_cpu(*fp->rx_cons_sb);
9270 if ((rx_cons_sb & MAX_RCQ_DESC_CNT) == MAX_RCQ_DESC_CNT)
9271 rx_cons_sb++;
9268 if (BNX2X_HAS_RX_WORK(fp)) 9272 if (BNX2X_HAS_RX_WORK(fp))
9269 work_done = bnx2x_rx_int(fp, budget); 9273 work_done = bnx2x_rx_int(fp, budget);
9270 9274
9271 rmb(); /* BNX2X_HAS_WORK() reads the status block */ 9275 rmb(); /* BNX2X_HAS_WORK() reads the status block */
9276 rx_cons_sb = le16_to_cpu(*fp->rx_cons_sb);
9277 if ((rx_cons_sb & MAX_RCQ_DESC_CNT) == MAX_RCQ_DESC_CNT)
9278 rx_cons_sb++;
9272 9279
9273 /* must not complete if we consumed full budget */ 9280 /* must not complete if we consumed full budget */
9274 if ((work_done < budget) && !BNX2X_HAS_WORK(fp)) { 9281 if ((work_done < budget) && !BNX2X_HAS_WORK(fp)) {