From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3941C433EF for ; Fri, 15 Apr 2022 12:43:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353745AbiDOMqD (ORCPT ); Fri, 15 Apr 2022 08:46:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241937AbiDOMqA (ORCPT ); Fri, 15 Apr 2022 08:46:00 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9439AC31D7; Fri, 15 Apr 2022 05:43:31 -0700 (PDT) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 3E09CE0005; Fri, 15 Apr 2022 12:43:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1650026610; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8erFvk+2hjel+P0tYw+hz99use+hgo7ZwPscCOBWUUI=; b=O4r486fzPea8x95LEc66uX+VfbejUeNr3S9jo6emAvz/RAciWQTeIoLsBKasizdh1s5Hx+ PTMlexfVy0fQsijFnKOcoZz58EaQFcqrwxyC8VzGwQlFsJ/4+AnoikyAIlkrgWTTUVb96Y 083jY2EzKumwc11wphcnozz/t3ou6xO9E6ubaLTWQ42Oxtwz1dK0opxkLtOzefLsKXIE6j 4yYc2Ap2Tndz/D4Kw5cThhJzRPXR0UMoSEQRL2V0UnYOu0lcy8eYop1Ul+ao88VEIgHIvV zVpP+qIegCingWUaCxiPz2tUMrUrWhC9Cd6wNFeKs73f15Vx1GaYQZA8XOhWxQ== Date: Fri, 15 Apr 2022 14:42:02 +0200 From: =?UTF-8?B?Q2zDqW1lbnQgTMOpZ2Vy?= To: Vladimir Oltean Cc: Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S . Miller" , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Geert Uytterhoeven , Magnus Damm , Heiner Kallweit , Russell King , Thomas Petazzoni , Herve Codina , =?UTF-8?B?TWlxdcOobA==?= Raynal , Milan Stevanovic , Jimmy Lalande , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH net-next 07/12] net: dsa: rzn1-a5psw: add statistics support Message-ID: <20220415144202.64b6c3b4@fixe.home> In-Reply-To: <20220414173444.iymkyes7iu4jifte@skbuf> References: <20220414122250.158113-1-clement.leger@bootlin.com> <20220414122250.158113-8-clement.leger@bootlin.com> <20220414173444.iymkyes7iu4jifte@skbuf> Organization: Bootlin X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le Thu, 14 Apr 2022 20:34:44 +0300, Vladimir Oltean a =C3=A9crit : > On Thu, Apr 14, 2022 at 02:22:45PM +0200, Cl=C3=A9ment L=C3=A9ger 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. > >=20 > > Signed-off-by: Cl=C3=A9ment L=C3=A9ger > > --- =20 >=20 > 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 ! >=20 > > drivers/net/dsa/rzn1_a5psw.c | 101 +++++++++++++++++++++++++++++++++++ > > drivers/net/dsa/rzn1_a5psw.h | 2 + > > 2 files changed, 103 insertions(+) > >=20 > > 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 @@ > > =20 > > #include "rzn1_a5psw.h" > > =20 > > +struct a5psw_stats { > > + u16 offset; > > + const char *name; > > +}; > > + > > +#define STAT_DESC(_offset, _name) {.offset =3D _offset, .name =3D _nam= e} > > + > > +static const struct a5psw_stats a5psw_stats[] =3D { > > + 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"), =20 >=20 > What does the "a" stand for? That's a mystery :/ I tried to be a normal person and copy/pasted these from the datasheet ;) --=20 Cl=C3=A9ment L=C3=A9ger, Embedded Linux and Kernel engineer at Bootlin https://bootlin.com