[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250708041041.56787-1-Raju.Rangoju@amd.com>
Date: Tue, 8 Jul 2025 09:40:41 +0530
From: Raju Rangoju <Raju.Rangoju@....com>
To: <netdev@...r.kernel.org>
CC: <andrew+netdev@...n.ch>, <davem@...emloft.net>, <edumazet@...gle.com>,
<kuba@...nel.org>, <pabeni@...hat.com>, <Shyam-sundar.S-k@....com>, "Raju
Rangoju" <Raju.Rangoju@....com>
Subject: [net-next] amd-xgbe: add ethtool counters for error and dropped packets
add the ethtool counters for tx/rx dropped packets and tx/rx error
packets
Signed-off-by: Raju Rangoju <Raju.Rangoju@....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
Powered by blists - more mailing lists