DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniil Iskhakov <dish@amicon.ru>
To: Anatoly Burakov <anatoly.burakov@intel.com>,
	Vladimir Medvedkin <vladimir.medvedkin@intel.com>,
	Harry van Haaren <harry.van.haaren@intel.com>,
	Konstantin Ananyev <konstantin.ananyev@huawei.com>
Cc: <dev@dpdk.org>, <stable@dpdk.org>,
	Daniil Iskhakov <dish@amicon.ru>, <sdl.dpdk@linuxtesting.org>,
	<rrv@amicon.ru>
Subject: [PATCH] net/ixgbe: fix good octets CRC adjustment
Date: Mon, 4 May 2026 17:15:24 +0300	[thread overview]
Message-ID: <20260504141524.114604-1-dish@amicon.ru> (raw)

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


             reply	other threads:[~2026-05-05 13:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-04 14:15 Daniil Iskhakov [this message]
2026-05-06 16:17 ` [PATCH] net/ixgbe: fix good octets CRC adjustment Bruce Richardson
2026-05-06 16:21   ` Bruce Richardson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260504141524.114604-1-dish@amicon.ru \
    --to=dish@amicon.ru \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=harry.van.haaren@intel.com \
    --cc=konstantin.ananyev@huawei.com \
    --cc=rrv@amicon.ru \
    --cc=sdl.dpdk@linuxtesting.org \
    --cc=stable@dpdk.org \
    --cc=vladimir.medvedkin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox