From patchwork Tue Aug 17 13:44:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Baum X-Patchwork-Id: 97005 X-Patchwork-Delegate: rasland@nvidia.com 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 8D1A8A0548; Tue, 17 Aug 2021 15:47:22 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2B69741246; Tue, 17 Aug 2021 15:45:43 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2088.outbound.protection.outlook.com [40.107.220.88]) by mails.dpdk.org (Postfix) with ESMTP id 8F0884121E for ; Tue, 17 Aug 2021 15:45:41 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KYiaXg6QzsOV5SgVOeaS6GOoJ47iNBSvR234QO8IbV1cLM+SgSdIFU5YpA3liK1TOMWB17QeqjqqlAqS2GXtC7cUlez+wcoFeaXlgwVOV2u5OhUJb4kjj13D3UnQ2a5K6slSVXSpGGufKanwQAzP+QLdrH2GYRNC67/Qr2HH578nmMS4l7yJzk5S12IcN+JzN/spm68QV5Ji+Porp0D5MtYoWGjUohIPtdFO7pFSAmJ52OyUk4Vn8dlYSF8EXAkkph6vZmtgBtR3bjIOg8g0LCQM6PfMNQAfJckYyIWDJOlhC+rQ2TfLeuSib7azN/uZyDpzsMgzaGGBPdk2BixWqA== 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-SenderADCheck; bh=bIpSAuF3Fr/6XNIkxYjugW3hDf6qbzhBjBihWx999TY=; b=dOH8slaZg0GkCDY80hhTRemTP2N1D3fNYXq0DsxQRiCpvbpTfZ5DG+NqR8Lq09p0PAhEGBvA5XBU25VwYI86/AQq4ABcNWLD1Z3XLhxGNs2iVJ5sfGOKBFBKD91IpK57zvDA+1rfBDhzQzeN/YuLzEnXzLUFqEVlL6P3Y0fTGaSVXZ1Vqhda9MrdHgF2um1aev9+Znk0VnfAYdBBhRVMIkP78wLXIh7oafqwi1cJDT//xcncZqCtpUAi7JHzssBQRMu7ku7GiEhTpdj0D9f7kn3N2PjMem2BSXw8BojndAeeNvcUqo+33sDaHs4Wfzyljr3zKO94AwK24WhEIJfmdQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.36) smtp.rcpttodomain=dpdk.org 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=bIpSAuF3Fr/6XNIkxYjugW3hDf6qbzhBjBihWx999TY=; b=solIN8BCRqur6FksxI5PZYbhJLyyrAKnxBo+inUoAdNUaNNv0HfGxFR8XJxXbKnxuJlpZx/226T3Njw9yITDvNEsjtRGPzNTnqTl46jC8RHmYS2jkgCATfev/bSqYa/GSRRtrdu2qMvEdfiYFtMIstJXzkdBqTHHtSuaA+KT2Wtn1WuaM9c5M0ciXU4pJu1s4NOkUb3cB1JhDsUYXskyNXYabDQ7tyvoeqOI/BHOADIoizyn7XbCcreT99iZ10SKac8rkz2KYuEU8y1rVyTS5d3rrIiaaYxJ0Ychfkffh8d9TCTxt2QYg7gvMwrfdYAPaUErpLsnbVBkhREMtHgORg== Received: from BN6PR20CA0064.namprd20.prod.outlook.com (2603:10b6:404:151::26) by MN2PR12MB4637.namprd12.prod.outlook.com (2603:10b6:208:3e::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.16; Tue, 17 Aug 2021 13:45:39 +0000 Received: from BN8NAM11FT022.eop-nam11.prod.protection.outlook.com (2603:10b6:404:151:cafe::8a) by BN6PR20CA0064.outlook.office365.com (2603:10b6:404:151::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Tue, 17 Aug 2021 13:45:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.36) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.36 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.36; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.36) by BN8NAM11FT022.mail.protection.outlook.com (10.13.176.112) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4415.14 via Frontend Transport; Tue, 17 Aug 2021 13:45:39 +0000 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 17 Aug 2021 13:45:37 +0000 Received: from nvidia.com (172.20.187.6) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 17 Aug 2021 13:45:36 +0000 From: Michael Baum To: CC: Matan Azrad , Raslan Darawsheh , Viacheslav Ovsiienko Date: Tue, 17 Aug 2021 16:44:34 +0300 Message-ID: <20210817134441.1966618-15-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210817134441.1966618-1-michaelba@nvidia.com> References: <20210817134441.1966618-1-michaelba@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To DRHQMAIL107.nvidia.com (10.27.9.16) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a084676e-774c-4db3-d6eb-08d961854c9c X-MS-TrafficTypeDiagnostic: MN2PR12MB4637: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:324; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iKciz0Pvn072EnIa9Dy81FVSaPFQJOd+psKQZYi7bizu/v3eIpe/7uyUyWn8mF/bqb4+DyowrjNbJ7NRzrlXeyRc+55eNuoEcNX2hcNZntqXETgq1c/AdI5N1Z22q6UJ0AUc5cwBOkFiVo4mOtvEqf31FJ851pqhO+p1/qHXiCy1XvpZRP0bOfuW/ya/X7T16/3lcXy6NB1ZXKM7KgIOsLIoxcgpEWrMLHhLzSwQC2x0RIZ6GjCcdeT0uw879ZmEBj8dsdhe4U1TxK4AaruGgUfD3XlyCTsM1xXi0QZ05kf5V+xGYVMPKzk/MIq30tzvWF9CRvHAXuCLk4pTUPJHTUl+ea1jpS/6lBEoPSAEz9SLxsFKFKhkf036HAMPehpP5tOwXw12fvWXATxUtyKSIzFHt0WoN5YzE/3Rp9dBn+AKy9CdlSp6RNfN3bmv79JG4Bb8jv3EYipxJDQGIDXJ5wEji+r4a2u5mxAc6gLv5VEjNqI9NYcAX08xD0mKCrvxg7aBIqWeisyj5whZVS8S+vtQgGBCtinQpTlnrcF8jJt3Rf29mseM2kggNnzclMvjHHECAOSsLPgVgIcYPs2QG7e1kqnAXMu8LVQCqMu0qVWe271FFTeJ6PtAPTKwYUtib0Y/McgFAR5GeHW0X0P4yqHmdSOREbJERnp4jjseoMiYyx4sV0oH8NGEjEfaaT5EGhnwyzLYHMb6QCRpAjcy+w== X-Forefront-Antispam-Report: CIP:216.228.112.36; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid05.nvidia.com; CAT:NONE; SFS:(4636009)(39860400002)(136003)(396003)(346002)(376002)(36840700001)(46966006)(6286002)(4326008)(26005)(186003)(16526019)(2616005)(82740400003)(82310400003)(6916009)(5660300002)(316002)(8936002)(8676002)(54906003)(86362001)(426003)(1076003)(70206006)(107886003)(55016002)(2906002)(36860700001)(478600001)(30864003)(36756003)(7636003)(7696005)(47076005)(83380400001)(356005)(336012)(70586007); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2021 13:45:39.1998 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a084676e-774c-4db3-d6eb-08d961854c9c 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.36]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT022.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4637 Subject: [dpdk-dev] [RFC 14/21] mlx5: update device sent to probing 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" Use mlx5 device structure as a parameter to probe function. This structure will contain the shared device context. Signed-off-by: Michael Baum --- drivers/common/mlx5/mlx5_common.c | 4 ++-- drivers/common/mlx5/mlx5_common.h | 10 +++++++-- drivers/common/mlx5/mlx5_common_private.h | 6 ------ drivers/compress/mlx5/mlx5_compress.c | 12 +++++------ drivers/crypto/mlx5/mlx5_crypto.c | 15 +++++++------- drivers/net/mlx5/linux/mlx5_os.c | 25 ++++++++++++----------- drivers/net/mlx5/mlx5.c | 6 +++--- drivers/net/mlx5/mlx5.h | 4 ++-- drivers/net/mlx5/windows/mlx5_os.c | 10 ++++----- drivers/regex/mlx5/mlx5_regex.c | 12 +++++------ drivers/vdpa/mlx5/mlx5_vdpa.c | 12 +++++------ 11 files changed, 59 insertions(+), 57 deletions(-) diff --git a/drivers/common/mlx5/mlx5_common.c b/drivers/common/mlx5/mlx5_common.c index ffd2c2c129..0870ee0718 100644 --- a/drivers/common/mlx5/mlx5_common.c +++ b/drivers/common/mlx5/mlx5_common.c @@ -404,7 +404,7 @@ drivers_remove(struct mlx5_common_device *dev, uint32_t enabled_classes) while (enabled_classes) { driver = driver_get(RTE_BIT64(i)); if (driver != NULL) { - local_ret = driver->remove(dev->dev); + local_ret = driver->remove(dev); if (local_ret == 0) dev->classes_loaded &= ~RTE_BIT64(i); else if (ret == 0) @@ -438,7 +438,7 @@ drivers_probe(struct mlx5_common_device *dev, uint32_t user_classes) ret = -EEXIST; goto probe_err; } - ret = driver->probe(dev->dev); + ret = driver->probe(dev); if (ret < 0) { DRV_LOG(ERR, "Failed to load driver %s", driver->name); diff --git a/drivers/common/mlx5/mlx5_common.h b/drivers/common/mlx5/mlx5_common.h index c4e86c3175..c5f2a6285f 100644 --- a/drivers/common/mlx5/mlx5_common.h +++ b/drivers/common/mlx5/mlx5_common.h @@ -335,6 +335,12 @@ struct mlx5_dev_ctx { int numa_node; /* Numa node of device. */ }; +struct mlx5_common_device { + struct rte_device *dev; + TAILQ_ENTRY(mlx5_common_device) next; + uint32_t classes_loaded; +}; + /** * Uninitialize context device and release all its resources. * @@ -367,12 +373,12 @@ int mlx5_dev_ctx_prepare(struct mlx5_dev_ctx *dev_ctx, struct rte_device *dev, /** * Initialization function for the driver called during device probing. */ -typedef int (mlx5_class_driver_probe_t)(struct rte_device *dev); +typedef int (mlx5_class_driver_probe_t)(struct mlx5_common_device *dev); /** * Uninitialization function for the driver called during hot-unplugging. */ -typedef int (mlx5_class_driver_remove_t)(struct rte_device *dev); +typedef int (mlx5_class_driver_remove_t)(struct mlx5_common_device *dev); /** * Driver-specific DMA mapping. After a successful call the device diff --git a/drivers/common/mlx5/mlx5_common_private.h b/drivers/common/mlx5/mlx5_common_private.h index a038330375..04c0af3763 100644 --- a/drivers/common/mlx5/mlx5_common_private.h +++ b/drivers/common/mlx5/mlx5_common_private.h @@ -16,12 +16,6 @@ extern "C" { /* Common bus driver: */ -struct mlx5_common_device { - struct rte_device *dev; - TAILQ_ENTRY(mlx5_common_device) next; - uint32_t classes_loaded; -}; - int mlx5_common_dev_probe(struct rte_device *eal_dev); int mlx5_common_dev_remove(struct rte_device *eal_dev); int mlx5_common_dev_dma_map(struct rte_device *dev, void *addr, uint64_t iova, diff --git a/drivers/compress/mlx5/mlx5_compress.c b/drivers/compress/mlx5/mlx5_compress.c index e906ddb066..8348ea8ea3 100644 --- a/drivers/compress/mlx5/mlx5_compress.c +++ b/drivers/compress/mlx5/mlx5_compress.c @@ -748,7 +748,7 @@ mlx5_compress_mr_mem_event_cb(enum rte_mem_event event_type, const void *addr, } static int -mlx5_compress_dev_probe(struct rte_device *dev) +mlx5_compress_dev_probe(struct mlx5_common_device *dev) { struct rte_compressdev *cdev; struct mlx5_dev_ctx *dev_ctx; @@ -756,7 +756,7 @@ mlx5_compress_dev_probe(struct rte_device *dev) struct mlx5_hca_attr att = { 0 }; struct rte_compressdev_pmd_init_params init_params = { .name = "", - .socket_id = dev->numa_node, + .socket_id = dev->dev->numa_node, }; const char *ibdev_name; int ret; @@ -773,7 +773,7 @@ mlx5_compress_dev_probe(struct rte_device *dev) rte_errno = ENOMEM; return -rte_errno; } - ret = mlx5_dev_ctx_prepare(dev_ctx, dev, MLX5_CLASS_COMPRESS); + ret = mlx5_dev_ctx_prepare(dev_ctx, dev->dev, MLX5_CLASS_COMPRESS); if (ret < 0) { DRV_LOG(ERR, "Failed to create device context."); mlx5_free(dev_ctx); @@ -791,7 +791,7 @@ mlx5_compress_dev_probe(struct rte_device *dev) rte_errno = ENOTSUP; return -ENOTSUP; } - cdev = rte_compressdev_pmd_create(ibdev_name, dev, + cdev = rte_compressdev_pmd_create(ibdev_name, dev->dev, sizeof(*priv), &init_params); if (cdev == NULL) { DRV_LOG(ERR, "Failed to create device \"%s\".", ibdev_name); @@ -840,13 +840,13 @@ mlx5_compress_dev_probe(struct rte_device *dev) } static int -mlx5_compress_dev_remove(struct rte_device *dev) +mlx5_compress_dev_remove(struct mlx5_common_device *dev) { struct mlx5_compress_priv *priv = NULL; pthread_mutex_lock(&priv_list_lock); TAILQ_FOREACH(priv, &mlx5_compress_priv_list, next) - if (priv->cdev->device == dev) + if (priv->cdev->device == dev->dev) break; if (priv) TAILQ_REMOVE(&mlx5_compress_priv_list, priv, next); diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c index 7cb5bb5445..44656225d2 100644 --- a/drivers/crypto/mlx5/mlx5_crypto.c +++ b/drivers/crypto/mlx5/mlx5_crypto.c @@ -942,7 +942,7 @@ mlx5_crypto_mr_mem_event_cb(enum rte_mem_event event_type, const void *addr, } static int -mlx5_crypto_dev_probe(struct rte_device *dev) +mlx5_crypto_dev_probe(struct mlx5_common_device *dev) { struct rte_cryptodev *crypto_dev; struct mlx5_dev_ctx *dev_ctx; @@ -953,7 +953,7 @@ mlx5_crypto_dev_probe(struct rte_device *dev) struct rte_cryptodev_pmd_init_params init_params = { .name = "", .private_data_size = sizeof(struct mlx5_crypto_priv), - .socket_id = dev->numa_node, + .socket_id = dev->dev->numa_node, .max_nb_queue_pairs = RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS, }; @@ -973,7 +973,7 @@ mlx5_crypto_dev_probe(struct rte_device *dev) rte_errno = ENOMEM; return -rte_errno; } - ret = mlx5_dev_ctx_prepare(dev_ctx, dev, MLX5_CLASS_CRYPTO); + ret = mlx5_dev_ctx_prepare(dev_ctx, dev->dev, MLX5_CLASS_CRYPTO); if (ret < 0) { DRV_LOG(ERR, "Failed to create device context."); mlx5_free(dev_ctx); @@ -990,7 +990,7 @@ mlx5_crypto_dev_probe(struct rte_device *dev) rte_errno = ENOTSUP; return -ENOTSUP; } - ret = mlx5_crypto_parse_devargs(dev->devargs, &devarg_prms); + ret = mlx5_crypto_parse_devargs(dev->dev->devargs, &devarg_prms); if (ret) { DRV_LOG(ERR, "Failed to parse devargs."); mlx5_dev_ctx_release(dev_ctx); @@ -1005,7 +1005,8 @@ mlx5_crypto_dev_probe(struct rte_device *dev) mlx5_free(dev_ctx); return -rte_errno; } - crypto_dev = rte_cryptodev_pmd_create(ibdev_name, dev, &init_params); + crypto_dev = rte_cryptodev_pmd_create(ibdev_name, dev->dev, + &init_params); if (crypto_dev == NULL) { DRV_LOG(ERR, "Failed to create device \"%s\".", ibdev_name); mlx5_dev_ctx_release(dev_ctx); @@ -1065,13 +1066,13 @@ mlx5_crypto_dev_probe(struct rte_device *dev) } static int -mlx5_crypto_dev_remove(struct rte_device *dev) +mlx5_crypto_dev_remove(struct mlx5_common_device *dev) { struct mlx5_crypto_priv *priv = NULL; pthread_mutex_lock(&priv_list_lock); TAILQ_FOREACH(priv, &mlx5_crypto_priv_list, next) - if (priv->crypto_dev->device == dev) + if (priv->crypto_dev->device == dev->dev) break; if (priv) TAILQ_REMOVE(&mlx5_crypto_priv_list, priv, next); diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index e2a7c3d09c..812aadaaa4 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -2655,21 +2655,22 @@ mlx5_os_parse_eth_devargs(struct rte_device *dev, * * This function spawns Ethernet devices out of a given PCI device. * - * @param[in] pci_dev - * PCI device information. + * @param[in] dev + * Pointer to mlx5 device structure. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */ static int -mlx5_os_pci_probe(struct rte_pci_device *pci_dev, struct mlx5_dev_ctx *dev_ctx, +mlx5_os_pci_probe(struct mlx5_common_device *dev, struct mlx5_dev_ctx *dev_ctx, uint8_t devx) { + struct rte_pci_device *pci_dev = RTE_DEV_TO_PCI(dev->dev); struct rte_eth_devargs eth_da = { .nb_ports = 0 }; int ret = 0; uint16_t p; - ret = mlx5_os_parse_eth_devargs(&pci_dev->device, ð_da); + ret = mlx5_os_parse_eth_devargs(dev->dev, ð_da); if (ret != 0) return ret; @@ -2687,7 +2688,7 @@ mlx5_os_pci_probe(struct rte_pci_device *pci_dev, struct mlx5_dev_ctx *dev_ctx, pci_dev->addr.domain, pci_dev->addr.bus, pci_dev->addr.devid, pci_dev->addr.function, eth_da.ports[p]); - mlx5_net_remove(&pci_dev->device); + mlx5_net_remove(dev); } } else { ret = mlx5_os_pci_probe_pf(pci_dev, dev_ctx, ð_da, 0, devx); @@ -2873,13 +2874,13 @@ mlx5_verbs_dev_ctx_prepare(struct mlx5_dev_ctx *dev_ctx, struct rte_device *dev) * This function probe PCI bus device(s) or a single SF on auxiliary bus. * * @param[in] dev - * Pointer to the generic device. + * Pointer to the common device. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_os_net_probe(struct rte_device *dev) +mlx5_os_net_probe(struct mlx5_common_device *dev) { struct mlx5_dev_ctx *dev_ctx; uint8_t devx = 0; @@ -2896,14 +2897,14 @@ mlx5_os_net_probe(struct rte_device *dev) * Initialize context device and allocate all its resources. * Try to do it with DV first, then usual Verbs. */ - ret = mlx5_dev_ctx_prepare(dev_ctx, dev, MLX5_CLASS_ETH); + ret = mlx5_dev_ctx_prepare(dev_ctx, dev->dev, MLX5_CLASS_ETH); if (ret < 0) { goto error; } else if (dev_ctx->ctx) { devx = 1; DRV_LOG(DEBUG, "DevX is supported."); } else { - ret = mlx5_verbs_dev_ctx_prepare(dev_ctx, dev); + ret = mlx5_verbs_dev_ctx_prepare(dev_ctx, dev->dev); if (ret < 0) goto error; DRV_LOG(DEBUG, "DevX is NOT supported."); @@ -2916,10 +2917,10 @@ mlx5_os_net_probe(struct rte_device *dev) strerror(rte_errno)); goto error; } - if (mlx5_dev_is_pci(dev)) - ret = mlx5_os_pci_probe(RTE_DEV_TO_PCI(dev), dev_ctx, devx); + if (mlx5_dev_is_pci(dev->dev)) + ret = mlx5_os_pci_probe(dev, dev_ctx, devx); else - ret = mlx5_os_auxiliary_probe(dev, dev_ctx, devx); + ret = mlx5_os_auxiliary_probe(dev->dev, dev_ctx, devx); if (ret) goto error; return ret; diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index b695f2f6d3..e0b180e83c 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -2394,13 +2394,13 @@ mlx5_get_dev_ctx(struct rte_device *dev) * 0 on success, the function cannot fail. */ int -mlx5_net_remove(struct rte_device *dev) +mlx5_net_remove(struct mlx5_common_device *dev) { - struct mlx5_dev_ctx *dev_ctx = mlx5_get_dev_ctx(dev); + struct mlx5_dev_ctx *dev_ctx = mlx5_get_dev_ctx(dev->dev); uint16_t port_id; int ret = 0; - RTE_ETH_FOREACH_DEV_OF(port_id, dev) { + RTE_ETH_FOREACH_DEV_OF(port_id, dev->dev) { /* * mlx5_dev_close() is not registered to secondary process, * call the close function explicitly for secondary process. diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index f6d8e1d817..26b23a6053 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -1481,7 +1481,7 @@ int mlx5_udp_tunnel_port_add(struct rte_eth_dev *dev, struct rte_eth_udp_tunnel *udp_tunnel); uint16_t mlx5_eth_find_next(uint16_t port_id, struct rte_device *odev); int mlx5_dev_close(struct rte_eth_dev *dev); -int mlx5_net_remove(struct rte_device *dev); +int mlx5_net_remove(struct mlx5_common_device *dev); bool mlx5_is_hpf(struct rte_eth_dev *dev); bool mlx5_is_sf_repr(struct rte_eth_dev *dev); void mlx5_age_event_prepare(struct mlx5_dev_ctx_shared *sh); @@ -1768,7 +1768,7 @@ void mlx5_flow_meter_rxq_flush(struct rte_eth_dev *dev); struct rte_pci_driver; int mlx5_os_get_dev_attr(void *ctx, struct mlx5_dev_attr *dev_attr); void mlx5_os_free_shared_dr(struct mlx5_priv *priv); -int mlx5_os_net_probe(struct rte_device *dev); +int mlx5_os_net_probe(struct mlx5_common_device *dev); void mlx5_os_dev_shared_handler_install(struct mlx5_dev_ctx_shared *sh); void mlx5_os_dev_shared_handler_uninstall(struct mlx5_dev_ctx_shared *sh); void mlx5_os_set_reg_mr_cb(mlx5_reg_mr_t *reg_mr_cb, diff --git a/drivers/net/mlx5/windows/mlx5_os.c b/drivers/net/mlx5/windows/mlx5_os.c index f6a7fbaca1..f21fb60272 100644 --- a/drivers/net/mlx5/windows/mlx5_os.c +++ b/drivers/net/mlx5/windows/mlx5_os.c @@ -869,15 +869,15 @@ mlx5_os_set_allmulti(struct rte_eth_dev *dev, int enable) * This function spawns Ethernet devices out of a given device. * * @param[in] dev - * Pointer to the generic device. + * Pointer to the common device. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_os_net_probe(struct rte_device *dev) +mlx5_os_net_probe(struct mlx5_common_device *dev) { - struct rte_pci_device *pci_dev = RTE_DEV_TO_PCI(dev); + struct rte_pci_device *pci_dev = RTE_DEV_TO_PCI(dev->dev); struct mlx5_dev_ctx *dev_ctx; struct mlx5_dev_spawn_data spawn = { .pf_bond = -1 }; struct mlx5_dev_config dev_config; @@ -902,7 +902,7 @@ mlx5_os_net_probe(struct rte_device *dev) rte_errno = ENOMEM; return -rte_errno; } - ret = mlx5_dev_ctx_prepare(dev_ctx, dev, MLX5_CLASS_ETH); + ret = mlx5_dev_ctx_prepare(dev_ctx, dev->dev, MLX5_CLASS_ETH); if (ret < 0) goto error; memset(&spawn.info, 0, sizeof(spawn.info)); @@ -954,7 +954,7 @@ mlx5_os_net_probe(struct rte_device *dev) dev_config.dv_flow_en = 1; dev_config.decap_en = 0; dev_config.log_hp_size = MLX5_ARG_UNSET; - spawn.eth_dev = mlx5_dev_spawn(dev, dev_ctx, &spawn, &dev_config); + spawn.eth_dev = mlx5_dev_spawn(dev->dev, dev_ctx, &spawn, &dev_config); if (!spawn.eth_dev) { ret = -rte_errno; goto error; diff --git a/drivers/regex/mlx5/mlx5_regex.c b/drivers/regex/mlx5/mlx5_regex.c index 11b24cde39..78fa90797c 100644 --- a/drivers/regex/mlx5/mlx5_regex.c +++ b/drivers/regex/mlx5/mlx5_regex.c @@ -122,7 +122,7 @@ mlx5_regex_mr_mem_event_cb(enum rte_mem_event event_type, const void *addr, } static int -mlx5_regex_dev_probe(struct rte_device *rte_dev) +mlx5_regex_dev_probe(struct mlx5_common_device *mlx5_dev) { struct mlx5_regex_priv *priv = NULL; struct mlx5_dev_ctx *dev_ctx = NULL; @@ -139,7 +139,7 @@ mlx5_regex_dev_probe(struct rte_device *rte_dev) rte_errno = ENOMEM; return -rte_errno; } - ret = mlx5_dev_ctx_prepare(dev_ctx, rte_dev, MLX5_CLASS_REGEX); + ret = mlx5_dev_ctx_prepare(dev_ctx, mlx5_dev->dev, MLX5_CLASS_REGEX); if (ret < 0) { DRV_LOG(ERR, "Failed to create device context."); rte_free(dev_ctx); @@ -184,7 +184,7 @@ mlx5_regex_dev_probe(struct rte_device *rte_dev) priv->is_bf2 = 1; /* Default RXP programming mode to Shared. */ priv->prog_mode = MLX5_RXP_SHARED_PROG_MODE; - mlx5_regex_get_name(name, rte_dev); + mlx5_regex_get_name(name, mlx5_dev->dev); priv->regexdev = rte_regexdev_register(name); if (priv->regexdev == NULL) { DRV_LOG(ERR, "Failed to register RegEx device."); @@ -212,7 +212,7 @@ mlx5_regex_dev_probe(struct rte_device *rte_dev) priv->regexdev->enqueue = mlx5_regexdev_enqueue_gga; #endif priv->regexdev->dequeue = mlx5_regexdev_dequeue; - priv->regexdev->device = rte_dev; + priv->regexdev->device = mlx5_dev->dev; priv->regexdev->data->dev_private = priv; priv->regexdev->state = RTE_REGEXDEV_READY; priv->mr_scache.reg_mr_cb = mlx5_common_verbs_reg_mr; @@ -254,13 +254,13 @@ mlx5_regex_dev_probe(struct rte_device *rte_dev) } static int -mlx5_regex_dev_remove(struct rte_device *rte_dev) +mlx5_regex_dev_remove(struct mlx5_common_device *mlx5_dev) { char name[RTE_REGEXDEV_NAME_MAX_LEN]; struct rte_regexdev *dev; struct mlx5_regex_priv *priv = NULL; - mlx5_regex_get_name(name, rte_dev); + mlx5_regex_get_name(name, mlx5_dev->dev); dev = rte_regexdev_get_device_by_name(name); if (!dev) return 0; diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.c b/drivers/vdpa/mlx5/mlx5_vdpa.c index f773ac8711..6771445582 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa.c +++ b/drivers/vdpa/mlx5/mlx5_vdpa.c @@ -503,7 +503,7 @@ mlx5_vdpa_config_get(struct rte_devargs *devargs, struct mlx5_vdpa_priv *priv) } static int -mlx5_vdpa_dev_probe(struct rte_device *dev) +mlx5_vdpa_dev_probe(struct mlx5_common_device *dev) { struct mlx5_vdpa_priv *priv = NULL; struct mlx5_dev_ctx *dev_ctx = NULL; @@ -517,7 +517,7 @@ mlx5_vdpa_dev_probe(struct rte_device *dev) rte_errno = ENOMEM; return -rte_errno; } - ret = mlx5_dev_ctx_prepare(dev_ctx, dev, MLX5_CLASS_VDPA); + ret = mlx5_dev_ctx_prepare(dev_ctx, dev->dev, MLX5_CLASS_VDPA); if (ret < 0) { DRV_LOG(ERR, "Failed to create device context."); mlx5_free(dev_ctx); @@ -558,13 +558,13 @@ mlx5_vdpa_dev_probe(struct rte_device *dev) DRV_LOG(ERR, "Failed to allocate VAR %u.", errno); goto error; } - priv->vdev = rte_vdpa_register_device(dev, &mlx5_vdpa_ops); + priv->vdev = rte_vdpa_register_device(dev->dev, &mlx5_vdpa_ops); if (priv->vdev == NULL) { DRV_LOG(ERR, "Failed to register vDPA device."); rte_errno = rte_errno ? rte_errno : EINVAL; goto error; } - mlx5_vdpa_config_get(dev->devargs, priv); + mlx5_vdpa_config_get(dev->dev->devargs, priv); SLIST_INIT(&priv->mr_list); pthread_mutex_init(&priv->vq_config_lock, NULL); pthread_mutex_lock(&priv_list_lock); @@ -586,14 +586,14 @@ mlx5_vdpa_dev_probe(struct rte_device *dev) } static int -mlx5_vdpa_dev_remove(struct rte_device *dev) +mlx5_vdpa_dev_remove(struct mlx5_common_device *dev) { struct mlx5_vdpa_priv *priv = NULL; int found = 0; pthread_mutex_lock(&priv_list_lock); TAILQ_FOREACH(priv, &priv_list, next) { - if (priv->vdev->device == dev) { + if (priv->vdev->device == dev->dev) { found = 1; break; }