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 18E61A050A for ; Wed, 6 Apr 2022 09:12:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0F2EE4284F; Wed, 6 Apr 2022 09:12:50 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2054.outbound.protection.outlook.com [40.107.92.54]) by mails.dpdk.org (Postfix) with ESMTP id 79AB940DF6; Wed, 6 Apr 2022 09:12:47 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Fo5NYguSpMrpQmlnf/iVRh5b/PZNwLo7yIoOlJgE+7l0CEDUUgtKmOHgYcOQXyK59Hlsz8rrBi5GBVuv8E6zmRn08LGKW4C88N20JudCN/YjPkbl4jHIPpQuOh4rKcphBMBUd2EU9au0ZF2a+gpdJDsvTI2Hu9oIlZy2pnd5WL7/J7XgTZALvZkXQcgI8ujmlZoCYarrGJe+BSjkaA3CPUUa7n7d6TJ4BuzJj1ngrUQKrSUioE4Es6kVDljF+MlDaUAquCw0/FJTDV7EWBAEQSURNvJqxATG5AHk9MR3EwYeNkJfTQRFbxqBWTLSHh4ebmA+NT9vVKyL2od5ukhFyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=KTf8W8GTBdJrTBBNu03XReSV304QGd4t9wcHydmAqtU=; b=I3431zPkkyhtybvaaPVKs4qCaM4B4X2G7UubJR2D7RVeKQnQUICRCWXYpcF8thPiNTPDttCLA88SL4lr/hjdHz/x00v8jXJJxQvKf9HC9hEsGmD187OSuPe2SbQwl16itqLaERtfEaIE73+Hy3ENGIjAAu4cKIiTC1lhJF9nt/HlX3bSMe0KlpuqAxGjRJkoiKOKZXAyIydxsfqtm8ZvCvdhS8FGjxUFmmPUQ1kow0sbdlqV1/QWUZ7lCcstx5Qa5TXSYg3oM9cbRlMP/KTj1lj6XNKpUmuNoQCyLd/WXNXvh8IkJkQD7FHCfnlJnRf4ZpLNq4RLj1EyYKQEYqPsGA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KTf8W8GTBdJrTBBNu03XReSV304QGd4t9wcHydmAqtU=; b=rrOlhXL2i4zb1QaQY2+rlc88GhV0TPvPOynQT98O3JkUPD+bEng/LQWQ/nnqtIihHK3Os148M5djsYZK6+vey/4ItqX8mOYpCuZaE6Mj0V2oBgPUPSx3QV0YKn0I4ccLNAnHIDBmxFAUKMMUhadIHnjiooGLNG/ePCZ8Z9JLN9a1yoMoauHffo5CTMiZzCZQyRf1QDUhFg5UZ+JlBld0SCls9wSKULlbycwMAzKooj/cHp1FnzyP6tCkOcIzC0DxHfzKKQiPqwU2kP7iOF+utu+g8WrE23xsUVFHL5AtgsgsEy6i5xoofrDK3qfa8Zwsl//cxzfRJGFE83Yz3jiAbQ== Received: from BN0PR08CA0022.namprd08.prod.outlook.com (2603:10b6:408:142::7) by SN1PR12MB2461.namprd12.prod.outlook.com (2603:10b6:802:27::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.31; Wed, 6 Apr 2022 07:12:45 +0000 Received: from BN8NAM11FT056.eop-nam11.prod.protection.outlook.com (2603:10b6:408:142:cafe::ba) by BN0PR08CA0022.outlook.office365.com (2603:10b6:408:142::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.21 via Frontend Transport; Wed, 6 Apr 2022 07:12:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.235) by BN8NAM11FT056.mail.protection.outlook.com (10.13.177.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5144.20 via Frontend Transport; Wed, 6 Apr 2022 07:12:45 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Wed, 6 Apr 2022 07:12:40 +0000 Received: from nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Wed, 6 Apr 2022 00:12:38 -0700 From: Rongwei Liu To: , , , , Michael Baum CC: , , Subject: [PATCH v1] net/mlx5: fix probe failure with secondary bonding member Date: Wed, 6 Apr 2022 10:12:24 +0300 Message-ID: <20220406071224.870035-1-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9ab6714e-9f17-48c0-3811-08da179cd929 X-MS-TrafficTypeDiagnostic: SN1PR12MB2461:EE_ X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: COdW7kH3DZDT0gMdaocFj8ounotJ4OriITjfsBKhoyf1tPPkpzN2crNiN0eEenVwzGrecxz7mp/xz9VkEql2/Js08Z42Mfs79aQpSzIIeG57XjP2eH8nByvqNWPTL7XQ3aevV490C0EkXktU9IcYItNmrhoeyR6yd8zXxvZQKto1d99CETckkwMKZs2Lxl1bX1gMGfj093jfRPmJwcAgGOMQJdUyG6bJyYhEGYBWdrfbl2ccJg5ERO+AkQ4Ah5Q0WXxumN5Jg7QN2Qkr2um32BNEdW8PninRo0mgKzVPav05SacbFSckT1+7HPrWFb5uHMlJJXzcz9orPavgSd1iKoKFHOuUwMZyOZQT3x+qJa5ZCJ+iQ1cgN1Z//FmPR9QtVZwjnZPBzbw4I/UFRg7DdQBxe3ZOVqnOU5ZkUmoLqPn+7Z6ZKq5BWCU4ilQOxZgV6LnaA6f5hSTE/NeIhAVySBKtX3Tj4OY4HbyMBasBJ8QnVrkYqun4mieHQxi/QoWOLxNeVeDnoylEVTtLxlxe46nUPjYZshZbkkjTEuS6UBiz9UnTqlLEgDb64VjkaUAQu3XYb2cwgjt4IP5WO+uD4Ugqu5mpIiHENGH9mkdOWI+isMixVuZwpjkaKNn2WakRskrHi1uzciw8ZUw+vVkt1lGE3oPoW+KTvhr9CUwXd7ZTU8X4aFGAc7IanRBQ7KDQ2mC4vlwAm7ISVr8N9pAuNg== X-Forefront-Antispam-Report: CIP:12.22.5.235; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(46966006)(36840700001)(8936002)(16526019)(36860700001)(40460700003)(2616005)(81166007)(82310400005)(55016003)(54906003)(83380400001)(356005)(1076003)(336012)(426003)(36756003)(6286002)(2906002)(5660300002)(110136005)(316002)(86362001)(508600001)(6636002)(4326008)(8676002)(70586007)(26005)(186003)(6666004)(47076005)(70206006)(7696005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2022 07:12:45.0322 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9ab6714e-9f17-48c0-3811-08da179cd929 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.235]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT056.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2461 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Users can probe primary or secondary PCIe id when bonding is configured. 1. -a 0a:00.0,representor=pf[0-1]vf[0-1], PMD probes 5 ports totally: bonding device plus 4 representor ports. 2. -a 0a:00.1,representor=pf[0-1]vf[0-1], PMD only probes 2 representor ports. Under the 2nd condition, bonding IB device doesn't have the same PCIe id and PMD needs to check bonding relationship otherwise probe failure. Fixes: 6856efa54eea ("net/mlx5: fix PF leak on PCI probing failure") Cc: stable@dpdk.org Signed-off-by: Rongwei Liu Acked-by: Viacheslav Ovsiienko --- drivers/common/mlx5/linux/mlx5_common_os.c | 26 ++++++++++++++++------ drivers/net/mlx5/linux/mlx5_os.c | 24 ++++++++++---------- 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/drivers/common/mlx5/linux/mlx5_common_os.c b/drivers/common/mlx5/linux/mlx5_common_os.c index 030ceb561f..d40cfd5cd1 100644 --- a/drivers/common/mlx5/linux/mlx5_common_os.c +++ b/drivers/common/mlx5/linux/mlx5_common_os.c @@ -559,21 +559,33 @@ mlx5_os_get_ibv_device(const struct rte_pci_addr *addr) int n; struct ibv_device **ibv_list = mlx5_glue->get_device_list(&n); struct ibv_device *ibv_match = NULL; + uint8_t guid1[32] = {0}; + uint8_t guid2[32] = {0}; + int ret1, ret2 = -1; + struct rte_pci_addr paddr; - if (ibv_list == NULL) { + if (ibv_list == NULL || !n) { rte_errno = ENOSYS; + if (ibv_list) + mlx5_glue->free_device_list(ibv_list); return NULL; } + ret1 = mlx5_get_device_guid(addr, guid1, sizeof(guid1)); while (n-- > 0) { - struct rte_pci_addr paddr; - DRV_LOG(DEBUG, "Checking device \"%s\"..", ibv_list[n]->name); if (mlx5_get_pci_addr(ibv_list[n]->ibdev_path, &paddr) != 0) continue; - if (rte_pci_addr_cmp(addr, &paddr) != 0) - continue; - ibv_match = ibv_list[n]; - break; + if (ret1 > 0) + ret2 = mlx5_get_device_guid(&paddr, guid2, sizeof(guid2)); + /* Bond device can bond secondary PCIe */ + if ((strstr(ibv_list[n]->name, "bond") && + ((ret1 > 0 && ret2 > 0 && !memcmp(guid1, guid2, sizeof(guid1))) || + (addr->domain == paddr.domain && addr->bus == paddr.bus && + addr->devid == paddr.devid))) || + !rte_pci_addr_cmp(addr, &paddr)) { + ibv_match = ibv_list[n]; + break; + } } if (ibv_match == NULL) { DRV_LOG(WARNING, diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index ff65efb2a2..a821153b35 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1979,9 +1979,9 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev, if (!nd) { /* No device matches, just complain and bail out. */ DRV_LOG(WARNING, - "No Verbs device matches PCI device " PCI_PRI_FMT "," + "PF %u doesn't have Verbs device matches PCI device " PCI_PRI_FMT "," " are kernel drivers loaded?", - owner_pci.domain, owner_pci.bus, + owner_id, owner_pci.domain, owner_pci.bus, owner_pci.devid, owner_pci.function); rte_errno = ENOENT; ret = -rte_errno; @@ -2387,16 +2387,16 @@ mlx5_os_pci_probe(struct mlx5_common_device *cdev, for (p = 0; p < eth_da.nb_ports; p++) { ret = mlx5_os_pci_probe_pf(cdev, ð_da, eth_da.ports[p], mkvlist); - if (ret) - break; - } - if (ret) { - DRV_LOG(ERR, "Probe of PCI device " PCI_PRI_FMT " " - "aborted due to prodding failure of PF %u", - pci_dev->addr.domain, pci_dev->addr.bus, - pci_dev->addr.devid, pci_dev->addr.function, - eth_da.ports[p]); - mlx5_net_remove(cdev); + if (ret) { + DRV_LOG(INFO, "Probe of PCI device " PCI_PRI_FMT " " + "aborted due to proding failure of PF %u", + pci_dev->addr.domain, pci_dev->addr.bus, + pci_dev->addr.devid, pci_dev->addr.function, + eth_da.ports[p]); + mlx5_net_remove(cdev); + if (p != 0) + break; + } } } else { ret = mlx5_os_pci_probe_pf(cdev, ð_da, 0, mkvlist); -- 2.27.0