The branch stable/15 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=9f5503e6410fcc165b9acf55a7cd7e3633c3a8cc
commit 9f5503e6410fcc165b9acf55a7cd7e3633c3a8cc Author: Kevin Bowling <[email protected]> AuthorDate: 2026-08-11 18:59:19 +0000 Commit: Kevin Bowling <[email protected]> CommitDate: 2026-08-25 00:26:33 +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. (cherry picked from commit eff55e5e098b85855335d8df151787b6b034973f) --- 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 32b02c93e134..d4044b547068 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -448,6 +448,7 @@ static void em_if_debug(if_ctx_t); static void em_update_vf_stats_counters(struct e1000_softc *); static void em_update_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_vlan_filter_capable(if_ctx_t); static bool em_if_vlan_filter_used(if_ctx_t); @@ -5057,6 +5058,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); @@ -5085,6 +5092,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_update_vf_stats_counters(struct e1000_softc *sc) { @@ -5365,6 +5380,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,
