[PATCH 23.11 2/3] net/ixgbe: fix good octets CRC adjustment

Andrey Mokrushin a.mokrushin at ideco.ru
Thu Oct 22 10:00:27 CEST 2026


From: Daniil Iskhakov <dish at amicon.ru>

[ upstream commit 77889afaf11f52a5e13f9077688c5e9ad501bbbb ]

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: stable at dpdk.org

Signed-off-by: Daniil Iskhakov <dish at amicon.ru>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>
Signed-off-by: Andrey Mokrushin <a.mokrushin at ideco.ru>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index d798aafcec..edefb9476b 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -3170,7 +3170,7 @@ ixgbe_read_stats_registers(struct ixgbe_hw *hw,
 			   uint64_t *total_qprc, uint64_t *total_qprdc)
 {
 	uint32_t bprc, lxon, lxoff, total;
-	uint32_t delta_gprc = 0;
+	uint64_t delta_gprc = 0;
 	unsigned i;
 	/* Workaround for RX byte count not including CRC bytes when CRC
 	 * strip is enabled. CRC bytes are removed from counters when crc_strip
-- 
2.56.0




More information about the stable mailing list