patch 'net/af_xdp: fix stats reset' has been queued to stable release 23.11.2
Xueming Li
xuemingl at nvidia.com
Fri Jul 12 12:44:10 CEST 2024
Hi,
FYI, your patch has been queued to stable release 23.11.2
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/14/24. 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://git.dpdk.org/dpdk-stable/log/?h=23.11-staging
This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=f3cafbb257888e72cdc95b777ff2256772bb8e95
Thanks.
Xueming Li <xuemingl at nvidia.com>
---
>From f3cafbb257888e72cdc95b777ff2256772bb8e95 Mon Sep 17 00:00:00 2001
From: Ciara Loftus <ciara.loftus at intel.com>
Date: Tue, 14 May 2024 08:41:54 +0000
Subject: [PATCH] net/af_xdp: fix stats reset
Cc: Xueming Li <xuemingl at nvidia.com>
[ upstream commit 3577b1ee97dcfe9ff1b9e050bed55f17c435a93d ]
The imissed statistic was not properly reset because it was
read directly from the kernel statistics. To fix this, take note
of the kernel statistic when the stats are reset and deduct this
value from the kernel statistic read during statistics get.
Bugzilla ID: 1430
Fixes: f1debd77efaf ("net/af_xdp: introduce AF_XDP PMD")
Reported-by: Stephen Hemminger <stephen at networkplumber.org>
Signed-off-by: Ciara Loftus <ciara.loftus at intel.com>
Acked-by: Maryam Tahhan <mtahhan at redhat.com>
Acked-by: Stephen Hemminger <stephen at networkplumber.org>
---
drivers/net/af_xdp/rte_eth_af_xdp.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index 73fc434ee3..57759e2301 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -125,6 +125,7 @@ struct rx_stats {
uint64_t rx_pkts;
uint64_t rx_bytes;
uint64_t rx_dropped;
+ uint64_t imissed_offset;
};
struct pkt_rx_queue {
@@ -888,7 +889,7 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
AF_XDP_LOG(ERR, "getsockopt() failed for XDP_STATISTICS.\n");
return -1;
}
- stats->imissed += xdp_stats.rx_dropped;
+ stats->imissed += xdp_stats.rx_dropped - rxq->stats.imissed_offset;
stats->opackets += stats->q_opackets[i];
stats->obytes += stats->q_obytes[i];
@@ -901,13 +902,25 @@ static int
eth_stats_reset(struct rte_eth_dev *dev)
{
struct pmd_internals *internals = dev->data->dev_private;
- int i;
+ struct pmd_process_private *process_private = dev->process_private;
+ struct xdp_statistics xdp_stats;
+ socklen_t optlen;
+ int i, ret, fd;
for (i = 0; i < internals->queue_cnt; i++) {
memset(&internals->rx_queues[i].stats, 0,
sizeof(struct rx_stats));
memset(&internals->tx_queues[i].stats, 0,
sizeof(struct tx_stats));
+ fd = process_private->rxq_xsk_fds[i];
+ optlen = sizeof(struct xdp_statistics);
+ ret = fd >= 0 ? getsockopt(fd, SOL_XDP, XDP_STATISTICS,
+ &xdp_stats, &optlen) : -1;
+ if (ret != 0) {
+ AF_XDP_LOG(ERR, "getsockopt() failed for XDP_STATISTICS.\n");
+ return -1;
+ }
+ internals->rx_queues[i].stats.imissed_offset = xdp_stats.rx_dropped;
}
return 0;
--
2.34.1
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2024-07-12 18:40:15.361760376 +0800
+++ 0024-net-af_xdp-fix-stats-reset.patch 2024-07-12 18:40:13.976594243 +0800
@@ -1 +1 @@
-From 3577b1ee97dcfe9ff1b9e050bed55f17c435a93d Mon Sep 17 00:00:00 2001
+From f3cafbb257888e72cdc95b777ff2256772bb8e95 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 3577b1ee97dcfe9ff1b9e050bed55f17c435a93d ]
@@ -13 +15,0 @@
-Cc: stable at dpdk.org
@@ -24 +26 @@
-index 0db761a204..25e67851f6 100644
+index 73fc434ee3..57759e2301 100644
@@ -27 +29 @@
-@@ -126,6 +126,7 @@ struct rx_stats {
+@@ -125,6 +125,7 @@ struct rx_stats {
@@ -35 +37 @@
-@@ -892,7 +893,7 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
+@@ -888,7 +889,7 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
@@ -44 +46 @@
-@@ -905,13 +906,25 @@ static int
+@@ -901,13 +902,25 @@ static int
More information about the stable
mailing list