[dpdk-stable] patch 'net/sfc: fix xstats query by ID according to ethdev' has been queued to stable release 20.11.3

luca.boccassi at gmail.com luca.boccassi at gmail.com
Mon Jul 26 15:53:16 CEST 2021


Hi,

FYI, your patch has been queued to stable release 20.11.3

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/28/21. 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/e4ebfdeb0d05d303408e555ad27297203c58532d

Thanks.

Luca Boccassi

---
>From e4ebfdeb0d05d303408e555ad27297203c58532d Mon Sep 17 00:00:00 2001
From: Ivan Ilchenko <ivan.ilchenko at oktetlabs.ru>
Date: Fri, 23 Jul 2021 16:15:09 +0300
Subject: [PATCH] net/sfc: fix xstats query by ID according to ethdev

[ upstream commit 8232cc2d35ab9d07a729971b6c7596189775bc8f ]

Fix xstats by ID callbacks according to ethdev usage.
Handle combinations of input arguments that are required by ethdev
and sanity check and reject other combinations on callback entry.

Fixes: 73280c1e4ff ("net/sfc: support xstats retrieval by ID")

Signed-off-by: Ivan Ilchenko <ivan.ilchenko at oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton at xilinx.com>
---
 drivers/net/sfc/sfc_ethdev.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 41dc0bf05d..e5c30e6d3f 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -785,13 +785,10 @@ sfc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
 	int ret;
 	int rc;
 
-	sfc_adapter_lock(sa);
+	if (unlikely(ids == NULL || values == NULL))
+		return -EINVAL;
 
-	if (unlikely(values == NULL) ||
-	    unlikely(ids == NULL && n < port->mac_stats_nb_supported)) {
-		ret = port->mac_stats_nb_supported;
-		goto unlock;
-	}
+	sfc_adapter_lock(sa);
 
 	rc = sfc_port_update_mac_stats(sa);
 	if (rc != 0) {
@@ -806,7 +803,7 @@ sfc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
 		if (!EFX_MAC_STAT_SUPPORTED(port->mac_stats_mask, i))
 			continue;
 
-		if ((ids == NULL) || (ids[nb_written] == nb_supported))
+		if (ids[nb_written] == nb_supported)
 			values[nb_written++] = mac_stats[i];
 
 		++nb_supported;
@@ -831,10 +828,13 @@ sfc_xstats_get_names_by_id(struct rte_eth_dev *dev,
 	unsigned int nb_written = 0;
 	unsigned int i;
 
+	if (unlikely(xstats_names == NULL && ids != NULL) ||
+	    unlikely(xstats_names != NULL && ids == NULL))
+		return -EINVAL;
+
 	sfc_adapter_lock(sa);
 
-	if (unlikely(xstats_names == NULL) ||
-	    unlikely((ids == NULL) && (size < port->mac_stats_nb_supported))) {
+	if (unlikely(xstats_names == NULL && ids == NULL)) {
 		nb_supported = port->mac_stats_nb_supported;
 		sfc_adapter_unlock(sa);
 		return nb_supported;
@@ -844,7 +844,7 @@ sfc_xstats_get_names_by_id(struct rte_eth_dev *dev,
 		if (!EFX_MAC_STAT_SUPPORTED(port->mac_stats_mask, i))
 			continue;
 
-		if ((ids == NULL) || (ids[nb_written] == nb_supported)) {
+		if (ids[nb_written] == nb_supported) {
 			char *name = xstats_names[nb_written++].name;
 
 			strlcpy(name, efx_mac_stat_name(sa->nic, i),
-- 
2.30.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-07-26 13:53:18.988046127 +0100
+++ 0053-net-sfc-fix-xstats-query-by-ID-according-to-ethdev.patch	2021-07-26 13:53:15.957294893 +0100
@@ -1 +1 @@
-From 8232cc2d35ab9d07a729971b6c7596189775bc8f Mon Sep 17 00:00:00 2001
+From e4ebfdeb0d05d303408e555ad27297203c58532d Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 8232cc2d35ab9d07a729971b6c7596189775bc8f ]
+
@@ -11 +12,0 @@
-Cc: stable at dpdk.org
@@ -21 +22 @@
-index d5417e5e65..fca3f524a1 100644
+index 41dc0bf05d..e5c30e6d3f 100644
@@ -24 +25 @@
-@@ -794,13 +794,10 @@ sfc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
+@@ -785,13 +785,10 @@ sfc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
@@ -41 +42 @@
-@@ -815,7 +812,7 @@ sfc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
+@@ -806,7 +803,7 @@ sfc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
@@ -50 +51 @@
-@@ -840,10 +837,13 @@ sfc_xstats_get_names_by_id(struct rte_eth_dev *dev,
+@@ -831,10 +828,13 @@ sfc_xstats_get_names_by_id(struct rte_eth_dev *dev,
@@ -66 +67 @@
-@@ -853,7 +853,7 @@ sfc_xstats_get_names_by_id(struct rte_eth_dev *dev,
+@@ -844,7 +844,7 @@ sfc_xstats_get_names_by_id(struct rte_eth_dev *dev,


More information about the stable mailing list