net/mlx5: fix encapsulation action flags

Message ID 1555935668-81847-1-git-send-email-orika@mellanox.com (mailing list archive)
State Superseded, archived
Delegated to: Shahaf Shuler
Headers
Series net/mlx5: fix encapsulation action flags |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Ori Kam April 22, 2019, 12:21 p.m. UTC
  When creating the encapsulation action using Direct Rules, we need to
add flags to mark, if the action will be done on root table or on
private table.

Fixes: 4f84a19779ca ("net/mlx5: add Direct Rules API")

Signed-off-by: Ori Kam <orika@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow.h    | 1 +
 drivers/net/mlx5/mlx5_flow_dv.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)
  

Patch

diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index c419e6b..b665420 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -255,6 +255,7 @@  struct mlx5_flow_dv_modify_hdr_resource {
 	uint32_t actions_num; /**< Number of modification actions. */
 	struct mlx5_modification_cmd actions[MLX5_MODIFY_NUM];
 	/**< Modification actions. */
+	uint64_t flags; /**< Flags for RDMA API. */
 };
 
 /* Jump action resource structure. */
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 2f777ec..ffc6ab7 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1830,10 +1830,12 @@  struct field_modify_info modify_tcp[] = {
 		ns = sh->tx_ns;
 	else
 		ns = sh->rx_ns;
+	resource->flags = dev_flow->flow->group ? 0 : 1;
 	/* Lookup a matching resource from cache. */
 	LIST_FOREACH(cache_resource, &sh->modify_cmds, next) {
 		if (resource->ft_type == cache_resource->ft_type &&
 		    resource->actions_num == cache_resource->actions_num &&
+		    resource->flags == cache_resource->flags &&
 		    !memcmp((const void *)resource->actions,
 			    (const void *)cache_resource->actions,
 			    (resource->actions_num *
@@ -1856,7 +1858,7 @@  struct field_modify_info modify_tcp[] = {
 	cache_resource->verbs_action =
 		mlx5_glue->dv_create_flow_action_modify_header
 					(sh->ctx, cache_resource->ft_type,
-					 ns, 0,
+					 ns, cache_resource->flags,
 					 cache_resource->actions_num *
 					 sizeof(cache_resource->actions[0]),
 					 (uint64_t *)cache_resource->actions);