[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200911195258.1048468-6-kuba@kernel.org>
Date: Fri, 11 Sep 2020 12:52:55 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: davem@...emloft.net
Cc: netdev@...r.kernel.org, mkubecek@...e.cz,
michael.chan@...adcom.com, tariqt@...dia.com, saeedm@...dia.com,
alexander.duyck@...il.com, andrew@...n.ch,
Jakub Kicinski <kuba@...nel.org>
Subject: [PATCH net-next 5/8] bnxt: add pause frame stats
These stats are already reported in ethtool -S.
Hopefully they are equivalent to standard stats?
Signed-off-by: Jakub Kicinski <kuba@...nel.org>
---
.../net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
index d0928334bdc8..b5de242766e3 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
@@ -1778,6 +1778,24 @@ static void bnxt_get_pauseparam(struct net_device *dev,
epause->tx_pause = !!(link_info->req_flow_ctrl & BNXT_LINK_PAUSE_TX);
}
+static void bnxt_get_pause_stats(struct net_device *dev,
+ struct ethtool_pause_stats *epstat)
+{
+ struct bnxt *bp = netdev_priv(dev);
+ struct rx_port_stats *rx_stats;
+ struct tx_port_stats *tx_stats;
+
+ if (BNXT_VF(bp) || !(bp->flags & BNXT_FLAG_PORT_STATS))
+ return;
+
+ rx_stats = (void *)bp->port_stats.sw_stats;
+ tx_stats = (void *)((unsigned long)bp->port_stats.sw_stats +
+ BNXT_TX_PORT_STATS_BYTE_OFFSET);
+
+ epstat->rx_pause_frames = rx_stats->rx_pause_frames;
+ epstat->tx_pause_frames = tx_stats->tx_pause_frames;
+}
+
static int bnxt_set_pauseparam(struct net_device *dev,
struct ethtool_pauseparam *epause)
{
@@ -3645,6 +3663,7 @@ const struct ethtool_ops bnxt_ethtool_ops = {
ETHTOOL_COALESCE_USE_ADAPTIVE_RX,
.get_link_ksettings = bnxt_get_link_ksettings,
.set_link_ksettings = bnxt_set_link_ksettings,
+ .get_pause_stats = bnxt_get_pause_stats,
.get_pauseparam = bnxt_get_pauseparam,
.set_pauseparam = bnxt_set_pauseparam,
.get_drvinfo = bnxt_get_drvinfo,
--
2.26.2
Powered by blists - more mailing lists