On Mon, May 04, 2026 at 05:15:24PM +0300, Daniil Iskhakov wrote:
> On some devices, such as 82599, GORC is a 36-bit clear-on-read counter,
> while GPRC is a 32-bit clear-on-read counter.
> ixgbe_read_stats_registers() accumulates GORC in a 64-bit software
> counter and, when CRC stripping is disabled, subtracts the CRC bytes
> accounted for each received packet.
> 
> The driver does not read GPRC directly. Due to an erratum, it derives
> the good packet delta from the sum of per-queue packet receives instead.
> The 32-bit QPRC registers are used for this purpose.
> 
> delta_gprc is used as an accumulator for those per-queue deltas and is
> then used to compute the CRC-byte adjustment. Keeping it 32-bit may wrap
> the accumulated packet delta before it is used to adjust the 64-bit GORC
> counter.
> 
> Make delta_gprc 64-bit so the accumulated packet delta and the CRC-byte
> adjustment are computed without 32-bit overflow.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Fixes: c03fcee9abbd ("ixgbe: remove CRC size from byte counters")
> Cc: [email protected]
> 
> Signed-off-by: Daniil Iskhakov <[email protected]>
Acked-by: Bruce Richardson <[email protected]>

Reply via email to