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 A4059A04B6; Tue, 13 Oct 2020 10:19:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B17101DA6C; Tue, 13 Oct 2020 10:17:47 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 6C4991DA4A for ; Tue, 13 Oct 2020 10:17:36 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from jiaweiw@nvidia.com) with SMTP; 13 Oct 2020 11:17:30 +0300 Received: from nvidia.com (gen-l-vrt-280.mtl.labs.mlnx [10.237.45.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 09D8HU0a022749; Tue, 13 Oct 2020 11:17:30 +0300 From: Jiawei Wang To: orika@nvidia.com, viacheslavo@nvidia.com, matan@nvidia.com, thomas@monjalon.net Cc: dev@dpdk.org, rasland@nvidia.com, asafp@nvidia.com Date: Tue, 13 Oct 2020 11:17:26 +0300 Message-Id: <1602577050-178398-7-git-send-email-jiaweiw@nvidia.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1602577050-178398-1-git-send-email-jiaweiw@nvidia.com> References: <1602251436-269694-1-git-send-email-jiaweiw@nvidia.com> <1602577050-178398-1-git-send-email-jiaweiw@nvidia.com> Subject: [dpdk-dev] [PATCH v2 06/10] common/mlx5: add glue function for mirroring 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" The new DR destination array action is supported since the rdma-core version v32. Destination array action is used group DR actions to a single action, And it can be used for mirroring packet and forward to every destination (port or queue) in the array. Signed-off-by: Jiawei Wang Acked-by: Viacheslav Ovsiienko --- drivers/common/mlx5/linux/meson.build | 2 ++ drivers/common/mlx5/linux/mlx5_glue.c | 26 ++++++++++++++++++++++++-- drivers/common/mlx5/linux/mlx5_glue.h | 22 ++++++++++++++++++++++ 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/drivers/common/mlx5/linux/meson.build b/drivers/common/mlx5/linux/meson.build index 1aa137d..9ef8e18 100644 --- a/drivers/common/mlx5/linux/meson.build +++ b/drivers/common/mlx5/linux/meson.build @@ -176,6 +176,8 @@ has_sym_args = [ 'mlx5dv_dr_action_create_flow_sampler'], [ 'HAVE_MLX5DV_DR_MEM_RECLAIM', 'infiniband/mlx5dv.h', 'mlx5dv_dr_domain_set_reclaim_device_memory'], + [ 'HAVE_MLX5_DR_CREATE_ACTION_DEST_ARRAY', 'infiniband/mlx5dv.h', + 'mlx5dv_dr_action_create_dest_array'], [ 'HAVE_DEVLINK', 'linux/devlink.h', 'DEVLINK_GENL_NAME' ], ] config = configuration_data() diff --git a/drivers/common/mlx5/linux/mlx5_glue.c b/drivers/common/mlx5/linux/mlx5_glue.c index 771a47c..47b7e98 100644 --- a/drivers/common/mlx5/linux/mlx5_glue.c +++ b/drivers/common/mlx5/linux/mlx5_glue.c @@ -1064,8 +1064,8 @@ } static void * -mlx5_glue_dr_create_flow_action_sampler( - struct mlx5dv_dr_flow_sampler_attr *attr) +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); @@ -1076,6 +1076,26 @@ #endif } +static void * +mlx5_glue_dr_action_create_dest_array + (void *domain, + size_t num_dest, + struct mlx5dv_dr_action_dest_attr *dests[]) +{ +#ifdef HAVE_MLX5_DR_CREATE_ACTION_DEST_ARRAY + return mlx5dv_dr_action_create_dest_array + (domain, + num_dest, + dests); +#else + (void)domain; + (void)num_dest; + (void)dests; + errno = ENOTSUP; + return NULL; +#endif +} + static int mlx5_glue_devx_query_eqn(struct ibv_context *ctx, uint32_t cpus, uint32_t *eqn) @@ -1354,6 +1374,8 @@ .dr_reclaim_domain_memory = mlx5_glue_dr_reclaim_domain_memory, .dr_create_flow_action_sampler = mlx5_glue_dr_create_flow_action_sampler, + .dr_create_flow_action_dest_array = + mlx5_glue_dr_action_create_dest_array, .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 a77d239..42b2f61 100644 --- a/drivers/common/mlx5/linux/mlx5_glue.h +++ b/drivers/common/mlx5/linux/mlx5_glue.h @@ -98,6 +98,24 @@ struct mlx5dv_dr_flow_sampler_attr { }; #endif +#ifndef HAVE_MLX5_DR_CREATE_ACTION_DEST_ARRAY +enum mlx5dv_dr_action_dest_type { + MLX5DV_DR_ACTION_DEST, + MLX5DV_DR_ACTION_DEST_REFORMAT, +}; +struct mlx5dv_dr_action_dest_reformat { + struct mlx5dv_dr_action *reformat; + struct mlx5dv_dr_action *dest; +}; +struct mlx5dv_dr_action_dest_attr { + enum mlx5dv_dr_action_dest_type type; + union { + struct mlx5dv_dr_action *dest; + struct mlx5dv_dr_action_dest_reformat *dest_reformat; + }; +}; +#endif + #ifndef HAVE_IBV_DEVX_EVENT struct mlx5dv_devx_event_channel { int fd; }; struct mlx5dv_devx_async_event_hdr; @@ -322,6 +340,10 @@ struct mlx5_glue { void (*dv_free_pp)(struct mlx5dv_pp *pp); void *(*dr_create_flow_action_sampler) (struct mlx5dv_dr_flow_sampler_attr *attr); + void *(*dr_create_flow_action_dest_array) + (void *domain, + size_t num_dest, + struct mlx5dv_dr_action_dest_attr *dests[]); }; extern const struct mlx5_glue *mlx5_glue; -- 1.8.3.1