diff options
author | Divy Le Ray <divy@chelsio.com> | 2009-05-28 07:23:08 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-05-29 04:54:41 -0400 |
commit | c22c8149313ee85c912e7b77a7afd04be8b8cba8 (patch) | |
tree | 84f18d574d01a0e7222c54f38d8e9cba9ba1c468 /drivers/net/cxgb3 | |
parent | 10b6d95612672f89deb39b5a60fb677c78ba4844 (diff) |
cxgb3: link fault fixes
Do not call t3_link_fault() under spinlock, as it calls msleep().
Besides, only the access to pi->link_fault needs to be serialized.
Also initialize local variables before checking the link status,
link state fields might otherwise end up containing garbage.
Signed-off-by: Divy Le Ray <divy@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cxgb3')
-rw-r--r-- | drivers/net/cxgb3/cxgb3_main.c | 8 | ||||
-rw-r--r-- | drivers/net/cxgb3/t3_hw.c | 5 |
2 files changed, 10 insertions, 3 deletions
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c index 7ea48414c6cb..17858b9a5830 100644 --- a/drivers/net/cxgb3/cxgb3_main.c +++ b/drivers/net/cxgb3/cxgb3_main.c | |||
@@ -2496,14 +2496,16 @@ static void check_link_status(struct adapter *adapter) | |||
2496 | for_each_port(adapter, i) { | 2496 | for_each_port(adapter, i) { |
2497 | struct net_device *dev = adapter->port[i]; | 2497 | struct net_device *dev = adapter->port[i]; |
2498 | struct port_info *p = netdev_priv(dev); | 2498 | struct port_info *p = netdev_priv(dev); |
2499 | int link_fault; | ||
2499 | 2500 | ||
2500 | spin_lock_irq(&adapter->work_lock); | 2501 | spin_lock_irq(&adapter->work_lock); |
2501 | if (p->link_fault) { | 2502 | link_fault = p->link_fault; |
2503 | spin_unlock_irq(&adapter->work_lock); | ||
2504 | |||
2505 | if (link_fault) { | ||
2502 | t3_link_fault(adapter, i); | 2506 | t3_link_fault(adapter, i); |
2503 | spin_unlock_irq(&adapter->work_lock); | ||
2504 | continue; | 2507 | continue; |
2505 | } | 2508 | } |
2506 | spin_unlock_irq(&adapter->work_lock); | ||
2507 | 2509 | ||
2508 | if (!(p->phy.caps & SUPPORTED_IRQ) && netif_running(dev)) { | 2510 | if (!(p->phy.caps & SUPPORTED_IRQ) && netif_running(dev)) { |
2509 | t3_xgm_intr_disable(adapter, i); | 2511 | t3_xgm_intr_disable(adapter, i); |
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c index 4f68aeb2679a..4950d5d789ae 100644 --- a/drivers/net/cxgb3/t3_hw.c +++ b/drivers/net/cxgb3/t3_hw.c | |||
@@ -1274,6 +1274,11 @@ void t3_link_fault(struct adapter *adapter, int port_id) | |||
1274 | A_XGM_INT_STATUS + mac->offset); | 1274 | A_XGM_INT_STATUS + mac->offset); |
1275 | link_fault &= F_LINKFAULTCHANGE; | 1275 | link_fault &= F_LINKFAULTCHANGE; |
1276 | 1276 | ||
1277 | link_ok = lc->link_ok; | ||
1278 | speed = lc->speed; | ||
1279 | duplex = lc->duplex; | ||
1280 | fc = lc->fc; | ||
1281 | |||
1277 | phy->ops->get_link_status(phy, &link_ok, &speed, &duplex, &fc); | 1282 | phy->ops->get_link_status(phy, &link_ok, &speed, &duplex, &fc); |
1278 | 1283 | ||
1279 | if (link_fault) { | 1284 | if (link_fault) { |