diff mbox series

[2/2] app/testpmd: fix tunnel offload private items location

Message ID 20210419130204.24348-2-getelson@nvidia.com (mailing list archive)
State Superseded
Delegated to: Ferruh Yigit
Headers show
Series [1/2] net/mlx5: fix tunnel offload private items location | expand

Checks

Context Check Description
ci/iol-abi-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/github-robot success github build: passed
ci/travis-robot success travis build: passed
ci/iol-testing success Testing PASS
ci/checkpatch success coding style OK

Commit Message

Gregory Etelson April 19, 2021, 1:02 p.m. UTC
Flow rules used in tunnel offload model require application to query
PMD for private flow elements and explicitly add these elements to
flow rule.
Tunnel offload model does not restrict private elements location in
a flow rule.
The patch places tunnel offload private PMD flow elements between
general RTE flow elements in a rule.

Fixes: 1b9f274623b8 ("app/testpmd: add commands for tunnel offload")

Cc: stable@dpdk.org

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
---
 app/test-pmd/config.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

Comments

Ferruh Yigit April 23, 2021, 8:50 a.m. UTC | #1
On 4/19/2021 2:02 PM, Gregory Etelson wrote:
> Flow rules used in tunnel offload model require application to query
> PMD for private flow elements and explicitly add these elements to
> flow rule.

Hi Gregory,

What is "private flow element"?

And can you please detail what is fixed with this patch, what was not working 
and now working?

> Tunnel offload model does not restrict private elements location in
> a flow rule.
> The patch places tunnel offload private PMD flow elements between
> general RTE flow elements in a rule.
> 
> Fixes: 1b9f274623b8 ("app/testpmd: add commands for tunnel offload")
> 
> Cc: stable@dpdk.org
> 
> Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
> ---
>   app/test-pmd/config.c | 14 ++++++++------
>   1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index ef0b9784d..da5e843fd 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -1663,7 +1663,7 @@ port_flow_tunnel_offload_cmd_prep(portid_t port_id,
>   		     aptr->type != RTE_FLOW_ACTION_TYPE_END;
>   		     aptr++, num_actions++);
>   		pft->actions = malloc(
> -				(num_actions +  pft->num_pmd_actions) *
> +				(num_actions +  pft->num_pmd_actions + 1) *
>   				sizeof(actions[0]));
>   		if (!pft->actions) {
>   			rte_flow_tunnel_action_decap_release(
> @@ -1671,9 +1671,10 @@ port_flow_tunnel_offload_cmd_prep(portid_t port_id,
>   					pft->num_pmd_actions, &error);
>   			return NULL;
>   		}
> -		rte_memcpy(pft->actions, pft->pmd_actions,
> +		pft->actions[0].type = RTE_FLOW_ACTION_TYPE_VOID;
> +		rte_memcpy(pft->actions + 1, pft->pmd_actions,
>   			   pft->num_pmd_actions * sizeof(actions[0]));
> -		rte_memcpy(pft->actions + pft->num_pmd_actions, actions,
> +		rte_memcpy(pft->actions + pft->num_pmd_actions + 1, actions,
>   			   num_actions * sizeof(actions[0]));
>   	}
>   	if (tunnel_ops->items) {
> @@ -1691,7 +1692,7 @@ port_flow_tunnel_offload_cmd_prep(portid_t port_id,
>   		for (iptr = pattern, num_items = 1;
>   		     iptr->type != RTE_FLOW_ITEM_TYPE_END;
>   		     iptr++, num_items++);
> -		pft->items = malloc((num_items + pft->num_pmd_items) *
> +		pft->items = malloc((num_items + pft->num_pmd_items + 1) *
>   				    sizeof(pattern[0]));
>   		if (!pft->items) {
>   			rte_flow_tunnel_item_release(
> @@ -1699,9 +1700,10 @@ port_flow_tunnel_offload_cmd_prep(portid_t port_id,
>   					pft->num_pmd_items, &error);
>   			return NULL;
>   		}
> -		rte_memcpy(pft->items, pft->pmd_items,
> +		pft->items[0].type = RTE_FLOW_ITEM_TYPE_VOID;
> +		rte_memcpy(pft->items + 1, pft->pmd_items,
>   			   pft->num_pmd_items * sizeof(pattern[0]));
> -		rte_memcpy(pft->items + pft->num_pmd_items, pattern,
> +		rte_memcpy(pft->items + pft->num_pmd_items + 1, pattern,
>   			   num_items * sizeof(pattern[0]));
>   	}
>   
>
diff mbox series

Patch

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index ef0b9784d..da5e843fd 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1663,7 +1663,7 @@  port_flow_tunnel_offload_cmd_prep(portid_t port_id,
 		     aptr->type != RTE_FLOW_ACTION_TYPE_END;
 		     aptr++, num_actions++);
 		pft->actions = malloc(
-				(num_actions +  pft->num_pmd_actions) *
+				(num_actions +  pft->num_pmd_actions + 1) *
 				sizeof(actions[0]));
 		if (!pft->actions) {
 			rte_flow_tunnel_action_decap_release(
@@ -1671,9 +1671,10 @@  port_flow_tunnel_offload_cmd_prep(portid_t port_id,
 					pft->num_pmd_actions, &error);
 			return NULL;
 		}
-		rte_memcpy(pft->actions, pft->pmd_actions,
+		pft->actions[0].type = RTE_FLOW_ACTION_TYPE_VOID;
+		rte_memcpy(pft->actions + 1, pft->pmd_actions,
 			   pft->num_pmd_actions * sizeof(actions[0]));
-		rte_memcpy(pft->actions + pft->num_pmd_actions, actions,
+		rte_memcpy(pft->actions + pft->num_pmd_actions + 1, actions,
 			   num_actions * sizeof(actions[0]));
 	}
 	if (tunnel_ops->items) {
@@ -1691,7 +1692,7 @@  port_flow_tunnel_offload_cmd_prep(portid_t port_id,
 		for (iptr = pattern, num_items = 1;
 		     iptr->type != RTE_FLOW_ITEM_TYPE_END;
 		     iptr++, num_items++);
-		pft->items = malloc((num_items + pft->num_pmd_items) *
+		pft->items = malloc((num_items + pft->num_pmd_items + 1) *
 				    sizeof(pattern[0]));
 		if (!pft->items) {
 			rte_flow_tunnel_item_release(
@@ -1699,9 +1700,10 @@  port_flow_tunnel_offload_cmd_prep(portid_t port_id,
 					pft->num_pmd_items, &error);
 			return NULL;
 		}
-		rte_memcpy(pft->items, pft->pmd_items,
+		pft->items[0].type = RTE_FLOW_ITEM_TYPE_VOID;
+		rte_memcpy(pft->items + 1, pft->pmd_items,
 			   pft->num_pmd_items * sizeof(pattern[0]));
-		rte_memcpy(pft->items + pft->num_pmd_items, pattern,
+		rte_memcpy(pft->items + pft->num_pmd_items + 1, pattern,
 			   num_items * sizeof(pattern[0]));
 	}