From patchwork Thu Sep 29 08:58:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 12993712 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 67724C04A95 for ; Thu, 29 Sep 2022 08:59:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234943AbiI2I7C (ORCPT ); Thu, 29 Sep 2022 04:59:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230341AbiI2I67 (ORCPT ); Thu, 29 Sep 2022 04:58:59 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on20712.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eaa::712]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E97C713EE95 for ; Thu, 29 Sep 2022 01:58:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N+kVh7vQlaoeCU4cpKAEIoH40teTe5H8DcKzb3UhLEMcSu2aqGDjCEFDhAbVOoFioeeFDdV7ixiqouCPudbsl6Y13RrhMNMZ/CTH/SIBfIptqjHx0bCtphymnWmv/nXOBmspW0G/k6wzgDUDCBaxcIR/T3DasBupELv/6TZ922XFF7OCW2iIjCecAkjP2ETdI07id4Ze8Mful0I7pMv2Z5CqC9DELcWDhYvc+gG+ZHZFeFCa9ten2XpNeGkZbs8hGkWMerxolxukTt3kq2Gsc7ysPo8f9LEwph6Lo67pNQLFWeAPdTWSwBQqylAkRWlGKWiwZ8+kF0wzTswoKwr8qw== 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=RSpw37fd8rsgeFOVNuYetaA/YdAGQkPN7VKrjboGTyc=; b=fK0ikgVHNUEt0obw5SnF3Gnwz/8FZAIE84T0aY1zcghcJF4Idb9cKE4StAH2awGRcv4N+QM4L1DlresYODmPlICXQPb14F6nm7aQ5xueyeCDs7gijUdzxUUHf347Dz2aGDVpKwOdfBnnJwrhjp8jaQB4jbi4aMgqDFNQq5wF8BE8+hWbNY0UDWlFfBHtJ4q6Pj+7q3PCVnZ5RQLfhdlAISXh0Iw1t7bm7/ivDnM6JLPDo/KT/CA4q9cFIUzl9PuRNYm44tG+2cm5kCpSyPSBCKE0a2M54TJ6PIB0VTm/AwB0BnCVkbKMuddl5cW4aEwxju7sv4p56PpcqgwniJhYCQ== 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=RSpw37fd8rsgeFOVNuYetaA/YdAGQkPN7VKrjboGTyc=; b=VCnPwalWpkmgTDRlUJo5T6YC4DWJ2AIjWA9s8lPnXns33PmTz3c+4pPiU9DcD9DhH0IZtNTtr1T8d3eF435sNDM+I2XCq4Ngr2Y65Tt9Gbz4omG9Zghq8IDFSx4JP6BLV4B3ndehEi5XgziqOlqdTWXYsB6CPIvT7JOPW18lIgU= 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 MN2PR13MB3854.namprd13.prod.outlook.com (2603:10b6:208:19e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.17; Thu, 29 Sep 2022 08:58:54 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::2cbf:e4b1:5bbf:3e54]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::2cbf:e4b1:5bbf:3e54%5]) with mapi id 15.20.5676.011; Thu, 29 Sep 2022 08:58:54 +0000 From: Simon Horman To: David Miller , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, oss-drivers@corigine.com, Yinjun Zhang , Fei Qin Subject: [PATCH net-next v2 1/5] nfp: add support for reporting active FEC mode Date: Thu, 29 Sep 2022 10:58:28 +0200 Message-Id: <20220929085832.622510-2-simon.horman@corigine.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220929085832.622510-1-simon.horman@corigine.com> References: <20220929085832.622510-1-simon.horman@corigine.com> X-ClientProxiedBy: AS4P190CA0036.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:5d1::7) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR13MB4842:EE_|MN2PR13MB3854:EE_ X-MS-Office365-Filtering-Correlation-Id: 6815c824-1538-4af0-6f13-08daa1f8d61c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8BCpcghipYDWqKagqYLN6L4NecIPHIwctEYsOzgqcnS6C65cB3ZVfRCesklbfct0dSpdWwFMYNI84DhCCwAGiTG5C78LsWfy8Bh16lYWusOZZJiswIwIGd3+KI6+JpUpcTq0OsFjmW6FmVQy/G9cHEjirZw/yW+m8N0aQDvl90PiZFfRD3QFnFxZIovCcVE9gI8IICDx/nD+owKBgn6YB2iVOYtY1zkvNm8BD+antm7hNnetxWZ7ZrvBw4nrhlkCTh7SWRlx99uuXNBCquiEo5E1byDoZeiwvzDwhqVtOOmXCe6yGxulx54sr4DCEwsjX7GVnCHTULUSlo/CDbGu2lfDoG5+pqObFTGVUz7j8xWwLWDZBDCUSOHoj6A/PvfBCjF+4DXIWbUNBbafMCagAbnxx1p1jpGnuUBwPH02ndj1utOkfR7s/hOKVrlJzK7g8UR0m39Ij9C1HfNUnnS8l0uWUFd0xS541WNMo+VirxnrYFlFEnrnPhWCZOA0JLDrEuyZ/bD6EQdIY/FYBoYOu+bx9sKFCmExNcLCLjb9stDpLdciTeNmtZ8hKeehKZKEjuNmK5mLW84bV6ah4plknWUaEBBetRSOq9JhJ03zM0exF7eYHTpU2xf83WKN3EyLRrkRfnO7XhOyOiBHLr3e0pEq3OG6w0lRGVvlZiVzQLySvch6NDO5M1gOkM4tJ88jsY8lEUrCPTAcuuMQvv2n2vzso6vUE6t7BRcc/27iAJwz80UFpfBQ5tJdaOtIgz8+ 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:(13230022)(4636009)(376002)(346002)(396003)(366004)(39840400004)(136003)(451199015)(8676002)(2616005)(1076003)(186003)(83380400001)(6512007)(86362001)(66946007)(4326008)(54906003)(5660300002)(66476007)(6666004)(107886003)(2906002)(36756003)(6506007)(38100700002)(66556008)(6486002)(44832011)(52116002)(41300700001)(478600001)(8936002)(316002)(110136005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rLj6dbX2SX6JyQuks/lM8Hb4RUTWbVf41O1gVGe3csps9tt6JTOPX4ds/PscpkdbY30jzgY6oCaehkT0W2iAZM+2qNYGXMMr32jGVqiNEoW2ByTF6Bzb2vZmXBcVu4IYtHV7uEWWBfeXVoDl1uYbj6zMupmZ+m7z+wQ1INSYAwmdIG+YgTgF0TFNHajiRNhCWxc8K9te7kAWWyVirmujqYIEpCLZ2eoCnnHTGj4T/YAn+An0IE33XOY41iOZJeidx7FVUYX4V0JWkVzA4x9/31gf2YY2etY4Z/nHWcwp0+dYhVslamZ23ZKxTbmF9kXhUvDNlpQeVnoZSsIy2P5kNO8R7k+XIViXxnzmufhimvBpIfhZ8IobFzG4LLgbTrOQ4cTWq7LdLhMcyrrbQxtZ6wAybiOz26SMOy0SNOHxws/s+hYtqQ7ma+URWav6Z3eASgGu0/PgO6LhYvVN2ZM9Af2/AZ1JwtVlvRAZtCubRL+74U/ni9BbIHHYzvXrIBD+W71guLWoPZ9DoNXCkFx9kmPsr16oI+6esjTpZ3rSGNQki8Biz+RlUlHex1Wq/OTUXLrKC04ESniA1IQsaAok8U1rsGAkMHhSLxlB+gA0PQ/roJt/TNYnMwWuTVpkNe4TIImqWI9XIi9GAxrVfv9zONclyqf6EgZfojgBiqeS79OuOdRjMlMUq2IykakeYxZsSyTF5KHBfhlJI9L4O4K+kWt15g+Y1kW9UStU/UFrdrbsOo9cC8XZK3puYujYP49+xLMK9gYogCfFhIFrH2sDxynnavxoc4PMfpbqp5jcTXPfhF1a2oM2LjLklk1TqmRBYc88hokogURMOpCh5Qe8hlNAQb/p7PpMBCBg7dTQq1vuMYvPp8SDcbuOGfzOnxY1BI73CcgOO4zub/4nGgQtyO77BqO2cTdeYk+1Qukc4GdCkS2YQ/U3y7OvxvbnDKqokE+htd6TiU9cVvreE5rFAe60iOwCBQ/cuCUbrRCPLyVwnyA6wFyHTRJfNPviBsKBUmymUl0vqa4jKQpEM3jScYWTUyZIaYLGpdhl5HFlO3u0fMWXOLsVNdCtR5kl/qZTGRli68fhFG9br/rgtIm3lkX2ZBOeR/IuEd7arap0W/knAudV2cs8o2+5m78Eoyi+kxIrUlr/IWb6mNbkxnNmrA+eiihjZ1FIi4TWET2f6Qj2Pb6P3Yb+fbhaNSYhizsl8TT8G0x4uT86JlIDme8DwT7fOI/psBzRYVByUl1vuN4/P/NaBBOPD8WFx2eV0jAzEWqvPkS435Knk0l/EL1x+rTaMwn48gJC4WZnnlAjVzRd5Y/AGib9j2H7YhvrUlIl3/eJXXFTTuUKtsBL4IY3aiiwlvboB2DvYXhJQeMT+NTn1++j1Jh7N7CY6IIVb6NpEFUMTH90ynn1zDT7NAx6iPcprZBhcAXPrMaKzu+QMqtu8fa+IKB1Wg7nLzFFqa6bfzOnhsAxoRUf0qGyeiknkiKL0MObq0myh1OHRDFQsjUme0jFsvXmrNqou8VVcZFAD2IJ0dohq+yYVF8USF+WUhQrR/jxn1yXs0fOppD71tqb9FKagd+amqwQtRKn8ijw5JPx8/htRpy1D5iz7v+AXmqHUXfRO7sB8Xwd+vhqjE+BU1qgmi0u0QG3aLPnc/siyxa4B4VNvFqTfx0CHjbypw== X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6815c824-1538-4af0-6f13-08daa1f8d61c X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2022 08:58:54.3588 (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: 6moADQcB2up117NZ4I+JX+0freNIU1dBLWnXq+gBaMffpeusD9NhImak79VkN7QxL7qprG8A87oBTSECuxkgo6gHaRyYDpKsrLezU0+mRx8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR13MB3854 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Yinjun Zhang The latest management firmware can now report the active FEC mode. Adapt driver accordingly so that user can get the active FEC mode by running command: # ethtool --show-fec Also correct use of `fec` field. Signed-off-by: Yinjun Zhang Signed-off-by: Simon Horman --- drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c | 2 +- drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h | 2 ++ drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c | 9 ++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c index db58532364b6..d50af23642a2 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c @@ -996,7 +996,7 @@ nfp_port_get_fecparam(struct net_device *netdev, return 0; param->fec = nfp_port_fec_nsp_to_ethtool(eth_port->fec_modes_supported); - param->active_fec = nfp_port_fec_nsp_to_ethtool(eth_port->fec); + param->active_fec = nfp_port_fec_nsp_to_ethtool(BIT(eth_port->act_fec)); return 0; } diff --git a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h index 77d66855be42..52465670a01e 100644 --- a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h +++ b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h @@ -132,6 +132,7 @@ enum nfp_eth_fec { * @ports.interface: interface (module) plugged in * @ports.media: media type of the @interface * @ports.fec: forward error correction mode + * @ports.act_fec: active forward error correction mode * @ports.aneg: auto negotiation mode * @ports.mac_addr: interface MAC address * @ports.label_port: port id @@ -162,6 +163,7 @@ struct nfp_eth_table { enum nfp_eth_media media; enum nfp_eth_fec fec; + enum nfp_eth_fec act_fec; enum nfp_eth_aneg aneg; u8 mac_addr[ETH_ALEN]; diff --git a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c index 4cc38799eabc..18ba7629cdc2 100644 --- a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c +++ b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c @@ -40,6 +40,7 @@ #define NSP_ETH_STATE_OVRD_CHNG BIT_ULL(22) #define NSP_ETH_STATE_ANEG GENMASK_ULL(25, 23) #define NSP_ETH_STATE_FEC GENMASK_ULL(27, 26) +#define NSP_ETH_STATE_ACT_FEC GENMASK_ULL(29, 28) #define NSP_ETH_CTRL_CONFIGURED BIT_ULL(0) #define NSP_ETH_CTRL_ENABLED BIT_ULL(1) @@ -170,7 +171,13 @@ nfp_eth_port_translate(struct nfp_nsp *nsp, const union eth_table_entry *src, if (dst->fec_modes_supported) dst->fec_modes_supported |= NFP_FEC_AUTO | NFP_FEC_DISABLED; - dst->fec = 1 << FIELD_GET(NSP_ETH_STATE_FEC, state); + dst->fec = FIELD_GET(NSP_ETH_STATE_FEC, state); + dst->act_fec = dst->fec; + + if (nfp_nsp_get_abi_ver_minor(nsp) < 33) + return; + + dst->act_fec = FIELD_GET(NSP_ETH_STATE_ACT_FEC, state); } static void From patchwork Thu Sep 29 08:58:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 12993713 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 161A9C07E9D for ; Thu, 29 Sep 2022 08:59:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235030AbiI2I7F (ORCPT ); Thu, 29 Sep 2022 04:59:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234841AbiI2I7B (ORCPT ); Thu, 29 Sep 2022 04:59:01 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on20712.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eaa::712]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFDF9DDD8F for ; Thu, 29 Sep 2022 01:58:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Oh2X7nVjV6IU1eO5sMQjijkBKfJIh+wZfEUBBc81S+GAODtFPGC+d1S0fyDTrMy2BgxXymPrI2auIfb66aVMuWE/I4vECBetlmHPtJVK/cxz8/lbHZlJ98QTRmM2EullROCvqj+B/zCtCHoPA07T4cU8Ha1qu/zN2LH8JjPy5POD6/G84ZbT2jGlYbjeEINBry7wuCfgk/difDbh4fyrhnLSinN0pCgnqTtBeE2bdk0YHxbnvwn7Ne63jVxfz6h4UccTV3bF4c0ixwDmcmD5E+cqDj9xt44X8kI/kFAuj7GRqlbxoXum3WQ0P4rT1uWCbjUjAttW4VAqnn3i+N5ZsA== 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=Fl92N4KaCggtMsUzbNIKw4hULs/CANoPYN0Uau9w9d8=; b=NgnXHlrERsg/uiOetAC9SflqlUS6WFJpW9sw14xnsq5C+7pET+dCW86qg/C7bw7lFl340zmnUFMAtnW4B1LxPBqdPfQyGgUlUYf5Jq8YSPtJ/98XOu/9p6P3GnsMCNo+uX4dfKcRcuP5SPrCzUc0OluPl6s1FLmblunO1P4LDK1KhhJoFQoMRB58vt/THbU33e+/pU7/uL/AdIgmZ8bRyAi6EhRwODiduc/+ypIZi1vAJwYh2r6MWeKdzteFVQXxnl3MtZ6KtP/VZ6a8QSkaGzVXZHu7D/uS4oiONTrWwRpMvVNeoUrHYsQ175Om5bybiNDmgLYquVPCToWBlzduwQ== 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=Fl92N4KaCggtMsUzbNIKw4hULs/CANoPYN0Uau9w9d8=; b=Tk4hCI9QKi2WYuhsNzLUeaAWWgCWsUooECXtXckMQORlglv5jNvlwkFUfbh47pV0G751ZJR3gU0Mu2z5pFmKGZtpBkYOgPeiooIcTQIzze0l1IrjIavImOAbpS8e3s4KXQGV0Gsy+cYQ5HXSg8ppxRf78nCO36Hxut7870eMOH4= 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 MN2PR13MB3854.namprd13.prod.outlook.com (2603:10b6:208:19e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.17; Thu, 29 Sep 2022 08:58:56 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::2cbf:e4b1:5bbf:3e54]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::2cbf:e4b1:5bbf:3e54%5]) with mapi id 15.20.5676.011; Thu, 29 Sep 2022 08:58:56 +0000 From: Simon Horman To: David Miller , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, oss-drivers@corigine.com, Yinjun Zhang , Fei Qin Subject: [PATCH net-next v2 2/5] nfp: avoid halt of driver init process when non-fatal error happens Date: Thu, 29 Sep 2022 10:58:29 +0200 Message-Id: <20220929085832.622510-3-simon.horman@corigine.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220929085832.622510-1-simon.horman@corigine.com> References: <20220929085832.622510-1-simon.horman@corigine.com> X-ClientProxiedBy: AS4P190CA0036.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:5d1::7) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR13MB4842:EE_|MN2PR13MB3854:EE_ X-MS-Office365-Filtering-Correlation-Id: 76c4b18d-7af7-41b5-2fe3-08daa1f8d70d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +/CguTtKbtYShS3Tt+fWBsT7YxMtJ795qZeWYAOQxQatX1e4kgdSJ1mVK4bvqxJP8SHaui1oPoEQNn58z+PYC0FcXGbf6PLWIXzbL8HyI+YJiy2iwIKXB+bDXgTfQ5F9StyzHp5jN91HikcQQGvjy5vPx3xrWKIlnqiCdFdc2Ywuw9+5QHl6/Z+Lj47UdARTE+mtRZEUbmvpIgUkBieDOWajL1KsCgk8/Rt9mk+Fc/waut/d+9fGnZuinfRwFZluGFyZ2VBb6T9Vl7yH4w648Flr/iYyWE7NgvbyiVl4t9f76Zpb5/OOIjEwfIuMhy0UPY8+ecYXFOdcfIMu8iNSEESygok9M70davB9ZDMm2/E38WxFPvA/kuQhiBP+zMtxM4b0QSmgMouND5NJK/4UrQxn5r8WHqzZIxQDZSFwKJ6MGX+JnD8pn49WaOFbEqzL4tPzOFmolSCmySlCARJCkyKkNdaf3XunVdIlSf0PHItAwrnFWgmw9Unh3m9AJqEMpbuQ7jBJrSC0UBzOSGAbSuhvC6MXhtvYLiUaQcaP/XVcQPV+IP4VNbqFZOg2nexxzWuNpBVvCKVY8nMk++qCEqj/aWseVheCWf2caHxBaDNVMllgBk2XQ6JLV0pTPGScyxoFucV8trJAkYsORugokG7b8DnHa/k7QUnJ7M6J+CgVEDtICMI+PlaPsIgQIyHo3fYNR0D90gQmrmYEUE099uzeXK8Fj6C1qBzwcTNcJIL1pPk8ARKEQ6mV9nc6lb3U 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:(13230022)(4636009)(376002)(346002)(396003)(366004)(39840400004)(136003)(451199015)(8676002)(2616005)(1076003)(186003)(83380400001)(6512007)(86362001)(66946007)(4326008)(54906003)(5660300002)(66476007)(6666004)(107886003)(2906002)(36756003)(6506007)(38100700002)(66556008)(6486002)(44832011)(52116002)(41300700001)(478600001)(8936002)(316002)(110136005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hHLgWLozo5+ODzeHzrzQcdHJuRhkKTOOj94S/inibmClDGXfvq1fwXkAicPSGXz3fTiqbpGEG/qPzg7n8TfFQRaEOPsUOAnoegSQ0VHFP1sdpGuA+o5/pJeYgd/bvGnDulOLy8UUUBZlTaqZ187MyRLiLGOFyHyYjVilLXxuJ4kJz0/Nv5NqgFQJEqAI0ElCXLizrBVYUhrWTEYbf/bs+fA2yJF1IItDY9F85qpMm4vWI+mzZJdMsDimwruBi2B4q0IyEia3J0E3GK+an5vM833HdHL+pm2gD0D9sm9qT+xf/bmQlPscCrXZoPao6GeP8nypC8LFVgWu+QvPNY4dfpI/eMqvDcWOQblRsYy7rKWF84XKyF2qXnA+lwtwah89hh/sxSdHWbxgG5iDx7N2SVCcWZ4D3ZglnqvG7ROEq/herw08CjeOhWy2QGfImx52YkchdxxqH34BjCCoY/V2A0np2IWpTn6BTDqfUFkiqE5YzRcbinfRADw1VMr+oUmxKNaytQRFIKHF74lzyQ9ZP64trjIPFiBCSIKviGm8JY5fwRoID8MQOisG6Dki5tBLwwlWj6U0ECiU6K03sZ1lGThRB47OPN+xkgr2dGTgSZepjpOiT9dd/Cg2kxgMZj+5b9Q9t5/QlKmsxydRcP9cTIsQfjmVAFBvxmIc+R0aotm0VUzQ4BVNBnN52+KWplkFPhP49pI/UaYBr4umZwMtBXPySflCBgTZdeng5u8be+FgLc4YhfvA7207aglquf7TPSSgqJ4605jgZw7PDtghLd6q55aqv3OLTL+z5LwvRmPeSoIK6gpfw/0UzeRo+0iAl6H1Jre8mJoI3Rl3MbPe+YZKsyJlznnGknV9A9yw3IjcUmlr86i89Ua1lJ+QOP06YFyYrtOobxF9ptG730bzVjPK2bOrx+gA87GAAD6PTHWaEaAXUn1ABP/1oj4NAkcdDOF2c/LaIknbEkGG6QUGevowVfxiu7rF+MdKXgTaLB8aMDkHlvhpKJYw4zJ90zPu9aDpyUo/Mzd6Qmrcseoy2IHtclRucFL+6mlMFYfwfICET69Yg9yXie118THdmufUNQT1Op23kTMOXKTU9WfhDrje5OrIX8f8mEiJCTA0BgEBd80+KK290n34krdHt5QS8QsMTG6O2L7MbQ26mkny5HEVb9GeHROCNASkwWao8y8r4aka7wtbib9pgFxUNnMAfGkqqaK6kxADb/xlvF6scZtB7izxzp19m3/M57PZ9/rlRaJrrfG+sePyPeSMSwqTBhjRF8e7WJnEIi4Ox26t+Yo9McfZJOdyd0NFOOrcpKTx4p+dG+AmZCeztcext0EmwP5wmTy8Y/dZ8jKYwJ50VUvBztVH1nxXG/ftywzwIkCJPGOjJYl9CwSfZ/PkqFTYshTjPakInjJIV+uecc1VZOIJ0Vsd76QXPiACcV4xjpWX2TWxin9AGTIysMg0wVLP+TBQ++5vFC8qaVTDWbJLYyTmeResvGXsCTK3lPpGRFXfGECuPaJUZ2yZ7uLAlnIarYa3zicT1FVh19/5lNIvqKqvB8O7EO18SgiaGhxkEfvNxok9H5+r+ToiaLu1XbTORSmTHNOb0Xa9dmHje6lxmCv6X4Qr5aa8vq0vJP2CCbJWP6ItR8nBcSUy7i8GwObQTuaZOujDBoLWb97oeW7reg== X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 76c4b18d-7af7-41b5-2fe3-08daa1f8d70d X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2022 08:58:56.1094 (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: C3gn58cZaVKqM3nRvULgfE9Sq25Bgc1F7ROYid0kG3uVQC8NSHw/+eAWQfpxleK0cTe6iRCwWVQuNSOlkOOoJph0sseWpN2yyCtpeWa/bDI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR13MB3854 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Yinjun Zhang It's not a fatal error when setting `hwinfo` into management firmware fails, no need to halt the whole driver initialization process. Signed-off-by: Yinjun Zhang Signed-off-by: Simon Horman --- drivers/net/ethernet/netronome/nfp/nfp_net_main.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c index e2d4c487e8de..f3852ba8099a 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c @@ -315,18 +315,17 @@ static int nfp_net_pf_cfg_nsp(struct nfp_pf *pf, bool sp_indiff) int err; nsp = nfp_nsp_open(pf->cpp); - if (IS_ERR(nsp)) { - err = PTR_ERR(nsp); - return err; - } + if (IS_ERR(nsp)) + return PTR_ERR(nsp); snprintf(hwinfo, sizeof(hwinfo), "sp_indiff=%d", sp_indiff); err = nfp_nsp_hwinfo_set(nsp, hwinfo, sizeof(hwinfo)); + /* Not a fatal error, no need to return error to stop driver from loading */ if (err) nfp_warn(pf->cpp, "HWinfo(sp_indiff=%d) set failed: %d\n", sp_indiff, err); nfp_nsp_close(nsp); - return err; + return 0; } static int nfp_net_pf_init_nsp(struct nfp_pf *pf) From patchwork Thu Sep 29 08:58:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 12993715 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 1CBCBC07E9D for ; Thu, 29 Sep 2022 08:59:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234961AbiI2I7S (ORCPT ); Thu, 29 Sep 2022 04:59:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234999AbiI2I7G (ORCPT ); Thu, 29 Sep 2022 04:59:06 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2117.outbound.protection.outlook.com [40.107.223.117]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20285139412 for ; Thu, 29 Sep 2022 01:59:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Nhgc7Msdwmx632gLaiqjtboPTL79xxeAWp3BtItiZu5Ifmg48+XWl9/hbN979P7KbwCXxREqkKa0OfpfDB3LG4XCaQVZiMlQYojHWSLLxcJatcrlZjpoctirc9W44yFkOGi5CfOZDA1QrCL1+JzxGDj6POmw2rLdf5VpPhzzkE4gt1jq9BbPEnKi16MO/XG/91fjpOSU8VU5yQ8Tje+SXT6kCjBJtWE5l2j2aTfJQVSf3wBTd13Q/gl9VMNC1JjC6LUiRMLJGmBDWfphYN6g9EAhTTpfA+QkQNEQppJ6khTzdLOZd3Y9yRTLDf6IHsB8ri5ZE6+CWoPManCKAX8NrA== 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=CPtGEevOg5TRtFqRfqds3SO1WWWczzqbyGmoybeBxgE=; b=gIX3UHsXn8QVaWUtX7Xiz6O4cvr69MvMdgYr4FldxgB1Mv7rpKxwXljXpo2qjUAHlAjoYqG9quJxLQ0l8O02JmxCIQ+iyX6SumXzAg/lbq9/Z8GKFRlUiUIEaKl27wOGEk8UVBZnpeN/yFs2a9GoKtivUNEW8dpwvN3yy1ncPe9WNZbxDMkXQEswxXjEHlLVnvoTD0s6B9KPXg5K7zkHfM+RHuKLERJkeUOMkHP0AyawxD1kZnX/ANwxJRY1FlmlbtmtfK4GNqQq1HCut4QHjOhnIHjCblNHCkNLFgH7x9SEzXHl7gVSXJUsgJLZ889GhAocuyxkm5CcV2UjZ7DM6Q== 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=CPtGEevOg5TRtFqRfqds3SO1WWWczzqbyGmoybeBxgE=; b=GBzm4FFm3+/cpxDAjq6zd7EkCW4Zjtg0oN1/HldzFsVE+bg719ludjWPiwU7phUA5pFkc0xdc6G6h5/Otf7vzNcArFzA/VJ266flGAIusQvO/IpZ8Ocuh08fXxuYu+e+i9oOlwPPVLJpMLyGEuOec3yBiNmT0sAkD8KLEgCjmCg= 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 MN2PR13MB3854.namprd13.prod.outlook.com (2603:10b6:208:19e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.17; Thu, 29 Sep 2022 08:58:57 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::2cbf:e4b1:5bbf:3e54]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::2cbf:e4b1:5bbf:3e54%5]) with mapi id 15.20.5676.011; Thu, 29 Sep 2022 08:58:57 +0000 From: Simon Horman To: David Miller , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, oss-drivers@corigine.com, Yinjun Zhang , Fei Qin Subject: [PATCH net-next v2 3/5] nfp: refine the ABI of getting `sp_indiff` info Date: Thu, 29 Sep 2022 10:58:30 +0200 Message-Id: <20220929085832.622510-4-simon.horman@corigine.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220929085832.622510-1-simon.horman@corigine.com> References: <20220929085832.622510-1-simon.horman@corigine.com> X-ClientProxiedBy: AS4P190CA0036.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:5d1::7) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR13MB4842:EE_|MN2PR13MB3854:EE_ X-MS-Office365-Filtering-Correlation-Id: a4ae2270-0380-405a-8681-08daa1f8d81a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ne7FTCJvnaGX05FEd9mbtSXK07y5t/2c9iJicVuv8HNi0a0BCX8g5b4z7eP/g4Wh6yNe+qMICiwf3UWtunE775GM0LQQQ6NmnVJ4IVw1WC8FgTxZRONrb01dSk9Wwkg9qO3RrLID1PM7X/z8bBoC52ny+v0fLJojkZ6pSMNWtQBOHibDkxTP/NeKFnXC84Gb1oF4rNwvlU6cfu96iqMwQn5IKf8kBRWJr+C0nXz1I0wkgWqlcGrkmzY2Nq8/82VXbQMVqXRNaWRA4zoav+t/svc50uKvzpZ9GwkBJozGBLLRs59no59p6MFvnwG36+wygc0dZkq8gqe6DObVAqrRFr1TTJdATsibDWjQsRKFLZuJZ376p30q/eRT0OwcXC3PuTfP2PMD0pHM6etoxCv2znEA5ZVGS8DHO42yG8sfjZP1SKIbIyk44GoFvfrBxC6mJ1B6qesZjK0U2mU6jxQgG3v7MaIY0US62QkThUy2E09jYs9R4u2/7sr36aDVS4R2GzYePK6XquZJJWoN68VZJN5hiJjEPgvSOKVx+Q/VyXPw4eEbj8DERiqSV7NgKjOvJTmMy0VS1BDthNqmdjJBl98F0cHCJ3GHy98msi2vztpR2BDrizBBOZpnwGTkeXQhj+L1f04kxev5haDtGwdkHtxXQA/W1hoCpbcXmB7W/VYIxts15FvQ8O4TKMKFXv1T7xfz4eoycnYv7ne/7iVz7aLM5PNSvwD80qwAnMrOPABUAgBPrLSosD3u4MYlGB2qXhtGebgZEEbBQMhFkiUyhSqp57oLlPKVt0tsyEo7AUAAcOESO0jY0uCWt1HYvMhY 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:(13230022)(4636009)(376002)(346002)(396003)(366004)(39840400004)(136003)(451199015)(8676002)(2616005)(1076003)(186003)(83380400001)(6512007)(86362001)(66946007)(4326008)(54906003)(5660300002)(66476007)(6666004)(107886003)(2906002)(36756003)(6506007)(38100700002)(66556008)(6486002)(44832011)(52116002)(41300700001)(478600001)(8936002)(316002)(110136005)(81973001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Wu+fMbASAFEVHKkDs+nUlvPExDQceaX4+LYn5BHnB/zP1Pxjj3krQipxjVAK8mOatIjvvHlbcAwpJ7HW1t8PqIcbXrNMCfU44pgEPbNWT1Eo3VL1AoXvOGJ685tl3EK8qAW3+7q/F1icim2GJoU6POAPE5xLJteK531IJItKLstxO5/RROX6OUqtWCT4+2tdowGc8JSvHU+hCH+UJvRZq/uAFi3PKGlIqp0xcn2d/d0IGwLagO1hZyjIKFZfobmOEHCfFo77+XN+SZu+/okmsZoC/xXVbLp0fj2LzfXj3COI/TfP+3NE1abK14BMht5LzJYa2j3doQwE0l+DPXOqJkubZmwwk6dlUv31S+pZDaDaxwfPSulD4OhndXJbNpHhtOtt8DqG3fWrFSs9zpbv4ZdCKexJLxkzOzrlklwNOOIgTz/Il87F4nc5NfM7NVS5AVEvPHZHnHIuLlAn1Mk9bDkTI5IQvWe5iLohC3ojvBdVYtVsJwqyu98N758gZQCw90q5lE1d6JCunOtyJgzAwhHeNziCeC2HkjTRWap2pHXWULUwq4Fn7dpf2mmUEEf/qOp0tCgm38om14x8vNgObko4jqyh84/kIECqRmXWDIwV7K4BKcSqYwVguhyGPVsXIQMNHhJOe1YXugvdKr7MwNHuXehQtFFp6uweDqDnhsdK1r5FqdrOKmBr9JUq/vOtvOpVrKdb7/1WxYV7L1YMaQkA0/UiZXWzZUCkSec62QY/z5xHNoYfoPwojvRlNDfREf+E2qWxp3QHHEEaFjpf2KsY3/5x5VVRL8Sw+4b6xxMN4NaptYSeqOaHRtfvSBbXf4OcG49IIBgF5MWsEd58lB1ayBunPm647ArmQruxPm8qVazyj5csCW2rCO90gzEMQcV6oIDUOxQCxoP8NqtXdaZ+KdF4/sbiio7yrk9ZXWR9vp5t+Kl1DS7G9nh9jDWRKFs70Rt6BV+c14drw5GtVkotEYhlnVx0SR6owx1URsmeQ9SfbSp/5nGjMXKC/kBJqjAY7koKwroYWltKuuccyu5eRw8NmpvLssTwGuPVz/sbzVrHt9mYLQXE3cy2/i174GJo/XuIv3NcEDv2M34+EQY37mhE6vOcX+1B0WlZJeIXp3hmpVoSTBlTNu3UbamLtDErlF0LCF5ylNLYfBRcpyTJRswv6FFiPRvSnzNBJyagOthuM17otZr2qHryNhKFk7JevS4Zo84lxEZz9epwWCOc5wDTpLHwUrtLIHdNhUvId09D3ooCQ6/FybxpHdMoqdNRDQnF+UmYRI0StIlZ0Tpj58D9lUki6qlsgx4+NbFf/nhXVwn+ujE4XZ2b5UVUqRptyPZI0SBZamUGxR5iYDX0kvSYhgkcEXqGDPSSF0rHQzMnWNRgf6JBnEr/OwXvsfECNzkhS3RcirXwVl3V9jwkY3BVigdqSmh/pLFCY6MrRW9OpGl4mQ/eXIqWYL1mPcIruNrPGk+TaS+WxK50VusyUinbuBrfcHuA8NP5hByxA57lX/dyMyDlghHJLsJ4uxqGfjsiTXZ3K34VuuDT5x96rtnset6I2EQi80neDGbvmeACDyYIInM651i0pff1YSdGWIiyBDOiZwUbBuyw766kf9MrcomF3CPLDSuQ4uEN3VhVhg6q5LfJuIeno7NasRm1PC+VFQy4taOM+VV42A== X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: a4ae2270-0380-405a-8681-08daa1f8d81a X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2022 08:58:57.7174 (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: Qd4QGXR/hhLbxy8YhXxHKvTj8Nd5lJSEDWu3fJDSvY0KTAeNnPYyyb/6in3PnbN4/7xoQkyNR7EQlhUvM6ZLJ5BjYmBtUuFExcWfuaf0XEo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR13MB3854 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Yinjun Zhang Considering that whether application firmware is indifferent to port speed is a firmware property instead of port property, now use a new rtsym to get the property instead of parsing per-port tlv caps. With this change, relevant code is moved to `nfp_main` layer. Signed-off-by: Yinjun Zhang Signed-off-by: Simon Horman --- drivers/net/ethernet/netronome/nfp/nfp_main.c | 67 ++++++++++++++++++- drivers/net/ethernet/netronome/nfp/nfp_main.h | 3 +- .../net/ethernet/netronome/nfp/nfp_net_ctrl.c | 8 --- .../net/ethernet/netronome/nfp/nfp_net_ctrl.h | 10 +-- .../net/ethernet/netronome/nfp/nfp_net_main.c | 48 +------------ 5 files changed, 71 insertions(+), 65 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/nfp_main.c b/drivers/net/ethernet/netronome/nfp/nfp_main.c index 873429f7a6da..91063f19c97d 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_main.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_main.c @@ -691,6 +691,64 @@ static int nfp_pf_find_rtsyms(struct nfp_pf *pf) return 0; } +int nfp_net_pf_get_app_id(struct nfp_pf *pf) +{ + return nfp_pf_rtsym_read_optional(pf, "_pf%u_net_app_id", + NFP_APP_CORE_NIC); +} + +static u64 nfp_net_pf_get_app_cap(struct nfp_pf *pf) +{ + char name[32]; + int err = 0; + u64 val; + + snprintf(name, sizeof(name), "_pf%u_net_app_cap", nfp_cppcore_pcie_unit(pf->cpp)); + + val = nfp_rtsym_read_le(pf->rtbl, name, &err); + if (err) { + if (err != -ENOENT) + nfp_err(pf->cpp, "Unable to read symbol %s\n", name); + + return 0; + } + + return val; +} + +static int nfp_pf_cfg_hwinfo(struct nfp_pf *pf, bool sp_indiff) +{ + struct nfp_nsp *nsp; + char hwinfo[32]; + int err; + + nsp = nfp_nsp_open(pf->cpp); + if (IS_ERR(nsp)) + return PTR_ERR(nsp); + + snprintf(hwinfo, sizeof(hwinfo), "sp_indiff=%d", sp_indiff); + err = nfp_nsp_hwinfo_set(nsp, hwinfo, sizeof(hwinfo)); + /* Not a fatal error, no need to return error to stop driver from loading */ + if (err) + nfp_warn(pf->cpp, "HWinfo(sp_indiff=%d) set failed: %d\n", sp_indiff, err); + + nfp_nsp_close(nsp); + return 0; +} + +static int nfp_pf_nsp_cfg(struct nfp_pf *pf) +{ + bool sp_indiff = (nfp_net_pf_get_app_id(pf) == NFP_APP_FLOWER_NIC) || + (nfp_net_pf_get_app_cap(pf) & NFP_NET_APP_CAP_SP_INDIFF); + + return nfp_pf_cfg_hwinfo(pf, sp_indiff); +} + +static void nfp_pf_nsp_clean(struct nfp_pf *pf) +{ + nfp_pf_cfg_hwinfo(pf, false); +} + static int nfp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) { @@ -791,10 +849,14 @@ static int nfp_pci_probe(struct pci_dev *pdev, goto err_fw_unload; } - err = nfp_net_pci_probe(pf); + err = nfp_pf_nsp_cfg(pf); if (err) goto err_fw_unload; + err = nfp_net_pci_probe(pf); + if (err) + goto err_nsp_clean; + err = nfp_hwmon_register(pf); if (err) { dev_err(&pdev->dev, "Failed to register hwmon info\n"); @@ -805,6 +867,8 @@ static int nfp_pci_probe(struct pci_dev *pdev, err_net_remove: nfp_net_pci_remove(pf); +err_nsp_clean: + nfp_pf_nsp_clean(pf); err_fw_unload: kfree(pf->rtbl); nfp_mip_close(pf->mip); @@ -844,6 +908,7 @@ static void __nfp_pci_shutdown(struct pci_dev *pdev, bool unload_fw) nfp_net_pci_remove(pf); + nfp_pf_nsp_clean(pf); vfree(pf->dumpspec); kfree(pf->rtbl); nfp_mip_close(pf->mip); diff --git a/drivers/net/ethernet/netronome/nfp/nfp_main.h b/drivers/net/ethernet/netronome/nfp/nfp_main.h index 6805af186f1b..afd3edfa2428 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_main.h +++ b/drivers/net/ethernet/netronome/nfp/nfp_main.h @@ -65,7 +65,6 @@ struct nfp_dumpspec { * @num_vfs: Number of SR-IOV VFs enabled * @fw_loaded: Is the firmware loaded? * @unload_fw_on_remove:Do we need to unload firmware on driver removal? - * @sp_indiff: Is the firmware indifferent to physical port speed? * @ctrl_vnic: Pointer to the control vNIC if available * @mip: MIP handle * @rtbl: RTsym table @@ -115,7 +114,6 @@ struct nfp_pf { bool fw_loaded; bool unload_fw_on_remove; - bool sp_indiff; struct nfp_net *ctrl_vnic; @@ -163,6 +161,7 @@ bool nfp_ctrl_tx(struct nfp_net *nn, struct sk_buff *skb); int nfp_pf_rtsym_read_optional(struct nfp_pf *pf, const char *format, unsigned int default_val); +int nfp_net_pf_get_app_id(struct nfp_pf *pf); u8 __iomem * nfp_pf_map_rtsym(struct nfp_pf *pf, const char *name, const char *sym_fmt, unsigned int min_size, struct nfp_cpp_area **area); diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_ctrl.c b/drivers/net/ethernet/netronome/nfp/nfp_net_ctrl.c index d81bd8697047..c3a763134e79 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_ctrl.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_ctrl.c @@ -148,14 +148,6 @@ int nfp_net_tlv_caps_parse(struct device *dev, u8 __iomem *ctrl_mem, true)) return -EINVAL; break; - case NFP_NET_CFG_TLV_TYPE_SP_INDIFF: - if (length) { - dev_err(dev, "Unexpected len of SP_INDIFF TLV:%u\n", length); - return -EINVAL; - } - - caps->sp_indiff = true; - break; default: if (!FIELD_GET(NFP_NET_CFG_TLV_HEADER_REQUIRED, hdr)) break; diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_ctrl.h b/drivers/net/ethernet/netronome/nfp/nfp_net_ctrl.h index 1d53f721a1c8..6714d5e8fdab 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_ctrl.h +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_ctrl.h @@ -14,6 +14,9 @@ #include +/* 64-bit per app capabilities */ +#define NFP_NET_APP_CAP_SP_INDIFF BIT_ULL(0) /* indifferent to port speed */ + /* Configuration BAR size. * * The configuration BAR is 8K in size, but due to @@ -492,10 +495,6 @@ * %NFP_NET_CFG_TLV_TYPE_CRYPTO_OPS_RX_SCAN: * Same as %NFP_NET_CFG_TLV_TYPE_CRYPTO_OPS, but crypto TLS does stream scan * RX sync, rather than kernel-assisted sync. - * - * %NFP_NET_CFG_TLV_TYPE_SP_INDIFF: - * Empty, indicate the firmware is indifferent to port speed. Then no need to - * reload driver and firmware when port speed is changed. */ #define NFP_NET_CFG_TLV_TYPE_UNKNOWN 0 #define NFP_NET_CFG_TLV_TYPE_RESERVED 1 @@ -509,7 +508,6 @@ #define NFP_NET_CFG_TLV_TYPE_CRYPTO_OPS 11 /* see crypto/fw.h */ #define NFP_NET_CFG_TLV_TYPE_VNIC_STATS 12 #define NFP_NET_CFG_TLV_TYPE_CRYPTO_OPS_RX_SCAN 13 -#define NFP_NET_CFG_TLV_TYPE_SP_INDIFF 14 struct device; @@ -524,7 +522,6 @@ struct device; * @vnic_stats_off: offset of vNIC stats area * @vnic_stats_cnt: number of vNIC stats * @tls_resync_ss: TLS resync will be performed via stream scan - * @sp_indiff: Firmware is indifferent to port speed */ struct nfp_net_tlv_caps { u32 me_freq_mhz; @@ -537,7 +534,6 @@ struct nfp_net_tlv_caps { unsigned int vnic_stats_off; unsigned int vnic_stats_cnt; unsigned int tls_resync_ss:1; - unsigned int sp_indiff:1; }; int nfp_net_tlv_caps_parse(struct device *dev, u8 __iomem *ctrl_mem, diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c index f3852ba8099a..3bae92dc899e 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c @@ -77,12 +77,6 @@ static int nfp_net_pf_get_num_ports(struct nfp_pf *pf) return nfp_pf_rtsym_read_optional(pf, "nfd_cfg_pf%u_num_ports", 1); } -static int nfp_net_pf_get_app_id(struct nfp_pf *pf) -{ - return nfp_pf_rtsym_read_optional(pf, "_pf%u_net_app_id", - NFP_APP_CORE_NIC); -} - static void nfp_net_pf_free_vnic(struct nfp_pf *pf, struct nfp_net *nn) { if (nfp_net_is_data_vnic(nn)) @@ -206,7 +200,6 @@ nfp_net_pf_alloc_vnics(struct nfp_pf *pf, void __iomem *ctrl_bar, nn->port->link_cb = nfp_net_refresh_port_table; ctrl_bar += NFP_PF_CSR_SLICE_SIZE; - pf->sp_indiff |= nn->tlv_caps.sp_indiff; /* Kill the vNIC if app init marked it as invalid */ if (nn->port && nn->port->type == NFP_PORT_INVALID) @@ -308,36 +301,6 @@ static int nfp_net_pf_init_vnics(struct nfp_pf *pf) return err; } -static int nfp_net_pf_cfg_nsp(struct nfp_pf *pf, bool sp_indiff) -{ - struct nfp_nsp *nsp; - char hwinfo[32]; - int err; - - nsp = nfp_nsp_open(pf->cpp); - if (IS_ERR(nsp)) - return PTR_ERR(nsp); - - snprintf(hwinfo, sizeof(hwinfo), "sp_indiff=%d", sp_indiff); - err = nfp_nsp_hwinfo_set(nsp, hwinfo, sizeof(hwinfo)); - /* Not a fatal error, no need to return error to stop driver from loading */ - if (err) - nfp_warn(pf->cpp, "HWinfo(sp_indiff=%d) set failed: %d\n", sp_indiff, err); - - nfp_nsp_close(nsp); - return 0; -} - -static int nfp_net_pf_init_nsp(struct nfp_pf *pf) -{ - return nfp_net_pf_cfg_nsp(pf, pf->sp_indiff); -} - -static void nfp_net_pf_clean_nsp(struct nfp_pf *pf) -{ - (void)nfp_net_pf_cfg_nsp(pf, false); -} - static int nfp_net_pf_app_init(struct nfp_pf *pf, u8 __iomem *qc_bar, unsigned int stride) { @@ -349,8 +312,6 @@ nfp_net_pf_app_init(struct nfp_pf *pf, u8 __iomem *qc_bar, unsigned int stride) if (IS_ERR(pf->app)) return PTR_ERR(pf->app); - pf->sp_indiff |= pf->app->type->id == NFP_APP_FLOWER_NIC; - devl_lock(devlink); err = nfp_app_init(pf->app); devl_unlock(devlink); @@ -813,13 +774,9 @@ int nfp_net_pci_probe(struct nfp_pf *pf) if (err) goto err_clean_ddir; - err = nfp_net_pf_init_nsp(pf); - if (err) - goto err_free_vnics; - err = nfp_net_pf_alloc_irqs(pf); if (err) - goto err_clean_nsp; + goto err_free_vnics; err = nfp_net_pf_app_start(pf); if (err) @@ -838,8 +795,6 @@ int nfp_net_pci_probe(struct nfp_pf *pf) nfp_net_pf_app_stop(pf); err_free_irqs: nfp_net_pf_free_irqs(pf); -err_clean_nsp: - nfp_net_pf_clean_nsp(pf); err_free_vnics: nfp_net_pf_free_vnics(pf); err_clean_ddir: @@ -870,7 +825,6 @@ void nfp_net_pci_remove(struct nfp_pf *pf) nfp_net_pf_free_vnic(pf, nn); } - nfp_net_pf_clean_nsp(pf); nfp_net_pf_app_stop(pf); /* stop app first, to avoid double free of ctrl vNIC's ddir */ nfp_net_debugfs_dir_clean(&pf->ddir); From patchwork Thu Sep 29 08:58:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 12993714 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 7B771C04A95 for ; Thu, 29 Sep 2022 08:59:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235505AbiI2I7R (ORCPT ); Thu, 29 Sep 2022 04:59:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232396AbiI2I7D (ORCPT ); Thu, 29 Sep 2022 04:59:03 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2117.outbound.protection.outlook.com [40.107.223.117]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6377C13EAF4 for ; Thu, 29 Sep 2022 01:59:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NlmtalSLSAG2i1A0/mDLIeH2B9SKvCK2SQSEaOKFNCu5ju34YXB3Fp9zg5BAJpBExoXip/uhNO23vM07oPodbKyhU1JTdREwG9tZCKt0T1KiZZfSrh7RUVH8OaxoNJm6Ceb0SvAfEjUeAvw/KkZEcqYZ4cLzeuXpR9+VEFCje8d3WnLKwbVgbm7ax0M/L/Z/+5W8L/XzIau79OtlXW8Y3IQPXmQNXQOX7scXIh+ZoIq3ZbqvLA5SCQO+flsBiYQQHWgYfsz93Ft2bHGTpYOqe32nJ8CGs2kncDopIQu1VxXFvGO15Vr0+6pTIXah2XEoKfmeeuUR2Fl7lKLLOsguhg== 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=clhz0dJs2A9w8BZrPYGZ6A9jedoEeB893xPGevx0jX0=; b=DTRUSm0Wc0EuE+YTOCJhd83sL1hIeUhm126sNI6eE0JgNhCIzwLJPn75beX12sgyspaXVUqBeecWrL69g8io4/+awIO31DwTJ0VjejI0Fj3v3d80Tz9bp7kU+lVJrZo+2slfmKaJ9HJqdUpyjX0JLrQmgL9PNc5RauYr82P8kLrWa62MhnzBRUw6vWtETAg4oUOfiIlus9yc5WltP37j6STxUYHBCbUUuwwbKIYyU2C2zHcL+4sWKaevZD5PJDBRzw23qTVU016e6qXbDjT22/cmpFYzFfWGNT0WYI875wwxXBQ2Yba64OpSCa60+U0pOpkn8AQPw4Jabl9jai1xGA== 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=clhz0dJs2A9w8BZrPYGZ6A9jedoEeB893xPGevx0jX0=; b=ez3ikjSue8iXaWp3cWCtWG0fZSRWXkGxRDsyKan3J9jO988zpzYbJyqj3nj/6axmNTyEEnAQlsu6BzXpkQRfgM686BBz7DFD0fEudu8MYgiHzI0Nk2tAOi9vAWswRFdKlBa6XxD0Th/VjmLD5O4ki9gZLl+jHPDB/fijwo/mvU8= 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 MN2PR13MB3854.namprd13.prod.outlook.com (2603:10b6:208:19e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.17; Thu, 29 Sep 2022 08:58:59 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::2cbf:e4b1:5bbf:3e54]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::2cbf:e4b1:5bbf:3e54%5]) with mapi id 15.20.5676.011; Thu, 29 Sep 2022 08:58:59 +0000 From: Simon Horman To: David Miller , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, oss-drivers@corigine.com, Yinjun Zhang , Fei Qin Subject: [PATCH net-next v2 4/5] nfp: add support for link auto negotiation Date: Thu, 29 Sep 2022 10:58:31 +0200 Message-Id: <20220929085832.622510-5-simon.horman@corigine.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220929085832.622510-1-simon.horman@corigine.com> References: <20220929085832.622510-1-simon.horman@corigine.com> X-ClientProxiedBy: AS4P190CA0036.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:5d1::7) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR13MB4842:EE_|MN2PR13MB3854:EE_ X-MS-Office365-Filtering-Correlation-Id: c4be5d6a-ec7c-4e97-1598-08daa1f8d928 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /WC3KyEN1Re/lqXZ4JzoPgsYOrt+wm2m+p/RJ5FQdQAomLOGa0WhKIuU40ySeRJC292cPcDz4y5kVPBwrei2Y7UxC6O6beOPsiBbyCHG6au6bDMAIXzNx7xIyDxcAPJq3MNCLAlo+5TEN9Mj36YQmrT3FUeqQf/y5JKP7BN8xjwJVjrnrAvV957z1qVePQ3H+aS1/Lql9i5hRnLjskAd9Fjlkc2dKHsiYyN/F+G0BV4L4RGYTqEGrJnqek5N2I3PHuJu83euDPfoTJcNR9jJtLOlwVed+gLR2nvGICwbsU46KVyOczWxCcmoZsCifXH2ftvksuiAYKFqIJPtjnLwGb/K3EqMA5fLfcmq2KBPNp/Yp5qL6bQPBmOifhk1m9YlVxxULDQ8YXBUgEPrmAVWhuIl097LjcnAK311duUmZu41T1vVUfZYx9VGl4JJQ97+c67qkHWveXSFLsmVTPtWrdWhKU8yIzxulHBlGFHN+hNSaQwIjPfb7PqAqdWShFZ0e67BGF2Y5s0/4vtUj4nfnUd+8ZczzgrvnAlfo9QCG2cqJ1ljacjlYY+WhfhZWKFzn9gegs3vkgbvhZTVAXMlYVdsDAQdho1OOgoN5JRtJK31h2nalU4ayrZ6zS1Mzq5YFwTGbcnBjIKGyh7gj7to2Vhr5qlUgwj47ziIM8IF/nYP3gLrdpbqWiuApOzSuMBlq/qmubEAj35Ldgnz3svAW8AgfQ2i8UKJF3sZ3eF4UtJpaeCq2aPoulP0XLJfJ5bM 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:(13230022)(4636009)(376002)(346002)(396003)(366004)(39840400004)(136003)(451199015)(8676002)(2616005)(1076003)(186003)(83380400001)(6512007)(86362001)(66946007)(4326008)(54906003)(5660300002)(66476007)(6666004)(107886003)(2906002)(36756003)(6506007)(38100700002)(66556008)(6486002)(44832011)(52116002)(41300700001)(478600001)(8936002)(316002)(110136005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HSSJCX18+uTwTlycjs4fbXSAszBv81VaO6Vv5ROHH3VFgUojtWoG2baBCGfg4lSJ4WGIGovAVX9crbkN8GMI6qD4ZBCjtk6eFESsLnH1SDso9v/5MX2XbCkltPr0WDjj9Vr1Sxo6VNX8Ynjrwnu0DZZqg7PYRMfPtw451FDpQblSxwkNhLdZopb2rSkUVua0Ys31dRRr2Ss/hntGcjoSSlXIpkDw1rhSnjOXfMPin15GXAZXSt3qmqSgfre4jcUQPRYBVeNO6qYnHnxyUYe6XpkxAZekPpNdm+7sjJytjdf8DPWb/rGtYX05T9K3k1qKIALnA4Wn08T39an0qW15aZZz47UQ8DGyD5Oale0nCGAvsgdtxeDLqvdpvqVE95tzbzfN57QH1b1PYbgSznAncEs12JOKFjM2IfcFEDJ/P52FhkM6cw6zMbEEnHv5+092k7L+1YGFX2Z/mHqFK5rVtynvRtwgr6WaE0Ca/WpHEEKK4RYy7Ug4rETa0PpL3sWimC+A/mv3jPNDcgf9ndls3xCZh22NDPhQark6z8Mt3fMyGf5de1HT5dlSmHgxe9SvScD2K0RByLFY/H6CN5QIZ+L+FAkBiQvS0UFegv4M+eZ145uBAXQy8dHOqiN4QhFVZiZYcGsY9dR2fI+Aid+KiMSQzG4BqAlyBWN7tQqRD0CCrsyHVgJYEpd4/3WQij8UkF1N+SLSHRmP/iPchbAnClP7NlNAimJH2Lksu3B82vG8XNP8KSdZtoGaxtY5fRyz+sGlPWq6nCM8wMRJw2B4TC3KTi4HyhMAIi8XfDEnReAXDdC3g8O2wYcD6FNyKF9eDvJ83UoBezPLMaf/+hoS/Z5mLsikFZ7ryELq0V6hY0fLv9lRMEwzco6oAZU20G1b2p4qXQQr+eIu4Lpl+usgjxO4N/z3PgfOIyzAjUBYpc0PEz3yMLz8/9uarILXWXerE+vjQG/ROqzku7u3eipDNGZ9df8pdEuHvcxKECJFVxYMdIf7QFvCUoOgvap61piwFvA1+aCUIgZhud/a5WdRk2UhDNycWI5lZPJq9z3InsdaS0xxJUxaPBH17s1CI0k6VVeL3KO9bDK/BZe+qTBXB913U/kTPfDUMLPcx6z7l5OX4FOgJQpQYudBTv4Ce4B6n+8RKP0YeVCVJ8sJioOeLMf3j6CU8fWbXZV/b7ZU21dc8JLaF8WIA/oYLaWy2YTMU29CuKf9VDuMaOu576cdPvhU7tkoBOH0pwKsoZv97C7B67E5k8nr1fw/WrKwddHAN9hsH3Y5dqgmshitZCJr5j2qOK6M3WDfPGL8hwgg9zgY5UKsBzcPDUfWkyQDKziH/eoq8bg3sWcLqcheOhgcHp4SPV1yXFBnKW/GaK/muDmTp93cb39tR96QzwRkXNNiEk6VvMVUIGrwyMpNNLz5kGE9kQauZC7yGumhIsszEnZDuxVfHWfUZW0yIXSscYVhcR9i37SENCl85GYSjotTJG/H1h24Y5K7+iWoc0yGCem4G4vqniIfEm15aXowROsf9/Unjlf19NiWnAcekazuPxSJCdSidPh13m40/R9whPzMNPKLoDjT9ugw7SUt6j29FPlUpd4qpsRuu3RwdDxqh3FxV7RnHfKCVGfO5oBrCcAhhNV7PVydA7f0syLra+Zqy2JSZILfy9wkMEdUoQ9vxg== X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: c4be5d6a-ec7c-4e97-1598-08daa1f8d928 X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2022 08:58:59.4840 (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: +oXLEjxloiTW700mOAGSoUuzHUuq03WOw0NxUauS0rz5YznV8EOgzwfEtfp3fsSYhseOuXO3PnBm2FMTlSUEswVJ0P+GoGQuhDHx264AAxs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR13MB3854 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Yinjun Zhang Report the auto negotiation capability if it's supported in management firmware, and advertise it if it's enabled. Changing port speed is not allowed when autoneg is enabled. The ethtool command displays the auto-neg capability: # ethtool enp1s0np0 Settings for enp1s0np0: Supported ports: [ FIBRE ] Supported link modes: Not reported Supported pause frame use: Symmetric Supports auto-negotiation: Yes Supported FEC modes: None RS BASER Advertised link modes: Not reported Advertised pause frame use: Symmetric Advertised auto-negotiation: Yes Advertised FEC modes: None RS BASER Speed: 25000Mb/s Duplex: Full Auto-negotiation: on Port: FIBRE PHYAD: 0 Transceiver: internal Link detected: yes Signed-off-by: Yinjun Zhang Signed-off-by: Simon Horman --- drivers/net/ethernet/netronome/nfp/nfp_main.c | 9 ++++++- .../ethernet/netronome/nfp/nfp_net_ethtool.c | 26 ++++++++++++++++--- .../ethernet/netronome/nfp/nfpcore/nfp_nsp.h | 1 + .../netronome/nfp/nfpcore/nfp_nsp_eth.c | 2 ++ 4 files changed, 33 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/nfp_main.c b/drivers/net/ethernet/netronome/nfp/nfp_main.c index 91063f19c97d..e66e548919d4 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_main.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_main.c @@ -729,8 +729,15 @@ static int nfp_pf_cfg_hwinfo(struct nfp_pf *pf, bool sp_indiff) snprintf(hwinfo, sizeof(hwinfo), "sp_indiff=%d", sp_indiff); err = nfp_nsp_hwinfo_set(nsp, hwinfo, sizeof(hwinfo)); /* Not a fatal error, no need to return error to stop driver from loading */ - if (err) + if (err) { nfp_warn(pf->cpp, "HWinfo(sp_indiff=%d) set failed: %d\n", sp_indiff, err); + } else { + /* Need reinit eth_tbl since the eth table state may change + * after sp_indiff is configured. + */ + kfree(pf->eth_tbl); + pf->eth_tbl = __nfp_eth_read_ports(pf->cpp, nsp); + } nfp_nsp_close(nsp); return 0; diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c index d50af23642a2..678cea0fd274 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c @@ -290,8 +290,13 @@ nfp_net_get_link_ksettings(struct net_device *netdev, if (eth_port) { ethtool_link_ksettings_add_link_mode(cmd, supported, Pause); ethtool_link_ksettings_add_link_mode(cmd, advertising, Pause); - cmd->base.autoneg = eth_port->aneg != NFP_ANEG_DISABLED ? - AUTONEG_ENABLE : AUTONEG_DISABLE; + if (eth_port->supp_aneg) { + ethtool_link_ksettings_add_link_mode(cmd, supported, Autoneg); + if (eth_port->aneg == NFP_ANEG_AUTO) { + ethtool_link_ksettings_add_link_mode(cmd, advertising, Autoneg); + cmd->base.autoneg = AUTONEG_ENABLE; + } + } nfp_net_set_fec_link_mode(eth_port, cmd); } @@ -327,6 +332,7 @@ static int nfp_net_set_link_ksettings(struct net_device *netdev, const struct ethtool_link_ksettings *cmd) { + bool req_aneg = (cmd->base.autoneg == AUTONEG_ENABLE); struct nfp_eth_table_port *eth_port; struct nfp_port *port; struct nfp_nsp *nsp; @@ -346,13 +352,25 @@ nfp_net_set_link_ksettings(struct net_device *netdev, if (IS_ERR(nsp)) return PTR_ERR(nsp); - err = __nfp_eth_set_aneg(nsp, cmd->base.autoneg == AUTONEG_ENABLE ? - NFP_ANEG_AUTO : NFP_ANEG_DISABLED); + if (req_aneg && !eth_port->supp_aneg) { + netdev_warn(netdev, "Autoneg is not supported.\n"); + err = -EOPNOTSUPP; + goto err_bad_set; + } + + err = __nfp_eth_set_aneg(nsp, req_aneg ? NFP_ANEG_AUTO : NFP_ANEG_DISABLED); if (err) goto err_bad_set; + if (cmd->base.speed != SPEED_UNKNOWN) { u32 speed = cmd->base.speed / eth_port->lanes; + if (req_aneg) { + netdev_err(netdev, "Speed changing is not allowed when working on autoneg mode.\n"); + err = -EINVAL; + goto err_bad_set; + } + err = __nfp_eth_set_speed(nsp, speed); if (err) goto err_bad_set; diff --git a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h index 52465670a01e..992d72ac98d3 100644 --- a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h +++ b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h @@ -174,6 +174,7 @@ struct nfp_eth_table { bool enabled; bool tx_enabled; bool rx_enabled; + bool supp_aneg; bool override_changed; diff --git a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c index 18ba7629cdc2..bb64efec4c46 100644 --- a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c +++ b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c @@ -27,6 +27,7 @@ #define NSP_ETH_PORT_PHYLABEL GENMASK_ULL(59, 54) #define NSP_ETH_PORT_FEC_SUPP_BASER BIT_ULL(60) #define NSP_ETH_PORT_FEC_SUPP_RS BIT_ULL(61) +#define NSP_ETH_PORT_SUPP_ANEG BIT_ULL(63) #define NSP_ETH_PORT_LANES_MASK cpu_to_le64(NSP_ETH_PORT_LANES) @@ -178,6 +179,7 @@ nfp_eth_port_translate(struct nfp_nsp *nsp, const union eth_table_entry *src, return; dst->act_fec = FIELD_GET(NSP_ETH_STATE_ACT_FEC, state); + dst->supp_aneg = FIELD_GET(NSP_ETH_PORT_SUPP_ANEG, port); } static void From patchwork Thu Sep 29 08:58:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 12993716 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 61646C04A95 for ; Thu, 29 Sep 2022 08:59:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235108AbiI2I7U (ORCPT ); Thu, 29 Sep 2022 04:59:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234841AbiI2I7H (ORCPT ); Thu, 29 Sep 2022 04:59:07 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2117.outbound.protection.outlook.com [40.107.223.117]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E62D13EEBA for ; Thu, 29 Sep 2022 01:59:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jn6yxUlpRvX5bBjMTvJkTY5Bo4BKW8syVvD6vsBtRwarNTLBqr5aidcU+6OX/0Rafsemh1WL1RPRGezFsB2NuvJX6IV5E3a6+Np8Sk2WNKWCRN6eo0mUD7MUrSLhnssVtp5SBwNMxk3lDOLLz1eiuUsIBnqaIs6gpq2NLqaIbw67FdzAnNDTyvQtbBJbZ2XGI8aapq/EiPwoRAEw4Da0zIkgPI5Wr11h7rTL8rGZyL/djlQWvB6K2JJWP6jGIL7nIw9Vgnq1p85eR8FL3a/DRenCUXeVXtlIayOnvZygAtaILOKEArN4yR5737CK55uYii+A52mH3NcoUIxVpOJ0zQ== 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=URgznGOsKOJaeYxYk6t+Yda+OB/psrONMj5do3nuO3o=; b=oUWopARpV79WnuWVWlmhj+0/kcZLqmPhNnFRS4RzHPJB1B3ttlNn853wRa0LR5AhBcYGUsHctag2nYcof5Z5w6sQjaGiWBw+MC01+NwrF2+iBS7ag4HBJ9PrqUrrvNutH1jZ6lmz016bwbnTIZILhgjmGD8xqYEX+A+FFbQ7pas4zhhHEr3U68/05rFLsYBM74thYKVLQyN1vAnhnG1bywIn/4xT/yWnhHB4M3RUHgRSoSQBj66iUbxZg+s0YVdLHnvRpT9CwCJizkk5UmQQvdkmqrjuCbTK8F7XvZy37JrFZGpd5D7chnQkH+i5oeGy1TRsB4N6HAgGGRnqr/BTvA== 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=URgznGOsKOJaeYxYk6t+Yda+OB/psrONMj5do3nuO3o=; b=uFgB5tW+0ItxJIhVXFEXREJ5xxcZK8/CDVAEckKsNHoGX0E1/3wwENIaW+1jDodV36F2bmwmUrkKwtwaB5ao4ACctdMXSiefOpmdPA6FJpSvHhwCspiIjaZkCmRE4wa+qqKgpxQ/lII6J+M20SlMMou1ln6Ew7TDaYRlToQXskg= 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 MN2PR13MB3854.namprd13.prod.outlook.com (2603:10b6:208:19e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.17; Thu, 29 Sep 2022 08:59:01 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::2cbf:e4b1:5bbf:3e54]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::2cbf:e4b1:5bbf:3e54%5]) with mapi id 15.20.5676.011; Thu, 29 Sep 2022 08:59:01 +0000 From: Simon Horman To: David Miller , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, oss-drivers@corigine.com, Yinjun Zhang , Fei Qin Subject: [PATCH net-next v2 5/5] nfp: add support restart of link auto-negotiation Date: Thu, 29 Sep 2022 10:58:32 +0200 Message-Id: <20220929085832.622510-6-simon.horman@corigine.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220929085832.622510-1-simon.horman@corigine.com> References: <20220929085832.622510-1-simon.horman@corigine.com> X-ClientProxiedBy: AS4P190CA0036.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:5d1::7) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR13MB4842:EE_|MN2PR13MB3854:EE_ X-MS-Office365-Filtering-Correlation-Id: 2135f95f-1263-42b0-eb57-08daa1f8da18 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bFlZiiXee17H1bKMj229nMSQcWL4Vw8uMdN4EniXV3tV1OeGhCjvfQ2CXhPD3BKqTCG2CB6q0iaky8yy+csJvetH60lxm43YPVQ1xJQpJaqh/uieirdIKMUUIYhMvEdgouVYJchJYpxd0hlCv1cNjZduldKm2o1CG5ErfL+mX7SC3OS10eSmVIPQ+qjExtguNKbWFobiMCjLngsuYWoZ+8ntU3V0dCyLVm0TSdcc3SALZV4yiYJgOEX/n5r1nvDMuq80mUDzgoHT+uDOcnFIpoNBijfL6k/CxBUtOf7hwpeMHIn2ctoUHgTOFspPwqF0Z9TYpUPiaoDDf7UVNqIMHIdy4V1Vy4WYUQ3PhD3rmXIqQM3XhERw6FCWBh8plyZpCqnRqVn/eCuIhuFpiCZcN5h987+3OmyHs73g9Lk5K0eTMuL80Ys4O1G8bLiJe+krZBD66M/EcwS5WRo0itjrHG3RxMbYj9gDZZpcEnqUlkQUwWi0IHxcfCHWM6CQuy6Aq2xejokcwXm9w6xZxQeARi+i3wcz8RsN+xAHE+Q6qGXZXBIDYPbJkwUQaWCUueDEBtAQJdTlDg11YV9MYG3c4moQhp+0AYWxRg4d36y7dAqDrDinyn3e9riXCDdewilmjwCDIFH4DLmh+idodp8386VTAce/lxVqN6d1031qMUptqixFHZ6FIb1PceOlAv2yAGxNGW9pWza8f6p8Q0X2iFyOENv8ctdHsZ6PJO9DKM1gfJBMa8Mk8bXseqTS+Gk0 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:(13230022)(4636009)(376002)(346002)(396003)(366004)(39840400004)(136003)(451199015)(8676002)(2616005)(1076003)(186003)(6512007)(86362001)(66946007)(4326008)(54906003)(5660300002)(66476007)(6666004)(107886003)(2906002)(36756003)(6506007)(38100700002)(66556008)(6486002)(44832011)(52116002)(41300700001)(478600001)(8936002)(316002)(110136005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YocRzB0IkP2IKsQDKJ+H1QpQzaqnGHJc+aDKTyHrNwLPkBL2Eu23DHHv0mX0vs1OBHNy6655EaxPk7iJNFIFo/ZLf4/BHwleRqX9V7Yew27BbxgcOrQBVXGDWVbkyGcYd8uhMms9PQm2MYuuo2aSU0OGIhX/jwBZ5zhlv6P941QgExgvEH8xSmqHMr/UXZEgLQeSeUUyGLdiLwKS97lZ6WuKC3OjgKZKl5dMmtBlb0ETTRZv7upVbWFyRvnf743DEQHJaS0t5T+xXBPrUmBF1XerN+xPZ742bo7O3TEGBP3K9SRqAZzoSdgyPPFBaSjhKs6Vo6Xp4g8e2rNgo0OTTnAmYsKZVLjceN4zXl3+V0Oe9drY/zz1ww/NO1FVdWu+THozO/dikh1buHeJa4rH/gmA5H9jBssAileE95YlgIrwJnvNUyv3BxU+x4myrRfPyGrSNjFNT3nqrhF2bnnoOkyePc4bx3EvYwf8a61O6FXM3htY3veqUZQsi/DjmJEf2n+dEV22ZYf4Q/O2zjLr5r0MtDLYuZ7gM1G1xP+VVBVhjYsPoDRQdN14RVBiVs5qUpKw5rPEuUm3uAkhPOVCw2KTVGqk1hpC4c5yMdpd3U9ens3gUZCWbns9Y/66x08cP3Mxlc1CTgP3IWVvjEhxmuWhlMijmD/SRYd70dbPEQrl+LP4Gr5SV8cRov4m4+39k//TA763hHjvz2BvdcOeqPUHOK0G52TX7RibNOHaxqx0O+fJV8u6/1MYqVvYerYxlc1ISLO59aS3eh0K+JYikG3f/OTMmMa+claOLFQGax7ydQuOQfe7S8yTjPyEn6NjgoX1knKPDA44wUKEx1EjumXzal2eTyaXOrYg7EZB3YDZkHVZu0vWXEBZLZ+sF5K6w5jz/ypZR3n+5CyWXXDxD8PYRRuXzAsS4ArAja+OucoyhhD5xkfHoDMW1fi+QVwi9jOvbX4FKQAx4877UMQPTb0WsIykCd3UO4UVfK0MaA3LeblyDXVROOAtNAV9hpB8P1+ZvGK7+dgUHlY62NW22Xy+qX4KEUJnNyj7QSoiTjpkJVQCydTscW3otBTedgkJHQHxZW+RWqaqslDk2r+BA3o0MjMdhqg6b5miRioE9kU+x4UkLnnPe/1/nx8sP0MXGdUNUNJVWqbhu9H3jdWDdDyFHJpk7TtYfvvzwuLXmcnFDd5IOUToI3xGuJF2ekrHpJt8Sms0UAwCUH+7m1nAFGKtEauDpOWnDrZpeozXtMlCqwVs3V4whY2TiaCi+OYXvDgpNgcOaN2SSSl3+8pftA32sDBZ1OMUObd/aXfz8RZn2F+tWhdnwQNIOdUqa84WEfpngqkNWy7PU5PuamdsCn7FRFmUirR2VjHW3cS8Dk3Ucka5wAk4xYsjJaoPQGox9t5qzYx//Xi7V6B4nEuYJLo0cPsXEGhhKXL8YkIi0T8yCuht0nT9tc9OFXLtqVIR24fvXT5Dx/9/SHwGwUlZNULcnP5kBa17Uybcs3+L2KX5JWvfOphivWRE6Rb9XHi6CVkSFArWpHXHysFCElJfiY1MBQ9IetGGK474nxrjy1JFIIFW3Dqo3iFRpMa9/n82FS6nkEy52ZuvSU6VgAjWwk6Kr1/n1uL11Z4w/1dz96O5lhXM3s3DwnKxDVpwB6porjlVPRfSOsCa5369sXw4yw== X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2135f95f-1263-42b0-eb57-08daa1f8da18 X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2022 08:59:01.0780 (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: 3FgQ8WJRDRYRuZ/cSvFLXjEZsl4Y3QkRYnz4ceT/ZE3YwJkUktkgeWSy+gmRjhqSA/SlceSiJbDETqRAklUFQKWpTNLQ7QUlWw/9WjWX2F0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR13MB3854 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Fei Qin Add support restart of link auto-negotiation. This may be initiated using: # ethtool -r Signed-off-by: Fei Qin Signed-off-by: Simon Horman --- .../ethernet/netronome/nfp/nfp_net_ethtool.c | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c index 678cea0fd274..22a5d2419084 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c @@ -228,6 +228,37 @@ nfp_net_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo) nfp_get_drvinfo(nn->app, nn->pdev, vnic_version, drvinfo); } +static int +nfp_net_nway_reset(struct net_device *netdev) +{ + struct nfp_eth_table_port *eth_port; + struct nfp_port *port; + int err; + + port = nfp_port_from_netdev(netdev); + eth_port = nfp_port_get_eth_port(port); + if (!eth_port) + return -EOPNOTSUPP; + + if (!netif_running(netdev)) + return 0; + + err = nfp_eth_set_configured(port->app->cpp, eth_port->index, false); + if (err) { + netdev_info(netdev, "Link down failed: %d\n", err); + return err; + } + + err = nfp_eth_set_configured(port->app->cpp, eth_port->index, true); + if (err) { + netdev_info(netdev, "Link up failed: %d\n", err); + return err; + } + + netdev_info(netdev, "Link reset succeeded\n"); + return 0; +} + static void nfp_app_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo) { @@ -1841,6 +1872,7 @@ static const struct ethtool_ops nfp_net_ethtool_ops = { ETHTOOL_COALESCE_MAX_FRAMES | ETHTOOL_COALESCE_USE_ADAPTIVE, .get_drvinfo = nfp_net_get_drvinfo, + .nway_reset = nfp_net_nway_reset, .get_link = ethtool_op_get_link, .get_ringparam = nfp_net_get_ringparam, .set_ringparam = nfp_net_set_ringparam, @@ -1878,6 +1910,7 @@ static const struct ethtool_ops nfp_net_ethtool_ops = { const struct ethtool_ops nfp_port_ethtool_ops = { .get_drvinfo = nfp_app_get_drvinfo, + .nway_reset = nfp_net_nway_reset, .get_link = ethtool_op_get_link, .get_strings = nfp_port_get_strings, .get_ethtool_stats = nfp_port_get_stats,