1 From e8b5fc514d1c7637cb4b8f77e7d8ac33ef66130c Mon Sep 17 00:00:00 2001
2 From: Vladislav Zolotarov <vladz@broadcom.com>
3 Date: Mon, 26 Jan 2009 12:36:42 -0800
4 Subject: bnx2x: tx_has_work should not wait for FW
5 Acked-by: Karsten Keil <kkeil@novell.com>
8 The current tx_has_work waited until all packets sent by the driver
9 are marked as completed by the FW. This is too greedy and it causes
10 the bnx2x_poll to spin in vain. The driver should only check that all
11 packets FW already completed are freed - only in unload flow the
12 driver should make sure that transmit queue is empty
14 Signed-off-by: Vladislav Zolotarov <vladz@broadcom.com>
15 Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
16 Signed-off-by: David S. Miller <davem@davemloft.net>
18 drivers/net/bnx2x_main.c | 17 ++++++++++++-----
19 1 files changed, 12 insertions(+), 5 deletions(-)
21 Index: linux-2.6.27-bnx2x_2/drivers/net/bnx2x_main.c
22 ===================================================================
23 --- linux-2.6.27-bnx2x_2.orig/drivers/net/bnx2x_main.c
24 +++ linux-2.6.27-bnx2x_2/drivers/net/bnx2x_main.c
27 #include "bnx2x_init.h"
29 -#define DRV_MODULE_VERSION "1.45.25"
30 -#define DRV_MODULE_RELDATE "2009/01/22"
31 +#define DRV_MODULE_VERSION "1.45.26"
32 +#define DRV_MODULE_RELDATE "2009/01/26"
33 #define BNX2X_BC_VER 0x040200
35 /* Time in jiffies before concluding the transmitter is hung */
36 @@ -740,8 +740,15 @@ static inline int bnx2x_has_tx_work(stru
37 /* Tell compiler that status block fields can change */
39 tx_cons_sb = le16_to_cpu(*fp->tx_cons_sb);
40 - return ((fp->tx_pkt_prod != tx_cons_sb) ||
41 - (fp->tx_pkt_prod != fp->tx_pkt_cons));
42 + return (fp->tx_pkt_cons != tx_cons_sb);
45 +static inline int bnx2x_has_tx_work_unload(struct bnx2x_fastpath *fp)
47 + /* Tell compiler that consumer and producer can change */
49 + return (fp->tx_pkt_prod != fp->tx_pkt_cons);
53 /* free skb in the packet ring at pos idx
54 @@ -6732,7 +6739,7 @@ static int bnx2x_nic_unload(struct bnx2x
58 - while (bnx2x_has_tx_work(fp)) {
59 + while (bnx2x_has_tx_work_unload(fp)) {
61 bnx2x_tx_int(fp, 1000);