aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen/netxen_nic_init.c
diff options
context:
space:
mode:
authorDhananjay Phadke <dhananjay@netxen.com>2009-05-05 15:05:06 -0400
committerDavid S. Miller <davem@davemloft.net>2009-05-06 18:33:35 -0400
commit22527864ed7ee6c50f3c4d4b03c83c963caf5c0b (patch)
tree074c3dce3fe61b54aec6c7d8a829c4fa7592a6c0 /drivers/net/netxen/netxen_nic_init.c
parent78a658d9720ce1b3dd71af3ee6d207ca751a48f5 (diff)
netxen: fix race in tx ring acccess
Fix the distance check between tx ring producer and consumer that could lead to tx ring wrap around. Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netxen/netxen_nic_init.c')
-rw-r--r--drivers/net/netxen/netxen_nic_init.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index d18216779a09..de9ebbd841b7 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -1319,10 +1319,11 @@ int netxen_process_cmd_ring(struct netxen_adapter *adapter)
1319 break; 1319 break;
1320 } 1320 }
1321 1321
1322 if (count) { 1322 tx_ring->sw_consumer = sw_consumer;
1323 tx_ring->sw_consumer = sw_consumer; 1323
1324 if (count && netif_running(netdev)) {
1324 smp_mb(); 1325 smp_mb();
1325 if (netif_queue_stopped(netdev) && netif_running(netdev)) { 1326 if (netif_queue_stopped(netdev) && netif_carrier_ok(netdev)) {
1326 netif_tx_lock(netdev); 1327 netif_tx_lock(netdev);
1327 netif_wake_queue(netdev); 1328 netif_wake_queue(netdev);
1328 smp_mb(); 1329 smp_mb();
@@ -1450,7 +1451,6 @@ netxen_post_rx_buffers_nodb(struct netxen_adapter *adapter,
1450 rds_ring->producer = producer; 1451 rds_ring->producer = producer;
1451 NXWR32(adapter, rds_ring->crb_rcv_producer, 1452 NXWR32(adapter, rds_ring->crb_rcv_producer,
1452 (producer - 1) & (rds_ring->num_desc - 1)); 1453 (producer - 1) & (rds_ring->num_desc - 1));
1453 wmb();
1454 } 1454 }
1455 spin_unlock(&rds_ring->lock); 1455 spin_unlock(&rds_ring->lock);
1456} 1456}