From: Ciara Loftus <ciara.loftus@intel.com>
To: dev@dpdk.org
Cc: Ciara Loftus <ciara.loftus@intel.com>
Subject: [PATCH 0/3] net/intel: fix potential rx stats underflow
Date: Thu, 25 Jun 2026 09:36:16 +0000 [thread overview]
Message-ID: <20260625093619.726471-1-ciara.loftus@intel.com> (raw)
The Rx packet count reported by ice, ice DCF and iavf can momentarily
jump to an enormous invalid value under load. ipackets is derived by
subtracting the discarded packet count from the sum of the unicast,
multicast and broadcast counters. That sum already includes the
discarded packets, so the result is the number actually delivered. The
inputs are sampled from separate sources at slightly different instants,
so the discard count can briefly exceed the measured sum. Because the
arithmetic is unsigned, the subtraction wraps to a huge value and is
reported as a hugely incorrect packet count and rate.
All three share the bug but not the fix, because they differ in how
much control they have over the sampling.
The ice PF reads its counters directly from hardware registers, so the
order is under the driver's control. Reading the discard register before
the other three, combined with the fact that the counters only ever
increase and the delivered-packet sum always includes the discards,
makes it impossible for the discard count to exceed the later sum. No
clamping is needed and the subtraction can never underflow.
ice DCF and iavf receive their counters from the PF in a single virtchnl
message and cannot influence the order in which the PF sampled them.
There a reorder is not available, so the subtraction is made saturating:
when the discard count exceeds the sum, essentially nothing was delivered,
so zero is reported instead of underflowing.
Ciara Loftus (3):
net/ice: fix Rx packets statistics underflow
net/ice: fix DCF Rx packets statistics underflow
net/iavf: fix Rx packets statistics underflow
drivers/net/intel/iavf/iavf_ethdev.c | 12 ++++++++++--
drivers/net/intel/ice/ice_dcf_ethdev.c | 12 ++++++++++--
drivers/net/intel/ice/ice_ethdev.c | 11 +++++++++--
3 files changed, 29 insertions(+), 6 deletions(-)
--
2.43.0
next reply other threads:[~2026-06-25 9:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-25 9:36 Ciara Loftus [this message]
2026-06-25 9:36 ` [PATCH 1/3] net/ice: fix Rx packets statistics underflow Ciara Loftus
2026-06-25 15:57 ` Bruce Richardson
2026-06-25 9:36 ` [PATCH 2/3] net/ice: fix DCF " Ciara Loftus
2026-06-25 15:57 ` Bruce Richardson
2026-06-25 9:36 ` [PATCH 3/3] net/iavf: fix " Ciara Loftus
2026-06-25 15:58 ` Bruce Richardson
2026-06-26 8:46 ` [PATCH 0/3] net/intel: fix potential rx stats underflow 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=20260625093619.726471-1-ciara.loftus@intel.com \
--to=ciara.loftus@intel.com \
--cc=dev@dpdk.org \
/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