Re: [PATCH net-next v2 2/6] net: phy: mscc: add ethtool statistics counters

From: Andrew Lunn
Date: Thu Oct 04 2018 - 11:22:44 EST


On Thu, Oct 04, 2018 at 02:47:24PM +0200, Quentin Schulz wrote:

Hi Quentin

> +static u64 vsc85xx_get_stat(struct phy_device *phydev, int i)
> +{
> + struct vsc8531_private *priv = phydev->priv;
> + int val, oldpage;
> + u64 ret;
> +
> + oldpage = phy_select_page(phydev, priv->hw_stats[i].page);
> +
> + val = __phy_read(phydev, priv->hw_stats[i].reg);
> + if (val < 0) {
> + ret = U64_MAX;
> + goto out;
> + }

phy_read_paged() should work here as well.

> +
> + val = val & priv->hw_stats[i].mask;
> + priv->stats[i] += val;
> + ret = priv->stats[i];

Otherwise this looks good.

Reviewed-by: Andrew Lunn <andrew@xxxxxxx>

Andrew