DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: Ciara Loftus <ciara.loftus@intel.com>
Cc: <dev@dpdk.org>
Subject: Re: [PATCH 0/3] net/intel: fix potential rx stats underflow
Date: Fri, 26 Jun 2026 09:46:58 +0100	[thread overview]
Message-ID: <aj48giiB0U5rfUkP@bricha3-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <20260625093619.726471-1-ciara.loftus@intel.com>

On Thu, Jun 25, 2026 at 09:36:16AM +0000, Ciara Loftus wrote:
> 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
> 
Series applied to dpdk-next-net-intel. I was tempted to squash into one
patch, but kept them as three because the fix is not identical in all cases
(iavf being different).

Thanks,
/Bruce

      parent reply	other threads:[~2026-06-26  8:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-25  9:36 [PATCH 0/3] net/intel: fix potential rx stats underflow Ciara Loftus
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 ` Bruce Richardson [this message]

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=aj48giiB0U5rfUkP@bricha3-mobl1.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=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