From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 74A93A04A6; Thu, 27 Jan 2022 16:42:23 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 45C4842918; Thu, 27 Jan 2022 16:40:34 +0100 (CET) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam08on2086.outbound.protection.outlook.com [40.107.100.86]) by mails.dpdk.org (Postfix) with ESMTP id 10D5342854 for ; Thu, 27 Jan 2022 16:40:32 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bKz4o+pvQeR7hv7mqZV5yHrzGVtFM8d1mcfHHiru0MM30nTRzJTWNQ0rk1HscdPg3AkJuSdv+z71gAZdhCNdPczTZSCLfeXABkCVWBEy0nhae985r9/aBfP+ppoq0CYTuuxpqcBRawdjgMcfnIcZxv2rpVK0zhDHXLGU9IQ9rhzz2IyQKP5MliFyB0V9vVaShTjVNy6tad9cuHidRBdS1y5qYx1YwD/lBaSiaBRLDTriJjQgnyQdly6iq4qhm+yJd8t/hjIwWafRJ5OgV9PixFsX0qAgoD4f518Y0m2snISkLSHxQBc9tx60JBPrZctanuOIcIqtsESM22SRU6MoFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=y5IiXfXR691Qn1ohAt5qL8YJBrjc2PZmWA2K/W3J0Us=; b=Skq+/jX8MXMAaPD6KPIruyAu/IRX3vjxKQGRHGqYVye32OVjm44I8eX1xywwEhtq1tTVqOteSnddBwTygXv/oYNGKmTyi8T371I5w77Oq5mNf9/b+P5TbrjWBuJdydBo+BkhlWgwV0rQxKUsCKBHYCvk8fc6iSV7+SOi1nfNtS6vORbDAhLQajwCv30ctuPZRlI+z99H7bcvYUq8nVGY9vNgg4BsOBngQJlmcZyky2oz0ArPX5XZqTbQ16jW8LcoEB79UmklVbGrdxGC4MEMnIGfz+WZJSKRsiiXtA4oE7zc61kojyMe55yBoDGMz7rK0c44eI8qiM7izmFSzgSgBQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=y5IiXfXR691Qn1ohAt5qL8YJBrjc2PZmWA2K/W3J0Us=; b=AGnX01Dotm4VNudzz92N9Ui9h+RNRMECxIvUMEQioada0Y3YlDwxlPmnN/F0BD/G+CX9SKORds6e9ST3GxYsdDFD0+QjGlzbn638uFRNeMWd+0PL74cm/Fp36cvHAobt8WYbdmAAx6PG2w0oGOQCiKrtMRMpJa7WPaP5UoNCO1UUalwvmpoDm6t6AmY40Q2YOQ3kkhRDR/Zb5atDAjVF84fXunBDro7MnYjeZz+G3koVVb//ibnKgALGAkSyaPqlxSa7SG0iDew8vaGWXtuNwPrf78MucZxzMhr7insc2CIDofXrjzun0vUIc4da1oQbthjsrC+lZ6oUjVuH2YQGuQ== Received: from DS7PR03CA0088.namprd03.prod.outlook.com (2603:10b6:5:3bb::33) by SA0PR12MB4447.namprd12.prod.outlook.com (2603:10b6:806:9b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.15; Thu, 27 Jan 2022 15:40:30 +0000 Received: from DM6NAM11FT038.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3bb:cafe::76) by DS7PR03CA0088.outlook.office365.com (2603:10b6:5:3bb::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.18 via Frontend Transport; Thu, 27 Jan 2022 15:40:30 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.235) by DM6NAM11FT038.mail.protection.outlook.com (10.13.173.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4930.15 via Frontend Transport; Thu, 27 Jan 2022 15:40:30 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 27 Jan 2022 15:40:28 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.9; Thu, 27 Jan 2022 07:40:27 -0800 Received: from nvidia.com (10.127.8.13) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.9 via Frontend Transport; Thu, 27 Jan 2022 07:40:26 -0800 From: Michael Baum To: CC: Matan Azrad , Raslan Darawsheh , Viacheslav Ovsiienko Subject: [PATCH 17/20] net/mlx5: using function to detect operation by DevX Date: Thu, 27 Jan 2022 17:39:47 +0200 Message-ID: <20220127153950.812953-18-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220127153950.812953-1-michaelba@nvidia.com> References: <20220127153950.812953-1-michaelba@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e9ea9447-e76e-448a-bacd-08d9e1ab5968 X-MS-TrafficTypeDiagnostic: SA0PR12MB4447:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4125; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fUcUc//HP/7+DKWfkGCem7gSVw/ybPxcg+LuOkKRoO0gSPbeNlsZHLtUJ/fLJXIhbsvaXuoU4JySy7p9Y7vM3P1p1iNdmgCNxDMK+x7EzFnkPA4qipRP5DHvV56oTaj+xEG1V/Z0Na63xAdyoF7bur4Rw4XGZiWcy8EObU2/dE6SpcFqyhyVYHZf7UJvIuYgoaL1NmVY4GANAA/CGMgxbkVnlRPnn4tx92moOPhPHewySAysPhKDVfgSc/q4f2cCiFsYPBz4mLxSOYFQslw3bZwIsqrgjvG52DZE7uNf03OEtYrGl/DcqBxakenI2392JSQfkABegqrI2SOf4Z8Bi7CNAPbvl509MoNNQz/y4cnTB9hI4XKA+2hCqq4EeAUqPb2C5pzrkrGPheSR/rpA6u+ra0Gpd0f19KxyZgj4rxJg5dBKKTiXPeLW09v2a5wkaKOwDyPchbjdOlQ9RrTl0D4jRWBR84lOHPYRFjk/THiB1BzaIz82Q9/XmST07l/+XWbrByTTThvGbXFCBpgFqnWPxrsRpOKyfR4sS+ha3pm+FRncSKC44EoEl23FhbyanxLgE2whFT+oj+JjfyhZu0EH3hwqy4osk2iHyX1G/oyuVTzTr2DlHw8Ipj3bD6oe35oS8CUXMQTEvlHhgK6zJZKGpgDfEl1bxwsVHHCfq2RrFGVPkqhuEyVQrLmqw9tgY4z6cl1cRMgGzT70qFgRdg== X-Forefront-Antispam-Report: CIP:12.22.5.235; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(36860700001)(86362001)(83380400001)(70206006)(70586007)(36756003)(6916009)(5660300002)(54906003)(8676002)(8936002)(47076005)(316002)(2906002)(4326008)(7696005)(6666004)(336012)(186003)(82310400004)(81166007)(356005)(26005)(6286002)(107886003)(55016003)(508600001)(426003)(2616005)(1076003)(40460700003)(36900700001)(20210929001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2022 15:40:30.3922 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e9ea9447-e76e-448a-bacd-08d9e1ab5968 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.235]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT038.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4447 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add inline function indicating whether HW objects operations can be created by DevX. It makes the code more readable. Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/net/mlx5/linux/mlx5_os.c | 6 ++---- drivers/net/mlx5/mlx5.h | 24 ++++++++++++++++++++++++ drivers/net/mlx5/mlx5_ethdev.c | 3 +-- drivers/net/mlx5/mlx5_trigger.c | 3 +-- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 50cc287e73..c432cf0858 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -370,8 +370,7 @@ mlx5_os_capabilities_prepare(struct mlx5_dev_ctx_shared *sh) sh->dev_cap.txpp_en = 0; #endif /* Check for LRO support. */ - if (sh->dev_cap.dest_tir && sh->dev_cap.dv_flow_en && - hca_attr->lro_cap) { + if (mlx5_devx_obj_ops_en(sh) && hca_attr->lro_cap) { /* TBD check tunnel lro caps. */ sh->dev_cap.lro_supported = 1; DRV_LOG(DEBUG, "Device supports LRO."); @@ -1550,8 +1549,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, if (mlx5_flex_item_port_init(eth_dev) < 0) goto error; } - if (sh->cdev->config.devx && sh->config.dv_flow_en && - sh->dev_cap.dest_tir) { + if (mlx5_devx_obj_ops_en(sh)) { priv->obj_ops = devx_obj_ops; mlx5_queue_counter_id_prepare(eth_dev); priv->obj_ops.lb_dummy_queue_create = diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 5ca48ef68f..46fa5131a7 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -1496,6 +1496,30 @@ enum dr_dump_rec_type { DR_DUMP_REC_TYPE_PMD_COUNTER = 4430, }; +/** + * Indicates whether HW objects operations can be created by DevX. + * + * This function is used for both: + * Before creation - deciding whether to create HW objects operations by DevX. + * After creation - indicator if HW objects operations were created by DevX. + * + * @param sh + * Pointer to shared device context. + * + * @return + * True if HW objects were created by DevX, False otherwise. + */ +static inline bool +mlx5_devx_obj_ops_en(struct mlx5_dev_ctx_shared *sh) +{ + /* + * When advanced DR API is available and DV flow is supported and + * DevX is supported, HW objects operations are created by DevX. + */ + return (sh->cdev->config.devx && sh->config.dv_flow_en && + sh->dev_cap.dest_tir); +} + /* mlx5.c */ int mlx5_getenv_int(const char *); diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c index 9e478db8df..d637dee98d 100644 --- a/drivers/net/mlx5/mlx5_ethdev.c +++ b/drivers/net/mlx5/mlx5_ethdev.c @@ -721,8 +721,7 @@ mlx5_hairpin_cap_get(struct rte_eth_dev *dev, struct rte_eth_hairpin_cap *cap) { struct mlx5_priv *priv = dev->data->dev_private; - if (!priv->sh->cdev->config.devx || !priv->sh->dev_cap.dest_tir || - !priv->sh->config.dv_flow_en) { + if (!mlx5_devx_obj_ops_en(priv->sh)) { rte_errno = ENOTSUP; return -rte_errno; } diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index eb03e9f7b1..e234d11215 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -1104,8 +1104,7 @@ mlx5_dev_start(struct rte_eth_dev *dev) dev->data->port_id, strerror(rte_errno)); goto error; } - if ((priv->sh->cdev->config.devx && priv->sh->config.dv_flow_en && - priv->sh->dev_cap.dest_tir) && + if (mlx5_devx_obj_ops_en(priv->sh) && priv->obj_ops.lb_dummy_queue_create) { ret = priv->obj_ops.lb_dummy_queue_create(dev); if (ret) -- 2.25.1