From patchwork Thu Oct 29 21:57:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matan Azrad X-Patchwork-Id: 82842 X-Patchwork-Delegate: rasland@nvidia.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 62B93A04B5; Thu, 29 Oct 2020 22:59:00 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 46885CAD4; Thu, 29 Oct 2020 22:58:16 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 79582CAAF for ; Thu, 29 Oct 2020 22:58:11 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from matan@nvidia.com) with SMTP; 29 Oct 2020 23:58:04 +0200 Received: from nvidia.com (pegasus25.mtr.labs.mlnx [10.210.16.10]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 09TLw4Tr022832; Thu, 29 Oct 2020 23:58:04 +0200 From: Matan Azrad To: Viacheslav Ovsiienko Cc: dev@dpdk.org, Dekel Peled Date: Thu, 29 Oct 2020 21:57:57 +0000 Message-Id: <1604008681-414157-5-git-send-email-matan@nvidia.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1604008681-414157-1-git-send-email-matan@nvidia.com> References: <1604008681-414157-1-git-send-email-matan@nvidia.com> Subject: [dpdk-dev] [PATCH 4/8] common/mlx5: add glue func create flow hit 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" From: Dekel Peled Add glue function to create the flow hit action using DV API, if rdma-core support exists. Signed-off-by: Dekel Peled --- drivers/common/mlx5/linux/meson.build | 2 ++ drivers/common/mlx5/linux/mlx5_glue.c | 16 ++++++++++++++++ drivers/common/mlx5/linux/mlx5_glue.h | 3 +++ 3 files changed, 21 insertions(+) diff --git a/drivers/common/mlx5/linux/meson.build b/drivers/common/mlx5/linux/meson.build index 9ef8e18..7c552a3 100644 --- a/drivers/common/mlx5/linux/meson.build +++ b/drivers/common/mlx5/linux/meson.build @@ -179,6 +179,8 @@ has_sym_args = [ [ 'HAVE_MLX5_DR_CREATE_ACTION_DEST_ARRAY', 'infiniband/mlx5dv.h', 'mlx5dv_dr_action_create_dest_array'], [ 'HAVE_DEVLINK', 'linux/devlink.h', 'DEVLINK_GENL_NAME' ], + [ 'HAVE_MLX5DV_DR_ACTION_FLOW_HIT', 'infiniband/mlx5dv.h', + 'mlx5dv_dr_action_create_flow_hit'], ] config = configuration_data() foreach arg:has_sym_args diff --git a/drivers/common/mlx5/linux/mlx5_glue.c b/drivers/common/mlx5/linux/mlx5_glue.c index 4a76902..02007f6 100644 --- a/drivers/common/mlx5/linux/mlx5_glue.c +++ b/drivers/common/mlx5/linux/mlx5_glue.c @@ -1283,6 +1283,21 @@ #endif } +static void * +mlx5_glue_dr_action_create_flow_hit(struct mlx5dv_devx_obj *devx_obj, + uint32_t offset, uint8_t reg_c_index) +{ +#ifdef HAVE_MLX5DV_DR_ACTION_FLOW_HIT + return mlx5dv_dr_action_create_flow_hit(devx_obj, offset, reg_c_index); +#else + (void)(devx_obj); + (void)(offset); + (void)(reg_c_index); + errno = ENOTSUP; + return NULL; +#endif +} + __rte_cache_aligned const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue) { .version = MLX5_GLUE_VERSION, @@ -1402,4 +1417,5 @@ .dv_free_var = mlx5_glue_dv_free_var, .dv_alloc_pp = mlx5_glue_dv_alloc_pp, .dv_free_pp = mlx5_glue_dv_free_pp, + .dr_action_create_flow_hit = mlx5_glue_dr_action_create_flow_hit, }; diff --git a/drivers/common/mlx5/linux/mlx5_glue.h b/drivers/common/mlx5/linux/mlx5_glue.h index a5e7fb3..1a50e01 100644 --- a/drivers/common/mlx5/linux/mlx5_glue.h +++ b/drivers/common/mlx5/linux/mlx5_glue.h @@ -345,6 +345,9 @@ struct mlx5_glue { (void *domain, size_t num_dest, struct mlx5dv_dr_action_dest_attr *dests[]); + void *(*dr_action_create_flow_hit)(struct mlx5dv_devx_obj *devx_obj, + uint32_t offset, + uint8_t reg_c_index); }; extern const struct mlx5_glue *mlx5_glue;