aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Bowling <kbowling@FreeBSD.org>2026-08-10 15:09:29 +0000
committerKevin Bowling <kbowling@FreeBSD.org>2026-08-10 16:33:12 +0000
commit660099c985e8bfc931b01398715441c90cf0d4db (patch)
treee40b297c39beb315ef6c468efcb86199009ace1e
parent877f0ee40c2af801c5ca758a37b3ebddc560dad2 (diff)
ixgbe: Restore missed packet accounting
missed_rx and total_missed_rx are never populated. As a result, the GPRC erratum workaround does not remove missed packets and iqdrops always remains zero. The rx_missed_packets sysctl and input-error total also expose only MPC bank zero. Read and accumulate all eight MPC banks. Use the interval total to correct GPRC and the cumulative total for iqdrops, input errors, and the aggregate sysctl. This matches DPDK's coverage of the hardware banks. MFC after: 2 weeks
-rw-r--r--sys/dev/ixgbe/if_ix.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c
index 252ae352829e..9a998b03dbd7 100644
--- a/sys/dev/ixgbe/if_ix.c
+++ b/sys/dev/ixgbe/if_ix.c
@@ -1923,7 +1923,7 @@ ixgbe_update_stats_counters(struct ixgbe_softc *sc)
{
struct ixgbe_hw *hw = &sc->hw;
struct ixgbe_hw_stats *stats = &sc->stats.pf;
- u32 missed_rx = 0, bprc, lxon, lxoff;
+ u32 missed_rx = 0, mpc, bprc, lxon, lxoff;
u32 lxoffrxc;
u64 total_missed_rx = 0, total;
@@ -1931,7 +1931,13 @@ ixgbe_update_stats_counters(struct ixgbe_softc *sc)
stats->illerrc += IXGBE_READ_REG(hw, IXGBE_ILLERRC);
stats->errbc += IXGBE_READ_REG(hw, IXGBE_ERRBC);
stats->mspdc += IXGBE_READ_REG(hw, IXGBE_MSPDC);
- stats->mpc[0] += IXGBE_READ_REG(hw, IXGBE_MPC(0));
+ for (int i = 0; i < nitems(stats->mpc); i++) {
+ mpc = IXGBE_READ_REG(hw, IXGBE_MPC(i));
+ missed_rx += mpc;
+ stats->mpc[i] += mpc;
+ total_missed_rx += stats->mpc[i];
+ }
+ stats->mpctotal = total_missed_rx;
for (int i = 0; i < 16; i++) {
stats->qprc[i] += IXGBE_READ_REG(hw, IXGBE_QPRC(i));
@@ -2053,7 +2059,7 @@ ixgbe_update_stats_counters(struct ixgbe_softc *sc)
* - jabber count.
*/
IXGBE_SET_IERRORS(sc, stats->crcerrs + stats->illerrc +
- stats->mpc[0] + stats->rlec + stats->ruc + stats->rfc +
+ stats->mpctotal + stats->rlec + stats->ruc + stats->rfc +
stats->roc + stats->rjc);
} /* ixgbe_update_stats_counters */
@@ -2164,7 +2170,7 @@ ixgbe_add_hw_stats(struct ixgbe_softc *sc)
SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "rec_len_errs",
CTLFLAG_RD, &stats->rlec, "Receive Length Errors");
SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "rx_missed_packets",
- CTLFLAG_RD, &stats->mpc[0], "RX Missed Packet Count");
+ CTLFLAG_RD, &stats->mpctotal, "RX Missed Packet Count");
/* Flow Control stats */
SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "xon_txd",