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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B113DC3DA4A for ; Mon, 19 Aug 2024 07:16:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Content-Transfer-Encoding:Content-Type:In-Reply-To:From:References:To:Subject :MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0vsrItiP+UOuGajC7NCZTlPPCFYcRA8XAnCYPGpz6CY=; b=oeCS5ofvVn7PQB AQ7nBGXwDc1COK/qkmtE80T4LEg8s8BfHynBfpSKNrLn+WqvrHCK4wGrGZ0scSteeCBeqeF6AaQ2j fIVr7FcQaUEysLBs9QZzIhrbku/NF6rsxtz8n2ETrIc7i9LvO16IL3c9wvZFL4HH2BGkvqDxR5iVH iuwxgE20PYSvn7hBdpjmRc79YJtH2beEYN7T+LE3K/IvwGbzVbFUQjCGLcVvWuPBRoi8XdfOQFgnz p+Z7JTZVeKiv8hG7dHxH/pgXq7M66jb4bfFuhFFIIVQVN6y7N3Tt5bdUbwIDAdL+sVBIqnILFfpvK RquG9pNVUGikGbhcusaQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sfwd5-00000000b4q-273N; Mon, 19 Aug 2024 07:16:39 +0000 Received: from fllv0015.ext.ti.com ([198.47.19.141]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sfwcQ-00000000b30-175k for linux-arm-kernel@lists.infradead.org; Mon, 19 Aug 2024 07:15:59 +0000 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 47J7FfIb014306; Mon, 19 Aug 2024 02:15:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1724051741; bh=0vsrItiP+UOuGajC7NCZTlPPCFYcRA8XAnCYPGpz6CY=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=bUquSnXby+EIUCpW7ZzEe4Ar3hHMOjtdKafPUf7hARC5ZjzvIJT73k+Rlyqz+4eIc mrjWcdP9ay9xONwaeGiMN0/96GxVUoMs+SkPhtY+O7gvOj73xKmUW2ZI274f8FA/tw h4OSozP0aJ8YN33a2OvxkoyPZHyFlEpEGBaRZlp4= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 47J7Ff7S013071 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 19 Aug 2024 02:15:41 -0500 Received: from DFLE111.ent.ti.com (10.64.6.32) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 19 Aug 2024 02:15:41 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 19 Aug 2024 02:15:41 -0500 Received: from [10.249.135.225] ([10.249.135.225]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 47J7FVGi056124; Mon, 19 Aug 2024 02:15:32 -0500 Message-ID: <2ee6f2eb-9a3f-4e04-a6d5-059c4381cbd8@ti.com> Date: Mon, 19 Aug 2024 12:45:30 +0530 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v5 2/2] net: ti: icssg-prueth: Add support for PA Stats To: Dan Carpenter , MD Danish Anwar References: <20240814092033.2984734-1-danishanwar@ti.com> <20240814092033.2984734-3-danishanwar@ti.com> Content-Language: en-US From: "Anwar, Md Danish" In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240819_001558_443963_DF84AF2D X-CRM114-Status: GOOD ( 28.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nishanth Menon , Andrew Lunn , Vignesh Raghavendra , Jan Kiszka , Eric Dumazet , Diogo Ivo , Rob Herring , Sai Krishna , Jakub Kicinski , Paolo Abeni , devicetree@vger.kernel.org, Conor Dooley , Roger Quadros , Santosh Shilimkar , linux-arm-kernel@lists.infradead.org, srk@ti.com, Kory Maincent , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Simon Horman , Krzysztof Kozlowski , "David S. Miller" , Heiner Kallweit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 >> --- >> 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