From: Raju Rangoju <Raju.Rangoju@amd.com>
To: <netdev@vger.kernel.org>
Cc: <andrew+netdev@lunn.ch>, <davem@davemloft.net>,
<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
<Shyam-sundar.S-k@amd.com>, "Raju Rangoju" <Raju.Rangoju@amd.com>
Subject: [net-next] amd-xgbe: add ethtool counters for error and dropped packets
Date: Tue, 8 Jul 2025 09:40:41 +0530 [thread overview]
Message-ID: <20250708041041.56787-1-Raju.Rangoju@amd.com> (raw)
add the ethtool counters for tx/rx dropped packets and tx/rx error
packets
Signed-off-by: Raju Rangoju <Raju.Rangoju@amd.com>
---
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c | 12 ++++++++++++
drivers/net/ethernet/amd/xgbe/xgbe.h | 4 ++++
2 files changed, 16 insertions(+)
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
index be0d2c7d08dc..62a80df5bc6e 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
@@ -47,6 +47,8 @@ static const struct xgbe_stats xgbe_gstring_stats[] = {
XGMAC_MMC_STAT("tx_1024_to_max_byte_packets", tx1024tomaxoctets_gb),
XGMAC_MMC_STAT("tx_underflow_errors", txunderflowerror),
XGMAC_MMC_STAT("tx_pause_frames", txpauseframes),
+ XGMAC_MMC_STAT("tx_errors", tx_errors),
+ XGMAC_MMC_STAT("tx_dropped", tx_dropped),
XGMAC_MMC_STAT("rx_bytes", rxoctetcount_gb),
XGMAC_MMC_STAT("rx_packets", rxframecount_gb),
@@ -75,6 +77,8 @@ static const struct xgbe_stats xgbe_gstring_stats[] = {
XGMAC_MMC_STAT("rx_pause_frames", rxpauseframes),
XGMAC_EXT_STAT("rx_split_header_packets", rx_split_header_packets),
XGMAC_EXT_STAT("rx_buffer_unavailable", rx_buffer_unavailable),
+ XGMAC_MMC_STAT("rx_errors", rx_errors),
+ XGMAC_MMC_STAT("rx_dropped", rx_dropped),
};
#define XGBE_STATS_COUNT ARRAY_SIZE(xgbe_gstring_stats)
@@ -107,10 +111,18 @@ static void xgbe_get_ethtool_stats(struct net_device *netdev,
struct ethtool_stats *stats, u64 *data)
{
struct xgbe_prv_data *pdata = netdev_priv(netdev);
+ struct xgbe_mmc_stats *pstats = &pdata->mmc_stats;
u8 *stat;
int i;
pdata->hw_if.read_mmc_stats(pdata);
+ pstats->tx_errors = pstats->txframecount_gb - pstats->txframecount_g;
+ pstats->tx_dropped = netdev->stats.tx_dropped;
+ pstats->rx_errors = pstats->rxframecount_gb -
+ pstats->rxbroadcastframes_g -
+ pstats->rxmulticastframes_g -
+ pstats->rxunicastframes_g;
+ pstats->rx_dropped = netdev->stats.rx_dropped;
for (i = 0; i < XGBE_STATS_COUNT; i++) {
stat = (u8 *)pdata + xgbe_gstring_stats[i].stat_offset;
*data++ = *(u64 *)stat;
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe.h b/drivers/net/ethernet/amd/xgbe/xgbe.h
index b5c5624eb827..fe6efd97f03d 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe.h
+++ b/drivers/net/ethernet/amd/xgbe/xgbe.h
@@ -626,8 +626,12 @@ struct xgbe_mmc_stats {
u64 txframecount_g;
u64 txpauseframes;
u64 txvlanframes_g;
+ u64 tx_errors;
+ u64 tx_dropped;
/* Rx Stats */
+ u64 rx_errors;
+ u64 rx_dropped;
u64 rxframecount_gb;
u64 rxoctetcount_gb;
u64 rxoctetcount_g;
--
2.34.1
next reply other threads:[~2025-07-08 4:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-08 4:10 Raju Rangoju [this message]
2025-07-08 11:32 ` [net-next] amd-xgbe: add ethtool counters for error and dropped packets Vadim Fedorenko
2025-07-10 2:28 ` Jakub Kicinski
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=20250708041041.56787-1-Raju.Rangoju@amd.com \
--to=raju.rangoju@amd.com \
--cc=Shyam-sundar.S-k@amd.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.