[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7b5f195f-c5c8-6847-9458-3d5563cf0112@ti.com>
Date: Thu, 12 Oct 2023 10:51:12 +0530
From: MD Danish Anwar <danishanwar@...com>
To: Andrew Lunn <andrew@...n.ch>
CC: Paolo Abeni <pabeni@...hat.com>, Jakub Kicinski <kuba@...nel.org>,
Eric Dumazet <edumazet@...gle.com>,
"David S. Miller" <davem@...emloft.net>,
<linux-kernel@...r.kernel.org>, <netdev@...r.kernel.org>,
<srk@...com>, Vignesh Raghavendra <vigneshr@...com>,
<r-gunasekaran@...com>, Roger Quadros <rogerq@...nel.org>
Subject: Re: [PATCH] net: ti: icssg-prueth: Fix tx_total_bytes count
Hi Andrew,
On 11/10/23 18:11, Andrew Lunn wrote:
>> @@ -29,7 +30,12 @@ void emac_update_hardware_stats(struct prueth_emac *emac)
>> base + icssg_all_stats[i].offset,
>> val);
>>
>> + if (!strncmp(icssg_ethtool_stats[i].name, "tx_good_frames", ETH_GSTRING_LEN))
>> + tx_pkt_cnt = val;
>
> Doing a strncmp seems very expensive. Could you make use of
> icssg_stats.offset?
>
Sure. I can define the offset of these two stats and then use them in if
condition as below.
#define ICSSG_TX_PACKET_OFFSET 0xA0
#define ICSSG_TX_BYTE_OFFSET 0xEC
if (icssg_ethtool_stats[i].offset == ICSSG_TX_PACKET_OFFSET)
tx_pkt_cnt = val;
if (icssg_ethtool_stats[i].offset == ICSSG_TX_BYTE_OFFSET)
emac->stats[i] -= tx_pkt_cnt * 8;
Pls let me know if this looks OK.
> Andrew
--
Thanks and Regards,
Danish
Powered by blists - more mailing lists