From patchwork Wed Sep 9 06:48:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiawei Wang X-Patchwork-Id: 77001 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D4FA6A04B1; Wed, 9 Sep 2020 08:49:04 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 99EF31C0D9; Wed, 9 Sep 2020 08:48:42 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 85C691C0BD for ; Wed, 9 Sep 2020 08:48:36 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from jiaweiw@nvidia.com) with SMTP; 9 Sep 2020 09:48:34 +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 0896mYG3029471; Wed, 9 Sep 2020 09:48:34 +0300 From: Jiawei Wang To: orika@nvidia.com, viacheslavo@nvidia.com, matan@nvidia.com, thomas@monjalon.net, ferruh.yigit@intel.com, marko.kovacevic@intel.com, arybchenko@solarflare.com Cc: dev@dpdk.org, rasland@nvidia.com, ian.stokes@intel.com, fbl@redhat.com, asafp@nvidia.com Date: Wed, 9 Sep 2020 09:48:30 +0300 Message-Id: <1599634114-148013-9-git-send-email-jiaweiw@nvidia.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1599634114-148013-1-git-send-email-jiaweiw@nvidia.com> References: <1598540492-406340-1-git-send-email-jiaweiw@nvidia.com> <1599634114-148013-1-git-send-email-jiaweiw@nvidia.com> Subject: [dpdk-dev] [PATCH v6 08/12] 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" Using extend Destination list in the FTE to implement the mirroring feature. Add two new rdma-core command for create group action and multiple destination action. Group action which is a group of sub-action will be used together for input to multiple destination action. Multiple destination action can be used for mirroring packet to different vport or Queue. Signed-off-by: Jiawei Wang --- drivers/common/mlx5/linux/meson.build | 2 ++ drivers/common/mlx5/linux/mlx5_glue.c | 37 +++++++++++++++++++++++++++++++++++ drivers/common/mlx5/linux/mlx5_glue.h | 5 +++++ 3 files changed, 44 insertions(+) diff --git a/drivers/common/mlx5/linux/meson.build b/drivers/common/mlx5/linux/meson.build index 1aa137d..d53b891 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_MULTI_DEST', 'infiniband/mlx5dv.h', + 'mlx5dv_dr_action_create_multi_dest'], [ '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..e44d822 100644 --- a/drivers/common/mlx5/linux/mlx5_glue.c +++ b/drivers/common/mlx5/linux/mlx5_glue.c @@ -1076,6 +1076,39 @@ #endif } +static void * +mlx5_glue_dr_create_flow_action_group(size_t num_actions, void *actions[]) +{ +#ifdef HAVE_MLX5_DR_CREATE_ACTION_MULTI_DEST + return mlx5dv_dr_action_create_group(num_actions, + (struct mlx5dv_dr_action **)actions); +#else + (void)num_actions; + (void)actions; + errno = ENOTSUP; + return NULL; +#endif +} + +static void * +mlx5_glue_dr_create_flow_action_multi_dest(void *domain, + size_t num_actions, + void *actions[]) +{ +#ifdef HAVE_MLX5_DR_CREATE_ACTION_MULTI_DEST + return mlx5dv_dr_action_create_multi_dest + (domain, + num_actions, + (struct mlx5dv_dr_action **)actions); +#else + (void)domain; + (void)num_actions; + (void)actions; + errno = ENOTSUP; + return NULL; +#endif +} + static int mlx5_glue_devx_query_eqn(struct ibv_context *ctx, uint32_t cpus, uint32_t *eqn) @@ -1354,6 +1387,10 @@ .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_group = + mlx5_glue_dr_create_flow_action_group, + .dr_create_flow_action_multi_dest = + mlx5_glue_dr_create_flow_action_multi_dest, .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..d5232d1 100644 --- a/drivers/common/mlx5/linux/mlx5_glue.h +++ b/drivers/common/mlx5/linux/mlx5_glue.h @@ -322,6 +322,11 @@ 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_group)(size_t num_actions, + void *actions[]); + void *(*dr_create_flow_action_multi_dest)(void *domain, + size_t num_actions, + void *actions[]); }; extern const struct mlx5_glue *mlx5_glue;