lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210521.143719.557231591502681397.davem@davemloft.net>
Date:   Fri, 21 May 2021 14:37:19 -0700 (PDT)
From:   David Miller <davem@...emloft.net>
To:     sr@...x.de
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

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.

Thank you.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ