Commit 9fe6cb58 authored by Gavin Shan's avatar Gavin Shan Committed by David S. Miller

net/cxgb4: Don't retrieve stats during recovery

We possibly retrieve the adapter's statistics during EEH recovery
and that should be disallowed. Otherwise, it would possibly incur
replicate EEH error and EEH recovery is going to fail eventually.

The patch reuses statistics lock and checks net_device is attached
before going to retrieve statistics, so that the problem can be
avoided.
Signed-off-by: default avatarGavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 144be3d9
...@@ -4288,7 +4288,15 @@ static struct rtnl_link_stats64 *cxgb_get_stats(struct net_device *dev, ...@@ -4288,7 +4288,15 @@ static struct rtnl_link_stats64 *cxgb_get_stats(struct net_device *dev,
struct port_info *p = netdev_priv(dev); struct port_info *p = netdev_priv(dev);
struct adapter *adapter = p->adapter; struct adapter *adapter = p->adapter;
/* Block retrieving statistics during EEH error
* recovery. Otherwise, the recovery might fail
* and the PCI device will be removed permanently
*/
spin_lock(&adapter->stats_lock); spin_lock(&adapter->stats_lock);
if (!netif_device_present(dev)) {
spin_unlock(&adapter->stats_lock);
return ns;
}
t4_get_port_stats(adapter, p->tx_chan, &stats); t4_get_port_stats(adapter, p->tx_chan, &stats);
spin_unlock(&adapter->stats_lock); spin_unlock(&adapter->stats_lock);
...@@ -5496,12 +5504,14 @@ static pci_ers_result_t eeh_err_detected(struct pci_dev *pdev, ...@@ -5496,12 +5504,14 @@ static pci_ers_result_t eeh_err_detected(struct pci_dev *pdev,
rtnl_lock(); rtnl_lock();
adap->flags &= ~FW_OK; adap->flags &= ~FW_OK;
notify_ulds(adap, CXGB4_STATE_START_RECOVERY); notify_ulds(adap, CXGB4_STATE_START_RECOVERY);
spin_lock(&adap->stats_lock);
for_each_port(adap, i) { for_each_port(adap, i) {
struct net_device *dev = adap->port[i]; struct net_device *dev = adap->port[i];
netif_device_detach(dev); netif_device_detach(dev);
netif_carrier_off(dev); netif_carrier_off(dev);
} }
spin_unlock(&adap->stats_lock);
if (adap->flags & FULL_INIT_DONE) if (adap->flags & FULL_INIT_DONE)
cxgb_down(adap); cxgb_down(adap);
rtnl_unlock(); rtnl_unlock();
......
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