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 69ED9A0547; Tue, 3 Aug 2021 17:07:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ED92B411A7; Tue, 3 Aug 2021 17:07:18 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2069.outbound.protection.outlook.com [40.107.220.69]) by mails.dpdk.org (Postfix) with ESMTP id A154D40E3C for ; Tue, 3 Aug 2021 17:07:17 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LSz8YDJDNXMkm3ecTcGUHg+p3bjXds015ZCWvK/K+Awfa4S6mViJYaWt/qSUYnpDUXTesYIER+bJT5hvbwJK22pZPNOBi2x/98jptT9lRxJ+Afz8aN4xrjX8hJVjfpogRzAblG4wgCEGyTTddgfcxTcE4oZNGL+2htb3Rduxi9RlsjgUt8J3DBJAODfd2WEYrbgXkGv14eTtORi2YJg4+eAehb1HQaZh6vlEum0MNYRUyqsNqZi0uD9wOC5/gjHSWXuqZ1gBtjCRgt6WSjaMQRKRbGUFaM6FEhrBiu+ciHZlnBt/V+nCbdZp/E9O9zzGqL0YhwRgdiavv5AATya0qw== 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=kZUwY0a61KSck3aFDkyCSAemKmoLnZ590B+SWWBls38=; b=S7aaqV1zRyHcLvU6/ocIUXSXAUfRZ7H6jLWPD/cy6eypwPo6nhJjPko7UhGJE2VPIOvc9vUHYXgWF0q5cS8yLNX8QXbPbKcjCc3FrdXTCaPXVUkpcqyDfRE1XqdVcGchAD4IZ8hQPVLqGxahWe5VyzKrmV7x0BgDT5MBNtmTek8g9xhPorfUGs4LoGqqvM/8hy91Dqv5PeF4uTzzqXgPnGqjkdNvmHORRsoTpupHIZTm1Omhx2guG3df8KCNqaKM865ywLFchFx36nkEVK3WGluxy2yT0FEvs2lzWVwc7tn+8cxwpAeywv5JW33qgATmUp5O/0FmSdZv3bsdBfFC3w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.35) 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=kZUwY0a61KSck3aFDkyCSAemKmoLnZ590B+SWWBls38=; b=pEtTyaPedv6BMk1zKLsm8T2Uh591CBsFFREY9Vavkvw2s4znCfWTehhAdzH5d4rNlketHvGzqHG/vNtsgwxLPrPqcuJp2yo7EIH7ti74raOgevS6u9gRQ2BfcXKXaQMtGrVL5jN+SPT4O3D525j1ItpE8nnkbZx361xqDDwK/N6ayLMt8RnyZXIzaHJtVdanENXlJ6Cto42vbpgiAoL0/lO4CI3JY6KIZldtwY5VEI0Ys9UQwP4C9Km1TIcQM7wz81VbpxTDyqFn6yV8g2TidhQvNBvaRVQysdWTPc+w3HFlFRIXllQ8/Q9CVHylLEJ5CIsRqjFj7vLP4BjYv5Daww== Received: from CO2PR05CA0090.namprd05.prod.outlook.com (2603:10b6:104:1::16) by BL0PR12MB4883.namprd12.prod.outlook.com (2603:10b6:208:1c6::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.19; Tue, 3 Aug 2021 15:07:16 +0000 Received: from CO1NAM11FT044.eop-nam11.prod.protection.outlook.com (2603:10b6:104:1:cafe::11) by CO2PR05CA0090.outlook.office365.com (2603:10b6:104:1::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.10 via Frontend Transport; Tue, 3 Aug 2021 15:07:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.35) 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.35 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.35; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.35) by CO1NAM11FT044.mail.protection.outlook.com (10.13.175.188) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4373.18 via Frontend Transport; Tue, 3 Aug 2021 15:07:15 +0000 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 3 Aug 2021 15:07:15 +0000 Received: from nvidia.com (172.20.187.5) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 3 Aug 2021 15:07:12 +0000 From: Gregory Etelson To: CC: , , , , , Shahaf Shuler , Xueming Li Date: Tue, 3 Aug 2021 18:06:58 +0300 Message-ID: <20210803150658.303-1-getelson@nvidia.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To DRHQMAIL107.nvidia.com (10.27.9.16) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0523f540-a946-4599-3d24-08d95690616d X-MS-TrafficTypeDiagnostic: BL0PR12MB4883: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aT0b5JsqliJA5XPSHbLumdfMi1pnKJYY9V05epoGuyumfVroqMb/sAgiuHzVDDC52UQHQZcXZa09urwbH1gt4shXhp8bsWnWQAErVteywbWm6fZgW5g6kLXakRx2Y4oX1xHN6L0k/Enx2rtScfjnmZxVu9K1xchNtTly2gvkQqtCclKGRbRH+HxlxOtcRkPNrYe6Lq77Atw1nBQoAEubyPidQXepnEWJ/iwhHMbwqzMsNirMbfUsZD0B8E1vPKm+llfzeq1hrXa+C0GNnIQOS+6obsiqx1KdjLqKWq7GSw4HVpj5xjFGc+1ycj0CcSvQobVa5PIOxTyWXeZdM3L5+MnI4VhzfWKzrs89E36Dtlgd+JM4g9BKpMKP2VqAdF1YK/GdSZanJouRnMBt7xWk9P0l7fzDTbP9ogU05Cqt4ansZWppf3pHRQOzdsTckiB5TB8Th02qGAWEhNzBxy53b71LRthb4oBJ53zj4ujAAdHXVxBe5ospUPhxS9v6fveUlAh7qSU1NYFpgvgJpcwaf77AW4HPhcjbz+dO/sTEmR2ANQhkA4iggEN+cvZZoh9nLz6PcBeaZxc2/C6eVOfppYQYsalo82BaHSWuSb6wuZNAYgjj/DXI6i7gmcrpeKNvQTGDj/8GHJh/1U5NXpth/m/oODZsJyUQ7lkXtKJUljKY61hI1ZymU2QMVuXsbWXlwSB2UzHkv6f+wBtcNnqqhA== X-Forefront-Antispam-Report: CIP:216.228.112.35; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid04.nvidia.com; CAT:NONE; SFS:(4636009)(39860400002)(396003)(346002)(376002)(136003)(46966006)(36840700001)(426003)(47076005)(8676002)(6666004)(26005)(5660300002)(86362001)(70586007)(316002)(6916009)(55016002)(2616005)(16526019)(36860700001)(186003)(478600001)(70206006)(8936002)(83380400001)(107886003)(2906002)(54906003)(7636003)(356005)(36756003)(7696005)(6286002)(82310400003)(36906005)(4326008)(1076003)(336012)(82740400003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Aug 2021 15:07:15.8284 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0523f540-a946-4599-3d24-08d95690616d 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.35]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT044.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB4883 Subject: [dpdk-dev] [PATCH] net/mlx5: fix find sibling devices 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" The routine mlx5_eth_find_next() and related iterating macro MLX5_ETH_FOREACH_DEV is used to iterate through sibling devices (all representors share the same configuration and switching domain) on top of specified root device. The root device parameter was specified as NULL, and it caused the missing siblings in iteration during representor device probing, causing: 1. allocating the new domain_id for the device being probed. 2. discrepancy in representor configurations and potential overall driver malfunctions. Fixes: 56bb3c84e982 ("net/mlx5: reduce PCI dependency") Signed-off-by: Gregory Etelson Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/linux/mlx5_os.c | 2 +- drivers/net/mlx5/mlx5.c | 5 +++-- drivers/net/mlx5/mlx5.h | 3 ++- drivers/net/mlx5/windows/mlx5_os.c | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index eeeca27ac2..5f8766aa48 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1314,7 +1314,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, } /* Override some values set by hardware configuration. */ mlx5_args(config, dpdk_dev->devargs); - err = mlx5_dev_check_sibling_config(priv, config); + err = mlx5_dev_check_sibling_config(priv, config, dpdk_dev); if (err) goto error; config->hw_csum = !!(sh->device_attr.device_cap_flags_ex & diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 90990ffdc2..f84e061fe7 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -2297,7 +2297,8 @@ rte_pmd_mlx5_get_dyn_flag_names(char *names[], unsigned int n) */ int mlx5_dev_check_sibling_config(struct mlx5_priv *priv, - struct mlx5_dev_config *config) + struct mlx5_dev_config *config, + struct rte_device *dpdk_dev) { struct mlx5_dev_ctx_shared *sh = priv->sh; struct mlx5_dev_config *sh_conf = NULL; @@ -2308,7 +2309,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, NULL) { + MLX5_ETH_FOREACH_DEV(port_id, dpdk_dev) { struct mlx5_priv *opriv = rte_eth_devices[port_id].data->dev_private; diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 34d66e93ad..e02714e231 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -1503,7 +1503,8 @@ void mlx5_set_min_inline(struct mlx5_dev_spawn_data *spawn, struct mlx5_dev_config *config); void mlx5_set_metadata_mask(struct rte_eth_dev *dev); int mlx5_dev_check_sibling_config(struct mlx5_priv *priv, - struct mlx5_dev_config *config); + struct mlx5_dev_config *config, + struct rte_device *dpdk_dev); int mlx5_dev_configure(struct rte_eth_dev *dev); int mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info); int mlx5_fw_version_get(struct rte_eth_dev *dev, char *fw_ver, size_t fw_size); diff --git a/drivers/net/mlx5/windows/mlx5_os.c b/drivers/net/mlx5/windows/mlx5_os.c index 5a18f538bc..5518bc3e76 100644 --- a/drivers/net/mlx5/windows/mlx5_os.c +++ b/drivers/net/mlx5/windows/mlx5_os.c @@ -430,7 +430,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, NULL) { + MLX5_ETH_FOREACH_DEV(port_id, dpdk_dev) { const struct mlx5_priv *opriv = rte_eth_devices[port_id].data->dev_private; -- 2.32.0