From patchwork Wed Sep 21 12:12:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 12983637 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 D218EECAAD8 for ; Wed, 21 Sep 2022 12:12:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229741AbiIUMMw (ORCPT ); Wed, 21 Sep 2022 08:12:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229785AbiIUMMv (ORCPT ); Wed, 21 Sep 2022 08:12:51 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2092.outbound.protection.outlook.com [40.107.94.92]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34D849568D for ; Wed, 21 Sep 2022 05:12:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FprykDPvH+Iz02L7NT0+zvPdmqhhVPXJe0lQMOQB21B+QpsWXUI6aMr7xL7Q+9/i/nKHXgR8M+ehP2stNiHr0hY8XzLIR1pK8suZ5IIGI9h01rqPLW3wW3V5djewevsA7Ew5Yj156hQArOxngqLr7zuV2xiBEx+/ARlAKkXiDXmzRh15UEECaCR9sx3VdWayjjMxq/d8xmbLsgWkBwkQlNi3wE64atoRdIKIS3QwjbfKPgIP0VBhFiKDBdqaffY0pGhB3khAxI2/BHFC8cEeaVTTc0N1Ezt7MslPzMfYYpdOb3pqmS7pxDfSzxCbRuczw8I3F9CkNkSiEaoxfAQZcQ== 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=sDkuK1tk2xi9EU0z0lQ7C9iQ+mr1LtDemhL3kCkgrbQ=; b=jTLmKNWm46t1oTVVVl0Z24+Wna7ilikhXHYf7QqdD/1Ky4NipgsbFsbrOBeQPhBsALpQzWuAdQKLPHYNocP0v6DgZDSBLwRbZBziU/Kh9lVMR85ZUKe+3aEms3pv737QltLHuiBHRiU7HS7fnpz1Lh+iSUHT+6w4DkHrKLjwQup5cSfLrhpNnziq0ZltXhw4sO+3tH8L6/7k5CRUmD+gTvMqy5y6uaytmgf240tkO8a3dguxVNS/G31fJTUzahFlLnjcrFwzySVW0GMKS4Ylh4u9fGQgk/gPunsMPNc/n2hJT0M+T3rEztAzq5wO9f5uEzYKruxZdt3wWvGFTM9jVA== 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=sDkuK1tk2xi9EU0z0lQ7C9iQ+mr1LtDemhL3kCkgrbQ=; b=iD9uA+FdCkMSDxjfZOFxPZ7Slb1D3wfzBq+HidCJR4mfoMvHrUyMNjYCTMJjAmz8Q2ABe90oDkeZipyn8eTOigIp8IW91gzvrRiiz5px5Xr7YWHFcltcDAuJS7v86tDGQBfHLYguQQ5zV40ekuNZ+Fu1C21D1luDAncNdjihTXk= 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 BL3PR13MB5210.namprd13.prod.outlook.com (2603:10b6:208:341::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.14; Wed, 21 Sep 2022 12:12:49 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::2cbf:e4b1:5bbf:3e54]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::2cbf:e4b1:5bbf:3e54%4]) with mapi id 15.20.5654.014; Wed, 21 Sep 2022 12:12:49 +0000 From: Simon Horman To: David Miller , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, oss-drivers@corigine.com, Fei Qin Subject: [PATCH net-next 1/3] nfp: add support for reporting active FEC mode Date: Wed, 21 Sep 2022 14:12:33 +0200 Message-Id: <20220921121235.169761-2-simon.horman@corigine.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220921121235.169761-1-simon.horman@corigine.com> References: <20220921121235.169761-1-simon.horman@corigine.com> X-ClientProxiedBy: AM0PR04CA0049.eurprd04.prod.outlook.com (2603:10a6:208:1::26) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR13MB4842:EE_|BL3PR13MB5210:EE_ X-MS-Office365-Filtering-Correlation-Id: 9cf14220-ee4f-433c-cf19-08da9bca99a9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aJmYNDwDc3P75bSVsJ8F6wC5efYEfE09xuuOONQiZ1CCU99lPUWffZqOhl+QTxq5y3g2xdgQATMjPR6JCYElZtvyjeLYAZHoDkAruW7v+nOf7x5MDNMwAIV9hiy7GkIOoGKYfiMPPDxmG61OLQkQeQKgmRTScBMrhABBCiIfi8wrXaYyc9IVCyBmrLnepwiBCxCFf1l4Gov5CFvPYqcnmIYtGAqL6/RLHWNYpAoVTcsdQGIkkacRT3wV71ju6fr3VCKwCzh5l2Pb6TDePB0FRLXPqH+jPo3znQfo/QGAB8qUUIQt5YjZcHtMJliZCbjatoGTZ5M6lHAHMvjh8qz5qRTb7+FRm5HCbhxtnChORPatFG+7Gco/Ux/Cms26Fdru+hOZn3tGdYDXAN2oa0FP1Ha4FEeiBl4f6jTrM6PChIDGk71/WHkPvlWqCNBY4jWLT1YvPNEDMesVucJ8kZEZNZu4CxtfbY7Q0XSBdpGrCbxWOlF/ddDGaguMtwwwd09FYvvs6auXiicvoheMQ/GGn9UQxGt1yyg86rsu3DK8GhRCYIiA7LdCis/5eTRokX5JROs11IHnD/li3kR1wC475VpY/PtMsFVS4BKNgc3UoTwvOtbx5vQl51ThUgYVap7q+ziX2JstToL3nTbltPzox15yTxww1Rvmn+rRAQD5V0/urHj7j3sV44sWJWUrXRBVqu9Ouein81a0on3cTDNNug== 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)(396003)(39840400004)(366004)(136003)(346002)(451199015)(107886003)(86362001)(41300700001)(6666004)(5660300002)(44832011)(8676002)(478600001)(110136005)(4326008)(316002)(66946007)(6486002)(66556008)(66476007)(8936002)(38100700002)(2616005)(1076003)(52116002)(6506007)(6512007)(186003)(83380400001)(2906002)(36756003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7R810MdeAmu5s/Uk3ewX5+yhMVdvcKOrTcZk9Cdn188MUnFAf56EXUy7glPeTgbHEG1lprgY6tokAT4W8F4ldhLDIQ20DO9ock1E2ZaZEYDaqKPtDYNUKJlO9+uI5L6H/LWDK+E56yZFSLW6QdS82jardiqA1Pd0B4w8meVr1k7pQ57OMGUr6l/H1/+Z2UHguJgfzP2GIuMp7skONsH6cWnlTKlQVz81sWrW1EcxiTAMVveuOY/6cL/wS7bLphdGHg05Hfmq1/XJ8WkPLe3JzYiVnP+cpNqaxMQtuTji98LUdb6zBDMf4z8NSgej/fcBApixBAuEV4s8zje5EHyPWeOBPMBfSebp+MhD//nvoBHpN/8ilF/d5xgMRK0phLiZIuYBtBliVEdst/SO858JMADQNPK75NEbR6jip0YE93suzaPdGpzj8zQC28/DrfpXlElsK2dHSjT0SUU1rE8M4Xdh1GihbZ+LdEua+4QX5NhJZwltIh+Qpjo8C2yLp6PYGMi+HAf196Ni7+jKE4vje6B05c5gEnGlStxLe69DUvhAOtjWpyTX+0MCr/CfLaFR4Ax+uidAQkfvxJRWR9VeuGFr47uwhC7ENODiN8dKoIiBjjQpQoV7+d2PBHjVY3OowLoexuwdjCcSIrI0Hbvno2Luuy3RtaRamPPibO/auzC5XpJrc51sZk3c49zqrLYiPuzZAo17Ncee/sXDZH1/9G+GaMfWhhUGBTf9qJwTFtg2TU+l9ZHfeIQ2zfq7Z5UQXRaCScn1qNaDwlX8jMvK4UtK64g6LOhaIXLMhy6EPYcMia4iXu1jadbaoVuTC9kpUlTRuKmfF9frBL3ppLbeUuH+LROlq+Wuxn3SbznOtKxZr+bLCYikmaQGfaGAqZVfxi8nUfBUn+7FIYh+p7dCJi6D7pdjx5sRmi0F1hOHRwwN+LY4x4KqteBHsD6H/ISbJfFIOrQ77oIq4kG9zkNCqNP/8CgjnJUSj5mylMWDLxOGQs288V7VCxxR6NOIW92PkJRq5xXNuoz90IG6f/nK35OiK/f628+QTLm3AK3GhKBhXcg3/ffzJRef3aPHCjnAB+lR/vuH7FIR1s8CM2F0kWzWIa8dQMHPTap7EKQvsh2TPf8Gm3thbiOedYy9YgjgjjZCA62GdMePNwOMRAeh+LCTAQyEwctlubzsGnQRoP5gk2gpTrZAqkdHsQ3VgZHwEAZswtQiz7J951FDAufIlqB6Lp3VbAO9iYJrT1xaXEGqOD2CPySQ4Ru6OUqXKgMzufHyq3JYbDmQcLI1EyAHnJR2hEYQAWLK7+JaBFzwwsMGFAGIvjmhhzf7NxAGVBVLCSIxmatl6zJS410+u5rxYaEESUOmk+FKFo0UJRA1QcxAS/YgQgFoHQ/PQxiMnmo4Z0+7cciX4H2jECRl8sUnmaoEQfklbLrt9bhq8FJvMRg8phTUliv2U08m+8PoU5+Rcuz9qrcJ98BikY0pDTEkteBDemLi0wAyKfc52QuG1KIHE6kacOhglw38U7wfyKloSuho9YSvedqitydB4P78ihNpjn/fK1ie1GrDaS9G1YdbP5lXRYRHSvw3BpKRWYJzLfLo8WgTIM/OYxdzqDLgDEg2C2UHqRX7dGBY7eaTptRZB4YHyXfOxyw3mcN3Ik/SaChiJn+K6Z0NzHH3vkS8/w== X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9cf14220-ee4f-433c-cf19-08da9bca99a9 X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2022 12:12:49.1181 (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: E6JWoOn6rjNQAYYZlIXQnWz70cFWxJty7A2SW+HiCp6JtLq779WTZQyRBl6NhI/0v39yoNU6nVfOkevf3Yvc0/vdv5f6RWONCAKV9x5ih74= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR13MB5210 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 Reviewed-by: Louis Peens 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 Wed Sep 21 12:12:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 12983638 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 85497ECAAD8 for ; Wed, 21 Sep 2022 12:13:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229891AbiIUMNA (ORCPT ); Wed, 21 Sep 2022 08:13:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229727AbiIUMMy (ORCPT ); Wed, 21 Sep 2022 08:12:54 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2107.outbound.protection.outlook.com [40.107.94.107]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBA84956B9 for ; Wed, 21 Sep 2022 05:12:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Epkp3DXGglBC9Lke/YGVt4rkUkk0rFCutNVAKz0+TXY9KLDwAiaXWL0vf4+E3DfB6sLwd3OxPdKYpNhQiAiXxQoroK3Pu8x6fBZ3ucUjuRv/HCvVbtmr30FwDsMc8MfGQwgvEM92j5krq0dZRD6rpbW0XX/bFZSpsATQTIiChhcEgdK5i9yRx6zWiaK+yr2C4huM9addnPNRV+vLkBTucZ83vERAj7z6mGkXOKoNRcZPJG35HvqzoKnJpoglDO65T+QaC9S/p8fR5nBnsDXH4ExJeICSCM2WaKkEc1qauAD3ec9x/tRGG5ssq8TIme0YJZADK69hbp6GUphjsX3aWw== 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=E7Jn2ys9qvODTTZXxr5YMHfBbhNcohaMNbYDEbqisiE=; b=fDm/m8UfAxGe71A9vJLXYwAB3ewlAD5vMp65IuJk2bzaKcQMzF1EvjCwimAuzJ6yafvzIc106XilaFxIHCRaj+tZ/gxddQ+wR80LlGXOTn6WX2CL67rmcflSdAP2J2N1xznS4u1UhqNN1O/BKTAG8mNW/YMlTXFYduTO9VnLcdK2zKZtghXxsqcIzx8aATuWPPhRSAEWHm0GcJTti4G3nf4gw8hsNHYozb2LK/IYwkSy7lA8YD8qGeTa8zP2pDNVWCIOFmKptnFs5lN7+bvlsJA8LuQaFeCTt9q3OwkpOjbMlL9QbsfvaRX2QdvtkA60FAu17Iav18KcYRBWCOQVqw== 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=E7Jn2ys9qvODTTZXxr5YMHfBbhNcohaMNbYDEbqisiE=; b=gUfj0j67AlfnbkSQtErmfGJ4wjdzuN1/MvdtmQ/8VthO/NVKo5zo4WTY87xWmxiTc6GW8YG57BbDV369apQkvtd7oxgnzfdkhS+0/JRRxr2vRxzch54efy9c1XM9GGytBH1DvN5K6cnn4IFqVqIdRIR85laEMtO1yTLBmC1iHiw= 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 BL3PR13MB5210.namprd13.prod.outlook.com (2603:10b6:208:341::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.14; Wed, 21 Sep 2022 12:12:51 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::2cbf:e4b1:5bbf:3e54]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::2cbf:e4b1:5bbf:3e54%4]) with mapi id 15.20.5654.014; Wed, 21 Sep 2022 12:12:51 +0000 From: Simon Horman To: David Miller , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, oss-drivers@corigine.com, Fei Qin Subject: [PATCH net-next 2/3] nfp: add support for link auto negotiation Date: Wed, 21 Sep 2022 14:12:34 +0200 Message-Id: <20220921121235.169761-3-simon.horman@corigine.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220921121235.169761-1-simon.horman@corigine.com> References: <20220921121235.169761-1-simon.horman@corigine.com> X-ClientProxiedBy: AM0PR04CA0049.eurprd04.prod.outlook.com (2603:10a6:208:1::26) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR13MB4842:EE_|BL3PR13MB5210:EE_ X-MS-Office365-Filtering-Correlation-Id: c69832bf-d931-42be-8fee-08da9bca9a80 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IZyBRGEeRSCrirzrOy09RS0vcvjE2Lhw8yU+jyTWfXxJooIzfpW0g++t5DEKIJxTsPz2UjVyz2uVt792aHCopHoXDRK3fpSKwITzG7GTatQbuqolJQ2ZHIFxwWSOC6XXabUqFrwpofaVtCvW3WbrfYp4xuNnNRsVWC0JBgvncT29fPDl7P4uL95lB60YYzGTtqkoXdPk9QrbEGYEM//nfQRkr3VsLD6Nmm7EyzPP/vukO7L23LyKemWBSjdig47jcqnTSkHIIAiAseMk9yBlApEYE1X+p9PcRQv/iU58OT6kys+w1QNoUjWSBIjYEoR45FCnEatswVMV5Il1HUXoVA4qce40POQpzk46lbKLQSvpgTYuWfmBX8R7w8Wd2Hyc4x80biBBIkUevKphLpUEebTUXL8uKFFq0glxR2omI/UHFlDZsPadYsOpmpuGLD2Tn+pJFL6WlWxRmQ12S4YyID11H0ieTq8H2avJU6l/ACndDFPc/SiX839bLvd2F1nvl08scxblaDI75iC674Z1D94jrgZs7w2eC9RhJL/BzLpX0pzbNGdE/di6rvT245+EWIVuHZzinsB7JL87w1htlaKCjqD+J0GrFr7xGevSSCJ7tRaMIuNH05VZZnhP9RQb+CkTgwii/bJKZiV5UO9N0G+PG4ULTTDe6Ih0aRiRolEjryB1htmnRprop5pGlAXGv7DVVb+q5dzTFN1XJAp+FA== 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)(396003)(39840400004)(366004)(136003)(346002)(451199015)(107886003)(86362001)(41300700001)(6666004)(5660300002)(44832011)(8676002)(478600001)(110136005)(4326008)(316002)(66946007)(6486002)(66556008)(66476007)(8936002)(38100700002)(2616005)(1076003)(52116002)(6506007)(6512007)(186003)(83380400001)(2906002)(36756003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AOpnyvQ9P6fJ8as6YwLYgVLUfVAplkuqceqQGlGP2XsRbRYnXySZGd+NzAI6dmmhMCT9lCLkcTeC6M3obCQz1iPdwETetrLQUewA47stswgpwlE5TosANGXlPeA09HUQbyf4EZdEpJpuJ5G7j5DYDk+zxbewUHeCrQmiDMOPpPhGfaoe52wUnOmpmyKGOi/Mo+k1xNwQG6eYG8Cu38K0W3aTeq7R8+XxfbXK/O+UxWOA1LMiItKn7An+6xHm959Kp7cj9f1NKEnGg2g5TwEsdXnn0ZTuElKhOnraI+p/PlFdg9GhAGyu0UHniQ7W7CGRFFgv1m/k40nGLkYrIW+y31nt+zLBVxPb7x7Kn3O0syBVsYe1AYSSd98eZxAASQx5/3eECsOE1IiIPCs8qq0DxNXflEZqXILetJo1hjKsMUhRYoDb/8lo9aahZMG1q3c/iV77xi5c6U01OpSPTdOg+pOHitU8BWbbjadalwdvoTsxgqrsxy7dV7AmXVqFGHDXy58Ch3ISZAfNHJNIZi+wnmGEFR7m/UhvKXOqfr5oc60p75DSTAcOj3CTLVPZ5+gAwrv3AyLTrs0jkG3b38UgF/MPBGCFCOE6f0h8UC7k+bP1YogY5W/rHOLaYVGuXy3edL5XRbYiu7ZyO2U08NGm6KpvpX6/EnlSTJ2IENogPpRwadn2v9AF8KEwYZYZ5fcq1yOzKGlhIWmoM0Q/cUQ6iI5WH30ZbHDILWhT4KdgbuOtEIMZQu3VXY0TEB7AurxYWSVRpf9VT14Y8cdxA9urCHRzLjxyMBXKZQbU5HGVccpcDKCpZlMLAlHtTvsPxJ6AUHXPYKKqzoMLNuebDJHFzCcdkiw8lc67IspeNRL0Y8Uypt9KIQcjb/ucLIxQZGNStEh2FWqofjjkjUe9ebKRmUPnjMijADbTv8RdSmHlm0n0SI5VD6Q0BJmBglTWYqmDP3tA/djgkCgir+j8I1TH2Z0ugtzSxDapbgtzbP64xJslr68UjTocFc/o6x+H+ujgiY6/xrQ/uZ7fsW2HveiES7h4+V0xI6jsg70cqygrtogwYFx4u1Tc/NiXOfhg3g8GGjMi8hDNpOsloOvKdBTuLe8yuK6NQisyLFTROuKzaKOPHAz+GHggvmEBwKyYGONthhiY3Kd6vOBY04f0IoCaLpd3PXGes0xPkoIgsOdhUgTCE4ZeuFmwn/MCBqvWVbjqOg9Q15wAt5Zbtz/2kc/sEUg+HlFEXYFAGiVOjgRVhsUKbobGAOP7Y544fCpvv2YMC2dKJSlaK9RY+MxhOHeD7TO5GjeS7wGYxnuq2N5yAEVUiaKwtJ1UU3wr/NaTGs5kG5biJ63wk1w87aH2efaglZwnatCSTXW1dvIqBACbEJ5IT7pliTxXJMwWkBmYULGf0EMRV7lyIJqyalcGgpiMjxhws+ZGRFfmELWAUPTgRkIAvixekPozDTBB1gF4W5lIbEBSOhIYGBTZ4We4hw4cHnh6jYmk/sE4a3lBdqQfXUWgvMq2z3cca5I3/7XT25PBf5+RiEN0qzqBUzTORTJtmitVme6zjCKNl88QVfq4HMZxnG3Ui5zbOS8DH/SpRADpHXLDMj3x79gkLhh/lCRlouYpbwDV6Wn0Lo0p0/7pnpHQnLgZBOtJeKb8FAicW21jP8qaiszoNQjXZwnl7zFlpA== X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: c69832bf-d931-42be-8fee-08da9bca9a80 X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2022 12:12:51.0400 (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: nJzuY+dsqS4R3FJ1AEPhuMZqvMIurvcoQXFXrLmRWDo87EfG0cBAHXFY6eihA2VCIoCMwGnL/UqPmF8i/TnW1DO5kXI0HXQnc8nbI0229cQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR13MB5210 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 FEC to mode other than auto or changing port speed is not allowed when autoneg is enabled. And FEC mode is enforced into auto mode when enabling link autoneg. 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 Reviewed-by: Louis Peens Signed-off-by: Simon Horman --- .../ethernet/netronome/nfp/nfp_net_ethtool.c | 43 ++++++++++++++++--- .../net/ethernet/netronome/nfp/nfp_net_main.c | 23 +++++++++- .../ethernet/netronome/nfp/nfpcore/nfp_nsp.h | 2 + .../netronome/nfp/nfpcore/nfp_nsp_eth.c | 4 +- 4 files changed, 63 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c index d50af23642a2..00aacc48a7a2 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,16 +352,36 @@ 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; + } else { + u32 speed = cmd->base.speed / eth_port->lanes; - err = __nfp_eth_set_speed(nsp, speed); + err = __nfp_eth_set_speed(nsp, speed); + if (err) + goto err_bad_set; + } + } + + if (req_aneg && nfp_eth_can_support_fec(eth_port) && eth_port->fec != NFP_FEC_AUTO_BIT) { + err = __nfp_eth_set_fec(nsp, NFP_FEC_AUTO_BIT); if (err) goto err_bad_set; + + netdev_info(netdev, "FEC is enforced into auto mode when autoneg is enabled.\n"); } err = nfp_eth_config_commit_end(nsp); @@ -1021,6 +1047,11 @@ nfp_port_set_fecparam(struct net_device *netdev, if (fec < 0) return fec; + if (eth_port->supp_aneg && eth_port->aneg == NFP_ANEG_AUTO && fec != NFP_FEC_AUTO_BIT) { + netdev_err(netdev, "Only auto mode is allowed when link autoneg is enabled.\n"); + return -EINVAL; + } + err = nfp_eth_set_fec(port->app->cpp, eth_port->index, fec); if (!err) /* Only refresh if we did something */ diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c index e2d4c487e8de..2c0279dcf299 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c @@ -322,8 +322,11 @@ static int nfp_net_pf_cfg_nsp(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)); - if (err) + if (err) { + /* Not a fatal error, no need to return error to stop driver from loading */ nfp_warn(pf->cpp, "HWinfo(sp_indiff=%d) set failed: %d\n", sp_indiff, err); + err = 0; + } nfp_nsp_close(nsp); return err; @@ -331,7 +334,23 @@ static int nfp_net_pf_cfg_nsp(struct nfp_pf *pf, bool sp_indiff) static int nfp_net_pf_init_nsp(struct nfp_pf *pf) { - return nfp_net_pf_cfg_nsp(pf, pf->sp_indiff); + int err; + + err = nfp_net_pf_cfg_nsp(pf, pf->sp_indiff); + if (!err) { + struct nfp_port *port; + + /* The eth ports need be refreshed after nsp is configured, + * since the eth table state may change, e.g. aneg_supp field. + * Only `CHANGED` bit is set here in case nsp needs some time + * to process the configuration. + */ + list_for_each_entry(port, &pf->ports, port_list) + if (__nfp_port_get_eth_port(port)) + set_bit(NFP_PORT_CHANGED, &port->flags); + } + + return err; } static void nfp_net_pf_clean_nsp(struct nfp_pf *pf) diff --git a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h index 52465670a01e..e045b6fb5fde 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; @@ -218,6 +219,7 @@ void nfp_eth_config_cleanup_end(struct nfp_nsp *nsp); int __nfp_eth_set_aneg(struct nfp_nsp *nsp, enum nfp_eth_aneg mode); int __nfp_eth_set_speed(struct nfp_nsp *nsp, unsigned int speed); int __nfp_eth_set_split(struct nfp_nsp *nsp, unsigned int lanes); +int __nfp_eth_set_fec(struct nfp_nsp *nsp, enum nfp_eth_fec mode); /** * struct nfp_nsp_identify - NSP static information 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..8084d52ade46 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 @@ -564,7 +566,7 @@ int __nfp_eth_set_aneg(struct nfp_nsp *nsp, enum nfp_eth_aneg mode) * * Return: 0 or -ERRNO. */ -static int __nfp_eth_set_fec(struct nfp_nsp *nsp, enum nfp_eth_fec mode) +int __nfp_eth_set_fec(struct nfp_nsp *nsp, enum nfp_eth_fec mode) { return NFP_ETH_SET_BIT_CONFIG(nsp, NSP_ETH_RAW_STATE, NSP_ETH_STATE_FEC, mode, From patchwork Wed Sep 21 12:12:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 12983639 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 76D4FC6FA8E for ; Wed, 21 Sep 2022 12:13:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229826AbiIUMNB (ORCPT ); Wed, 21 Sep 2022 08:13:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229785AbiIUMMz (ORCPT ); Wed, 21 Sep 2022 08:12:55 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2107.outbound.protection.outlook.com [40.107.94.107]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE86495E75 for ; Wed, 21 Sep 2022 05:12:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZBIltrHyZ2W1ig/CHULebsI0JGsv7KiDLHhyJo6sr3fRO5if35NPxlTdZc9C+NAJG/vAzIxNQwUpv8qpLe2bHro2EaEtCqzYc2rjQQJd04th8acvOzw3RB88OaubS1dqjEobdOhqqwsPBL1KOllUT9B2XA+Qg5w+jeDKAM61gvhtgmwvwHnYzk3oB3ExfgmR5a2qUPpfa9rGVh4eA16X45PW0aXZeIcUDVRRslquRn9D4V4DNRfwJlKEAg0v2iWVIDJZ5IwYv8rkAM9+1vZjov1AgcTue+wxC/SLsmqhOYeR57submXu15qgjzzsZMgvpFZX7ketCMTaQza1ijjY+A== 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=Ss6PC8iPr6TwN3dPelOhV9QzjWYAOl6EQ5sVedPj2yk=; b=h7sEqkk059tD2IY6Z2bb0AaZwy1Q373y6r8Fw3/Dd5Fi+OI9SMltTX+KFRgwaI/ju0poMnC5L3RInpEatma9tS2lR+kqGZr7ktWyEhyU3oNEiDCjEMACxLJm8Zdb3W/IUe5KYOr1Dok5nXWW8Yhbse3I6xKk0oh9RfGzqPFYNU4g8VedarXHnXlWOPvdtf3Q4d8pdsE0A2ykD+JXqn6CMyTYgAxGK8NOazj+CEQzPc2DsVL4CMTX+IMGL+gyezJr4huTiHJHrgonb8v7FAGbRKT0JIBRV/Z0E6qAjliuILyd34oXwuZ9oP5Najioge2OJn7G2K9Os/4ah9fP+EAB3Q== 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=Ss6PC8iPr6TwN3dPelOhV9QzjWYAOl6EQ5sVedPj2yk=; b=J1o3MYAVxq1l/VdZAsVmFgEVgKDppbNmeuAxpw1ogrIoywJQVkXHfK+AV/DASgFX1TekCTy4elMDr/CPJGN8MgAHmp2kKWtu+BVKeBHAm9tYNdrv/Cb4tqAmPAt6csdZQMp2syyapVWncGl/13hBzigzzpKH2r8fucElbeqVCA4= 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 BL3PR13MB5210.namprd13.prod.outlook.com (2603:10b6:208:341::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.14; Wed, 21 Sep 2022 12:12:53 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::2cbf:e4b1:5bbf:3e54]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::2cbf:e4b1:5bbf:3e54%4]) with mapi id 15.20.5654.014; Wed, 21 Sep 2022 12:12:53 +0000 From: Simon Horman To: David Miller , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, oss-drivers@corigine.com, Fei Qin Subject: [PATCH net-next 3/3] nfp: add support restart of link auto-negotiation Date: Wed, 21 Sep 2022 14:12:35 +0200 Message-Id: <20220921121235.169761-4-simon.horman@corigine.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220921121235.169761-1-simon.horman@corigine.com> References: <20220921121235.169761-1-simon.horman@corigine.com> X-ClientProxiedBy: AM0PR04CA0049.eurprd04.prod.outlook.com (2603:10a6:208:1::26) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR13MB4842:EE_|BL3PR13MB5210:EE_ X-MS-Office365-Filtering-Correlation-Id: b4df36a6-9c85-4e78-8714-08da9bca9be8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EuvFqj9bhKOU7vL/6TTxzrtSQFUk1dcdcIiCnXIHUceRAbpNVimpDrsSDrRWBlS4uA2X9RaLvL+vBk7yiwQ6DrCMuP779AkBUHOZBzIFS3An1M0FZxQhHbCsTxRmBsWSOej2Mo9tijU0JwA18ei1hd7ISiy41V+MkrzKSgPb4DaUEfYXHaBwgTkmPqND731AdUtvhsPuwK38wRw3LqyEFaFCIoWXNJlH+fI0MIUqXAQ5Nko0sUzYyTwKVxN8BcA9kV8yJ0AqO6s27m1YVOf9yRnnE2H/1igezLAgN+3TDu23RXU3TMgsLSCo+pWYIGrjdrb5bjiD12LAVz+VH9WbxHkZsx4Kzl9tZkj0FMWEeW4+ZDRkUdT2s9VyPiKMH9bT7+Pz4SDv4xsEr7MSaiyoixMt0Dmb82/nil+tLb77F6mniB8kYMjfvxxvK1MmBKfX+D4HuRnEsQWvgLtJPzhZ1hqZUWFnTWsxdrQb2gx6K/yZg0CruvvaGgICTwAuVaYVA7W9CRM+SytnPG0GcoS/dgX0YqWriaUXK3lfJ+urNXopv91V/bH+cQ97xY3rBdLfZGwAp22urhRa7FGyjZnjG6YHj0usJFmPzWjbm68GPLUBUS9J4QfWao8TAYNtAkBVh8ZAZzdK8Vf36ONnB2yjcnBhLOfyr5y7hcp2jb6eFYbt8xsFSUEeqp/Xl1YRPOAY4GyvPzI6p19diXPdCJehrg== 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)(396003)(39840400004)(366004)(136003)(346002)(451199015)(107886003)(86362001)(41300700001)(6666004)(5660300002)(44832011)(8676002)(478600001)(110136005)(4326008)(316002)(66946007)(6486002)(66556008)(66476007)(8936002)(38100700002)(2616005)(1076003)(52116002)(6506007)(6512007)(186003)(2906002)(36756003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EBDgk0mLpQmcwiMld4OD21+egxFv+TEFsfppAiFrOmqxVreyI/oKCjymSsiQpfTm67DWhlKq1iQb0vrkY8MXPL5xLBK9DPKjLd45RT0O6OlutG35ObZ1qXaH3hCgfmnG+cH7AQVTtaEPauqd4eumkgWhi+hKwQ3+g+1m/FyerDI59cX69Bgkh+hN80FdX75u3L6eAZwDBR8eoYP+BdleNcnbDlrCsrUkatwLAusxKoJ/Plv5Jld+8xUTxPNfc45hIk4Zlv6/hvgj/1VQfawq4yryQ3zyzvUCyGu4KbNihyTxBakfBDG6DoSA5goDVvjGYnmuf13Gzp76233S6MkvDSAQxLky5pD1tyPNlkG8KQAZ1ta2NC8yCTus5Ow38H2wAHdXiU4MvdUwWW4ivrKmXrUZ8b6gl50Be73z2Sg4w4tpAsqEsBjN0rSrZ7HGshRkYat13L1L/UZuqb1Cay6cJmlfPe2jWelIneRIoxbEI89rf7B9c1WFN84bv+RplBlsv/+FUf+eN0Y7dbCUi7fMYSevjQNRlAYUHwcd0G0NqrncJM+ow+HrBHTgJ0pW6E8C5yLGYJ6hr2jJLXiqMNA1kg0uMt4HvpiBYxS6YjdqDJSlAgSUuOD+vMLf0FzQmwkJziJPx2qkRzQv0l9WJ4NUQbOyCL/M+WdxyiHKktTrLjvKIQrljS5Oz3KWmD0w7OpmuopoVAq2omIoeF5B1w417wCMnMIPBv2q7uWwD+7otsw/yLETtUwct9Sru0C3TR10NttB/7qC790dEXfA0xhX27RyFb92eOdiZyRNsh9t6MH7F9XLNsqByhgPy20FQNqAGEkjGSs19cY7EkiTqnNid6ERvzr+12OWY0pK5h6K1jQ2B3/b9kMj4NDyvWe9+9sSAkSBhi1kDYlHyDFCJ1914DqfKp9kie8/r+h2UgxWAo0H2mgVY1rbyuixKDGpKZz5iV3famRYFFYIgaSwOIh14aTuKc6KO2o+0TjThNJ25YI/VeF8M2KMDgVL+boSLhuTD923UwPdM9C0uL6CGPBzljc4ugYj++qrTV2aA+zVMtGbHlR3jrN7nQjeB+h/cTpKfaBDAovghf+H16Duuvi3exBZrrTgcFwtZqHtACswLuv3nxYR/ogBVHeAWbqAUWrxX0UIEfLsr3YtLL1WB2QZjf9/a0u4ayoc9fRKMdUsbmpT2IxhtuONtFoO2/pPykSPITx+a4v0oQ4lic9nfJz+tMU/zhJHaL737vB5smC/QA0LAjqdi1+9IXg14Qar56oNHPOiwbS6HCQpnJCDhVu4FkgwTDFQIR6cBrtbQCNMxzotdVINTWAC4uYgpdcrOr9V6aizfX+6bcc4k8s1dajd6xXyQ+njaTkUI9WPohHGPI4Tzz6BZV1nK7pX45Q+YcPjeYxEUTyCwXDawTZt2yq9MkcXI3+LiCxjRe/SOZFuOPzhBycZX6Em7yPVK4chTixRuI/ly+v+apURXuELSvxz3b/AbCxWXbNdZZmOu++08lwA9x2W9dheINwuBrUZJ8BliYMJ66qzv1dzXC3Q08+Z2+zcpSEMLOt8t/r9biKetV4L4YoYilQSGTtPm8WJ1tNFoAjyVs/DhFjlNYReQmvWiG/yhuZeLkE0dr1LdKnt/hSlsPJtsFXvZKyM1odsT9VZaHCAD7h72fIVArSQy6eqqg== X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: b4df36a6-9c85-4e78-8714-08da9bca9be8 X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2022 12:12:52.9315 (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: tv0I0N30LIrKlLG66DwBjmaNbkvHj8AniH+EWRNA5mkwsZfCVHwMspEr57FrhbFkWsDtlot0iu44adBhgaXRV3CEkU7CA5BgHZZ7mr4pmvI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR13MB5210 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 Reviewed-by: Louis Peens 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 00aacc48a7a2..ceda4d0b98bf 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_port_configure(netdev, false); + if (err) { + netdev_info(netdev, "Link down failed: %d\n", err); + return err; + } + + err = nfp_port_configure(netdev, 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) { @@ -1854,6 +1885,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, @@ -1891,6 +1923,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,