patch 'net/iavf: fix Rx packets statistics underflow' has been queued to stable release 24.11.7

luca.boccassi at gmail.com luca.boccassi at gmail.com
Mon Jul 6 12:20:28 CEST 2026


Hi,

FYI, your patch has been queued to stable release 24.11.7

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/05/26. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/41bc33f1d0670cd48f950c99367ca2e6946248f4

Thanks.

Luca Boccassi

---
>From 41bc33f1d0670cd48f950c99367ca2e6946248f4 Mon Sep 17 00:00:00 2001
From: Ciara Loftus <ciara.loftus at intel.com>
Date: Thu, 25 Jun 2026 09:36:19 +0000
Subject: [PATCH] net/iavf: fix Rx packets statistics underflow

[ upstream commit e0d83fb908a5eedb48a73f8f06db65c63399012f ]

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")

Signed-off-by: Ciara Loftus <ciara.loftus at intel.com>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>
---
 drivers/net/iavf/iavf_ethdev.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index dcd726f10d..02c3227e9d 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -1825,8 +1825,16 @@ iavf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 					 RTE_ETH_RX_OFFLOAD_KEEP_CRC) ? 0 :
 					 RTE_ETHER_CRC_LEN;
 		iavf_update_stats(vsi, pstats);
-		stats->ipackets = pstats->rx_unicast + pstats->rx_multicast +
-				pstats->rx_broadcast - pstats->rx_discards;
+		stats->ipackets = pstats->rx_unicast + pstats->rx_multicast + pstats->rx_broadcast;
+		/*
+		 * Unicast/multicast/broadcast counters include discarded packets, so subtract
+		 * rx_discards to report only the packets delivered to the application. The
+		 * counters are sampled from separate sources and can be momentarily inconsistent
+		 * under load. If rx_discards exceeds their sum then essentially nothing was
+		 * delivered, so saturate at zero rather than underflow.
+		 */
+		stats->ipackets = stats->ipackets >= pstats->rx_discards ?
+					stats->ipackets - pstats->rx_discards : 0;
 		stats->opackets = pstats->tx_broadcast + pstats->tx_multicast +
 						pstats->tx_unicast;
 		stats->imissed = pstats->rx_discards;
-- 
2.47.3

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2026-07-03 12:55:48.079666088 +0100
+++ 0036-net-iavf-fix-Rx-packets-statistics-underflow.patch	2026-07-03 12:55:46.666573877 +0100
@@ -1 +1 @@
-From e0d83fb908a5eedb48a73f8f06db65c63399012f Mon Sep 17 00:00:00 2001
+From 41bc33f1d0670cd48f950c99367ca2e6946248f4 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit e0d83fb908a5eedb48a73f8f06db65c63399012f ]
+
@@ -28 +29,0 @@
-Cc: stable at dpdk.org
@@ -33 +34 @@
- drivers/net/intel/iavf/iavf_ethdev.c | 12 ++++++++++--
+ drivers/net/iavf/iavf_ethdev.c | 12 ++++++++++--
@@ -36,5 +37,5 @@
-diff --git a/drivers/net/intel/iavf/iavf_ethdev.c b/drivers/net/intel/iavf/iavf_ethdev.c
-index 4c8a1895e4..80e740ef29 100644
---- a/drivers/net/intel/iavf/iavf_ethdev.c
-+++ b/drivers/net/intel/iavf/iavf_ethdev.c
-@@ -1887,8 +1887,16 @@ iavf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats,
+diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
+index dcd726f10d..02c3227e9d 100644
+--- a/drivers/net/iavf/iavf_ethdev.c
++++ b/drivers/net/iavf/iavf_ethdev.c
+@@ -1825,8 +1825,16 @@ iavf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
@@ -43,4 +44,4 @@
- 		iavf_update_stats(vsi, &pstats);
--		stats->ipackets = pstats.rx_unicast + pstats.rx_multicast +
--				pstats.rx_broadcast - pstats.rx_discards;
-+		stats->ipackets = pstats.rx_unicast + pstats.rx_multicast + pstats.rx_broadcast;
+ 		iavf_update_stats(vsi, pstats);
+-		stats->ipackets = pstats->rx_unicast + pstats->rx_multicast +
+-				pstats->rx_broadcast - pstats->rx_discards;
++		stats->ipackets = pstats->rx_unicast + pstats->rx_multicast + pstats->rx_broadcast;
@@ -54,5 +55,5 @@
-+		stats->ipackets = stats->ipackets >= pstats.rx_discards ?
-+					stats->ipackets - pstats.rx_discards : 0;
- 		stats->opackets = pstats.tx_broadcast + pstats.tx_multicast +
- 						pstats.tx_unicast;
- 		stats->imissed = pstats.rx_discards;
++		stats->ipackets = stats->ipackets >= pstats->rx_discards ?
++					stats->ipackets - pstats->rx_discards : 0;
+ 		stats->opackets = pstats->tx_broadcast + pstats->tx_multicast +
+ 						pstats->tx_unicast;
+ 		stats->imissed = pstats->rx_discards;


More information about the stable mailing list