aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Bowling <kbowling@FreeBSD.org>2026-07-25 11:02:36 +0000
committerKevin Bowling <kbowling@FreeBSD.org>2026-08-01 00:24:33 +0000
commit03125b959758a5bfed0e4f10aa36a33fed279097 (patch)
tree3cb6bf6e5641492a63ca26bc402944a22a0056c2
parentec14a029fe73f7274668c41fa9e8073f3cf367ec (diff)
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)
-rw-r--r--sys/dev/e1000/em_txrx.c4
-rw-r--r--sys/dev/e1000/igb_txrx.c2
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);