patch 'net/nfp: fix offload of multiple output actions' has been queued to stable release 22.11.2

Xueming Li xuemingl at nvidia.com
Sun Apr 9 17:23:53 CEST 2023


Hi,

FYI, your patch has been queued to stable release 22.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 04/11/23. 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=22.11-staging

This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/log/?h=22.11-staging/commit/17637f9c0f2ae5434e363b9ae79d1338b0ec48c9

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 17637f9c0f2ae5434e363b9ae79d1338b0ec48c9 Mon Sep 17 00:00:00 2001
From: Chaoyong He <chaoyong.he at corigine.com>
Date: Tue, 28 Feb 2023 17:03:05 +0800
Subject: [PATCH] net/nfp: fix offload of multiple output actions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit 6a49f38c30eccc2e9040e7c5d78e4cbadbe04937 ]

When offload the flow with multiple output actions, the
original logic add a flag to every output action wrongly,
and this cause only the first output action can take effect.
Fix it by only add the flag to the last output action.

Fixes: 4d946034bf9c ("net/nfp: support basic flow actions")

Signed-off-by: Chaoyong He <chaoyong.he at corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund at corigine.com>
---
 drivers/net/nfp/nfp_flow.c | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c
index 49305a4152..50b166786a 100644
--- a/drivers/net/nfp/nfp_flow.c
+++ b/drivers/net/nfp/nfp_flow.c
@@ -2022,7 +2022,8 @@ nfp_flow_compile_items(struct nfp_flower_representor *representor,
 static int
 nfp_flow_action_output(char *act_data,
 		const struct rte_flow_action *action,
-		struct nfp_fl_rule_metadata *nfp_flow_meta)
+		struct nfp_fl_rule_metadata *nfp_flow_meta,
+		uint32_t output_cnt)
 {
 	size_t act_size;
 	struct rte_eth_dev *ethdev;
@@ -2041,8 +2042,9 @@ nfp_flow_action_output(char *act_data,
 	output = (struct nfp_fl_act_output *)act_data;
 	output->head.jump_id = NFP_FL_ACTION_OPCODE_OUTPUT;
 	output->head.len_lw  = act_size >> NFP_FL_LW_SIZ;
-	output->flags        = rte_cpu_to_be_16(NFP_FL_OUT_FLAGS_LAST);
 	output->port         = rte_cpu_to_be_32(representor->port_id);
+	if (output_cnt == 0)
+		output->flags = rte_cpu_to_be_16(NFP_FL_OUT_FLAGS_LAST);
 
 	nfp_flow_meta->shortcut = rte_cpu_to_be_32(representor->port_id);
 
@@ -3254,12 +3256,27 @@ nfp_flow_action_raw_encap(struct nfp_app_fw_flower *app_fw_flower,
 	return ret;
 }
 
+static uint32_t
+nfp_flow_count_output(const struct rte_flow_action actions[])
+{
+	uint32_t count = 0;
+	const struct rte_flow_action *action;
+
+	for (action = actions; action->type != RTE_FLOW_ACTION_TYPE_END; ++action) {
+		if (action->type == RTE_FLOW_ACTION_TYPE_PORT_ID)
+			count++;
+	}
+
+	return count;
+}
+
 static int
 nfp_flow_compile_action(struct nfp_flower_representor *representor,
 		const struct rte_flow_action actions[],
 		struct rte_flow *nfp_flow)
 {
 	int ret = 0;
+	uint32_t count;
 	char *position;
 	char *action_data;
 	bool ttl_tos_flag = false;
@@ -3278,6 +3295,8 @@ nfp_flow_compile_action(struct nfp_flower_representor *representor,
 	position      = action_data;
 	meta_tci = (struct nfp_flower_meta_tci *)nfp_flow->payload.unmasked_data;
 
+	count = nfp_flow_count_output(actions);
+
 	for (action = actions; action->type != RTE_FLOW_ACTION_TYPE_END; ++action) {
 		switch (action->type) {
 		case RTE_FLOW_ACTION_TYPE_VOID:
@@ -3294,7 +3313,8 @@ nfp_flow_compile_action(struct nfp_flower_representor *representor,
 			break;
 		case RTE_FLOW_ACTION_TYPE_PORT_ID:
 			PMD_DRV_LOG(DEBUG, "Process RTE_FLOW_ACTION_TYPE_PORT_ID");
-			ret = nfp_flow_action_output(position, action, nfp_flow_meta);
+			count--;
+			ret = nfp_flow_action_output(position, action, nfp_flow_meta, count);
 			if (ret != 0) {
 				PMD_DRV_LOG(ERR, "Failed when process"
 						" RTE_FLOW_ACTION_TYPE_PORT_ID");
-- 
2.25.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-04-09 21:45:39.939259000 +0800
+++ 0045-net-nfp-fix-offload-of-multiple-output-actions.patch	2023-04-09 21:45:38.639042200 +0800
@@ -1 +1 @@
-From 6a49f38c30eccc2e9040e7c5d78e4cbadbe04937 Mon Sep 17 00:00:00 2001
+From 17637f9c0f2ae5434e363b9ae79d1338b0ec48c9 Mon Sep 17 00:00:00 2001
@@ -7,0 +8,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 6a49f38c30eccc2e9040e7c5d78e4cbadbe04937 ]
@@ -15 +17,0 @@
-Cc: stable at dpdk.org
@@ -24 +26 @@
-index 53029d00c9..41b722f4d8 100644
+index 49305a4152..50b166786a 100644
@@ -27 +29 @@
-@@ -2033,7 +2033,8 @@ nfp_flow_compile_items(struct nfp_flower_representor *representor,
+@@ -2022,7 +2022,8 @@ nfp_flow_compile_items(struct nfp_flower_representor *representor,
@@ -37 +39 @@
-@@ -2052,8 +2053,9 @@ nfp_flow_action_output(char *act_data,
+@@ -2041,8 +2042,9 @@ nfp_flow_action_output(char *act_data,
@@ -48,2 +50,2 @@
-@@ -3307,12 +3309,27 @@ nfp_flow_action_meter(struct nfp_flower_representor *representor,
- 	return 0;
+@@ -3254,12 +3256,27 @@ nfp_flow_action_raw_encap(struct nfp_app_fw_flower *app_fw_flower,
+ 	return ret;
@@ -76 +78 @@
-@@ -3331,6 +3348,8 @@ nfp_flow_compile_action(struct nfp_flower_representor *representor,
+@@ -3278,6 +3295,8 @@ nfp_flow_compile_action(struct nfp_flower_representor *representor,
@@ -85 +87 @@
-@@ -3347,7 +3366,8 @@ nfp_flow_compile_action(struct nfp_flower_representor *representor,
+@@ -3294,7 +3313,8 @@ nfp_flow_compile_action(struct nfp_flower_representor *representor,


More information about the stable mailing list