* [PATCH] net/ixgbe: fix good octets CRC adjustment
@ 2026-05-04 14:15 Daniil Iskhakov
2026-05-06 16:17 ` Bruce Richardson
0 siblings, 1 reply; 3+ messages in thread
From: Daniil Iskhakov @ 2026-05-04 14:15 UTC (permalink / raw)
To: Anatoly Burakov, Vladimir Medvedkin, Harry van Haaren,
Konstantin Ananyev
Cc: dev, stable, Daniil Iskhakov, sdl.dpdk, rrv
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@dpdk.org
Signed-off-by: Daniil Iskhakov <dish@amicon.ru>
---
Cc: harry.van.haaren@intel.com
Cc: sdl.dpdk@linuxtesting.org
Cc: rrv@amicon.ru
---
drivers/net/intel/ixgbe/ixgbe_ethdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/intel/ixgbe/ixgbe_ethdev.c b/drivers/net/intel/ixgbe/ixgbe_ethdev.c
index 57d929cf2c..71243610ee 100644
--- a/drivers/net/intel/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/intel/ixgbe/ixgbe_ethdev.c
@@ -3182,7 +3182,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.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] net/ixgbe: fix good octets CRC adjustment
2026-05-04 14:15 [PATCH] net/ixgbe: fix good octets CRC adjustment Daniil Iskhakov
@ 2026-05-06 16:17 ` Bruce Richardson
2026-05-06 16:21 ` Bruce Richardson
0 siblings, 1 reply; 3+ messages in thread
From: Bruce Richardson @ 2026-05-06 16:17 UTC (permalink / raw)
To: Daniil Iskhakov
Cc: Anatoly Burakov, Vladimir Medvedkin, Konstantin Ananyev, dev,
stable, sdl.dpdk, rrv
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: stable@dpdk.org
>
> Signed-off-by: Daniil Iskhakov <dish@amicon.ru>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] net/ixgbe: fix good octets CRC adjustment
2026-05-06 16:17 ` Bruce Richardson
@ 2026-05-06 16:21 ` Bruce Richardson
0 siblings, 0 replies; 3+ messages in thread
From: Bruce Richardson @ 2026-05-06 16:21 UTC (permalink / raw)
To: Daniil Iskhakov
Cc: Anatoly Burakov, Vladimir Medvedkin, Konstantin Ananyev, dev,
stable, sdl.dpdk, rrv
On Wed, May 06, 2026 at 05:17:04PM +0100, Bruce Richardson wrote:
> 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: stable@dpdk.org
> >
> > Signed-off-by: Daniil Iskhakov <dish@amicon.ru>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Applied to dpdk-next-net-intel.
Thanks,
/Bruce
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-05-06 16:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-04 14:15 [PATCH] net/ixgbe: fix good octets CRC adjustment Daniil Iskhakov
2026-05-06 16:17 ` Bruce Richardson
2026-05-06 16:21 ` Bruce Richardson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox