lkml.org 
[lkml]   [2022]   [May]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH net-next v4 07/12] net: dsa: rzn1-a5psw: add statistics support
Le Tue, 10 May 2022 09:32:53 -0700,
Florian Fainelli <f.fainelli@gmail.com> a écrit :

> On 5/9/22 06:18, Clément Léger wrote:
> > Add statistics support to the rzn1-a5psw driver by implementing the
> > following dsa_switch_ops callbacks:
> > - get_sset_count()
> > - get_strings()
> > - get_ethtool_stats()
> > - get_eth_mac_stats()
> > - get_eth_ctrl_stats()
> > - get_rmon_stats()
> >
> > Signed-off-by: Clément Léger <clement.leger@bootlin.com>
> > ---
> > drivers/net/dsa/rzn1_a5psw.c | 178
> > +++++++++++++++++++++++++++++++++++ drivers/net/dsa/rzn1_a5psw.h |
> > 46 ++++++++- 2 files changed, 223 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/dsa/rzn1_a5psw.c
> > b/drivers/net/dsa/rzn1_a5psw.c index 1e2fac80f3e0..46ba25672593
> > 100644 --- a/drivers/net/dsa/rzn1_a5psw.c
> > +++ b/drivers/net/dsa/rzn1_a5psw.c
> > @@ -17,6 +17,61 @@
> >
> > #include "rzn1_a5psw.h"
> >
> > +struct a5psw_stats {
> > + u16 offset;
> > + const char name[ETH_GSTRING_LEN];
> > +};
> > +
> > +#define STAT_DESC(_offset, _name) {.offset = _offset, .name =
> > _name}
>
> You can build a more compact representation as long as you keep the
> offset constant and the name in sync, the attached patch and leverage
> the __stringify() macro to construct the name field:
>
> -#define STAT_DESC(_offset, _name) {.offset = _offset, .name = _name}
> +#define STAT_DESC(_offset) { \
> + .offset = A5PSW_##_offset, \
> + .name = __stringify(_offset), \
> +}

Indeed, nice catch ! Thanks for the patch !

>
> The attached patch does the conversion if you want to fixup into your
> commit.

\
 
 \ /
  Last update: 2022-05-11 09:08    [W:0.106 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site