get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/100175/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 100175,
    "url": "http://patches.dpdk.org/api/patches/100175/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210930172822.1949969-7-michaelba@nvidia.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20210930172822.1949969-7-michaelba@nvidia.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210930172822.1949969-7-michaelba@nvidia.com",
    "date": "2021-09-30T17:28:10",
    "name": "[06/18] common/mlx5: move basic probing functions to common",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "c8823e3983aec1a495613bc0dd351ae4dcbb678d",
    "submitter": {
        "id": 1949,
        "url": "http://patches.dpdk.org/api/people/1949/?format=api",
        "name": "Michael Baum",
        "email": "michaelba@nvidia.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20210930172822.1949969-7-michaelba@nvidia.com/mbox/",
    "series": [
        {
            "id": 19311,
            "url": "http://patches.dpdk.org/api/series/19311/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=19311",
            "date": "2021-09-30T17:28:04",
            "name": "mlx5: sharing global MR cache between drivers",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/19311/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/100175/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/100175/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "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])\n\tby inbox.dpdk.org (Postfix) with ESMTP id D0A70A0C43;\n\tThu, 30 Sep 2021 19:40:24 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 5B78C4113A;\n\tThu, 30 Sep 2021 19:39:52 +0200 (CEST)",
            "from NAM12-BN8-obe.outbound.protection.outlook.com\n (mail-bn8nam12on2083.outbound.protection.outlook.com [40.107.237.83])\n by mails.dpdk.org (Postfix) with ESMTP id 82A4C410E5\n for <dev@dpdk.org>; Thu, 30 Sep 2021 19:28:57 +0200 (CEST)",
            "from BN0PR02CA0057.namprd02.prod.outlook.com (2603:10b6:408:e5::32)\n by DM6PR12MB3273.namprd12.prod.outlook.com (2603:10b6:5:188::17) with\n Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.14; Thu, 30 Sep\n 2021 17:28:55 +0000",
            "from BN8NAM11FT010.eop-nam11.prod.protection.outlook.com\n (2603:10b6:408:e5:cafe::b3) by BN0PR02CA0057.outlook.office365.com\n (2603:10b6:408:e5::32) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.14 via Frontend\n Transport; Thu, 30 Sep 2021 17:28:55 +0000",
            "from mail.nvidia.com (216.228.112.34) by\n BN8NAM11FT010.mail.protection.outlook.com (10.13.177.53) with Microsoft SMTP\n Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id\n 15.20.4566.14 via Frontend Transport; Thu, 30 Sep 2021 17:28:54 +0000",
            "from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com\n (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 30 Sep\n 2021 17:28:52 +0000"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;\n b=J3TkDL8Lr8VXVc73XWJ/t8idKNUMLE9xJwcMOUrJUKLtbW9K28m8UOXnHlJ/ISFmRMWsX6WU2lfKK456RghVqbLJDTLhN1n4lJT6PlQb0KBTDa60teUNfIxeQie+0q6pw5/tQ6dx/sn72A2vZhPw7CMgIZ0J2Wl/LnAcjFmBz+UibH9rzhGcR9dK7z3R67/uFJDHRxN6Pn4RZkzmIdjoc1OXlOGw4oTFlaVM6mw1X68tt0o1NQ0cREoe70pXL0FqTv0OfbSTndtZTX/7dJQWp9lRo6Y+ZFBm4pdziQ6o+SX8P5MdWVcwPSnQnEk7fHQoLl9TsjidDp7m/DMRCu1BLw==",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n s=arcselector9901;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version;\n bh=y/ueSUHu/js52gAvMmtWld2kOVcJnMUyQem30hnwhzY=;\n b=Gq04RML9FwGjN6WypPsh00OhGDDGHKNQnecxW0b/L0I4Nem/dHPicOSf88o+WEN0+pd/M3My7UcP9SqYc4mGjKlZngGOVM8TdAveAR60QV84ST+U80vlKI4iJKUnqA0gmHbbBJnRHPqB4i5swdB+BMPzH4Lpqe76swRtvmSFKbnwpzria+EXoF4ZEl12c4n+F49lopoFax3w0TpwGJg5/k9XOCmxYu5jQNldHwHqgPluNGivM6+DNY5KWXWhIW/DQIi5QwDcfLnxS5dAW5bOJCkqLvRv0uGz5t4QzITavYAI+SlQh6Djj/t8jQu8IcEJZAf3gux2LymPrSdnsk14oA==",
        "ARC-Authentication-Results": "i=1; mx.microsoft.com 1; spf=pass (sender ip is\n 216.228.112.34) smtp.rcpttodomain=monjalon.net smtp.mailfrom=nvidia.com;\n dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=nvidia.com;\n dkim=none (message not signed); arc=none",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com;\n s=selector2;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n bh=y/ueSUHu/js52gAvMmtWld2kOVcJnMUyQem30hnwhzY=;\n b=mNH74890n13gznvYEYBrubCwFEk435kfpTvUIycPKRTRERwdQW+2se9w1NCrLEtV0o0q3D4smK9W92okpugPi2/fxohmJv4m+G84IX9e60bX/tWxBD/MHbReOfB9gnFOh/xmqarS49smHzDQHjFhflhNLH0BILXx87pcCZEgdUevpHihgi/zphG7oUQABzAz1diFFDhq5EVYv4a01sXHbB49DTteD+QgUGUrRlDK2sEVMmJQawmSxNwa6ub18J58IsMwzbuywak25iI1zCgFTXf/DbCD/Y7c6yaN1PjUEVfFcZUAUwmv8EcQP3Uczr8RrGDkAK7hsesqm1ey6RFZcA==",
        "X-MS-Exchange-Authentication-Results": "spf=pass (sender IP is 216.228.112.34)\n smtp.mailfrom=nvidia.com; monjalon.net; dkim=none (message not signed)\n header.d=none;monjalon.net; dmarc=pass action=none header.from=nvidia.com;",
        "Received-SPF": "Pass (protection.outlook.com: domain of nvidia.com designates\n 216.228.112.34 as permitted sender) receiver=protection.outlook.com;\n client-ip=216.228.112.34; helo=mail.nvidia.com;",
        "From": "<michaelba@nvidia.com>",
        "To": "<dev@dpdk.org>",
        "CC": "Matan Azrad <matan@nvidia.com>, Thomas Monjalon <thomas@monjalon.net>,\n Michael Baum <michaelba@oss.nvidia.com>",
        "Date": "Thu, 30 Sep 2021 20:28:10 +0300",
        "Message-ID": "<20210930172822.1949969-7-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\n HQMAIL107.nvidia.com (172.20.187.13)",
        "X-EOPAttributedMessage": "0",
        "X-MS-PublicTrafficType": "Email",
        "X-MS-Office365-Filtering-Correlation-Id": "729e1248-c216-4fd0-6820-08d98437c735",
        "X-MS-TrafficTypeDiagnostic": "DM6PR12MB3273:",
        "X-LD-Processed": "43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr",
        "X-Microsoft-Antispam-PRVS": "\n <DM6PR12MB3273D0D00700A17D57CB1C4ACCAA9@DM6PR12MB3273.namprd12.prod.outlook.com>",
        "X-MS-Oob-TLC-OOBClassifiers": "OLM:2;",
        "X-MS-Exchange-SenderADCheck": "1",
        "X-MS-Exchange-AntiSpam-Relay": "0",
        "X-Microsoft-Antispam": "BCL:0;",
        "X-Microsoft-Antispam-Message-Info": "\n wt/NIqhEx9M8nIs8nFzwQyB9vY3/4wvNdQDtPzEZNC7yaPWiQx7hDzw9z9m23ZUjf7k1FWW5HFbi07n70fR6fGENIJ6xdGm9vlzm8WC8Ofu3p2P1cp2tCav6VsJgqkvyRkZ9wHVtGfFFAW8szKRAGSZFUJ53jfn2zJmu+lfERIyFljYTg8OAb4yoNTs0LHSnoIRuf5qr10xC218Lsy3NZgj5PgdGSKAy6Alfmxgix11QSPqKk4WECsQ6+ccuiSEm+bSeuuzg2uR/xTNcDymhtKIq6/DRhcD1eFgSixZojUIOVhhILHbsAWbyXIUL00K2Ky946Ij4AnXjBSew3Z2kVeus+DHG8jMSqORxXni8RWGd9fd8GE47qrjD/znjHpOsdFZhfWhiPBgCHRudOemEOAkKVbfpiI7hbF0Ill2f6HwU4mU8rrYZn57jZv52EqqB5yx9xDsZx5I6cFf2htAHT1HKgpGaPOm1csi9wcF+x9Tly+a5Nc0T9MDyLQTYiu1ZgJe3b0LjpeyxawDIxdT65B4dR25US8PVYsz8gAdGwW5kskw+rFBX7d3Z0iokztI25y3ljSSRiECi2oTnZ9VrdUlRaZSZ7ARp2ftlTDkGBcdkl9nMyVLCSKOdIvbsFkbs5gYrUPruG10EULHLU9OPuPkaSLPLn8Cfmq//jvLER4ed4iAt4wn6htq55U2fYtafVlBjZtVqBJdohAjspIx67M7u5FGtClTG0zYEdcecMAs=",
        "X-Forefront-Antispam-Report": "CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1;\n SRV:;\n IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE;\n SFS:(4636009)(46966006)(36840700001)(8936002)(8676002)(5660300002)(6666004)(6286002)(316002)(7696005)(70206006)(47076005)(508600001)(6916009)(30864003)(70586007)(426003)(54906003)(83380400001)(336012)(26005)(107886003)(36756003)(356005)(4326008)(2876002)(55016002)(2616005)(2906002)(1076003)(186003)(16526019)(7636003)(86362001)(36860700001)(82310400003)(309714004);\n DIR:OUT; SFP:1101;",
        "X-OriginatorOrg": "Nvidia.com",
        "X-MS-Exchange-CrossTenant-OriginalArrivalTime": "30 Sep 2021 17:28:54.6681 (UTC)",
        "X-MS-Exchange-CrossTenant-Network-Message-Id": "\n 729e1248-c216-4fd0-6820-08d98437c735",
        "X-MS-Exchange-CrossTenant-Id": "43083d15-7273-40c1-b7db-39efd9ccc17a",
        "X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp": "\n TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34];\n Helo=[mail.nvidia.com]",
        "X-MS-Exchange-CrossTenant-AuthSource": "\n BN8NAM11FT010.eop-nam11.prod.protection.outlook.com",
        "X-MS-Exchange-CrossTenant-AuthAs": "Anonymous",
        "X-MS-Exchange-CrossTenant-FromEntityHeader": "HybridOnPrem",
        "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "DM6PR12MB3273",
        "X-Mailman-Approved-At": "Thu, 30 Sep 2021 19:39:43 +0200",
        "Subject": "[dpdk-dev] [PATCH 06/18] common/mlx5: move basic probing functions\n to common",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: Michael Baum <michaelba@oss.nvidia.com>\n\nMove open IBV/DevX device function to common.\n\nSigned-off-by: Michael Baum <michaelba@oss.nvidia.com>\nAcked-by: Matan Azrad <matan@nvidia.com>\n---\n drivers/common/mlx5/linux/mlx5_common_os.c    |  86 ++++++\n drivers/common/mlx5/linux/mlx5_common_os.h    |   3 +\n drivers/common/mlx5/linux/mlx5_common_verbs.c |  70 +++++\n drivers/common/mlx5/mlx5_common.h             |   6 +\n drivers/common/mlx5/version.map               |   1 +\n drivers/common/mlx5/windows/mlx5_common_os.c  | 161 ++++++++++\n drivers/net/mlx5/linux/mlx5_os.c              | 289 ++++--------------\n drivers/net/mlx5/mlx5.c                       |   8 +-\n drivers/net/mlx5/mlx5.h                       |   5 +-\n drivers/net/mlx5/windows/mlx5_os.c            | 181 +----------\n 10 files changed, 411 insertions(+), 399 deletions(-)",
    "diff": "diff --git a/drivers/common/mlx5/linux/mlx5_common_os.c b/drivers/common/mlx5/linux/mlx5_common_os.c\nindex 9e0c823c97..2aa5684b05 100644\n--- a/drivers/common/mlx5/linux/mlx5_common_os.c\n+++ b/drivers/common/mlx5/linux/mlx5_common_os.c\n@@ -16,6 +16,7 @@\n \n #include \"mlx5_common.h\"\n #include \"mlx5_common_log.h\"\n+#include \"mlx5_common_defs.h\"\n #include \"mlx5_common_os.h\"\n #include \"mlx5_glue.h\"\n \n@@ -428,3 +429,88 @@ mlx5_os_get_ibv_device(const struct rte_pci_addr *addr)\n \tmlx5_glue->free_device_list(ibv_list);\n \treturn ibv_match;\n }\n+\n+static int\n+mlx5_config_doorbell_mapping_env(int dbnc)\n+{\n+\tchar *env;\n+\tint value;\n+\n+\tMLX5_ASSERT(rte_eal_process_type() == RTE_PROC_PRIMARY);\n+\t/* Get environment variable to store. */\n+\tenv = getenv(MLX5_SHUT_UP_BF);\n+\tvalue = env ? !!strcmp(env, \"0\") : MLX5_ARG_UNSET;\n+\tif (dbnc == MLX5_ARG_UNSET)\n+\t\tsetenv(MLX5_SHUT_UP_BF, MLX5_SHUT_UP_BF_DEFAULT, 1);\n+\telse\n+\t\tsetenv(MLX5_SHUT_UP_BF,\n+\t\t       dbnc == MLX5_TXDB_NCACHED ? \"1\" : \"0\", 1);\n+\treturn value;\n+}\n+\n+static void\n+mlx5_restore_doorbell_mapping_env(int value)\n+{\n+\tMLX5_ASSERT(rte_eal_process_type() == RTE_PROC_PRIMARY);\n+\t/* Restore the original environment variable state. */\n+\tif (value == MLX5_ARG_UNSET)\n+\t\tunsetenv(MLX5_SHUT_UP_BF);\n+\telse\n+\t\tsetenv(MLX5_SHUT_UP_BF, value ? \"1\" : \"0\", 1);\n+}\n+\n+/**\n+ * Function API to open IB device.\n+ *\n+ *\n+ * @param cdev\n+ *   Pointer to the mlx5 device.\n+ * @param ctx_ptr\n+ *   Pointer to fill inside pointer to device context.\n+ *\n+ * @return\n+ *   0 on success, a negative errno value otherwise and rte_errno is set.\n+ */\n+int\n+mlx5_os_open_device(struct mlx5_common_device *cdev, void **ctx_ptr)\n+{\n+\tstruct ibv_device *ibv;\n+\tstruct ibv_context *ctx = NULL;\n+\tint dbmap_env;\n+\n+\tibv = mlx5_os_get_ibv_dev(cdev->dev);\n+\tif (!ibv)\n+\t\treturn -rte_errno;\n+\tDRV_LOG(INFO, \"Dev information matches for device \\\"%s\\\".\", ibv->name);\n+\t/*\n+\t * Configure environment variable \"MLX5_BF_SHUT_UP\" before the device\n+\t * creation. The rdma_core library checks the variable at device\n+\t * creation and stores the result internally.\n+\t */\n+\tdbmap_env = mlx5_config_doorbell_mapping_env(cdev->config.dbnc);\n+\t/* Try to open IB device with DV first, then usual Verbs. */\n+\terrno = 0;\n+\tctx = mlx5_glue->dv_open_device(ibv);\n+\tif (ctx) {\n+\t\tcdev->config.devx = 1;\n+\t\tDRV_LOG(DEBUG, \"DevX is supported.\");\n+\t} else {\n+\t\t/* The environment variable is still configured. */\n+\t\tctx = mlx5_glue->open_device(ibv);\n+\t\tif (ctx == NULL)\n+\t\t\tgoto error;\n+\t\tDRV_LOG(DEBUG, \"DevX is NOT supported.\");\n+\t}\n+\t/* The device is created, no need for environment. */\n+\tmlx5_restore_doorbell_mapping_env(dbmap_env);\n+\t/* Hint libmlx5 to use PMD allocator for data plane resources */\n+\tmlx5_set_context_attr(cdev->dev, ctx);\n+\t*ctx_ptr = (void *)ctx;\n+\treturn 0;\n+error:\n+\trte_errno = errno ? errno : ENODEV;\n+\t/* The device creation is failed, no need for environment. */\n+\tmlx5_restore_doorbell_mapping_env(dbmap_env);\n+\tDRV_LOG(ERR, \"Failed to open IB device \\\"%s\\\".\", ibv->name);\n+\treturn -rte_errno;\n+}\ndiff --git a/drivers/common/mlx5/linux/mlx5_common_os.h b/drivers/common/mlx5/linux/mlx5_common_os.h\nindex c3202b6786..05c8ae1ba5 100644\n--- a/drivers/common/mlx5/linux/mlx5_common_os.h\n+++ b/drivers/common/mlx5/linux/mlx5_common_os.h\n@@ -296,4 +296,7 @@ __rte_internal\n struct ibv_device *\n mlx5_os_get_ibv_dev(const struct rte_device *dev);\n \n+void\n+mlx5_set_context_attr(struct rte_device *dev, struct ibv_context *ctx);\n+\n #endif /* RTE_PMD_MLX5_COMMON_OS_H_ */\ndiff --git a/drivers/common/mlx5/linux/mlx5_common_verbs.c b/drivers/common/mlx5/linux/mlx5_common_verbs.c\nindex 9080bd3e87..e5a1244867 100644\n--- a/drivers/common/mlx5/linux/mlx5_common_verbs.c\n+++ b/drivers/common/mlx5/linux/mlx5_common_verbs.c\n@@ -12,6 +12,7 @@\n \n #include <rte_errno.h>\n #include <rte_bus_pci.h>\n+#include <rte_eal_paging.h>\n #include <rte_bus_auxiliary.h>\n \n #include \"mlx5_common_utils.h\"\n@@ -19,6 +20,7 @@\n #include \"mlx5_common_private.h\"\n #include \"mlx5_autoconf.h\"\n #include <mlx5_glue.h>\n+#include <mlx5_malloc.h>\n #include <mlx5_common.h>\n #include <mlx5_common_mr.h>\n \n@@ -38,6 +40,74 @@ mlx5_os_get_ibv_dev(const struct rte_device *dev)\n \treturn ibv;\n }\n \n+/**\n+ * Verbs callback to allocate a memory. This function should allocate the space\n+ * according to the size provided residing inside a huge page.\n+ * Please note that all allocation must respect the alignment from libmlx5\n+ * (i.e. currently rte_mem_page_size()).\n+ *\n+ * @param[in] size\n+ *   The size in bytes of the memory to allocate.\n+ * @param[in] data\n+ *   A pointer to the callback data.\n+ *\n+ * @return\n+ *   Allocated buffer, NULL otherwise and rte_errno is set.\n+ */\n+static void *\n+mlx5_alloc_verbs_buf(size_t size, void *data)\n+{\n+\tstruct rte_device *dev = data;\n+\tvoid *ret;\n+\tsize_t alignment = rte_mem_page_size();\n+\tif (alignment == (size_t)-1) {\n+\t\tDRV_LOG(ERR, \"Failed to get mem page size\");\n+\t\trte_errno = ENOMEM;\n+\t\treturn NULL;\n+\t}\n+\n+\tMLX5_ASSERT(data != NULL);\n+\tret = mlx5_malloc(0, size, alignment, dev->numa_node);\n+\tif (!ret && size)\n+\t\trte_errno = ENOMEM;\n+\treturn ret;\n+}\n+\n+/**\n+ * Verbs callback to free a memory.\n+ *\n+ * @param[in] ptr\n+ *   A pointer to the memory to free.\n+ * @param[in] data\n+ *   A pointer to the callback data.\n+ */\n+static void\n+mlx5_free_verbs_buf(void *ptr, void *data __rte_unused)\n+{\n+\tMLX5_ASSERT(data != NULL);\n+\tmlx5_free(ptr);\n+}\n+\n+/**\n+ * Hint libmlx5 to use PMD allocator for data plane resources.\n+ *\n+ * @param dev\n+ *   Pointer to the generic device.\n+ */\n+void\n+mlx5_set_context_attr(struct rte_device *dev, struct ibv_context *ctx)\n+{\n+\tstruct mlx5dv_ctx_allocators allocator = {\n+\t\t.alloc = &mlx5_alloc_verbs_buf,\n+\t\t.free = &mlx5_free_verbs_buf,\n+\t\t.data = dev,\n+\t};\n+\n+\t/* Hint libmlx5 to use PMD allocator for data plane resources */\n+\tmlx5_glue->dv_set_context_attr(ctx, MLX5DV_CTX_ATTR_BUF_ALLOCATORS,\n+\t\t\t\t       (void *)((uintptr_t)&allocator));\n+}\n+\n /**\n  * Register mr. Given protection domain pointer, pointer to addr and length\n  * register the memory region.\ndiff --git a/drivers/common/mlx5/mlx5_common.h b/drivers/common/mlx5/mlx5_common.h\nindex f922757da1..f36791f24e 100644\n--- a/drivers/common/mlx5/mlx5_common.h\n+++ b/drivers/common/mlx5/mlx5_common.h\n@@ -334,6 +334,7 @@ void mlx5_common_init(void);\n  */\n struct mlx5_common_dev_config {\n \tint dbnc; /* Skip doorbell register write barrier. */\n+\tunsigned int devx:1; /* Whether devx interface is available or not. */\n \tunsigned int sys_mem_en:1; /* The default memory allocator. */\n \tunsigned int mr_mempool_reg_en:1;\n \t/* Allow/prevent implicit mempool memory registration. */\n@@ -443,4 +444,9 @@ __rte_internal\n bool\n mlx5_dev_is_pci(const struct rte_device *dev);\n \n+/* mlx5_common_os.c */\n+\n+__rte_internal\n+int mlx5_os_open_device(struct mlx5_common_device *cdev, void **ctx);\n+\n #endif /* RTE_PMD_MLX5_COMMON_H_ */\ndiff --git a/drivers/common/mlx5/version.map b/drivers/common/mlx5/version.map\nindex 37a0ffef4b..bcee26b7ea 100644\n--- a/drivers/common/mlx5/version.map\n+++ b/drivers/common/mlx5/version.map\n@@ -141,6 +141,7 @@ INTERNAL {\n \tmlx5_os_dealloc_pd;\n \tmlx5_os_dereg_mr;\n \tmlx5_os_get_ibv_dev; # WINDOWS_NO_EXPORT\n+    mlx5_os_open_device;\n \tmlx5_os_reg_mr;\n \tmlx5_os_umem_dereg;\n \tmlx5_os_umem_reg;\ndiff --git a/drivers/common/mlx5/windows/mlx5_common_os.c b/drivers/common/mlx5/windows/mlx5_common_os.c\nindex 5031bdca26..e426a955ff 100644\n--- a/drivers/common/mlx5/windows/mlx5_common_os.c\n+++ b/drivers/common/mlx5/windows/mlx5_common_os.c\n@@ -72,6 +72,167 @@ mlx5_os_dealloc_pd(void *pd)\n \treturn 0;\n }\n \n+/**\n+ * Detect if a devx_device_bdf object has identical DBDF values to the\n+ * rte_pci_addr found in bus/pci probing.\n+ *\n+ * @param[in] devx_bdf\n+ *   Pointer to the devx_device_bdf structure.\n+ * @param[in] addr\n+ *   Pointer to the rte_pci_addr structure.\n+ *\n+ * @return\n+ *   1 on Device match, 0 on mismatch.\n+ */\n+static int\n+mlx5_match_devx_bdf_to_addr(struct devx_device_bdf *devx_bdf,\n+\t\t\t    struct rte_pci_addr *addr)\n+{\n+\tif (addr->domain != (devx_bdf->bus_id >> 8) ||\n+\t    addr->bus != (devx_bdf->bus_id & 0xff) ||\n+\t    addr->devid != devx_bdf->dev_id ||\n+\t    addr->function != devx_bdf->fnc_id) {\n+\t\treturn 0;\n+\t}\n+\treturn 1;\n+}\n+\n+/**\n+ * Detect if a devx_device_bdf object matches the rte_pci_addr\n+ * found in bus/pci probing\n+ * Compare both the Native/PF BDF and the raw_bdf representing a VF BDF.\n+ *\n+ * @param[in] devx_bdf\n+ *   Pointer to the devx_device_bdf structure.\n+ * @param[in] addr\n+ *   Pointer to the rte_pci_addr structure.\n+ *\n+ * @return\n+ *   1 on Device match, 0 on mismatch, rte_errno code on failure.\n+ */\n+static int\n+mlx5_match_devx_devices_to_addr(struct devx_device_bdf *devx_bdf,\n+\t\t\t\tstruct rte_pci_addr *addr)\n+{\n+\tint err;\n+\tstruct devx_device mlx5_dev;\n+\n+\tif (mlx5_match_devx_bdf_to_addr(devx_bdf, addr))\n+\t\treturn 1;\n+\t/*\n+\t * Didn't match on Native/PF BDF, could still match a VF BDF,\n+\t * check it next.\n+\t */\n+\terr = mlx5_glue->query_device(devx_bdf, &mlx5_dev);\n+\tif (err) {\n+\t\tDRV_LOG(ERR, \"query_device failed\");\n+\t\trte_errno = err;\n+\t\treturn rte_errno;\n+\t}\n+\tif (mlx5_match_devx_bdf_to_addr(&mlx5_dev.raw_bdf, addr))\n+\t\treturn 1;\n+\treturn 0;\n+}\n+\n+/**\n+ * Look for DevX device that match to given rte_device.\n+ *\n+ * @param dev\n+ *   Pointer to the generic device.\n+ * @param devx_list\n+ *   Pointer to head of DevX devices list.\n+ * @param n\n+ *   Number of devices in given DevX devices list.\n+ *\n+ * @return\n+ *   A device match on success, NULL otherwise and rte_errno is set.\n+ */\n+static struct devx_device_bdf *\n+mlx5_os_get_devx_device(struct rte_device *dev,\n+\t\t\tstruct devx_device_bdf *devx_list, int n)\n+{\n+\tstruct devx_device_bdf *devx_match = NULL;\n+\tstruct rte_pci_device *pci_dev = RTE_DEV_TO_PCI(dev);\n+\tstruct rte_pci_addr *addr = &pci_dev->addr;\n+\n+\twhile (n-- > 0) {\n+\t\tint ret = mlx5_match_devx_devices_to_addr(devx_list, addr);\n+\t\tif (!ret) {\n+\t\t\tdevx_list++;\n+\t\t\tcontinue;\n+\t\t}\n+\t\tif (ret != 1) {\n+\t\t\trte_errno = ret;\n+\t\t\treturn NULL;\n+\t\t}\n+\t\tdevx_match = devx_list;\n+\t\tbreak;\n+\t}\n+\tif (devx_match == NULL) {\n+\t\t/* No device matches, just complain and bail out. */\n+\t\tDRV_LOG(WARNING,\n+\t\t\t\"No DevX device matches PCI device \" PCI_PRI_FMT \",\"\n+\t\t\t\" is DevX Configured?\",\n+\t\t\taddr->domain, addr->bus, addr->devid, addr->function);\n+\t\trte_errno = ENOENT;\n+\t}\n+\treturn devx_match;\n+}\n+\n+/**\n+ * Function API open device under Windows.\n+ *\n+ * This function calls the Windows glue APIs to open a device.\n+ *\n+ * @param dev\n+ *   Pointer to mlx5 device structure.\n+ * @param ctx\n+ *   Pointer to fill inside pointer to device context.\n+ *\n+ * @return\n+ *   0 on success, a negative errno value otherwise and rte_errno is set.\n+ */\n+int\n+mlx5_os_open_device(struct mlx5_common_device *cdev, void **ctx)\n+{\n+\tstruct devx_device_bdf *devx_bdf_dev = NULL;\n+\tstruct devx_device_bdf *devx_list;\n+\tstruct mlx5_context *mlx5_ctx = NULL;\n+\tint n;\n+\n+\terrno = 0;\n+\tdevx_list = mlx5_glue->get_device_list(&n);\n+\tif (devx_list == NULL) {\n+\t\trte_errno = errno ? errno : ENOSYS;\n+\t\tDRV_LOG(ERR, \"Cannot list devices, is DevX enabled?\");\n+\t\treturn -rte_errno;\n+\t}\n+\tdevx_bdf_dev = mlx5_os_get_devx_device(cdev->dev, devx_list, n);\n+\tif (devx_bdf_dev == NULL)\n+\t\tgoto error;\n+\t/* Try to open DevX device with DV. */\n+\tmlx5_ctx = mlx5_glue->open_device(devx_bdf_dev);\n+\tif (mlx5_ctx == NULL) {\n+\t\tDRV_LOG(ERR, \"Failed to open DevX device.\");\n+\t\trte_errno = errno;\n+\t\tgoto error;\n+\t}\n+\tif (mlx5_glue->query_device(devx_bdf_dev, &mlx5_ctx->mlx5_dev)) {\n+\t\tDRV_LOG(ERR, \"Failed to query device context fields.\");\n+\t\trte_errno = errno;\n+\t\tgoto error;\n+\t}\n+\tcdev->config.devx = 1;\n+\t*ctx = (void *)mlx5_ctx;\n+\tmlx5_glue->free_device_list(devx_list);\n+\treturn 0;\n+error:\n+\tif (mlx5_ctx != NULL)\n+\t\tclaim_zero(mlx5_glue->close_device(mlx5_ctx));\n+\tmlx5_glue->free_device_list(devx_list);\n+\treturn -rte_errno;\n+}\n+\n /**\n  * Register umem.\n  *\ndiff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c\nindex a808325412..c1b828a422 100644\n--- a/drivers/net/mlx5/linux/mlx5_os.c\n+++ b/drivers/net/mlx5/linux/mlx5_os.c\n@@ -197,39 +197,6 @@ mlx5_os_get_dev_attr(void *ctx, struct mlx5_dev_attr *device_attr)\n \treturn err;\n }\n \n-/**\n- * Verbs callback to allocate a memory. This function should allocate the space\n- * according to the size provided residing inside a huge page.\n- * Please note that all allocation must respect the alignment from libmlx5\n- * (i.e. currently rte_mem_page_size()).\n- *\n- * @param[in] size\n- *   The size in bytes of the memory to allocate.\n- * @param[in] data\n- *   A pointer to the callback data.\n- *\n- * @return\n- *   Allocated buffer, NULL otherwise and rte_errno is set.\n- */\n-static void *\n-mlx5_alloc_verbs_buf(size_t size, void *data)\n-{\n-\tstruct mlx5_dev_ctx_shared *sh = data;\n-\tvoid *ret;\n-\tsize_t alignment = rte_mem_page_size();\n-\tif (alignment == (size_t)-1) {\n-\t\tDRV_LOG(ERR, \"Failed to get mem page size\");\n-\t\trte_errno = ENOMEM;\n-\t\treturn NULL;\n-\t}\n-\n-\tMLX5_ASSERT(data != NULL);\n-\tret = mlx5_malloc(0, size, alignment, sh->numa_node);\n-\tif (!ret && size)\n-\t\trte_errno = ENOMEM;\n-\treturn ret;\n-}\n-\n /**\n  * Detect misc5 support or not\n  *\n@@ -303,21 +270,6 @@ __mlx5_discovery_misc5_cap(struct mlx5_priv *priv)\n }\n #endif\n \n-/**\n- * Verbs callback to free a memory.\n- *\n- * @param[in] ptr\n- *   A pointer to the memory to free.\n- * @param[in] data\n- *   A pointer to the callback data.\n- */\n-static void\n-mlx5_free_verbs_buf(void *ptr, void *data __rte_unused)\n-{\n-\tMLX5_ASSERT(data != NULL);\n-\tmlx5_free(ptr);\n-}\n-\n /**\n  * Initialize DR related data within private structure.\n  * Routine checks the reference counter and does actual\n@@ -938,7 +890,7 @@ mlx5_representor_match(struct mlx5_dev_spawn_data *spawn,\n  *   Verbs device parameters (name, port, switch_info) to spawn.\n  * @param config\n  *   Device configuration parameters.\n- * @param config\n+ * @param eth_da\n  *   Device arguments.\n  *\n  * @return\n@@ -997,12 +949,10 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,\n \t\t/* Bonding device. */\n \t\tif (!switch_info->representor) {\n \t\t\terr = snprintf(name, sizeof(name), \"%s_%s\",\n-\t\t\t\t dpdk_dev->name,\n-\t\t\t\t mlx5_os_get_dev_device_name(spawn->phys_dev));\n+\t\t\t\t       dpdk_dev->name, spawn->phys_dev_name);\n \t\t} else {\n \t\t\terr = snprintf(name, sizeof(name), \"%s_%s_representor_c%dpf%d%s%u\",\n-\t\t\t\tdpdk_dev->name,\n-\t\t\t\tmlx5_os_get_dev_device_name(spawn->phys_dev),\n+\t\t\t\tdpdk_dev->name, spawn->phys_dev_name,\n \t\t\t\tswitch_info->ctrl_num,\n \t\t\t\tswitch_info->pf_num,\n \t\t\t\tswitch_info->name_type ==\n@@ -1224,9 +1174,8 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,\n \t\t\t\t\t\t &vport_info);\n \t\tif (err) {\n \t\t\tDRV_LOG(WARNING,\n-\t\t\t\t\"can't query devx port %d on device %s\",\n-\t\t\t\tspawn->phys_port,\n-\t\t\t\tmlx5_os_get_dev_device_name(spawn->phys_dev));\n+\t\t\t\t\"Cannot query devx port %d on device %s\",\n+\t\t\t\tspawn->phys_port, spawn->phys_dev_name);\n \t\t\tvport_info.query_flags = 0;\n \t\t}\n \t}\n@@ -1234,20 +1183,16 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,\n \t\tpriv->vport_meta_tag = vport_info.vport_meta_tag;\n \t\tpriv->vport_meta_mask = vport_info.vport_meta_mask;\n \t\tif (!priv->vport_meta_mask) {\n-\t\t\tDRV_LOG(ERR, \"vport zero mask for port %d\"\n-\t\t\t\t     \" on bonding device %s\",\n-\t\t\t\t     spawn->phys_port,\n-\t\t\t\t     mlx5_os_get_dev_device_name\n-\t\t\t\t\t\t\t(spawn->phys_dev));\n+\t\t\tDRV_LOG(ERR,\n+\t\t\t\t\"vport zero mask for port %d on bonding device %s\",\n+\t\t\t\tspawn->phys_port, spawn->phys_dev_name);\n \t\t\terr = ENOTSUP;\n \t\t\tgoto error;\n \t\t}\n \t\tif (priv->vport_meta_tag & ~priv->vport_meta_mask) {\n-\t\t\tDRV_LOG(ERR, \"invalid vport tag for port %d\"\n-\t\t\t\t     \" on bonding device %s\",\n-\t\t\t\t     spawn->phys_port,\n-\t\t\t\t     mlx5_os_get_dev_device_name\n-\t\t\t\t\t\t\t(spawn->phys_dev));\n+\t\t\tDRV_LOG(ERR,\n+\t\t\t\t\"Invalid vport tag for port %d on bonding device %s\",\n+\t\t\t\tspawn->phys_port, spawn->phys_dev_name);\n \t\t\terr = ENOTSUP;\n \t\t\tgoto error;\n \t\t}\n@@ -1256,10 +1201,9 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,\n \t\tpriv->vport_id = vport_info.vport_id;\n \t} else if (spawn->pf_bond >= 0 &&\n \t\t   (switch_info->representor || switch_info->master)) {\n-\t\tDRV_LOG(ERR, \"can't deduce vport index for port %d\"\n-\t\t\t     \" on bonding device %s\",\n-\t\t\t     spawn->phys_port,\n-\t\t\t     mlx5_os_get_dev_device_name(spawn->phys_dev));\n+\t\tDRV_LOG(ERR,\n+\t\t\t\"Cannot deduce vport index for port %d on bonding device %s\",\n+\t\t\tspawn->phys_port, spawn->phys_dev_name);\n \t\terr = ENOTSUP;\n \t\tgoto error;\n \t} else {\n@@ -1742,14 +1686,6 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,\n \tpriv->mtr_profile_tbl = mlx5_l3t_create(MLX5_L3T_TYPE_PTR);\n \tif (!priv->mtr_profile_tbl)\n \t\tgoto error;\n-\t/* Hint libmlx5 to use PMD allocator for data plane resources */\n-\tmlx5_glue->dv_set_context_attr(sh->ctx,\n-\t\t\tMLX5DV_CTX_ATTR_BUF_ALLOCATORS,\n-\t\t\t(void *)((uintptr_t)&(struct mlx5dv_ctx_allocators){\n-\t\t\t\t.alloc = &mlx5_alloc_verbs_buf,\n-\t\t\t\t.free = &mlx5_free_verbs_buf,\n-\t\t\t\t.data = sh,\n-\t\t\t}));\n \t/* Bring Ethernet device up. */\n \tDRV_LOG(DEBUG, \"port %u forcing Ethernet interface up\",\n \t\teth_dev->data->port_id);\n@@ -2155,7 +2091,7 @@ mlx5_os_config_default(struct mlx5_dev_config *config)\n  *   0 on success, a negative errno value otherwise and rte_errno is set.\n  */\n static int\n-mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev,\n+mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev, void *ctx,\n \t\t     struct rte_eth_devargs *req_eth_da,\n \t\t     uint16_t owner_id)\n {\n@@ -2197,7 +2133,7 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev,\n \tibv_list = mlx5_glue->get_device_list(&ret);\n \tif (!ibv_list) {\n \t\trte_errno = errno ? errno : ENOSYS;\n-\t\tDRV_LOG(ERR, \"cannot list devices, is ib_uverbs loaded?\");\n+\t\tDRV_LOG(ERR, \"Cannot list devices, is ib_uverbs loaded?\");\n \t\treturn -rte_errno;\n \t}\n \t/*\n@@ -2212,7 +2148,7 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev,\n \twhile (ret-- > 0) {\n \t\tstruct rte_pci_addr pci_addr;\n \n-\t\tDRV_LOG(DEBUG, \"checking device \\\"%s\\\"\", ibv_list[ret]->name);\n+\t\tDRV_LOG(DEBUG, \"Checking device \\\"%s\\\"\", ibv_list[ret]->name);\n \t\tbd = mlx5_device_bond_pci_match\n \t\t\t\t(ibv_list[ret], &owner_pci, nl_rdma, owner_id,\n \t\t\t\t &bond_info);\n@@ -2259,7 +2195,7 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev,\n \tif (!nd) {\n \t\t/* No device matches, just complain and bail out. */\n \t\tDRV_LOG(WARNING,\n-\t\t\t\"no Verbs device matches PCI device \" PCI_PRI_FMT \",\"\n+\t\t\t\"No Verbs device matches PCI device \" PCI_PRI_FMT \",\"\n \t\t\t\" are kernel drivers loaded?\",\n \t\t\towner_pci.domain, owner_pci.bus,\n \t\t\towner_pci.devid, owner_pci.function);\n@@ -2276,26 +2212,22 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev,\n \t\tif (nl_rdma >= 0)\n \t\t\tnp = mlx5_nl_portnum(nl_rdma, ibv_match[0]->name);\n \t\tif (!np)\n-\t\t\tDRV_LOG(WARNING, \"can not get IB device \\\"%s\\\"\"\n-\t\t\t\t\t \" ports number\", ibv_match[0]->name);\n+\t\t\tDRV_LOG(WARNING,\n+\t\t\t\t\"Cannot get IB device \\\"%s\\\" ports number.\",\n+\t\t\t\tibv_match[0]->name);\n \t\tif (bd >= 0 && !np) {\n-\t\t\tDRV_LOG(ERR, \"can not get ports\"\n-\t\t\t\t     \" for bonding device\");\n+\t\t\tDRV_LOG(ERR, \"Cannot get ports for bonding device.\");\n \t\t\trte_errno = ENOENT;\n \t\t\tret = -rte_errno;\n \t\t\tgoto exit;\n \t\t}\n \t}\n-\t/*\n-\t * Now we can determine the maximal\n-\t * amount of devices to be spawned.\n-\t */\n+\t/* Now we can determine the maximal amount of devices to be spawned. */\n \tlist = mlx5_malloc(MLX5_MEM_ZERO,\n-\t\t\t   sizeof(struct mlx5_dev_spawn_data) *\n-\t\t\t   (np ? np : nd),\n+\t\t\t   sizeof(struct mlx5_dev_spawn_data) * (np ? np : nd),\n \t\t\t   RTE_CACHE_LINE_SIZE, SOCKET_ID_ANY);\n \tif (!list) {\n-\t\tDRV_LOG(ERR, \"spawn data array allocation failure\");\n+\t\tDRV_LOG(ERR, \"Spawn data array allocation failure.\");\n \t\trte_errno = ENOMEM;\n \t\tret = -rte_errno;\n \t\tgoto exit;\n@@ -2314,15 +2246,15 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev,\n \t\t\tlist[ns].bond_info = &bond_info;\n \t\t\tlist[ns].max_port = np;\n \t\t\tlist[ns].phys_port = i;\n-\t\t\tlist[ns].phys_dev = ibv_match[0];\n+\t\t\tlist[ns].phys_dev_name = ibv_match[0]->name;\n+\t\t\tlist[ns].ctx = ctx;\n \t\t\tlist[ns].eth_dev = NULL;\n \t\t\tlist[ns].pci_dev = pci_dev;\n \t\t\tlist[ns].cdev = cdev;\n \t\t\tlist[ns].pf_bond = bd;\n-\t\t\tlist[ns].ifindex = mlx5_nl_ifindex\n-\t\t\t\t(nl_rdma,\n-\t\t\t\tmlx5_os_get_dev_device_name\n-\t\t\t\t\t\t(list[ns].phys_dev), i);\n+\t\t\tlist[ns].ifindex = mlx5_nl_ifindex(nl_rdma,\n+\t\t\t\t\t\t\t   ibv_match[0]->name,\n+\t\t\t\t\t\t\t   i);\n \t\t\tif (!list[ns].ifindex) {\n \t\t\t\t/*\n \t\t\t\t * No network interface index found for the\n@@ -2335,10 +2267,9 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev,\n \t\t\t}\n \t\t\tret = -1;\n \t\t\tif (nl_route >= 0)\n-\t\t\t\tret = mlx5_nl_switch_info\n-\t\t\t\t\t       (nl_route,\n-\t\t\t\t\t\tlist[ns].ifindex,\n-\t\t\t\t\t\t&list[ns].info);\n+\t\t\t\tret = mlx5_nl_switch_info(nl_route,\n+\t\t\t\t\t\t\t  list[ns].ifindex,\n+\t\t\t\t\t\t\t  &list[ns].info);\n \t\t\tif (ret || (!list[ns].info.representor &&\n \t\t\t\t    !list[ns].info.master)) {\n \t\t\t\t/*\n@@ -2346,9 +2277,8 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev,\n \t\t\t\t * Netlink, let's try to perform the task\n \t\t\t\t * with sysfs.\n \t\t\t\t */\n-\t\t\t\tret =  mlx5_sysfs_switch_info\n-\t\t\t\t\t\t(list[ns].ifindex,\n-\t\t\t\t\t\t &list[ns].info);\n+\t\t\t\tret = mlx5_sysfs_switch_info(list[ns].ifindex,\n+\t\t\t\t\t\t\t     &list[ns].info);\n \t\t\t}\n \t\t\tif (!ret && bd >= 0) {\n \t\t\t\tswitch (list[ns].info.name_type) {\n@@ -2384,8 +2314,7 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev,\n \t\t}\n \t\tif (!ns) {\n \t\t\tDRV_LOG(ERR,\n-\t\t\t\t\"unable to recognize master/representors\"\n-\t\t\t\t\" on the IB device with multiple ports\");\n+\t\t\t\t\"Unable to recognize master/representors on the IB device with multiple ports.\");\n \t\t\trte_errno = ENOENT;\n \t\t\tret = -rte_errno;\n \t\t\tgoto exit;\n@@ -2413,7 +2342,8 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev,\n \t\t\tlist[ns].bond_info = NULL;\n \t\t\tlist[ns].max_port = 1;\n \t\t\tlist[ns].phys_port = 1;\n-\t\t\tlist[ns].phys_dev = ibv_match[i];\n+\t\t\tlist[ns].phys_dev_name = ibv_match[i]->name;\n+\t\t\tlist[ns].ctx = ctx;\n \t\t\tlist[ns].eth_dev = NULL;\n \t\t\tlist[ns].pci_dev = pci_dev;\n \t\t\tlist[ns].cdev = cdev;\n@@ -2421,9 +2351,9 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev,\n \t\t\tlist[ns].ifindex = 0;\n \t\t\tif (nl_rdma >= 0)\n \t\t\t\tlist[ns].ifindex = mlx5_nl_ifindex\n-\t\t\t\t(nl_rdma,\n-\t\t\t\tmlx5_os_get_dev_device_name\n-\t\t\t\t\t\t(list[ns].phys_dev), 1);\n+\t\t\t\t\t\t\t    (nl_rdma,\n+\t\t\t\t\t\t\t     ibv_match[i]->name,\n+\t\t\t\t\t\t\t     1);\n \t\t\tif (!list[ns].ifindex) {\n \t\t\t\tchar ifname[IF_NAMESIZE];\n \n@@ -2473,9 +2403,8 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev,\n \t\t\t\t * Netlink, let's try to perform the task\n \t\t\t\t * with sysfs.\n \t\t\t\t */\n-\t\t\t\tret =  mlx5_sysfs_switch_info\n-\t\t\t\t\t\t(list[ns].ifindex,\n-\t\t\t\t\t\t &list[ns].info);\n+\t\t\t\tret = mlx5_sysfs_switch_info(list[ns].ifindex,\n+\t\t\t\t\t\t\t     &list[ns].info);\n \t\t\t}\n \t\t\tif (!ret && (list[ns].info.representor ^\n \t\t\t\t     list[ns].info.master)) {\n@@ -2484,21 +2413,19 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev,\n \t\t\t\t   !list[ns].info.representor &&\n \t\t\t\t   !list[ns].info.master) {\n \t\t\t\t/*\n-\t\t\t\t * Single IB device with\n-\t\t\t\t * one physical port and\n+\t\t\t\t * Single IB device with one physical port and\n \t\t\t\t * attached network device.\n-\t\t\t\t * May be SRIOV is not enabled\n-\t\t\t\t * or there is no representors.\n+\t\t\t\t * May be SRIOV is not enabled or there is no\n+\t\t\t\t * representors.\n \t\t\t\t */\n-\t\t\t\tDRV_LOG(INFO, \"no E-Switch support detected\");\n+\t\t\t\tDRV_LOG(INFO, \"No E-Switch support detected.\");\n \t\t\t\tns++;\n \t\t\t\tbreak;\n \t\t\t}\n \t\t}\n \t\tif (!ns) {\n \t\t\tDRV_LOG(ERR,\n-\t\t\t\t\"unable to recognize master/representors\"\n-\t\t\t\t\" on the multiple IB devices\");\n+\t\t\t\t\"Unable to recognize master/representors on the multiple IB devices.\");\n \t\t\trte_errno = ENOENT;\n \t\t\tret = -rte_errno;\n \t\t\tgoto exit;\n@@ -2681,7 +2608,7 @@ mlx5_os_parse_eth_devargs(struct rte_device *dev,\n  *   0 on success, a negative errno value otherwise and rte_errno is set.\n  */\n static int\n-mlx5_os_pci_probe(struct mlx5_common_device *cdev)\n+mlx5_os_pci_probe(struct mlx5_common_device *cdev, void *ctx)\n {\n \tstruct rte_pci_device *pci_dev = RTE_DEV_TO_PCI(cdev->dev);\n \tstruct rte_eth_devargs eth_da = { .nb_ports = 0 };\n@@ -2695,7 +2622,7 @@ mlx5_os_pci_probe(struct mlx5_common_device *cdev)\n \tif (eth_da.nb_ports > 0) {\n \t\t/* Iterate all port if devargs pf is range: \"pf[0-1]vf[...]\". */\n \t\tfor (p = 0; p < eth_da.nb_ports; p++) {\n-\t\t\tret = mlx5_os_pci_probe_pf(cdev, &eth_da,\n+\t\t\tret = mlx5_os_pci_probe_pf(cdev, ctx, &eth_da,\n \t\t\t\t\t\t   eth_da.ports[p]);\n \t\t\tif (ret)\n \t\t\t\tbreak;\n@@ -2709,14 +2636,14 @@ mlx5_os_pci_probe(struct mlx5_common_device *cdev)\n \t\t\tmlx5_net_remove(cdev);\n \t\t}\n \t} else {\n-\t\tret = mlx5_os_pci_probe_pf(cdev, &eth_da, 0);\n+\t\tret = mlx5_os_pci_probe_pf(cdev, ctx, &eth_da, 0);\n \t}\n \treturn ret;\n }\n \n /* Probe a single SF device on auxiliary bus, no representor support. */\n static int\n-mlx5_os_auxiliary_probe(struct mlx5_common_device *cdev)\n+mlx5_os_auxiliary_probe(struct mlx5_common_device *cdev, void *ctx)\n {\n \tstruct rte_eth_devargs eth_da = { .nb_ports = 0 };\n \tstruct mlx5_dev_config config;\n@@ -2736,9 +2663,8 @@ mlx5_os_auxiliary_probe(struct mlx5_common_device *cdev)\n \t/* Init spawn data. */\n \tspawn.max_port = 1;\n \tspawn.phys_port = 1;\n-\tspawn.phys_dev = mlx5_os_get_ibv_dev(dev);\n-\tif (spawn.phys_dev == NULL)\n-\t\treturn -rte_errno;\n+\tspawn.ctx = ctx;\n+\tspawn.phys_dev_name = mlx5_os_get_ctx_device_name(ctx);\n \tret = mlx5_auxiliary_get_ifindex(dev->name);\n \tif (ret < 0) {\n \t\tDRV_LOG(ERR, \"failed to get ethdev ifindex: %s\", dev->name);\n@@ -2776,48 +2702,28 @@ int\n mlx5_os_net_probe(struct mlx5_common_device *cdev)\n {\n \tint ret;\n+\tvoid *ctx = NULL;\n \n-\tif (rte_eal_process_type() == RTE_PROC_PRIMARY)\n+\tif (rte_eal_process_type() == RTE_PROC_PRIMARY) {\n+\t\tret = mlx5_os_open_device(cdev, &ctx);\n+\t\tif (ret) {\n+\t\t\tDRV_LOG(ERR, \"Fail to open device %s\", cdev->dev->name);\n+\t\t\treturn -rte_errno;\n+\t\t}\n \t\tmlx5_pmd_socket_init();\n+\t}\n \tret = mlx5_init_once();\n \tif (ret) {\n \t\tDRV_LOG(ERR, \"Unable to init PMD global data: %s\",\n \t\t\tstrerror(rte_errno));\n+\t\tif (ctx != NULL)\n+\t\t\tclaim_zero(mlx5_glue->close_device(ctx));\n \t\treturn -rte_errno;\n \t}\n \tif (mlx5_dev_is_pci(cdev->dev))\n-\t\treturn mlx5_os_pci_probe(cdev);\n-\telse\n-\t\treturn mlx5_os_auxiliary_probe(cdev);\n-}\n-\n-static int\n-mlx5_config_doorbell_mapping_env(const struct mlx5_common_dev_config *config)\n-{\n-\tchar *env;\n-\tint value;\n-\n-\tMLX5_ASSERT(rte_eal_process_type() == RTE_PROC_PRIMARY);\n-\t/* Get environment variable to store. */\n-\tenv = getenv(MLX5_SHUT_UP_BF);\n-\tvalue = env ? !!strcmp(env, \"0\") : MLX5_ARG_UNSET;\n-\tif (config->dbnc == MLX5_ARG_UNSET)\n-\t\tsetenv(MLX5_SHUT_UP_BF, MLX5_SHUT_UP_BF_DEFAULT, 1);\n+\t\treturn mlx5_os_pci_probe(cdev, ctx);\n \telse\n-\t\tsetenv(MLX5_SHUT_UP_BF,\n-\t\t       config->dbnc == MLX5_TXDB_NCACHED ? \"1\" : \"0\", 1);\n-\treturn value;\n-}\n-\n-static void\n-mlx5_restore_doorbell_mapping_env(int value)\n-{\n-\tMLX5_ASSERT(rte_eal_process_type() == RTE_PROC_PRIMARY);\n-\t/* Restore the original environment variable state. */\n-\tif (value == MLX5_ARG_UNSET)\n-\t\tunsetenv(MLX5_SHUT_UP_BF);\n-\telse\n-\t\tsetenv(MLX5_SHUT_UP_BF, value ? \"1\" : \"0\", 1);\n+\t\treturn mlx5_os_auxiliary_probe(cdev, ctx);\n }\n \n /**\n@@ -2855,69 +2761,6 @@ mlx5_os_get_pdn(void *pd, uint32_t *pdn)\n #endif /* HAVE_IBV_FLOW_DV_SUPPORT */\n }\n \n-/**\n- * Function API to open IB device.\n- *\n- * This function calls the Linux glue APIs to open a device.\n- *\n- * @param[in] spawn\n- *   Pointer to the IB device attributes (name, port, etc).\n- * @param[out] sh\n- *   Pointer to shared context structure.\n- *\n- * @return\n- *   0 on success, a positive error value otherwise.\n- */\n-int\n-mlx5_os_open_device(const struct mlx5_dev_spawn_data *spawn,\n-\t\t     struct mlx5_dev_ctx_shared *sh)\n-{\n-\tint dbmap_env;\n-\tint err = 0;\n-\n-\tpthread_mutex_init(&sh->txpp.mutex, NULL);\n-\t/*\n-\t * Configure environment variable \"MLX5_BF_SHUT_UP\"\n-\t * before the device creation. The rdma_core library\n-\t * checks the variable at device creation and\n-\t * stores the result internally.\n-\t */\n-\tdbmap_env = mlx5_config_doorbell_mapping_env(&spawn->mlx5_dev->config);\n-\t/* Try to open IB device with DV first, then usual Verbs. */\n-\terrno = 0;\n-\tsh->ctx = mlx5_glue->dv_open_device(spawn->phys_dev);\n-\tif (sh->ctx) {\n-\t\tsh->devx = 1;\n-\t\tDRV_LOG(DEBUG, \"DevX is supported\");\n-\t\t/* The device is created, no need for environment. */\n-\t\tmlx5_restore_doorbell_mapping_env(dbmap_env);\n-\t} else {\n-\t\t/* The environment variable is still configured. */\n-\t\tsh->ctx = mlx5_glue->open_device(spawn->phys_dev);\n-\t\terr = errno ? errno : ENODEV;\n-\t\t/*\n-\t\t * The environment variable is not needed anymore,\n-\t\t * all device creation attempts are completed.\n-\t\t */\n-\t\tmlx5_restore_doorbell_mapping_env(dbmap_env);\n-\t\tif (!sh->ctx)\n-\t\t\treturn err;\n-\t\tDRV_LOG(DEBUG, \"DevX is NOT supported\");\n-\t\terr = 0;\n-\t}\n-\tif (!err && sh->ctx) {\n-\t\t/* Hint libmlx5 to use PMD allocator for data plane resources */\n-\t\tmlx5_glue->dv_set_context_attr(sh->ctx,\n-\t\t\tMLX5DV_CTX_ATTR_BUF_ALLOCATORS,\n-\t\t\t(void *)((uintptr_t)&(struct mlx5dv_ctx_allocators){\n-\t\t\t\t.alloc = &mlx5_alloc_verbs_buf,\n-\t\t\t\t.free = &mlx5_free_verbs_buf,\n-\t\t\t\t.data = sh,\n-\t\t\t}));\n-\t}\n-\treturn err;\n-}\n-\n /**\n  * Install shared asynchronous device events handler.\n  * This function is implemented to support event sharing\ndiff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c\nindex b5af21b0f6..bfdce8da72 100644\n--- a/drivers/net/mlx5/mlx5.c\n+++ b/drivers/net/mlx5/mlx5.c\n@@ -1262,7 +1262,7 @@ mlx5_alloc_shared_dev_ctx(const struct mlx5_dev_spawn_data *spawn,\n \t/* Search for IB context by device name. */\n \tLIST_FOREACH(sh, &mlx5_dev_ctx_list, next) {\n \t\tif (!strcmp(sh->ibdev_name,\n-\t\t\tmlx5_os_get_dev_device_name(spawn->phys_dev))) {\n+\t\t\tmlx5_os_get_ctx_device_name(spawn->ctx))) {\n \t\t\tsh->refcnt++;\n \t\t\tgoto exit;\n \t\t}\n@@ -1279,13 +1279,13 @@ mlx5_alloc_shared_dev_ctx(const struct mlx5_dev_spawn_data *spawn,\n \t\trte_errno  = ENOMEM;\n \t\tgoto exit;\n \t}\n+\tpthread_mutex_init(&sh->txpp.mutex, NULL);\n \tsh->numa_node = spawn->cdev->dev->numa_node;\n \tsh->cdev = spawn->cdev;\n+\tsh->devx = sh->cdev->config.devx;\n+\tsh->ctx = spawn->ctx;\n \tif (spawn->bond_info)\n \t\tsh->bond = *spawn->bond_info;\n-\terr = mlx5_os_open_device(spawn, sh);\n-\tif (!sh->ctx)\n-\t\tgoto error;\n \terr = mlx5_os_get_dev_attr(sh->ctx, &sh->device_attr);\n \tif (err) {\n \t\tDRV_LOG(DEBUG, \"mlx5_os_get_dev_attr() failed\");\ndiff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h\nindex 4c8e633fb6..becd8722de 100644\n--- a/drivers/net/mlx5/mlx5.h\n+++ b/drivers/net/mlx5/mlx5.h\n@@ -136,7 +136,8 @@ struct mlx5_dev_spawn_data {\n \tuint32_t phys_port; /**< Device physical port index. */\n \tint pf_bond; /**< bonding device PF index. < 0 - no bonding */\n \tstruct mlx5_switch_info info; /**< Switch information. */\n-\tvoid *phys_dev; /**< Associated physical device. */\n+\tconst char *phys_dev_name; /**< Name of physical device. */\n+\tvoid *ctx; /**< Associated physical device context. */\n \tstruct rte_eth_dev *eth_dev; /**< Associated Ethernet device. */\n \tstruct rte_pci_device *pci_dev; /**< Backend PCI device. */\n \tstruct mlx5_common_device *cdev; /**< Backend common device. */\n@@ -1771,8 +1772,6 @@ void mlx5_flow_meter_rxq_flush(struct rte_eth_dev *dev);\n struct rte_pci_driver;\n int mlx5_os_get_dev_attr(void *ctx, struct mlx5_dev_attr *dev_attr);\n void mlx5_os_free_shared_dr(struct mlx5_priv *priv);\n-int mlx5_os_open_device(const struct mlx5_dev_spawn_data *spawn,\n-\t\t\t struct mlx5_dev_ctx_shared *sh);\n int mlx5_os_get_pdn(void *pd, uint32_t *pdn);\n int mlx5_os_net_probe(struct mlx5_common_device *cdev);\n void mlx5_os_dev_shared_handler_install(struct mlx5_dev_ctx_shared *sh);\ndiff --git a/drivers/net/mlx5/windows/mlx5_os.c b/drivers/net/mlx5/windows/mlx5_os.c\nindex 90e21479e3..1e76f63fc1 100644\n--- a/drivers/net/mlx5/windows/mlx5_os.c\n+++ b/drivers/net/mlx5/windows/mlx5_os.c\n@@ -253,46 +253,6 @@ mlx5_os_set_nonblock_channel_fd(int fd)\n \treturn -ENOTSUP;\n }\n \n-/**\n- * Function API open device under Windows\n- *\n- * This function calls the Windows glue APIs to open a device.\n- *\n- * @param[in] spawn\n- *   Pointer to the device attributes (name, port, etc).\n- * @param[out] sh\n- *   Pointer to shared context structure.\n- *\n- * @return\n- *   0 on success, a positive error value otherwise.\n- */\n-int\n-mlx5_os_open_device(const struct mlx5_dev_spawn_data *spawn,\n-\t\t struct mlx5_dev_ctx_shared *sh)\n-{\n-\tint err = 0;\n-\tstruct mlx5_context *mlx5_ctx;\n-\n-\tpthread_mutex_init(&sh->txpp.mutex, NULL);\n-\t/* Set numa node from pci probe */\n-\tsh->numa_node = spawn->pci_dev->device.numa_node;\n-\n-\t/* Try to open device with DevX */\n-\trte_errno = 0;\n-\tsh->ctx = mlx5_glue->open_device(spawn->phys_dev);\n-\tif (!sh->ctx) {\n-\t\tDRV_LOG(ERR, \"open_device failed\");\n-\t\terr = errno;\n-\t\treturn err;\n-\t}\n-\tsh->devx = 1;\n-\tmlx5_ctx = (struct mlx5_context *)sh->ctx;\n-\terr = mlx5_glue->query_device(spawn->phys_dev, &mlx5_ctx->mlx5_dev);\n-\tif (err)\n-\t\tDRV_LOG(ERR, \"Failed to query device context fields.\");\n-\treturn err;\n-}\n-\n /**\n  * DV flow counter mode detect and config.\n  *\n@@ -909,114 +869,6 @@ mlx5_os_set_allmulti(struct rte_eth_dev *dev, int enable)\n \treturn -ENOTSUP;\n }\n \n-/**\n- * Detect if a devx_device_bdf object has identical DBDF values to the\n- * rte_pci_addr found in bus/pci probing\n- *\n- * @param[in] devx_bdf\n- *   Pointer to the devx_device_bdf structure.\n- * @param[in] addr\n- *   Pointer to the rte_pci_addr structure.\n- *\n- * @return\n- *   1 on Device match, 0 on mismatch.\n- */\n-static int\n-mlx5_match_devx_bdf_to_addr(struct devx_device_bdf *devx_bdf,\n-\t\t\t    struct rte_pci_addr *addr)\n-{\n-\tif (addr->domain != (devx_bdf->bus_id >> 8) ||\n-\t    addr->bus != (devx_bdf->bus_id & 0xff) ||\n-\t    addr->devid != devx_bdf->dev_id ||\n-\t    addr->function != devx_bdf->fnc_id) {\n-\t\treturn 0;\n-\t}\n-\treturn 1;\n-}\n-\n-/**\n- * Detect if a devx_device_bdf object matches the rte_pci_addr\n- * found in bus/pci probing\n- * Compare both the Native/PF BDF and the raw_bdf representing a VF BDF.\n- *\n- * @param[in] devx_bdf\n- *   Pointer to the devx_device_bdf structure.\n- * @param[in] addr\n- *   Pointer to the rte_pci_addr structure.\n- *\n- * @return\n- *   1 on Device match, 0 on mismatch, rte_errno code on failure.\n- */\n-static int\n-mlx5_match_devx_devices_to_addr(struct devx_device_bdf *devx_bdf,\n-\t\t\t\tstruct rte_pci_addr *addr)\n-{\n-\tint err;\n-\tstruct devx_device mlx5_dev;\n-\n-\tif (mlx5_match_devx_bdf_to_addr(devx_bdf, addr))\n-\t\treturn 1;\n-\t/*\n-\t * Didn't match on Native/PF BDF, could still match a VF BDF,\n-\t * check it next.\n-\t */\n-\terr = mlx5_glue->query_device(devx_bdf, &mlx5_dev);\n-\tif (err) {\n-\t\tDRV_LOG(ERR, \"query_device failed\");\n-\t\trte_errno = err;\n-\t\treturn rte_errno;\n-\t}\n-\tif (mlx5_match_devx_bdf_to_addr(&mlx5_dev.raw_bdf, addr))\n-\t\treturn 1;\n-\treturn 0;\n-}\n-\n-/**\n- * Look for DevX device that match to given rte_device.\n- *\n- * @param dev\n- *   Pointer to the generic device.\n- * @param orig_devx_list\n- *   Pointer to head of DevX devices list.\n- * @param n\n- *   Number of devices in given DevX devices list.\n- *\n- * @return\n- *   A device match on success, NULL otherwise and rte_errno is set.\n- */\n-static struct devx_device_bdf *\n-mlx5_os_get_devx_device(struct rte_device *dev,\n-\t\t\tstruct devx_device_bdf *orig_devx_list, int n)\n-{\n-\tstruct devx_device_bdf *devx_list = orig_devx_list;\n-\tstruct devx_device_bdf *devx_match = NULL;\n-\tstruct rte_pci_device *pci_dev = RTE_DEV_TO_PCI(dev);\n-\tstruct rte_pci_addr *addr = &pci_dev->addr;\n-\n-\twhile (n-- > 0) {\n-\t\tint ret = mlx5_match_devx_devices_to_addr(devx_list, addr);\n-\t\tif (!ret) {\n-\t\t\tdevx_list++;\n-\t\t\tcontinue;\n-\t\t}\n-\t\tif (ret != 1) {\n-\t\t\trte_errno = ret;\n-\t\t\treturn NULL;\n-\t\t}\n-\t\tdevx_match = devx_list;\n-\t\tbreak;\n-\t}\n-\tif (devx_match == NULL) {\n-\t\t/* No device matches, just complain and bail out. */\n-\t\tDRV_LOG(WARNING,\n-\t\t\t\"No DevX device matches PCI device \" PCI_PRI_FMT \",\"\n-\t\t\t\" is DevX Configured?\",\n-\t\t\taddr->domain, addr->bus, addr->devid, addr->function);\n-\t\trte_errno = ENOENT;\n-\t}\n-\treturn devx_match;\n-}\n-\n /**\n  * DPDK callback to register a PCI device.\n  *\n@@ -1032,8 +884,6 @@ int\n mlx5_os_net_probe(struct mlx5_common_device *cdev)\n {\n \tstruct rte_pci_device *pci_dev = RTE_DEV_TO_PCI(cdev->dev);\n-\tstruct devx_device_bdf *devx_list;\n-\tstruct devx_device_bdf *devx_bdf_match;\n \tstruct mlx5_dev_spawn_data spawn = {\n \t\t.pf_bond = -1,\n \t\t.max_port = 1,\n@@ -1058,33 +908,28 @@ mlx5_os_net_probe(struct mlx5_common_device *cdev)\n \t\t.dv_flow_en = 1,\n \t\t.log_hp_size = MLX5_ARG_UNSET,\n \t};\n+\tvoid *ctx;\n \tint ret;\n-\tint n;\n \tuint32_t restore;\n \n \tif (rte_eal_process_type() == RTE_PROC_SECONDARY) {\n \t\tDRV_LOG(ERR, \"Secondary process is not supported on Windows.\");\n \t\treturn -ENOTSUP;\n \t}\n+\tret = mlx5_os_open_device(cdev, &ctx);\n+\tif (ret) {\n+\t\tDRV_LOG(ERR, \"Fail to open DevX device %s\", cdev->dev->name);\n+\t\treturn -rte_errno;\n+\t}\n \tret = mlx5_init_once();\n \tif (ret) {\n \t\tDRV_LOG(ERR, \"unable to init PMD global data: %s\",\n \t\t\tstrerror(rte_errno));\n+\t\tclaim_zero(mlx5_glue->close_device(ctx));\n \t\treturn -rte_errno;\n \t}\n-\terrno = 0;\n-\tdevx_list = mlx5_glue->get_device_list(&n);\n-\tif (devx_list == NULL) {\n-\t\trte_errno = errno ? errno : ENOSYS;\n-\t\tDRV_LOG(ERR, \"Cannot list devices, is DevX enabled?\");\n-\t\treturn -rte_errno;\n-\t}\n-\tdevx_bdf_match = mlx5_os_get_devx_device(cdev->dev, devx_list, n);\n-\tif (devx_bdf_match == NULL) {\n-\t\tret = -rte_errno;\n-\t\tgoto exit;\n-\t}\n-\tspawn.phys_dev = devx_bdf_match;\n+\tspawn.ctx = ctx;\n+\tspawn.phys_dev_name = mlx5_os_get_ctx_device_name(ctx);\n \t/* Device specific configuration. */\n \tswitch (pci_dev->id.device_id) {\n \tcase PCI_DEVICE_ID_MELLANOX_CONNECTX4VF:\n@@ -1102,17 +947,15 @@ mlx5_os_net_probe(struct mlx5_common_device *cdev)\n \t}\n \tspawn.eth_dev = mlx5_dev_spawn(cdev->dev, &spawn, &dev_config);\n \tif (!spawn.eth_dev) {\n-\t\tret = -rte_errno;\n-\t\tgoto exit;\n+\t\tclaim_zero(mlx5_glue->close_device(ctx));\n+\t\treturn -rte_errno;\n \t}\n \trestore = spawn.eth_dev->data->dev_flags;\n \trte_eth_copy_pci_info(spawn.eth_dev, pci_dev);\n \t/* Restore non-PCI flags cleared by the above call. */\n \tspawn.eth_dev->data->dev_flags |= restore;\n \trte_eth_dev_probing_finish(spawn.eth_dev);\n-exit:\n-\tmlx5_glue->free_device_list(devx_list);\n-\treturn ret;\n+\treturn 0;\n }\n \n /**\n",
    "prefixes": [
        "06/18"
    ]
}