public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn•ch>
To: Joao Pinto <Joao.Pinto@synopsys•com>
Cc: Jose Abreu <Jose.Abreu@synopsys•com>,
	"netdev@vger•kernel.org" <netdev@vger•kernel.org>,
	"David S. Miller" <davem@davemloft•net>,
	Giuseppe Cavallaro <peppe.cavallaro@st•com>,
	Alexandre Torgue <alexandre.torgue@st•com>
Subject: Re: [PATCH net-next 2/2] net: stmmac: Add support for DWMAC5 and implement Safety Features
Date: Thu, 1 Feb 2018 16:02:09 +0100	[thread overview]
Message-ID: <20180201150209.GB16818@lunn.ch> (raw)
In-Reply-To: <D5C2FD580325C2409E11CD8571E1431C0180B5FD@de02wembxa.internal.synopsys.com>

> +static void dwmac5_log_error(struct net_device *ndev, u32 value, bool corr,
> +		const char *module_name, const char **errors_str) {
> +	unsigned long loc, mask;
> +
> +	mask = value;
> +	for_each_set_bit(loc, &mask, 32) {
> +		netdev_err(ndev, "Found %s error in %s: '%s'\n", corr ?
> +				"correctable" : "uncorrectable", module_name,
> +				errors_str[loc]);
> +	}
> +}

How about also adding ethtool -S stats. You have a text string, so all
you need to add is a counter. And i expect statistics are looked at
more than dmesg output.

> +
> +static bool dwmac5_handle_mac_err(struct net_device *ndev,
> +		void __iomem *ioaddr, bool correctable) {
> +	u32 value;
> +
> +	value = readl(ioaddr + MAC_DPP_FSM_INT_STATUS);
> +	writel(value, ioaddr + MAC_DPP_FSM_INT_STATUS);
> +
> +	dwmac5_log_error(ndev, value, correctable, "MAC", dwmac5_mac_errors);
> +	return !correctable;
> +}

Returning !correctable in all these functions seems pointless.  None
of the handlers change its value. So just make these void functions.

>  static void stmmac_global_err(struct stmmac_priv *priv)  {
> +	netif_carrier_off(priv->dev);
>  	set_bit(STMMAC_RESET_REQUESTED, &priv->state);
>  	stmmac_service_event_schedule(priv);
>  }

This should be in a separate patch, with an explanation why it is
needed.

	Andrew

  reply	other threads:[~2018-02-01 15:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-01 14:41 [PATCH net-next 0/2] Fix TX Timeout and implement Safety Features Jose Abreu
2018-02-01 14:41 ` [PATCH net-next 1/2] net: stmmac: Rework and fix TX Timeout code Jose Abreu
2018-02-01 14:41 ` [PATCH net-next 2/2] net: stmmac: Add support for DWMAC5 and implement Safety Features Jose Abreu
2018-02-01 14:44   ` Joao Pinto
2018-02-01 15:02     ` Andrew Lunn [this message]
2018-02-01 15:09       ` David Miller
2018-02-01 15:26         ` Jose Abreu
2018-02-01 15:33           ` David Miller
2018-02-01 15:18       ` Jose Abreu

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=20180201150209.GB16818@lunn.ch \
    --to=andrew@lunn$(echo .)ch \
    --cc=Joao.Pinto@synopsys$(echo .)com \
    --cc=Jose.Abreu@synopsys$(echo .)com \
    --cc=alexandre.torgue@st$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=peppe.cavallaro@st$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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