net/mlx5: fix modification action flags

When creating the modify 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>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
This commit is contained in:
Ori Kam 2019-04-22 18:06:56 +00:00 committed by Ferruh Yigit
parent b1d4f2ab65
commit 79e7ba1f7d
2 changed files with 9 additions and 1 deletions

View File

@ -255,6 +255,7 @@ struct mlx5_flow_dv_modify_hdr_resource {
uint32_t actions_num; /**< Number of modification actions. */ uint32_t actions_num; /**< Number of modification actions. */
struct mlx5_modification_cmd actions[MLX5_MODIFY_NUM]; struct mlx5_modification_cmd actions[MLX5_MODIFY_NUM];
/**< Modification actions. */ /**< Modification actions. */
uint64_t flags; /**< Flags for RDMA API. */
}; };
/* Jump action resource structure. */ /* Jump action resource structure. */

View File

@ -43,6 +43,10 @@
#define MLX5DV_FLOW_TABLE_TYPE_FDB 0 #define MLX5DV_FLOW_TABLE_TYPE_FDB 0
#endif #endif
#ifndef HAVE_MLX5DV_DR
#define MLX5DV_DR_ACTION_FLAGS_ROOT_LEVEL 1
#endif
union flow_dv_attr { union flow_dv_attr {
struct { struct {
uint32_t valid:1; uint32_t valid:1;
@ -1830,10 +1834,13 @@ flow_dv_modify_hdr_resource_register
ns = sh->tx_ns; ns = sh->tx_ns;
else else
ns = sh->rx_ns; ns = sh->rx_ns;
resource->flags =
dev_flow->flow->group ? 0 : MLX5DV_DR_ACTION_FLAGS_ROOT_LEVEL;
/* Lookup a matching resource from cache. */ /* Lookup a matching resource from cache. */
LIST_FOREACH(cache_resource, &sh->modify_cmds, next) { LIST_FOREACH(cache_resource, &sh->modify_cmds, next) {
if (resource->ft_type == cache_resource->ft_type && if (resource->ft_type == cache_resource->ft_type &&
resource->actions_num == cache_resource->actions_num && resource->actions_num == cache_resource->actions_num &&
resource->flags == cache_resource->flags &&
!memcmp((const void *)resource->actions, !memcmp((const void *)resource->actions,
(const void *)cache_resource->actions, (const void *)cache_resource->actions,
(resource->actions_num * (resource->actions_num *
@ -1856,7 +1863,7 @@ flow_dv_modify_hdr_resource_register
cache_resource->verbs_action = cache_resource->verbs_action =
mlx5_glue->dv_create_flow_action_modify_header mlx5_glue->dv_create_flow_action_modify_header
(sh->ctx, cache_resource->ft_type, (sh->ctx, cache_resource->ft_type,
ns, 0, ns, cache_resource->flags,
cache_resource->actions_num * cache_resource->actions_num *
sizeof(cache_resource->actions[0]), sizeof(cache_resource->actions[0]),
(uint64_t *)cache_resource->actions); (uint64_t *)cache_resource->actions);