git: 7dd826171b69 - main - e1000: Fix the multiqueue debug register dump

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Wed, 12 Aug 2026 03:02:26 UTC
The branch main has been updated by kbowling:

URL: https://cgit.FreeBSD.org/src/commit/?id=7dd826171b69a01c234ba6e9117917398ba2705e

commit 7dd826171b69a01c234ba6e9117917398ba2705e
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-08-12 00:33:18 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-08-12 02:59:21 +0000

    e1000: Fix the multiqueue debug register dump
    
    The debug routine advanced ring pointers as if rings were contiguous.
    They are embedded in queue structures, so rings beyond queue zero had
    the wrong stride.  The bogus queue index could cause an invalid MMIO
    read and panic the machine.
    
    Index the queue arrays first and then select the embedded ring.
    
    MFC after:      2 weeks
---
 sys/dev/e1000/if_em.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c
index 66a298ecf21c..691531601b8a 100644
--- a/sys/dev/e1000/if_em.c
+++ b/sys/dev/e1000/if_em.c
@@ -6749,9 +6749,6 @@ em_print_debug_info(struct e1000_softc *sc)
 		device_printf(dev, "queue state is unavailable\n");
 		return;
 	}
-	txr = &sc->tx_queues->txr;
-	rxr = &sc->rx_queues->rxr;
-
 	if (if_getdrvflags(ifp) & IFF_DRV_RUNNING)
 		printf("Interface is RUNNING ");
 	else
@@ -6762,14 +6759,16 @@ em_print_debug_info(struct e1000_softc *sc)
 	else
 		printf("and ACTIVE\n");
 
-	for (int i = 0; i < sc->tx_num_queues; i++, txr++) {
+	for (int i = 0; i < sc->tx_num_queues; i++) {
+		txr = &sc->tx_queues[i].txr;
 		device_printf(dev, "TX Queue %d ------\n", i);
 		device_printf(dev, "hw tdh = %d, hw tdt = %d\n",
 		    E1000_READ_REG(&sc->hw, E1000_TDH(txr->me)),
 		    E1000_READ_REG(&sc->hw, E1000_TDT(txr->me)));
 
 	}
-	for (int j=0; j < sc->rx_num_queues; j++, rxr++) {
+	for (int j = 0; j < sc->rx_num_queues; j++) {
+		rxr = &sc->rx_queues[j].rxr;
 		device_printf(dev, "RX Queue %d ------\n", j);
 		device_printf(dev, "hw rdh = %d, hw rdt = %d\n",
 		    E1000_READ_REG(&sc->hw, E1000_RDH(rxr->me)),