Skip to contentSkip to conversation

ethdev: fix indirect action convert

PATCH Applied Suanming Mou 3 participants 3 messages May 26, 2023 – May 31, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ethdev: fix indirect action convert

As indirect action conf fills the indirect action handler, while converting indirect action, the action conf(action handler) should be copied from original indirect action conf instead of duplicating the action handler memory.

Fixes 4b61b8774be9 ("ethdev: introduce indirect flow action")
---
 lib/ethdev/rte_flow.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
lib/ethdev/rte_flow.c +9 -1
index 69e6e749f7..ff740f19a4 100644
@@ -889,7 +889,15 @@ rte_flow_conv_actions(struct rte_flow_action *dst,
 	src -= num;
 	dst -= num;
 	do {
-		if (src->conf) {
+		if (src->type == RTE_FLOW_ACTION_TYPE_INDIRECT) {
+			/*
+			 * Indirect action conf fills the indirect action
+			 * handler. Copy the action handle directly instead
+			 * of duplicating the pointer memory.
+			 */
+			if (size)
+				dst->conf = src->conf;
+		} else if (src->conf) {
 			off = RTE_ALIGN_CEIL(off, sizeof(double));
 			ret = rte_flow_conv_action_conf
 				((void *)(data + off),
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw

Hi Suanming,

Quoted 38 lines

-----Original Message-----
From: Suanming Mou <[email protected]>
Sent: Friday, May 26, 2023 6:18 AM

As indirect action conf fills the indirect action handler, while converting indirect action, the action conf(action handler) should be copied from original indirect action conf instead of duplicating the action handler memory.

Fixes 4b61b8774be9 ("ethdev: introduce indirect flow action")
---
 lib/ethdev/rte_flow.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
lib/ethdev/rte_flow.c +9 -2
index 69e6e749f7..ff740f19a4 100644
@@ -889,7 +889,15 @@ rte_flow_conv_actions(struct rte_flow_action *dst,
 	src -= num;
 	dst -= num;
 	do {
-		if (src->conf) {
+		if (src->type == RTE_FLOW_ACTION_TYPE_INDIRECT) {
+			/*
+			 * Indirect action conf fills the indirect action
+			 * handler. Copy the action handle directly instead
+			 * of duplicating the pointer memory.
+			 */
+			if (size)
+				dst->conf = src->conf;
+		} else if (src->conf) {
 			off = RTE_ALIGN_CEIL(off, sizeof(double));
 			ret = rte_flow_conv_action_conf
 				((void *)(data + off),
--
Quoted 1 line

2.25.1

Best,
Ori

Applied
#2 lore raw
Quoted 35 lines · Ori Kam

Hi Suanming,

Quoted 33 lines

-----Original Message-----
From: Suanming Mou <[email protected]>
Sent: Friday, May 26, 2023 6:18 AM

As indirect action conf fills the indirect action handler, while converting indirect action, the action conf(action handler) should be copied from original indirect action conf instead of duplicating the action handler memory.

Fixes 4b61b8774be9 ("ethdev: introduce indirect flow action")
---
 lib/ethdev/rte_flow.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
lib/ethdev/rte_flow.c +8 -1
index 69e6e749f7..ff740f19a4 100644
@@ -889,7 +889,15 @@ rte_flow_conv_actions(struct rte_flow_action *dst,
 	src -= num;
 	dst -= num;
 	do {
-		if (src->conf) {
+		if (src->type == RTE_FLOW_ACTION_TYPE_INDIRECT) {
+			/*
+			 * Indirect action conf fills the indirect action
+			 * handler. Copy the action handle directly instead
+			 * of duplicating the pointer memory.
+			 */
+			if (size)
+				dst->conf = src->conf;
Quoted 9 lines
Quoted 6 lines
lib/ethdev/rte_flow.c +1 -1
+		} else if (src->conf) {
 			off = RTE_ALIGN_CEIL(off, sizeof(double));
 			ret = rte_flow_conv_action_conf
 				((void *)(data + off),
--

2.25.1

Applied to dpdk-next-net/main, thanks.