patch 'net/memif: fix statistics' has been queued to stable release 25.11.5
Kevin Traynor
ktraynor at redhat.com
Thu Dec 3 14:01:23 CET 2026
Hi,
FYI, your patch has been queued to stable release 25.11.5
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 12/08/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/kevintraynor/dpdk-stable
This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/eee589c6cfd3bdd551fe1d70abf70b68a95b4e04
Thanks.
Kevin
---
>From eee589c6cfd3bdd551fe1d70abf70b68a95b4e04 Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen at networkplumber.org>
Date: Tue, 22 Sep 2026 12:40:53 -0700
Subject: [PATCH] net/memif: fix statistics
[ upstream commit e7793922cca0649008ce26aaebccfcb8e3daf2b6 ]
The statistics structure is already cleared in ethdev before
calling PMD.
Statistics from all queues should be counted against overall
packets; the constant RTE_ETHDEV_QUEUE_STAT_CNTRS is upper
bound on the array of queue stats.
The counters were also keyed off the negotiated ring counts in
pmd->run, which memif_disconnect() clears, so every counter read
back as zero once the peer went away. Iterate over the configured
queue counts instead, in both stats_get and stats_reset, so the
totals survive a disconnect.
Fixes: 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
drivers/net/memif/rte_eth_memif.c | 41 +++++++++----------------------
1 file changed, 11 insertions(+), 30 deletions(-)
diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
index 5d153c3a5a..9dab748546 100644
--- a/drivers/net/memif/rte_eth_memif.c
+++ b/drivers/net/memif/rte_eth_memif.c
@@ -1596,23 +1596,11 @@ memif_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats,
struct eth_queue_stats *qstats)
{
- struct pmd_internals *pmd = dev->data->dev_private;
struct memif_queue *mq;
- int i;
- uint8_t tmp, nq;
-
- stats->ipackets = 0;
- stats->ibytes = 0;
- stats->opackets = 0;
- stats->obytes = 0;
-
- tmp = (pmd->role == MEMIF_ROLE_CLIENT) ? pmd->run.num_s2c_rings :
- pmd->run.num_c2s_rings;
- nq = (tmp < RTE_ETHDEV_QUEUE_STAT_CNTRS) ? tmp :
- RTE_ETHDEV_QUEUE_STAT_CNTRS;
+ unsigned int i;
/* RX stats */
- for (i = 0; i < nq; i++) {
+ for (i = 0; i < dev->data->nb_rx_queues; i++) {
mq = dev->data->rx_queues[i];
- if (qstats != NULL) {
+ if (qstats != NULL && i < RTE_ETHDEV_QUEUE_STAT_CNTRS) {
qstats->q_ipackets[i] = mq->n_pkts;
qstats->q_ibytes[i] = mq->n_bytes;
@@ -1623,13 +1611,8 @@ memif_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats,
}
- tmp = (pmd->role == MEMIF_ROLE_CLIENT) ? pmd->run.num_c2s_rings :
- pmd->run.num_s2c_rings;
- nq = (tmp < RTE_ETHDEV_QUEUE_STAT_CNTRS) ? tmp :
- RTE_ETHDEV_QUEUE_STAT_CNTRS;
-
/* TX stats */
- for (i = 0; i < nq; i++) {
+ for (i = 0; i < dev->data->nb_tx_queues; i++) {
mq = dev->data->tx_queues[i];
- if (qstats != NULL) {
+ if (qstats != NULL && i < RTE_ETHDEV_QUEUE_STAT_CNTRS) {
qstats->q_opackets[i] = mq->n_pkts;
qstats->q_obytes[i] = mq->n_bytes;
@@ -1644,18 +1627,16 @@ static int
memif_stats_reset(struct rte_eth_dev *dev)
{
- struct pmd_internals *pmd = dev->data->dev_private;
- int i;
struct memif_queue *mq;
+ unsigned int i;
- for (i = 0; i < pmd->run.num_c2s_rings; i++) {
- mq = (pmd->role == MEMIF_ROLE_CLIENT) ? dev->data->tx_queues[i] :
- dev->data->rx_queues[i];
+ /* Same as memif_stats_get(), pmd->run is cleared on disconnect. */
+ for (i = 0; i < dev->data->nb_rx_queues; i++) {
+ mq = dev->data->rx_queues[i];
mq->n_pkts = 0;
mq->n_bytes = 0;
mq->n_err = 0;
}
- for (i = 0; i < pmd->run.num_s2c_rings; i++) {
- mq = (pmd->role == MEMIF_ROLE_CLIENT) ? dev->data->rx_queues[i] :
- dev->data->tx_queues[i];
+ for (i = 0; i < dev->data->nb_tx_queues; i++) {
+ mq = dev->data->tx_queues[i];
mq->n_pkts = 0;
mq->n_bytes = 0;
--
2.56.1
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-12-03 12:52:43.725748462 +0000
+++ 0157-net-memif-fix-statistics.patch 2026-12-03 12:52:39.140885587 +0000
@@ -1 +1 @@
-From e7793922cca0649008ce26aaebccfcb8e3daf2b6 Mon Sep 17 00:00:00 2001
+From eee589c6cfd3bdd551fe1d70abf70b68a95b4e04 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit e7793922cca0649008ce26aaebccfcb8e3daf2b6 ]
+
@@ -19 +20,0 @@
-Cc: stable at dpdk.org
@@ -23,2 +24,2 @@
- drivers/net/memif/rte_eth_memif.c | 37 ++++++++-----------------------
- 1 file changed, 9 insertions(+), 28 deletions(-)
+ drivers/net/memif/rte_eth_memif.c | 41 +++++++++----------------------
+ 1 file changed, 11 insertions(+), 30 deletions(-)
@@ -27 +28 @@
-index 1c8dc1d5ec..11df159b2d 100644
+index 5d153c3a5a..9dab748546 100644
@@ -30 +31 @@
-@@ -1596,21 +1596,9 @@ memif_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats,
+@@ -1596,23 +1596,11 @@ memif_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats,
@@ -45,2 +46,2 @@
-- nq = (tmp < dev->data->nb_rx_queues) ? tmp :
-- dev->data->nb_rx_queues;
+- nq = (tmp < RTE_ETHDEV_QUEUE_STAT_CNTRS) ? tmp :
+- RTE_ETHDEV_QUEUE_STAT_CNTRS;
@@ -53,2 +54,5 @@
- if (qstats != NULL) {
-@@ -1623,11 +1611,6 @@ memif_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats,
+- if (qstats != NULL) {
++ if (qstats != NULL && i < RTE_ETHDEV_QUEUE_STAT_CNTRS) {
+ qstats->q_ipackets[i] = mq->n_pkts;
+ qstats->q_ibytes[i] = mq->n_bytes;
+@@ -1623,13 +1611,8 @@ memif_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats,
@@ -59,2 +63,2 @@
-- nq = (tmp < dev->data->nb_tx_queues) ? tmp :
-- dev->data->nb_tx_queues;
+- nq = (tmp < RTE_ETHDEV_QUEUE_STAT_CNTRS) ? tmp :
+- RTE_ETHDEV_QUEUE_STAT_CNTRS;
@@ -66 +70,4 @@
- if (qstats != NULL) {
+- if (qstats != NULL) {
++ if (qstats != NULL && i < RTE_ETHDEV_QUEUE_STAT_CNTRS) {
+ qstats->q_opackets[i] = mq->n_pkts;
+ qstats->q_obytes[i] = mq->n_bytes;
More information about the stable
mailing list