[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ee06c234-2781-28b7-23b5-e49f6c563f57@denx.de>
Date: Sat, 22 May 2021 09:51:12 +0200
From: Stefan Roese <sr@...x.de>
To: David Miller <davem@...emloft.net>
Cc: netdev@...r.kernel.org, nbd@....name, john@...ozen.org,
ilya.lipnitskiy@...il.com, code@...o-schneider.ch,
reto.schneider@...qvarnagroup.com
Subject: Re: [PATCH net] net: ethernet: mtk_eth_soc: Fix packet statistics
support for MT7628/88
On 21.05.21 23:37, David Miller wrote:
> From: Stefan Roese <sr@...x.de>
> Date: Fri, 21 May 2021 07:57:15 +0200
>
>> The MT7628/88 SoC(s) have other (limited) packet counter registers than
>> currently supported in the mtk_eth_soc driver. This patch adds support
>> for reading these registers, so that the packet statistics are correctly
>> updated.
>>
>> Signed-off-by: Stefan Roese <sr@...x.de>
>> Fixes: 296c9120752b ("net: ethernet: mediatek: Add MT7628/88 SoC support")
>> Cc: Felix Fietkau <nbd@....name>
>> Cc: John Crispin <john@...ozen.org>
>> Cc: Ilya Lipnitskiy <ilya.lipnitskiy@...il.com>
>> Cc: Reto Schneider <code@...o-schneider.ch>
>> Cc: Reto Schneider <reto.schneider@...qvarnagroup.com>
>> Cc: David S. Miller <davem@...emloft.net>
>> ---
>> drivers/net/ethernet/mediatek/mtk_eth_soc.c | 56 ++++++++++++---------
>> drivers/net/ethernet/mediatek/mtk_eth_soc.h | 7 +++
>> 2 files changed, 40 insertions(+), 23 deletions(-)
>>
>> + unsigned int base = MTK_GDM1_TX_GBCNT + hw_stats->reg_offset;
>> + u64 stats;
>> +
>> + hw_stats->rx_bytes += mtk_r32(mac->hw, base);
>> + stats = mtk_r32(mac->hw, base + 0x04);
>> + if (stats)
>> + hw_stats->rx_bytes += (stats << 32);
>> + hw_stats->rx_packets += mtk_r32(mac->hw, base + 0x08);
>> + hw_stats->rx_overflow += mtk_r32(mac->hw, base + 0x10);
>> + hw_stats->rx_fcs_errors += mtk_r32(mac->hw, base + 0x14);
>> + hw_stats->rx_short_errors += mtk_r32(mac->hw, base + 0x18);
>> + hw_stats->rx_long_errors += mtk_r32(mac->hw, base + 0x1c);
>> + hw_stats->rx_checksum_errors += mtk_r32(mac->hw, base + 0x20);
>> + hw_stats->rx_flow_control_packets +=
>> + mtk_r32(mac->hw, base + 0x24);
>> + hw_stats->tx_skip += mtk_r32(mac->hw, base + 0x28);
>> + hw_stats->tx_collisions += mtk_r32(mac->hw, base + 0x2c);
>> + hw_stats->tx_bytes += mtk_r32(mac->hw, base + 0x30);
>> + stats = mtk_r32(mac->hw, base + 0x34);
>> + if (stats)
>> + hw_stats->tx_bytes += (stats << 32);
>> + hw_stats->tx_packets += mtk_r32(mac->hw, base + 0x38);
>>
>> +/* Counter / stat register */
>> +#define MT7628_SDM_TPCNT (MT7628_SDM_OFFSET + 0x100)
>> +#define MT7628_SDM_TBCNT (MT7628_SDM_OFFSET + 0x104)
>> +#define MT7628_SDM_RPCNT (MT7628_SDM_OFFSET + 0x108)
>> +#define MT7628_SDM_RBCNT (MT7628_SDM_OFFSET + 0x10c)
>> +#define MT7628_SDM_CS_ERR (MT7628_SDM_OFFSET + 0x110)
>> +
>
> The other stats/cpunter regs should be properly defined like this too.
Okay. Will send v2 with this change shortly.
Thanks,
Stefan
Powered by blists - more mailing lists