> +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 via email to