From patchwork Mon Jul 17 16:59:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nelson, Shannon" X-Patchwork-Id: 13316015 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 F0C6C1FAD for ; Mon, 17 Jul 2023 17:01:17 +0000 (UTC) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A87EAE1 for ; Mon, 17 Jul 2023 10:01:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eNUT9XJCcngHuSfuWcyEFAiKXSmLCbpGx8Gd4lnRu11XA0bCfqcAGFIHlNSg/2fes2J06PuWnfsOIirz+YwMcnGhemSSnyUR5arAlEvtGD3IroTBKYoAdAXKLRngs9sb+ic2jkIyqZrAhTG3rOHo3wKHKBE7mZX4k4PcFCgpaqieUJcXOorcRlMRqmAW8jCOrOO+p4b81pubimaM3r+t/HzT8leaG7dn32x+l+s3K4fhgnhyxtXMGjUFr65sXklWtjezd2aBp3sOQ52Nt6jK8M9hT7GzIdI7qbm/IBrZ1/MYR/bA/EaMFWDBeKYEmSBDEs42dKB1JtnMk8JwwFrtbQ== 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=DEgcAOOxJAiYT1mBLnMlVFpCarP+/me/t2sejYJgumSKUpmJsnvk6/caFlbKG0+v85uChq5NHXpXEco5NQ3l+EXiN0mH8LslvtzIUhhIhKRr8XtCA1k/GIdLBzBzxILcp+RLFqxGW0ZrXM/J9rho5pPcdC64CHs8z5LsykfHH6Bcr7cVh1bs5XZGqMFrPyBmONOY/m06p4b1CIFjWcQbbV803kv0cROmqlZgv+Js95uPIamXcGExlFIrLlrnl0iyKWbG+W1W0vwDQ7q748s2GUL96hlVGiccPQZvuEB+E5Deuo0ULuMnCRxBtl2ZiOCrl6HOGYF8m6SFibdQXI83JQ== 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=YyWTbhV+TjMedyloM9kEJE/Up1PdWgkAC4FvHipwhgB5SEZMcdIzAMrfWiAo4blae+na7P/4VuxxHJzize71OxAas+J929BDnq6ANEWYrNLiDoNbYWuIMEDr4PHTKAsMz4NzEH53LNpNp1VVgKKqbjRSraE8NFxyuepb4M+tJ/Q= Received: from MW4PR04CA0301.namprd04.prod.outlook.com (2603:10b6:303:82::6) by SA0PR12MB4509.namprd12.prod.outlook.com (2603:10b6:806:9e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.32; Mon, 17 Jul 2023 17:01:14 +0000 Received: from CO1NAM11FT082.eop-nam11.prod.protection.outlook.com (2603:10b6:303:82:cafe::19) by MW4PR04CA0301.outlook.office365.com (2603:10b6:303:82::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.33 via Frontend Transport; Mon, 17 Jul 2023 17:01:14 +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 CO1NAM11FT082.mail.protection.outlook.com (10.13.175.224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6588.32 via Frontend Transport; Mon, 17 Jul 2023 17:01:13 +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; Mon, 17 Jul 2023 12:01:12 -0500 From: Shannon Nelson To: , , , CC: , , Shannon Nelson Subject: [PATCH v3 net-next 1/4] ionic: extract common bits from ionic_remove Date: Mon, 17 Jul 2023 09:59:58 -0700 Message-ID: <20230717170001.30539-2-shannon.nelson@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230717170001.30539-1-shannon.nelson@amd.com> References: <20230717170001.30539-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: CO1NAM11FT082:EE_|SA0PR12MB4509:EE_ X-MS-Office365-Filtering-Correlation-Id: ce4d5f28-b5c1-4725-bc17-08db86e76dce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: k3jExCByA6mXkI+M7F4vO3ZsPy2xraZYG+2lDY7YBFrBZ08Oe5N4dMe3/+PsDs4AMh7lN3SnXF7YIYbrBE7MAQqhuqxsjtfvfQ5AsF68DToOIGPTXdEmVsRWHKbQ0kMHSEY5j+3LemIuA9733Q3pUcy7fWggIMIefam//LHiij5MwNx8Uh0+OWWAuziWBmc1wJo9x/dj4k37b//59vD+hbp/W6qgkVCb3xpeV8a62eNSX0AwIHWkDdSSSxVa0x/aIe3nXpoMseTx5XeWYPt4VIg/qKVSznDCsT2kCMld5DTFJheE25jXmXjTILbzgzBe2P3wz22UWda5Uitrx/b5jrh33veP8FwoVRT64c2OPSGkx7EcxCDZ/CV8a77pFiyrmxJXgmO/5QpbpbcWZfV0iteKHKvSChoz8f8BYc9cwVAxsxKpB3A0u2t7sHAIx0SCYUFhIIg58WeGNQ14FMmDOgrPHEVzBWdhUHmh0ek5S3uDf7CO7JZAzpx+OPBqlCcxQkyi3LDHd6JGxYAgvxGe7oxmJg36gThaSy9u/KMuq4NawFlx5M2gDMKZ/prRbtkGZ4APsSB/B07sM5zt9c0sKEE4brDrIO4dXUGbOe8s1EJNe1tdUFuxPS3cF89NudfxgXQ+j7Eg4nja7T47H/2zkqORjKH0/g/nORVKiYlf4SgRX1/SegKUTRCcI2bO0TTwc1rbbLiqmEW4VyXAcbJQSoduXEoV9pbMNpd4d9lhkREQkWdt0Y2B4Bw7m6+Y2QjLBQb2csm5pBFsr1pEBico24Wrntanc1o50EB8ayL7rol7PqSrCUx2F6W1F2nl72T9 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)(136003)(376002)(396003)(346002)(39860400002)(82310400008)(451199021)(40470700004)(36840700001)(46966006)(110136005)(478600001)(6666004)(54906003)(186003)(1076003)(26005)(16526019)(2906002)(44832011)(41300700001)(70206006)(4326008)(316002)(5660300002)(8676002)(8936002)(70586007)(81166007)(356005)(82740400003)(86362001)(36756003)(40460700003)(36860700001)(426003)(336012)(47076005)(2616005)(83380400001)(40480700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2023 17:01:13.9483 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ce4d5f28-b5c1-4725-bc17-08db86e76dce 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: CO1NAM11FT082.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4509 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_NONE,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 Mon Jul 17 16:59:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nelson, Shannon" X-Patchwork-Id: 13316016 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 12DFEBA53 for ; Mon, 17 Jul 2023 17:01:19 +0000 (UTC) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2040.outbound.protection.outlook.com [40.107.220.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B86AEF7 for ; Mon, 17 Jul 2023 10:01:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZXf7x0roaEZ7yygrXjHmZQGuDy7bVAf8vHs+dAfYF3bfjAMOcKgq2UW6MpPbwoa2kaNDnTufrkqWPwiBFWC6FKnRwNcvkGZ2/CKlIQ+tY2EzefCUtihToQpLh1wWKAxlSGu43QaDSXQ5TXjP0M874ENEg2BxNy+t9man+cMrcbN3qzsN6YlS3cWGqZKt0eWlFf2cA29tXhmY43nejSyIvzHTskvo+m3nDLENGG039f+sNMGWSmfinsi2Ow6hlJhZYKeNE2nwBvss1l4aYunI8FEhfPJ99NjMmrZ0pfc1UUx2swiyohaETa9ri/GFyNfhgBnsLy5sRQJbpjM8TM9ciw== 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=rnyeEAsZ+PXRzIeRfU9AXImqgcQaAMhVyW6nhLZtEpo=; b=HTo4eg+0FX3U2V8IYIdfpV+r7CV4Vut9R6xlzAfjqAYR+iaP3BYHRR8mKMG2POsTke72RKnio8UuQLw0qoYtJr2o9uWBmburgHdcavW7Lg7zpap1eb5luhT0RCgV3t8oF0ardJvp//P9xk9vDGidBclWzZnSxK26dSS/XvjATlgQmIkhVJOmvZ35im6nsJQrGQrm/MduGZVDKvFkajd9HUwcvYYtA/6yAVlTbnrLaygNc/i1jXCQFSCmVi9U05qsCpkEZ+CNK9HtjHIAweIz1dSQUV+0wIgOUTJPXpcAyum65sMHx2BEjw1TJkEkoH2P3Fr3g/+32E5A3bIAxJ26/g== 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=rnyeEAsZ+PXRzIeRfU9AXImqgcQaAMhVyW6nhLZtEpo=; b=AH6bIpsiUhtahKi7wsq5JJSfT+FO3nPRNnNEGAtWfgaPmovs62rPU51Nx8fN6P2kqsAzYRplc1V3AMicx6C56d4ffLiPUEPzwRh2/zJhDd82RsinfpLCdln/H/55sjih+DMwTd4n7RpxPuVmNC73k1AioJ6ECQKsEzBPjATMZW0= Received: from MW4PR04CA0302.namprd04.prod.outlook.com (2603:10b6:303:82::7) by CH2PR12MB4117.namprd12.prod.outlook.com (2603:10b6:610:ae::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.33; Mon, 17 Jul 2023 17:01:15 +0000 Received: from CO1NAM11FT082.eop-nam11.prod.protection.outlook.com (2603:10b6:303:82:cafe::de) by MW4PR04CA0302.outlook.office365.com (2603:10b6:303:82::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.33 via Frontend Transport; Mon, 17 Jul 2023 17:01:15 +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 CO1NAM11FT082.mail.protection.outlook.com (10.13.175.224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6588.32 via Frontend Transport; Mon, 17 Jul 2023 17:01:14 +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; Mon, 17 Jul 2023 12:01:13 -0500 From: Shannon Nelson To: , , , CC: , , Shannon Nelson Subject: [PATCH v3 net-next 2/4] ionic: extract common bits from ionic_probe Date: Mon, 17 Jul 2023 09:59:59 -0700 Message-ID: <20230717170001.30539-3-shannon.nelson@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230717170001.30539-1-shannon.nelson@amd.com> References: <20230717170001.30539-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: CO1NAM11FT082:EE_|CH2PR12MB4117:EE_ X-MS-Office365-Filtering-Correlation-Id: 839f83d8-f75d-40d6-0304-08db86e76e59 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NUrK4wqoY0IvaAftwn5lSdc0sm7HJwY4143qlzoQInUBzf4Q2n3X5UFabnim+0jhql3MnIeWNZOfnsffK1YCFq2oEZ9B/AbGE/HddR9mHkC7u5g9nHqIqLlJQhRqF0ql3ZimH84Whe/ANhMhRish60kYY5fdiqPlJtL8G8U7XdU0Az0kmRAT/7ZCXCnPyf/fK6FONhcSqaRsYrx1H61J2DKCXOIaHUnbNRJ9OiKPVrOYw9l7C3hoqGrOf9rqPw+834WlJ8UMq1pjttWw4kW+7E9R3wPxrAGKM5ZSOJlqdVKZmcxDQQtNe7L/hkMz43QWO9hmmlgikDjrFO2pKUaplkScSe7LhjyXXIucVyH4XhjMBjGl7D0vXJK1tybpm6DhknIXMD51m5tLIddzHjAEy3vLk+mgHzv3OD2T9AYkz6PI7PtXH7WviBp7ip3ZsJxeK/vqmNcur09FAr6kR2eFSFLpkNdTwNZYjOtDCU1BUN1FpEmH1p+LbiBViU6Zwp1CxGp5qG6vlT4RsmRwBV7pZiC7FnXzvd0E4uG4ycHTHNjyHjjM2hFULFvfkCbwaxLBiK7VdeK1I1iQ/6g8eU3bJ2sDVwhdyAkQimh+59Zyb6rtQffihhHETvgBZVnQWwJoJX5sCbFBe2JLAWumrBVmIAYp2Ol9P0bD4jZdSS5EkHeh3m+m3LXKeYn5h/VVMDy7T2GJkdZhvtd3Fk4LhoESQBpF91iDUl4DTfzVLyAuHrMyyl5fHdloK3UQka1uxmTDv8OD4YH+mOf+8KzGucYYgA== 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)(136003)(396003)(39860400002)(376002)(346002)(82310400008)(451199021)(46966006)(40470700004)(36840700001)(110136005)(54906003)(6666004)(478600001)(36860700001)(426003)(2616005)(83380400001)(47076005)(36756003)(86362001)(40460700003)(40480700001)(356005)(2906002)(70586007)(1076003)(336012)(186003)(26005)(16526019)(81166007)(4326008)(70206006)(44832011)(41300700001)(8676002)(8936002)(316002)(82740400003)(5660300002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2023 17:01:14.8545 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 839f83d8-f75d-40d6-0304-08db86e76e59 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: CO1NAM11FT082.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4117 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_NONE,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 | 85 +++++++++++-------- 1 file changed, 49 insertions(+), 36 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..b141a29177df 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,9 @@ 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: - ionic_dev_teardown(ionic); -err_out_clear_pci: +err_out_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 Mon Jul 17 17:00:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nelson, Shannon" X-Patchwork-Id: 13316017 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 6E9FABE57 for ; Mon, 17 Jul 2023 17:01:23 +0000 (UTC) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2061e.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe5a::61e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C1FCF7 for ; Mon, 17 Jul 2023 10:01:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kzo5w3u7LnZ9g4KMGuHIu+L7ttNGSTwj20mfZjGM+jgwD40LNZUQgv4foIa+sg1oN38JYLrr2dMFPJgJVZS1xznalDPuCaqUfl2VAXc3I8Hkz90Md33pRHBAMAyF3Qzfbp8FbxcSN4n1qv8OaKN39AAOYFS+bqe7TU5tdlAHY9BHmOhc9XuUNk3y4ANLgUFnGFOaIIaQyZ+tS4mbMF9uTNLGG1WYQCwfWcPp45fAcUqSX9naZ1gzxP3qRLGKhkr+wyppWQamJeiWjitmmjtjh6TU3w0Zt6Z+7YDZmdTQjC7OTxmjQj05Azd0A3xmFa3UYVPWVZwEahblXWg7XjTfBg== 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=iI8OnGXBlH4qKmwk9YCKeJJ6M3Fn4PPmJo6gYQb6X4I=; b=Tpj8x+NrP5czRRohuVoJ5Lji+r+pI4n64DcbTFkKqOFn2UP34TGB4IrD/5MCVfz0puDL9XxEJ+J03mcbsN3gHy/t3ZMwy0ZK+qxuikJX6KjGsdOHLHNwXJg36R4l+rD4IIa/XtQJeF9G8VwhHHpsruHwYojjUSOs5Z0R7vInzAJFeVYtYJRq6XI2AhuDpudFJUS4xd1ITyQthHLcMZ2YZ8ARP0jj3lwU+49be7lEYSfxV2XTvnYTqLiXpNkGirOcx0Y+3AesgzR9+L+M/7NeyGZil5VPIIqRBsOKfRis9rOl9dehsuVRWsAsEHS7NfGg01jlHGjS/s8s6xgyjtS4Bg== 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=iI8OnGXBlH4qKmwk9YCKeJJ6M3Fn4PPmJo6gYQb6X4I=; b=lCoNNYqKC9KHsDbEIuBW8umf8oiAXTVkg94YfgqmPiYyb3+CJ4knofvYZ+bPPAyLq6vrzjbTo0oU/u1bidIVHclN/xfGiPfPBJnyQJaB5ymidvmNJrNV5X+qM77IPNMQ1IZkNIWP/P0WGUvks0xKe0eLYd7QCGfyFIk+BFIDmek= Received: from MW4PR03CA0298.namprd03.prod.outlook.com (2603:10b6:303:b5::33) by DM3PR12MB9327.namprd12.prod.outlook.com (2603:10b6:0:42::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.31; Mon, 17 Jul 2023 17:01:16 +0000 Received: from CO1NAM11FT057.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b5:cafe::97) by MW4PR03CA0298.outlook.office365.com (2603:10b6:303:b5::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; Mon, 17 Jul 2023 17:01:16 +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 CO1NAM11FT057.mail.protection.outlook.com (10.13.174.205) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6588.33 via Frontend Transport; Mon, 17 Jul 2023 17:01:16 +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; Mon, 17 Jul 2023 12:01:14 -0500 From: Shannon Nelson To: , , , CC: , , Shannon Nelson Subject: [PATCH v3 net-next 3/4] ionic: pull out common bits from fw_up Date: Mon, 17 Jul 2023 10:00:00 -0700 Message-ID: <20230717170001.30539-4-shannon.nelson@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230717170001.30539-1-shannon.nelson@amd.com> References: <20230717170001.30539-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: CO1NAM11FT057:EE_|DM3PR12MB9327:EE_ X-MS-Office365-Filtering-Correlation-Id: be3dbfa0-6975-4d34-6f33-08db86e76f5c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gMRjib8zIp96Q7LUM1WVG/lOvu+De3VvUmxktFK6+JoouDQSzUmLRDY7HcUlTMCQxhlF1kOodq6jZB9yF+yNReSFNKD2RIPaK0JhJmssX5P0mz2vt//Jyz2X5dQwgiP8DElfcAWVqb43WlGgOuVujXq4ctiMpGQCklqMq3N8wxS3YJ16OSjcMeBKpP2hysSuyTS/dqbpwbaHBFgusUmOo2iJw2+XWEeXehhq4JDR8RAfxoVTbUKamVSwOHQJFRm0R5m+zztkYB2d+A8i2b3VTXi9OgyfUsCY9/+5C6gIBXKih0HSLmdo5552jW5rqrGb8JT3weIRxV440zgz9njsI0PfDDZnj9S1ze2IVXvteh4y7ownpbVTvTSlPFxXTaX8f0UvouxqWdQOYyrhbT/ziKuuZJHF4YKhdAWV9hc/wLi+Sxqi6ulEbtFStd9cWBwVkNIV+mA8n8KD81V/+l9ztJ+KVEkXNWT1Dl7XsXinVQRGZwgP3MLbNSO+Z8cUPS0uVU/PK+XpaQh3r4YPHzSAC6iWMOAKasY4WkKG/x+6vUv84U+NG1Va+GLvUNY7VmBT4TcGNgz9XaglQxK1Wa8vWvkDx+SCn62mgbK8fpG2jjkqgaXYDB67tFpyRW46aKJvzBgw2OuxwLEqLAsyIOgWAqxq//IxKlK/rmrFaHfSJjl1CXNnUj6Jt39qDV2dhVFlu5mpdA4VRYUT64FavwRWrGKJ9M1qy3AdZFwKPsXVNBUew9qiU1AG1cq9GxWpDTpYVlHBt92BpLysQ4n215kv4A== 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)(396003)(136003)(451199021)(82310400008)(36840700001)(40470700004)(46966006)(2616005)(6666004)(82740400003)(478600001)(356005)(36860700001)(47076005)(16526019)(186003)(426003)(336012)(83380400001)(26005)(40460700003)(1076003)(40480700001)(8676002)(8936002)(4326008)(41300700001)(2906002)(316002)(86362001)(70206006)(110136005)(36756003)(44832011)(5660300002)(54906003)(70586007)(81166007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2023 17:01:16.5234 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: be3dbfa0-6975-4d34-6f33-08db86e76f5c 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: CO1NAM11FT057.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR12MB9327 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,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 | 66 ++++++++++++------- 1 file changed, 43 insertions(+), 23 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index 612b0015dc43..94b14ea6ffee 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)) @@ -3317,17 +3301,13 @@ static void ionic_lif_handle_fw_up(struct ionic_lif *lif) goto err_txrx_free; } + clear_bit(IONIC_LIF_F_FW_RESET, lif->state); mutex_unlock(&lif->queue_lock); - 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 Mon Jul 17 17:00:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nelson, Shannon" X-Patchwork-Id: 13316018 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 4703B1878 for ; Mon, 17 Jul 2023 17:01:32 +0000 (UTC) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2085.outbound.protection.outlook.com [40.107.223.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3E7FF7 for ; Mon, 17 Jul 2023 10:01:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b+mbhWw1Xwb2BNlMi68EfIisTI9ag47mbWELh206lsqr/12i1ELSnt9T+rk3MOYJKFeHKMtNq2ZwMddCnWuM1cO8Kxx9su3z3hiQucnrk1xLwHanakcS+Tk19lYqqI0mJuRYIKDPQeua0ReYeC/rZX4vB+Dp09n9fcCUdq+D8zYZ9hDsb5/XOnpYsdBCL/gFDqoI2ZpwhXDfTNmNf/dWqMtlZ0T4MzGCePxthqq0BSkhrTojM0LF63NWaoUh4FqGjN67BRGCX72j3+wHf63EqnrYw0WJQHiMToLg9Hsm8r2UPNsqJ32124zGmw18OILkJsuV3xLw9cIdtU5n5ziMyA== 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=hlRzQPKX0GCRdl4J0We4dPIv8uiVTa48synp85cJtWw=; b=e0LfhFZR/OrT8EN3IOpVPf2cSQ7grbWGE0aVLVOlOtviQSUkCEmeZ62yp8jdypB6R8sa3hll+fIK64VpgUDA2LeQqilV/yb83AxdOiFIz+nAr638iButk5h5U9A5tbiWlYk/fR+Lq6gSl/DTW0pmytqnZblFi7sLgioICoxV0F82aw2wOV6a/SyiJ2YT9C2TJut02eyPece3+05Ul5r6DCsDkKx+SIIcLNxQNK+X7v3kfavAtMW5OaYV6NBnTAfTeDQQLnH9BV54omSDkS1quNOwAcu8BN4qsKsdG/RVCGgnoD8t+sgYgcUm5/7VjwUZ44OfqGvFpvSueev2Z/fFCA== 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=hlRzQPKX0GCRdl4J0We4dPIv8uiVTa48synp85cJtWw=; b=4TXVS4E5fbpVQBI/70pbZtegF02L8wkhk2o976wsig44BACZWyuUOM6/0YJahlNrfHheCBgoUA/sJEY6wuhpe2JsHqUglN9E9ZKqViO6QC09r1rR18VmDNa5Goh8oWT8PcSFmk8o+IXPyxDQn84iX3NTXve81q9ATMrHFF2F5qM= Received: from MW4P222CA0006.NAMP222.PROD.OUTLOOK.COM (2603:10b6:303:114::11) by DS7PR12MB5768.namprd12.prod.outlook.com (2603:10b6:8:77::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.31; Mon, 17 Jul 2023 17:01:28 +0000 Received: from CO1NAM11FT102.eop-nam11.prod.protection.outlook.com (2603:10b6:303:114:cafe::4b) by MW4P222CA0006.outlook.office365.com (2603:10b6:303:114::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.33 via Frontend Transport; Mon, 17 Jul 2023 17:01:28 +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 CO1NAM11FT102.mail.protection.outlook.com (10.13.175.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6588.33 via Frontend Transport; Mon, 17 Jul 2023 17:01:28 +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; Mon, 17 Jul 2023 12:01:15 -0500 From: Shannon Nelson To: , , , CC: , , Shannon Nelson Subject: [PATCH v3 net-next 4/4] ionic: add FLR recovery support Date: Mon, 17 Jul 2023 10:00:01 -0700 Message-ID: <20230717170001.30539-5-shannon.nelson@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230717170001.30539-1-shannon.nelson@amd.com> References: <20230717170001.30539-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: CO1NAM11FT102:EE_|DS7PR12MB5768:EE_ X-MS-Office365-Filtering-Correlation-Id: ab469709-5787-4763-5451-08db86e7766b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UI3OuXP3euNIJj39RkT0Tm7K+8ZvDDbXSQRJD9y8xTm5LlFgDHR/tn6uDlTTqPld/TTpP1+dmecHqLKUG7ZhnFhZGRESKgCfY6a8T3UuItgOYcb/44DdHF+zdAL/yQ3s4KhLdQlQR+yUgK9afRY/4DTMxiYDS3va5Ro6TnGlzGv+i0NrH0XtV9YEhx8zyhDEtg29z3ww3NOaCUDPflfZ7Qs2WSWtyjCGBAY8fL3RuVADnIVjRk5JPPf8hJ2+/gZQQbGnCGAyX0S/Tst+hub47ZMUfTs7ghiBFoOsjJVfE9JBBp8hFFvlDK9/m6Ez6M3sMkaJ9doi9kCJ+LCgDU2BPaVqqDMuJwyhHeaKYmiG6915d+wUlcwz3DC6X3XBw/eBaflODS6BChKAwgzJ4ngCtnQduEQwAR5mYX/2uXulKVtU7i6NQF3XGv1qSxsy/TxpdayWaMg17IsuKCcrl3KWNsFac+psunzdrd51fLSWB/XxIW50CfARF8g6rL/A/g2FGIBrz7M3jls1EPR2VNxsx2J7fHJ4MxV7oyvpv/Rz2LlRlo69zMy+bTAmn2D3iP+3z7YNg8I0aOkl7+pPVO62EqKS8ai2Fyhgj6IWJ00kzFAzvg2zyx7vfXMR5IrG8mqHtjdnUOzWgrLZTTmCAa05ldW6EoJBBgvefHscZezoT8iwoQgyk9xHCkir47gA2i3rTsF0c8VGT/IZ/RPTF5wth7mXtEIBfJNu3zKcYsXMCFgQlzO3QsIax0QPDb+5P81MUIJLf13nhsjRtl/Xv68jnw== 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)(136003)(39860400002)(346002)(396003)(376002)(82310400008)(451199021)(36840700001)(46966006)(40470700004)(336012)(4326008)(47076005)(426003)(36860700001)(83380400001)(2616005)(186003)(26005)(1076003)(16526019)(6666004)(478600001)(82740400003)(356005)(110136005)(54906003)(81166007)(70206006)(70586007)(2906002)(8936002)(8676002)(5660300002)(316002)(44832011)(41300700001)(36756003)(86362001)(40460700003)(40480700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2023 17:01:28.3963 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ab469709-5787-4763-5451-08db86e7766b 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: CO1NAM11FT102.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5768 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_NONE,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 b141a29177df..3fb7925c2d47 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c @@ -408,12 +408,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 94b14ea6ffee..9a10458f4a31 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,