Netdev List
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Tony Nguyen <anthony.l.nguyen@intel.com>,
	Przemek Kitszel <przemyslaw.kitszel@intel.com>
Cc: Maxime Chevallier <maxime.chevallier@bootlin.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Willem de Bruijn <willemb@google.com>,
	Oleksij Rempel <o.rempel@pengutronix.de>,
	intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
	thomas.petazzoni@bootlin.com
Subject: [PATCH iwl-next] igb: report the EEE LPI counters in the ethtool statistics
Date: Sun,  6 Dec 2026 12:58:32 +0100	[thread overview]
Message-ID: <20261206115832.85773-1-maxime.chevallier@bootlin.com> (raw)

i350 and later seem to be able to report LPI counters, as clear-on-read
value. Let's report these through ethtool, as "tx_lpi_count" and
"rx_lpi_count".

This was only tested on i350-T4, these values were found in the out of
tree driver and tested with multiple stmmac-based devices to validate
the counter report consistent values.

Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
 drivers/net/ethernet/intel/igb/e1000_hw.h    | 2 ++
 drivers/net/ethernet/intel/igb/e1000_regs.h  | 2 ++
 drivers/net/ethernet/intel/igb/igb_ethtool.c | 2 ++
 drivers/net/ethernet/intel/igb/igb_main.c    | 5 +++++
 4 files changed, 11 insertions(+)

diff --git a/drivers/net/ethernet/intel/igb/e1000_hw.h b/drivers/net/ethernet/intel/igb/e1000_hw.h
index 44111f65afc7..f38e8e130517 100644
--- a/drivers/net/ethernet/intel/igb/e1000_hw.h
+++ b/drivers/net/ethernet/intel/igb/e1000_hw.h
@@ -245,6 +245,8 @@ struct e1000_hw_stats {
 	u64 o2bspc;
 	u64 b2ospc;
 	u64 b2ogprc;
+	u64 tlpic;
+	u64 rlpic;
 };
 
 struct e1000_host_mng_dhcp_cookie {
diff --git a/drivers/net/ethernet/intel/igb/e1000_regs.h b/drivers/net/ethernet/intel/igb/e1000_regs.h
index eb9f6da9208a..288e4d835246 100644
--- a/drivers/net/ethernet/intel/igb/e1000_regs.h
+++ b/drivers/net/ethernet/intel/igb/e1000_regs.h
@@ -272,6 +272,8 @@
 #define E1000_HGOTCL      0x04130  /* Host Good Octets Transmit Count Low */
 #define E1000_HGOTCH      0x04134  /* Host Good Octets Transmit Count High */
 #define E1000_LENERRS     0x04138  /* Length Errors Count */
+#define E1000_TLPIC       0x04148  /* EEE Tx LPI Count */
+#define E1000_RLPIC       0x0414C  /* EEE Rx LPI Count */
 #define E1000_SCVPC       0x04228  /* SerDes/SGMII Code Violation Pkt Count */
 #define E1000_PCS_ANADV   0x04218  /* AN advertisement - RW */
 #define E1000_PCS_LPAB    0x0421C  /* Link Partner Ability - RW */
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
index e663123451da..61919292ac11 100644
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -69,6 +69,8 @@ static const struct igb_stats igb_gstrings_stats[] = {
 	IGB_STAT("os2bmc_tx_by_bmc", stats.b2ospc),
 	IGB_STAT("os2bmc_tx_by_host", stats.o2bspc),
 	IGB_STAT("os2bmc_rx_by_host", stats.b2ogprc),
+	IGB_STAT("tx_lpi_count", stats.tlpic),
+	IGB_STAT("rx_lpi_count", stats.rlpic),
 	IGB_STAT("tx_hwtstamp_timeouts", tx_hwtstamp_timeouts),
 	IGB_STAT("tx_hwtstamp_skipped", tx_hwtstamp_skipped),
 	IGB_STAT("rx_hwtstamp_cleared", rx_hwtstamp_cleared),
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index c75d78badf71..985d23050ae9 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -6936,6 +6936,11 @@ void igb_update_stats(struct igb_adapter *adapter)
 		adapter->stats.b2ospc += rd32(E1000_B2OSPC);
 		adapter->stats.b2ogprc += rd32(E1000_B2OGPRC);
 	}
+
+	if (hw->mac.type >= e1000_i350) {
+		adapter->stats.tlpic += rd32(E1000_TLPIC);
+		adapter->stats.rlpic += rd32(E1000_RLPIC);
+	}
 }
 
 static void igb_perout(struct igb_adapter *adapter, int tsintr_tt)
-- 
2.56.1


                 reply	other threads:[~2026-12-06 11:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261206115832.85773-1-maxime.chevallier@bootlin.com \
    --to=maxime.chevallier@bootlin.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=willemb@google.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