From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 164BEA0522; Thu, 2 Jul 2020 19:44:01 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1733A1D979; Thu, 2 Jul 2020 19:43:56 +0200 (CEST) Received: from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130]) by dpdk.org (Postfix) with ESMTP id DBB291D944 for ; Thu, 2 Jul 2020 19:43:52 +0200 (CEST) From: Jiawei Wang To: orika@mellanox.com, viacheslavo@mellanox.com, matan@mellanox.com Cc: dev@dpdk.org, thomas@monjalon.net, rasland@mellanox.com, ian.stokes@intel.com, fbl@redhat.com, jiaweiw@mellanox.com Date: Thu, 2 Jul 2020 20:43:45 +0300 Message-Id: <1593711830-80737-3-git-send-email-jiaweiw@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1593711830-80737-1-git-send-email-jiaweiw@mellanox.com> References: <1593102379-400132-1-git-send-email-jiaweiw@mellanox.com> <1593711830-80737-1-git-send-email-jiaweiw@mellanox.com> Subject: [dpdk-dev] [PATCH 2/7] common/mlx5: glue for sample action X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" rdma-core introduce a new DR sample action. Add the rdma-core commands in glue to create this action. Sample action is used for creating the sample object to implement the sampling/mirroring function. Signed-off-by: Jiawei Wang Acked-by: Ori Kam --- drivers/common/mlx5/Makefile | 5 +++++ drivers/common/mlx5/linux/meson.build | 2 ++ drivers/common/mlx5/linux/mlx5_glue.c | 15 +++++++++++++++ drivers/common/mlx5/linux/mlx5_glue.h | 12 ++++++++++++ 4 files changed, 34 insertions(+) diff --git a/drivers/common/mlx5/Makefile b/drivers/common/mlx5/Makefile index f6c762b..4c1484c 100644 --- a/drivers/common/mlx5/Makefile +++ b/drivers/common/mlx5/Makefile @@ -192,6 +192,11 @@ mlx5_autoconf.h.new: $(RTE_SDK)/buildtools/auto-config-h.sh func mlx5dv_dump_dr_domain \ $(AUTOCONF_OUTPUT) $Q sh -- '$<' '$@' \ + HAVE_MLX5_DR_CREATE_ACTION_FLOW_SAMPLE \ + infiniband/mlx5dv.h \ + func mlx5dv_dr_action_create_flow_sampler \ + $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ HAVE_MLX5DV_MMAP_GET_NC_PAGES_CMD \ infiniband/mlx5dv.h \ enum MLX5_MMAP_GET_NC_PAGES_CMD \ diff --git a/drivers/common/mlx5/linux/meson.build b/drivers/common/mlx5/linux/meson.build index 2294213..0f08318 100644 --- a/drivers/common/mlx5/linux/meson.build +++ b/drivers/common/mlx5/linux/meson.build @@ -162,6 +162,8 @@ has_sym_args = [ 'RDMA_NLDEV_ATTR_NDEV_INDEX' ], [ 'HAVE_MLX5_DR_FLOW_DUMP', 'infiniband/mlx5dv.h', 'mlx5dv_dump_dr_domain'], + [ 'HAVE_MLX5_DR_CREATE_ACTION_FLOW_SAMPLE', 'infiniband/mlx5dv.h', + 'mlx5dv_dr_action_create_flow_sampler'], [ 'HAVE_MLX5DV_DR_MEM_RECLAIM', 'infiniband/mlx5dv.h', 'mlx5dv_dr_domain_set_reclaim_device_memory'], [ 'HAVE_DEVLINK', 'linux/devlink.h', 'DEVLINK_GENL_NAME' ], diff --git a/drivers/common/mlx5/linux/mlx5_glue.c b/drivers/common/mlx5/linux/mlx5_glue.c index 048207e..98b3e71 100644 --- a/drivers/common/mlx5/linux/mlx5_glue.c +++ b/drivers/common/mlx5/linux/mlx5_glue.c @@ -1059,6 +1059,19 @@ #endif } +static void * +mlx5_glue_dr_create_flow_action_sampler( + struct mlx5dv_dr_flow_sampler_attr *attr) +{ +#ifdef HAVE_MLX5_DR_CREATE_ACTION_FLOW_SAMPLE + return mlx5dv_dr_action_create_flow_sampler(attr); +#else + (void)attr; + errno = ENOTSUP; + return NULL; +#endif +} + static int mlx5_glue_devx_query_eqn(struct ibv_context *ctx, uint32_t cpus, uint32_t *eqn) @@ -1308,6 +1321,8 @@ .devx_port_query = mlx5_glue_devx_port_query, .dr_dump_domain = mlx5_glue_dr_dump_domain, .dr_reclaim_domain_memory = mlx5_glue_dr_reclaim_domain_memory, + .dr_create_flow_action_sampler = + mlx5_glue_dr_create_flow_action_sampler, .devx_query_eqn = mlx5_glue_devx_query_eqn, .devx_create_event_channel = mlx5_glue_devx_create_event_channel, .devx_destroy_event_channel = mlx5_glue_devx_destroy_event_channel, diff --git a/drivers/common/mlx5/linux/mlx5_glue.h b/drivers/common/mlx5/linux/mlx5_glue.h index 069d854..11b95c5 100644 --- a/drivers/common/mlx5/linux/mlx5_glue.h +++ b/drivers/common/mlx5/linux/mlx5_glue.h @@ -77,6 +77,7 @@ #ifndef HAVE_MLX5DV_DR enum mlx5dv_dr_domain_type { unused, }; struct mlx5dv_dr_domain; +struct mlx5dv_dr_action; #endif #ifndef HAVE_MLX5DV_DR_DEVX_PORT @@ -87,6 +88,15 @@ struct mlx5dv_dr_flow_meter_attr; #endif +#ifndef HAVE_MLX5_DR_CREATE_ACTION_FLOW_SAMPLE +struct mlx5dv_dr_flow_sampler_attr { + uint32_t sample_ratio; + void *default_next_table; + size_t num_sample_actions; + struct mlx5dv_dr_action **sample_actions; +}; +#endif + #ifndef HAVE_IBV_DEVX_EVENT struct mlx5dv_devx_event_channel { int fd; }; struct mlx5dv_devx_async_event_hdr; @@ -304,6 +314,8 @@ struct mlx5_glue { struct mlx5dv_devx_async_event_hdr *event_data, size_t event_resp_len); void (*dr_reclaim_domain_memory)(void *domain, uint32_t enable); + void *(*dr_create_flow_action_sampler) + (struct mlx5dv_dr_flow_sampler_attr *attr); }; extern const struct mlx5_glue *mlx5_glue; -- 1.8.3.1