From patchwork Thu Sep 30 17:28:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Baum X-Patchwork-Id: 100169 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 96201A0C43; Thu, 30 Sep 2021 19:39:46 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1862640DDA; Thu, 30 Sep 2021 19:39:46 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2057.outbound.protection.outlook.com [40.107.236.57]) by mails.dpdk.org (Postfix) with ESMTP id 0F1AA4067E for ; Thu, 30 Sep 2021 19:28:47 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lyd4lRvW4sr62WTQ4vT0BOENDdOKI+mN1SnVQLwkKWQ++cHZbj/roTj/lIvh5iDqCySMzDNs/h81RJC5e7Jk5lDujRfLpMSrXxh4LtcDJSVNqUVgjGIudPx+BC/idgC4TyHkAddwVhWSzTm6H+CQkrgfXDUBR9Do3THVEy5EtqXWhNP6M2sDkbq6oEgC1FkBW25Sge10w3riaebBQONt+egtcVAjb7B6zGw40xBsN46prLudfdkiE0oAiQvgC7qGSvaD2BEGZYn/0Rc9FSFwqA8AfcWzBjFPPUobGrE+S1mk1VirQDjIvpaoa/qztacDYbHnjRwzKlU4iYasdZhwuw== 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=lQYJC2+feK7zA6/qzpuNmulddY/tDdCVm/wSqSTXjSw=; b=a9wBKLslHoBn552oYwv5Eu9lfE4QAc8APMygS4dOZkEgdvq1FWtKzKO3Uyj5fjC+ovGwPiiZKBqg750Zv5+far3abuF4QIwjp8t5n6P+ZA1odXVEV9D8USkDGDVbKTunLPsXVVm90rMCtxMOt9QKPIqXGKWCobYhcfO3ItOKEuM7m/YleOabIoiD4+sDJ1wILDPxblc3n10OHpvrnJ3qiQbk6BGQVj+nJc/d/qJ+swFPmQVJ+5DPD5EzRPQzbhYIQRXJ+Nv05gxTkLx9E5eVjCRn7m8+PXGSpetCMxZmgf+g16SehmHevBZz2hA9yRhextisO4ehBszs4uSZHko0LQ== 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=lQYJC2+feK7zA6/qzpuNmulddY/tDdCVm/wSqSTXjSw=; b=jwuZ1s/vdZnhMSS0DO1DrzhOldvwIR9FicI1oj7Iqf6I/ps3gZG6QrEC8vY+C+E74WdN1c7dc/vOGqKlEdj6jca0ZRLboOC1Ls8XjOMSCgCYxLYh6Jeiux55kUVOtOot8NTDUCylsW664f0PPzPYRvRlUheFaaeQpSIVz2teeg9d19gIP5AObh32kx+BX9tbUQHfVMSkAmdgbySCeO4QApsXQGlM6UYJjzIgEATp3u125zhVk+tqQ/9vB3npw+xKNwv74ylq4ILJDCntp12/D+gOiTLpnz3KOrtflDz+KkR4L4eHQM40KAdRJhy3AzPYpoz2TECNkhT1SBC70HI+Yw== Received: from BN9PR03CA0883.namprd03.prod.outlook.com (2603:10b6:408:13c::18) by DM6PR12MB2793.namprd12.prod.outlook.com (2603:10b6:5:4f::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.19; Thu, 30 Sep 2021 17:28:45 +0000 Received: from BN8NAM11FT058.eop-nam11.prod.protection.outlook.com (2603:10b6:408:13c:cafe::ed) by BN9PR03CA0883.outlook.office365.com (2603:10b6:408:13c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.14 via Frontend Transport; Thu, 30 Sep 2021 17:28:45 +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 BN8NAM11FT058.mail.protection.outlook.com (10.13.177.58) 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:28:44 +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:28:43 +0000 From: To: CC: Matan Azrad , Thomas Monjalon , Michael Baum Date: Thu, 30 Sep 2021 20:28:04 +0300 Message-ID: <20210930172822.1949969-1-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 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: aeecd296-fabc-4f3d-ccc0-08d98437c12b X-MS-TrafficTypeDiagnostic: DM6PR12MB2793: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr 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: vhjFsNLgTj1q8i/g6zIOE7pzLTmzZxcsvcLRQv6CR6vCnGf1DGdBerCnnsNbc4qWeq7JknXvyWPz2DodxPDTxZ6RXv9DGROC1z3HTBIahWt3QMrREqrQd/n54FYX0Glmxs9SAzrQ/5n7yQPPHC6ZhOr8CeG4idU71NBJKy/yVY5qlYN2DrVbCGEm3wjvMKE3HNeGZxpM1a20P9Oy+uIaYAK5bqDTVAso7Sr+fSeglf/LANAuuBwoz3vNHwfTdrZRfrsoj6EawBZuthaNKLn0hi1awrjt/aBBP48FeGnmp0kbnws6ISLkpcEh0SgVoUoB1MLb7u1soIu9gROy3y+BnYn/lQMfv1rStljS/rplbEv4JT5ipKDHI25v7JBdLel/XefsIDwZerRvpeBa8n1NB24GIhTD0cRKN7YSgaXvqITS0tpB7gQ1eTM7T6ff5FH2BkCamyNqjWvEs4fIzavDp3JoIjInR5HkGnzFD6P9AtnK3qv9Md0s4PwhccPqUjLB6SqCUj2GyukBA8IuCMY+lWo5NWUBVQOJayih59nIz+sMN3MqwDuOkyNUHIlY7iByYSMOi5gArTkqvvOQp9LP2iAnmPbtBq5cK+JekPJnAZ8jOzmlYqSnL3ieIBRxBvzpZSK0pImmDpjZC4ZX0PIBJJgtnoQukJNAXRAx5cOmyECqSOKHq97tKGhjkzD26mKPRTIxAeLuYxIoxaaBGsGyB+RvP32xQPJx5IEplcET3m9io3qR4nEIuIt4z2c1uB+4//2oA5/Tx0Y/HbSv5OFtwgjw2MaWyNJ5YWb0apnkZxsk/3140m+InhpZPx3lZzsjdNHuJElNTwZZjs74nbuGFg== 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)(70206006)(54906003)(8936002)(966005)(1076003)(356005)(5660300002)(16526019)(186003)(7696005)(55016002)(2876002)(86362001)(316002)(7636003)(36756003)(2906002)(70586007)(107886003)(4326008)(26005)(6286002)(508600001)(83380400001)(6916009)(8676002)(36860700001)(82310400003)(336012)(2616005)(6666004)(47076005)(426003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Sep 2021 17:28:44.5918 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aeecd296-fabc-4f3d-ccc0-08d98437c12b 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: BN8NAM11FT058.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2793 X-Mailman-Approved-At: Thu, 30 Sep 2021 19:39:43 +0200 Subject: [dpdk-dev] [PATCH 00/18] mlx5: sharing global MR cache between drivers 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 The MLNX PMD supports 5 classes (net, RegEx, vDPA, Compress and Crypto). The various drivers are registered under the common driver, and managed by it. In the common driver probing, it calls in a loop the probe function of each driver registered to it. Each driver creates for itself all the objects required for communication with the hardware, as well as a global MR cache that manages memory mappings. The management of the caches separately by the different drivers, is not very efficient. In fact the same memory is managed several times and each caching handle is done by doubling the number of drivers, so we want to manage this cache jointly by the common driver. This feature will move management to common driver in two phases. Phase 1: sharing HW objects between drivers (11 patches) The communication with the hardware - for any MR handle - is conducted by the Protection Domain, so we are motivated to share it between the drivers. However, to create it we need to give the context of the device, so the context must also be shared between the drivers. At this point we will share between the drivers the next trio (CTX, PD, pdn) to create an infrastructure that will allow sharing of dependent objects, and in particular the global MR cache. The common driver itself will create this trio individually for all drivers, before calling their probe function. As a parameter to the probe function, it will give them a pointer to the structure containing the trio. Phase 2: sharing global MR cache between drivers (7 patches) The common driver will add to the structure containing the trio also the structure that manages the global MR cache, and will keep a list of such structures for memory management. In each driver, each queue will manage its own local MR cache. If the queue does not find its cache, it will switch to searching the global MR cache shared by all. Caching access will be through the pointer that the driver received as a parameter in probing. Depends-on: series-19267 ("mempool: add event callbacks") https://patchwork.dpdk.org/project/dpdk/list/?series=19267 Depends-on: series-19097 ("net/mlx5: support new global device syntax") https://patchwork.dpdk.org/project/dpdk/list/?series=19097 Michael Baum (18): net/mlx5/windows: fix miss callback register for mem event common/mlx5: share basic probing with the internal drivers common/mlx5: share common definitions common/mlx5: share memory related devargs net/mlx5/windows: rearrange probing code common/mlx5: move basic probing functions to common net/mlx5: remove redundant flag in device config common/mlx5: share device context object common/mlx5: add ROCE disable in context device creation common/mlx5: share the protection domain object common/mlx5: share the HCA capabilities handle net/mlx5: remove redundancy in MR file common/mlx5: add MR ctrl init function common/mlx5: add global MR cache create function common/mlx5: share MR top-half search function common/mlx5: share MR management common/mlx5: support device DMA map and unmap common/mlx5: share MR mempool registration drivers/common/mlx5/linux/mlx5_common_os.c | 280 +++++++- drivers/common/mlx5/linux/mlx5_common_os.h | 16 +- drivers/common/mlx5/linux/mlx5_common_verbs.c | 96 ++- drivers/common/mlx5/linux/mlx5_nl.c | 2 +- drivers/common/mlx5/linux/mlx5_nl.h | 6 +- drivers/common/mlx5/mlx5_common.c | 596 +++++++++++++++--- drivers/common/mlx5/mlx5_common.h | 96 +-- drivers/common/mlx5/mlx5_common_defs.h | 45 ++ drivers/common/mlx5/mlx5_common_mp.h | 11 + drivers/common/mlx5/mlx5_common_mr.c | 192 +++++- drivers/common/mlx5/mlx5_common_mr.h | 76 ++- drivers/common/mlx5/mlx5_common_private.h | 6 - drivers/common/mlx5/mlx5_devx_cmds.h | 12 +- drivers/common/mlx5/mlx5_malloc.h | 1 - drivers/common/mlx5/version.map | 29 +- drivers/common/mlx5/windows/mlx5_common_os.c | 245 ++++++- drivers/common/mlx5/windows/mlx5_common_os.h | 9 +- drivers/compress/mlx5/mlx5_compress.c | 223 ++----- drivers/crypto/mlx5/mlx5_crypto.c | 201 +----- drivers/crypto/mlx5/mlx5_crypto.h | 6 +- drivers/crypto/mlx5/mlx5_crypto_dek.c | 5 +- drivers/net/mlx5/linux/mlx5_ethdev_os.c | 6 +- drivers/net/mlx5/linux/mlx5_mp_os.c | 12 +- drivers/net/mlx5/linux/mlx5_os.c | 511 ++++----------- drivers/net/mlx5/linux/mlx5_verbs.c | 99 +-- drivers/net/mlx5/linux/mlx5_verbs.h | 2 - drivers/net/mlx5/meson.build | 1 - drivers/net/mlx5/mlx5.c | 241 ++----- drivers/net/mlx5/mlx5.h | 57 +- drivers/net/mlx5/mlx5_defs.h | 22 +- drivers/net/mlx5/mlx5_devx.c | 39 +- drivers/net/mlx5/mlx5_flow.c | 6 +- drivers/net/mlx5/mlx5_flow_aso.c | 50 +- drivers/net/mlx5/mlx5_flow_dv.c | 66 +- drivers/net/mlx5/mlx5_flow_verbs.c | 4 +- drivers/net/mlx5/mlx5_mr.c | 397 ------------ drivers/net/mlx5/mlx5_mr.h | 26 - drivers/net/mlx5/mlx5_rx.c | 16 +- drivers/net/mlx5/mlx5_rx.h | 20 +- drivers/net/mlx5/mlx5_rxq.c | 11 +- drivers/net/mlx5/mlx5_rxtx.c | 1 - drivers/net/mlx5/mlx5_rxtx.h | 27 - drivers/net/mlx5/mlx5_rxtx_vec.h | 1 - drivers/net/mlx5/mlx5_trigger.c | 8 +- drivers/net/mlx5/mlx5_tx.c | 1 - drivers/net/mlx5/mlx5_tx.h | 30 +- drivers/net/mlx5/mlx5_txpp.c | 23 +- drivers/net/mlx5/mlx5_txq.c | 10 +- drivers/net/mlx5/windows/mlx5_ethdev_os.c | 12 +- drivers/net/mlx5/windows/mlx5_os.c | 402 ++---------- drivers/regex/mlx5/mlx5_regex.c | 138 +--- drivers/regex/mlx5/mlx5_regex.h | 27 +- drivers/regex/mlx5/mlx5_regex_control.c | 19 +- drivers/regex/mlx5/mlx5_regex_fastpath.c | 47 +- drivers/regex/mlx5/mlx5_rxp.c | 62 +- drivers/vdpa/mlx5/mlx5_vdpa.c | 212 +------ drivers/vdpa/mlx5/mlx5_vdpa.h | 5 +- drivers/vdpa/mlx5/mlx5_vdpa_event.c | 25 +- drivers/vdpa/mlx5/mlx5_vdpa_lm.c | 6 +- drivers/vdpa/mlx5/mlx5_vdpa_mem.c | 13 +- drivers/vdpa/mlx5/mlx5_vdpa_steer.c | 11 +- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 15 +- 62 files changed, 2065 insertions(+), 2769 deletions(-) create mode 100644 drivers/common/mlx5/mlx5_common_defs.h delete mode 100644 drivers/net/mlx5/mlx5_mr.c delete mode 100644 drivers/net/mlx5/mlx5_mr.h