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

christian.ehrhardt at canonical.com christian.ehrhardt at canonical.com
Tue Aug 10 17:40:07 CEST 2021


Hi,

FYI, your patch has been queued to stable release 19.11.10

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 08/12/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/cpaelzer/dpdk-stable-queue

This queued commit can be viewed at:
https://github.com/cpaelzer/dpdk-stable-queue/commit/a31460e290504bbb8ec62ef76281044eac9a715b

Thanks.

Christian Ehrhardt <christian.ehrhardt at canonical.com>

---
>From a31460e290504bbb8ec62ef76281044eac9a715b 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 93c7ee6322..7317c30a71 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -777,13 +777,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) {
@@ -798,7 +795,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;
@@ -823,10 +820,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;
@@ -836,7 +836,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.32.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-08-10 15:11:16.368105036 +0200
+++ 0087-net-sfc-fix-xstats-query-by-ID-according-to-ethdev.patch	2021-08-10 15:11:13.102638705 +0200
@@ -1 +1 @@
-From 8232cc2d35ab9d07a729971b6c7596189775bc8f Mon Sep 17 00:00:00 2001
+From a31460e290504bbb8ec62ef76281044eac9a715b 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 93c7ee6322..7317c30a71 100644
@@ -24 +25 @@
-@@ -794,13 +794,10 @@ sfc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
+@@ -777,13 +777,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,
+@@ -798,7 +795,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,
+@@ -823,10 +820,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,
+@@ -836,7 +836,7 @@ sfc_xstats_get_names_by_id(struct rte_eth_dev *dev,


More information about the stable mailing list