aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/qlcnic/qlcnic_hw.c
diff options
context:
space:
mode:
authorRajesh K Borundia <rajesh.borundia@qlogic.com>2010-06-16 22:56:41 -0400
committerDavid S. Miller <davem@davemloft.net>2010-06-17 11:57:56 -0400
commitef71ff833acfd3795c3af1bb800ac186561508ef (patch)
treefa285765677574d4aafb42c9fbbc32443a8e4597 /drivers/net/qlcnic/qlcnic_hw.c
parent8f891387aa73b85d2ea8d953e04dac224f687e52 (diff)
qlcnic: fix race in tx stop queue
There is a race between netif_stop_queue and netif_stopped_queue check. So check once again if buffers are available to avoid race. With above logic we can also get rid of tx lock in process_cmd_ring. Signed-off-by: Rajesh K Borundia <rajesh.borundia@qlogic.com> Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/qlcnic/qlcnic_hw.c')
-rw-r--r--drivers/net/qlcnic/qlcnic_hw.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/net/qlcnic/qlcnic_hw.c b/drivers/net/qlcnic/qlcnic_hw.c
index f776956d2d6c..d9becb96d403 100644
--- a/drivers/net/qlcnic/qlcnic_hw.c
+++ b/drivers/net/qlcnic/qlcnic_hw.c
@@ -338,9 +338,15 @@ qlcnic_send_cmd_descs(struct qlcnic_adapter *adapter,
338 338
339 if (nr_desc >= qlcnic_tx_avail(tx_ring)) { 339 if (nr_desc >= qlcnic_tx_avail(tx_ring)) {
340 netif_tx_stop_queue(tx_ring->txq); 340 netif_tx_stop_queue(tx_ring->txq);
341 __netif_tx_unlock_bh(tx_ring->txq); 341 smp_mb();
342 adapter->stats.xmit_off++; 342 if (qlcnic_tx_avail(tx_ring) > nr_desc) {
343 return -EBUSY; 343 if (qlcnic_tx_avail(tx_ring) > TX_STOP_THRESH)
344 netif_tx_wake_queue(tx_ring->txq);
345 } else {
346 adapter->stats.xmit_off++;
347 __netif_tx_unlock_bh(tx_ring->txq);
348 return -EBUSY;
349 }
344 } 350 }
345 351
346 do { 352 do {