git: 2f095faebb19 - main - e1000: Report corrected LAN management FIFO ECC errors

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Sat, 29 Aug 2026 02:31:31 UTC
The branch main has been updated by kbowling:

URL: https://cgit.FreeBSD.org/src/commit/?id=2f095faebb195735879d9caad164ce807d85ddf7

commit 2f095faebb195735879d9caad164ce807d85ddf7
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-08-28 12:58:37 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-08-29 02:31:22 +0000

    e1000: Report corrected LAN management FIFO ECC errors
    
    I350 and I354 report a corrected ECC error in the LAN transmit
    management FIFO through LANPERRSTS bit 16.  Unlike the parity status in
    the same register, this condition neither interrupts nor stops traffic.
    
    Poll the latch with the other corrected error status, increment a
    dedicated counter, and clear only its RW1C bit.  Expose it as
    dev.igb.N.memory_errors.corrected_lan_mng_fifo.
    
    Fatal error handling returns before the periodic statistics sweep and
    may reset the device.  Drain all I350 and I354 corrected-error status in
    the admin task before recovery so the reset does not discard pending
    indications.
    
    This follows section 6.21.16 of the Intel Atom Processor C2000 Product
    Family Integrated GbE Controller Programmer's Reference Manual,
    document 537426 revision 1.5.
    
    MFC after:      2 weeks
    Sponsored by:   BBOX.io
---
 sys/dev/e1000/e1000_defines.h |  1 +
 sys/dev/e1000/if_em.c         | 14 +++++++++++++-
 sys/dev/e1000/if_em.h         |  1 +
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/sys/dev/e1000/e1000_defines.h b/sys/dev/e1000/e1000_defines.h
index 21f54e15b9a7..18b311138032 100644
--- a/sys/dev/e1000/e1000_defines.h
+++ b/sys/dev/e1000/e1000_defines.h
@@ -591,6 +591,7 @@
 #define E1000_PBECCSTS_I350_I354_CORR_MASK	0x14000000
 
 #define E1000_LANPERRSTS_RETX_BUF		0x00000200
+#define E1000_LANPERRSTS_MNG_FIFO_CORR		0x00010000
 #define E1000_LANPERRSTS_I350_I354_NO_RESET_MASK	0x00008400
 #define E1000_LANPERRSTS_I350_I354_RESET_MASK	0x00007BFE
 #define E1000_LANPERRSTS_I350_I354_FATAL_MASK	0x0000FFFE
diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c
index de1b513f1040..649f57762919 100644
--- a/sys/dev/e1000/if_em.c
+++ b/sys/dev/e1000/if_em.c
@@ -2614,6 +2614,12 @@ em_update_i350_i354_ecc_stats(struct e1000_softc *sc)
 		sc->corrected_error_dma_count += bitcount32(status);
 		E1000_WRITE_REG(hw, E1000_DDECCS, status);
 	}
+	status = E1000_READ_REG(hw, E1000_LANPERRSTS) &
+	    E1000_LANPERRSTS_MNG_FIFO_CORR;
+	if (status != 0) {
+		sc->corrected_error_lan_mng_fifo_count++;
+		E1000_WRITE_REG(hw, E1000_LANPERRSTS, status);
+	}
 
 	pbeccsts = E1000_READ_REG(hw, E1000_RPBECCSTS);
 	status = pbeccsts & E1000_PBECCSTS_I350_I354_CORR_MASK;
@@ -2799,7 +2805,8 @@ em_handle_fatal_error_admin(struct e1000_softc *sc)
 			    E1000_READ_REG(&sc->hw, E1000_RPBECCSTS),
 			    E1000_READ_REG(&sc->hw, E1000_TPBECCSTS),
 			    pcieecc);
-		}
+		} else if (em_has_i350_i354_memory_errors(&sc->hw))
+			em_update_i350_i354_ecc_stats(sc);
 		if (peind & E1000_PEIND_LANPORT_PARITY_FATAL)
 			sc->fatal_error_lan_count++;
 		if (peind & E1000_PEIND_MNG_PARITY_FATAL)
@@ -7179,6 +7186,11 @@ em_add_hw_stats(struct e1000_softc *sc)
 				    "corrected_packet_buffer", CTLFLAG_RD,
 				    &sc->corrected_error_packet_buffer_count,
 				    "Corrected packet-buffer memory indications");
+				SYSCTL_ADD_UQUAD(ctx, memerr_list, OID_AUTO,
+				    "corrected_lan_mng_fifo", CTLFLAG_RD,
+				    &sc->corrected_error_lan_mng_fifo_count,
+				    "Corrected LAN management transmit-FIFO ECC "
+				    "indications");
 				SYSCTL_ADD_UQUAD(ctx, memerr_list, OID_AUTO,
 				    "corrected_pcie_tx_data", CTLFLAG_RD,
 				    &sc->corrected_error_pcie_tx_data_count,
diff --git a/sys/dev/e1000/if_em.h b/sys/dev/e1000/if_em.h
index d4d2b3db9457..5e72be998078 100644
--- a/sys/dev/e1000/if_em.h
+++ b/sys/dev/e1000/if_em.h
@@ -646,6 +646,7 @@ struct e1000_softc {
 	u64			corrected_error_pcie_retry_count;
 	u64			corrected_error_pcie_other_count;
 	u64			corrected_error_packet_buffer_count;
+	u64			corrected_error_lan_mng_fifo_count;
 	u64			uncorrected_error_packet_buffer_count;
 	u64			uncorrected_error_dma_count;
 	u64			uncorrected_error_pcie_count;