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 3A48DA04E6; Wed, 18 Nov 2020 10:02:33 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E199EC8B4; Wed, 18 Nov 2020 10:02:15 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id F212C5937 for ; Wed, 18 Nov 2020 10:02:10 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from dekelp@nvidia.com) with SMTP; 18 Nov 2020 11:00:54 +0200 Received: from mtl-vdi-280.wap.labs.mlnx. (mtl-vdi-280.wap.labs.mlnx [10.228.134.250]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 0AI90mxf021118; Wed, 18 Nov 2020 11:00:54 +0200 From: Dekel Peled To: viacheslavo@nvidia.com, shahafs@nvidia.com, matan@nvidia.com Cc: dev@dpdk.org Date: Wed, 18 Nov 2020 10:59:57 +0200 Message-Id: X-Mailer: git-send-email 1.7.1 In-Reply-To: References: Subject: [dpdk-dev] [PATCH 3/3] common/mlx5: move to formal ASO action API 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" Existing code uses the previous API offered by rdma-core in order to create ASO Flow Hit action. A general API is now formally released, to create ASO action of any type. This patch moves the MLX5 PMD code to use the formal API. Signed-off-by: Dekel Peled Acked-by: Matan Azrad --- drivers/common/mlx5/linux/meson.build | 4 +-- drivers/common/mlx5/linux/mlx5_glue.c | 38 ++++++++++++++++----------- drivers/common/mlx5/linux/mlx5_glue.h | 6 ++--- drivers/net/mlx5/linux/mlx5_os.c | 4 +-- drivers/net/mlx5/mlx5_flow_dv.c | 11 +++++--- 5 files changed, 36 insertions(+), 27 deletions(-) diff --git a/drivers/common/mlx5/linux/meson.build b/drivers/common/mlx5/linux/meson.build index 87f7bfda51..63b78e4bce 100644 --- a/drivers/common/mlx5/linux/meson.build +++ b/drivers/common/mlx5/linux/meson.build @@ -181,8 +181,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'], + [ 'HAVE_MLX5_DR_CREATE_ACTION_ASO', 'infiniband/mlx5dv.h', + 'mlx5dv_dr_action_create_aso' ], ] 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 cc6670c5bd..8146c79287 100644 --- a/drivers/common/mlx5/linux/mlx5_glue.c +++ b/drivers/common/mlx5/linux/mlx5_glue.c @@ -811,6 +811,27 @@ mlx5_glue_dv_modify_flow_action_meter(void *action, #endif } +static void * +mlx5_glue_dv_create_flow_action_aso(struct mlx5dv_dr_domain *domain, + void *aso_obj, + uint32_t offset, + uint32_t flags, + uint8_t return_reg_c) +{ +#if defined(HAVE_MLX5DV_DR) && defined(HAVE_MLX5_DR_CREATE_ACTION_ASO) + return mlx5dv_dr_action_create_aso(domain, aso_obj, offset, + flags, return_reg_c); +#else + (void)domain; + (void)aso_obj; + (void)offset; + (void)flags; + (void)return_reg_c; + errno = ENOTSUP; + return NULL; +#endif +} + static void * mlx5_glue_dr_create_flow_action_default_miss(void) { @@ -1281,21 +1302,6 @@ mlx5_glue_dv_free_pp(struct mlx5dv_pp *pp) #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, @@ -1379,6 +1385,7 @@ 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, + .dv_create_flow_action_aso = mlx5_glue_dv_create_flow_action_aso, .dr_create_flow_action_default_miss = mlx5_glue_dr_create_flow_action_default_miss, .dv_destroy_flow = mlx5_glue_dv_destroy_flow, @@ -1415,5 +1422,4 @@ const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue) { .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 c5d7853ea9..8be446a902 100644 --- a/drivers/common/mlx5/linux/mlx5_glue.h +++ b/drivers/common/mlx5/linux/mlx5_glue.h @@ -344,9 +344,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); + void *(*dv_create_flow_action_aso) + (struct mlx5dv_dr_domain *domain, void *aso_obj, + uint32_t offset, uint32_t flags, uint8_t return_reg_c); }; extern const struct mlx5_glue *mlx5_glue; diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 468ef3356f..2dfed4b16f 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1200,7 +1200,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, } } #endif -#ifdef HAVE_MLX5DV_DR_ACTION_FLOW_HIT +#ifdef HAVE_MLX5_DR_CREATE_ACTION_ASO if (config->hca_attr.flow_hit_aso && priv->mtr_color_reg == REG_C_3) { sh->flow_hit_aso_en = 1; @@ -1211,7 +1211,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, } DRV_LOG(DEBUG, "Flow Hit ASO is supported."); } -#endif /* HAVE_MLX5DV_DR_ACTION_FLOW_HIT */ +#endif /* HAVE_MLX5_DR_CREATE_ACTION_ASO */ #if defined(HAVE_MLX5DV_DR) && defined(HAVE_MLX5_DR_CREATE_ACTION_FLOW_SAMPLE) if (config->hca_attr.log_max_ft_sampler_num > 0 && config->dv_flow_en) { diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index ae8967ec58..b3e71fc564 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -9491,10 +9491,13 @@ flow_dv_aso_age_alloc(struct rte_eth_dev *dev, struct rte_flow_error *error) "for ASO flow hit"); return 0; /* 0 is an error. */ } - age_free->dr_action = mlx5_glue->dr_action_create_flow_hit - (pool->flow_hit_aso_obj->obj, - age_free->offset, - (reg_c - REG_C_0)); +#ifdef HAVE_MLX5_DR_CREATE_ACTION_ASO + age_free->dr_action = mlx5_glue->dv_create_flow_action_aso + (priv->sh->rx_domain, + pool->flow_hit_aso_obj->obj, age_free->offset, + MLX5DV_DR_ACTION_FLAGS_ASO_FIRST_HIT_SET, + (reg_c - REG_C_0)); +#endif /* HAVE_MLX5_DR_CREATE_ACTION_ASO */ if (!age_free->dr_action) { rte_errno = errno; rte_spinlock_lock(&mng->free_sl); -- 2.25.1