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 6AF38A0032; Tue, 16 Nov 2021 15:37:18 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 78F1641183; Tue, 16 Nov 2021 15:37:14 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2087.outbound.protection.outlook.com [40.107.92.87]) by mails.dpdk.org (Postfix) with ESMTP id 81B054117D for ; Tue, 16 Nov 2021 15:37:13 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nl1xVN3AS4S6g6rQiVoq27CARe8gD3xEu4LLLB7XzDS3kJ+pGZkuOuMOecf/Gv8ig4x/KG/kfP9LuqKvokKGLzNeM3JisFIVMU4tZQ5cTDFe9uE5OUsmK8TyTzvbazTk8k7A4/bZ0jV/NyBiGQrsPw6UExtTvs7FIDAc4ldSSnG3Xiiu2tEiiMNXaFhlUyWaX7T/si5/S+DvunB5j7yQaYSfi0JhjjtDxeLLbrdsCiZe6By/5xlLdkAbmnE2T1LkzEh7sJscyzICqxJMAlr7sJ9UoPvvm2C/M6SEV8WsDzLfJYOAZ9MIEellTsanle1tMS4DGYSSFsrcgvAbzHW9nQ== 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=sgqkfk15gyjwgN0a+1BouWTVFWkOxBwBgH7AS0o684o=; b=dwiU89sPopIg1Xxq5FznvDe6+YgFoCyO2DAqKRQW2ryGKQxDroLkYIBdU0oGZ1WQj9fZzMnGeZ2gLvfchLxxSBON23gfkTMHm77m1i50qIk6jbltzANWbRSlImFi1tSLf/NTBgbeFoOCbUNJA/EycX+E6ufGzIuInFiwsLcmlhGpiqfvDc4X5MhKgRPlk0e0BcRkk4XNeSZHbytyLN57r0dkz48/7v2oHkRO2YVTHN362tnaP7P1I08I5IT5gDxitRJL8dtI+IhPy7NY+NK19JLFistC3w1ZNcOcRN+KtN7QB0D5LrKV2lwl/uwUHwZ+N4OG+r0AWKJya8r4Qk46MQ== 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=sgqkfk15gyjwgN0a+1BouWTVFWkOxBwBgH7AS0o684o=; b=k7yjVORcA1qTlTOcCQko4qPhnVRnlrzFhP15OJmMK+is7LmDsOWXvROOX99TMGdYgvRC/ZubR0+0gH77zskLDbDUUJDg3RcXcXQDoWvJTRIAXlomMDiru2KM9ZToTNFJefENE6wN8b9bOIdK1MrdEBd4FEHpUvFk4qGROv2lsyeZ/mAp7vNux6cfSi7GtfUMITdD0r1iKiEbjbA4jPvdu4Nf5Ku9EekbC8VJKtnoPvY72bMfX1FF+3acb2AJjTcr+22i7hgK9mol8Mfg+jW1tf7FplJfReLO6eLgrca9OWDYcwAk/Fcgmntp5xNbkeO8hV9+cYMmRE/va60lKHpTsA== Received: from CO2PR04CA0089.namprd04.prod.outlook.com (2603:10b6:104:6::15) by BY5PR12MB3939.namprd12.prod.outlook.com (2603:10b6:a03:1a5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.16; Tue, 16 Nov 2021 14:37:11 +0000 Received: from CO1NAM11FT050.eop-nam11.prod.protection.outlook.com (2603:10b6:104:6:cafe::eb) by CO2PR04CA0089.outlook.office365.com (2603:10b6:104:6::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19 via Frontend Transport; Tue, 16 Nov 2021 14:37:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) 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 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 CO1NAM11FT050.mail.protection.outlook.com (10.13.174.79) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4690.15 via Frontend Transport; Tue, 16 Nov 2021 14:37:10 +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, 16 Nov 2021 14:37:08 +0000 From: To: CC: Matan Azrad , Thomas Monjalon , Michael Baum Subject: [PATCH] common/mlx5: fix redundant field in MR control structure Date: Tue, 16 Nov 2021 16:36:35 +0200 Message-ID: <20211116143635.1863313-1-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 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: 730abebd-50bb-4fcf-0152-08d9a90e92e5 X-MS-TrafficTypeDiagnostic: BY5PR12MB3939: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZgzxX1bKbbZXYmuyyB7025U/a1TFqixxTMdANt4/AvIwLIP1qO1W95DlKXuhVHHD0D3oMz9AdO98PU9OY6KODDEV4ln3nfZ9J9GtRu9eEgUDWMuaaZmI6Qt+niZsrtu75BV7T14WWFD/4kvGXezxduKFiZfioChYsL/Ey+4qALD1aohoBfXvDlsbMOqxBRNo2e7xjf+88zP/VjRAKRBR88V/U1nWnxjbONWCoiVBDJGCfWju9f7xKoOHhdnGM/Gzh4rAkZ6yTcF/N9mkej5Q9GWkuGr9ZwNDGDJ0phYyCJtEtU5NPdoV0tPmCGEhxfBr6BODLIjQcTRyHEDgNRbZkP3H+8c99D2PIB4Na5QbNbGMxZjxigqLU0ntBYcDZfPRyRhuQUjf0LqfChj8lC3LFPejuIdHHjO+u96k7dc7TFT6bSsxO+oPhfUg0l4NmfqYv9l+kutcvrEo/BKehPLT4gyR/RO4SCtobTCsZwNsZyxaUx030UO1B/7q/xs8BFL1keIibSUEoGty9cBDp5dVugCkxRaaNGdZlFv27NC5X3q/3Wkxd57JjUz+nhwRY7sWFzlvE7a1hG3LAneAOrOA9g9vgE7EOsxt6nl4HUhLiIRSvELfqmwgcbZCNba0PAHfxzhS4gpSLHfGwsdPkU0wVD2ey1iU2+yoPSO183SeVGsBa/YATyW6HW+ry4rsdkE/6zdRFv4lrLtm6GwVai7mUw== 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)(186003)(8936002)(70206006)(83380400001)(16526019)(26005)(356005)(2906002)(47076005)(508600001)(2876002)(336012)(7636003)(54906003)(316002)(70586007)(4326008)(1076003)(5660300002)(6916009)(7696005)(6666004)(8676002)(426003)(86362001)(6286002)(82310400003)(107886003)(36860700001)(55016002)(36756003)(30864003)(2616005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2021 14:37:10.7444 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 730abebd-50bb-4fcf-0152-08d9a90e92e5 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: CO1NAM11FT050.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB3939 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 From: Michael Baum Inside the MR control structure there is a pointer to the common device. This pointer enables access to the global cache as well as hardware objects that may be required in case a new MR needs to be created. The purpose of adding this pointer into the MR control structure was to avoid its transfer as a parameter to all the functions of searching MR in the caches. However, adding it to this structure increased the Rx and Tx data-path structures, all the fields that followed it were slightly moved away which caused to a reduction in performance. This patch removes the pointer from the structure. It can be accessed through the "dev_gen_ptr" existing field using the "container_of" operator. Fixes: 334ed198ab4d ("common/mlx5: remove redundant parameter in MR search") Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/common/mlx5/mlx5_common_mr.c | 42 +++++++++++++------------ drivers/common/mlx5/mlx5_common_mr.h | 8 ++--- drivers/compress/mlx5/mlx5_compress.c | 2 +- drivers/crypto/mlx5/mlx5_crypto.c | 2 +- drivers/net/mlx5/mlx5_rx.h | 13 ++------ drivers/net/mlx5/mlx5_rxq.c | 3 +- drivers/net/mlx5/mlx5_txq.c | 3 +- drivers/regex/mlx5/mlx5_regex_control.c | 3 +- 8 files changed, 36 insertions(+), 40 deletions(-) diff --git a/drivers/common/mlx5/mlx5_common_mr.c b/drivers/common/mlx5/mlx5_common_mr.c index 49feea4474..1d2a107597 100644 --- a/drivers/common/mlx5/mlx5_common_mr.c +++ b/drivers/common/mlx5/mlx5_common_mr.c @@ -292,8 +292,8 @@ mlx5_mr_btree_dump(struct mlx5_mr_btree *bt __rte_unused) * * @param mr_ctrl * Pointer to MR control structure. - * @param cdev - * Pointer to the mlx5 device structure. + * @param dev_gen_ptr + * Pointer to generation number of global cache. * @param socket * NUMA socket on which memory must be allocated. * @@ -301,16 +301,15 @@ mlx5_mr_btree_dump(struct mlx5_mr_btree *bt __rte_unused) * 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_mr_ctrl_init(struct mlx5_mr_ctrl *mr_ctrl, struct mlx5_common_device *cdev, +mlx5_mr_ctrl_init(struct mlx5_mr_ctrl *mr_ctrl, uint32_t *dev_gen_ptr, int socket) { if (mr_ctrl == NULL) { rte_errno = EINVAL; return -rte_errno; } - mr_ctrl->cdev = cdev; /* Save pointer of global generation number to check memory event. */ - mr_ctrl->dev_gen_ptr = &cdev->mr_scache.dev_gen; + mr_ctrl->dev_gen_ptr = dev_gen_ptr; /* Initialize B-tree and allocate memory for bottom-half cache table. */ return mlx5_mr_btree_init(&mr_ctrl->cache_bh, MLX5_MR_BTREE_CACHE_N, socket); @@ -930,7 +929,11 @@ static uint32_t mr_lookup_caches(struct mlx5_mr_ctrl *mr_ctrl, struct mr_cache_entry *entry, uintptr_t addr) { - struct mlx5_mr_share_cache *share_cache = &mr_ctrl->cdev->mr_scache; + struct mlx5_mr_share_cache *share_cache = + container_of(mr_ctrl->dev_gen_ptr, struct mlx5_mr_share_cache, + dev_gen); + struct mlx5_common_device *cdev = + container_of(share_cache, struct mlx5_common_device, mr_scache); struct mlx5_mr_btree *bt = &mr_ctrl->cache_bh; uint32_t lkey; uint16_t idx; @@ -955,7 +958,7 @@ mr_lookup_caches(struct mlx5_mr_ctrl *mr_ctrl, } rte_rwlock_read_unlock(&share_cache->rwlock); /* First time to see the address? Create a new MR. */ - lkey = mlx5_mr_create(mr_ctrl->cdev, share_cache, entry, addr); + lkey = mlx5_mr_create(cdev, share_cache, entry, addr); /* * Update the local cache if successfully created a new global MR. Even * if failed to create one, there's no action to take in this datapath @@ -1819,8 +1822,6 @@ mlx5_mempool_reg_addr2mr(struct mlx5_mempool_reg *mpr, uintptr_t addr, /** * Update bottom-half cache from the list of mempool registrations. * - * @param share_cache - * Pointer to a global shared MR cache. * @param mr_ctrl * Per-queue MR control handle. * @param entry @@ -1834,11 +1835,13 @@ mlx5_mempool_reg_addr2mr(struct mlx5_mempool_reg *mpr, uintptr_t addr, * MR lkey on success, UINT32_MAX on failure. */ static uint32_t -mlx5_lookup_mempool_regs(struct mlx5_mr_share_cache *share_cache, - struct mlx5_mr_ctrl *mr_ctrl, +mlx5_lookup_mempool_regs(struct mlx5_mr_ctrl *mr_ctrl, struct mr_cache_entry *entry, struct rte_mempool *mp, uintptr_t addr) { + struct mlx5_mr_share_cache *share_cache = + container_of(mr_ctrl->dev_gen_ptr, struct mlx5_mr_share_cache, + dev_gen); struct mlx5_mr_btree *bt = &mr_ctrl->cache_bh; struct mlx5_mempool_reg *mpr; uint32_t lkey = UINT32_MAX; @@ -1865,8 +1868,6 @@ mlx5_lookup_mempool_regs(struct mlx5_mr_share_cache *share_cache, /** * Bottom-half lookup for the address from the mempool. * - * @param share_cache - * Pointer to a global shared MR cache. * @param mr_ctrl * Per-queue MR control handle. * @param mp @@ -1877,8 +1878,7 @@ mlx5_lookup_mempool_regs(struct mlx5_mr_share_cache *share_cache, * MR lkey on success, UINT32_MAX on failure. */ uint32_t -mlx5_mr_mempool2mr_bh(struct mlx5_mr_share_cache *share_cache, - struct mlx5_mr_ctrl *mr_ctrl, +mlx5_mr_mempool2mr_bh(struct mlx5_mr_ctrl *mr_ctrl, struct rte_mempool *mp, uintptr_t addr) { struct mr_cache_entry *repl = &mr_ctrl->cache[mr_ctrl->head]; @@ -1891,8 +1891,7 @@ mlx5_mr_mempool2mr_bh(struct mlx5_mr_share_cache *share_cache, if (likely(lkey != UINT32_MAX)) { *repl = (*mr_ctrl->cache_bh.table)[bh_idx]; } else { - lkey = mlx5_lookup_mempool_regs(share_cache, mr_ctrl, repl, - mp, addr); + lkey = mlx5_lookup_mempool_regs(mr_ctrl, repl, mp, addr); /* Can only fail if the address is not from the mempool. */ if (unlikely(lkey == UINT32_MAX)) return UINT32_MAX; @@ -1909,7 +1908,11 @@ mlx5_mr_mb2mr_bh(struct mlx5_mr_ctrl *mr_ctrl, struct rte_mbuf *mb) { uint32_t lkey; uintptr_t addr = (uintptr_t)mb->buf_addr; - struct mlx5_common_device *cdev = mr_ctrl->cdev; + struct mlx5_mr_share_cache *share_cache = + container_of(mr_ctrl->dev_gen_ptr, struct mlx5_mr_share_cache, + dev_gen); + struct mlx5_common_device *cdev = + container_of(share_cache, struct mlx5_common_device, mr_scache); if (cdev->config.mr_mempool_reg_en) { struct rte_mempool *mp = NULL; @@ -1923,8 +1926,7 @@ mlx5_mr_mb2mr_bh(struct mlx5_mr_ctrl *mr_ctrl, struct rte_mbuf *mb) mp = buf->mp; } if (mp != NULL) { - lkey = mlx5_mr_mempool2mr_bh(&cdev->mr_scache, - mr_ctrl, mp, addr); + lkey = mlx5_mr_mempool2mr_bh(mr_ctrl, mp, addr); /* * Lookup can only fail on invalid input, e.g. "addr" * is not from "mp" or "mp" has MEMPOOL_F_NON_IO set. diff --git a/drivers/common/mlx5/mlx5_common_mr.h b/drivers/common/mlx5/mlx5_common_mr.h index dc7ddc3513..cc885c4521 100644 --- a/drivers/common/mlx5/mlx5_common_mr.h +++ b/drivers/common/mlx5/mlx5_common_mr.h @@ -66,7 +66,6 @@ struct mlx5_common_device; /* Per-queue MR control descriptor. */ struct mlx5_mr_ctrl { - struct mlx5_common_device *cdev; /* Pointer to the mlx5 common device.*/ uint32_t *dev_gen_ptr; /* Generation number of device to poll. */ uint32_t cur_gen; /* Generation number saved to flush caches. */ uint16_t mru; /* Index of last hit entry in top-half cache. */ @@ -211,14 +210,13 @@ mlx5_mr_mb2mr(struct mlx5_mr_ctrl *mr_ctrl, struct rte_mbuf *mbuf) /* mlx5_common_mr.c */ __rte_internal -int mlx5_mr_ctrl_init(struct mlx5_mr_ctrl *mr_ctrl, - struct mlx5_common_device *cdev, int socket); +int mlx5_mr_ctrl_init(struct mlx5_mr_ctrl *mr_ctrl, uint32_t *dev_gen_ptr, + int socket); __rte_internal void mlx5_mr_btree_free(struct mlx5_mr_btree *bt); void mlx5_mr_btree_dump(struct mlx5_mr_btree *bt __rte_unused); __rte_internal -uint32_t mlx5_mr_mempool2mr_bh(struct mlx5_mr_share_cache *share_cache, - struct mlx5_mr_ctrl *mr_ctrl, +uint32_t mlx5_mr_mempool2mr_bh(struct mlx5_mr_ctrl *mr_ctrl, struct rte_mempool *mp, uintptr_t addr); void mlx5_mr_release_cache(struct mlx5_mr_share_cache *mr_cache); int mlx5_mr_create_cache(struct mlx5_mr_share_cache *share_cache, int socket); diff --git a/drivers/compress/mlx5/mlx5_compress.c b/drivers/compress/mlx5/mlx5_compress.c index 9d5893e790..bb0dc3a5d2 100644 --- a/drivers/compress/mlx5/mlx5_compress.c +++ b/drivers/compress/mlx5/mlx5_compress.c @@ -206,7 +206,7 @@ mlx5_compress_qp_setup(struct rte_compressdev *dev, uint16_t qp_id, return -rte_errno; } dev->data->queue_pairs[qp_id] = qp; - if (mlx5_mr_ctrl_init(&qp->mr_ctrl, priv->cdev, + if (mlx5_mr_ctrl_init(&qp->mr_ctrl, &priv->cdev->mr_scache.dev_gen, priv->dev_config.socket_id)) { DRV_LOG(ERR, "Cannot allocate MR Btree for qp %u.", (uint32_t)qp_id); diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c index 3caa22f35f..607ef7cdd2 100644 --- a/drivers/crypto/mlx5/mlx5_crypto.c +++ b/drivers/crypto/mlx5/mlx5_crypto.c @@ -636,7 +636,7 @@ mlx5_crypto_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id, DRV_LOG(ERR, "Failed to create QP."); goto error; } - if (mlx5_mr_ctrl_init(&qp->mr_ctrl, priv->cdev, + if (mlx5_mr_ctrl_init(&qp->mr_ctrl, &priv->cdev->mr_scache.dev_gen, priv->dev_config.socket_id) != 0) { DRV_LOG(ERR, "Cannot allocate MR Btree for qp %u.", (uint32_t)qp_id); diff --git a/drivers/net/mlx5/mlx5_rx.h b/drivers/net/mlx5/mlx5_rx.h index 298d1b1f32..9cc1a2703b 100644 --- a/drivers/net/mlx5/mlx5_rx.h +++ b/drivers/net/mlx5/mlx5_rx.h @@ -316,8 +316,7 @@ mlx5_rx_addr2mr(struct mlx5_rxq_data *rxq, uintptr_t addr) if (likely(lkey != UINT32_MAX)) return lkey; mp = mlx5_rxq_mprq_enabled(rxq) ? rxq->mprq_mp : rxq->mp; - return mlx5_mr_mempool2mr_bh(&mr_ctrl->cdev->mr_scache, mr_ctrl, - mp, addr); + return mlx5_mr_mempool2mr_bh(mr_ctrl, mp, addr); } /** @@ -338,7 +337,6 @@ mlx5_rx_mb2mr(struct mlx5_rxq_data *rxq, struct rte_mbuf *mb) { struct mlx5_mr_ctrl *mr_ctrl = &rxq->mr_ctrl; uintptr_t addr = (uintptr_t)mb->buf_addr; - struct mlx5_rxq_ctrl *rxq_ctrl; uint32_t lkey; /* Linear search on MR cache array. */ @@ -346,13 +344,8 @@ mlx5_rx_mb2mr(struct mlx5_rxq_data *rxq, struct rte_mbuf *mb) MLX5_MR_CACHE_N, addr); if (likely(lkey != UINT32_MAX)) return lkey; - /* - * Slower search in the mempool database on miss. - * During queue creation rxq->sh is not yet set, so we use rxq_ctrl. - */ - rxq_ctrl = container_of(rxq, struct mlx5_rxq_ctrl, rxq); - return mlx5_mr_mempool2mr_bh(&rxq_ctrl->sh->cdev->mr_scache, - mr_ctrl, mb->pool, addr); + /* Slower search in the mempool database on miss. */ + return mlx5_mr_mempool2mr_bh(mr_ctrl, mb->pool, addr); } /** diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 52b95d7070..61ef4edff0 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -1675,7 +1675,8 @@ mlx5_rxq_new(struct rte_eth_dev *dev, struct mlx5_rxq_priv *rxq, goto error; } tmpl->type = MLX5_RXQ_TYPE_STANDARD; - if (mlx5_mr_ctrl_init(&tmpl->rxq.mr_ctrl, priv->sh->cdev, socket)) { + if (mlx5_mr_ctrl_init(&tmpl->rxq.mr_ctrl, + &priv->sh->cdev->mr_scache.dev_gen, socket)) { /* rte_errno is already set. */ goto error; } diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c index 2140a328a2..4e0bf7af9c 100644 --- a/drivers/net/mlx5/mlx5_txq.c +++ b/drivers/net/mlx5/mlx5_txq.c @@ -1079,7 +1079,8 @@ mlx5_txq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, rte_errno = ENOMEM; return NULL; } - if (mlx5_mr_ctrl_init(&tmpl->txq.mr_ctrl, priv->sh->cdev, socket)) { + if (mlx5_mr_ctrl_init(&tmpl->txq.mr_ctrl, + &priv->sh->cdev->mr_scache.dev_gen, socket)) { /* rte_errno is already set. */ goto error; } diff --git a/drivers/regex/mlx5/mlx5_regex_control.c b/drivers/regex/mlx5/mlx5_regex_control.c index 9d5b4bd174..6ab62a12fc 100644 --- a/drivers/regex/mlx5/mlx5_regex_control.c +++ b/drivers/regex/mlx5/mlx5_regex_control.c @@ -247,7 +247,8 @@ mlx5_regex_qp_setup(struct rte_regexdev *dev, uint16_t qp_ind, nb_sq_config++; } - ret = mlx5_mr_ctrl_init(&qp->mr_ctrl, priv->cdev, rte_socket_id()); + ret = mlx5_mr_ctrl_init(&qp->mr_ctrl, &priv->cdev->mr_scache.dev_gen, + rte_socket_id()); if (ret) { DRV_LOG(ERR, "Error setting up mr btree"); goto err_btree; -- 2.25.1