netxen: fix deadlock on dev close

netxen: fix deadlock on dev close

The tx ring accounting fix in commit cb2107be43
("netxen: fix tx ring accounting") introduced intermittent
deadlock when inteface is going down.

This was possibly combined effect of speculative tx pause,
calling netif_tx_lock instead of queue lock and unclean
synchronization with napi which could end up unmasking
interrupt.

Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Dhananjay Phadke
2009-07-17 15:27:07 +00:00
committed by David S. Miller
parent cf981ffb31
commit b2af9cb06d
4 changed files with 23 additions and 13 deletions

View File

@@ -215,9 +215,9 @@ netxen_napi_disable(struct netxen_adapter *adapter)
for (ring = 0; ring < adapter->max_sds_rings; ring++) {
sds_ring = &recv_ctx->sds_rings[ring];
napi_disable(&sds_ring->napi);
netxen_nic_disable_int(sds_ring);
synchronize_irq(sds_ring->irq);
napi_synchronize(&sds_ring->napi);
napi_disable(&sds_ring->napi);
}
}
@@ -833,11 +833,11 @@ netxen_nic_up(struct netxen_adapter *adapter, struct net_device *netdev)
adapter->ahw.linkup = 0;
netxen_napi_enable(adapter);
if (adapter->max_sds_rings > 1)
netxen_config_rss(adapter, 1);
netxen_napi_enable(adapter);
if (adapter->capabilities & NX_FW_CAPABILITY_LINK_NOTIFICATION)
netxen_linkevent_request(adapter, 1);
else
@@ -851,8 +851,9 @@ netxen_nic_up(struct netxen_adapter *adapter, struct net_device *netdev)
static void
netxen_nic_down(struct netxen_adapter *adapter, struct net_device *netdev)
{
spin_lock(&adapter->tx_clean_lock);
netif_carrier_off(netdev);
netif_stop_queue(netdev);
netif_tx_disable(netdev);
if (adapter->stop_port)
adapter->stop_port(adapter);
@@ -863,9 +864,10 @@ netxen_nic_down(struct netxen_adapter *adapter, struct net_device *netdev)
netxen_napi_disable(adapter);
netxen_release_tx_buffers(adapter);
spin_unlock(&adapter->tx_clean_lock);
FLUSH_SCHEDULED_WORK();
del_timer_sync(&adapter->watchdog_timer);
FLUSH_SCHEDULED_WORK();
}
@@ -1645,6 +1647,9 @@ static void netxen_tx_timeout_task(struct work_struct *work)
struct netxen_adapter *adapter =
container_of(work, struct netxen_adapter, tx_timeout_task);
if (!netif_running(adapter->netdev))
return;
printk(KERN_ERR "%s %s: transmit timeout, resetting.\n",
netxen_nic_driver_name, adapter->netdev->name);
@@ -1757,7 +1762,8 @@ static int netxen_nic_poll(struct napi_struct *napi, int budget)
if ((work_done < budget) && tx_complete) {
napi_complete(&sds_ring->napi);
netxen_nic_enable_int(sds_ring);
if (netif_running(adapter->netdev))
netxen_nic_enable_int(sds_ring);
}
return work_done;