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 773AE42D46 for ; Sun, 25 Jun 2023 08:39:30 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 69C0B42D13; Sun, 25 Jun 2023 08:39:30 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by mails.dpdk.org (Postfix) with ESMTP id C908A40A7F for ; Sun, 25 Jun 2023 08:39:29 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T1vY1T3nz6wQBbktfcaBaqabeRJa4YxumZYl1qTetoQXQENS3mcmrDgqUEa+vXET1zS/4VommmNxzSufoHLQnYfE/wjp00TwM6BHwiXbp+Fs9MbpWYiE6tqTjCpUkHq3JRwdC5KsBEHMXx6x/Rpy7kzUbQlFs1alSwhdf2drWSQYxwsxyFswEgAukk3txyTkjcv19PUXQvjTMfOo4X9WaA3ez3193Xx3Bbnd9KZCcwbs4N7ePaQ1HYDcxAGXhHwYMwt1PiEf/FUIjtR3ZVTTPhEfFyKIm6erEo8VBseU1FdS2lY6AG4WSFw4gPyHwfx6kIoyr081tM0hDdmoV9l4vg== 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=m2vBVQ6eT+3tY4Wk2E5IEkbnOAJPhSZ1Ju2erM/S45Q=; b=U73Kl+MH/aOYIU5Ebj9ABE04by/954VfoOVmNsmUfvuApdEBip1LJiNZw2fLSxY9u1H/72vHeDUJqmwfq7p1iq6wFjhNRByqIGub3u2Cep5E/LYL5kixuuno/lb56VeNuv5endQd9QHrvhyhpzeb6LuJ6hS41ISTpmKqRdymcJo5h1v4s6enfCN8Jj4RSy236mRXOrLFMI554ZgwJsmJjcRP6aSRlshuTfPktrxQaZGe2xW8XfoHe6g9i8c1SvNtE4Cxs7qq+VCi1G6oL9UT+WFVVMu2xJJ0QxivCCeqUBlqg7LicIUHhzEx2Jnr34cMeynvYb/71nwb20zta2P4wQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=microsoft.com 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=m2vBVQ6eT+3tY4Wk2E5IEkbnOAJPhSZ1Ju2erM/S45Q=; b=uBBxreILfhjBsegF+RJjPWjEQGv5p2gbQUN1FQGZ0ArVtwq3c2GjAxF6e6DwRuQwRjV5tq01ONcN82D/6tXGPEoFdAHdBx1Ct1u6Xr9G9UjYD8I5wci3/nnIdE3coYqAzKwiySx6VBih1PuALHiWqfN3YXipTNEsyIG4kHkfN+Z/pyZANQQZ7Bua3E42KfefUp7K5YH0xn3KL6b1ACVDQ+Akqf2TfxgsHCHCUDbJO6VFZ/ROPX7dgCWQ+KrrGBvN09KlmiXG1/sc7yGdt24+LKASvkAaDsdZ8a9wyf7M92ZRGJLwlX9VFmIuL7O8cTscIOgC+gEjDfEasZ1aGbA3KA== Received: from BY5PR20CA0029.namprd20.prod.outlook.com (2603:10b6:a03:1f4::42) by LV3PR12MB9095.namprd12.prod.outlook.com (2603:10b6:408:1a6::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Sun, 25 Jun 2023 06:39:28 +0000 Received: from DM6NAM11FT019.eop-nam11.prod.protection.outlook.com (2603:10b6:a03:1f4:cafe::d2) by BY5PR20CA0029.outlook.office365.com (2603:10b6:a03:1f4::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.32 via Frontend Transport; Sun, 25 Jun 2023 06:39:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by DM6NAM11FT019.mail.protection.outlook.com (10.13.172.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.47 via Frontend Transport; Sun, 25 Jun 2023 06:39:27 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Sat, 24 Jun 2023 23:39:13 -0700 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.37; Sat, 24 Jun 2023 23:39:12 -0700 From: Xueming Li To: Long Li CC: Ferruh Yigit , dpdk stable Subject: patch 'net/mana: return probing failure if no device found' has been queued to stable release 22.11.3 Date: Sun, 25 Jun 2023 14:34:16 +0800 Message-ID: <20230625063544.11183-39-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230625063544.11183-1-xuemingl@nvidia.com> References: <20230625063544.11183-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT019:EE_|LV3PR12MB9095:EE_ X-MS-Office365-Filtering-Correlation-Id: b96d47d4-261e-4417-c1ca-08db7546ec35 X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: T/B/LzD3K9ahjShKJDYBvDBeS27vEgfRYwCU/j8EG3/HuTu9xPoTp0m5/+eiK2k1PPoCaj27XUR+nZakq7EKRIYN/v/L1+OksZlwCR6q+/zlNlJZo6po/k3zoOH62u0PwNha56Z4oW1QbDlrjMJSYe5Blgn9STRali5/k+2aXuV6LtT0brDdydy0r1024dAYGHr+5Rg12CRf39GMleCpoIrTjWRJfu6cEkQuPB8rHd0lk2eX3syqzLJyfslEKDx8JQm32x6RoGAUo/+Rsq3WIeWgSyGkcyZ6xpJZjnNNH/4C/ndzILzSxwT8GHAdkcJ7uaOoMRoncbb8PPcgmfgsi08HA+MvU6qwMrrtKDcgsmbecxiqSRac9Cs7biwUH5J+q4iz6f5UF/E15434n7JsfVqgV7qkSROi0ULMKVPjvuqrGOtK4DLdrzjJXaTAI/VQMrZCXjJbNzRnc/F5p0kz8bp+SwCTxRVwP9yFdZdsPXIgMJVH9ooUFu5h09aq2iZbYuBkCugQbGTzC+G6wt/Z03fMeMhkJCehZnRvPY/zLvdnSiP5uIaNhg5GVbMHrAtb5f7HGUN275kJRBGmIQBkKEbMQRb1WZFDXM1i5EUMMRkITnT6AmSRxwhUvSFbCY51BhqEXvRdqSTN/er8Mcll6e/eCEth7yLeWxLF4JQ7835faLvlKvBSklF/sJCcJyXuptnlP8jC326SIOdviDvb2B9UremzsDQEMbJ84GZWGuxLwUiZIBI9dYW2u1mH7IcUeIx+rwSnQuWgpZMD72nogw== X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(376002)(136003)(396003)(346002)(39860400002)(451199021)(46966006)(36840700001)(40470700004)(36860700001)(82310400005)(47076005)(966005)(478600001)(45080400002)(7696005)(2616005)(54906003)(426003)(83380400001)(336012)(26005)(53546011)(1076003)(186003)(16526019)(6286002)(2906002)(5660300002)(40460700003)(36756003)(70206006)(356005)(4326008)(7636003)(70586007)(82740400003)(55016003)(40480700001)(316002)(86362001)(8936002)(8676002)(41300700001)(6916009); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jun 2023 06:39:27.2601 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b96d47d4-261e-4417-c1ca-08db7546ec35 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT019.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR12MB9095 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 Hi, FYI, your patch has been queued to stable release 22.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/27/23. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://git.dpdk.org/dpdk-stable/log/?h=22.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=22.11-staging&id=3254062488e80c76d141858fcfa5f13349c734a8 Thanks. Xueming Li --- >From 3254062488e80c76d141858fcfa5f13349c734a8 Mon Sep 17 00:00:00 2001 From: Long Li Date: Fri, 5 May 2023 18:32:10 -0700 Subject: [PATCH] net/mana: return probing failure if no device found Cc: Xueming Li [ upstream commit 0595702ef21500a276fba65557f1d09d65976ec8 ] When there is no device found on this PCI device, return probe failure and release allocated resources for this PCI device. Fixes: 517ed6e2d590 ("net/mana: add basic driver with build environment") Signed-off-by: Long Li Acked-by: Ferruh Yigit --- drivers/net/mana/mana.c | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/drivers/net/mana/mana.c b/drivers/net/mana/mana.c index 2463f34c1e..7630118d4f 100644 --- a/drivers/net/mana/mana.c +++ b/drivers/net/mana/mana.c @@ -1343,6 +1343,7 @@ failed: /* * Goes through the IB device list to look for the IB port matching the * mac_addr. If found, create a rte_eth_dev for it. + * Return value: number of successfully probed devices */ static int mana_pci_probe_mac(struct rte_pci_device *pci_dev, @@ -1352,8 +1353,9 @@ mana_pci_probe_mac(struct rte_pci_device *pci_dev, int ibv_idx; struct ibv_context *ctx; int num_devices; - int ret = 0; + int ret; uint8_t port; + int count = 0; ibv_list = ibv_get_device_list(&num_devices); for (ibv_idx = 0; ibv_idx < num_devices; ibv_idx++) { @@ -1383,6 +1385,12 @@ mana_pci_probe_mac(struct rte_pci_device *pci_dev, ret = ibv_query_device_ex(ctx, NULL, &dev_attr); ibv_close_device(ctx); + if (ret) { + DRV_LOG(ERR, "Failed to query IB device %s", + ibdev->name); + continue; + } + for (port = 1; port <= dev_attr.orig_attr.phys_port_cnt; port++) { struct rte_ether_addr addr; @@ -1394,15 +1402,17 @@ mana_pci_probe_mac(struct rte_pci_device *pci_dev, continue; ret = mana_probe_port(ibdev, &dev_attr, port, pci_dev, &addr); - if (ret) + if (ret) { DRV_LOG(ERR, "Probe on IB port %u failed %d", port, ret); - else + } else { + count++; DRV_LOG(INFO, "Successfully probed on IB port %u", port); + } } } ibv_free_device_list(ibv_list); - return ret; + return count; } /* @@ -1416,6 +1426,7 @@ mana_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, struct mana_conf conf = {0}; unsigned int i; int ret; + int count = 0; if (args && args->drv_str) { ret = mana_parse_args(args, &conf); @@ -1433,16 +1444,21 @@ mana_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, } /* If there are no driver parameters, probe on all ports */ - if (!conf.index) - return mana_pci_probe_mac(pci_dev, NULL); + if (conf.index) { + for (i = 0; i < conf.index; i++) + count += mana_pci_probe_mac(pci_dev, + &conf.mac_array[i]); + } else { + count = mana_pci_probe_mac(pci_dev, NULL); + } - for (i = 0; i < conf.index; i++) { - ret = mana_pci_probe_mac(pci_dev, &conf.mac_array[i]); - if (ret) - return ret; + if (!count) { + rte_memzone_free(mana_shared_mz); + mana_shared_mz = NULL; + ret = -ENODEV; } - return 0; + return ret; } static int @@ -1475,6 +1491,7 @@ mana_pci_remove(struct rte_pci_device *pci_dev) if (!mana_shared_data->primary_cnt) { DRV_LOG(DEBUG, "free shared memezone data"); rte_memzone_free(mana_shared_mz); + mana_shared_mz = NULL; } rte_spinlock_unlock(&mana_shared_data_lock); -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-06-25 14:31:59.547511600 +0800 +++ 0038-net-mana-return-probing-failure-if-no-device-found.patch 2023-06-25 14:31:58.335773900 +0800 @@ -1 +1 @@ -From 0595702ef21500a276fba65557f1d09d65976ec8 Mon Sep 17 00:00:00 2001 +From 3254062488e80c76d141858fcfa5f13349c734a8 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 0595702ef21500a276fba65557f1d09d65976ec8 ] @@ -10 +12,0 @@ -Cc: stable@dpdk.org