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>, <stable@dpdk.org>
Subject: Re: [PATCH 3/3] net/iavf: fix Rx packets statistics underflow
Date: Thu, 25 Jun 2026 16:58:38 +0100	[thread overview]
Message-ID: <aj1QLsdpA7iOsFYI@bricha3-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <20260625093619.726471-4-ciara.loftus@intel.com>

On Thu, Jun 25, 2026 at 09:36:19AM +0000, Ciara Loftus wrote:
> The number of Rx packets is computed as the sum of the unicast,
> multicast and broadcast packet counters, minus the discarded packet
> count:
> 
>     ipackets = rx_unicast + rx_multicast + rx_broadcast - rx_discards
> 
> The unicast, multicast and broadcast counters already include the
> packets that were subsequently dropped, so subtracting rx_discards
> yields only the packets delivered to the application. These values are
> provided by the PF in a virtchnl_eth_stats message; the PF samples them
> from separate sources and the VF cannot guarantee the order in which
> they are read. Under load, rx_discards can therefore momentarily exceed
> the sum of the unicast, multicast and broadcast counters. As ipackets is
> unsigned, the subtraction then wraps to a huge bogus value, reported to
> the application as an enormous Rx packet count and packet rate.
> 
> The read order cannot be guaranteed from the VF, so use a saturating
> subtraction: when rx_discards exceeds the sum of the unicast, multicast
> and broadcast counters essentially nothing was delivered, so report zero
> instead of underflowing.
> 
> Fixes: e71ffcc1008e ("net/iavf: fix Rx total stats")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

  reply	other threads:[~2026-06-25 15:58 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 [this message]
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=aj1QLsdpA7iOsFYI@bricha3-mobl1.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=ciara.loftus@intel.com \
    --cc=dev@dpdk.org \
    --cc=stable@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