git: 3a3937507af5 - stable/14 - e1000: fix rx accounting for multi-descriptor packets
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 01 Aug 2026 00:25:32 UTC
The branch stable/14 has been updated by kbowling:
URL: https://cgit.FreeBSD.org/src/commit/?id=3a3937507af534413ff1a6422661e6d112c74579
commit 3a3937507af534413ff1a6422661e6d112c74579
Author: Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-07-25 11:02:36 +0000
Commit: Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-08-01 00:25:17 +0000
e1000: fix rx accounting for multi-descriptor packets
The receive paths accumulate ri->iri_len across the descriptors making
up a packet, then add that running total to rxr->rx_bytes on every
iteration of the loop. A packet spanning descriptors of length l1, l2
and l3 thus contributes 3*l1 + 2*l2 + l3 instead of l1 + l2 + l3.
Single descriptor packets, the common case, are accounted correctly,
so this only shows up on jumbo frames.
Add the per descriptor length instead. iflib memsets the if_rxd_info
before each isc_rxd_pkt_get() call, so summing len gives the same total
as the final iri_len, and the frame error path that returns without
incrementing rx_packets keeps counting bytes exactly as before.
(cherry picked from commit 41a46c2d46aa4078c597ce3a0d19323cab988277)
---
sys/dev/e1000/em_txrx.c | 4 ++--
sys/dev/e1000/igb_txrx.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/sys/dev/e1000/em_txrx.c b/sys/dev/e1000/em_txrx.c
index ced8d0f41d14..cfeb43036563 100644
--- a/sys/dev/e1000/em_txrx.c
+++ b/sys/dev/e1000/em_txrx.c
@@ -681,7 +681,7 @@ lem_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri)
len = le16toh(rxd->length);
ri->iri_len += len;
- rxr->rx_bytes += ri->iri_len;
+ rxr->rx_bytes += len;
eop = (status & E1000_RXD_STAT_EOP) != 0;
@@ -747,7 +747,7 @@ em_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri)
len = le16toh(rxd->wb.upper.length);
ri->iri_len += len;
- rxr->rx_bytes += ri->iri_len;
+ rxr->rx_bytes += len;
eop = (staterr & E1000_RXD_STAT_EOP) != 0;
diff --git a/sys/dev/e1000/igb_txrx.c b/sys/dev/e1000/igb_txrx.c
index 568d84807173..19b365bf020a 100644
--- a/sys/dev/e1000/igb_txrx.c
+++ b/sys/dev/e1000/igb_txrx.c
@@ -460,7 +460,7 @@ igb_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri)
le32toh(rxd->wb.lower.lo_dword.data) & IGB_PKTTYPE_MASK;
ri->iri_len += len;
- rxr->rx_bytes += ri->iri_len;
+ rxr->rx_bytes += len;
rxd->wb.upper.status_error = 0;
eop = ((staterr & E1000_RXD_STAT_EOP) == E1000_RXD_STAT_EOP);