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 472B7A0C41; Tue, 19 Oct 2021 22:56:42 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0117F41142; Tue, 19 Oct 2021 22:56:36 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2068.outbound.protection.outlook.com [40.107.93.68]) by mails.dpdk.org (Postfix) with ESMTP id CB36A41100 for ; Tue, 19 Oct 2021 22:56:33 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FTApITAbruNaScJqofNu71bknaRYDnTJdQJDcrI/RFH1UKXJYxLkhEhvOs5H2HIJbgUFS5XYUvlTW+Sscc58yIxmMm8fpYICZ+7Wm41UygqW8TiLmjJg7AE5uUHGQsy/X9jFBarGx8AFhnjDG2RPnlEcwexrrxy1T9eaQHd7Jv/kRfIVoqag4ghJeoHCkHNd7Gk68swCQfuPVSFT31YDmFBeJL9uEpMEgerHgnlW+b1UZnxBwoTYAUlI/T9UegTbF3TZ33C8gZ5/jc1+KTWLIlvAuvk4rOMUOgYjmIqipKfxJYexnRG83FWTSgwfgTWX4marWNF1SBRyTfMNHZSawA== 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=unItVVZyEVCSKmYOSOJDo/xhqp8uuW1W/z9eZfesbmU=; b=aQArFc48S00WJ1FrXW3uGgdj6INql4V+cWcOU7o7kQo79YVd59AqUAmXWS3/F4ys5ortznJd9wDgjkia1gD7xiz7zNu8irrSaDjaAwEUj+D5bFb8V1aFMB29+cioMXdlJd8gzWTIYHgeQffDmO4rIhADks0rAawNI3T55VVHetIbQ/sEzOHN2rxQg3GI74Mee1JU1/wwDqWJyBgnnpYE53rX63Y+uZVna2Rnvcfow2mziNrx8hRo3UoqmCWq5wFkwTBiIJ3fg2kD4fEo6aRDrwqBIEcl7w6wzQ+qB3xY5mD9Cvz1V4DjrpWHzE9wrzeGe9jMcirs9JKDQ0+A+CqFKA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=monjalon.net smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine 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=unItVVZyEVCSKmYOSOJDo/xhqp8uuW1W/z9eZfesbmU=; b=fk8ZlX8VhZvCwX5e+MN5iZkqG0i+5oO/RRCW78w17Tup/Z7yc9nK6zLpqqIqmwTLHpkTZ49UKIN1ZHwzlXAGMlaqOpN+5mbajYHbekvPllTeEPpx03igwwLcj/mvvt4gp2WHJ5Dczhw41LLEITt7YoX2YXDrn+pQ/zjDN2/g2Wz0IIUhU3zQkZ7Sk0+9u3/aH+FmrJDJpHzmTWASojHv7teu7dSZyIe2fZzVyl9Wv0AaY5dtk72ke0n9RO4HdfAApLEVd7hOqDLYPAd2g57sgDHIHAKX/3YCLdy8IpOiaXzRC26sfHx0f+oOAszVw9dM6D62ltz4UiT5wqc6nrliQQ== Received: from BN9PR03CA0925.namprd03.prod.outlook.com (2603:10b6:408:107::30) by CH2PR12MB4858.namprd12.prod.outlook.com (2603:10b6:610:67::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.17; Tue, 19 Oct 2021 20:56:32 +0000 Received: from BN8NAM11FT035.eop-nam11.prod.protection.outlook.com (2603:10b6:408:107:cafe::b9) by BN9PR03CA0925.outlook.office365.com (2603:10b6:408:107::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Tue, 19 Oct 2021 20:56:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; monjalon.net; dkim=none (message not signed) header.d=none;monjalon.net; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT035.mail.protection.outlook.com (10.13.177.116) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 20:56:31 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 19 Oct 2021 20:56:26 +0000 From: To: CC: Matan Azrad , Thomas Monjalon , Michael Baum Date: Tue, 19 Oct 2021 23:55:47 +0300 Message-ID: <20211019205602.3188203-4-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019205602.3188203-1-michaelba@nvidia.com> References: <20211006220350.2357487-1-michaelba@nvidia.com> <20211019205602.3188203-1-michaelba@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d33c602d-272f-4b4f-4f6d-08d99342edfc X-MS-TrafficTypeDiagnostic: CH2PR12MB4858: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:264; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 86CZtR5advM2SvKfdlev0+aGH8ybDu9DbR7v3oNsdXiDL/SCk9geYSmbWBj3jlatZnkQEpj/BPr9rGH3USQOiKrHSgjtHYZ1gLrLporoFrPzJK9HcQoyn2L5d4U0l62rMfXCYWa96RVpiYyGNH34mUaB66y31MHohX1z1AvdB2R4zmZq+jT+2nknhccn2ocuMjqJe8KyqDA25m73wsP+Na6PVrYyzkGZAgG8ITxVfFmtPPAW0ddtMPmrLnnDRNAP7zojQGDxeh93aTNCCIL848Ho5Us38FA/4AKomvuR3uRung4Xu0r7JRPCkLntn6LrrHh4P/jHif7NkH59no2/XxbLGGb9cBe+HQfKnZEV8b8L8tyuLuP3ffWj107if7cMIJL+7bqUpcacMAYVgWKYn8VCt+dkbhMm6jc/CxMpEwOe6K+/PcdmayB/pKl864O8AIY8fopxxPctHDliZqkjjb9iBp/32cY3wxJ7sGXZQhbFDA1fQEJcBkx4dLAQGmvVniW5682w+Ek7Vn4ePnkIuDyVN/gsErLQreuWE9ItB7OPPU/r1ewK8/IX6CX80ZTiqmzEnqh1gKufCYhpRCpdYKTuW4CkNepMkRh4ECN+y7RwBMw2c1DOqZlb8Gb1ZqssSuZl47OSYQhtdN63IQv7DYsVpecYT/xWalAcLXCKtfMQ/X8sAKVXzDpiljxBot9rUN8tFL8UVWcDAQIV8jBKBw== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(70586007)(70206006)(36860700001)(86362001)(55016002)(316002)(7696005)(5660300002)(2906002)(54906003)(26005)(186003)(16526019)(336012)(426003)(6286002)(508600001)(47076005)(82310400003)(6916009)(2616005)(8676002)(7636003)(2876002)(1076003)(8936002)(356005)(83380400001)(36756003)(6666004)(107886003)(4326008); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 20:56:31.4618 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d33c602d-272f-4b4f-4f6d-08d99342edfc X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT035.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4858 Subject: [dpdk-dev] [PATCH v3 03/18] common/mlx5: share common definitions 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 Sender: "dev" From: Michael Baum Create MACRO definitions file in the common driver as preparation for MR and basic probe sharing. Move relevant definitions from the net driver to the above file. Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/common/mlx5/mlx5_common.c | 1 + drivers/common/mlx5/mlx5_common_defs.h | 42 ++++++++++++++++++++++++++ drivers/common/mlx5/mlx5_common_mr.h | 5 +-- drivers/common/mlx5/mlx5_devx_cmds.h | 12 ++------ drivers/net/mlx5/mlx5.h | 4 +-- drivers/net/mlx5/mlx5_defs.h | 22 ++------------ 6 files changed, 49 insertions(+), 37 deletions(-) create mode 100644 drivers/common/mlx5/mlx5_common_defs.h diff --git a/drivers/common/mlx5/mlx5_common.c b/drivers/common/mlx5/mlx5_common.c index 91de7b3e2c..8e3ea073e3 100644 --- a/drivers/common/mlx5/mlx5_common.c +++ b/drivers/common/mlx5/mlx5_common.c @@ -14,6 +14,7 @@ #include "mlx5_common.h" #include "mlx5_common_os.h" #include "mlx5_common_log.h" +#include "mlx5_common_defs.h" #include "mlx5_common_private.h" uint8_t haswell_broadwell_cpu; diff --git a/drivers/common/mlx5/mlx5_common_defs.h b/drivers/common/mlx5/mlx5_common_defs.h new file mode 100644 index 0000000000..6fd30f2c97 --- /dev/null +++ b/drivers/common/mlx5/mlx5_common_defs.h @@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2021 6WIND S.A. + * Copyright 2021 Mellanox Technologies, Ltd + */ + +#ifndef RTE_PMD_MLX5_COMMON_DEFS_H_ +#define RTE_PMD_MLX5_COMMON_DEFS_H_ + +#include "mlx5_autoconf.h" + +/* Size of per-queue MR cache array for linear search. */ +#define MLX5_MR_CACHE_N 8 + +/* Size of MR cache table for binary search. */ +#define MLX5_MR_BTREE_CACHE_N 256 + +/* + * Defines the amount of retries to allocate the first UAR in the page. + * OFED 5.0.x and Upstream rdma_core before v29 returned the NULL as + * UAR base address if UAR was not the first object in the UAR page. + * It caused the PMD failure and we should try to get another UAR + * till we get the first one with non-NULL base address returned. + */ +#define MLX5_ALLOC_UAR_RETRY 32 + +/* Environment variable to control the doorbell register mapping. */ +#define MLX5_SHUT_UP_BF "MLX5_SHUT_UP_BF" +#if defined(RTE_ARCH_ARM64) +#define MLX5_SHUT_UP_BF_DEFAULT "0" +#else +#define MLX5_SHUT_UP_BF_DEFAULT "1" +#endif + +/* Default PMD specific parameter value. */ +#define MLX5_ARG_UNSET (-1) + +/* MLX5_TX_DB_NC supported values. */ +#define MLX5_TXDB_CACHED 0 +#define MLX5_TXDB_NCACHED 1 +#define MLX5_TXDB_HEURISTIC 2 + +#endif /* RTE_PMD_MLX5_COMMON_DEFS_H_ */ diff --git a/drivers/common/mlx5/mlx5_common_mr.h b/drivers/common/mlx5/mlx5_common_mr.h index 685ac98e08..15489cd399 100644 --- a/drivers/common/mlx5/mlx5_common_mr.h +++ b/drivers/common/mlx5/mlx5_common_mr.h @@ -18,10 +18,7 @@ #include "mlx5_glue.h" #include "mlx5_common_mp.h" - -/* Size of per-queue MR cache array for linear search. */ -#define MLX5_MR_CACHE_N 8 -#define MLX5_MR_BTREE_CACHE_N 256 +#include "mlx5_common_defs.h" /* mlx5 PMD MR struct. */ struct mlx5_pmd_mr { diff --git a/drivers/common/mlx5/mlx5_devx_cmds.h b/drivers/common/mlx5/mlx5_devx_cmds.h index e149f8b4f5..dbf301a127 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.h +++ b/drivers/common/mlx5/mlx5_devx_cmds.h @@ -5,18 +5,10 @@ #ifndef RTE_PMD_MLX5_DEVX_CMDS_H_ #define RTE_PMD_MLX5_DEVX_CMDS_H_ -#include "mlx5_glue.h" -#include "mlx5_prm.h" #include -/* - * Defines the amount of retries to allocate the first UAR in the page. - * OFED 5.0.x and Upstream rdma_core before v29 returned the NULL as - * UAR base address if UAR was not the first object in the UAR page. - * It caused the PMD failure and we should try to get another UAR - * till we get the first one with non-NULL base address returned. - */ -#define MLX5_ALLOC_UAR_RETRY 32 +#include "mlx5_glue.h" +#include "mlx5_prm.h" /* This is limitation of libibverbs: in length variable type is u16. */ #define MLX5_DEVX_MAX_KLM_ENTRIES ((UINT16_MAX - \ diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index f441352a63..2e93ce2a3e 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -27,6 +27,7 @@ #include #include #include +#include #include "mlx5_defs.h" #include "mlx5_utils.h" @@ -214,9 +215,6 @@ struct mlx5_stats_ctrl { uint64_t imissed; }; -/* Default PMD specific parameter value. */ -#define MLX5_ARG_UNSET (-1) - #define MLX5_LRO_SUPPORTED(dev) \ (((struct mlx5_priv *)((dev)->data->dev_private))->config.lro.supported) diff --git a/drivers/net/mlx5/mlx5_defs.h b/drivers/net/mlx5/mlx5_defs.h index fe86bb40d3..376e34a946 100644 --- a/drivers/net/mlx5/mlx5_defs.h +++ b/drivers/net/mlx5/mlx5_defs.h @@ -9,6 +9,8 @@ #include #include +#include + #include "mlx5_autoconf.h" /* Maximum number of simultaneous VLAN filters. */ @@ -33,13 +35,6 @@ */ #define MLX5_TX_COMP_MAX_CQE 2u - -/* Size of per-queue MR cache array for linear search. */ -#define MLX5_MR_CACHE_N 8 - -/* Size of MR cache table for binary search. */ -#define MLX5_MR_BTREE_CACHE_N 256 - /* * If defined, only use software counters. The PMD will never ask the hardware * for these, and many of them won't be available. @@ -121,14 +116,6 @@ #define MLX5_UAR_MMAP_CMD_SHIFT 8 #define MLX5_UAR_MMAP_CMD_MASK 0xff -/* Environment variable to control the doorbell register mapping. */ -#define MLX5_SHUT_UP_BF "MLX5_SHUT_UP_BF" -#if defined(RTE_ARCH_ARM64) -#define MLX5_SHUT_UP_BF_DEFAULT "0" -#else -#define MLX5_SHUT_UP_BF_DEFAULT "1" -#endif - #ifndef HAVE_MLX5DV_MMAP_GET_NC_PAGES_CMD #define MLX5_MMAP_GET_NC_PAGES_CMD 3 #endif @@ -161,11 +148,6 @@ /* Provide info on patrial hw miss. Implies MLX5_XMETA_MODE_META16 */ #define MLX5_XMETA_MODE_MISS_INFO 3 -/* MLX5_TX_DB_NC supported values. */ -#define MLX5_TXDB_CACHED 0 -#define MLX5_TXDB_NCACHED 1 -#define MLX5_TXDB_HEURISTIC 2 - /* Tx accurate scheduling on timestamps parameters. */ #define MLX5_TXPP_WAIT_INIT_TS 1000ul /* How long to wait timestamp. */ #define MLX5_TXPP_CLKQ_SIZE 1 -- 2.25.1