From patchwork Tue Jan 31 16:30:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 13123163 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8559C38142 for ; Tue, 31 Jan 2023 16:31:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232241AbjAaQbs (ORCPT ); Tue, 31 Jan 2023 11:31:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231936AbjAaQbP (ORCPT ); Tue, 31 Jan 2023 11:31:15 -0500 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2097.outbound.protection.outlook.com [40.107.220.97]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E401372B1 for ; Tue, 31 Jan 2023 08:30:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AhVOp5Iyyadw0l36gwPnaPCUGqJxBm935+HLwc0umQOU4RbB5JlIjmnj4lSd9zFU7Ri/zJgCPU9il6rDdJB16QJ2RIo7E01l+UKhmoy7x/yPlF07LPiIYq15AH82IGRB3CgTjhYD6zuVLN8X1a+N77/PeasOjx0EO16b4LUWKCKbNnqMIPlY4kTxYqy//wPl/X01X5bsIWhFuOiUoKO9meWZ9XyewpHSCYMasF/Pp/8VF/VBOjvMEGOdWaBwmZ94oAIFdX9/ZFqDMNysP0q5GZI6zW04Of90zxNTKlOAtzMgdniyn6xZQGAutTMspkaD/eQvJapjC/TDoJG0hetHfg== 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=57ylOHnP9SqzkLGk5KPc8MZmcdSXRdjQtdvqMc+keFk=; b=kGtFlAjeZi4xNa0g+SzaNaXC61KuF+ZbrAfK8oSdqBMmO/LU8tTdNE0vLPPgPpUp5B15wa0ZRhR2D8GM7bC37DJJKqLaUpErYITXIVJZOOUNT35GdqtCf70P/1t0SPVNR4qwK4yL8PKTbfHqNot7J/pTyyBDBcVRKLcSkvsWqgS8dh11VLAe+V3tdFfGfw+wZ1Hz03ozhLyxVAZdfZjXdqkcOFHiNDtJ+twSGttS+aBSuKWaMsLMdSKZcvmUtiE4CCypDnKqJd8tiB09SUIUvVtAc9DP3i2DNFhTrv+n/umYhzVdeFJ3+aZ+4MdeBF0j+09m5WUy+VwFosYvKLkO9A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=57ylOHnP9SqzkLGk5KPc8MZmcdSXRdjQtdvqMc+keFk=; b=eL9mGyM1NCyGhn1MKHdb+gY8FTBrbhsaaVaI6LLhTL6Z9xKgDQLVAU8mYGTX9bk0bGs9l3lyYj7HVHtIvIBI4SD1/drD0JznarR26EUiYz6ZY/sRhwhu08j0rgnfdcceBaYfJfUsoojQ4Zc6U6fh7tC3309G7JSYMnYLZghZ5xo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) by DM6PR13MB3897.namprd13.prod.outlook.com (2603:10b6:5:22a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.33; Tue, 31 Jan 2023 16:30:50 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::eb5c:910f:3730:fd65]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::eb5c:910f:3730:fd65%7]) with mapi id 15.20.6043.038; Tue, 31 Jan 2023 16:30:50 +0000 From: Simon Horman To: David Miller , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, oss-drivers@corigine.com, Huayu Chen , =?utf-8?q?Niklas_S=C3=B6derlund?= , Simon Horman Subject: [PATCH net-next] nfp: correct cleanup related to DCB resources Date: Tue, 31 Jan 2023 17:30:33 +0100 Message-Id: <20230131163033.981937-1-simon.horman@corigine.com> X-Mailer: git-send-email 2.30.2 X-ClientProxiedBy: AM3PR05CA0115.eurprd05.prod.outlook.com (2603:10a6:207:2::17) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR13MB4842:EE_|DM6PR13MB3897:EE_ X-MS-Office365-Filtering-Correlation-Id: 435002cd-dd20-4889-a51c-08db03a883c4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VveIdNFObhvHhF9hu0hjJS1S+qv1SH7PPbVQjqPDTjnHAZWs70mThDOtKqbAJt3Vv3ukIagnlj4IVcyPAaztki3FJt4gj/9BV4DyIiZctKOOSE4TgnogP37wqEVf88zh0Yb5TwxyzlxrzGJPQj6sFyMLqBy/fSZsQX5j+4y7p8M3euvH9fbWeOk3SMwB7+WH+AhyUUbp5m5Rs/jl/J07Ubl0GD1o3s5ENf/mrrs/H48WscS2mg9HLSo8FMD5CydnGEEofqz12uuw1Im60kmQerMVFc9BSmNRNr1x338PeqrYVexMHRzblb2k3utoevioRB9PrHX6WAHSIrdv4j+MzJbH5rthgZqiEHGjfEVchJWUymQ7k5RyL6sRWQ+MnWRXAHqzEzXV3CbE3UWK/Ru9bV5n39Q9am1Z92Toe6hIyiY1e2bC9USYBpIxAP/erlljm2GiQOncs0gmCElNxNMXA4MCioY7DemWbqYCbBTnSMpFMD4DGgNJjdwXzolkgPfLE7S2OkHpRCHvj3MERrSO+5wN2oTbflGklYWoXnXGqDf3JXOqUUAny8UmnIsmKJRCb+K8Lz2q5AuoA0NXiqRwaiR41AF0oPpgl9BQfreGsqZyHZnWKPrWUiEnLch3djuguijIQXBGFnOX3ppAAoAB2w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR13MB4842.namprd13.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(376002)(39840400004)(396003)(136003)(366004)(346002)(451199018)(54906003)(6486002)(4326008)(316002)(110136005)(8936002)(66556008)(8676002)(41300700001)(6666004)(66946007)(66476007)(107886003)(6506007)(6512007)(478600001)(186003)(1076003)(52116002)(2616005)(83380400001)(44832011)(36756003)(5660300002)(2906002)(38100700002)(86362001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?02FvIJYWLYbUidaTQYQ6SxY5sdhA?= =?utf-8?q?eaiAaIFkbDdC6AJZN1v44jQpCj39l9KMWXh1k0bBmMCbFzU9zPJnLXn6xm2cXqOTq?= =?utf-8?q?Rv/ZdUzMIbRjb72Tw5ZxiYgXnT9BffcRAlPZRZLtwh744OSX9ampCx4XSc0/VVZcj?= =?utf-8?q?o7aqJbrMmM18aTnQgjRV8ODQy/bga6TFDcPX9OPYZfmk5azXR9sqbLzpG1W0xeAOY?= =?utf-8?q?0R/Cy3fKI8CM/gctp9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QxE5VKe5jpE50LzvoyGwDT/RobMmnqBApNeC08nXAU9nDclmT4e?= =?utf-8?q?g71ja4QMBB7jdKPyVmdbGkgAMlD+qQlotdFQxw7wDuxdn2nG86M+BrWYCwNMTUC2v?= =?utf-8?q?aqq7wjehxiGn9a8sAEAbD0ZO4Sazp3nRG8FXLtta26UegCV4nfmoDkfzcdB6AvdQ7?= =?utf-8?q?aeRZnHC3CYBz4LcipSkDq58tQvkgU6jstQwite8yAlQBeiJtfSNqlludKcIQp6Wks?= =?utf-8?q?ptKpBo7fUJFbx7VhuPcy0FLYWths1DJppRL10zS1gEE1GtwXOMjyQYD2Q/VDglDg1?= =?utf-8?q?uo/OU8uh87yr5HDKttr5eGCzJzxmSGX5crHf9b1W1rjnwdVrjZ1Qs2YqbvwKxByzy?= =?utf-8?q?BXsQfWP3edscNGSsKwlWAcczQ+2hS6JduNZjm9U9Q8si0uIaWCbzhIw2zYkixa8Ko?= =?utf-8?q?CZBRpYN6Ke2UwmENYQKdN6tdMg1hhoGlLPE9WcV8m3DdJcFNdQM3k49zUuYW2J709?= =?utf-8?q?yONAGPUTOrQZU346sX+lq23TKr9+8RrbA=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 435002cd-dd20-4889-a51c-08db03a883c4 X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jan 2023 16:30:50.5179 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +EBRRFHk8WNeLD7EX9G3ORC0aUiMrsMfkWl76R4d14ofGgR827uuV/wPS6SeEES9RzXCpVtpvnH4ylwkcqakmMbF+WUI/EnheYKGtrUmFwY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR13MB3897 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Huayu Chen This patch corrects two oversights relating to releasing resources and DCB initialisation. 1. If mapping of the dcbcfg_tbl area fails: an error should be propagated, allowing partial initialisation (probe) to be unwound. 2. Conversely, if where dcbcfg_tbl is successfully mapped: it should be unmapped in nfp_nic_dcb_clean() which is called via various error cleanup paths, and shutdown or removal of the PCIE device. Fixes: 9b7fe8046d74 ("nfp: add DCB IEEE support") Signed-off-by: Huayu Chen Reviewed-by: Niklas Söderlund Signed-off-by: Simon Horman Reviewed-by: Leon Romanovsky --- drivers/net/ethernet/netronome/nfp/nic/main.c | 8 ++++++-- drivers/net/ethernet/netronome/nfp/nic/main.h | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/nic/main.c b/drivers/net/ethernet/netronome/nfp/nic/main.c index f78c2447d45b..9dd5afe37f6e 100644 --- a/drivers/net/ethernet/netronome/nfp/nic/main.c +++ b/drivers/net/ethernet/netronome/nfp/nic/main.c @@ -32,9 +32,12 @@ static void nfp_nic_sriov_disable(struct nfp_app *app) static int nfp_nic_vnic_init(struct nfp_app *app, struct nfp_net *nn) { - nfp_nic_dcb_init(nn); + return nfp_nic_dcb_init(nn); +} - return 0; +static void nfp_nic_vnic_clean(struct nfp_app *app, struct nfp_net *nn) +{ + nfp_nic_dcb_clean(nn); } static int nfp_nic_vnic_alloc(struct nfp_app *app, struct nfp_net *nn, @@ -72,4 +75,5 @@ const struct nfp_app_type app_nic = { .sriov_disable = nfp_nic_sriov_disable, .vnic_init = nfp_nic_vnic_init, + .vnic_clean = nfp_nic_vnic_clean, }; diff --git a/drivers/net/ethernet/netronome/nfp/nic/main.h b/drivers/net/ethernet/netronome/nfp/nic/main.h index 7ba04451b8ba..094374df42b8 100644 --- a/drivers/net/ethernet/netronome/nfp/nic/main.h +++ b/drivers/net/ethernet/netronome/nfp/nic/main.h @@ -33,7 +33,7 @@ struct nfp_dcb { int nfp_nic_dcb_init(struct nfp_net *nn); void nfp_nic_dcb_clean(struct nfp_net *nn); #else -static inline int nfp_nic_dcb_init(struct nfp_net *nn) {return 0; } +static inline int nfp_nic_dcb_init(struct nfp_net *nn) { return 0; } static inline void nfp_nic_dcb_clean(struct nfp_net *nn) {} #endif