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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le Tue, 10 May 2022 09:32:53 -0700,
Florian Fainelli <f.fainelli@xxxxxxxxx> 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@xxxxxxxxxxx>
> > ---
> >   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.





[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux