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 3946AA0093; Sun, 2 Jan 2022 08:07:08 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4012D41141; Sun, 2 Jan 2022 08:07:04 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2062.outbound.protection.outlook.com [40.107.220.62]) by mails.dpdk.org (Postfix) with ESMTP id 4F0E540698 for ; Sun, 2 Jan 2022 08:07:02 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dZ4rt7JeJo5Rz4wsu/aVvAWq8p6hIrtJSMjYh4d02Ry3uqy6JqNEPvLKRUrmbcwFb1clYBc0VRqfofErlYk3J6dg8tZ4YDXdy7AjkWe3llIKGDIMPv4rn/HEuakdL60m/AjFDA+6pkhIXBbVV7mvvsgoZrZkQAZD/ySZVfv5Gc0v1bv9otFWHuSLSRHF0tQJiCMYXZZfkRPrKrl4+W2QntgS5IOgYemLy4yyvcVKwM1o0o1oZSl9zMCBuWhmVkuUAU0sKMFkOYAuyFawD+GaMXFdUXADVecD1aDNw5DOWRJl41sPv1t8z0HkH36JZ0F10v7mZXNtfZbrfR/x1VYgag== 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=/5osMn1o2lpKet5rZC+zD9QiI2GYfRkcQzj9rJFp4oc=; b=WVjPMCn5fQfMeuHK21OJiBhhRjcJ+mj659TFlJG3zWUQcp4DwnqL4LD4ABNZdOv06ejEXhUTz+nvNMaTYlnZRrIoxSQk4frlQEQ+BcSPiBDxrif0R+i0I1nxEJPaueBlzd/1fQQZqDiPLYFZQez8miW9/Rze2ROjcyNP40eNbc0y1NgY8hHmLwXBsvhooF5YgphWTTADwvqTEhJlJEy+WQET5mFl3Ykmr6Sihc3mB7WgxYOKOyZDpK4xgz18wqgVbBNJHMmXpMeh8kmMgGcQcdO0cOrNQs2asZ6AcZZM9tKXt1gYsWGRdlxQMvGsuHWq8zbTw/xFYoJIGKKNZfBwyQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) 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=/5osMn1o2lpKet5rZC+zD9QiI2GYfRkcQzj9rJFp4oc=; b=qQxEioEvYLFlFA4WycMKxIlDCr8ZoKI39raFAJ37/WWXfvuL4fyd5nrZHKX7e2UIhOJ6X62okbWy+H73CytlRZsQfFYwT4nIvYIM9qzw8OtOlEg1WJ1ykzIo20g0sV392aqq2V4FMppMFroM+TNq9bEo08SajdyP6ohzD/UkLUmz7o9d3YICoG2KlVfZDtq3o7cPJfhCu+hrbQe7ODzEBqHfb4zakvm1Dfr+q3nC1A8zEApbQs/LsY8+Gym2rZMhfx2wJWgIaTRA8YMVCLze0dYKkkLg/4qAdOD95D6gHINsuMkYax91zXBIcDBXVyewuVbMZ9JIqB6/SXhVp+tqPA== Received: from MW2PR16CA0023.namprd16.prod.outlook.com (2603:10b6:907::36) by DM6PR12MB3228.namprd12.prod.outlook.com (2603:10b6:5:18c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4844.15; Sun, 2 Jan 2022 07:07:00 +0000 Received: from CO1NAM11FT033.eop-nam11.prod.protection.outlook.com (2603:10b6:907:0:cafe::1f) by MW2PR16CA0023.outlook.office365.com (2603:10b6:907::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4844.14 via Frontend Transport; Sun, 2 Jan 2022 07:07:00 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.238) 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.238 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.238; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.238) by CO1NAM11FT033.mail.protection.outlook.com (10.13.174.247) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4844.14 via Frontend Transport; Sun, 2 Jan 2022 07:07:00 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Sun, 2 Jan 2022 07:06:59 +0000 Received: from nvidia.com (172.20.187.6) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.986.9; Sat, 1 Jan 2022 23:06:57 -0800 From: To: CC: Matan Azrad , Raslan Darawsheh , Viacheslav Ovsiienko , Michael Baum Subject: [RFC 1/3] common/mlx5: glue device and PD importation Date: Sun, 2 Jan 2022 09:06:36 +0200 Message-ID: <20220102070638.2211160-2-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220102070638.2211160-1-michaelba@nvidia.com> References: <20220102070638.2211160-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: HQMAIL107.nvidia.com (172.20.187.13) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 443b5278-8dfa-44a4-97fc-08d9cdbe78b8 X-MS-TrafficTypeDiagnostic: DM6PR12MB3228:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YiiToGXsI1U/n1R6cpGXyCEd+SHAVupPNu+LgG5XnPMOk83lKoFbTLefBbvbrv9FviMzmAj+mhuHNFYoICKXmdFlU5XLkxmzNRFAS/fpoATfaUnEY9RMurPkRqzIFITp1f10nSGMcpd1pJPJE+8IPf/tfM/JFg1TedDaxkNmbUAcrjZD0/Go21SJlnY2iBHU8M0Jeu3c95i+pQZZXyaYet68wJUHUh/UcbNzVQq6UgUE6670D8UBnrvImHkaVmBjDv2RTgvyqC7NVI55sHjHWjNiZllF6GBXFhV5msFoIm1pVCW8PRPbXGeXmsepcZA64NqjZeDKpYm8vjYs5lPyGHarHS9mjirBxizax3MXpnK6OY16kFetFxJ2F81cvQXeW/O5OgJDXLYMvxcZZd2qHYf8rBTIQ3neEzj3Y1+xLLYb7Zvxx0Z5G6QPhGVZGeewz4iNP4Kotj+OWKpXAOqi2Baqy8b4qlhJc7kEbsFT7J1lUtx4i4k4Sq4Edz5xo5J/phhbbZKmuxT/NOva1McVTnlKVEUs40EvgXZjrUS3TFO2nnZsjpKAGnicXaABm1YCk3L/mjkac+Ik0kbRc2FooyTpufZwgWltdAnpgs9bK5a2xeGSWwK+9R8YYEcQBToENR1GvGsB6p1cMiNIy+4HspWUY93/jx4hKcC/77RnL/HHEiOC95VwAoarcyv1Zp0o53qb6UYN+sxEjdLAsvkOyp1jJEblUB54SKf9zmZBIuyhp0Of8epeUqGcznTCTdjYmWvHk4Dpjbup63piehtv6lgfyZKzWaaKO9c0xscc5Og= X-Forefront-Antispam-Report: CIP:12.22.5.238; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(4636009)(40470700002)(46966006)(36840700001)(4326008)(70206006)(426003)(1076003)(70586007)(86362001)(2616005)(107886003)(2906002)(5660300002)(316002)(47076005)(6286002)(508600001)(6666004)(336012)(55016003)(8676002)(8936002)(83380400001)(36860700001)(16526019)(36756003)(40460700001)(7696005)(6916009)(26005)(186003)(356005)(81166007)(54906003)(2876002)(82310400004)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jan 2022 07:07:00.1385 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 443b5278-8dfa-44a4-97fc-08d9cdbe78b8 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.238]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT033.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3228 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 Add support for rdma-core API to import device. The API gets ibv_context file descriptor and returns an ibv_context pointer that is associated with the given file descriptor. Add also support for rdma-core API to import PD. The API gets ibv_context and PD handle and returns a protection domain (PD) that is associated with the given handle in the given context. Signed-off-by: Michael Baum --- drivers/common/mlx5/linux/mlx5_glue.c | 21 +++++++++++++++++++++ drivers/common/mlx5/linux/mlx5_glue.h | 4 ++++ 2 files changed, 25 insertions(+) diff --git a/drivers/common/mlx5/linux/mlx5_glue.c b/drivers/common/mlx5/linux/mlx5_glue.c index bc6622053f..2f70e7f320 100644 --- a/drivers/common/mlx5/linux/mlx5_glue.c +++ b/drivers/common/mlx5/linux/mlx5_glue.c @@ -34,6 +34,18 @@ mlx5_glue_dealloc_pd(struct ibv_pd *pd) return ibv_dealloc_pd(pd); } +static struct ibv_pd * +mlx5_glue_import_pd(struct ibv_context *context, uint32_t pd_handle) +{ + return ibv_import_pd(context, pd_handle); +} + +static void +mlx5_glue_unimport_pd(struct ibv_pd *pd) +{ + ibv_unimport_pd(pd); +} + static struct ibv_device ** mlx5_glue_get_device_list(int *num_devices) { @@ -52,6 +64,12 @@ mlx5_glue_open_device(struct ibv_device *device) return ibv_open_device(device); } +static struct ibv_context * +mlx5_glue_import_device(int cmd_fd) +{ + return ibv_import_device(cmd_fd); +} + static int mlx5_glue_close_device(struct ibv_context *context) { @@ -1402,9 +1420,12 @@ const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue) { .fork_init = mlx5_glue_fork_init, .alloc_pd = mlx5_glue_alloc_pd, .dealloc_pd = mlx5_glue_dealloc_pd, + .import_pd = mlx5_glue_import_pd, + .unimport_pd = mlx5_glue_unimport_pd, .get_device_list = mlx5_glue_get_device_list, .free_device_list = mlx5_glue_free_device_list, .open_device = mlx5_glue_open_device, + .import_device = mlx5_glue_import_device, .close_device = mlx5_glue_close_device, .query_device = mlx5_glue_query_device, .query_device_ex = mlx5_glue_query_device_ex, diff --git a/drivers/common/mlx5/linux/mlx5_glue.h b/drivers/common/mlx5/linux/mlx5_glue.h index 4e6d31f263..5ed38e4fd9 100644 --- a/drivers/common/mlx5/linux/mlx5_glue.h +++ b/drivers/common/mlx5/linux/mlx5_glue.h @@ -151,9 +151,13 @@ struct mlx5_glue { int (*fork_init)(void); struct ibv_pd *(*alloc_pd)(struct ibv_context *context); int (*dealloc_pd)(struct ibv_pd *pd); + struct ibv_pd *(*import_pd)(struct ibv_context *context, + uint32_t pd_handle); + void (*unimport_pd)(struct ibv_pd *pd); struct ibv_device **(*get_device_list)(int *num_devices); void (*free_device_list)(struct ibv_device **list); struct ibv_context *(*open_device)(struct ibv_device *device); + struct ibv_context *(*import_device)(int cmd_fd); int (*close_device)(struct ibv_context *context); int (*query_device)(struct ibv_context *context, struct ibv_device_attr *device_attr); -- 2.25.1