ethdev: fix indirect action convert

Message ID 20230526031800.913744-1-suanmingm@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series ethdev: fix indirect action convert |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/intel-Functional success Functional PASS

Commit Message

Suanming Mou May 26, 2023, 3:18 a.m. UTC
  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")

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
---
 lib/ethdev/rte_flow.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
  

Comments

Ori Kam May 29, 2023, 6:12 a.m. UTC | #1
Hi Suanming,

> -----Original Message-----
> From: Suanming Mou <suanmingm@nvidia.com>
> 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")
> 
> Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
> ---
>  lib/ethdev/rte_flow.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
> index 69e6e749f7..ff740f19a4 100644
> --- a/lib/ethdev/rte_flow.c
> +++ b/lib/ethdev/rte_flow.c
> @@ -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),
> --
> 2.25.1

Acked-by: Ori Kam <orika@nvidia.com>
Best,
Ori
  
Ferruh Yigit May 31, 2023, 1:57 p.m. UTC | #2
On 5/29/2023 7:12 AM, Ori Kam wrote:
> Hi Suanming,
> 
>> -----Original Message-----
>> From: Suanming Mou <suanmingm@nvidia.com>
>> 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")
>>
>> Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
>> ---
>>  lib/ethdev/rte_flow.c | 10 +++++++++-
>>  1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
>> index 69e6e749f7..ff740f19a4 100644
>> --- a/lib/ethdev/rte_flow.c
>> +++ b/lib/ethdev/rte_flow.c
>> @@ -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),
>> --
>> 2.25.1
> 
> Acked-by: Ori Kam <orika@nvidia.com>
> 

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

Patch

diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
index 69e6e749f7..ff740f19a4 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -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),