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 3/3] net: enetc: read 64-bit statistics from port MAC counters
Date: Tue, 24 Jun 2025 13:00:35 -0400 [thread overview]
Message-ID: <aFrZs17NpJM5SJBU@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20250624101548.2669522-4-wei.fang@nxp.com>
On Tue, Jun 24, 2025 at 06:15:48PM +0800, Wei Fang wrote:
> The counters of port MAC are all 64-bit registers, and the statistics of
> ethtool are u64 type, so replace enetc_port_rd() with enetc_port_rd64()
> to read 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>
> ---
> .../ethernet/freescale/enetc/enetc_ethtool.c | 84 +++++++++----------
> 1 file changed, 42 insertions(+), 42 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
> index 2c9aa94c8e3d..961e76cd8489 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
> +++ b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
> @@ -320,8 +320,8 @@ static void enetc_get_ethtool_stats(struct net_device *ndev,
> static void enetc_pause_stats(struct enetc_hw *hw, int mac,
> struct ethtool_pause_stats *pause_stats)
> {
> - pause_stats->tx_pause_frames = enetc_port_rd(hw, ENETC_PM_TXPF(mac));
> - pause_stats->rx_pause_frames = enetc_port_rd(hw, ENETC_PM_RXPF(mac));
> + pause_stats->tx_pause_frames = enetc_port_rd64(hw, ENETC_PM_TXPF(mac));
> + pause_stats->rx_pause_frames = enetc_port_rd64(hw, ENETC_PM_RXPF(mac));
> }
>
> static void enetc_get_pause_stats(struct net_device *ndev,
> @@ -348,31 +348,31 @@ static void enetc_get_pause_stats(struct net_device *ndev,
> static void enetc_mac_stats(struct enetc_hw *hw, int mac,
> struct ethtool_eth_mac_stats *s)
> {
> - s->FramesTransmittedOK = enetc_port_rd(hw, ENETC_PM_TFRM(mac));
> - s->SingleCollisionFrames = enetc_port_rd(hw, ENETC_PM_TSCOL(mac));
> - s->MultipleCollisionFrames = enetc_port_rd(hw, ENETC_PM_TMCOL(mac));
> - s->FramesReceivedOK = enetc_port_rd(hw, ENETC_PM_RFRM(mac));
> - s->FrameCheckSequenceErrors = enetc_port_rd(hw, ENETC_PM_RFCS(mac));
> - s->AlignmentErrors = enetc_port_rd(hw, ENETC_PM_RALN(mac));
> - s->OctetsTransmittedOK = enetc_port_rd(hw, ENETC_PM_TEOCT(mac));
> - s->FramesWithDeferredXmissions = enetc_port_rd(hw, ENETC_PM_TDFR(mac));
> - s->LateCollisions = enetc_port_rd(hw, ENETC_PM_TLCOL(mac));
> - s->FramesAbortedDueToXSColls = enetc_port_rd(hw, ENETC_PM_TECOL(mac));
> - s->FramesLostDueToIntMACXmitError = enetc_port_rd(hw, ENETC_PM_TERR(mac));
> - s->CarrierSenseErrors = enetc_port_rd(hw, ENETC_PM_TCRSE(mac));
> - s->OctetsReceivedOK = enetc_port_rd(hw, ENETC_PM_REOCT(mac));
> - s->FramesLostDueToIntMACRcvError = enetc_port_rd(hw, ENETC_PM_RDRNTP(mac));
> - s->MulticastFramesXmittedOK = enetc_port_rd(hw, ENETC_PM_TMCA(mac));
> - s->BroadcastFramesXmittedOK = enetc_port_rd(hw, ENETC_PM_TBCA(mac));
> - s->MulticastFramesReceivedOK = enetc_port_rd(hw, ENETC_PM_RMCA(mac));
> - s->BroadcastFramesReceivedOK = enetc_port_rd(hw, ENETC_PM_RBCA(mac));
> + s->FramesTransmittedOK = enetc_port_rd64(hw, ENETC_PM_TFRM(mac));
> + s->SingleCollisionFrames = enetc_port_rd64(hw, ENETC_PM_TSCOL(mac));
> + s->MultipleCollisionFrames = enetc_port_rd64(hw, ENETC_PM_TMCOL(mac));
> + s->FramesReceivedOK = enetc_port_rd64(hw, ENETC_PM_RFRM(mac));
> + s->FrameCheckSequenceErrors = enetc_port_rd64(hw, ENETC_PM_RFCS(mac));
> + s->AlignmentErrors = enetc_port_rd64(hw, ENETC_PM_RALN(mac));
> + s->OctetsTransmittedOK = enetc_port_rd64(hw, ENETC_PM_TEOCT(mac));
> + s->FramesWithDeferredXmissions = enetc_port_rd64(hw, ENETC_PM_TDFR(mac));
> + s->LateCollisions = enetc_port_rd64(hw, ENETC_PM_TLCOL(mac));
> + s->FramesAbortedDueToXSColls = enetc_port_rd64(hw, ENETC_PM_TECOL(mac));
> + s->FramesLostDueToIntMACXmitError = enetc_port_rd64(hw, ENETC_PM_TERR(mac));
> + s->CarrierSenseErrors = enetc_port_rd64(hw, ENETC_PM_TCRSE(mac));
> + s->OctetsReceivedOK = enetc_port_rd64(hw, ENETC_PM_REOCT(mac));
> + s->FramesLostDueToIntMACRcvError = enetc_port_rd64(hw, ENETC_PM_RDRNTP(mac));
> + s->MulticastFramesXmittedOK = enetc_port_rd64(hw, ENETC_PM_TMCA(mac));
> + s->BroadcastFramesXmittedOK = enetc_port_rd64(hw, ENETC_PM_TBCA(mac));
> + s->MulticastFramesReceivedOK = enetc_port_rd64(hw, ENETC_PM_RMCA(mac));
> + s->BroadcastFramesReceivedOK = enetc_port_rd64(hw, ENETC_PM_RBCA(mac));
> }
>
> static void enetc_ctrl_stats(struct enetc_hw *hw, int mac,
> struct ethtool_eth_ctrl_stats *s)
> {
> - s->MACControlFramesTransmitted = enetc_port_rd(hw, ENETC_PM_TCNP(mac));
> - s->MACControlFramesReceived = enetc_port_rd(hw, ENETC_PM_RCNP(mac));
> + s->MACControlFramesTransmitted = enetc_port_rd64(hw, ENETC_PM_TCNP(mac));
> + s->MACControlFramesReceived = enetc_port_rd64(hw, ENETC_PM_RCNP(mac));
> }
>
> static const struct ethtool_rmon_hist_range enetc_rmon_ranges[] = {
> @@ -389,26 +389,26 @@ static const struct ethtool_rmon_hist_range enetc_rmon_ranges[] = {
> static void enetc_rmon_stats(struct enetc_hw *hw, int mac,
> struct ethtool_rmon_stats *s)
> {
> - s->undersize_pkts = enetc_port_rd(hw, ENETC_PM_RUND(mac));
> - s->oversize_pkts = enetc_port_rd(hw, ENETC_PM_ROVR(mac));
> - s->fragments = enetc_port_rd(hw, ENETC_PM_RFRG(mac));
> - s->jabbers = enetc_port_rd(hw, ENETC_PM_RJBR(mac));
> -
> - s->hist[0] = enetc_port_rd(hw, ENETC_PM_R64(mac));
> - s->hist[1] = enetc_port_rd(hw, ENETC_PM_R127(mac));
> - s->hist[2] = enetc_port_rd(hw, ENETC_PM_R255(mac));
> - s->hist[3] = enetc_port_rd(hw, ENETC_PM_R511(mac));
> - s->hist[4] = enetc_port_rd(hw, ENETC_PM_R1023(mac));
> - s->hist[5] = enetc_port_rd(hw, ENETC_PM_R1522(mac));
> - s->hist[6] = enetc_port_rd(hw, ENETC_PM_R1523X(mac));
> -
> - s->hist_tx[0] = enetc_port_rd(hw, ENETC_PM_T64(mac));
> - s->hist_tx[1] = enetc_port_rd(hw, ENETC_PM_T127(mac));
> - s->hist_tx[2] = enetc_port_rd(hw, ENETC_PM_T255(mac));
> - s->hist_tx[3] = enetc_port_rd(hw, ENETC_PM_T511(mac));
> - s->hist_tx[4] = enetc_port_rd(hw, ENETC_PM_T1023(mac));
> - s->hist_tx[5] = enetc_port_rd(hw, ENETC_PM_T1522(mac));
> - s->hist_tx[6] = enetc_port_rd(hw, ENETC_PM_T1523X(mac));
> + s->undersize_pkts = enetc_port_rd64(hw, ENETC_PM_RUND(mac));
> + s->oversize_pkts = enetc_port_rd64(hw, ENETC_PM_ROVR(mac));
> + s->fragments = enetc_port_rd64(hw, ENETC_PM_RFRG(mac));
> + s->jabbers = enetc_port_rd64(hw, ENETC_PM_RJBR(mac));
> +
> + s->hist[0] = enetc_port_rd64(hw, ENETC_PM_R64(mac));
> + s->hist[1] = enetc_port_rd64(hw, ENETC_PM_R127(mac));
> + s->hist[2] = enetc_port_rd64(hw, ENETC_PM_R255(mac));
> + s->hist[3] = enetc_port_rd64(hw, ENETC_PM_R511(mac));
> + s->hist[4] = enetc_port_rd64(hw, ENETC_PM_R1023(mac));
> + s->hist[5] = enetc_port_rd64(hw, ENETC_PM_R1522(mac));
> + s->hist[6] = enetc_port_rd64(hw, ENETC_PM_R1523X(mac));
> +
> + s->hist_tx[0] = enetc_port_rd64(hw, ENETC_PM_T64(mac));
> + s->hist_tx[1] = enetc_port_rd64(hw, ENETC_PM_T127(mac));
> + s->hist_tx[2] = enetc_port_rd64(hw, ENETC_PM_T255(mac));
> + s->hist_tx[3] = enetc_port_rd64(hw, ENETC_PM_T511(mac));
> + s->hist_tx[4] = enetc_port_rd64(hw, ENETC_PM_T1023(mac));
> + s->hist_tx[5] = enetc_port_rd64(hw, ENETC_PM_T1522(mac));
> + s->hist_tx[6] = enetc_port_rd64(hw, ENETC_PM_T1523X(mac));
> }
>
> static void enetc_get_eth_mac_stats(struct net_device *ndev,
> --
> 2.34.1
>
next prev parent reply other threads:[~2025-06-24 17:00 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
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 [this message]
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=aFrZs17NpJM5SJBU@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