From: "Anwar, Md Danish" <a0501179@ti.com>
To: Dan Carpenter <dan.carpenter@linaro.org>,
MD Danish Anwar <danishanwar@ti.com>
Cc: Nishanth Menon <nm@ti.com>, Andrew Lunn <andrew@lunn.ch>,
Vignesh Raghavendra <vigneshr@ti.com>,
Jan Kiszka <jan.kiszka@siemens.com>,
Eric Dumazet <edumazet@google.com>,
Diogo Ivo <diogo.ivo@siemens.com>, Rob Herring <robh@kernel.org>,
Sai Krishna <saikrishnag@marvell.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
devicetree@vger.kernel.org, Conor Dooley <conor+dt@kernel.org>,
Roger Quadros <rogerq@kernel.org>,
Santosh Shilimkar <ssantosh@kernel.org>,
linux-arm-kernel@lists.infradead.org, srk@ti.com,
Kory Maincent <kory.maincent@bootlin.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Simon Horman <horms@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Heiner Kallweit <hkallweit1@gmail.com>
Subject: Re: [PATCH net-next v5 2/2] net: ti: icssg-prueth: Add support for PA Stats
Date: Mon, 19 Aug 2024 12:45:30 +0530 [thread overview]
Message-ID: <2ee6f2eb-9a3f-4e04-a6d5-059c4381cbd8@ti.com> (raw)
In-Reply-To: <cd15268f-f6d3-4fca-bd7f-c94011f55996@stanley.mountain>
On 8/15/2024 4:58 PM, Dan Carpenter wrote:
> On Wed, Aug 14, 2024 at 02:50:33PM +0530, MD Danish Anwar wrote:
>> Add support for dumping PA stats registers via ethtool.
>> Firmware maintained stats are stored at PA Stats registers.
>> Also modify emac_get_strings() API to use ethtool_puts().
>>
>> Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
>> ---
>> drivers/net/ethernet/ti/icssg/icssg_ethtool.c | 17 +++++-----
>> drivers/net/ethernet/ti/icssg/icssg_prueth.c | 6 ++++
>> drivers/net/ethernet/ti/icssg/icssg_prueth.h | 5 ++-
>> drivers/net/ethernet/ti/icssg/icssg_stats.c | 19 +++++++++--
>> drivers/net/ethernet/ti/icssg/icssg_stats.h | 32 +++++++++++++++++++
>> 5 files changed, 67 insertions(+), 12 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/ti/icssg/icssg_ethtool.c b/drivers/net/ethernet/ti/icssg/icssg_ethtool.c
>> index 5688f054cec5..51bb509d37c7 100644
>> --- a/drivers/net/ethernet/ti/icssg/icssg_ethtool.c
>> +++ b/drivers/net/ethernet/ti/icssg/icssg_ethtool.c
>> @@ -83,13 +83,11 @@ static void emac_get_strings(struct net_device *ndev, u32 stringset, u8 *data)
>>
>> switch (stringset) {
>> case ETH_SS_STATS:
>> - for (i = 0; i < ARRAY_SIZE(icssg_all_stats); i++) {
>> - if (!icssg_all_stats[i].standard_stats) {
>> - memcpy(p, icssg_all_stats[i].name,
>> - ETH_GSTRING_LEN);
>> - p += ETH_GSTRING_LEN;
>> - }
>> - }
>> + for (i = 0; i < ARRAY_SIZE(icssg_all_stats); i++)
>> + if (!icssg_all_stats[i].standard_stats)
>> + ethtool_puts(&p, icssg_all_stats[i].name);
>> + for (i = 0; i < ICSSG_NUM_PA_STATS; i++)
>
> It would probably be better to use ARRAY_SIZE(icssg_all_pa_stats) so that it's
> consistent with the loop right before.
Sure Dan.
>
>> + ethtool_puts(&p, icssg_all_pa_stats[i].name);
>> break;
>> default:
>> break;
>> @@ -100,13 +98,16 @@ static void emac_get_ethtool_stats(struct net_device *ndev,
>> struct ethtool_stats *stats, u64 *data)
>> {
>> struct prueth_emac *emac = netdev_priv(ndev);
>> - int i;
>> + int i, j;
>>
>> emac_update_hardware_stats(emac);
>>
>> for (i = 0; i < ARRAY_SIZE(icssg_all_stats); i++)
>> if (!icssg_all_stats[i].standard_stats)
>> *(data++) = emac->stats[i];
>> +
>> + for (j = 0; j < ICSSG_NUM_PA_STATS; j++)
>> + *(data++) = emac->stats[i + j];
>
> Here i is not an iterator. It's a stand in for ARRAY_SIZE(icssg_all_stats).
> It would be more readable to do that directly.
>
> for (i = 0; i < ICSSG_NUM_PA_STATS; i++)
> *(data++) = emac->stats[ARRAY_SIZE(icssg_all_stats) + i];
>
> To be honest, putting the pa_stats at the end of ->stats would have made sense
> if we could have looped over the whole array, but since they have to be treated
> differently we should probably just put them into their own ->pa_stats array.
>
Sure Dan. It will make more sense to have different array for pa_stats.
I will do this change and update.
> I haven't tested this so maybe I've missed something obvious.
>
> The "all" in "icssg_all_stats" doesn't really make sense anymore btw...
>
Correct, the "icssg_all_stats" should be renamed to "icssg_mii_g_rt_stats".
> Sorry for being so nit picky on a v5 patch. :(
>
It's okay. Thanks for the review. I will address all these comments and
send out a v6.
> regards,
> dan carpenter
>
--
Thanks and Regards,
Md Danish Anwar
next prev parent reply other threads:[~2024-08-19 7:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-14 9:20 [PATCH net-next v5 0/2] Add support for ICSSG PA_STATS MD Danish Anwar
2024-08-14 9:20 ` [PATCH net-next v5 1/2] dt-bindings: soc: ti: pruss: Add documentation for PA_STATS support MD Danish Anwar
2024-08-14 9:20 ` [PATCH net-next v5 2/2] net: ti: icssg-prueth: Add support for PA Stats MD Danish Anwar
2024-08-15 11:28 ` Dan Carpenter
2024-08-19 7:15 ` Anwar, Md Danish [this message]
2024-08-15 16:01 ` Simon Horman
2024-08-19 7:10 ` Anwar, Md Danish
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2ee6f2eb-9a3f-4e04-a6d5-059c4381cbd8@ti.com \
--to=a0501179@ti.com \
--cc=andrew@lunn.ch \
--cc=conor+dt@kernel.org \
--cc=dan.carpenter@linaro.org \
--cc=danishanwar@ti.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=diogo.ivo@siemens.com \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=horms@kernel.org \
--cc=jan.kiszka@siemens.com \
--cc=kory.maincent@bootlin.com \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nm@ti.com \
--cc=pabeni@redhat.com \
--cc=robh@kernel.org \
--cc=rogerq@kernel.org \
--cc=saikrishnag@marvell.com \
--cc=srk@ti.com \
--cc=ssantosh@kernel.org \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).