From patchwork Thu Dec 17 17:30:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tal Shnaiderman X-Patchwork-Id: 85355 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 9970BA09F6; Thu, 17 Dec 2020 18:39:34 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5E307CB19; Thu, 17 Dec 2020 18:33:39 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id A3500CA35 for ; Thu, 17 Dec 2020 18:33:10 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from talshn@nvidia.com) with SMTP; 17 Dec 2020 19:33:06 +0200 Received: from nvidia.com (l-wincomp04-vm.mtl.labs.mlnx [10.237.1.5]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 0BHHX45g021771; Thu, 17 Dec 2020 19:33:06 +0200 From: Tal Shnaiderman To: dev@dpdk.org Cc: thomas@monjalon.net, matan@nvidia.com, rasland@nvidia.com, ophirmu@nvidia.com Date: Thu, 17 Dec 2020 19:30:23 +0200 Message-Id: <20201217173037.11396-22-talshn@nvidia.com> X-Mailer: git-send-email 2.16.1.windows.4 In-Reply-To: <20201217173037.11396-1-talshn@nvidia.com> References: <20201217173037.11396-1-talshn@nvidia.com> Subject: [dpdk-dev] [PATCH 21/35] net/mlx5/linux: wrap adjust flow priority with OS calls 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: Ophir Munk mlx5_flow_adjust_priority() is used to adjust priorities according to priorities levels. It is Verbs based and it is called from shared code (mlx5_flow_dv.c). Therefore, wrap it in an OS API. Signed-off-by: Ophir Munk Acked-by: Matan Azrad --- drivers/net/mlx5/linux/mlx5_flow_os.h | 20 ++++++++++++++++++++ drivers/net/mlx5/mlx5_flow_dv.c | 5 +++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/linux/mlx5_flow_os.h b/drivers/net/mlx5/linux/mlx5_flow_os.h index a6bd2c01e1..c7003a194e 100644 --- a/drivers/net/mlx5/linux/mlx5_flow_os.h +++ b/drivers/net/mlx5/linux/mlx5_flow_os.h @@ -365,4 +365,24 @@ mlx5_flow_os_destroy_flow_action(void *action) return mlx5_glue->destroy_flow_action(action); } +/** + * OS wrapper over Verbs API. + * Adjust flow priority based on the highest layer and the request priority. + * + * @param[in] dev + * Pointer to the Ethernet device structure. + * @param[in] priority + * The rule base priority. + * @param[in] subpriority + * The priority based on the items. + * + * @return + * The new priority. + */ +static inline uint32_t +mlx5_os_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority, + uint32_t subpriority) +{ + return mlx5_flow_adjust_priority(dev, priority, subpriority); +} #endif /* RTE_PMD_MLX5_FLOW_OS_H_ */ diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 911042b677..40c8e54a09 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -10600,8 +10600,9 @@ flow_dv_translate(struct rte_eth_dev *dev, /* Register matcher. */ matcher.crc = rte_raw_cksum((const void *)matcher.mask.buf, matcher.mask.size); - matcher.priority = mlx5_flow_adjust_priority(dev, priority, - matcher.priority); + matcher.priority = mlx5_os_flow_adjust_priority(dev, + priority, + matcher.priority); /* reserved field no needs to be set to 0 here. */ tbl_key.domain = attr->transfer; tbl_key.direction = attr->egress;