netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, mkubecek@suse.cz,
	michael.chan@broadcom.com, tariqt@nvidia.com, saeedm@nvidia.com,
	alexander.duyck@gmail.com, andrew@lunn.ch,
	Jakub Kicinski <kuba@kernel.org>,
	Alexander Duyck <alexander.h.duyck@linux.intel.com>
Subject: [PATCH net-next v2 6/8] ixgbe: add pause frame stats
Date: Fri, 11 Sep 2020 16:28:51 -0700	[thread overview]
Message-ID: <20200911232853.1072362-7-kuba@kernel.org> (raw)
In-Reply-To: <20200911232853.1072362-1-kuba@kernel.org>

Report standard pause frame stats. They are already aggregated
in struct ixgbe_hw_stats.

The combination of the registers is suggested as equivalent to
PAUSEMACCtrlFramesTransmitted / PAUSEMACCtrlFramesReceived
by the Intel 82576EB datasheet, I could not find any information
in the HW actually supported by ixgbe.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index 71ec908266a6..a280aa34ca1d 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -531,6 +531,16 @@ static int ixgbe_set_link_ksettings(struct net_device *netdev,
 	return err;
 }
 
+static void ixgbe_get_pause_stats(struct net_device *netdev,
+				  struct ethtool_pause_stats *stats)
+{
+	struct ixgbe_adapter *adapter = netdev_priv(netdev);
+	struct ixgbe_hw_stats *hwstats = &adapter->stats;
+
+	stats->tx_pause_frames = hwstats->lxontxc + hwstats->lxofftxc;
+	stats->rx_pause_frames = hwstats->lxonrxc + hwstats->lxoffrxc;
+}
+
 static void ixgbe_get_pauseparam(struct net_device *netdev,
 				 struct ethtool_pauseparam *pause)
 {
@@ -3546,6 +3556,7 @@ static const struct ethtool_ops ixgbe_ethtool_ops = {
 	.set_eeprom             = ixgbe_set_eeprom,
 	.get_ringparam          = ixgbe_get_ringparam,
 	.set_ringparam          = ixgbe_set_ringparam,
+	.get_pause_stats	= ixgbe_get_pause_stats,
 	.get_pauseparam         = ixgbe_get_pauseparam,
 	.set_pauseparam         = ixgbe_set_pauseparam,
 	.get_msglevel           = ixgbe_get_msglevel,
-- 
2.26.2


  parent reply	other threads:[~2020-09-11 23:29 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-11 23:28 [PATCH net-next v2 0/8] ethtool: add pause frame stats Jakub Kicinski
2020-09-11 23:28 ` [PATCH net-next v2 1/8] ethtool: add standard pause stats Jakub Kicinski
2020-09-14  1:48   ` Andrew Lunn
2020-09-14 15:48     ` Jakub Kicinski
2020-09-14 17:18       ` Andrew Lunn
2020-09-14 18:58         ` Jakub Kicinski
2020-09-11 23:28 ` [PATCH net-next v2 2/8] docs: net: include the new ethtool pause stats in the stats doc Jakub Kicinski
2020-09-14 19:33   ` Saeed Mahameed
2020-09-14 19:52     ` Jakub Kicinski
2020-09-14 21:19       ` Saeed Mahameed
2020-09-11 23:28 ` [PATCH net-next v2 3/8] netdevsim: add pause frame stats Jakub Kicinski
2020-09-11 23:28 ` [PATCH net-next v2 4/8] selftests: add a test for ethtool pause stats Jakub Kicinski
2020-09-11 23:28 ` [PATCH net-next v2 5/8] bnxt: add pause frame stats Jakub Kicinski
2020-09-11 23:28 ` Jakub Kicinski [this message]
2020-09-11 23:28 ` [PATCH net-next v2 7/8] mlx5: " Jakub Kicinski
2020-09-12  1:10   ` Jakub Kicinski
2020-09-13  8:16   ` kernel test robot
2020-09-11 23:28 ` [PATCH net-next v2 8/8] mlx4: " Jakub Kicinski
2020-09-11 23:49 ` [PATCH net-next v2 0/8] ethtool: " Vladimir Oltean
2020-09-12  0:07   ` Jakub Kicinski
2020-09-12  0:15     ` Vladimir Oltean
2020-09-12  0:42       ` Jakub Kicinski
2020-09-12  2:54         ` Florian Fainelli
2020-09-14 15:53           ` Jakub Kicinski
2020-09-14 16:25             ` Florian Fainelli
2020-09-14 16:54               ` Jakub Kicinski
2020-09-14 17:36             ` Andrew Lunn
2020-09-14 19:20               ` Jakub Kicinski
2020-09-12  7:16         ` Vladimir Oltean
2020-09-14 16:15           ` Jakub Kicinski
2020-09-14 17:28             ` Andrew Lunn
2020-09-14 19:36               ` Jakub Kicinski
2020-09-14  2:08   ` Andrew Lunn
2020-09-14 16:26     ` Jakub Kicinski
2020-09-14 20:05 ` Saeed Mahameed

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=20200911232853.1072362-7-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=alexander.duyck@gmail.com \
    --cc=alexander.h.duyck@linux.intel.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=michael.chan@broadcom.com \
    --cc=mkubecek@suse.cz \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.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 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).