patch 'net/cnxk: fix build with GCC 12' has been queued to stable release 21.11.1

Kevin Traynor ktraynor at redhat.com
Tue Mar 1 11:42:48 CET 2022


Hi,

FYI, your patch has been queued to stable release 21.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/06/22. 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/9a8eca798335e2afb3999f2f7a2f3e2a8292ce84

Thanks.

Kevin

---
>From 9a8eca798335e2afb3999f2f7a2f3e2a8292ce84 Mon Sep 17 00:00:00 2001
From: Rakesh Kudurumalla <rkudurumalla at marvell.com>
Date: Wed, 23 Feb 2022 15:25:40 +0530
Subject: [PATCH] net/cnxk: fix build with GCC 12

[ upstream commit b526599020ef06811dd08c4f15c0cdf049d7f9f2 ]

Resolve following compilation error with gcc 12 version.
error: storing the address of local variable message in *error.message

Fixes: 26b034f78ca7 ("net/cnxk: support to validate meter policy")

Reported-by: Ferruh Yigit <ferruh.yigit at intel.com>
Signed-off-by: Rakesh Kudurumalla <rkudurumalla at marvell.com>
Acked-by: Jerin Jacob <jerinj at marvell.com>
---
 drivers/net/cnxk/cnxk_ethdev_mtr.c | 59 ++++++++++++++++++++++--------
 1 file changed, 44 insertions(+), 15 deletions(-)

diff --git a/drivers/net/cnxk/cnxk_ethdev_mtr.c b/drivers/net/cnxk/cnxk_ethdev_mtr.c
index 39d8563826..6d14c88e7d 100644
--- a/drivers/net/cnxk/cnxk_ethdev_mtr.c
+++ b/drivers/net/cnxk/cnxk_ethdev_mtr.c
@@ -278,4 +278,45 @@ cnxk_nix_mtr_profile_delete(struct rte_eth_dev *eth_dev, uint32_t profile_id,
 }
 
+static int
+update_mtr_err(uint32_t act_color, struct rte_mtr_error *error, bool action)
+{
+	const char *str;
+	switch (act_color) {
+	case RTE_COLOR_GREEN:
+		if (action) {
+			str = "Green action is not valid";
+			goto notsup;
+		} else {
+			str = "Green action is null";
+			goto notvalid;
+		}
+		break;
+	case RTE_COLOR_YELLOW:
+		if (action) {
+			str = "Yellow action is not valid";
+			goto notsup;
+		} else {
+			str = "Yellow action is null";
+			goto notvalid;
+		}
+		break;
+	case RTE_COLOR_RED:
+		if (action) {
+			str = "Red action is not valid";
+			goto notsup;
+		} else {
+			str = "Red action is null";
+			goto notvalid;
+		}
+		break;
+	}
+notsup:
+	return -rte_mtr_error_set(error, ENOTSUP,
+				  RTE_MTR_ERROR_TYPE_METER_POLICY, NULL, str);
+notvalid:
+	return -rte_mtr_error_set(error, EINVAL,
+				  RTE_MTR_ERROR_TYPE_METER_POLICY, NULL, str);
+}
+
 static int
 cnxk_nix_mtr_policy_validate(struct rte_eth_dev *dev,
@@ -283,8 +324,6 @@ cnxk_nix_mtr_policy_validate(struct rte_eth_dev *dev,
 			     struct rte_mtr_error *error)
 {
-	static const char *const action_color[] = {"Green", "Yellow", "Red"};
 	bool supported[RTE_COLORS] = {false, false, false};
 	const struct rte_flow_action *action;
-	char message[1024];
 	uint32_t i;
 
@@ -305,19 +344,9 @@ cnxk_nix_mtr_policy_validate(struct rte_eth_dev *dev,
 					supported[i] = true;
 
-				if (!supported[i]) {
-					sprintf(message,
-						"%s action is not valid",
-						action_color[i]);
-					return -rte_mtr_error_set(error,
-					  ENOTSUP,
-					  RTE_MTR_ERROR_TYPE_METER_POLICY, NULL,
-					  message);
-				}
+				if (!supported[i])
+					return update_mtr_err(i, error, true);
 			}
 		} else {
-			sprintf(message, "%s action is null", action_color[i]);
-			return -rte_mtr_error_set(error, EINVAL,
-				RTE_MTR_ERROR_TYPE_METER_POLICY, NULL,
-				message);
+			return update_mtr_err(i, error, false);
 		}
 	}
-- 
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-03-01 10:41:03.926973761 +0000
+++ 0092-net-cnxk-fix-build-with-GCC-12.patch	2022-03-01 10:41:01.460244130 +0000
@@ -1 +1 @@
-From b526599020ef06811dd08c4f15c0cdf049d7f9f2 Mon Sep 17 00:00:00 2001
+From 9a8eca798335e2afb3999f2f7a2f3e2a8292ce84 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit b526599020ef06811dd08c4f15c0cdf049d7f9f2 ]
+
@@ -10 +11,0 @@
-Cc: stable at dpdk.org
@@ -20 +21 @@
-index cc783e5f86..c8183aa12d 100644
+index 39d8563826..6d14c88e7d 100644
@@ -23 +24 @@
-@@ -286,4 +286,45 @@ cnxk_nix_mtr_profile_delete(struct rte_eth_dev *eth_dev, uint32_t profile_id,
+@@ -278,4 +278,45 @@ cnxk_nix_mtr_profile_delete(struct rte_eth_dev *eth_dev, uint32_t profile_id,
@@ -69 +70 @@
-@@ -291,8 +332,6 @@ cnxk_nix_mtr_policy_validate(struct rte_eth_dev *dev,
+@@ -283,8 +324,6 @@ cnxk_nix_mtr_policy_validate(struct rte_eth_dev *dev,
@@ -78 +79 @@
-@@ -316,19 +355,9 @@ cnxk_nix_mtr_policy_validate(struct rte_eth_dev *dev,
+@@ -305,19 +344,9 @@ cnxk_nix_mtr_policy_validate(struct rte_eth_dev *dev,



More information about the stable mailing list