netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next] amd-xgbe: add ethtool counters for error and dropped packets
@ 2025-07-08  4:10 Raju Rangoju
  2025-07-08 11:32 ` Vadim Fedorenko
  2025-07-10  2:28 ` Jakub Kicinski
  0 siblings, 2 replies; 3+ messages in thread
From: Raju Rangoju @ 2025-07-08  4:10 UTC (permalink / raw)
  To: netdev
  Cc: andrew+netdev, davem, edumazet, kuba, pabeni, Shyam-sundar.S-k,
	Raju Rangoju

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [net-next] amd-xgbe: add ethtool counters for error and dropped packets
  2025-07-08  4:10 [net-next] amd-xgbe: add ethtool counters for error and dropped packets Raju Rangoju
@ 2025-07-08 11:32 ` Vadim Fedorenko
  2025-07-10  2:28 ` Jakub Kicinski
  1 sibling, 0 replies; 3+ messages in thread
From: Vadim Fedorenko @ 2025-07-08 11:32 UTC (permalink / raw)
  To: Raju Rangoju, netdev
  Cc: andrew+netdev, davem, edumazet, kuba, pabeni, Shyam-sundar.S-k

On 08/07/2025 05:10, Raju Rangoju wrote:
> add the ethtool counters for tx/rx dropped packets and tx/rx error
> packets
> 
> Signed-off-by: Raju Rangoju <Raju.Rangoju@amd.com>
> ---

Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [net-next] amd-xgbe: add ethtool counters for error and dropped packets
  2025-07-08  4:10 [net-next] amd-xgbe: add ethtool counters for error and dropped packets Raju Rangoju
  2025-07-08 11:32 ` Vadim Fedorenko
@ 2025-07-10  2:28 ` Jakub Kicinski
  1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2025-07-10  2:28 UTC (permalink / raw)
  To: Raju Rangoju
  Cc: netdev, andrew+netdev, davem, edumazet, pabeni, Shyam-sundar.S-k

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.
-- 
pw-bot: reject

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-10  2:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-08  4:10 [net-next] amd-xgbe: add ethtool counters for error and dropped packets Raju Rangoju
2025-07-08 11:32 ` Vadim Fedorenko
2025-07-10  2:28 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).