net: phy: adin: add ethtool get_stats support
authorAlexandru Ardelean <alexandru.ardelean@analog.com>
Fri, 16 Aug 2019 13:10:10 +0000 (16:10 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 16 Aug 2019 18:56:26 +0000 (11:56 -0700)
commit9fe0b8d6ba9fea0018dc3ac93f4677c8d44bb9a0
treee7dafe58ce57d163cd881b4dbbf917ec492d9337
parent2d99b58461e111f1fd662f275f9711027bab4913
net: phy: adin: add ethtool get_stats support

This change implements retrieving all the error counters from the PHY.

The counters require that the RxErrCnt register (0x0014) be read first,
after which copies of the counters are latched into the registers. This
ensures that all registers read after RxErrCnt are synchronized at the
moment that they are read.

The counter values need to be accumulated by the driver, as each time that
RxErrCnt is read, the values that are latched are the ones that have
incremented from the last read.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/adin.c