netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: Gavin Shan <shangw@linux.vnet.ibm.com>
Cc: netdev@vger.kernel.org, dm@chelsio.com
Subject: Re: [PATCH 2/2] net/cxgb4: Don't retrieve stats during recovery
Date: Mon, 20 Jan 2014 03:49:11 +0000	[thread overview]
Message-ID: <1390189751.3651.48.camel@deadeye.wl.decadent.org.uk> (raw)
In-Reply-To: <1390187144-15495-2-git-send-email-shangw@linux.vnet.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 1754 bytes --]

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 <shangw@linux.vnet.ibm.com>
> ---
>  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.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

  reply	other threads:[~2014-01-20  3:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-20  3:05 [PATCH 1/2] net/cxgb4: Avoid disabling PCI device for towice Gavin Shan
2014-01-20  3:05 ` [PATCH 2/2] net/cxgb4: Don't retrieve stats during recovery Gavin Shan
2014-01-20  3:49   ` Ben Hutchings [this message]
2014-01-20 14:35   ` Sergei Shtylyov
2014-01-20 22:05   ` Dimitris Michailidis
     [not found]     ` <20140121023404.GA6575@shangw.(null)>
     [not found]       ` <20140123013134.GA5947@shangw.(null)>
2014-01-23  2:17         ` Dimitrios Michailidis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1390189751.3651.48.camel@deadeye.wl.decadent.org.uk \
    --to=ben@decadent.org.uk \
    --cc=dm@chelsio.com \
    --cc=netdev@vger.kernel.org \
    --cc=shangw@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).