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 BA594A0C43; Thu, 30 Sep 2021 19:41:21 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0122641169; Thu, 30 Sep 2021 19:40:01 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2044.outbound.protection.outlook.com [40.107.94.44]) by mails.dpdk.org (Postfix) with ESMTP id 76A7F4067E for ; Thu, 30 Sep 2021 19:29:12 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gyFUwqDyFp0lRMwz8Y4M7BfsloMJozAuATUifYphqVorc6zxrr7eRyYZ147Jo4lEy3ij+/Im/cc3bFHJ3Pw3HjC/KMG9MpSLKcedoz8GAe9tE/m6tQA5gDS8NuquPkQhFEXAl10nm07MKKJzmmfr1VlCT2Dkw8+z6BXFgJgk97QYnnQbMrloU1SZwyU8hmt5YF/m9pXCF6myYK7raQ1u9Hc07bIBsWBL0NKC54cY+TucuZ1Ey1ttKVaPd1Fqv7/pwKGFQb+383r65fqpiLdmaG5sDkn4oDpZqNuOcnUsEOunztnG9j8WKqKaQcPqG4hWzHowkchuxUQK+HGPIqLSjg== 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; bh=ooOC9zhuLqFY4e5r18PLaXqrkeQmXAje+iziHXTcEns=; b=mdg1mvsKV5A2ZG6qbVDKBa77jTFSjQVlf2zbHyjX3kShc/afY0uhyU0kSOuenHsmQybEff58BehNZxigogDEr4fv8/M2hKt4bZL17HBC5bFBP11xDzn66NH2xRzlfkixFqt4vQC3cuVTAndTCt8Ul9DpuYhXiu8t2LwMmyjYRdKhZ80/rB1C/1SUpDNtVRWTIEZyhxuT80Fyg7oZrbbpH0xYovbi6ikLpzYIEW4TrRaOUz/IdKChz8A0hGELz2intzDUI5NzWAUlb8Db05sg961Awu3l/xCFx+Bf9nccf1UImBAg1glcMqW+JqGULkf0FkPIoCynTNiVQFbaYWDWyQ== 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=none 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=ooOC9zhuLqFY4e5r18PLaXqrkeQmXAje+iziHXTcEns=; b=D06HRd8hO9+nGCGtFRYLKS9EOpBHWmlHbPQ9k/LwuO/6Jp/sEBsi9BgQyQlmkIH7ETg/cSKjjc6Byxku8ymZb+W0eIeaTNGmLyPuIR8G/9x+789xTC3uFD1ZmUboUPidSd03Bamhz6mfA7XsOs+jwa5EyLHGal71PbNBuzgFot/ZjxJs5x03YDB6S4lEruCncp9b4Q7aT9tw+hT4sxWfW0bwlGTO9mEQCwzc7q+OVIbCpA+xam0l5GRiCmT2nGayedVKn7vkk5HTUw8PaiSbDvyeJLTzMhdQ+DCZ+bYD9FiOyCKZ28Zj3LwYp4lJoaDgoTbjIBCzJDxSxwcEbZ860Q== Received: from BN0PR02CA0055.namprd02.prod.outlook.com (2603:10b6:408:e5::30) by MW2PR12MB2377.namprd12.prod.outlook.com (2603:10b6:907:11::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.15; Thu, 30 Sep 2021 17:29:10 +0000 Received: from BN8NAM11FT010.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e5:cafe::f9) by BN0PR02CA0055.outlook.office365.com (2603:10b6:408:e5::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.17 via Frontend Transport; Thu, 30 Sep 2021 17:29:10 +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 BN8NAM11FT010.mail.protection.outlook.com (10.13.177.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4566.14 via Frontend Transport; Thu, 30 Sep 2021 17:29:09 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 30 Sep 2021 17:29:04 +0000 From: To: CC: Matan Azrad , Thomas Monjalon , Michael Baum Date: Thu, 30 Sep 2021 20:28:18 +0300 Message-ID: <20210930172822.1949969-15-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210930172822.1949969-1-michaelba@nvidia.com> References: <20210930172822.1949969-1-michaelba@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3250eb0c-f030-480f-0d6e-08d98437d042 X-MS-TrafficTypeDiagnostic: MW2PR12MB2377: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3044; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DQqZpdGih97lUMHygYpf7dTVJGf91YEulQk7MVOm9I7hVFuPmrWXyitJGT0+VAjZoJ5NT3/mCSFef5eMOOOMtxLoCy86tyxvqA58SM6DzspMnQBOmUrCDYvdZVVykQyXS062QYN7oY2kqVQZoxubVmXm44kB7Qqkw/QE1635GEjkp5ObKqTlaZqupUfzphNAeywUyCTCpuy2KVA3Osi62u9FCEpWlzFAkahR2GJMC2ei67rJCjZdZj+N0/NCnp+pnkH7Ga4WRJ5FBXHScIxDKcn/kDLueiY+b6sHVCuR5FyqR94IAST7DAC9rFN8LA1CpXh7X4NuUyqBXS0VSEujwt/Q8OlTdKPYMpqXZcHTLJ7FC3yevoUVbnGxLj08NT1GR+Amf+czHf90ePShQJ4BX+23HrqPc5I9vb3IrnKOwAZNtGmCFpZ05t4j4jxPvccglZ814Ab1iZogDTKF7oD9PCFlx3WHLziEv+m8n3EVACGI28WzmAYDpvoQ3IzH0gjAARxTla71PW74mEMszfTA4LNwnXgsh2DTsQG6PS+VNJNgvEsn/IIE1qUo8ue+za9RZWLYK6xfcVFexfPxhlwaqecQ0GqL5D1yn4LQrD3sZQ4X6i5ZP3Dm0as/+NHPbOmeJBrLzZWgJRIigOw2ab+p/9qHNkqCidL/R/Jlq8WKazAGv/5tvWtRzMRX0XLuXqt6o0w52HcnKeaYIjzErOKb/g== 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)(83380400001)(8936002)(70206006)(6286002)(186003)(6666004)(16526019)(26005)(4326008)(107886003)(8676002)(336012)(426003)(2616005)(1076003)(508600001)(2876002)(2906002)(30864003)(36756003)(86362001)(7636003)(82310400003)(7696005)(70586007)(5660300002)(6916009)(316002)(36906005)(55016002)(36860700001)(47076005)(54906003)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Sep 2021 17:29:09.9934 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3250eb0c-f030-480f-0d6e-08d98437d042 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: BN8NAM11FT010.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR12MB2377 X-Mailman-Approved-At: Thu, 30 Sep 2021 19:39:43 +0200 Subject: [dpdk-dev] [PATCH 14/18] common/mlx5: add global MR cache create function 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 Add function for global shared MR cache structure initialization. This function include: - btree initialization. - set callbacks for reg and dereg MR. Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/common/mlx5/linux/mlx5_common_verbs.c | 15 +++++++ drivers/common/mlx5/mlx5_common_mr.c | 25 ++++++++++- drivers/common/mlx5/mlx5_common_mr.h | 8 +++- drivers/common/mlx5/version.map | 5 +-- drivers/common/mlx5/windows/mlx5_common_os.c | 20 ++++++++- drivers/common/mlx5/windows/mlx5_common_os.h | 6 +-- drivers/compress/mlx5/mlx5_compress.c | 5 +-- drivers/crypto/mlx5/mlx5_crypto.c | 5 +-- drivers/net/mlx5/linux/mlx5_os.c | 17 -------- drivers/net/mlx5/linux/mlx5_verbs.c | 42 ------------------- drivers/net/mlx5/linux/mlx5_verbs.h | 2 - drivers/net/mlx5/mlx5.c | 6 +-- drivers/net/mlx5/mlx5.h | 8 ---- drivers/net/mlx5/windows/mlx5_os.c | 17 -------- drivers/regex/mlx5/mlx5_regex.c | 6 +-- 15 files changed, 70 insertions(+), 117 deletions(-) diff --git a/drivers/common/mlx5/linux/mlx5_common_verbs.c b/drivers/common/mlx5/linux/mlx5_common_verbs.c index 519cb8d056..cf2f7ecbf3 100644 --- a/drivers/common/mlx5/linux/mlx5_common_verbs.c +++ b/drivers/common/mlx5/linux/mlx5_common_verbs.c @@ -142,3 +142,18 @@ mlx5_common_verbs_dereg_mr(struct mlx5_pmd_mr *pmd_mr) memset(pmd_mr, 0, sizeof(*pmd_mr)); } } + +/** + * Set the reg_mr and dereg_mr callbacks. + * + * @param[out] reg_mr_cb + * Pointer to reg_mr func + * @param[out] dereg_mr_cb + * Pointer to dereg_mr func + */ +void +mlx5_os_set_reg_mr_cb(mlx5_reg_mr_t *reg_mr_cb, mlx5_dereg_mr_t *dereg_mr_cb) +{ + *reg_mr_cb = mlx5_common_verbs_reg_mr; + *dereg_mr_cb = mlx5_common_verbs_dereg_mr; +} diff --git a/drivers/common/mlx5/mlx5_common_mr.c b/drivers/common/mlx5/mlx5_common_mr.c index 8fd65484cf..43dc3d88ce 100644 --- a/drivers/common/mlx5/mlx5_common_mr.c +++ b/drivers/common/mlx5/mlx5_common_mr.c @@ -199,7 +199,7 @@ mr_btree_insert(struct mlx5_mr_btree *bt, struct mr_cache_entry *entry) * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */ -int +static int mlx5_mr_btree_init(struct mlx5_mr_btree *bt, int n, int socket) { if (bt == NULL) { @@ -1044,6 +1044,29 @@ mlx5_mr_release_cache(struct mlx5_mr_share_cache *share_cache) mlx5_mr_garbage_collect(share_cache); } +/** + * Initialize global MR cache of a device. + * + * @param share_cache + * Pointer to a global shared MR cache. + * @param socket + * NUMA socket on which memory must be allocated. + * + * @return + * 0 on success, a negative errno value otherwise and rte_errno is set. + */ +int +mlx5_mr_create_cache(struct mlx5_mr_share_cache *share_cache, int socket) +{ + /* Set the reg_mr and dereg_mr callback functions */ + mlx5_os_set_reg_mr_cb(&share_cache->reg_mr_cb, + &share_cache->dereg_mr_cb); + rte_rwlock_init(&share_cache->rwlock); + /* Initialize B-tree and allocate memory for global MR cache table. */ + return mlx5_mr_btree_init(&share_cache->cache, + MLX5_MR_BTREE_CACHE_N * 2, socket); +} + /** * Flush all of the local cache entries. * diff --git a/drivers/common/mlx5/mlx5_common_mr.h b/drivers/common/mlx5/mlx5_common_mr.h index 1392d9b55a..36689dfb54 100644 --- a/drivers/common/mlx5/mlx5_common_mr.h +++ b/drivers/common/mlx5/mlx5_common_mr.h @@ -128,8 +128,6 @@ __rte_internal int mlx5_mr_ctrl_init(struct mlx5_mr_ctrl *mr_ctrl, uint32_t *dev_gen_ptr, int socket); __rte_internal -int mlx5_mr_btree_init(struct mlx5_mr_btree *bt, int n, int socket); -__rte_internal void mlx5_mr_btree_free(struct mlx5_mr_btree *bt); __rte_internal void mlx5_mr_btree_dump(struct mlx5_mr_btree *bt __rte_unused); @@ -145,6 +143,8 @@ uint32_t mlx5_mr_mempool2mr_bh(struct mlx5_mr_share_cache *share_cache, __rte_internal void mlx5_mr_release_cache(struct mlx5_mr_share_cache *mr_cache); __rte_internal +int mlx5_mr_create_cache(struct mlx5_mr_share_cache *share_cache, int socket); +__rte_internal void mlx5_mr_dump_cache(struct mlx5_mr_share_cache *share_cache __rte_unused); __rte_internal void mlx5_mr_rebuild_cache(struct mlx5_mr_share_cache *share_cache); @@ -183,6 +183,10 @@ __rte_internal void mlx5_common_verbs_dereg_mr(struct mlx5_pmd_mr *pmd_mr); +__rte_internal +void +mlx5_os_set_reg_mr_cb(mlx5_reg_mr_t *reg_mr_cb, mlx5_dereg_mr_t *dereg_mr_cb); + __rte_internal void mlx5_mr_free(struct mlx5_mr *mr, mlx5_dereg_mr_t dereg_mr_cb); diff --git a/drivers/common/mlx5/version.map b/drivers/common/mlx5/version.map index f786287986..cabdc676d5 100644 --- a/drivers/common/mlx5/version.map +++ b/drivers/common/mlx5/version.map @@ -106,7 +106,7 @@ INTERNAL { mlx5_mr_addr2mr_bh; mlx5_mr_btree_dump; mlx5_mr_btree_free; - mlx5_mr_btree_init; + mlx5_mr_create_cache; mlx5_mr_create_primary; mlx5_mr_ctrl_init; mlx5_mr_dump_cache; @@ -133,10 +133,9 @@ INTERNAL { mlx5_nl_vlan_vmwa_create; # WINDOWS_NO_EXPORT mlx5_nl_vlan_vmwa_delete; # WINDOWS_NO_EXPORT - mlx5_os_dereg_mr; - mlx5_os_reg_mr; mlx5_os_umem_dereg; mlx5_os_umem_reg; + mlx5_os_set_reg_mr_cb; mlx5_realloc; diff --git a/drivers/common/mlx5/windows/mlx5_common_os.c b/drivers/common/mlx5/windows/mlx5_common_os.c index 4d0f1e92e3..44e8ebec2b 100644 --- a/drivers/common/mlx5/windows/mlx5_common_os.c +++ b/drivers/common/mlx5/windows/mlx5_common_os.c @@ -317,7 +317,7 @@ mlx5_os_umem_dereg(void *pumem) * @return * 0 on successful registration, -1 otherwise */ -int +static int mlx5_os_reg_mr(void *pd, void *addr, size_t length, struct mlx5_pmd_mr *pmd_mr) { @@ -365,7 +365,7 @@ mlx5_os_reg_mr(void *pd, * @param[in] pmd_mr * Pointer to PMD mr object */ -void +static void mlx5_os_dereg_mr(struct mlx5_pmd_mr *pmd_mr) { if (pmd_mr && pmd_mr->mkey) @@ -374,3 +374,19 @@ mlx5_os_dereg_mr(struct mlx5_pmd_mr *pmd_mr) claim_zero(mlx5_os_umem_dereg(pmd_mr->obj)); memset(pmd_mr, 0, sizeof(*pmd_mr)); } + +/** + * Set the reg_mr and dereg_mr callbacks. + * + * @param[out] reg_mr_cb + * Pointer to reg_mr func + * @param[out] dereg_mr_cb + * Pointer to dereg_mr func + * + */ +void +mlx5_os_set_reg_mr_cb(mlx5_reg_mr_t *reg_mr_cb, mlx5_dereg_mr_t *dereg_mr_cb) +{ + *reg_mr_cb = mlx5_os_reg_mr; + *dereg_mr_cb = mlx5_os_dereg_mr; +} diff --git a/drivers/common/mlx5/windows/mlx5_common_os.h b/drivers/common/mlx5/windows/mlx5_common_os.h index c99645aefd..3afce56cd9 100644 --- a/drivers/common/mlx5/windows/mlx5_common_os.h +++ b/drivers/common/mlx5/windows/mlx5_common_os.h @@ -253,9 +253,5 @@ __rte_internal void *mlx5_os_umem_reg(void *ctx, void *addr, size_t size, uint32_t access); __rte_internal int mlx5_os_umem_dereg(void *pumem); -__rte_internal -int mlx5_os_reg_mr(void *pd, - void *addr, size_t length, struct mlx5_pmd_mr *pmd_mr); -__rte_internal -void mlx5_os_dereg_mr(struct mlx5_pmd_mr *pmd_mr); + #endif /* RTE_PMD_MLX5_COMMON_OS_H_ */ diff --git a/drivers/compress/mlx5/mlx5_compress.c b/drivers/compress/mlx5/mlx5_compress.c index 7e297778ef..6116f5113f 100644 --- a/drivers/compress/mlx5/mlx5_compress.c +++ b/drivers/compress/mlx5/mlx5_compress.c @@ -788,16 +788,13 @@ mlx5_compress_dev_probe(struct mlx5_common_device *cdev) rte_compressdev_pmd_destroy(priv->compressdev); return -1; } - if (mlx5_mr_btree_init(&priv->mr_scache.cache, - MLX5_MR_BTREE_CACHE_N * 2, rte_socket_id()) != 0) { + if (mlx5_mr_create_cache(&priv->mr_scache, rte_socket_id()) != 0) { DRV_LOG(ERR, "Failed to allocate shared cache MR memory."); mlx5_compress_hw_global_release(priv); rte_compressdev_pmd_destroy(priv->compressdev); rte_errno = ENOMEM; return -rte_errno; } - priv->mr_scache.reg_mr_cb = mlx5_common_verbs_reg_mr; - priv->mr_scache.dereg_mr_cb = mlx5_common_verbs_dereg_mr; /* Register callback function for global shared MR cache management. */ if (TAILQ_EMPTY(&mlx5_compress_priv_list)) rte_mem_event_callback_register("MLX5_MEM_EVENT_CB", diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c index af32e0a2ac..e40c4f1e6c 100644 --- a/drivers/crypto/mlx5/mlx5_crypto.c +++ b/drivers/crypto/mlx5/mlx5_crypto.c @@ -1024,16 +1024,13 @@ mlx5_crypto_dev_probe(struct mlx5_common_device *cdev) rte_cryptodev_pmd_destroy(priv->crypto_dev); return -1; } - if (mlx5_mr_btree_init(&priv->mr_scache.cache, - MLX5_MR_BTREE_CACHE_N * 2, rte_socket_id()) != 0) { + if (mlx5_mr_create_cache(&priv->mr_scache, rte_socket_id()) != 0) { DRV_LOG(ERR, "Failed to allocate shared cache MR memory."); mlx5_crypto_hw_global_release(priv); rte_cryptodev_pmd_destroy(priv->crypto_dev); rte_errno = ENOMEM; return -rte_errno; } - priv->mr_scache.reg_mr_cb = mlx5_common_verbs_reg_mr; - priv->mr_scache.dereg_mr_cb = mlx5_common_verbs_dereg_mr; priv->keytag = rte_cpu_to_be_64(devarg_prms.keytag); priv->max_segs_num = devarg_prms.max_segs_num; priv->umr_wqe_size = sizeof(struct mlx5_wqe_umr_bsf_seg) + diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 06bde2669c..9e445f2f9b 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -2831,23 +2831,6 @@ mlx5_os_read_dev_stat(struct mlx5_priv *priv, const char *ctr_name, return 1; } -/** - * Set the reg_mr and dereg_mr call backs - * - * @param reg_mr_cb[out] - * Pointer to reg_mr func - * @param dereg_mr_cb[out] - * Pointer to dereg_mr func - * - */ -void -mlx5_os_set_reg_mr_cb(mlx5_reg_mr_t *reg_mr_cb, - mlx5_dereg_mr_t *dereg_mr_cb) -{ - *reg_mr_cb = mlx5_mr_verbs_ops.reg_mr; - *dereg_mr_cb = mlx5_mr_verbs_ops.dereg_mr; -} - /** * Remove a MAC address from device * diff --git a/drivers/net/mlx5/linux/mlx5_verbs.c b/drivers/net/mlx5/linux/mlx5_verbs.c index fb10dd0839..4779b37aa6 100644 --- a/drivers/net/mlx5/linux/mlx5_verbs.c +++ b/drivers/net/mlx5/linux/mlx5_verbs.c @@ -26,48 +26,6 @@ #include #include -/** - * Register mr. Given protection domain pointer, pointer to addr and length - * register the memory region. - * - * @param[in] pd - * Pointer to protection domain context. - * @param[in] addr - * Pointer to memory start address. - * @param[in] length - * Length of the memory to register. - * @param[out] pmd_mr - * pmd_mr struct set with lkey, address, length and pointer to mr object - * - * @return - * 0 on successful registration, -1 otherwise - */ -static int -mlx5_reg_mr(void *pd, void *addr, size_t length, - struct mlx5_pmd_mr *pmd_mr) -{ - return mlx5_common_verbs_reg_mr(pd, addr, length, pmd_mr); -} - -/** - * Deregister mr. Given the mlx5 pmd MR - deregister the MR - * - * @param[in] pmd_mr - * pmd_mr struct set with lkey, address, length and pointer to mr object - * - */ -static void -mlx5_dereg_mr(struct mlx5_pmd_mr *pmd_mr) -{ - mlx5_common_verbs_dereg_mr(pmd_mr); -} - -/* verbs operations. */ -const struct mlx5_mr_ops mlx5_mr_verbs_ops = { - .reg_mr = mlx5_reg_mr, - .dereg_mr = mlx5_dereg_mr, -}; - /** * Modify Rx WQ vlan stripping offload * diff --git a/drivers/net/mlx5/linux/mlx5_verbs.h b/drivers/net/mlx5/linux/mlx5_verbs.h index f7e8e2fe98..829d9fa738 100644 --- a/drivers/net/mlx5/linux/mlx5_verbs.h +++ b/drivers/net/mlx5/linux/mlx5_verbs.h @@ -12,7 +12,5 @@ void mlx5_txq_ibv_obj_release(struct mlx5_txq_obj *txq_obj); int mlx5_rxq_ibv_obj_dummy_lb_create(struct rte_eth_dev *dev); void mlx5_rxq_ibv_obj_dummy_lb_release(struct rte_eth_dev *dev); -/* Verbs ops struct */ -extern const struct mlx5_mr_ops mlx5_mr_verbs_ops; extern struct mlx5_obj_ops ibv_obj_ops; #endif /* RTE_PMD_MLX5_VERBS_H_ */ diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 788c701292..a6c196b368 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1351,15 +1351,11 @@ mlx5_alloc_shared_dev_ctx(const struct mlx5_dev_spawn_data *spawn, * At this point the device is not added to the memory * event list yet, context is just being created. */ - err = mlx5_mr_btree_init(&sh->share_cache.cache, - MLX5_MR_BTREE_CACHE_N * 2, - sh->numa_node); + err = mlx5_mr_create_cache(&sh->share_cache, sh->numa_node); if (err) { err = rte_errno; goto error; } - mlx5_os_set_reg_mr_cb(&sh->share_cache.reg_mr_cb, - &sh->share_cache.dereg_mr_cb); mlx5_os_dev_shared_handler_install(sh); sh->cnt_id_tbl = mlx5_l3t_create(MLX5_L3T_TYPE_DWORD); if (!sh->cnt_id_tbl) { diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 96e2cbc644..5c25b94f36 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -1363,12 +1363,6 @@ struct mlx5_obj_ops { #define MLX5_RSS_HASH_FIELDS_LEN RTE_DIM(mlx5_rss_hash_fields) -/* MR operations structure. */ -struct mlx5_mr_ops { - mlx5_reg_mr_t reg_mr; - mlx5_dereg_mr_t dereg_mr; -}; - struct mlx5_priv { struct rte_eth_dev_data *dev_data; /* Pointer to device data. */ struct mlx5_dev_ctx_shared *sh; /* Shared device context. */ @@ -1768,8 +1762,6 @@ void mlx5_os_free_shared_dr(struct mlx5_priv *priv); int mlx5_os_net_probe(struct mlx5_common_device *cdev); void mlx5_os_dev_shared_handler_install(struct mlx5_dev_ctx_shared *sh); void mlx5_os_dev_shared_handler_uninstall(struct mlx5_dev_ctx_shared *sh); -void mlx5_os_set_reg_mr_cb(mlx5_reg_mr_t *reg_mr_cb, - mlx5_dereg_mr_t *dereg_mr_cb); void mlx5_os_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index); int mlx5_os_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index); diff --git a/drivers/net/mlx5/windows/mlx5_os.c b/drivers/net/mlx5/windows/mlx5_os.c index 3477f018c1..c3d4b90946 100644 --- a/drivers/net/mlx5/windows/mlx5_os.c +++ b/drivers/net/mlx5/windows/mlx5_os.c @@ -926,21 +926,4 @@ mlx5_os_net_probe(struct mlx5_common_device *cdev) return 0; } -/** - * Set the reg_mr and dereg_mr call backs - * - * @param reg_mr_cb[out] - * Pointer to reg_mr func - * @param dereg_mr_cb[out] - * Pointer to dereg_mr func - * - */ -void -mlx5_os_set_reg_mr_cb(mlx5_reg_mr_t *reg_mr_cb, - mlx5_dereg_mr_t *dereg_mr_cb) -{ - *reg_mr_cb = mlx5_os_reg_mr; - *dereg_mr_cb = mlx5_os_dereg_mr; -} - const struct mlx5_flow_driver_ops mlx5_flow_verbs_drv_ops = {0}; diff --git a/drivers/regex/mlx5/mlx5_regex.c b/drivers/regex/mlx5/mlx5_regex.c index 3855b344d4..d95c0b7f2c 100644 --- a/drivers/regex/mlx5/mlx5_regex.c +++ b/drivers/regex/mlx5/mlx5_regex.c @@ -191,11 +191,7 @@ mlx5_regex_dev_probe(struct mlx5_common_device *cdev) priv->regexdev->device = cdev->dev; priv->regexdev->data->dev_private = priv; priv->regexdev->state = RTE_REGEXDEV_READY; - priv->mr_scache.reg_mr_cb = mlx5_common_verbs_reg_mr; - priv->mr_scache.dereg_mr_cb = mlx5_common_verbs_dereg_mr; - ret = mlx5_mr_btree_init(&priv->mr_scache.cache, - MLX5_MR_BTREE_CACHE_N * 2, - rte_socket_id()); + ret = mlx5_mr_create_cache(&priv->mr_scache, rte_socket_id()); if (ret) { DRV_LOG(ERR, "MR init tree failed."); rte_errno = ENOMEM; -- 2.25.1