From: Frank Li <Frank.li@nxp.com>
To: Wei Fang <wei.fang@nxp.com>
Cc: claudiu.manoil@nxp.com, vladimir.oltean@nxp.com,
xiaoning.wang@nxp.com, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, horms@kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, imx@lists.linux.dev
Subject: Re: [PATCH v2 net-next 2/3] net: enetc: separate 64-bit counters from enetc_port_counters
Date: Tue, 24 Jun 2025 12:59:24 -0400 [thread overview]
Message-ID: <aFrZbEafkQCEc0O/@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20250624101548.2669522-3-wei.fang@nxp.com>
On Tue, Jun 24, 2025 at 06:15:47PM +0800, Wei Fang wrote:
> Some counters in enetc_port_counters are 32-bit registers, and some are
> 64-bit registers. But in the current driver, they are all read through
> enetc_port_rd(), which can only read a 32-bit value. Therefore, separate
> 64-bit counters (enetc_pm_counters) from enetc_port_counters and use
> enetc_port_rd64() to read the 64-bit statistics.
>
> Signed-off-by: Wei Fang <wei.fang@nxp.com>
> Reviewed-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
> .../net/ethernet/freescale/enetc/enetc_ethtool.c | 15 ++++++++++++++-
> drivers/net/ethernet/freescale/enetc/enetc_hw.h | 1 +
> 2 files changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
> index 2e5cef646741..2c9aa94c8e3d 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
> +++ b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
> @@ -142,7 +142,7 @@ static const struct {
> static const struct {
> int reg;
> char name[ETH_GSTRING_LEN] __nonstring;
> -} enetc_port_counters[] = {
> +} enetc_pm_counters[] = {
> { ENETC_PM_REOCT(0), "MAC rx ethernet octets" },
> { ENETC_PM_RALN(0), "MAC rx alignment errors" },
> { ENETC_PM_RXPF(0), "MAC rx valid pause frames" },
> @@ -194,6 +194,12 @@ static const struct {
> { ENETC_PM_TSCOL(0), "MAC tx single collisions" },
> { ENETC_PM_TLCOL(0), "MAC tx late collisions" },
> { ENETC_PM_TECOL(0), "MAC tx excessive collisions" },
> +};
> +
> +static const struct {
> + int reg;
> + char name[ETH_GSTRING_LEN] __nonstring;
> +} enetc_port_counters[] = {
> { ENETC_UFDMF, "SI MAC nomatch u-cast discards" },
> { ENETC_MFDMF, "SI MAC nomatch m-cast discards" },
> { ENETC_PBFDSIR, "SI MAC nomatch b-cast discards" },
> @@ -240,6 +246,7 @@ static int enetc_get_sset_count(struct net_device *ndev, int sset)
> return len;
>
> len += ARRAY_SIZE(enetc_port_counters);
> + len += ARRAY_SIZE(enetc_pm_counters);
>
> return len;
> }
> @@ -266,6 +273,9 @@ static void enetc_get_strings(struct net_device *ndev, u32 stringset, u8 *data)
> for (i = 0; i < ARRAY_SIZE(enetc_port_counters); i++)
> ethtool_cpy(&data, enetc_port_counters[i].name);
>
> + for (i = 0; i < ARRAY_SIZE(enetc_pm_counters); i++)
> + ethtool_cpy(&data, enetc_pm_counters[i].name);
> +
> break;
> }
> }
> @@ -302,6 +312,9 @@ static void enetc_get_ethtool_stats(struct net_device *ndev,
>
> for (i = 0; i < ARRAY_SIZE(enetc_port_counters); i++)
> data[o++] = enetc_port_rd(hw, enetc_port_counters[i].reg);
> +
> + for (i = 0; i < ARRAY_SIZE(enetc_pm_counters); i++)
> + data[o++] = enetc_port_rd64(hw, enetc_pm_counters[i].reg);
> }
>
> static void enetc_pause_stats(struct enetc_hw *hw, int mac,
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc_hw.h b/drivers/net/ethernet/freescale/enetc/enetc_hw.h
> index cb26f185f52f..d4bbb07199c5 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc_hw.h
> +++ b/drivers/net/ethernet/freescale/enetc/enetc_hw.h
> @@ -536,6 +536,7 @@ static inline u64 _enetc_rd_reg64_wa(void __iomem *reg)
> /* port register accessors - PF only */
> #define enetc_port_rd(hw, off) enetc_rd_reg((hw)->port + (off))
> #define enetc_port_wr(hw, off, val) enetc_wr_reg((hw)->port + (off), val)
> +#define enetc_port_rd64(hw, off) _enetc_rd_reg64_wa((hw)->port + (off))
> #define enetc_port_rd_mdio(hw, off) _enetc_rd_mdio_reg_wa((hw)->port + (off))
> #define enetc_port_wr_mdio(hw, off, val) _enetc_wr_mdio_reg_wa(\
> (hw)->port + (off), val)
> --
> 2.34.1
>
next prev parent reply other threads:[~2025-06-24 16:59 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-24 10:15 [PATCH v2 net-next 0/3] change some statistics to 64-bit Wei Fang
2025-06-24 10:15 ` [PATCH v2 net-next 1/3] net: enetc: change the statistics of ring to unsigned long type Wei Fang
2025-06-24 16:55 ` Frank Li
2025-06-25 16:24 ` Simon Horman
2025-06-24 10:15 ` [PATCH v2 net-next 2/3] net: enetc: separate 64-bit counters from enetc_port_counters Wei Fang
2025-06-24 16:59 ` Frank Li [this message]
2025-06-25 16:24 ` Simon Horman
2025-06-24 10:15 ` [PATCH v2 net-next 3/3] net: enetc: read 64-bit statistics from port MAC counters Wei Fang
2025-06-24 17:00 ` Frank Li
2025-06-25 16:25 ` Simon Horman
2025-06-25 1:11 ` [PATCH v2 net-next 0/3] change some statistics to 64-bit Jakub Kicinski
2025-06-25 2:22 ` Wei Fang
2025-06-25 16:34 ` Simon Horman
2025-06-25 20:32 ` Jakub Kicinski
2025-06-26 1:40 ` Wei Fang
2025-06-26 7:23 ` Simon Horman
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=aFrZbEafkQCEc0O/@lizhi-Precision-Tower-5810 \
--to=frank.li@nxp.com \
--cc=andrew+netdev@lunn.ch \
--cc=claudiu.manoil@nxp.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=imx@lists.linux.dev \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=vladimir.oltean@nxp.com \
--cc=wei.fang@nxp.com \
--cc=xiaoning.wang@nxp.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