lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 10 May 2022 09:32:53 -0700
From:   Florian Fainelli <f.fainelli@...il.com>
To:     Clément Léger <clement.leger@...tlin.com>,
        Andrew Lunn <andrew@...n.ch>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Vladimir Oltean <olteanv@...il.com>,
        "David S . Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzk+dt@...nel.org>,
        Geert Uytterhoeven <geert+renesas@...der.be>,
        Magnus Damm <magnus.damm@...il.com>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Russell King <linux@...linux.org.uk>
Cc:     Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
        Herve Codina <herve.codina@...tlin.com>,
        Miquèl Raynal <miquel.raynal@...tlin.com>,
        Milan Stevanovic <milan.stevanovic@...com>,
        Jimmy Lalande <jimmy.lalande@...com>,
        Pascal Eberhard <pascal.eberhard@...com>,
        linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
        linux-renesas-soc@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH net-next v4 07/12] net: dsa: rzn1-a5psw: add statistics
 support

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@...tlin.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),   \
+}

The attached patch does the conversion if you want to fixup into your 
commit.
-- 
Florian
View attachment "rzn1_a5psw.c.diff" of type "text/x-patch" (4322 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ