amd-xgbe: add ethtool counters for error and dropped packets
Subsystems (3)
Raju Rangoju
maintaineradd the ethtool counters for tx/rx dropped packets and tx/rx error packets
Signed-off-by Raju Rangoju <[email protected]>
--- drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c | 12 ++++++++++++ drivers/net/ethernet/amd/xgbe/xgbe.h | 4 ++++ 2 files changed, 16 insertions(+)
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c +12 -0
@@ -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;
drivers/net/ethernet/amd/xgbe/xgbe.h +4 -0
@@ -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;
Signature · 1 line
2.34.1
Vadim Fedorenko
Reviewed-byQuoted 5 lines · Raju Rangoju
add the ethtool counters for tx/rx dropped packets and tx/rx error packets
Signed-off-by Raju Rangoju <[email protected]>---
Reviewed-by Vadim Fedorenko <[email protected]>
Jakub Kicinski
maintainerQuoted 2 lines · On Tue, 8 Jul 2025 09:40:41 +0530 Raju Rangoju wrote:
add the ethtool counters for tx/rx dropped packets and tx/rx error packets
Standard stats from struct rtnl_link_stats64 must not be duplicated by ethtool -S. ethtool -S is for non-standard stats the device may have.
Signature · 1 line
pw-bot: reject