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 D5EE4A0C51; Tue, 13 Jul 2021 15:16:53 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 19CDD4126F; Tue, 13 Jul 2021 15:16:42 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2058.outbound.protection.outlook.com [40.107.244.58]) by mails.dpdk.org (Postfix) with ESMTP id 9746A406FF for ; Tue, 13 Jul 2021 15:16:40 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IzlKBJiuYmVo/cwru2wAqtcaykYNLxLkEfO0I5nWKH16Uv6a4WN7U7QLdHfRVByxgrcvNQG+WgUnW7ry3Id4UxLa5Nzvgcx2/CdwHPfxqpJ4eXWQtakbKgkykWgxz+ud9ndi/MJtQ62HKsmf3Q//EaBLecw01LZPa8xiFPOxe4kwsbvG7jSWAxX+WCif3RRtiHbcvZy3LJVtpw8+EyPl6vWX0efUgyc8Tm8m6mbWgZPT21aotBOSlpZNQvq1pBKzGaPFWcRaqZLUCFAtg9MUT5mvSxwq0vXWNVRDEk72XiIjjmkzkg9sOm/IWv6WvFdIklVymc+D2AxEvkZQspJtRA== 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=I0OyCnP4JuuyvYLSfcp2BYpKZPAIHz61ij7DsO8lHLY=; b=VUtEtu1Pjw2I0nxRhtiwQAnV9KnSw6lrFI+kWw/JxtNnkODHhUItj+6uJNjEQ1a4JM0RhvQ0PvQkx4KF6PWotqbHwy4ngw5wiB+cFsyhpq8r6yDRgfrXxEi/bqjQ3I6Gkzso2a4c+MlS2MF4ZrNC3qzLTIlcb4aoBbjKivdZtPYjK7gLVNJwRRjBIaHKE2vbCvNyQXotvEg8RcIKM6dma+flW5IppwyqyaxWntzbFS3pkYoc3kX/oDUUmWz3Z2JbUN1SgOiulm2QF1sXSt2X7wVhWsZMuASviYRD5yDRWsr9SKj5+2Xdqc+b4WzqoXhWYM+24LUhTLWmlyvUrNMqRg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none 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=I0OyCnP4JuuyvYLSfcp2BYpKZPAIHz61ij7DsO8lHLY=; b=iYO3ieRh1VdjTFhdX2w2Jw99rzTNse7ChinGIIaPGrj+5aYcrHPwY8kn1h8To0VwnHBRIIAXxbc8O5aq2KHRAg1QO3zU1fPBVGN84gyZhEcTCf48OY4JbyXV71NCUPwro/lQEh0XSij9ZO6hd6n5SQiAlxnVKI8bvMnqn1EGXzAmv2p37Hancdb6v2RvnSCtiKnx7qD0EX6mJEyYhETf6Gq4wjZM3SUeX2otW/xDzrPnZ2SObD70fYnk/yBe+/cQr2cbwcSGLFIVi0chgkcuNyr++rpmgUdegimKiidt9R8GDzDxf64z5BkcYWUSL02HZjcElOjCL474YKmJGUrQIw== Received: from MW4PR03CA0051.namprd03.prod.outlook.com (2603:10b6:303:8e::26) by CH2PR12MB5001.namprd12.prod.outlook.com (2603:10b6:610:61::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.22; Tue, 13 Jul 2021 13:16:39 +0000 Received: from CO1NAM11FT023.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8e:cafe::8b) by MW4PR03CA0051.outlook.office365.com (2603:10b6:303:8e::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.20 via Frontend Transport; Tue, 13 Jul 2021 13:16:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) 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.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 CO1NAM11FT023.mail.protection.outlook.com (10.13.175.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4308.20 via Frontend Transport; Tue, 13 Jul 2021 13:16:16 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 13 Jul 2021 13:16:02 +0000 From: Xueming Li To: Viacheslav Ovsiienko CC: , , Matan Azrad , Shahaf Shuler Date: Tue, 13 Jul 2021 21:14:28 +0800 Message-ID: <20210713131437.30170-6-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210616040935.311733-2-xuemingl@nvidia.com> References: <20210616040935.311733-2-xuemingl@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 HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 841134e1-7dda-4cf3-722b-08d9460072c5 X-MS-TrafficTypeDiagnostic: CH2PR12MB5001: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:48; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iaTtApFpLUvAPGupxhgnD5+TTnbVSYBgZvHmXJZ/rEnxd/kFq4soC6Ysi8bb9l3UMueiSPxWfW93GXr4vVdbnCIQhGImml5PKeb2T5+QeBz4N5oLEUHxN+NPV70QmD+xjoBgLLbXKkF7hotPN7A0uCJWzngvKeHAbH6zY6lf3l8PQquC9oCcDJjPfkZL0/Nn+ma7Lujrax1WpUbVEfSZD2CfmB4b34pUqepYlQDfIWIcESMg/WFdapEC8PgJNducGkF6NmAdiYaRJczRqLq3eCIjwdyJA9esFGboyRHSe2focdVcshcRz1NaDLOCTIMUgMd8DVVCvuwCz9fhM8/7zxhlRFwAhN18Euu9MAtju6RtpzcM0txcvwdDw4Co+KZuB75l9kdIoTKZ1QhDjOFhuebfWq2WUFDi0UO6jvIVPZoKoolVZEGnL3WfFhFdOWG5htkMu+RlCUM3HItvGImwUPt3BKMaoiUtQT1tLFwbcXc0FKBX8KeTkdzQqFjFLDlNoETxUcTavMKla/6Bkj2VaultUcRA75hC1HwBDO3wlAbCd9IeBR6jT39NTVO/e2jXrbxLb7Zq2KbAN1KtzjRHmRUoDKT0SvrU7OHGpxtN1QmmPYy+zvQvDCrSoK2kchjkAc8smHOrZ5LRAk75noDnIV1sJ2jlPbHZFrbLOwKg85ujhiRwuBzqaoZvrjPKKFGrh9/GgVVYLCogoj20VuRFnyBilWldMjZTMd4XBbd8qbQ= 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)(346002)(396003)(39860400002)(376002)(136003)(46966006)(36840700001)(6636002)(54906003)(8676002)(70586007)(70206006)(30864003)(478600001)(26005)(37006003)(356005)(55016002)(7696005)(5660300002)(1076003)(47076005)(4326008)(83380400001)(36756003)(426003)(6286002)(86362001)(336012)(6862004)(8936002)(36906005)(316002)(2616005)(7636003)(107886003)(16526019)(186003)(82310400003)(36860700001)(34020700004)(6666004)(82740400003)(2906002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2021 13:16:16.2781 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 841134e1-7dda-4cf3-722b-08d9460072c5 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: CO1NAM11FT023.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB5001 Subject: [dpdk-dev] [PATCH v2 05/14] net/mlx5: remove PCI dependency 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" To support more bus types, remove PCI dependency where possible. Signed-off-by: Xueming Li --- drivers/net/mlx5/linux/mlx5_ethdev_os.c | 2 +- drivers/net/mlx5/linux/mlx5_os.c | 4 +-- drivers/net/mlx5/mlx5.c | 45 ++++++++++++++----------- drivers/net/mlx5/mlx5.h | 9 ++--- drivers/net/mlx5/mlx5_ethdev.c | 2 +- drivers/net/mlx5/mlx5_mr.c | 14 ++++---- drivers/net/mlx5/mlx5_trigger.c | 12 +++---- drivers/net/mlx5/mlx5_txq.c | 3 +- drivers/net/mlx5/windows/mlx5_os.c | 3 +- 9 files changed, 51 insertions(+), 43 deletions(-) diff --git a/drivers/net/mlx5/linux/mlx5_ethdev_os.c b/drivers/net/mlx5/linux/mlx5_ethdev_os.c index ddc1371aa9..b05b9fc950 100644 --- a/drivers/net/mlx5/linux/mlx5_ethdev_os.c +++ b/drivers/net/mlx5/linux/mlx5_ethdev_os.c @@ -346,7 +346,7 @@ mlx5_find_master_dev(struct rte_eth_dev *dev) priv = dev->data->dev_private; domain_id = priv->domain_id; MLX5_ASSERT(priv->representor); - MLX5_ETH_FOREACH_DEV(port_id, priv->pci_dev) { + MLX5_ETH_FOREACH_DEV(port_id, dev->device) { struct mlx5_priv *opriv = rte_eth_devices[port_id].data->dev_private; if (opriv && diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 5c568794d7..8ebadc895d 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1177,7 +1177,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, * Look for sibling devices in order to reuse their switch domain * if any, otherwise allocate one. */ - MLX5_ETH_FOREACH_DEV(port_id, priv->pci_dev) { + MLX5_ETH_FOREACH_DEV(port_id, NULL) { const struct mlx5_priv *opriv = rte_eth_devices[port_id].data->dev_private; @@ -2434,6 +2434,7 @@ mlx5_os_pci_probe_pf(struct rte_pci_device *pci_dev, dev_config.decap_en = 1; dev_config.log_hp_size = MLX5_ARG_UNSET; dev_config.allow_duplicate_pattern = 1; + list[i].numa_node = pci_dev->device.numa_node; list[i].eth_dev = mlx5_dev_spawn(&pci_dev->device, &list[i], &dev_config, @@ -2631,7 +2632,6 @@ mlx5_os_open_device(const struct mlx5_dev_spawn_data *spawn, int dbmap_env; int err = 0; - sh->numa_node = spawn->pci_dev->device.numa_node; pthread_mutex_init(&sh->txpp.mutex, NULL); /* * Configure environment variable "MLX5_BF_SHUT_UP" diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index d9c90d5ef9..8e64bf955b 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1120,6 +1120,7 @@ mlx5_alloc_shared_dev_ctx(const struct mlx5_dev_spawn_data *spawn, rte_errno = ENOMEM; goto exit; } + sh->numa_node = spawn->numa_node; if (spawn->bond_info) sh->bond = *spawn->bond_info; err = mlx5_os_open_device(spawn, config, sh); @@ -1197,7 +1198,7 @@ mlx5_alloc_shared_dev_ctx(const struct mlx5_dev_spawn_data *spawn, */ err = mlx5_mr_btree_init(&sh->share_cache.cache, MLX5_MR_BTREE_CACHE_N * 2, - spawn->pci_dev->device.numa_node); + sh->numa_node); if (err) { err = rte_errno; goto error; @@ -1635,7 +1636,7 @@ mlx5_dev_close(struct rte_eth_dev *dev) unsigned int c = 0; uint16_t port_id; - MLX5_ETH_FOREACH_DEV(port_id, priv->pci_dev) { + MLX5_ETH_FOREACH_DEV(port_id, dev->device) { struct mlx5_priv *opriv = rte_eth_devices[port_id].data->dev_private; @@ -2077,18 +2078,20 @@ mlx5_set_min_inline(struct mlx5_dev_spawn_data *spawn, { if (config->txq_inline_min != MLX5_ARG_UNSET) { /* Application defines size of inlined data explicitly. */ - switch (spawn->pci_dev->id.device_id) { - case PCI_DEVICE_ID_MELLANOX_CONNECTX4: - case PCI_DEVICE_ID_MELLANOX_CONNECTX4VF: - if (config->txq_inline_min < - (int)MLX5_INLINE_HSIZE_L2) { - DRV_LOG(DEBUG, - "txq_inline_mix aligned to minimal" - " ConnectX-4 required value %d", - (int)MLX5_INLINE_HSIZE_L2); - config->txq_inline_min = MLX5_INLINE_HSIZE_L2; + if (spawn->pci_dev != NULL) { + switch (spawn->pci_dev->id.device_id) { + case PCI_DEVICE_ID_MELLANOX_CONNECTX4: + case PCI_DEVICE_ID_MELLANOX_CONNECTX4VF: + if (config->txq_inline_min < + (int)MLX5_INLINE_HSIZE_L2) { + DRV_LOG(DEBUG, + "txq_inline_mix aligned to minimal ConnectX-4 required value %d", + (int)MLX5_INLINE_HSIZE_L2); + config->txq_inline_min = + MLX5_INLINE_HSIZE_L2; + } + break; } - break; } goto exit; } @@ -2142,6 +2145,10 @@ mlx5_set_min_inline(struct mlx5_dev_spawn_data *spawn, } } } + if (spawn->pci_dev == NULL) { + config->txq_inline_min = MLX5_INLINE_HSIZE_NONE; + goto exit; + } /* * We get here if we are unable to deduce * inline data size with DevX. Try PCI ID @@ -2276,7 +2283,7 @@ mlx5_dev_check_sibling_config(struct mlx5_priv *priv, if (sh->refcnt == 1) return 0; /* Find the device with shared context. */ - MLX5_ETH_FOREACH_DEV(port_id, priv->pci_dev) { + MLX5_ETH_FOREACH_DEV(port_id, NULL) { struct mlx5_priv *opriv = rte_eth_devices[port_id].data->dev_private; @@ -2307,25 +2314,25 @@ mlx5_dev_check_sibling_config(struct mlx5_priv *priv, * * @param[in] port_id * port_id to start looking for device. - * @param[in] pci_dev - * Pointer to the hint PCI device. When device is being probed + * @param[in] odev + * Pointer to the hint device. When device is being probed * the its siblings (master and preceding representors might * not have assigned driver yet (because the mlx5_os_pci_probe() - * is not completed yet, for this case match on hint PCI + * is not completed yet, for this case match on hint * device may be used to detect sibling device. * * @return * port_id of found device, RTE_MAX_ETHPORT if not found. */ uint16_t -mlx5_eth_find_next(uint16_t port_id, struct rte_pci_device *pci_dev) +mlx5_eth_find_next(uint16_t port_id, struct rte_device *odev) { while (port_id < RTE_MAX_ETHPORTS) { struct rte_eth_dev *dev = &rte_eth_devices[port_id]; if (dev->state != RTE_ETH_DEV_UNUSED && dev->device && - (dev->device == &pci_dev->device || + (dev->device == odev || (dev->device->driver && dev->device->driver->name && !strcmp(dev->device->driver->name, MLX5_PCI_DRIVER_NAME)))) diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 30893c7f38..6e6a2b28b2 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -134,6 +134,7 @@ struct mlx5_dev_spawn_data { uint32_t max_port; /**< Device maximal port index. */ uint32_t phys_port; /**< Device physical port index. */ int pf_bond; /**< bonding device PF index. < 0 - no bonding */ + int numa_node; /**< Device numa node. */ struct mlx5_switch_info info; /**< Switch information. */ void *phys_dev; /**< Associated physical device. */ struct rte_eth_dev *eth_dev; /**< Associated Ethernet device. */ @@ -1460,16 +1461,16 @@ int mlx5_proc_priv_init(struct rte_eth_dev *dev); void mlx5_proc_priv_uninit(struct rte_eth_dev *dev); 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_pci_device *pci_dev); +uint16_t mlx5_eth_find_next(uint16_t port_id, struct rte_device *odev); int mlx5_dev_close(struct rte_eth_dev *dev); bool mlx5_is_hpf(struct rte_eth_dev *dev); void mlx5_age_event_prepare(struct mlx5_dev_ctx_shared *sh); /* Macro to iterate over all valid ports for mlx5 driver. */ -#define MLX5_ETH_FOREACH_DEV(port_id, pci_dev) \ - for (port_id = mlx5_eth_find_next(0, pci_dev); \ +#define MLX5_ETH_FOREACH_DEV(port_id, dev) \ + for (port_id = mlx5_eth_find_next(0, dev); \ port_id < RTE_MAX_ETHPORTS; \ - port_id = mlx5_eth_find_next(port_id + 1, pci_dev)) + port_id = mlx5_eth_find_next(port_id + 1, dev)) int mlx5_args(struct mlx5_dev_config *config, struct rte_devargs *devargs); struct mlx5_dev_ctx_shared * mlx5_alloc_shared_dev_ctx(const struct mlx5_dev_spawn_data *spawn, diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c index c32eeefd88..82e2284d98 100644 --- a/drivers/net/mlx5/mlx5_ethdev.c +++ b/drivers/net/mlx5/mlx5_ethdev.c @@ -335,7 +335,7 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) if (priv->representor) { uint16_t port_id; - MLX5_ETH_FOREACH_DEV(port_id, priv->pci_dev) { + MLX5_ETH_FOREACH_DEV(port_id, dev->device) { struct mlx5_priv *opriv = rte_eth_devices[port_id].data->dev_private; diff --git a/drivers/net/mlx5/mlx5_mr.c b/drivers/net/mlx5/mlx5_mr.c index 89c43fc9e9..87fb4371a4 100644 --- a/drivers/net/mlx5/mlx5_mr.c +++ b/drivers/net/mlx5/mlx5_mr.c @@ -199,23 +199,23 @@ mlx5_mr_update_ext_mp_cb(struct rte_mempool *mp, void *opaque, } /** - * Finds the first ethdev that match the pci device. + * Finds the first ethdev that match the device. * The existence of multiple ethdev per pci device is only with representors. * On such case, it is enough to get only one of the ports as they all share * the same ibv context. * - * @param pdev - * Pointer to the PCI device. + * @param dev + * Pointer to the device. * * @return * Pointer to the ethdev if found, NULL otherwise. */ static struct rte_eth_dev * -pci_dev_to_eth_dev(struct rte_pci_device *pdev) +dev_to_eth_dev(struct rte_device *dev) { uint16_t port_id; - port_id = rte_eth_find_next_of(0, &pdev->device); + port_id = rte_eth_find_next_of(0, dev); if (port_id == RTE_MAX_ETHPORTS) return NULL; return &rte_eth_devices[port_id]; @@ -245,7 +245,7 @@ mlx5_dma_map(struct rte_pci_device *pdev, void *addr, struct mlx5_priv *priv; struct mlx5_dev_ctx_shared *sh; - dev = pci_dev_to_eth_dev(pdev); + dev = dev_to_eth_dev(&pdev->device); if (!dev) { DRV_LOG(WARNING, "unable to find matching ethdev " "to PCI device %p", (void *)pdev); @@ -295,7 +295,7 @@ mlx5_dma_unmap(struct rte_pci_device *pdev, void *addr, struct mlx5_mr *mr; struct mr_cache_entry entry; - dev = pci_dev_to_eth_dev(pdev); + dev = dev_to_eth_dev(&pdev->device); if (!dev) { DRV_LOG(WARNING, "unable to find matching ethdev " "to PCI device %p", (void *)pdev); diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index 7cb8920d6b..6d2351f5a8 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -697,7 +697,7 @@ mlx5_hairpin_bind_single_port(struct rte_eth_dev *dev, uint16_t rx_port) uint32_t explicit; uint16_t rx_queue; - if (mlx5_eth_find_next(rx_port, priv->pci_dev) != rx_port) { + if (mlx5_eth_find_next(rx_port, dev->device) != rx_port) { rte_errno = ENODEV; DRV_LOG(ERR, "Rx port %u does not belong to mlx5", rx_port); return -rte_errno; @@ -835,7 +835,7 @@ mlx5_hairpin_unbind_single_port(struct rte_eth_dev *dev, uint16_t rx_port) int ret; uint16_t cur_port = priv->dev_data->port_id; - if (mlx5_eth_find_next(rx_port, priv->pci_dev) != rx_port) { + if (mlx5_eth_find_next(rx_port, dev->device) != rx_port) { rte_errno = ENODEV; DRV_LOG(ERR, "Rx port %u does not belong to mlx5", rx_port); return -rte_errno; @@ -893,7 +893,6 @@ mlx5_hairpin_bind(struct rte_eth_dev *dev, uint16_t rx_port) { int ret = 0; uint16_t p, pp; - struct mlx5_priv *priv = dev->data->dev_private; /* * If the Rx port has no hairpin configuration with the current port, @@ -902,7 +901,7 @@ mlx5_hairpin_bind(struct rte_eth_dev *dev, uint16_t rx_port) * information updating. */ if (rx_port == RTE_MAX_ETHPORTS) { - MLX5_ETH_FOREACH_DEV(p, priv->pci_dev) { + MLX5_ETH_FOREACH_DEV(p, dev->device) { ret = mlx5_hairpin_bind_single_port(dev, p); if (ret != 0) goto unbind; @@ -912,7 +911,7 @@ mlx5_hairpin_bind(struct rte_eth_dev *dev, uint16_t rx_port) return mlx5_hairpin_bind_single_port(dev, rx_port); } unbind: - MLX5_ETH_FOREACH_DEV(pp, priv->pci_dev) + MLX5_ETH_FOREACH_DEV(pp, dev->device) if (pp < p) mlx5_hairpin_unbind_single_port(dev, pp); return ret; @@ -927,10 +926,9 @@ mlx5_hairpin_unbind(struct rte_eth_dev *dev, uint16_t rx_port) { int ret = 0; uint16_t p; - struct mlx5_priv *priv = dev->data->dev_private; if (rx_port == RTE_MAX_ETHPORTS) - MLX5_ETH_FOREACH_DEV(p, priv->pci_dev) { + MLX5_ETH_FOREACH_DEV(p, dev->device) { ret = mlx5_hairpin_unbind_single_port(dev, p); if (ret != 0) return ret; diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c index 3e5e94444b..11770aeeef 100644 --- a/drivers/net/mlx5/mlx5_txq.c +++ b/drivers/net/mlx5/mlx5_txq.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -816,7 +817,7 @@ txq_set_params(struct mlx5_txq_ctrl *txq_ctrl) if (config->txqs_inline == MLX5_ARG_UNSET) txqs_inline = #if defined(RTE_ARCH_ARM64) - (priv->pci_dev->id.device_id == + (priv->pci_dev && priv->pci_dev->id.device_id == PCI_DEVICE_ID_MELLANOX_CONNECTX5BF) ? MLX5_INLINE_MAX_TXQS_BLUEFIELD : #endif diff --git a/drivers/net/mlx5/windows/mlx5_os.c b/drivers/net/mlx5/windows/mlx5_os.c index 5da362a9d5..bf20adaa30 100644 --- a/drivers/net/mlx5/windows/mlx5_os.c +++ b/drivers/net/mlx5/windows/mlx5_os.c @@ -391,7 +391,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, * Look for sibling devices in order to reuse their switch domain * if any, otherwise allocate one. */ - MLX5_ETH_FOREACH_DEV(port_id, priv->pci_dev) { + MLX5_ETH_FOREACH_DEV(port_id, NULL) { const struct mlx5_priv *opriv = rte_eth_devices[port_id].data->dev_private; @@ -1080,6 +1080,7 @@ mlx5_os_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, dev_config.dv_flow_en = 1; dev_config.decap_en = 0; dev_config.log_hp_size = MLX5_ARG_UNSET; + list[ns].numa_node = pci_dev->device.numa_node; list[ns].eth_dev = mlx5_dev_spawn(&pci_dev->device, &list[ns], &dev_config); -- 2.25.1