From nobody Sun Aug 16 10:04:03 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4hNBPw1SHyz6nq33 for ; Sun, 16 Aug 2026 10:04:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hNBPw0DyTz3VD0 for ; Sun, 16 Aug 2026 10:04:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1786874644; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8Wl+Dusn7Df5s7FSSmg11HuaRY0I/BnY8IPs6i5jIE0=; b=giLlgm5zucCz8vgyB00fk3jjzgCgoKzKvOoSbCA7b8OM+IrcE7eqDtHQbukIRNQIg4eJNi SLkJDfpA0R5HsCYV2hj8F4viU7WFcFCdBN9xbwHP8IeQouGxqxBD7Cva/Is69aMUUcyG57 6w/ypJkj+3c+bSpgDuX+PopCAkSme7eiWjxHCSx6ziEn5o2vn9WKxSBRdu8WD9+xeij2Qo 2v5C115LaDEGEHPqyNgEsrdl841RsSbVBJ5SheuHRkkZa8T+RRISlp8ouwe9C08zjjej8t 4biaCoO2n9WMGBKmOUkJRJGb0+t7mzrIR6ojZsJ13CiNdF4pb3pv5c2sAGG3CQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1786874644; a=rsa-sha256; cv=none; b=lZT+ze/gF0pLqtZ7LWC1IWCYNw93xABfvg4jJUZO0cW2vHgI44iRQ6ad3eFYml7jfn7NuL +rn7r2bhbjcBz3mcr/OWLjaajvcpc4OL8UrP3keU4pX0swyBFrU8ktxqJ9gh31CeKQYXw4 ZCQiL7yReZ6vOcmknJ6Whrt8P34bLgJtB4xdmLhQCZWiPsO5SN38ZNe8CKqD3BVeEUdqrB ENiJNI7lYb3dgm8YFUSxd2d2Q+8qLaSKYHBog+X70cSj3fB8Ow4KSeNj1jLGhKF8PQY0/c 2VkHhp3gthnmeBzxDbmFaaoy/ZSr4sDRx5YhqB9Az/j37QF0EeZcWF2i8inH8A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1786874644; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8Wl+Dusn7Df5s7FSSmg11HuaRY0I/BnY8IPs6i5jIE0=; b=KFHAqQuVuR7wfQ7alZiuqf8M4i7V54ymB5nZQpcCSJA81UqvewsfjUf7ZrW04NExGSQiI6 fEHZXUPHGEvixj5bSefOnhkpQxtU9NTmBW9yXyeTHh33H/uX5F5R98yw6wbeKzmBJe8W/j YGT5CF280s8Y3dl0AG3+OYky38qeehNkc6JPFRVBmEFvifiJJbe7XAhn+aSHGy8QYgysgi HjDMZLcrCDVBqREmfVQosXoTLUIZNJGBZr5nra2Jhicavpafw7ExBK43ys8yFv0F1LJFp0 NGTT2OdUlLNaHif3Jnh9/a61CULsc/znlDIAEhHaO2Z4WVNH2kbUi37n/2B8og== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hNBPv68zwz7vJ for ; Sun, 16 Aug 2026 10:04:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 237e5 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 16 Aug 2026 10:04:03 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 17042fd31571 - main - e1000: Report 82576 memory ECC errors List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 17042fd31571c7ceb955570ef43c9921d4a80f21 Auto-Submitted: auto-generated Date: Sun, 16 Aug 2026 10:04:03 +0000 Message-Id: <6a818b13.237e5.15de5cc5@gitrepo.freebsd.org> The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=17042fd31571c7ceb955570ef43c9921d4a80f21 commit 17042fd31571c7ceb955570ef43c9921d4a80f21 Author: Kevin Bowling AuthorDate: 2026-08-13 23:15:39 +0000 Commit: Kevin Bowling CommitDate: 2026-08-16 10:02:44 +0000 e1000: Report 82576 memory ECC errors 82576 exposes clear-on-read corrected error counters for RX, TX, switch, IPsec, descriptor-handler, PCIe retry, PCIe write, and MSI-X memories. The packet and descriptor memories also count uncorrectable errors. Sample each status register exactly once from the regular hardware statistics update and immediately before handling a memory-error interrupt. Group the counters by packet buffer, descriptor handler, and PCIe region. Skip the absent IPsec block on 82576NS. PRBESTS and PMSIXESTS are shared by both LAN ports. Attribute an indication to whichever attached port samples the clear-on-read register first so it is not counted twice. Hardware validation used an 82576EB revision 1. All nine implemented status registers reported their ECC-enable bit set. The sysctl counters remained clear across interface lifecycle, two-stream line-rate traffic, and NFER and FER cause injections. Each reset preserved the ECC enables while the driver restored PEINDM reactions. ICR cause injection does not corrupt SRAM, and the only documented data injector is specific to the IPsec packet buffer. Exact counter increments for the other memories were therefore validated against the register definitions rather than an injected ECC error. MFC after: 2 weeks Sponsored by: BBOX.io --- sys/dev/e1000/e1000_defines.h | 5 +++ sys/dev/e1000/e1000_regs.h | 7 ++++ sys/dev/e1000/if_em.c | 83 +++++++++++++++++++++++++++++++++++++++++++ sys/dev/e1000/if_em.h | 1 + 4 files changed, 96 insertions(+) diff --git a/sys/dev/e1000/e1000_defines.h b/sys/dev/e1000/e1000_defines.h index cf23bbde846e..ab53546d5597 100644 --- a/sys/dev/e1000/e1000_defines.h +++ b/sys/dev/e1000/e1000_defines.h @@ -543,6 +543,11 @@ /* 82576NS omits the IPsec key, FIFO, and packet-buffer memories. */ #define E1000_PEIND_82576_IPSEC_MASK 0x40700600 +/* The 82576 clear-on-read ECC status registers share this count layout. */ +#define E1000_ECC_82576_CORR_CNT_MASK 0x000000FF +#define E1000_ECC_82576_UNCORR_CNT_MASK 0x0000FF00 +#define E1000_ECC_82576_UNCORR_CNT_SHIFT 8 + #define E1000_PBECCSTS_I210_ECC_ENABLE 0x00000001 #define E1000_PBECCSTS_I210_CORR_ERR 0x00000004 diff --git a/sys/dev/e1000/e1000_regs.h b/sys/dev/e1000/e1000_regs.h index ec5df9ad774d..2141118c1246 100644 --- a/sys/dev/e1000/e1000_regs.h +++ b/sys/dev/e1000/e1000_regs.h @@ -117,6 +117,13 @@ #define E1000_PEIND 0x01084 /* Parity and ECC Indication - RC */ #define E1000_PEINDM 0x01088 /* Parity and ECC Indication Mask - RW */ #define E1000_PBECCSTS_I210 0x0245C /* I210 Packet Buffer ECC Status */ +#define E1000_SWPBECCSTS_82576 0x0305C /* Switch Packet Buffer ECC Status */ +#define E1000_IPPBECCSTS_82576 0x0B470 /* IPsec Packet Buffer ECC Status */ +#define E1000_RDHESTS_82576 0x025C0 /* Rx Descriptor Handler ECC Status */ +#define E1000_TDHESTS_82576 0x035C0 /* Tx Descriptor Handler ECC Status */ +#define E1000_PRBESTS_82576 0x05BA0 /* PCIe Retry Buffer ECC Status */ +#define E1000_PMSIXESTS_82576 0x05BA8 /* PCIe MSI-X ECC Status */ +#define E1000_PWBESTS_82576 0x05BB0 /* PCIe Write Buffer ECC Status */ #define E1000_IOSFPC 0x00F28 /* TX corrupted data */ #define E1000_EEMNGCTL 0x01010 /* MNG EEprom Control */ #define E1000_EEMNGCTL_I210 0x01010 /* i210 MNG EEprom Mode Control */ diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 6aa2a634bd24..8f2502ea2015 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -2291,6 +2291,58 @@ em_fatal_error_intr_mask(struct e1000_softc *sc) return (mask); } +static void +em_update_82576_ecc_counter(struct e1000_softc *sc, u32 reg, + u64 *corrected, u64 *uncorrected) +{ + u32 status; + + status = E1000_READ_REG(&sc->hw, reg); + *corrected += status & E1000_ECC_82576_CORR_CNT_MASK; + if (uncorrected != NULL) + *uncorrected += + (status & E1000_ECC_82576_UNCORR_CNT_MASK) >> + E1000_ECC_82576_UNCORR_CNT_SHIFT; +} + +static void +em_update_82576_ecc_stats(struct e1000_softc *sc) +{ + + /* + * These counters are clear-on-read. PRBESTS and PMSIXESTS are + * controller-shared, so whichever LAN port samples them first owns + * the software count. + */ + em_update_82576_ecc_counter(sc, E1000_RPBECCSTS, + &sc->corrected_error_packet_buffer_count, + &sc->uncorrected_error_packet_buffer_count); + em_update_82576_ecc_counter(sc, E1000_TPBECCSTS, + &sc->corrected_error_packet_buffer_count, + &sc->uncorrected_error_packet_buffer_count); + em_update_82576_ecc_counter(sc, E1000_SWPBECCSTS_82576, + &sc->corrected_error_packet_buffer_count, + &sc->uncorrected_error_packet_buffer_count); + if (em_82576_has_ipsec(&sc->hw)) + em_update_82576_ecc_counter(sc, E1000_IPPBECCSTS_82576, + &sc->corrected_error_packet_buffer_count, + &sc->uncorrected_error_packet_buffer_count); + + em_update_82576_ecc_counter(sc, E1000_RDHESTS_82576, + &sc->corrected_error_dma_count, + &sc->uncorrected_error_dma_count); + em_update_82576_ecc_counter(sc, E1000_TDHESTS_82576, + &sc->corrected_error_dma_count, + &sc->uncorrected_error_dma_count); + + em_update_82576_ecc_counter(sc, E1000_PRBESTS_82576, + &sc->corrected_error_pcie_retry_count, NULL); + em_update_82576_ecc_counter(sc, E1000_PWBESTS_82576, + &sc->corrected_error_pcie_tx_data_count, NULL); + em_update_82576_ecc_counter(sc, E1000_PMSIXESTS_82576, + &sc->corrected_error_pcie_other_count, NULL); +} + static void em_update_pch_ecc_stats(struct e1000_softc *sc, u32 pbeccsts) { @@ -2469,6 +2521,7 @@ em_handle_fatal_error_admin(struct e1000_softc *sc) sc->fatal_error_pbeccsts); } else if (em_has_82576_memory_errors(&sc->hw)) { peind = sc->fatal_error_peind; + em_update_82576_ecc_stats(sc); reset_required = (sc->fatal_error_icr & E1000_ICR_FER) != 0 || (peind & (E1000_PEIND_82576_FATAL_MASK | @@ -6205,6 +6258,8 @@ em_update_stats_counters(struct e1000_softc *sc) if (em_has_pch_ecc(&sc->hw)) em_update_pch_ecc_stats(sc, E1000_READ_REG(&sc->hw, E1000_PBECCSTS)); + else if (em_has_82576_memory_errors(&sc->hw)) + em_update_82576_ecc_stats(sc); else if (em_has_i350_memory_errors(&sc->hw)) em_update_i350_ecc_stats(sc); else if (em_has_i210_memory_errors(&sc->hw)) @@ -6649,6 +6704,34 @@ em_add_hw_stats(struct e1000_softc *sc) "fatal_unknown", CTLFLAG_RD, &sc->fatal_error_unknown_count, "Fatal memory errors without a reported source"); + SYSCTL_ADD_UQUAD(ctx, memerr_list, OID_AUTO, + "corrected_packet_buffer", CTLFLAG_RD, + &sc->corrected_error_packet_buffer_count, + "Corrected packet and switch-buffer ECC errors"); + SYSCTL_ADD_UQUAD(ctx, memerr_list, OID_AUTO, + "uncorrected_packet_buffer", CTLFLAG_RD, + &sc->uncorrected_error_packet_buffer_count, + "Uncorrected packet and switch-buffer ECC errors"); + SYSCTL_ADD_UQUAD(ctx, memerr_list, OID_AUTO, + "corrected_descriptor_handler", CTLFLAG_RD, + &sc->corrected_error_dma_count, + "Corrected descriptor-handler ECC errors"); + SYSCTL_ADD_UQUAD(ctx, memerr_list, OID_AUTO, + "uncorrected_descriptor_handler", CTLFLAG_RD, + &sc->uncorrected_error_dma_count, + "Uncorrected descriptor-handler ECC errors"); + SYSCTL_ADD_UQUAD(ctx, memerr_list, OID_AUTO, + "corrected_pcie_write_buffer", CTLFLAG_RD, + &sc->corrected_error_pcie_tx_data_count, + "Corrected PCIe write-buffer ECC errors"); + SYSCTL_ADD_UQUAD(ctx, memerr_list, OID_AUTO, + "corrected_pcie_retry_buffer", CTLFLAG_RD, + &sc->corrected_error_pcie_retry_count, + "Corrected controller-shared PCIe retry-buffer errors"); + SYSCTL_ADD_UQUAD(ctx, memerr_list, OID_AUTO, + "corrected_pcie_msix", CTLFLAG_RD, + &sc->corrected_error_pcie_other_count, + "Corrected controller-shared PCIe MSI-X errors"); } else { SYSCTL_ADD_UQUAD(ctx, memerr_list, OID_AUTO, "fatal_lan", CTLFLAG_RD, diff --git a/sys/dev/e1000/if_em.h b/sys/dev/e1000/if_em.h index 5515fcd3b4b2..9c441edd320b 100644 --- a/sys/dev/e1000/if_em.h +++ b/sys/dev/e1000/if_em.h @@ -644,6 +644,7 @@ struct e1000_softc { u64 corrected_error_pcie_other_count; u64 corrected_error_packet_buffer_count; u64 uncorrected_error_packet_buffer_count; + u64 uncorrected_error_dma_count; #ifdef PCI_IOV struct igb_vf *vfs;