From patchwork Thu Jul 20 19:08:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nelson, Shannon" X-Patchwork-Id: 13321004 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71C4A19BCD for ; Thu, 20 Jul 2023 19:08:45 +0000 (UTC) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2054.outbound.protection.outlook.com [40.107.96.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53C0A2128 for ; Thu, 20 Jul 2023 12:08:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MkyKSn5gKAReHLj5MdDaiXFhvg/jI/bZ7nKt7FRTIYQcVmiK3kpXiGVvp0TZYsgNfuOP6J5miHClQOBJ34h1kojUY35SMXPtNHHO7StrrgOU9WZhqD2DJyFG7/DcuUJ4Y+EPEUpckTBjxZa44D4kwxwThJAeaG8EMYckONFSaAcRCevduVHh0CF73w/0W8NvKKKmr79ann5YSvv6UAoU4bIsK93dBhJa2ztgMc2h5XVOX7x1WtvOp1gs4ZTjR+lseyITnFBy0UD8/89iis6WZ4I+dp29zoHFlNFDcQzVnThlyoSqq1j9yPDoXl/MKlLtEuw9bAl34lwQx+GS2JxfQA== 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=4wd2epHwBfqBXOAvsv91YuWoVCS95c0F8uy708TH7L8=; b=KonZkWB82Lh7IutnMeiYf7v0687S2kGWyOZyDR9dQcWo0oJ5p72gJ7mDSN9JedKxaTo7aeuebjOumg9MPssXO+tUi9Xvi9F9wcyaOTU2HBipiVdzId7lW9K4b2uLWWgTxMK5nYXJNZoM+YpmIL8M8HASx4gRF21KDpUUidxGWdnSnwmhr+H7nwK8218typwdbNWHWVFDr9TzG2qRRbRtPt1Pt+QGRKQEjQedW3nZabMUZ958m3TE5+jHEdVwMHZojojDRh3YOLP7C0NmEAopkafNoSK6cGCIigRdgBm3Wvnb7Xcy1jVmvnwfuuP0LuH3OMyLDKMTR2kB3Lx3xydzqg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4wd2epHwBfqBXOAvsv91YuWoVCS95c0F8uy708TH7L8=; b=PPaeusD/dRS3u+KA2rZfNr8L8J/LJDEGFgSafEcjTbxrrtRq+1U3zHMbw8GhLGgm6Bn2h0ZuvKZXqZDyfKDtUo5pEVSF3TpbnNewToqpxd0US3Wt20THB7OTT3u2SlterxN4UuxgyKSQEpLaHuczX7VLSD8qJHEOJXR/F/9V7zY= Received: from DS7PR03CA0021.namprd03.prod.outlook.com (2603:10b6:5:3b8::26) by CYXPR12MB9443.namprd12.prod.outlook.com (2603:10b6:930:db::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.33; Thu, 20 Jul 2023 19:08:38 +0000 Received: from DM6NAM11FT029.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b8:cafe::2b) by DS7PR03CA0021.outlook.office365.com (2603:10b6:5:3b8::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.28 via Frontend Transport; Thu, 20 Jul 2023 19:08:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT029.mail.protection.outlook.com (10.13.173.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6609.28 via Frontend Transport; Thu, 20 Jul 2023 19:08:38 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 20 Jul 2023 14:08:36 -0500 From: Shannon Nelson To: , , , , CC: , , Shannon Nelson Subject: [PATCH v4 net-next 1/4] ionic: extract common bits from ionic_remove Date: Thu, 20 Jul 2023 12:08:13 -0700 Message-ID: <20230720190816.15577-2-shannon.nelson@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230720190816.15577-1-shannon.nelson@amd.com> References: <20230720190816.15577-1-shannon.nelson@amd.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT029:EE_|CYXPR12MB9443:EE_ X-MS-Office365-Filtering-Correlation-Id: ede97630-c8b8-4859-4a0d-08db8954b959 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2tcqgbHXeG3llpyR2IdN5vuffShpzI+zMN8RR59tVHuPmEOGiWZGafMxZNnIrusQ1B7SjA+BiJTcyy1tcNkh2QgcoPkF0ep0LT7QvfER9apAPqRKKo9Pc6rebrpnwcR1orh5AvMGiBOsF1ytZ9iwDWCdMeEvoLh2yhyxMy8ZWIhANDiUUaSYZxZWzhf10eIKhwUEGwhM5eb+LkDAVfFNZ47FZiS9k/0xmvQMx8MeGnouyh6MRtEAdJpoAzy+QAH8U/fVFc/vDa2oyYUT95zsu3JI6O/GfTvc8t89AeS/bIqHUULlIvtqWXSeWo43e5cVCNpXun5Zz1caDNz5wT5Vvrqv6x6H1E0A5rYuED2QPcNx8+ylIObE1proeQEXnEADRNYRmrtjrpvyzc5JQdwrSp6uH8OvxkidUbTRXfnp8S9IQeKVVErG1rugCbdm3NofM/yowJV17nhey+ItIpY1AO8ygBC7e7zOxXjRLYhQnm5UIYzQke129uDcq/Qn42oAAfiYylNondbuK9usMMUgIM+EehJwhHqhggUyOrcWaFN5kzB9Uti9dDOk8Tl7j7z0WI/Z8r5j+UkwfgGGLXmTILleZ8AUREJhV6Lo2nf7Sw6xfV3lhqhuds9QDnsTa86AekEj1VgFORWpYmJdg42WtzrIxNJj34TBmsQurZwyqre9ESikYEiDQd3f3OBBH3PJDn2YZEFYM9XaU+ks+JPLGWSYdslgsyfQifxpYwIhvkgeWfEvjRJEw4rmGYk9iOEcJwVa22Kiav5nexUJpaIjrg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(376002)(346002)(136003)(39860400002)(396003)(82310400008)(451199021)(46966006)(36840700001)(40470700004)(70206006)(110136005)(6666004)(478600001)(54906003)(16526019)(186003)(426003)(36860700001)(86362001)(40460700003)(36756003)(40480700001)(2616005)(83380400001)(70586007)(5660300002)(336012)(82740400003)(47076005)(26005)(356005)(4326008)(2906002)(81166007)(1076003)(316002)(41300700001)(44832011)(8936002)(8676002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jul 2023 19:08:38.2170 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ede97630-c8b8-4859-4a0d-08db8954b959 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT029.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYXPR12MB9443 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Pull out a chunk of code from ionic_remove() that will be common in teardown paths. Signed-off-by: Shannon Nelson --- .../ethernet/pensando/ionic/ionic_bus_pci.c | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c index ab7d217b98b3..2bc3cab3967d 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c @@ -213,6 +213,13 @@ static int ionic_sriov_configure(struct pci_dev *pdev, int num_vfs) return ret; } +static void ionic_clear_pci(struct ionic *ionic) +{ + ionic_unmap_bars(ionic); + pci_release_regions(ionic->pdev); + pci_disable_device(ionic->pdev); +} + static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { struct device *dev = &pdev->dev; @@ -249,20 +256,20 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) err = pci_request_regions(pdev, IONIC_DRV_NAME); if (err) { dev_err(dev, "Cannot request PCI regions: %d, aborting\n", err); - goto err_out_pci_disable_device; + goto err_out_clear_pci; } pcie_print_link_status(pdev); err = ionic_map_bars(ionic); if (err) - goto err_out_pci_release_regions; + goto err_out_clear_pci; /* Configure the device */ err = ionic_setup(ionic); if (err) { dev_err(dev, "Cannot setup device: %d, aborting\n", err); - goto err_out_unmap_bars; + goto err_out_clear_pci; } pci_set_master(pdev); @@ -353,12 +360,8 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ionic_reset(ionic); err_out_teardown: ionic_dev_teardown(ionic); -err_out_unmap_bars: - ionic_unmap_bars(ionic); -err_out_pci_release_regions: - pci_release_regions(pdev); -err_out_pci_disable_device: - pci_disable_device(pdev); +err_out_clear_pci: + ionic_clear_pci(ionic); err_out_debugfs_del_dev: ionic_debugfs_del_dev(ionic); err_out_clear_drvdata: @@ -386,9 +389,7 @@ static void ionic_remove(struct pci_dev *pdev) ionic_port_reset(ionic); ionic_reset(ionic); ionic_dev_teardown(ionic); - ionic_unmap_bars(ionic); - pci_release_regions(pdev); - pci_disable_device(pdev); + ionic_clear_pci(ionic); ionic_debugfs_del_dev(ionic); mutex_destroy(&ionic->dev_cmd_lock); ionic_devlink_free(ionic); From patchwork Thu Jul 20 19:08:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nelson, Shannon" X-Patchwork-Id: 13321007 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C5CFF1BE6F for ; Thu, 20 Jul 2023 19:08:47 +0000 (UTC) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2046.outbound.protection.outlook.com [40.107.220.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F7BA1BC1 for ; Thu, 20 Jul 2023 12:08:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PMSqKBCdcoGPCMWl+/Xplrs0WWg9LiazDf1s/nEPmfNDnnDCwwPiNNgG9bAYWYRyZChekyF7ek5AV1Pdss2/QMFPXsAbPhjtYc4G9VZsqDsKMTxeH2DbiGK0qkl2NhBbQNKB6hNOiPBkTcg9LDVbI2C/QDY9XeAQHTMKANWlRpL1yzoLT+xn1yP7hnU7XhSdDD9MFC2S3J0gvTcKinF6FEk6YMWhKLu8YrxjTYpkdApHzvfbpSCqMGJlPpuxe++Qb0BUVoRrlDt/PLdxAF8O6PQXEuSNKZI2UVIjbg+VV3DRctgkE3r+7rduP7xPLRJx7ZA2DfulHFSdk2DESCjusw== 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=etMMNfcLcrUdufIV1PkhmTmjmvo0YKUU3ANWeNFwX0E=; b=A9cmkxfdEk06n3XaMXnJGYj2SDxoU8VItbm9J66oL2r0IVu6UJHfYjK4i0UWX6aK9+OJ53DLYjRLmTi+xlacJamR0jkQz9Vr95ijWEKWWXQN3roy4PLP6p8almtYe9Sw3KfkA3wHVXfrMfoi137osZ6+Rx52FxxGp7CcecJMGkz1OGTvrTAOMtIY5amdIccZ8fUfbZ29KrkIi7q+CvqLtwQiJFtuQClwt/CMijnzNkEoKQ3EO9Kr295EmN0l+p2o79QnaDtu2iWCA5NU9ay0f4X3EgEAIx0ME/06wmqpEXY6MMxqyQOVSpRsXEaJO95e8ONb2uxzUP67Ot15Nn+urQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=etMMNfcLcrUdufIV1PkhmTmjmvo0YKUU3ANWeNFwX0E=; b=GTuS9ip05iAxlDYAWeKUlOHVCTGej6LsxVBqeIR/UCNmwYbsSFK7p2ol3SziHR2m0eWPchGpPfAMlPXdhjzS60oYUQXKqUyQO8wNUeDZUV7HFxuUQx1QVE4xYvfid9kn0EnKsiYLGUKH5GnYqsIG61lY5QRZc6mZWmfuqJ+AaHk= Received: from DS7PR03CA0028.namprd03.prod.outlook.com (2603:10b6:5:3b8::33) by IA1PR12MB6017.namprd12.prod.outlook.com (2603:10b6:208:3d7::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Thu, 20 Jul 2023 19:08:39 +0000 Received: from DM6NAM11FT029.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b8:cafe::25) by DS7PR03CA0028.outlook.office365.com (2603:10b6:5:3b8::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.33 via Frontend Transport; Thu, 20 Jul 2023 19:08:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT029.mail.protection.outlook.com (10.13.173.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6609.28 via Frontend Transport; Thu, 20 Jul 2023 19:08:39 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 20 Jul 2023 14:08:37 -0500 From: Shannon Nelson To: , , , , CC: , , Shannon Nelson Subject: [PATCH v4 net-next 2/4] ionic: extract common bits from ionic_probe Date: Thu, 20 Jul 2023 12:08:14 -0700 Message-ID: <20230720190816.15577-3-shannon.nelson@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230720190816.15577-1-shannon.nelson@amd.com> References: <20230720190816.15577-1-shannon.nelson@amd.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT029:EE_|IA1PR12MB6017:EE_ X-MS-Office365-Filtering-Correlation-Id: 63679935-5636-43b8-404b-08db8954b9f4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dgFGgwpHA0FUvnFaRTt96znvV++uMgpWb2UWYL3Mr0XpjIBDAjbDqXri8Z11If1U6RZlzfM6kqpLV+DfNDNWFLu1fkYsPXr4gQsLgdOuyF+uTR5BNJgUGoHvymb918lvkpRwkTE2T+8IWmKCREBvhhqBEX2fGoQwxNRtkdH8jZGB2dLO7oqnZrMBPIjx5egdKIWL6gtMBV+xgHiP6NIRok18VQp77YM8e9kOWR7/OPwwoZp5cEA5fj4R3+4y3CIGDIq7f5ytsSAq1Hx7d4+my+dKG2gcBh3pwZBay/oyt+vPdEXRYINhM3+C/izoY/2E4J6jSC6NauOvEBf+DSmgAi147YDqWz4DZ6loU4cGBS8DJTPWMtvgddXv8RvhFvvO2PxmnHAQSo8XxO1Xsd39c8rOIVLQCzPr4JxdYQi5V56iRn09I2z8mPEeYhFccmH92hvt7PJqYFqdjw3gu1dvVIvfyqfQJTlPYFOpVB9hBdXGLwSLT1zoxvXkn9TbaptW786HMMrQdic3wD5J5Wj2EghqE+XzyJjRt/tnKZ3OWD81YZVwPJBp0fr1wHMzraB2GrmLbwFDOGSWNDxkn/uqhS3LJClx9Uz00gS1x3LQ9FSEVAOSJ3tUBLhf/KAyMRhF/FoKj9jUQIrGAWUdgRBD3q0NClH2cYDMrQ0/i7rLL4zo23cCEiWwP7JHZFx3PlIkEahM1Uld4dNMHKjBfnZ29XQDXR6OFqiyT2vmD5WL3pGryCLKsKEANJUGlRCOEaOirXc4slP0Ng8rU6j+RljKxw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(346002)(376002)(39860400002)(136003)(396003)(82310400008)(451199021)(36840700001)(46966006)(40470700004)(6666004)(478600001)(54906003)(110136005)(36756003)(83380400001)(426003)(36860700001)(2616005)(40460700003)(40480700001)(86362001)(2906002)(82740400003)(26005)(1076003)(336012)(47076005)(186003)(356005)(16526019)(81166007)(8676002)(5660300002)(70586007)(316002)(44832011)(4326008)(8936002)(70206006)(41300700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jul 2023 19:08:39.2326 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 63679935-5636-43b8-404b-08db8954b9f4 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT029.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6017 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Pull out some chunks of code from ionic_probe() that will be common in rebuild paths. Signed-off-by: Shannon Nelson --- .../ethernet/pensando/ionic/ionic_bus_pci.c | 84 +++++++++++-------- 1 file changed, 49 insertions(+), 35 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c index 2bc3cab3967d..bcce613449c2 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c @@ -220,30 +220,12 @@ static void ionic_clear_pci(struct ionic *ionic) pci_disable_device(ionic->pdev); } -static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) +static int ionic_setup_one(struct ionic *ionic) { - struct device *dev = &pdev->dev; - struct ionic *ionic; - int num_vfs; + struct pci_dev *pdev = ionic->pdev; + struct device *dev = ionic->dev; int err; - ionic = ionic_devlink_alloc(dev); - if (!ionic) - return -ENOMEM; - - ionic->pdev = pdev; - ionic->dev = dev; - pci_set_drvdata(pdev, ionic); - mutex_init(&ionic->dev_cmd_lock); - - /* Query system for DMA addressing limitation for the device. */ - err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(IONIC_ADDR_LEN)); - if (err) { - dev_err(dev, "Unable to obtain 64-bit DMA for consistent allocations, aborting. err=%d\n", - err); - goto err_out_clear_drvdata; - } - ionic_debugfs_add_dev(ionic); /* Setup PCI device */ @@ -258,7 +240,6 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) dev_err(dev, "Cannot request PCI regions: %d, aborting\n", err); goto err_out_clear_pci; } - pcie_print_link_status(pdev); err = ionic_map_bars(ionic); @@ -286,24 +267,64 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto err_out_teardown; } - /* Configure the ports */ + /* Configure the port */ err = ionic_port_identify(ionic); if (err) { dev_err(dev, "Cannot identify port: %d, aborting\n", err); - goto err_out_reset; + goto err_out_teardown; } err = ionic_port_init(ionic); if (err) { dev_err(dev, "Cannot init port: %d, aborting\n", err); - goto err_out_reset; + goto err_out_teardown; + } + + return 0; + +err_out_teardown: + ionic_dev_teardown(ionic); +err_out_clear_pci: + ionic_clear_pci(ionic); +err_out_debugfs_del_dev: + ionic_debugfs_del_dev(ionic); + + return err; +} + +static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) +{ + struct device *dev = &pdev->dev; + struct ionic *ionic; + int num_vfs; + int err; + + ionic = ionic_devlink_alloc(dev); + if (!ionic) + return -ENOMEM; + + ionic->pdev = pdev; + ionic->dev = dev; + pci_set_drvdata(pdev, ionic); + mutex_init(&ionic->dev_cmd_lock); + + /* Query system for DMA addressing limitation for the device. */ + err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(IONIC_ADDR_LEN)); + if (err) { + dev_err(dev, "Unable to obtain 64-bit DMA for consistent allocations, aborting. err=%d\n", + err); + goto err_out; } + err = ionic_setup_one(ionic); + if (err) + goto err_out; + /* Allocate and init the LIF */ err = ionic_lif_size(ionic); if (err) { dev_err(dev, "Cannot size LIF: %d, aborting\n", err); - goto err_out_port_reset; + goto err_out_pci; } err = ionic_lif_alloc(ionic); @@ -354,17 +375,10 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ionic->lif = NULL; err_out_free_irqs: ionic_bus_free_irq_vectors(ionic); -err_out_port_reset: - ionic_port_reset(ionic); -err_out_reset: - ionic_reset(ionic); -err_out_teardown: +err_out_pci: ionic_dev_teardown(ionic); -err_out_clear_pci: ionic_clear_pci(ionic); -err_out_debugfs_del_dev: - ionic_debugfs_del_dev(ionic); -err_out_clear_drvdata: +err_out: mutex_destroy(&ionic->dev_cmd_lock); ionic_devlink_free(ionic); From patchwork Thu Jul 20 19:08:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nelson, Shannon" X-Patchwork-Id: 13321006 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 80F721BE61 for ; Thu, 20 Jul 2023 19:08:47 +0000 (UTC) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2081.outbound.protection.outlook.com [40.107.223.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B973E75 for ; Thu, 20 Jul 2023 12:08:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MAkWVEaPl8UbHgUplWq744Mrd08RAc7JQmzg5xcDWXvuMpXlsi9JwC+/+iKWgTH0MdsoPVo4gS8TTVCa2OG4h1IhS+xk6DAb0uyIXIK3PV/Ky8ZnNajB7igL7toaqCcl+/C2I7NX7m7L5vHnthGpM+QPT//5XJ7xndxEwIv05ull6YgroKZmRnaZBH3MTrD56FKeGlxOV9dfxQ2yKZPQSL/8IccojGMxctfjaHK8VUStLRhk8CO8kGS/oAjlgCHJwn0RAiWgNYmIbt05CGRh+ZnvH4n2mYna6Yu0BT+RWZSCRAPffz1SXoMOfyLLgJih1MP1aYqb7+EONcp3daUJUw== 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=rWsuFpSKKhWHboZt7i1sp8iS/R9/5py/M4I2ag/aK8g=; b=cakPNBE9MycClkkPeF3kqsRwWSO6WWrA4EtYru6i6WyHhSXCKACNIdbKfZVj8TtVINY23gaZgDJ2IoZDXicPWoZAAYQ8rwbOEi0xXIIQgJsAKNXAzUgWFr68c3jRhDmXp6xlJbKIA3btKAtku7jpyIXhlONWFKVHaclU37wdBG/6c82rzdaMe+qgPEfYIONuzxXhv5+1wArl7VcnVGXkJp0iqUjtJ+vIPpPFbVrlTDc+Vk1Hj+HSPNo/WT/GzBYJ25aZSqkrwRZpbIm1U1gvy/1rSoqzTTL/OsY7eG3p0vPss38I+WGt/0m/qLGqbIYbxLZeOtWI1OGNjP9Kx41rHw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rWsuFpSKKhWHboZt7i1sp8iS/R9/5py/M4I2ag/aK8g=; b=PEYMe+YL1DQagrVO8ZUXvnc+B/FHlrAiq2GPF/o6uYz4LOSgQQz7dpkAHpgVdFqHCzip6koka9/1DTD870Wyr9md4wuqshBjpSkWBdWTX7DDE3myJevN38yxbnFP1dx9AbWCcpkjB3fA4q4WL3fCoyOL+3ARR0SQO7UrzLUIIcE= Received: from DS7PR03CA0069.namprd03.prod.outlook.com (2603:10b6:5:3bb::14) by IA1PR12MB6066.namprd12.prod.outlook.com (2603:10b6:208:3ee::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.25; Thu, 20 Jul 2023 19:08:42 +0000 Received: from DM6NAM11FT089.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3bb:cafe::84) by DS7PR03CA0069.outlook.office365.com (2603:10b6:5:3bb::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.28 via Frontend Transport; Thu, 20 Jul 2023 19:08:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT089.mail.protection.outlook.com (10.13.173.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6588.34 via Frontend Transport; Thu, 20 Jul 2023 19:08:40 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 20 Jul 2023 14:08:38 -0500 From: Shannon Nelson To: , , , , CC: , , Shannon Nelson Subject: [PATCH v4 net-next 3/4] ionic: pull out common bits from fw_up Date: Thu, 20 Jul 2023 12:08:15 -0700 Message-ID: <20230720190816.15577-4-shannon.nelson@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230720190816.15577-1-shannon.nelson@amd.com> References: <20230720190816.15577-1-shannon.nelson@amd.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT089:EE_|IA1PR12MB6066:EE_ X-MS-Office365-Filtering-Correlation-Id: aa1ef2e2-8fe0-412a-51f3-08db8954ba93 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LSqy9gU6xradepiD0dugHcvorchWXVNjEcxUjKGUcGfkool8NHP+NiEc7Z7a4FYUAtQJfJjnrq1IUv5bh5Gpy8PsXW8SHziVc7BQf3ZQyqjq38wY8M//Zz9AKPcnPUL2DMVNLqQckGiUiH1Ehq/h8mGhhlCGWCI803Aw8DAvO+fs6FV8MM83QSqxqnGwFHb7W/hSwxN5ueQlkuicNBkx2yrqRigXcbJGPfp7g3V7T1ZAHMk8yLrDU4wEl6ZMUn3Hon0l2Y+6zfPKRW9upijnqNSmaJ1XSET2WuV7kS3RqwDAUQNK0Q0gOi2ePg/xUA2oAebF6adthQQdQ3MNegqVvPNegQmyNr952OSYC8LYBJ/jb+zFTV4LJ2co7hW7geVRXtFUqDC3fV/U/qNVlmG311l7E7tR/gzNZBpvq+oRn3oKqqw1OfBWkcwsCK3BLMCMQRvwe9VyTO0Kkg7L2LpKQ/+TgJP4lwLjLNZ8CwFHaTmESng7HNQ3Xl3ASJ4/Ci57KiIXLxY9BI+nQBuxoBMmEz+4DPwLRSnKF7zKu67lB2O98F9jTug7TNWRjm1GSPz3av0S8irxsC2AEYCcTYejQd7fbM8c5+oPvvQDDLThx/Ib7eXHH0P6GBWoCi75a4Vw+pJsmLIMMMfa7fHi4IxHr4rdYWZ6o8QdM2JL3FdCoDf5ktnAJneffIL2cFZtxLQNzhS4f03KN8nWQE5AZggRY2+Cozf6ZnQVRaoZy6QMaGPUWUac0KMIFkCzHxc7aBlyeaxfnSmfry2/mBK43RHmPw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(376002)(39860400002)(396003)(346002)(136003)(82310400008)(451199021)(36840700001)(46966006)(40470700004)(2906002)(36860700001)(83380400001)(40460700003)(2616005)(426003)(47076005)(356005)(81166007)(86362001)(36756003)(82740400003)(40480700001)(316002)(4326008)(70586007)(70206006)(336012)(26005)(1076003)(186003)(16526019)(41300700001)(110136005)(478600001)(6666004)(54906003)(8936002)(44832011)(8676002)(5660300002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jul 2023 19:08:40.2751 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aa1ef2e2-8fe0-412a-51f3-08db8954ba93 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT089.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6066 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Pull out some code from ionic_lif_handle_fw_up() that can be used in the coming FLR recovery patch. Signed-off-by: Shannon Nelson --- .../net/ethernet/pensando/ionic/ionic_lif.c | 64 ++++++++++++------- 1 file changed, 42 insertions(+), 22 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index 612b0015dc43..2d03c1b995bc 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -3266,27 +3266,11 @@ static void ionic_lif_handle_fw_down(struct ionic_lif *lif) dev_info(ionic->dev, "FW Down: LIFs stopped\n"); } -static void ionic_lif_handle_fw_up(struct ionic_lif *lif) +static int ionic_restart_lif(struct ionic_lif *lif) { struct ionic *ionic = lif->ionic; int err; - if (!test_bit(IONIC_LIF_F_FW_RESET, lif->state)) - return; - - dev_info(ionic->dev, "FW Up: restarting LIFs\n"); - - ionic_init_devinfo(ionic); - err = ionic_identify(ionic); - if (err) - goto err_out; - err = ionic_port_identify(ionic); - if (err) - goto err_out; - err = ionic_port_init(ionic); - if (err) - goto err_out; - mutex_lock(&lif->queue_lock); if (test_and_clear_bit(IONIC_LIF_F_BROKEN, lif->state)) @@ -3322,12 +3306,8 @@ static void ionic_lif_handle_fw_up(struct ionic_lif *lif) clear_bit(IONIC_LIF_F_FW_RESET, lif->state); ionic_link_status_check_request(lif, CAN_SLEEP); netif_device_attach(lif->netdev); - dev_info(ionic->dev, "FW Up: LIFs restarted\n"); - - /* restore the hardware timestamping queues */ - ionic_lif_hwstamp_replay(lif); - return; + return 0; err_txrx_free: ionic_txrx_free(lif); @@ -3337,6 +3317,46 @@ static void ionic_lif_handle_fw_up(struct ionic_lif *lif) ionic_qcqs_free(lif); err_unlock: mutex_unlock(&lif->queue_lock); + + return err; +} + +static void ionic_lif_handle_fw_up(struct ionic_lif *lif) +{ + struct ionic *ionic = lif->ionic; + int err; + + if (!test_bit(IONIC_LIF_F_FW_RESET, lif->state)) + return; + + dev_info(ionic->dev, "FW Up: restarting LIFs\n"); + + /* This is a little different from what happens at + * probe time because the LIF already exists so we + * just need to reanimate it. + */ + ionic_init_devinfo(ionic); + err = ionic_identify(ionic); + if (err) + goto err_out; + err = ionic_port_identify(ionic); + if (err) + goto err_out; + err = ionic_port_init(ionic); + if (err) + goto err_out; + + err = ionic_restart_lif(lif); + if (err) + goto err_out; + + dev_info(ionic->dev, "FW Up: LIFs restarted\n"); + + /* restore the hardware timestamping queues */ + ionic_lif_hwstamp_replay(lif); + + return; + err_out: dev_err(ionic->dev, "FW Up: LIFs restart failed - err %d\n", err); } From patchwork Thu Jul 20 19:08:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nelson, Shannon" X-Patchwork-Id: 13321008 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A28A1BE78 for ; Thu, 20 Jul 2023 19:08:48 +0000 (UTC) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2047.outbound.protection.outlook.com [40.107.243.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91E231731 for ; Thu, 20 Jul 2023 12:08:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kB52wpOtUUkw1ANn+GBys7fRm2fuiSul/sLtXcAIr5BAd25XB4MxFMI+MsMFjE2GX/TRpj7BYHMyqK1VLPlAgdap2+Ezdhp9fX8EFfvtqw7uc8eWI5u8xpwMN4wDSPJ3nMWVaSv5WzLGg+NElRfO88JKBJLr3rXjDqI72bpNGH09/8bD5vm6/QABa1OWiPjFiio3MGwAAvacDhbD2yU1yMxviSuRW7nwTBNq5rHbMukClU0x+BVyh/Dxgt7Wj5XwsWBYR1TPRXvFdTAGt4aX9Py3upseQu0MfbdnGlfdZD4eQk6fS7Zbwzt7HMLVx4xnz7IP9MSKyY6nJFS1KyxbrA== 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=xgf8XHuID+V8m5lp2qUr1xdplpkPPnWhoe4FgH+cgEI=; b=HxDDemxS1Avl/IuL15lLc835F6YnNPdzMBTKjPIb+CnaKTMzw1I/OPf3SCjzC6pDeQS3ODfPVn1gpxHa/JMKEzwXqaIsVh+cSqapGAl0qeiZjbyRuupaLnhVBdQdIptV3USNjUIgQzVu6gDgR661IJ99Wn3G9ek6d8osS3k9TVleVwhNeWMVqnF3j7ZGaJguFdhBZ+GP4cBSs6QscFR4mv1g2qcFKcciljKBhSwsV7aZymVTFg7VY53iTO7CQKGeIhZsDoiT99ohvxKtJCuDRCFj9S4IqcKpduDdRexrP+XzBFVtK4StQvt0wO8/P4d9E/+sX5tsQJEqYN41SLDpFw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xgf8XHuID+V8m5lp2qUr1xdplpkPPnWhoe4FgH+cgEI=; b=RLLO5Z8TFaRJzAi6Zo+lQCFzvBX9frBD2uyzzw4XoenxGyFZhvJaT24IwV3rpNNTZM3ujk6h7zF0m/v9ZpDY6ZssrF7H1NjMYSll0s7x7IuU+aYJoNAAEZtIFzNIuXzgdNGGzoLs7/QZ45ruQltGF6wW3HWlw4aiAcVABcBCpBw= Received: from DS7PR03CA0072.namprd03.prod.outlook.com (2603:10b6:5:3bb::17) by CH0PR12MB5297.namprd12.prod.outlook.com (2603:10b6:610:d4::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.28; Thu, 20 Jul 2023 19:08:43 +0000 Received: from DM6NAM11FT089.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3bb:cafe::cf) by DS7PR03CA0072.outlook.office365.com (2603:10b6:5:3bb::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.33 via Frontend Transport; Thu, 20 Jul 2023 19:08:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT089.mail.protection.outlook.com (10.13.173.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6588.34 via Frontend Transport; Thu, 20 Jul 2023 19:08:43 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 20 Jul 2023 14:08:39 -0500 From: Shannon Nelson To: , , , , CC: , , Shannon Nelson Subject: [PATCH v4 net-next 4/4] ionic: add FLR recovery support Date: Thu, 20 Jul 2023 12:08:16 -0700 Message-ID: <20230720190816.15577-5-shannon.nelson@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230720190816.15577-1-shannon.nelson@amd.com> References: <20230720190816.15577-1-shannon.nelson@amd.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT089:EE_|CH0PR12MB5297:EE_ X-MS-Office365-Filtering-Correlation-Id: 1dfa3f6c-dd2f-4fcc-96d6-08db8954bc66 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zB/WmRx+cH7hDGUzzt8GJjO5R8OagiIroSoXIcT7XeRL5wSEN1fsR09qkXwRVaz4bqsYVyTIcOJ94AGPUtYDO0zReYBE5kungT1Nh8zDmMFuItEFB7y0qlVlUsBkoc25qG06+//9JDZ1kVR09DrwNNtL8XwSYSNjy+Av95WbmlE/cIo9meIv8MMFjdWdMLWBvFHLMGnhsxGkspIuRFfU044ya/x38IStrcDkXkiTJ6Jcn2ww7g3Yt/rNAG8yKlBKBbKa1zPKTiADfs1K2Hp2lplKiEoPDrc0vOXhuKbcqY5QyzoG9vSiGUKjQFP3ITouNjNPEhQRxP9dTWpzXy7jL2X26H0K/9UWi/xYrzYgVHO6Lm+hw2ULOXwHwY8n8AIbQVcBwsPsRuaJo3HuotBPLUiQLvQ5tl2TQ3SFT2vf/rsc81rHtlk8Y2s8AgaGZ1Y9xYhXK+p9GyH5zUWEZfjNjDiGnBw2TW7KOwxQAOS4EO16qT8GEK7lJ629sJ710Tc9VBsTUFdRapmqKiBZz2OJRg/ax9qFDxRehT23WpGNdPvcFpP+d6E888HhweuUN7NDjqdxNUCYjo2MkvSgFKORWlHj3/vVpSSVPb4ebx+TFz1E2u6oww1/UVuWTw0E18HmEYsa9/AXnbIf0nNqV7D6bM0xoA7m4uQFKkjFvPE52iG5geYqEEJcF6AebWeidUv6fZ3gNZ7BUYcAR7JWrJf469w8XKqam9fX05K3zJHi/Wq7E+m+XvoWYM0sn3zAs/OpI1fy4iWkPB0rWrFGYSmG9w== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(376002)(346002)(39860400002)(136003)(396003)(451199021)(82310400008)(36840700001)(46966006)(40470700004)(40480700001)(70586007)(356005)(82740400003)(86362001)(81166007)(83380400001)(2906002)(36860700001)(8936002)(478600001)(8676002)(2616005)(426003)(47076005)(70206006)(40460700003)(36756003)(1076003)(5660300002)(26005)(336012)(186003)(6666004)(16526019)(44832011)(4326008)(110136005)(54906003)(41300700001)(316002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jul 2023 19:08:43.3374 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1dfa3f6c-dd2f-4fcc-96d6-08db8954bc66 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT089.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5297 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Add support for the PCI reset handlers in order to manage an FLR event. Signed-off-by: Shannon Nelson --- .../ethernet/pensando/ionic/ionic_bus_pci.c | 53 +++++++++++++++++++ .../net/ethernet/pensando/ionic/ionic_lif.c | 8 +-- .../net/ethernet/pensando/ionic/ionic_lif.h | 5 ++ 3 files changed, 62 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c index bcce613449c2..d6ce113a4210 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c @@ -409,12 +409,65 @@ static void ionic_remove(struct pci_dev *pdev) ionic_devlink_free(ionic); } +static void ionic_reset_prepare(struct pci_dev *pdev) +{ + struct ionic *ionic = pci_get_drvdata(pdev); + struct ionic_lif *lif = ionic->lif; + + dev_dbg(ionic->dev, "%s: device stopping\n", __func__); + + del_timer_sync(&ionic->watchdog_timer); + cancel_work_sync(&lif->deferred.work); + + mutex_lock(&lif->queue_lock); + ionic_stop_queues_reconfig(lif); + ionic_txrx_free(lif); + ionic_lif_deinit(lif); + ionic_qcqs_free(lif); + mutex_unlock(&lif->queue_lock); + + ionic_dev_teardown(ionic); + ionic_clear_pci(ionic); + ionic_debugfs_del_dev(ionic); +} + +static void ionic_reset_done(struct pci_dev *pdev) +{ + struct ionic *ionic = pci_get_drvdata(pdev); + struct ionic_lif *lif = ionic->lif; + int err; + + err = ionic_setup_one(ionic); + if (err) + goto err_out; + + ionic_debugfs_add_sizes(ionic); + ionic_debugfs_add_lif(ionic->lif); + + err = ionic_restart_lif(lif); + if (err) + goto err_out; + + mod_timer(&ionic->watchdog_timer, jiffies + 1); + +err_out: + dev_dbg(ionic->dev, "%s: device recovery %s\n", + __func__, err ? "failed" : "done"); +} + +static const struct pci_error_handlers ionic_err_handler = { + /* FLR handling */ + .reset_prepare = ionic_reset_prepare, + .reset_done = ionic_reset_done, +}; + static struct pci_driver ionic_driver = { .name = IONIC_DRV_NAME, .id_table = ionic_id_table, .probe = ionic_probe, .remove = ionic_remove, .sriov_configure = ionic_sriov_configure, + .err_handler = &ionic_err_handler }; int ionic_bus_register_driver(void) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index 2d03c1b995bc..adc05f944c14 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -434,7 +434,7 @@ static void ionic_qcq_free(struct ionic_lif *lif, struct ionic_qcq *qcq) } } -static void ionic_qcqs_free(struct ionic_lif *lif) +void ionic_qcqs_free(struct ionic_lif *lif) { struct device *dev = lif->ionic->dev; struct ionic_qcq *adminqcq; @@ -1754,7 +1754,7 @@ static int ionic_set_mac_address(struct net_device *netdev, void *sa) return ionic_lif_addr_add(netdev_priv(netdev), mac); } -static void ionic_stop_queues_reconfig(struct ionic_lif *lif) +void ionic_stop_queues_reconfig(struct ionic_lif *lif) { /* Stop and clean the queues before reconfiguration */ netif_device_detach(lif->netdev); @@ -2009,7 +2009,7 @@ static void ionic_txrx_deinit(struct ionic_lif *lif) } } -static void ionic_txrx_free(struct ionic_lif *lif) +void ionic_txrx_free(struct ionic_lif *lif) { unsigned int i; @@ -3266,7 +3266,7 @@ static void ionic_lif_handle_fw_down(struct ionic_lif *lif) dev_info(ionic->dev, "FW Down: LIFs stopped\n"); } -static int ionic_restart_lif(struct ionic_lif *lif) +int ionic_restart_lif(struct ionic_lif *lif) { struct ionic *ionic = lif->ionic; int err; diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.h b/drivers/net/ethernet/pensando/ionic/ionic_lif.h index fd2ea670e7d8..457c24195ca6 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.h @@ -325,6 +325,11 @@ void ionic_lif_deinit(struct ionic_lif *lif); int ionic_lif_addr_add(struct ionic_lif *lif, const u8 *addr); int ionic_lif_addr_del(struct ionic_lif *lif, const u8 *addr); +void ionic_stop_queues_reconfig(struct ionic_lif *lif); +void ionic_txrx_free(struct ionic_lif *lif); +void ionic_qcqs_free(struct ionic_lif *lif); +int ionic_restart_lif(struct ionic_lif *lif); + int ionic_lif_register(struct ionic_lif *lif); void ionic_lif_unregister(struct ionic_lif *lif); int ionic_lif_identify(struct ionic *ionic, u8 lif_type,