From: Andrew Lunn 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 Message-ID: <20180201150209.GB16818@lunn.ch> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Jose Abreu , "netdev@vger.kernel.org" , "David S. Miller" , Giuseppe Cavallaro , Alexandre Torgue To: Joao Pinto Return-path: Received: from vps0.lunn.ch ([185.16.172.187]:43818 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751408AbeBAPCO (ORCPT ); Thu, 1 Feb 2018 10:02:14 -0500 Content-Disposition: inline In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: > +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