Re: [PATCH net-next 07/12] net: dsa: rzn1-a5psw: add statistics support

Clément Léger
2022-04-15T12:43:37Z

Le Thu, 14 Apr 2022 20:34:44 +0300,
Vladimir Oltean <olteanv@gmail.com> a écrit :

> On Thu, Apr 14, 2022 at 02:22:45PM +0200, Clément Léger wrote:
> > Add per-port statistics. This support requries to add a stat lock since
> > statistics are stored in two 32 bits registers, the hi part one being
> > global and latched when accessing the lo part.
> >
> > Signed-off-by: Clément Léger <clement.leger@bootlin.com>
> > ---
>
> I think for new drivers Jakub will also want to see the more specific
> and less free-form get_stats64, get_eth_mac_stats, get_eth_phy_stats,
> get_eth_ctrl_stats ops implemented. Your counters should map nicely over
> these.

Ok, I'll implement these callbacks !

>
> > drivers/net/dsa/rzn1_a5psw.c | 101 +++++++++++++++++++++++++++++++++++
> > drivers/net/dsa/rzn1_a5psw.h | 2 +
> > 2 files changed, 103 insertions(+)
> >
> > diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
> > index 5bee999f7050..7ab7d9054427 100644
> > --- a/drivers/net/dsa/rzn1_a5psw.c
> > +++ b/drivers/net/dsa/rzn1_a5psw.c
> > @@ -16,6 +16,59 @@
> >
> > #include "rzn1_a5psw.h"
> >
> > +struct a5psw_stats {
> > + u16 offset;
> > + const char *name;
> > +};
> > +
> > +#define STAT_DESC(_offset, _name) {.offset = _offset, .name = _name}
> > +
> > +static const struct a5psw_stats a5psw_stats[] = {
> > + STAT_DESC(0x868, "aFrameTransmitted"),
> > + STAT_DESC(0x86C, "aFrameReceived"),
> > + STAT_DESC(0x870, "aFrameCheckSequenceErrors"),
> > + STAT_DESC(0x874, "aAlignmentErrors"),
> > + STAT_DESC(0x878, "aOctetsTransmitted"),
> > + STAT_DESC(0x87C, "aOctetsReceived"),
> > + STAT_DESC(0x880, "aTxPAUSEMACCtrlFrames"),
> > + STAT_DESC(0x884, "aRxPAUSEMACCtrlFrames"),
>
> What does the "a" stand for?

That's a mystery :/ I tried to be a normal person and copy/pasted these
from the datasheet ;)

--
Clément Léger,
Embedded Linux and Kernel engineer at Bootlin