Commit c22c8149 authored by Divy Le Ray's avatar Divy Le Ray Committed by David S. Miller

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: default avatarDivy Le Ray <divy@chelsio.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 10b6d956
...@@ -2496,14 +2496,16 @@ static void check_link_status(struct adapter *adapter) ...@@ -2496,14 +2496,16 @@ static void check_link_status(struct adapter *adapter)
for_each_port(adapter, i) { for_each_port(adapter, i) {
struct net_device *dev = adapter->port[i]; struct net_device *dev = adapter->port[i];
struct port_info *p = netdev_priv(dev); struct port_info *p = netdev_priv(dev);
int link_fault;
spin_lock_irq(&adapter->work_lock); spin_lock_irq(&adapter->work_lock);
if (p->link_fault) { link_fault = p->link_fault;
spin_unlock_irq(&adapter->work_lock);
if (link_fault) {
t3_link_fault(adapter, i); t3_link_fault(adapter, i);
spin_unlock_irq(&adapter->work_lock);
continue; continue;
} }
spin_unlock_irq(&adapter->work_lock);
if (!(p->phy.caps & SUPPORTED_IRQ) && netif_running(dev)) { if (!(p->phy.caps & SUPPORTED_IRQ) && netif_running(dev)) {
t3_xgm_intr_disable(adapter, i); t3_xgm_intr_disable(adapter, i);
......
...@@ -1274,6 +1274,11 @@ void t3_link_fault(struct adapter *adapter, int port_id) ...@@ -1274,6 +1274,11 @@ void t3_link_fault(struct adapter *adapter, int port_id)
A_XGM_INT_STATUS + mac->offset); A_XGM_INT_STATUS + mac->offset);
link_fault &= F_LINKFAULTCHANGE; link_fault &= F_LINKFAULTCHANGE;
link_ok = lc->link_ok;
speed = lc->speed;
duplex = lc->duplex;
fc = lc->fc;
phy->ops->get_link_status(phy, &link_ok, &speed, &duplex, &fc); phy->ops->get_link_status(phy, &link_ok, &speed, &duplex, &fc);
if (link_fault) { if (link_fault) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment