diff options
| author | Kevin Bowling <kbowling@FreeBSD.org> | 2026-07-25 11:02:36 +0000 |
|---|---|---|
| committer | Kevin Bowling <kbowling@FreeBSD.org> | 2026-07-25 21:36:18 +0000 |
| commit | 41a46c2d46aa4078c597ce3a0d19323cab988277 (patch) | |
| tree | b1421a97546673a6d766069327fdf3a99c828a69 | |
| parent | 941113a0097ea047bd493f7f78b384718249779d (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.
MFC after: 1 week
| -rw-r--r-- | sys/dev/e1000/em_txrx.c | 4 | ||||
| -rw-r--r-- | 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 b86222e363e9..f2b48d6518f7 100644 --- a/sys/dev/e1000/em_txrx.c +++ b/sys/dev/e1000/em_txrx.c @@ -679,7 +679,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; @@ -745,7 +745,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 e01bc72cdc55..fc690dcfc100 100644 --- a/sys/dev/e1000/igb_txrx.c +++ b/sys/dev/e1000/igb_txrx.c @@ -458,7 +458,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); |
