From d4d85aa6f13aed654b2cd8344fe30ec7b7aba7c7 Mon Sep 17 00:00:00 2001 From: Shiri Kuzin Date: Tue, 23 Jun 2020 11:41:05 +0300 Subject: [PATCH] common/mlx5: add default miss action Add dv_create_action_default_miss wrapper function for the action added to the rdma-core MLX5DV_FLOW_ACTION_DEFAULT_MISS. When a packet matches MLX5DV_FLOW_ACTION_DEFAULT_MISS action it is steered to the default miss of the verbs steering domain. Signed-off-by: Shiri Kuzin Acked-by: Matan Azrad --- drivers/common/mlx5/Makefile | 5 +++++ drivers/common/mlx5/linux/meson.build | 2 ++ drivers/common/mlx5/linux/mlx5_glue.c | 13 +++++++++++++ drivers/common/mlx5/linux/mlx5_glue.h | 1 + 4 files changed, 21 insertions(+) diff --git a/drivers/common/mlx5/Makefile b/drivers/common/mlx5/Makefile index 622bde4ff4..f6c762bf0c 100644 --- a/drivers/common/mlx5/Makefile +++ b/drivers/common/mlx5/Makefile @@ -156,6 +156,11 @@ mlx5_autoconf.h.new: $(RTE_SDK)/buildtools/auto-config-h.sh infiniband/mlx5dv.h \ enum MLX5DV_FLOW_ACTION_COUNTERS_DEVX \ $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ + HAVE_MLX5_DR_CREATE_ACTION_DEFAULT_MISS \ + infiniband/mlx5dv.h \ + enum MLX5DV_FLOW_ACTION_DEFAULT_MISS \ + $(AUTOCONF_OUTPUT) $Q sh -- '$<' '$@' \ HAVE_IBV_DEVX_ASYNC \ infiniband/mlx5dv.h \ diff --git a/drivers/common/mlx5/linux/meson.build b/drivers/common/mlx5/linux/meson.build index 638bb2b855..2294213f1d 100644 --- a/drivers/common/mlx5/linux/meson.build +++ b/drivers/common/mlx5/linux/meson.build @@ -95,6 +95,8 @@ has_sym_args = [ 'mlx5dv_devx_obj_create' ], [ 'HAVE_IBV_FLOW_DEVX_COUNTERS', 'infiniband/mlx5dv.h', 'MLX5DV_FLOW_ACTION_COUNTERS_DEVX' ], + [ 'HAVE_MLX5_DR_CREATE_ACTION_DEFAULT_MISS', 'infiniband/mlx5dv.h', + 'MLX5DV_FLOW_ACTION_DEFAULT_MISS' ], [ 'HAVE_IBV_DEVX_ASYNC', 'infiniband/mlx5dv.h', 'mlx5dv_devx_obj_query_async' ], [ 'HAVE_IBV_DEVX_QP', 'infiniband/mlx5dv.h', diff --git a/drivers/common/mlx5/linux/mlx5_glue.c b/drivers/common/mlx5/linux/mlx5_glue.c index c91ee33bba..62c4cc74b0 100644 --- a/drivers/common/mlx5/linux/mlx5_glue.c +++ b/drivers/common/mlx5/linux/mlx5_glue.c @@ -795,6 +795,17 @@ mlx5_glue_dv_modify_flow_action_meter(void *action, #endif } +static void * +mlx5_glue_dr_create_flow_action_default_miss(void) +{ +#if defined(HAVE_MLX5DV_DR) && defined(HAVE_MLX5_DR_CREATE_ACTION_DEFAULT_MISS) + return mlx5dv_dr_action_create_default_miss(); +#else + errno = ENOTSUP; + return NULL; +#endif +} + static int mlx5_glue_dv_destroy_flow(void *flow_id) { @@ -1276,6 +1287,8 @@ const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue) { .dv_create_flow_action_tag = mlx5_glue_dv_create_flow_action_tag, .dv_create_flow_action_meter = mlx5_glue_dv_create_flow_action_meter, .dv_modify_flow_action_meter = mlx5_glue_dv_modify_flow_action_meter, + .dr_create_flow_action_default_miss = + mlx5_glue_dr_create_flow_action_default_miss, .dv_destroy_flow = mlx5_glue_dv_destroy_flow, .dv_destroy_flow_matcher = mlx5_glue_dv_destroy_flow_matcher, .dv_open_device = mlx5_glue_dv_open_device, diff --git a/drivers/common/mlx5/linux/mlx5_glue.h b/drivers/common/mlx5/linux/mlx5_glue.h index 5d238a40ad..069d8540cc 100644 --- a/drivers/common/mlx5/linux/mlx5_glue.h +++ b/drivers/common/mlx5/linux/mlx5_glue.h @@ -237,6 +237,7 @@ struct mlx5_glue { (struct mlx5dv_dr_flow_meter_attr *attr); int (*dv_modify_flow_action_meter)(void *action, struct mlx5dv_dr_flow_meter_attr *attr, uint64_t modify_bits); + void *(*dr_create_flow_action_default_miss)(void); int (*dv_destroy_flow)(void *flow); int (*dv_destroy_flow_matcher)(void *matcher); struct ibv_context *(*dv_open_device)(struct ibv_device *device); -- 2.20.1