HomeFreeBSD

iflib: accurately count bytes/segments for TSO

Description

iflib: accurately count bytes/segments for TSO

When using software based ifnet counters, iflib has not factored
TSO into account when reporting the segments and bytes sent.
So it will underreport NIC bandwidth by a small percent,
and will undercount sent segments by a large factor.
Fix this by calculating the number of added segments the NIC
will send, and add header size multiplied by that number
to arrive at a correct accounting of segments and bytes sent.
This makes these software counters directly comparable to
hardware counters.

Doing this requires moving the calculation into iflib_encap() where
we have already parsed the packet and know the header size, MSS, etc.

Differential Revision: https://reviews.freebsd.org/D56338
Sponsored by: Netflix

Details

Provenance
gallatinAuthored on Apr 17 2026, 3:45 PM
Differential Revision
D56338: iflib: accurately account for TSO packets & transmitted
Parents
rG52e7958702be: iflib: ignore reclaim coalescing when low on tx descriptors
Branches
Unknown
Tags
Unknown