git: eff55e5e098b - main - e1000: Export EEE Low Power Idle counters
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 11 Aug 2026 20:50:19 UTC
The branch main has been updated by kbowling:
URL: https://cgit.FreeBSD.org/src/commit/?id=eff55e5e098b85855335d8df151787b6b034973f
commit eff55e5e098b85855335d8df151787b6b034973f
Author: Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-08-11 18:59:19 +0000
Commit: Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-08-11 20:49:56 +0000
e1000: Export EEE Low Power Idle counters
Accumulate the clear-on-read transmit and receive LPI event counters
on EEE capable PCH and I350 family devices. Expose the 64-bit totals
under the per-device eee sysctl node.
MFC after: 2 weeks
---
sys/dev/e1000/if_em.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c
index 2a7b3f4e3bfb..5a02514a89e3 100644
--- a/sys/dev/e1000/if_em.c
+++ b/sys/dev/e1000/if_em.c
@@ -462,6 +462,7 @@ static void em_initialize_vf_stats(struct e1000_softc *);
static void em_rebase_vf_stats(struct e1000_softc *);
static void em_update_vf_stats_counters(struct e1000_softc *);
static void em_add_hw_stats(struct e1000_softc *);
+static bool em_mac_has_eee(enum e1000_mac_type);
static int em_if_set_promisc(if_ctx_t, int);
static bool em_if_defer_promisc(struct e1000_softc *);
static bool em_if_vlan_filter_capable(if_ctx_t);
@@ -5642,6 +5643,12 @@ em_update_stats_counters(struct e1000_softc *sc)
stats->mptc += E1000_READ_REG(&sc->hw, E1000_MPTC);
stats->bptc += E1000_READ_REG(&sc->hw, E1000_BPTC);
+ /* TLPIC and RLPIC are clear-on-read. */
+ if (em_mac_has_eee(sc->hw.mac.type)) {
+ stats->tlpic += E1000_READ_REG(&sc->hw, E1000_TLPIC);
+ stats->rlpic += E1000_READ_REG(&sc->hw, E1000_RLPIC);
+ }
+
/* Interrupt Counts */
stats->iac += E1000_READ_REG(&sc->hw, E1000_IAC);
@@ -5670,6 +5677,14 @@ em_update_stats_counters(struct e1000_softc *sc)
}
}
+static bool
+em_mac_has_eee(enum e1000_mac_type type)
+{
+
+ return ((type >= e1000_pch2lan && type < e1000_82575) ||
+ (type >= e1000_i350 && type <= e1000_i211));
+}
+
static void
em_initialize_vf_stats(struct e1000_softc *sc)
{
@@ -6059,6 +6074,19 @@ em_add_hw_stats(struct e1000_softc *sc)
}
stats = &sc->ustats.stats;
+ if (em_mac_has_eee(sc->hw.mac.type)) {
+ struct sysctl_oid *eee_node;
+ struct sysctl_oid_list *eee_list;
+
+ eee_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "eee",
+ CTLFLAG_RD | CTLFLAG_MPSAFE, NULL,
+ "Energy Efficient Ethernet statistics");
+ eee_list = SYSCTL_CHILDREN(eee_node);
+ SYSCTL_ADD_UQUAD(ctx, eee_list, OID_AUTO, "tx_lpi_count",
+ CTLFLAG_RD, &stats->tlpic, "TX LPI event count");
+ SYSCTL_ADD_UQUAD(ctx, eee_list, OID_AUTO, "rx_lpi_count",
+ CTLFLAG_RD, &stats->rlpic, "RX LPI event count");
+ }
SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "excess_coll",
CTLFLAG_RD, &stats->ecol,