On Mon, 2014-01-20 at 11:05 +0800, Gavin Shan wrote: > We possiblly 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 checks if the PCI device is off-line before statistic > retrieval. > > Signed-off-by: Gavin Shan > --- > drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c > index c8eafbf..b0e72fb 100644 > --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c > +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c > @@ -4288,6 +4288,17 @@ static struct rtnl_link_stats64 *cxgb_get_stats(struct net_device *dev, > struct port_info *p = netdev_priv(dev); > struct adapter *adapter = p->adapter; > > + /* > + * We possibly retrieve the statistics while the PCI > + * device is off-line. That would cause the recovery > + * on off-lined PCI device going to fail. So it's > + * reasonable to block it during the recovery period. > + */ > + if (pci_channel_offline(adapter->pdev)) { > + memset(ns, 0, sizeof(*ns)); > + return ns; > + } The buffer is already zero-initialised so there's no need for this memset(). > spin_lock(&adapter->stats_lock); > t4_get_port_stats(adapter, p->tx_chan, &stats); > spin_unlock(&adapter->stats_lock); Is there anything to stop this running just after pci_channel_offline() becomes true? Ben. -- Ben Hutchings One of the nice things about standards is that there are so many of them.