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 15352A04B5; Wed, 28 Oct 2020 00:40:33 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9FF8AC840; Wed, 28 Oct 2020 00:25:29 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id C01922C55 for ; Wed, 28 Oct 2020 00:24:02 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from ophirmu@nvidia.com) with SMTP; 28 Oct 2020 01:23:58 +0200 Received: from nvidia.com (pegasus05.mtr.labs.mlnx [10.210.16.100]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 09RNNrsD026642; Wed, 28 Oct 2020 01:23:58 +0200 From: Ophir Munk To: dev@dpdk.org, Raslan Darawsheh Cc: Ophir Munk , Matan Azrad , Tal Shnaiderman , Thomas Monjalon Date: Tue, 27 Oct 2020 23:23:24 +0000 Message-Id: <20201027232335.31427-62-ophirmu@nvidia.com> X-Mailer: git-send-email 2.8.4 In-Reply-To: <20201027232335.31427-1-ophirmu@nvidia.com> References: <20201027232335.31427-1-ophirmu@nvidia.com> Subject: [dpdk-dev] [PATCH v1 61/72] net/mlx5/linux: add OS default miss flow 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" Wrap glue call dr_create_flow_action_default_miss() with an OS API. This commit is a follow up on (1). (1) commit d4d85aa6f13a ("common/mlx5: add default miss action") commit b293fbf9672b ("net/mlx5: add OS specific flow actions operations") Signed-off-by: Ophir Munk --- drivers/net/mlx5/linux/mlx5_flow_os.h | 16 ++++++++++++++++ drivers/net/mlx5/mlx5_flow_dv.c | 9 +++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/drivers/net/mlx5/linux/mlx5_flow_os.h b/drivers/net/mlx5/linux/mlx5_flow_os.h index c7003a1..7706b3b 100644 --- a/drivers/net/mlx5/linux/mlx5_flow_os.h +++ b/drivers/net/mlx5/linux/mlx5_flow_os.h @@ -351,6 +351,22 @@ mlx5_flow_os_create_flow_action_drop(void **action) } /** + * Create flow action: default miss. + * + * @param[out] action + * Pointer to a valid action on success, NULL otherwise. + * + * @return + * 0 on success, or -1 on failure and errno is set. + */ +static inline int +mlx5_flow_os_create_flow_action_default_miss(void **action) +{ + *action = mlx5_glue->dr_create_flow_action_default_miss(); + return (*action) ? 0 : -1; +} + +/** * Destroy flow action. * * @param[in] action diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 18ab409..5c772e7 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -2987,12 +2987,13 @@ flow_dv_default_miss_resource_register(struct rte_eth_dev *dev, struct mlx5_flow_default_miss_resource *cache_resource = &sh->default_miss; int cnt = rte_atomic32_read(&cache_resource->refcnt); + int ret; if (!cnt) { MLX5_ASSERT(cache_resource->action); - cache_resource->action = - mlx5_glue->dr_create_flow_action_default_miss(); - if (!cache_resource->action) + ret = mlx5_flow_os_create_flow_action_default_miss + (&cache_resource->action); + if (ret) return rte_flow_error_set(error, ENOMEM, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, "cannot create default miss action"); @@ -10602,7 +10603,7 @@ flow_dv_default_miss_resource_release(struct rte_eth_dev *dev) (void *)cache_resource->action, rte_atomic32_read(&cache_resource->refcnt)); if (rte_atomic32_dec_and_test(&cache_resource->refcnt)) { - claim_zero(mlx5_glue->destroy_flow_action + claim_zero(mlx5_flow_os_destroy_flow_action (cache_resource->action)); DRV_LOG(DEBUG, "default miss resource %p: removed", (void *)cache_resource->action); -- 2.8.4