From patchwork Wed Jan 26 10:30:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 12724917 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 949AFC28CF5 for ; Wed, 26 Jan 2022 10:31:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239989AbiAZKbX (ORCPT ); Wed, 26 Jan 2022 05:31:23 -0500 Received: from mail-bn7nam10on2084.outbound.protection.outlook.com ([40.107.92.84]:51617 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S239985AbiAZKbV (ORCPT ); Wed, 26 Jan 2022 05:31:21 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PgcGxYsVM87ViYZbRVXUjl0E7II9Idl3EcWhhVwegScfiaP+uHLUKKF78HkqiXTvUym1V3Uic4k2aICWSGGs8YtH/D04AeFgRbDWQnhkSnoeJbdcDu3BvIgO/fbiKqscGwwjwtLYJK65lVTNxU80m/dcit+uZ9Rjhhkst5e36v0Wtj2pijTXw7c4sxFtebIrOYExSIOs7bn8vKQ6OfLEcRtF1xXPzEUbsN2te6Pg2n9suGfmoLEokyTTD9V1EvQO1CMiI3R/KJsbw5qNSdzqG+v4idYdy6Ifmn+ThsT4ZIc4BDM1aAHmO6kIYprm7GqKCo+UjW1lXtiKWa7oOBThOA== 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=xJ9m9wVNFP/ns5Va2Cram2cfiMjVb2RiKkLc9SRq7K4=; b=RgHfaRpGV+VfC0CcKk0q4kxmjtW3lfaeFxID4JQN2iYRDnKxgxaz4vzuHMos6dk1ASCLoh+CRwQe1leSjiMLvwOixzihelZZhvcB0d2RQhHlS++7zOx8aEJPdQDptNHehdHKryl/qaHKT3xEMRefcR0IzSsi3rgFLOAw5ReIx4zUvFqohv9Mh7JOww8qSxQSxYoAGl/ESvnetcIgQf9dD9q/RGs0Wo7efCNAwPV2My0/92PHYoH2NkBloWA+TeOv49JsSXHfu270nFPOIe7D2ePAH2XHvsrLSqP099/goPeFRXYcoeq5kAP4x9BxW3u9FY+o3YTxD9DnCi4vg7g5Aw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xJ9m9wVNFP/ns5Va2Cram2cfiMjVb2RiKkLc9SRq7K4=; b=lDR7irw3y+dLksa1K8h/30aqYcbkvdQi+CBJ5+AxOYMrUJTi/rFRKTp+bVi8O5DETpMyRo8LHEE9eLmqUPqsYS1wQuYBdwBAefVdZFjfI/5RWzLvhF4yA/64njkin9Ev80Qb+YWjTlDrpeCSgSiTfi9xjFh7s13ZpMUe+f7GaCz/2xqFRlXXtEI2tcRhwZngPuUGwKBuTK/1HTq84ukIzGFtjA0Ln00jAtDoskGTfISKa/ibgtbPs8XXthLjgjpcgHZTJZFEBRuup8xRkmmtkWkQdLgRNLJOk7ycOgtdsU60/b/eWtHAfS2NnCeeYQY9khEqQMF/IgqJhLMtAYLt7g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BYAPR12MB3527.namprd12.prod.outlook.com (2603:10b6:a03:13c::12) by SA0PR12MB4461.namprd12.prod.outlook.com (2603:10b6:806:9c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.8; Wed, 26 Jan 2022 10:31:19 +0000 Received: from BYAPR12MB3527.namprd12.prod.outlook.com ([fe80::3dfb:4df1:dcf1:4561]) by BYAPR12MB3527.namprd12.prod.outlook.com ([fe80::3dfb:4df1:dcf1:4561%5]) with mapi id 15.20.4909.017; Wed, 26 Jan 2022 10:31:19 +0000 From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, petrm@nvidia.com, danieller@nvidia.com, vadimp@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next 1/9] mlxsw: spectrum_ethtool: Remove redundant variable Date: Wed, 26 Jan 2022 12:30:29 +0200 Message-Id: <20220126103037.234986-2-idosch@nvidia.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220126103037.234986-1-idosch@nvidia.com> References: <20220126103037.234986-1-idosch@nvidia.com> X-ClientProxiedBy: VE1PR08CA0016.eurprd08.prod.outlook.com (2603:10a6:803:104::29) To BYAPR12MB3527.namprd12.prod.outlook.com (2603:10b6:a03:13c::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 453f2783-c940-4731-da54-08d9e0b6fdc8 X-MS-TrafficTypeDiagnostic: SA0PR12MB4461:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:626; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PPUU6vVQ2tyD1avSMN/627WuqGO5Io4TaiZPg5JXlXQEV0o+duXcpPOu2iw84SMP5hn4tciyoi5KZ4lxJqR0mKSDRIHhBsou147nwomxP4OWtDXJGW/OXGaRhRGzUGDmZ+7H4bVyWVh2fp1++6TEe/4kgHSQVCerqmWlo7h8u5aQwCdYRc0cqFGQ37zVAVGqNqWC4rREtT+s0ANi8qzaD37wRj6CrtnIlUsYshCQWC3ousqWLCR+8mdKh6R9hmnuIVJMSVIOfVO0dWNZfQ5LGPq3CDZesDdo4NFmMLWbsa5jLGtKbOpWQpC5UwG/e2XQ4fUbO5wdlPxpUpcj8tweh9pRdN/kM5d627Vd7hdXjLvFGAtdGynCZsVGRxx7DeUg5Mpa38xVqLzm9MD612ecl6AWJGzVf5ikVjAd6XXvpy+rTmih70VzyI9Y5wfV9eJtNCzEKsCakHjpzy0CyQwMfZKr2DVS/BqFXL39fqeI/xBmNGkx9nl8rGm4ygqunZozJiK3N6SMUN8D4L+A3JB2AY/XbDrIPpVzHDTXXLYSPToc4nfgSuO0xJ0azC3tkDznoNuknk6CYV4D6+3uslcebCmgkGC2BCHEBqk7xFIxsCoWIcZ5MqK8kg8JFFoKWtaJkfODIXyxY3E6CQ6pIggwww== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB3527.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(66946007)(107886003)(86362001)(66476007)(508600001)(8676002)(66556008)(38100700002)(2616005)(5660300002)(8936002)(6666004)(83380400001)(4326008)(6916009)(186003)(6486002)(6512007)(6506007)(2906002)(316002)(26005)(36756003)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WaTCxZ/mKjg//bz2nZ0Iny7h+fKkE7SRsDt8/wSC34SAiFuqWs1ihk9bql4/zG0e81s+AvMuvWlyhv3LPPXT0Jx6Eb1+ux37LH7yf9rdEpCkwk8eY2xPOCExityZnpHV8lmBNEsOMNpuvTemxMnZwyLIZ17sjFL60ljG9EnJJT/JMzA/1Ev8Z/0ATFjYvO++ElSyTyHOzwou1dZaOQJGU9zGC+9IHAVSXzb8mRqvWco6K6H9Vu16LkHAIOPzBSZka16VTkd929oWCYkPTclKNRa+THoyHantfHzE1CVGVtq1gLa7pGtqqkltGRSX9ID+zbwlmebTcJrN9qVji+NeSqNvr92JKjrFY5II1i2XRG9d4uQI2h7HPcwCxiCDOeF6ZW+6ZiWP5aXTDUbVxnUlpS76pdOuvhFytd7PpFdl7hn3XTpV14TfHbWzNPhxGxvxQuOXG+jKE3XZ5EunZ1AKc51tl8OH4myuJ4qdtaTgXlppuOFQ1RWDLw/M2zZUh4Jbrka7Tg+InmPyjMULwW/kvAH2zN/V24nMjGa6ldmn6zhyFym5fwHTjO2alkPTbXn6Zn5zYuHcuS+jmYIav3k4SHqkkWgOEOSyKDJdfhFQo21ixhjQTdW6STTcAJT56IhHH0JuNlWMIuADrGa476uYNIdLfvVT1GiUiKE9OMuNz7aO8LzDOgLayysvNDql2on3drL9auA6Skq1TjGzMaciy4h0vM5fd40bLkqXQ5TfiyETeK/atyaFFlsBO4AIPGkUXA/tY2rR86NB28RzHO8hW0fz5eO5BwNMVqLfyp4rK17pPk2mNdMZYgG9qjb4wIEDPAwtm1OdU7XhfBkIsTOjQadQgrWfEamF7LFdCDKHVpXS4sgEfXNy662PMYdHmySD1JFp/M55LqfFbK+DHsKxho9pr9MU3Pdd68iITK4F6rwsayy0mz/nRkZLSamxgnE+VYlCHq1Ua6K3FIpz6Pq38uKjpX7jtG033Ca8Uses/cD2H/5WgbVlSLDZ+3ipZrhuDkxw5KsbMPjBiqBBvMytADatd9apWk+sUyldz1QxIqJkmdi3/6LOvE8uGuAfdqutrpx7/tyr8+7OQjOiijSv+3Fnd4Kq1ncmbIsJjmsjylxWfNS48Vp+e1u2BWAHQMoNMTGZRtT6/WR1ukC6baAGpiyc76upVi7lzUvaAixDCImhsAs0WoXlLUoM+6OQ/HpKSUviXA3F2Q2lc4Y1xBSy/81uNwevITP1rxs1axqacuskWiK3OXkCLPCW+x7fFAqztQItzzzK3cEtDhV0TxOhmHTNrKbLsJurMYLx8ut9nLivoNwpcKj8MMnk3vDesRn0Uuy6QgyQrbavlVmZYd1WLrx0v56726W5Io6dIFHnwjTzTYT6OEvmq3euqBYmVPiBJ8RBa1JrIV5jpkGnLXfC/gy2OXe3F9iKIALxvnpO0xk0iONeE2eeMnfPh0SftIP4qYz5/nkSUt+5ilaoiykOe1BwqmKJ+eNSOn4q3hCcP94dlVV3eJlu0fFQh6PigmaKb2r0AYB8PjjprYlMtP1deCGBy050YvHebLZQo/hoC33+FqkufPdLdwRbsz025pPvWQ0qBNRFV4tlWCfcwHwHihpeodLKtf3fPgq5AgDXVKo= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 453f2783-c940-4731-da54-08d9e0b6fdc8 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB3527.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2022 10:31:19.7666 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9BY7zO0BTver5VZOW7a/5tkIIGRvUnmmJPmFIdfKKbWkfGAIZ5y10dB8IHZ98CsM3Kgr0nLpinbb3GizUO00mQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4461 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Remove the 'err' variable and simply return. Signed-off-by: Ido Schimmel --- .../ethernet/mellanox/mlxsw/spectrum_ethtool.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c index 20530712eadb..68c0ddf3b6c1 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c @@ -1034,13 +1034,10 @@ static int mlxsw_sp_get_module_info(struct net_device *netdev, { struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(netdev); struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; - int err; - - err = mlxsw_env_get_module_info(mlxsw_sp->core, - mlxsw_sp_port->mapping.module, - modinfo); - return err; + return mlxsw_env_get_module_info(mlxsw_sp->core, + mlxsw_sp_port->mapping.module, + modinfo); } static int mlxsw_sp_get_module_eeprom(struct net_device *netdev, @@ -1048,13 +1045,10 @@ static int mlxsw_sp_get_module_eeprom(struct net_device *netdev, { struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(netdev); struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; - int err; - - err = mlxsw_env_get_module_eeprom(netdev, mlxsw_sp->core, - mlxsw_sp_port->mapping.module, ee, - data); - return err; + return mlxsw_env_get_module_eeprom(netdev, mlxsw_sp->core, + mlxsw_sp_port->mapping.module, ee, + data); } static int From patchwork Wed Jan 26 10:30:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 12724918 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 534A9C28CF5 for ; Wed, 26 Jan 2022 10:31:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239986AbiAZKbb (ORCPT ); Wed, 26 Jan 2022 05:31:31 -0500 Received: from mail-bn7nam10on2044.outbound.protection.outlook.com ([40.107.92.44]:13856 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S239984AbiAZKb2 (ORCPT ); Wed, 26 Jan 2022 05:31:28 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TnX8dhpfL2sbXkh1Fxo/AEZSPd3dGkTQeWr0j2Nh222//6+Ec3pRy8bswSFnObjR/Xdmz2htWOQjK+MpxFVQqFBjDVxYhPLMYPZAp/oB19YRUvF8ygDbleYPsInb4rUYmdtppLxe/ex/xIY6aM2wndROJRPIx9tJc14ihq5QtVJy8nvcesCGevvTyE082y6x3pnaf6eq3jCmfobkjRnbFSU2VVnZZguuSTRC5ss+Wb0tvmgdvUTk1o913f/tWlaUlyIRen/WB2vK3VXL4IbB6lEYCCSpJ4s4A+FZujGtUlUt3iQpc1I92g52CpyDl79hOWyNUfVcbhsiU9fKM62nFw== 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=nP18OYGFJTFN0ZuC1cVx+3YMUuncso/BjFsas3C69eY=; b=axgC0yuL406jGqu6yYBeeNk9oCFVHpPsc0EcldIJEUimv5W86avJ/nQ8tJPfO45tBMhlEbNhCNCEDKtYl07G0DZ4g47DbMWGxE2ZagZcTZ+e+92P86ZFHwkf+kvsd1CJPqLec92Zp1MLwthMbWzXMas3GFUg4TZHlJmxo8DmcrkA+AqDBbE3yUsjjl8ad13PoBIH6ZiUPhQuijYbeltehQeLE1/NNvzgCa8XHRTm3e2xfg9Yykat9VNWZoMlMtF8O1B3GR9r3LtfQ6KA/Dc/EPSjhRXB7tLTa5Y5Cl5RM7jlfSHUJLqVNL51fgrwx/ttEYDRYrBqLy3wvmt9bAkpcg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nP18OYGFJTFN0ZuC1cVx+3YMUuncso/BjFsas3C69eY=; b=Lp0HxAWTOPv9Smzb9VQS+j5BRpeZqCWi3hYtPPVBvJ6Pgzndr9xcVVXKenk0ogQkf/fy2e+8FNO5uqm7SFHY3TysnC5FS/3DDQYjGEXkYxTh4xIhmAbj+HFuU96mAZMHExpc7JbE62tW3wcmXyfmooHjko3EoRqW7TabJmud9f18YVSOpKYME/MWLLkEhRpSAvQjDtNtPUuskw1smagmAusPJsfuQBURIlO5q7oP+7mHTgsUHXojRDw5SdLwo9LIZA0uuCPf4K+TacOdLxyGDYMMsDXWqRfgJsFkVCl3UCfx9lnxxVysB2F9MkLY1KXocUTXv6KQ9L3WBnAqRMwzsA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BYAPR12MB3527.namprd12.prod.outlook.com (2603:10b6:a03:13c::12) by SA0PR12MB4461.namprd12.prod.outlook.com (2603:10b6:806:9c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.8; Wed, 26 Jan 2022 10:31:27 +0000 Received: from BYAPR12MB3527.namprd12.prod.outlook.com ([fe80::3dfb:4df1:dcf1:4561]) by BYAPR12MB3527.namprd12.prod.outlook.com ([fe80::3dfb:4df1:dcf1:4561%5]) with mapi id 15.20.4909.017; Wed, 26 Jan 2022 10:31:27 +0000 From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, petrm@nvidia.com, danieller@nvidia.com, vadimp@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next 2/9] mlxsw: core_env: Do not pass number of modules as argument Date: Wed, 26 Jan 2022 12:30:30 +0200 Message-Id: <20220126103037.234986-3-idosch@nvidia.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220126103037.234986-1-idosch@nvidia.com> References: <20220126103037.234986-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR10CA0094.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::23) To BYAPR12MB3527.namprd12.prod.outlook.com (2603:10b6:a03:13c::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cacf577b-1f6b-4f14-dd8b-08d9e0b70251 X-MS-TrafficTypeDiagnostic: SA0PR12MB4461:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: V0xy5nU0j/PRUSx0Dyghua9AUBjTI1e8jZxSD9oEuyps9mL91xLXdyRad77B4ctF9tGPca+44F/pxQMkVzu13NZ529a/uNR3UNnPb1XpmNtF5O+YeMm0rQsWC3pXqTL59YmFk0SgN0MB7Nc9dUZ9z5Q5Y3wyhmukqhThZo8jZAXtNSevIYizTUuGG7XDxbnGFg/CfGzbL1D9sfPuodsJxHYeAsfsGdkow9OC1MM9ycKC0ncYhbIsCeIzzHK3CR8ZKqxs8VN1/2uw7vkbRBV9XUxECKwYoLfRX5kHlrgpnI3bX1GxEtS2ZUFBxJo5pz9czzTiB9CGS9VS8d0ZNN/13eBnRyiRtzEZDf4TY5t5DtWk6q2omK4BlaJTTs2mKh9lmi4dxSZjCe4bXcbUQaB8ve4H3OISVxVteR3Ml7sK9wCkrDweg9t8ShIw4lkd63JvbDZgWIOQFVmlt+kH9Dn7pTg223amPt+BWEsCnLHuTvvba+nW6Srcbqe29x45DYtyQ1/2GVPNL+VUv8aqJxn0PaQB9NjbKMrZ5Jl3yVdoNjmJg9236yKBUAgiMmPKEdVUpvgxdWJqTCitGULfix+O9IiuVT7ukduuaFaJVzepPhFQywpCIJOXBhEKo7KKsuRQFqY/ZGZXNFFR5tif34/FxA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB3527.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(66946007)(107886003)(86362001)(66476007)(508600001)(8676002)(66556008)(38100700002)(2616005)(5660300002)(8936002)(6666004)(83380400001)(4326008)(6916009)(186003)(6486002)(6512007)(6506007)(2906002)(316002)(26005)(36756003)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aNmiEeMMiMmK5bSzOqvKZxexVFzjcIp5+bl8iSwUx1H9Oz8K37+8nZAtK5NaJo4yV0KGI3NnHYXDgJSRvy5l42roGpdSZqY6svkPLrHG8yQ6yL6nKpx6o4xPMC2i1ItcdsHxLrgqLgLanu5J9Lg1YJEvQjputAsxF3ayWo1qeoEiTC+sioEDN2vN36+HB5yuWKCNvQKHxjQ13JFiwQKuBGev0wqkO3mch2QBqvbaYjikQNWMDL3ctLgtEHRW0MwOEZAEXUOcF/vPfloFFsQp+R3iLpLHN68m5MuTUBDgiD3YrDTt+uUz2vEElmVT+GMdIV938K4VWy6cIb2ADPx7q4C47mERiy3Uiv93f6xtyjwdD5KuP4adNlI1YI7erpghkdujKDTZEBYyK6NyTLBs0+IjnIM8T47XOecJokgOC1DRu53zaITYsouhQTZTkYH2ZZoi1twnMbzLCBDHp0sKpzmO9CLiO0NtwISY86aYQK98VkLeMbemCuMRf75n/Jv48TjYW4lUJKJMGkl572vso0bu75QXkP0dEoMZHQvjZET6RwS6dUYDBl2DTw5EutdrN7rdDxQ9mouf7mrerJ5lH1PqaVW7i4AQIeNOZd2HiZPqJKWnWF6kRAcSvlEONODm6ptr47OCPGSYEog/RIRYKajdmvm2EB0mXPUwAKA9bHwGOEvWuOEfiz0tx8RXuDW9oGvO92nWHz1AIIizowLF72mP0vICehwh4IjOh9JJlvofa9dMKvHJVaAx9b95YrlepVr4OITQS02bPl18gNcK7bo939B3/sO4hv5wXK47hBYZN+jOjntmXDfp3a754ufjNNK674eO25bFqP3/lDI/vIlBEFG7JL73NwU09O016Ao7Ef1YtMdoDWc4j40sVP1qyEyktuEACYFklmDqzbrJS2BvIk36M/tOpR8ncaghHNyw0iSnXW/v+K53YoXaPe1OALn6fkE7VaptORdHhDVex/furaY3QHbo3JvO69FVsm30ynWl4m2XlZLT9Bl40M//cAX0nq8QtOJY0BaG0t12yhic2rgQLIE/ELOkuwZujrKCP1PEwaX4gazET26v///loy5Dgub0wdsseG4bgoStQy7Cp+JhhgWAx5dxuwBrskZ/xkQltnxeXukvvf+wk6/VEhwVOHiM1jc5lJ7ZyPeU0W+uICwEHUn/oD6ceFdI5kHq3njzEdFPnmPbD+WG4+cEMrhGjsS+rqkRS+eYiTKeCgooklR1xr+xxOFmyjz4YfFCQafRbHP6QlTI9KmA+UN8g9edYpjI/Wqposm+/HJR45HZo/uzafS6b+apNYo4QzkE9Ud0ihBldXQ6F8qaj3161zyjMP8te1sbe+PZRkXqZWcVh4hENW68/wH4jOTchNjBXBQil0Pke57XmXsiKtaq2DdtRuoRzCjE8bwI2fG/VtXrpr2tZbalIxM0qTx15imUPDraODD1ovxcUhqxFPna0gwt5abPJKeDk96GwVZpmgJElXRnKFYc9KCs/HelE4VUU4MDRJRkbsixAV+/whltUC1s5DfPpKd4qjZwlAnWRimXEyqBfY/MDhN0qzMMlwzDiXdPHjnTYgiQ/Eb+DxpDBRZ4vgmPsf0mjijjj9mPyo/e6Hp7/toNapbeaBWldsM= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: cacf577b-1f6b-4f14-dd8b-08d9e0b70251 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB3527.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2022 10:31:27.4848 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: qTicF0bUvQ1vBzPaUiWwgG8hSSn9TtkjebcgOHUtpO4OOZvdB8Fqssjh4HkUYVr2RS1WernHQgcitfJ9tQwXvw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4461 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The number of modules can be resolved from the first argument, so do not pass it. Signed-off-by: Ido Schimmel --- drivers/net/ethernet/mellanox/mlxsw/core_env.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_env.c b/drivers/net/ethernet/mellanox/mlxsw/core_env.c index 6dd4ae2f45f4..e84453d70355 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core_env.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core_env.c @@ -661,13 +661,12 @@ static int mlxsw_env_temp_event_set(struct mlxsw_core *mlxsw_core, return mlxsw_reg_write(mlxsw_core, MLXSW_REG(mtmp), mtmp_pl); } -static int mlxsw_env_module_temp_event_enable(struct mlxsw_core *mlxsw_core, - u8 module_count) +static int mlxsw_env_module_temp_event_enable(struct mlxsw_core *mlxsw_core) { int i, err, sensor_index; bool has_temp_sensor; - for (i = 0; i < module_count; i++) { + for (i = 0; i < mlxsw_core_env(mlxsw_core)->module_count; i++) { err = mlxsw_env_module_has_temp_sensor(mlxsw_core, i, &has_temp_sensor); if (err) @@ -876,12 +875,11 @@ mlxsw_env_module_plug_event_unregister(struct mlxsw_env *mlxsw_env) } static int -mlxsw_env_module_oper_state_event_enable(struct mlxsw_core *mlxsw_core, - u8 module_count) +mlxsw_env_module_oper_state_event_enable(struct mlxsw_core *mlxsw_core) { int i, err; - for (i = 0; i < module_count; i++) { + for (i = 0; i < mlxsw_core_env(mlxsw_core)->module_count; i++) { char pmaos_pl[MLXSW_REG_PMAOS_LEN]; mlxsw_reg_pmaos_pack(pmaos_pl, i); @@ -1037,12 +1035,11 @@ int mlxsw_env_init(struct mlxsw_core *mlxsw_core, struct mlxsw_env **p_env) if (err) goto err_module_plug_event_register; - err = mlxsw_env_module_oper_state_event_enable(mlxsw_core, - env->module_count); + err = mlxsw_env_module_oper_state_event_enable(mlxsw_core); if (err) goto err_oper_state_event_enable; - err = mlxsw_env_module_temp_event_enable(mlxsw_core, env->module_count); + err = mlxsw_env_module_temp_event_enable(mlxsw_core); if (err) goto err_temp_event_enable; From patchwork Wed Jan 26 10:30:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 12724919 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 1932CC28CF5 for ; Wed, 26 Jan 2022 10:31:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239987AbiAZKbh (ORCPT ); Wed, 26 Jan 2022 05:31:37 -0500 Received: from mail-bn7nam10on2051.outbound.protection.outlook.com ([40.107.92.51]:6688 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S239984AbiAZKbg (ORCPT ); Wed, 26 Jan 2022 05:31:36 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DzX+Cy13zBUQU3Pkye0F3q+CeY6vzagdwcubt3rZ6VH6wyeM+H8SyaIdZhWJUUyKYUbGg+rD2LY3vuKe4vmp30h1ggA1Nj1slMeL9j+QVIZmMjCBVIrRpECsBplWndxhRecz7RYluqi4uZ2zyMIZfkKjlWynAyg1Uo/C6l8km5O2mPmxEKHGsYRwbArmkILAuUDEaH5XxN0f+h4TwJ89GfZ8fUo12KIT1XuR4ol6gkQbTzhO0I5pI6FDj7VXqjSdyIDlumz+mrlnmtNyTGYwvGmtz2v6AEdZp3dSc+dd3MQnLfRv7n2NYwPcRFt6lvVdbggJQQb5pQ0ruZbbCmAPLQ== 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=Z3/ClhcY2f3fqHrBsWyo3vYN4ofULRCizkpHQ3gciSI=; b=e3WNcyIdyF8ydiVSSD8HMuUGq61sxda5zmEQyA9erFNcqJo9Xs8nQ/49+/1728KY+hV6O2z0rA+1V/3FLZq5usZaV/6r3DWJnfS0rm+3PZybwBQpep3YVe8OBkAe8nJ4YARa+YPNI1yvONGIXXtavvtNH1TWWA5yk7z6xlH/Hw1vyZyhUpKVCm8nfYfPC3y1Ft9JHTCvniZZf9PQ0DzUUk8rFf71KtSlx3ivjHlgq1v66YbreSQEMhMauZxKBfKbiH3RPBidO/mio9C81FsQq3vzFcuWdLd7OWP68JIjjApgYEM5Ewuu7l6Fn6kZYTxDUPX8mHdkFuTUUhApuZd6Yw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Z3/ClhcY2f3fqHrBsWyo3vYN4ofULRCizkpHQ3gciSI=; b=ZeJhXJxjD8eeC4Jd/Efk3B08Ay+u2sKwsSIherXnPpLnV71Ird5oqyEwbFPZubmgMknFQRd66NWgamXW5xChHCpTdzHyegCUFlTSsc9g4ynETLdubnqRyojigw8MrlC3ZscNcE/DgaJ++icH57iTa4oH/olDduMZUnV5ggbsimfXzlfZLoB+EQhZvJrr1107BVq4LvrK75dD2nB5y8EvobFhIO/Oq389b7TishADiWI/IBIqBnTak+dxqg7VMmeCurjV3Fq1EOUw97hg4YV1o/jIYj/UyUUbSeioTV2sFVbo43ndEK8TmbxkH1ejU5Lyu2VO2Q++AOZDKiHBjVglhg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BYAPR12MB3527.namprd12.prod.outlook.com (2603:10b6:a03:13c::12) by SA0PR12MB4461.namprd12.prod.outlook.com (2603:10b6:806:9c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.8; Wed, 26 Jan 2022 10:31:34 +0000 Received: from BYAPR12MB3527.namprd12.prod.outlook.com ([fe80::3dfb:4df1:dcf1:4561]) by BYAPR12MB3527.namprd12.prod.outlook.com ([fe80::3dfb:4df1:dcf1:4561%5]) with mapi id 15.20.4909.017; Wed, 26 Jan 2022 10:31:34 +0000 From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, petrm@nvidia.com, danieller@nvidia.com, vadimp@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next 3/9] mlxsw: Add netdev argument to mlxsw_env_get_module_info() Date: Wed, 26 Jan 2022 12:30:31 +0200 Message-Id: <20220126103037.234986-4-idosch@nvidia.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220126103037.234986-1-idosch@nvidia.com> References: <20220126103037.234986-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR09CA0173.eurprd09.prod.outlook.com (2603:10a6:800:120::27) To BYAPR12MB3527.namprd12.prod.outlook.com (2603:10b6:a03:13c::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a09b6dbb-0cf9-4355-7214-08d9e0b70668 X-MS-TrafficTypeDiagnostic: SA0PR12MB4461:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: y/PU2vQdirx4a04TV9gFvwAb0Ocz//2iQjpbCY7Dxrb6KTNXG7yRqU/02t35nEMDn0tCekX5NuwEfu96uc+l07+7LoTYjir1FFAWpixcB58vQ07JdzGllu5F7M0BfSpHOyoKjI70TySIL63ENlIrRdPL+8NpzptLAdmb29wftI0SPyi9eEA/7DFhQLY4OHyAv2HYRcbQrTg3tQfYQMVnWDkqSJpYn/taSVKsKdhegakWHByNFv+Mf4ik6uLZzl/FbN/hHCkYqPsETJZgIZkFQvK6bZfDOORQ3HASjl2UBA3ZpJ4ctB1K3ay5cb/s/b3TITVl7fklef9zmg7RO4P95D0ZxXkaVWbN8yXpgWFxP6V6Sm6BuAeL1tZqYyLecouMVZYHR+LgX2hl93otnV7xQV7UNyg5gaiodoOHTXXzaQcKvHRtLvAWn9udC+oox6h9Dy7u3BHtghszEvltgl9bUWFFoZeO+86bP8XqdtqKsNjPOSqSYGUQiBp77VkKx+jPI51GAFz4Hu+ITZi7iDwXxd8EIsLLsA2jpedMQq3W3aBkhpQvvKRTb6pKM5DqyOeZIxd9K7YQCX0IS7M0GajTDvRkR4YlGaz1/X8lDBQ+EC3iW6Y5aaJlBWMMFCUCcxXFnBKHO3/1dUUD2R0Ni+AcrQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB3527.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(66946007)(107886003)(86362001)(66476007)(508600001)(8676002)(66556008)(38100700002)(2616005)(5660300002)(8936002)(6666004)(83380400001)(4326008)(6916009)(186003)(6486002)(6512007)(6506007)(2906002)(316002)(26005)(36756003)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uqQi4NRVuXW7M+70jT+u4awmHKfsS8FpN4HK5iVINeKkS+PNOgkA1S6Grz68MHpTXzrLKFUA1NkfDXrGbgNcx/1OCICTLhVih+oVDwz2AM3bpXpz4M60GPa8A7QqOUZgEgQZAxELxX/JPS3ierXjzFsNtYzZMva56hihnbDxwmAxI1ymG1OzMN8KH94YPRKDQPig5VejC1IfU1wYYeQCgm2f5kr3XD+8nAROEVMWDHbqyXN8pvILOGWDqBI1sX+wOnH+Nz2CNv6aJaO/jdJ9dUvUlgF9R+eNai/TYXgAFjSyg9ntgQF5HrtgXIRiBeA/LH8jMGbwA+dSnq5dOR6uisgF8XTN8Nkfo7u6feTvSiT5eqSRxBHL8kvtLKrE5gsWJxYpwd+GeJImJ29dp+3/YyIs6C4G3PO3V5W1cXSfRXVgzqhVXFLayGWrv5Yma6SroDmuPkRHkm+xjHGPnV5fiwTN+EoMAb4TSIWI3V3s+48uVPOslaZrco1G5INSZVQQ6S0igHL3zppOiYkrdKu9D+WtJCSg44esnLEsqCLa5RcM1+cJQYA1R0N7syZQSDl4VZ81LMEhGvWZxmRZ+tC0WPnBq35qLTE6Gi7ewEM4lckxdI2U0Xgp6hBKCP4jaI/wEbuS+XAcsnnPZBWdoINffaF12Hfm9RalkgXtURDE4YnReqapqlOzbH2diMroN4TsGIeT73/KQ8Q/dlI77HloC2+vh1isv801PaElkQDzUD0TZukjPJH5LJ0NX3BibuO7EneVp/D1giEAa1YoBP4S6RpKxLW4iWMHnazV0f2zkk5/k5bxLM/jiSgd72nf4nRPhOI8LmwFI3CSPNtLuGZKHH00qHZumnRm6UDLb8nMXNf0Ad1ANjukK41jxpgb0o4nxK7FjeEkKmOqvBoqA0XUzMlezaikAyu3LbZETkGJTgEkfwYed5HICIBW+63tWlhocJxd4IyY8fmTTZRc1wi6dNkTgzCXS+iWynbeJCV14Dbw2/uoGw2J1i0dgnEnPhW3ffASD+vCziAYrqh7cb1FTDi8qGtPChYGgLu9tgs0JUQ/o9iUq8ju856XnG9h8lGHszA/wjqQzfm2Fr/I0nspj5yKjnk5DON82XtsMJgFSDtc667bUMHePxo2qjBltw0moQEcTWa0dL3LV9ZltOumje77n0XtecCxBpKe7GPg1G0z8qzCM3MlLhTIbc0sKsxnNRTlpHeLtf+RWA5b2IzouER7g5D8z+CXXP0q/7iN9nnf0FQ5HgKW3JZfrhepoteUm9259SNMfbPluGsAWu01MsQD3MrnsD70t8qy2Q6JIWzO0lVnum/Y9mfUiyGVWXcl9n+h2emGzmEyUOeMx4H1mpSdFAKfRye9oI6ZOHZu+b331RmgExHamUYlJSM6sCciRcQgKYZk+ErimGdJoEHra9Eu5zCEYaISqS1+3eVY5mEmimR+fBVjlKuoqQ9C9ETgDsaPsR7DN70SRqAiODTfzYWYJCaTU0aOKIInIQEPpQxoRKyXOfI3Vamg0FiwOfAMqKgP/CXWUxRGbU92fDA3pTUdqrddnF9F/pvNRPwmSShzg9IKbRLVhbw7yItSJ99WybFglb8UUNVvmsK8vgzEF/JImvz9d0ICijy1a50/eWg= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: a09b6dbb-0cf9-4355-7214-08d9e0b70668 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB3527.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2022 10:31:34.3437 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: MRuOY91T3P1Jze+N6k8F1dSNuvRW8ynbXh5Wt8qk14N7aAgwfFtp7oujyOzYrwWlpaN389gUYdHr8Or8E1eVGw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4461 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Danielle Ratson The next patches will forbid querying the port module's EEPROM info when its type is RJ45 as in this case no transceiver module can ever be connected to the port. Add netdev argument to mlxsw_env_get_module_info() so it could be used to print an error to the kernel log via netdev_err(). Signed-off-by: Danielle Ratson Signed-off-by: Ido Schimmel --- drivers/net/ethernet/mellanox/mlxsw/core_env.c | 3 ++- drivers/net/ethernet/mellanox/mlxsw/core_env.h | 3 ++- drivers/net/ethernet/mellanox/mlxsw/minimal.c | 3 ++- drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_env.c b/drivers/net/ethernet/mellanox/mlxsw/core_env.c index e84453d70355..06b6acc028e0 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core_env.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core_env.c @@ -206,7 +206,8 @@ int mlxsw_env_module_temp_thresholds_get(struct mlxsw_core *core, int module, return 0; } -int mlxsw_env_get_module_info(struct mlxsw_core *mlxsw_core, int module, +int mlxsw_env_get_module_info(struct net_device *netdev, + struct mlxsw_core *mlxsw_core, int module, struct ethtool_modinfo *modinfo) { u8 module_info[MLXSW_REG_MCIA_EEPROM_MODULE_INFO_SIZE]; diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_env.h b/drivers/net/ethernet/mellanox/mlxsw/core_env.h index da121b1a84b4..ec6564e5d2ee 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core_env.h +++ b/drivers/net/ethernet/mellanox/mlxsw/core_env.h @@ -12,7 +12,8 @@ struct ethtool_eeprom; int mlxsw_env_module_temp_thresholds_get(struct mlxsw_core *core, int module, int off, int *temp); -int mlxsw_env_get_module_info(struct mlxsw_core *mlxsw_core, int module, +int mlxsw_env_get_module_info(struct net_device *netdev, + struct mlxsw_core *mlxsw_core, int module, struct ethtool_modinfo *modinfo); int mlxsw_env_get_module_eeprom(struct net_device *netdev, diff --git a/drivers/net/ethernet/mellanox/mlxsw/minimal.c b/drivers/net/ethernet/mellanox/mlxsw/minimal.c index 10d13f5f9c7d..9ac8ce01c061 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/minimal.c +++ b/drivers/net/ethernet/mellanox/mlxsw/minimal.c @@ -110,7 +110,8 @@ static int mlxsw_m_get_module_info(struct net_device *netdev, struct mlxsw_m_port *mlxsw_m_port = netdev_priv(netdev); struct mlxsw_core *core = mlxsw_m_port->mlxsw_m->core; - return mlxsw_env_get_module_info(core, mlxsw_m_port->module, modinfo); + return mlxsw_env_get_module_info(netdev, core, mlxsw_m_port->module, + modinfo); } static int diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c index 68c0ddf3b6c1..055f857931b2 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c @@ -1035,7 +1035,7 @@ static int mlxsw_sp_get_module_info(struct net_device *netdev, struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(netdev); struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; - return mlxsw_env_get_module_info(mlxsw_sp->core, + return mlxsw_env_get_module_info(netdev, mlxsw_sp->core, mlxsw_sp_port->mapping.module, modinfo); } From patchwork Wed Jan 26 10:30:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 12724920 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 107D1C2BA4C for ; Wed, 26 Jan 2022 10:31:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239984AbiAZKbr (ORCPT ); Wed, 26 Jan 2022 05:31:47 -0500 Received: from mail-bn7nam10on2083.outbound.protection.outlook.com ([40.107.92.83]:13889 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S239990AbiAZKbn (ORCPT ); Wed, 26 Jan 2022 05:31:43 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HCOLYecvLvfZtGNEej+0oa61fAaTd0TyLQooec/yfXpzRzgKywk+nd2RvesPTkqNiZWS2ZAHbIgm9qGMzPA2HJh7G2TokD92dKYmVIAPiPADwj0eydubX0NEVb/NfzqRnGipz85+8gwX7zb4mmYBqJyOApx3fNFrJEdpmbcUDqvR85we0HhWJv25mdT5UA4fQz1O82Pq+NDiCiUXIB+FmThsLBsYqR4gF2YWupAtqOCifP64urkoZcr0bmV51oa3M98Io98VEKPi+1rrY9+Fp1tQycmVqPrWw6Yl+S6HlZBW8vCKKVzOxQzIBAH1iRtj+JGGw0/FUEMNpbALTU7gYQ== 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=ZaHYKwGzM/pG2wV+309vZEqN5PtH/SckifWdsHc9Mck=; b=CRQofiUVI6PS0d+ly+IjwuFbOB32DuhmvhPmmITX54XdCOPF/KPz/aNaf/CdO9LaxRQQ01npeKXC+ReWdSsSdixpGyir57BKlPe2N1zQtFV8/Qn7q0MTP8HVXnaooYY6vFYMJZGGho5/7CjgJV3ADiW6hOy8y1cuBumshpUesObfpiX7Wld+Fj5l4kTRuNajbWCcfvrEBCrb/QrVg+mK4WvW39ZN0X7fygWTe8/j6UxiBdOweHjLae35/GjT5ggIbv6IukD4ov/fD/q21+A/620Jnp/YSgs0/vwEEfnVYrWLty8h+avU24laVp8HeWfPeD7Svf62vsHG1/zmtEzyzw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZaHYKwGzM/pG2wV+309vZEqN5PtH/SckifWdsHc9Mck=; b=BC6Ur176EK5V2k8R4U295qQkba/VUuVzf7aD2iO39Ez04DW5ZuZcTb890QEbUUx3iFC8RfenEDBcnx2Yqr51W4O6GnxEFcUNIgK/frtdAxsiPuh25hbFHwv47TJGzwO4NCFEdscHSxj+GUkMDUbakyY/2SvPVijiApSuTSlvQQhp+8P4KHE86nzGODFIK2pqVSYZbKuACKtFZHOAHBqZtsHy9bBeByA4GSmvPHTg8vGbh8Z65hagGKVZzRDGZ5rXpYH+5pxf1GwScJ639zR2p7R4rGJ/9QUU9ofB/qOmLTx2b/ORSVq4rBqtmE9jv1K5XOrRIkKXLTvXifIPjesRzQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BYAPR12MB3527.namprd12.prod.outlook.com (2603:10b6:a03:13c::12) by SA0PR12MB4461.namprd12.prod.outlook.com (2603:10b6:806:9c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.8; Wed, 26 Jan 2022 10:31:42 +0000 Received: from BYAPR12MB3527.namprd12.prod.outlook.com ([fe80::3dfb:4df1:dcf1:4561]) by BYAPR12MB3527.namprd12.prod.outlook.com ([fe80::3dfb:4df1:dcf1:4561%5]) with mapi id 15.20.4909.017; Wed, 26 Jan 2022 10:31:42 +0000 From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, petrm@nvidia.com, danieller@nvidia.com, vadimp@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next 4/9] mlxsw: spectrum_ethtool: Add support for two new link modes Date: Wed, 26 Jan 2022 12:30:32 +0200 Message-Id: <20220126103037.234986-5-idosch@nvidia.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220126103037.234986-1-idosch@nvidia.com> References: <20220126103037.234986-1-idosch@nvidia.com> X-ClientProxiedBy: VE1PR03CA0057.eurprd03.prod.outlook.com (2603:10a6:803:118::46) To BYAPR12MB3527.namprd12.prod.outlook.com (2603:10b6:a03:13c::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e2a7b3bc-a28c-4626-4a55-08d9e0b70b28 X-MS-TrafficTypeDiagnostic: SA0PR12MB4461:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3968; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: baUcaWOUPVzAgjiGndAO7owhTvJ9P0hUtpkJn4IObEmydcUCzcboZV0dTBDg6lb1s0la6VVcdWWLuQfiprd9khP53FgscZ2DPevmd81U1nvQOnAmajc6yA1OU4oPgvPLJDxcaRlARvT6KFQmxWc93/ntjO5SCFk5gtDstIIZt5ReQeihvE+h8M7+G96tJYiSPjtMBfIk3cLOl6oDWEssFAXKhqoXNUaBBO+9KraYJKH/e1CUvjHU0f7W1j7oSfMACCBs8gT8qK+1US/nhuqxHq0N1x21absWuu81lEJi+6rzJ97kFAIwzDrIlMXCvqZP41Zy3Am6Ci107cX117k6ccjbm1b4Yib7AVqGG0o55LxgbioTjy9JgKHGyxy6OjA5uXxXdrwja+RC2LVuwaxsscoDQ1sdyxxqSSnbUEkSi4VBQ/Z6ALvepLzOcfOVHCt46e9YKQ+h5o0AM+xhdj+JLVu9gDjWwmrpPKsWp1H2dkAluMCGMnDdcHhv8ZiVEYexoUob90hnhlmMM40nxBVK2bMcK67UPft+OZHxFrqshrGxIcxoD6pVhkxGcOT3dx3jMbvnErARxIWXuoygygT5RCtWekTdiH83z78HSp+yc73WvqWQ5jaTcn/NjYYWY+vFwDLEwgIRlFsfY3yGEyCTeg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB3527.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(66946007)(107886003)(86362001)(66476007)(508600001)(8676002)(66556008)(38100700002)(2616005)(5660300002)(8936002)(6666004)(4326008)(6916009)(186003)(6486002)(6512007)(6506007)(2906002)(316002)(26005)(36756003)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2yE6ved8s1awfNvWCqJimtO3y0V/zoPbybzgd1+vAzrB2AyB8+du9ih+X6lZlJ/AyIbrhQk1zXfzwWLIkYt/UI2zEOG0wCYt+vCLwc+ekkgJLDb9Q/eOQkYE5tK1bbUMXSjyWL29VPjpwdgXIF72rfHSbXy3JvY7rgzPujNZtu40q7BRlBevkQAEXRAhoX2KSt70TRNVrsvugquCPWNAYBHm9PFeh/3V47i5LkjjL6fLWUkUz/bBOaTOSLY+1xayUusg+VOeZsHl2nKvGcGOBbuAgQUtHNpHdVZyJ312rfWw5be4+3ANwGnKN69IuAksVW3MFWtpybPmo6Oo95pO4KFWoPNMw1XQLw09j4mXspBstR+GAzZUDu1RPWsNI7/SupS8UhN0peaXeP2TNq4E/r4vVoCLbejoZ695mRa+uq59Dly0L7qU0iuV18ottbLKToK1Bns8BG52BonFh0fu9FUJr+bEGs29kalu0zAoA3s9OVXj0zf0SICBoOM1XE9mOp2YN+b1NOCBfLqm6n7F7zlqNgYki2oHklzbIcwsP1uxHpMJPDLp0J5Q2MTIJ3J+O4OFKw2YQPvTE0sH1RJpGi7bGsCzHrpdZ28EFVCUipOBKuNRuur6xtGybmbDD/P7M+q4dDk7MQkULoJs8Tt8C2Zo0hq3a3eL3L3vRqVEzqRVj/bfXQA1XOf43kY/MLLdU8wm2AHy5DIqTT7WYBMF221O4ad5t0Wbc68Yfk8apmC2fN/qeZ4rBFGvk0W0aiIQTfbEsdyRi0lXXynQElDzMvL1r9mUYkFkCI/Z9DzhPkedmzRsycPuAYhGTYqtdCrHEAtrpWJosECVb8/I04FgzRv8OVLUiT6ZsK76QFQ2Tnlc1xU8H0HyDh5+UNG95d7PHfnDauuEQGNzs5lvr6xX0Ck0BaeT3KBsTwSTCSAZ/kmMtOBwkMmSMHTwkR7P1HIBeOt/fT99HBHnCT4ja2dr401CdIfKqORVhY5iaa4eYunI5y5OAskmTORvQD5IYqcZiv0QWes1sRGV6cBPTfZJpb250MaDvRbI+8bAKDnJWGcuwN5H5EiUrJzs51UqZXZ0X3Q9mWjwvRrHb59FJSbEc2Na3yz6a+A3J/uX6VZOYdA+z9+CPdutRAY55Nawha7mNMxrTIWBwx6PQdF/zgdus/+PI07BTps9tSwBe/hh/u4ze6N1pHXPZ7Kwoa2GHPQK0j3YvqrhOKHgpQF8k8m9nOvc/ffNyalvM/fDr2Crhr95Fbj/dcnGujZ2tRhqMxi7PsLRU4Ykx5LY4wZx56WvS4OFIlY6+bQ0Ni84sAuCZ0GjY0Fa5DpKhJYvv5yIfhCpEaB5fnw32H6DXSQ9Q/PYET9rgnv6K6ROxrzGGj0mdetYJD/59mOKTVJkIzeKvmVr3RVQOU3n3RHP/kP0ZehkRDYoC370XBPtf4+5l+N/gg1tXVVRyCeqgQCcgz+Lwz8zGbMbAZSYU5OtWoAj410ikK1KEf1+SoHCgb4EiXYWV3E1/OZjederR8YaeIzZ93eOw/5DJDw5fL6xOHIe3wA/FUJ7ODwDlhMx6FEwr0CNdawl4AZI7lL1USsqJSMCWObyPKxPHBMd8T3dgNehMDF4gtgkAX6W4cDMG7vMUydyaSg= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: e2a7b3bc-a28c-4626-4a55-08d9e0b70b28 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB3527.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2022 10:31:42.4212 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 40clMZKouRc1RTRd+ucs4ho3TO/sC79BQmzE/enSzZC27RIHHg8ra8u/Le9X7qdg87sQRasq2c9HlPcMRpCZag== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4461 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Danielle Ratson As part of a process for supporting a new system with RJ45 connectors, 100BaseT and 1000BaseT link modes need to be supported. Add support for these two link modes by adding the two corresponding bits in PTYS (Port Type and Speed) register. Signed-off-by: Danielle Ratson Signed-off-by: Ido Schimmel --- drivers/net/ethernet/mellanox/mlxsw/reg.h | 2 ++ drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/reg.h b/drivers/net/ethernet/mellanox/mlxsw/reg.h index 24cc65018b41..c7eb48f350e3 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/reg.h +++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h @@ -4482,6 +4482,8 @@ MLXSW_ITEM32(reg, ptys, ext_eth_proto_cap, 0x08, 0, 32); #define MLXSW_REG_PTYS_ETH_SPEED_100GBASE_SR4 BIT(21) #define MLXSW_REG_PTYS_ETH_SPEED_100GBASE_KR4 BIT(22) #define MLXSW_REG_PTYS_ETH_SPEED_100GBASE_LR4_ER4 BIT(23) +#define MLXSW_REG_PTYS_ETH_SPEED_100BASE_T BIT(24) +#define MLXSW_REG_PTYS_ETH_SPEED_1000BASE_T BIT(25) #define MLXSW_REG_PTYS_ETH_SPEED_25GBASE_CR BIT(27) #define MLXSW_REG_PTYS_ETH_SPEED_25GBASE_KR BIT(28) #define MLXSW_REG_PTYS_ETH_SPEED_25GBASE_SR BIT(29) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c index 055f857931b2..8b5d7f83b9b0 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c @@ -1266,12 +1266,22 @@ struct mlxsw_sp1_port_link_mode { }; static const struct mlxsw_sp1_port_link_mode mlxsw_sp1_port_link_mode[] = { + { + .mask = MLXSW_REG_PTYS_ETH_SPEED_100BASE_T, + .mask_ethtool = ETHTOOL_LINK_MODE_100baseT_Full_BIT, + .speed = SPEED_100, + }, { .mask = MLXSW_REG_PTYS_ETH_SPEED_SGMII | MLXSW_REG_PTYS_ETH_SPEED_1000BASE_KX, .mask_ethtool = ETHTOOL_LINK_MODE_1000baseKX_Full_BIT, .speed = SPEED_1000, }, + { + .mask = MLXSW_REG_PTYS_ETH_SPEED_1000BASE_T, + .mask_ethtool = ETHTOOL_LINK_MODE_1000baseT_Full_BIT, + .speed = SPEED_1000, + }, { .mask = MLXSW_REG_PTYS_ETH_SPEED_10GBASE_CX4 | MLXSW_REG_PTYS_ETH_SPEED_10GBASE_KX4, From patchwork Wed Jan 26 10:30:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 12724921 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 A35FDC2BA4C for ; Wed, 26 Jan 2022 10:31:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239998AbiAZKbw (ORCPT ); Wed, 26 Jan 2022 05:31:52 -0500 Received: from mail-bn7nam10on2088.outbound.protection.outlook.com ([40.107.92.88]:6624 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S239996AbiAZKbv (ORCPT ); Wed, 26 Jan 2022 05:31:51 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MREDtFkrDtwp6beeGo6TcaICDfJOxUpdJdukFvyzKeedZicIvH6ClwcxZeWWCBcsewuNaJYLgQX4uhd5OnfbgJE5mk05qp2ZWlA1ED8jz93gh+VXmBXmc5EmYD3FbjSCq1oVFV7eCGoC9Uk7XyoRmomKDVoO0RmJCdYv69NefCU5djEORuksN4KYsieiTNOiZwVfxboASb7kcZtc/d/R8g6AVkP2s+gNjMUcUWt1CNfyrTIhmd3wNWEMJZuXABH8DHHMp1b2Umo8iY6roYF5BVSdT9liAwXyF9VGe7ZsF6cqELhsc9dIFaSb4gX9zuVvh2/oKaoWJGI3eUtpjmPXaA== 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=gV6JNj8ugacjTfwfeHNrCYf2k3MSVsHPDjXL4aqT1iw=; b=PBOrbyysKerH1RjUjitiRh6DOSIDYDd/9Ti8S86x7UQltCNHalco7bMmSixCamgHQQ9+vL3rcxa7CasJUEtxp1NZFa8qoWfS0hfBf4xtsTmBk/bfxjSWQGt6sacc1l7j783Mi9KvEHCYZONsMJoYCbT43esDFTkpsyGrsGmi98FyJ377APdjF5s/eBSAbWpjd3mPueuQmL6xZNxM0Xc8L2VlN4MvR6SpLO4Bbm0pb5r7lp6VnlAfvvzVMvEu//5tGh2Ukf5Rf5SiwtwFVUXuUm5SRS82VQ+R2WMhAH0At1A4t3hc1Z5Gw013qAFHKix27eSoqX1UDmGHKC9yqF7l7Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gV6JNj8ugacjTfwfeHNrCYf2k3MSVsHPDjXL4aqT1iw=; b=aoc3TR1SLOJh6/0jmriz98JIXBad4/l7qj80BFT4Bf8n626a66+BlxRB2s3eTc/HajZr2U/S2/GPcYnBmJrnAUFyUgek8evjJ5bnxKR8xEWOvkXEd9WC5+vM8BskLOSKKiWnb4YocDOWIXPoaaqkr3vcT0J4vweiDtOKkaSjU7VIxwnFvqHyYZ7PpBzRhvFiCkgZYgbuZSmx03/KS4/uBHrGy4kiVjiL8fnozG3kN4ghjzKPqqwhBBKvtyBXGihfYYK4eoO0McAt/zq/DV+BCgNcH2zMrM4f5ctzUFd3U91ZZKCmmxApr5HXtopJ3kmjciASyHzzM7tVrNlXq2ksdg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BYAPR12MB3527.namprd12.prod.outlook.com (2603:10b6:a03:13c::12) by SA0PR12MB4461.namprd12.prod.outlook.com (2603:10b6:806:9c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.8; Wed, 26 Jan 2022 10:31:49 +0000 Received: from BYAPR12MB3527.namprd12.prod.outlook.com ([fe80::3dfb:4df1:dcf1:4561]) by BYAPR12MB3527.namprd12.prod.outlook.com ([fe80::3dfb:4df1:dcf1:4561%5]) with mapi id 15.20.4909.017; Wed, 26 Jan 2022 10:31:49 +0000 From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, petrm@nvidia.com, danieller@nvidia.com, vadimp@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next 5/9] mlxsw: reg: Add Port Module Type Mapping register Date: Wed, 26 Jan 2022 12:30:33 +0200 Message-Id: <20220126103037.234986-6-idosch@nvidia.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220126103037.234986-1-idosch@nvidia.com> References: <20220126103037.234986-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR06CA0147.eurprd06.prod.outlook.com (2603:10a6:803:a0::40) To BYAPR12MB3527.namprd12.prod.outlook.com (2603:10b6:a03:13c::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6ec39e25-2122-4b9c-dad1-08d9e0b70f7c X-MS-TrafficTypeDiagnostic: SA0PR12MB4461:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LOOITNXX1Yk0vq+p6Opx0k2/2Sbb+0/RNnbH1i17ngSUh715DwRU2NyclaAoq9JAMDDzWfkNEZNqYRodmPcYSyzqnnHZkVCSSgpuTrMPVTj3JPrS2WwaXQTtL5PVZuuRxtF1zT3k6GNanHtE6l5S33eaZ7RL65/+VOctKTVaCQAgQ6NlasPI3fFxmnAV2LzwbF/61yVkCX8L6oXj9qL2BVq8LMfNVysmqHc6rUTAR3ks3wBUV/qn9doqir69BAEbKNchMHu81lWtieLbGs3bPDknYnKkzqAisd1F3lHIecbhaADssi/J4Mth7o92peT7tPnew6dbmdde5AmZgkDXQjToBAUyj6mfqpIceMfi0ggf4OfLxtca23lJW+9XSLew8QjS5euPK5so38sbqISuE5zZxJqEnGQoQ4QdXj8I2+qWjEfIu2MO4YcF/L9MdqsIet+AzmKgu/+ENyuY8xGh0VeL5qaMGzViRw0Jeq4RmEP52n6iNjblvgcEKKytu1JwCAK226T1W4Eq3SwRc5Dt+CWZJIOg1b7IHpWd9dojOi59gpDypAoftj7A58Am1fzrjgD6okAkQybeQ56xuT0B0NSVJ/wfrAOa/JTodVWC3IdnOex+RUSKy2kbGsj33YQJUt1ewvYcBtdIo2cvkGPPcA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB3527.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(66946007)(107886003)(86362001)(66476007)(508600001)(8676002)(66556008)(38100700002)(2616005)(5660300002)(8936002)(6666004)(83380400001)(4326008)(6916009)(186003)(6486002)(6512007)(6506007)(2906002)(316002)(26005)(36756003)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sFkK/RDYwGHkIvSBWYwAiDGWFDuY1HIAXLYlSO6dEXkFs8OM8hVNvmhWCaL2e5RpLqNzeJH6v6yBofc7WIVRAMY/Ma78xNTPVKu5oow62gbIXKggbU0MDFsD/4TqqA1YHakgeB043Pl63JKYKuRh8Hj5krPU7SG11lllPcOWUJB1TOg0XwR4aqXGgg6OMn0IzxSyGIHMl9AVDBhzCB16LFewV4yZhg4lxT9qwdfQTtd2kKyVCtc1N1Ho7/DK4hROxEwISAOMmnKvPWIlDuEl6w4oE2L6g0WcF8v9P+GsCB8qcBr49SEfllxNlBN8vpFiGYc2fsul5KohJeuclbNOz8DzNklsrLoHUda2U8ISnhKVWOfrA/+xu4O5qitOvsnqNG5lJWR2ArGg/E9+PpvotVkPWT4L+mSVeagbwdehi1eQmWOMHKiVIt4BqSY8EZrbrEUOzbRjS456ZpZDpnR/6UDhNFjVE6IDmGyz6Eq823W/dQqpVw4f0dWVGNi2DDch9fNsr9a79v4/iT1RtlprxLRYZY5TdVxf8ozTO66WmTVc7y2z+KZd4OV5PDuIdpWwkGuo6E5TxTSewJqJSsO9lA10dAoX6p61o71QkqI2X8PUOBY8DiNR637EGXl4QtnxduSpdes9I2Fu6rXdT7Tp4xr0Ou7fBsFDq8rjZS6rdcNG4qr3D9nKy7OTfRZvGpbLAgzcBjCqpL8C8QflhZXS3vF763tB4wykM4+AMlZ9lnHhOl6q/N/Lm3gvt26eYpatEXVZPYckDpgjMVY002uMZMCKeoYkiPUUkZSFFnBUivU2EuNsZPlhtzGMGfvxLVZ2OaRbNwt+cFFAchtFxIuNYbUEKfLBIA85Lcsp3P/h0CK9sYIhAWpnGzpvckPcm3lkott4fC2ec8DiAfDaISINDC8z7BIkieO+k++WtY7qc6Lr2Ph4MGTmnXmSS/HG5j7e75tgJBPqwunNG/S5WpPEAN7BBCS47/7/TyTnkuhdBNeG+Ag9/O8GeC/DR0EIUmSjQg8/zffdRmFfmkhP3ZgPf9USRYPAQDiKPUh3kX+9V39KyJTY8JDEOnb1Wjb+eIlRbZkRpbwcaoyI4C+V28yPj30dEqZIsTxeWImo5WzWPXY18lCqbC67ewZsqgPz+TN5S/D33hdrmc3jGNXVQkP5NSlCOoPCdfgav7yxZUK+En1CHRetewMdGUNd4Ou2AskPIAaVOB/rxFvc/2vkHKA5GQ2oE6qE7U0uC38ZAgM2yH/MjL+MtYOUf8WMlU7ZR0raW1YNCgA6/5dZLcEpfcJQpk4j7HKVM6smaRwAinajt+Gd6vRiZO9TVCLvMsCu65dRYuXjrezoNlr2TEx8v5avkEq6DW1sgvG5/JXHIi2G8fO2gTes4aVEZPOoH2r2DKXApFri9HwwibQW2xEHOE8VGAuTl9vnUhiDTRTkac+tEOfQ3SHbOimRo6lJZgw843xMcdI3CrLiBKSWW3cUyL/fZSQwMkNP7iiPRwUq5Iv2p+HJ6JVLlj+ip2Zim6zALZbr2sUqjI2NrL8NHomNtWXMEC5wVF5gqH3vmucNp3UrzPKWMX8LMLWqUj6SdEbgehiHIfUrY3LAIKQcGJlOr/sd6U0BnODqGRX5peNB53PXKhc= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6ec39e25-2122-4b9c-dad1-08d9e0b70f7c X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB3527.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2022 10:31:49.4363 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BYph/kJKyedAou7loos2Ai4K/aZ7FhUjLdZZv/EfQo9AdRH/KVS28I4h9pdjLRnD5tXks8UE/KeEyCO6zI380w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4461 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Danielle Ratson Add the Port Module Type Mapping (PMTP) register. It will be used by subsequent patches to query port module types and forbid certain configurations based on the port module's type. Signed-off-by: Danielle Ratson Signed-off-by: Ido Schimmel --- drivers/net/ethernet/mellanox/mlxsw/reg.h | 53 +++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/reg.h b/drivers/net/ethernet/mellanox/mlxsw/reg.h index c7eb48f350e3..aba5db4bc780 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/reg.h +++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h @@ -6064,6 +6064,58 @@ static inline void mlxsw_reg_pllp_unpack(char *payload, u8 *label_port, *slot_index = mlxsw_reg_pllp_slot_index_get(payload); } +/* PMTM - Port Module Type Mapping Register + * ---------------------------------------- + * The PMTM register allows query or configuration of module types. + * The register can only be set when the module is disabled by PMAOS register + */ +#define MLXSW_REG_PMTM_ID 0x5067 +#define MLXSW_REG_PMTM_LEN 0x10 + +MLXSW_REG_DEFINE(pmtm, MLXSW_REG_PMTM_ID, MLXSW_REG_PMTM_LEN); + +/* reg_pmtm_slot_index + * Slot index. + * Access: Index + */ +MLXSW_ITEM32(reg, pmtm, slot_index, 0x00, 24, 4); + +/* reg_pmtm_module + * Module number. + * Access: Index + */ +MLXSW_ITEM32(reg, pmtm, module, 0x00, 16, 8); + +enum mlxsw_reg_pmtm_module_type { + MLXSW_REG_PMTM_MODULE_TYPE_BACKPLANE_4_LANES = 0, + MLXSW_REG_PMTM_MODULE_TYPE_QSFP = 1, + MLXSW_REG_PMTM_MODULE_TYPE_SFP = 2, + MLXSW_REG_PMTM_MODULE_TYPE_BACKPLANE_SINGLE_LANE = 4, + MLXSW_REG_PMTM_MODULE_TYPE_BACKPLANE_2_LANES = 8, + MLXSW_REG_PMTM_MODULE_TYPE_CHIP2CHIP4X = 10, + MLXSW_REG_PMTM_MODULE_TYPE_CHIP2CHIP2X = 11, + MLXSW_REG_PMTM_MODULE_TYPE_CHIP2CHIP1X = 12, + MLXSW_REG_PMTM_MODULE_TYPE_QSFP_DD = 14, + MLXSW_REG_PMTM_MODULE_TYPE_OSFP = 15, + MLXSW_REG_PMTM_MODULE_TYPE_SFP_DD = 16, + MLXSW_REG_PMTM_MODULE_TYPE_DSFP = 17, + MLXSW_REG_PMTM_MODULE_TYPE_CHIP2CHIP8X = 18, + MLXSW_REG_PMTM_MODULE_TYPE_TWISTED_PAIR = 19, +}; + +/* reg_pmtm_module_type + * Module type. + * Access: RW + */ +MLXSW_ITEM32(reg, pmtm, module_type, 0x04, 0, 5); + +static inline void mlxsw_reg_pmtm_pack(char *payload, u8 slot_index, u8 module) +{ + MLXSW_REG_ZERO(pmtm, payload); + mlxsw_reg_pmtm_slot_index_set(payload, slot_index); + mlxsw_reg_pmtm_module_set(payload, module); +} + /* HTGT - Host Trap Group Table * ---------------------------- * Configures the properties for forwarding to CPU. @@ -12570,6 +12622,7 @@ static const struct mlxsw_reg_info *mlxsw_reg_infos[] = { MLXSW_REG(pddr), MLXSW_REG(pmmp), MLXSW_REG(pllp), + MLXSW_REG(pmtm), MLXSW_REG(htgt), MLXSW_REG(hpkt), MLXSW_REG(rgcr), From patchwork Wed Jan 26 10:30:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 12724922 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 776DAC28CF5 for ; Wed, 26 Jan 2022 10:32:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240042AbiAZKcG (ORCPT ); Wed, 26 Jan 2022 05:32:06 -0500 Received: from mail-mw2nam12on2065.outbound.protection.outlook.com ([40.107.244.65]:2593 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S240029AbiAZKcB (ORCPT ); Wed, 26 Jan 2022 05:32:01 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EqdQ5SwV9YtZnMYZMU04lkeK3MNFf4gMXDsYCe+3i3B9HFuz7MwFIkrngan6WqWBav8MEEdu1Piwu9zWFfdjLUaml+mY+Sny8MUq8AWcT6tcCoPi8i/PKot0ejZCF0SxPnibLW0mf+GOvzioLjUEbK9gDrokCLRDI0lxUAVfw2kTXkholz+HpkYnyUT27zsQb/s8pkhSq5ImGEARZxdGMJLiXerpPWM4H6WGf6aI0EamXbjBfaa6hX/arxYKrkGGxYvuf8znGeegcyj0fYoKGNMbNxsgFRlHuAbGWGhrD2QXYaufKd3qhh+oaem+xFh2I560ScV2QvX0EiC9SZlusA== 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=zX0Nbzha89xwBjlqwgz7aizf06vesWROK+56A4cFpsg=; b=iGoELT5kz7t5sTJbYT5K+HpNykYpnKlEhdBLn09XDRQ7D+6fWLpsiiPiQvD3fhWkk6NVOc9Uw43J97vvHtYza6SJD+HC6TTIyW23KBj02WFqfe0wQ508prDPM33AObvE4cDZv8+2vCdDBsEsYvabxC+72lvdFHzz5XheKPv2uFHqQ86RT8QZacvae4On5tJaL675TDhvQgQGy7pcRY8uoNZ1T+dQfgp/tHofBk5xlhu0ssbmPwJh6MY5ylQG+io1jD/kmjbL3KnCmcoNVryB30USwSP/OnjzAQBUPPSNnOL9a5xM/iRuieVblO4+cTe+wmjr8SxYLLU0IC70yzdxMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zX0Nbzha89xwBjlqwgz7aizf06vesWROK+56A4cFpsg=; b=KH4iWnb0JGkdgNvTkfGvu9qeNmAwmt30s89p+Oz7rtaL9X6sEBGAS6+qWbrZoPDi50npfc8iLPVay4qT+0VwZr764/3sDqilD1nHYgWpAxTaZaau6xrHKyTeuDDKJDKFkdcM0xwOY+jJ/Nis7/2A0f2xzJlbEUuiF6+hOn6b8j48ZY1OeMxJMW5+NM9+C8rnYAciNKe0ut37syQXtgG3Wz8u1jmA9n9JILSzo2GvKer9qV2/pXH70Wbc0i/J4DfzzllfokaSDYKIx5wNbEedPnOKXpU0SEZ/63NVtlsUf3/ttBlPoRisnLBKcDiK7Cwl4gSJqVGOI0i3UwGKs7tvjQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BYAPR12MB3527.namprd12.prod.outlook.com (2603:10b6:a03:13c::12) by BN8PR12MB3620.namprd12.prod.outlook.com (2603:10b6:408:49::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.12; Wed, 26 Jan 2022 10:31:58 +0000 Received: from BYAPR12MB3527.namprd12.prod.outlook.com ([fe80::3dfb:4df1:dcf1:4561]) by BYAPR12MB3527.namprd12.prod.outlook.com ([fe80::3dfb:4df1:dcf1:4561%5]) with mapi id 15.20.4909.017; Wed, 26 Jan 2022 10:31:57 +0000 From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, petrm@nvidia.com, danieller@nvidia.com, vadimp@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next 6/9] mlxsw: core_env: Query and store port module's type during initialization Date: Wed, 26 Jan 2022 12:30:34 +0200 Message-Id: <20220126103037.234986-7-idosch@nvidia.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220126103037.234986-1-idosch@nvidia.com> References: <20220126103037.234986-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR09CA0156.eurprd09.prod.outlook.com (2603:10a6:803:12c::40) To BYAPR12MB3527.namprd12.prod.outlook.com (2603:10b6:a03:13c::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8b4b5986-961d-4c88-d9fc-08d9e0b71443 X-MS-TrafficTypeDiagnostic: BN8PR12MB3620:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3631; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /mi8Yf+x//2Fl17g9gYBLI+MtD+KvQ2ruv4dmOvibXYbDTi/zUAM+RpLlnS/JDmt1SXgs1KEaLMpJI6Wsk7FfJce8zq1KmeqKZGFRnyW5p9SjKrNRvw/XM5MfAJ4/Zg18p38YY6EqjbTy6XlVJbXLGdHP4X90TE7D/Oef+ghdvAUGLYEbBIJdoEytqYvLRXCBJUX6DzSRJ89g3h49KXyigao+62+SWkPkQFhul3+81pC8RBnUuEpxCHLog3dbOMiCLoRqyQh5x+GC3fmakcEVOJUPLedsvHTqkfiupT9z4eHoY6izqqiDT/aCDcckUjLn1XAudYhFPOw1Edd1/ToFvv3OHPijbchjrX3WuaDVBdh0ZTgPcaLY4kY3y48wYW25NdBWQevOMSOkciipjc9TzOvdMh+CpiV6xnaqtco3xTKg5NQ4chRF0NZvOyFXru47LycegF8jewQzZ9hr27zbdqb9TpSMRBWMu7eOH0DoNfLdeAm44rx5uTLeTkprM26sXvE6PPbU2d5uXg8gk01PPArORs8HMj25pSGTx8FI6RQo7HQAqeu9TRB61FrulNbZ8t0lG/UjcclrTcPtS3/p31BccbWXr+NkObdB/c9YQLuhto+K+e3D/aBxiUOh87m+5w6giRfBTBkDaDjJsCIkw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB3527.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(8676002)(26005)(6512007)(8936002)(316002)(2616005)(508600001)(36756003)(186003)(66476007)(38100700002)(6486002)(107886003)(6506007)(4326008)(6916009)(86362001)(1076003)(66556008)(2906002)(6666004)(66946007)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tQCgCTtGU3Ejk+4EX09FLgDqbOK40bTWrp5viEZIenK2kwPQMna/Px0rwwU/lFMzum6VZH9lHW0sFBg9f5QfpdTcMwE3yCRHVvjmfYyrZ7IRDEruQLNVUnsuIGpDS2lv81yctHS7cl/frUvViadNPWe66WlQNgwLJZBMrRR8Xcnt0Unesp5TEeNP7ONIMHRkd3Vs6O1kVGmLjtnEg2xeqkQ7R9Az4KVhs44KIXr5vVjSw2/gdYecEGpa4gq4STcu/UrIXicdhiZV94oKitKeEmlurSVTF/fNgfxWlIYx4keHa5bqlV44G4emulznvpzffbQSeJXwCOiBoQJZJaP+ehSza+5RzeYzpXF+C8ZMd2DIU4T2MH6IL2rzM/6+4wP1UcfS2J5OPg+19ZMIlMUHf1cgrkLh6P3cNC8ISl6/6QRB+8lMnjkIV6KfiQhhNBhhGvP2u+yEnVOMgLNA5M7G48k1aMqlFJ/MuZfCmY+2+zSmqQj9HgwGc8XuuduKAO0VBRh1GxnTMYK3MSzAm9olxyhDm3qaveCAbp7csa2GomNQpXascedlpjYbmFJygH4BfaRkUTVT6gDGtTzuaxemoFloXAlDoQNNkEy1XBzFK3+89IlvMwkQZdMPU+R0a7EEW7zGTGJTViSg5XhWSAUcOhM0o9RhXqrmkJLw8kcpqVGnPG6BiuKKy3y+P0PaJDde64kM6Va65QfAOwNco5F1LeJ+Ui1Kaim9RAOygbqRw8zkjbtRQWdcdMPPN0T3fTGjBwzmU1qC/9Xtifh67hNZB7jNIuQefVDZ0ING0nLLLnkhDyV6mpGNW9rPSw07pnvxkVHwGuQAHmxKnazQBhnQvdOdnfnwneeTiv8mfICJhFSEVWqfEApIx5lX/dYGycx44MDx7ndBtP5IUzRMBoDZyjrWHboZCR5KTpsxnIlE5odmAqI4NVq38FC63RjAovST1WxS0HKeoOuQa8uRYafKQEXanG66yTfEN8whWhZgpXheyME4/boXZdprY5Cx0tAD7g6CaNx8hlaEnFry4I89yzfiIOfDnnKRfw3tmA54Nfh8KVeMrw3SpFhu/P0NUHWtpThG8KykOiZDgkfU+5VD56BpLYP8RQhPnoGZ2QUeP9PhHpXY1qV2RfsA09D0WvE+H0UuVPThVJ+d4axqOgePotoK6uJY0l9MrSyEnlWvaaLopB3wg1qiT/7fBqY2IRBY0iXm6jQMhpoQ1hg0DvLY/6aP7ve4cUhtpzq3uSFK8CvLj0zJT83uOrn5obqXQ2wRhQDVJL3WVV0e05IoiU33IZ8cJDSRv8RXES37fA2Hx2iEn7zCQARyQFMPOqO48JMoi9fC2rd+Kj2rXHEn9q63kyYYqAaxwPw6HmHKuErlBrR4YCza5HoyEhFnyYG4VWfZfuCKXgCGyGWeJQGGyWjjv7tTqcDAWnf7T0O0YdoAy2LIHjNogGPMLB69OWloJ74u21e+0lcbruOtoJN3kfO93TtpY49BjK7hsGYUFxTjWu/y3891CRBliriUur8Cal6/sWCLPeDiVwJXw27SJo20jMSHG9yiIQtrnZhP/ULouU+VLQ4TJNbhA29kp6bCEUST8Uj5tn02ZzAtPksJple2N3RFkbsVYgridRoDvEr6Z5k= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8b4b5986-961d-4c88-d9fc-08d9e0b71443 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB3527.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2022 10:31:57.6232 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BEXV95rJTaThtAdkwwMg8BrChHsjs08k47oTq8r2h+Dd+8Lz20bOA/th99lPYz0hLx9HasedKyFv5Gdhvhu93Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3620 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Danielle Ratson Query and store port module's type during initialization so that it could be later used to determine if certain configurations are allowed based on the type. Signed-off-by: Danielle Ratson Signed-off-by: Ido Schimmel --- .../net/ethernet/mellanox/mlxsw/core_env.c | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_env.c b/drivers/net/ethernet/mellanox/mlxsw/core_env.c index 06b6acc028e0..5a9c98b94b33 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core_env.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core_env.c @@ -18,6 +18,7 @@ struct mlxsw_env_module_info { int num_ports_mapped; int num_ports_up; enum ethtool_module_power_mode_policy power_mode_policy; + enum mlxsw_reg_pmtm_module_type type; }; struct mlxsw_env { @@ -998,6 +999,28 @@ void mlxsw_env_module_port_down(struct mlxsw_core *mlxsw_core, u8 module) } EXPORT_SYMBOL(mlxsw_env_module_port_down); +static int +mlxsw_env_module_type_set(struct mlxsw_core *mlxsw_core) +{ + struct mlxsw_env *mlxsw_env = mlxsw_core_env(mlxsw_core); + int i; + + for (i = 0; i < mlxsw_env->module_count; i++) { + char pmtm_pl[MLXSW_REG_PMTM_LEN]; + int err; + + mlxsw_reg_pmtm_pack(pmtm_pl, 0, i); + err = mlxsw_reg_query(mlxsw_core, MLXSW_REG(pmtm), pmtm_pl); + if (err) + return err; + + mlxsw_env->module_info[i].type = + mlxsw_reg_pmtm_module_type_get(pmtm_pl); + } + + return 0; +} + int mlxsw_env_init(struct mlxsw_core *mlxsw_core, struct mlxsw_env **p_env) { char mgpir_pl[MLXSW_REG_MGPIR_LEN]; @@ -1044,8 +1067,13 @@ int mlxsw_env_init(struct mlxsw_core *mlxsw_core, struct mlxsw_env **p_env) if (err) goto err_temp_event_enable; + err = mlxsw_env_module_type_set(mlxsw_core); + if (err) + goto err_type_set; + return 0; +err_type_set: err_temp_event_enable: err_oper_state_event_enable: mlxsw_env_module_plug_event_unregister(env); From patchwork Wed Jan 26 10:30:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 12724923 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 C94F1C63682 for ; Wed, 26 Jan 2022 10:32:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240040AbiAZKcI (ORCPT ); Wed, 26 Jan 2022 05:32:08 -0500 Received: from mail-mw2nam12on2065.outbound.protection.outlook.com ([40.107.244.65]:2593 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S240051AbiAZKcF (ORCPT ); Wed, 26 Jan 2022 05:32:05 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T6dLaTk2tWS5ecMKjoy6WuZtyKJgNreYNg65icpwYxXvnMkTaPnFQLfJMzEOHQimwOSVoORSz9HvscnTYdEAIApjcww2TwQFrkIChiebSuvPFpisoZjQ6OW35AfDtV5qUmqr/E9MI6rmDLTxkzA3bJ7MPeQfwB4YpGLougxZXQsZ37eYqdYlLTQKBeVkihTSfdV03WnGWApS6N3gjshhCzhPe2tcjm2Ns/4FVjX/gnrl8ZYs0rO163QniDF0ZHmwzhGczL8D48S6TrZB8bc+A8/pL4ISJTAyl40R/BihO/LYfUxe3s3Jtmid0mtmbm24e04HclKWYj1d+0NxM2qaJg== 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=W0+NleJ0WFgXdijaH9a28TOrw7bsk6XXc39hQFrFzE8=; b=QbAnUfBGxumBT7FWu+s2T4UsipakYAOHOYTPv7c7jzk/XF/AVGQfdJZFKX8k/KZZX9+otbJs3Efu44ski+Kw7dRdX+7ut8HkL5Zn6ewv7/b0+lR0jeGSgNjtUB3r+EY1JyRpoGDNFJq6/uVy/0GQk+9roySPqtvXD0jh1VhGV75JDMJfNiFKSE3rRf9VnFmwy+KDsm2h2IPjvrsXMxBCqdkPbyEovvIxZ5j+V1lPRWtARZhvhZ4TlTy7R/UgLg5jY49sNoMQbMbpnX/uNx6QO+c7QjMVEDgsVU8c1dv/RLLixSs7j8e1dgkhPaiD0ng3+zcjvejzs6aKxrgPFTRqJg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=W0+NleJ0WFgXdijaH9a28TOrw7bsk6XXc39hQFrFzE8=; b=bjDv4bkXnlGncg01L6aYjPDQetrXtVsEshcsf8+H9H7O09v2HTu7li1avuHBhm0jJW7483TTtH+T9Pcr8JQUWltNe2MoufJ5YOCcIla9XRy28uguTT4GzGyWw8piT1AOBGNH5UG9ahe3Dim6lTrs4Bg7SSt8GvnTSxu+BjAZ2zxjdvcOis1u378+uq6fjdEISWjIht1vyyQJ8MFaSTHAwQ3tZ1Rx5IzxZOsjLBw2rIPeH7+RGJVG9g7Nve4hqKgy+579mOG8znepHF63W9n8q+lUcDEvQOCg/7wrer1uH0KanS2R+bX0T085Rjjc157tp8KGnJS6Scq38cs0Jc6uQA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BYAPR12MB3527.namprd12.prod.outlook.com (2603:10b6:a03:13c::12) by BN8PR12MB3620.namprd12.prod.outlook.com (2603:10b6:408:49::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.12; Wed, 26 Jan 2022 10:32:03 +0000 Received: from BYAPR12MB3527.namprd12.prod.outlook.com ([fe80::3dfb:4df1:dcf1:4561]) by BYAPR12MB3527.namprd12.prod.outlook.com ([fe80::3dfb:4df1:dcf1:4561%5]) with mapi id 15.20.4909.017; Wed, 26 Jan 2022 10:32:03 +0000 From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, petrm@nvidia.com, danieller@nvidia.com, vadimp@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next 7/9] mlxsw: core_env: Forbid getting module EEPROM on RJ45 ports Date: Wed, 26 Jan 2022 12:30:35 +0200 Message-Id: <20220126103037.234986-8-idosch@nvidia.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220126103037.234986-1-idosch@nvidia.com> References: <20220126103037.234986-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR09CA0151.eurprd09.prod.outlook.com (2603:10a6:803:12c::35) To BYAPR12MB3527.namprd12.prod.outlook.com (2603:10b6:a03:13c::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8606d61c-ed09-4391-7492-08d9e0b717fd X-MS-TrafficTypeDiagnostic: BN8PR12MB3620:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3826; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0QcuAJ5J9iwE64Xvkd1tWsBZ9LzPgPTekxMKdqJJEYTWQtzIkFSb4ylGAfPNSLWT5mijwlmUugxObREs541UBwrLtAgbwC8yMf6EGiURpF95rlo0p9FKTO0pUIfhJKkTFc3nwKPcLz/IBXlSuYHA85r/VQ3qLUD0PaI2b//C2aNxEUyL3Sqr7VgvwYEh8AnsVTXNYnYh/hHmJS7eSE0eCr+jSoloTZkgr0GJ0+LgcCveo+mZxUBC+b1cbp3zVZFLfe0I+e7iXaNIZFh5jY/m/OS+Bps6BIthRsd9k5OC/VDuj1JMTb4XOP51BHiOMcCFkIy9OnLuafxkfPge4IiuW32JTnEOdMs+w5NUXlouuMwBQ8VUfSEPK2ZIOi9Mpbh469FtkohJ/AvgkvEdNeK58lRhGfRmtS6/T5ph82HpDDZNtG0v+LNyk3Q2XzWd37kPWhXTP7HZa4yRLYDd08wL3LrPuDYyPjgfgLuEiV65xL2gRYEF9eftcWAYua6T1rS6xuYNdVIidKxG7QgQdKcQtRXWB/yG9Ap9QtKkCyQlA0KDvp/lZIkJ1WVuB+E8mXv7JdcgVOLhJ1WBw5LuHGb3k9DO/WE9zK1E3pc+g9D2q0mt6ANIGqoUmSoQ/xfhAl7dRKSgZ7vdIPgeN2ClrbH9iw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB3527.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(8676002)(26005)(6512007)(8936002)(316002)(2616005)(508600001)(36756003)(186003)(66476007)(38100700002)(6486002)(107886003)(6506007)(4326008)(6916009)(86362001)(1076003)(66556008)(2906002)(6666004)(66946007)(83380400001)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: y5EtBd0QqKM0IcPU7I5AYsz2KjoictuD5VU/nMW4XHV6IhAkZ4rZ1zijBoJ+Zi8Brc/s5VeKNuo1/YlkQMwmcBYGvy/wtuFzQjjbDIXCJYtUnUu3MxRMxJY/OMC8eyaHQpbMKL7tjsLe5CkBvx93vsUSX5/32gqfgPmfgY/jnn0wJ2SSxJltukAHQMa5QopH9ZZiYyY08uHO2cXj8vW6GUNPURsa6JrpdlXjMXzCR6oIEodwiQom0X7nHsJh7EXeU4aG4bW4l8Mihrs9E259ZijF5ZfK4BDDfmEP3eo+Syjro+CTFiQ7meEIbFKrtetwCfqVi02OR6fweB0hrhMoGzVwakGcy7/9oLt4yaTJvBgYmTS5hFb1GqAaEg+fHYGgu53owwZOs2x5aaFkMlrtjXrVPnywfNbebNYFOkUdWbvewhbqYZ9FBaGUv+7CvrRVNZ69qbUuCJp00GSXHzkcjQDSNuNntF8rqNsu4rKaeXozfSEbYPj7BrK+VHSgpV1z9fUxi8Yk0Qa1R5FGVFAokm5GFle58KifLG0/kQS9bO01TF4jmoxTdhdsmkPE1eZwNGNh0yIEFq23nkbd1+5RfseP9lxP9db9TB6ZeUV9QirpjsTlJtO9SgRL8KuGLizbFP6KnMDvW77iJr7Hw90PSM0QLu3uTinAyzCf9SXBZSdotzcZz8yZhctWS6PMK+hU70MDnqjRstI1y9CL9ApsVRa+cF0bQwWCiolvIizoLhPSc8Bo4RX0j9peoObcSH7FkRd7CHloB9YtWeUOtTFeNdpuQ/5iHPhAfKH4qclbnCYw5lXeSnZEKfC1zlAfkUXWnZbG150kKMQP5WnEaWgWGSaBAPvDFa1P+4EFpmwqJLFaRnwKEJyk3cxGajoZ5esppfmMLwgFHyGMWzYUGBHiMh2+FdGORc8OAl4r3Fi7wVIt7tPDrU6vwrVXhShSx66Q2zO+Lue8JhhQlWn5Uo15lAWBiqcTSjbpkiJi7inUL7q4uoM7e9GKBYXH50dR2XiH7SLfAArBcMmEFhp3c16ZtCRqWR8eIdD+QEAKgiESdfT7BuQ2ICBiHBfNpVmgQFUDkwwnDBLHIfENTZsRSLnfmNo0fDGq80DBS3dSoeOMqWlXUrOTHXpudws7ryedqubsyX/XvWdnw+y7q5+E5xOJLCgYme0aBj3XC4gC0Q8roWDM6UEC47xSvnMZZDyzyha+F1sg7bnV9jajmC50+Qp3P78y0QIqXqyU5nInbeSvkIXcHXgHPWDGAfL0x2ODlqAwnnRYfLBFICXPYe82JoLz+1usE9io7oARQ6pQa7q9R0tyhSXh/0OBrfMQPhI/Li+9kvrAj0Jpxpjzo7BCFXoKWG/vFyLhHjyVTVmc2jVeb4sLIwl4AdOB1z7G7tG5B+84zVy5lW4boekSbJ4/6BjNP5JEmmYYTv/CtO7ugC2rXRKwFP6vUxWMsbdF1S7PvSM4HvUNbgesrpOaNry6ITp5uYIwV4SqPiKDa+PM3gdmsXIrwpkvbc5muZqWV+3NwN0A0HIwcKUFqwks92CPvAPivR2QEVCVtZuD5JpIfNtHei+GWFDvwR2vdDU9FC/+r/lb7Vf0audxhAfK0GZfRzpNZfd1Cbt/eewGpiZ2iLcvyXY= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8606d61c-ed09-4391-7492-08d9e0b717fd X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB3527.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2022 10:32:03.7790 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NeX1QWl0pnwMrb5DKb06otsfg+M8zounM49lSUtQZ8+zt04YhPNBGjbF4p77LEN/tdm9LXUgfM2hCN5Y3lwhjQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3620 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Danielle Ratson MCIA (Management Cable Info Access) register is not supported on RJ45 ports, so getting module EEPROM should be rejected. Therefore, before trying to access this register, validate the port module type that was queried during initialization and return an error to user space in case the port module type is RJ45 (twisted pair). Examples for output when trying to get EEPROM module: Using netlink: # ethtool -m swp1 netlink error: mlxsw_core: EEPROM is not equipped on port module type netlink error: Invalid argument Using IOCTL: # ethtool -m swp1 Cannot get module EEPROM information: Invalid argument $ dmesg mlxsw_spectrum 0000:03:00.0 swp1: EEPROM is not equipped on port module type Signed-off-by: Danielle Ratson Signed-off-by: Ido Schimmel --- .../net/ethernet/mellanox/mlxsw/core_env.c | 52 +++++++++++++++++-- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_env.c b/drivers/net/ethernet/mellanox/mlxsw/core_env.c index 5a9c98b94b33..b63e66b7e2b1 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core_env.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core_env.c @@ -28,14 +28,47 @@ struct mlxsw_env { struct mlxsw_env_module_info module_info[]; }; -static int mlxsw_env_validate_cable_ident(struct mlxsw_core *core, int id, - bool *qsfp, bool *cmis) +static int __mlxsw_env_validate_module_type(struct mlxsw_core *core, u8 module) +{ + struct mlxsw_env *mlxsw_env = mlxsw_core_env(core); + int err; + + switch (mlxsw_env->module_info[module].type) { + case MLXSW_REG_PMTM_MODULE_TYPE_TWISTED_PAIR: + err = -EINVAL; + break; + default: + err = 0; + } + + return err; +} + +static int mlxsw_env_validate_module_type(struct mlxsw_core *core, u8 module) +{ + struct mlxsw_env *mlxsw_env = mlxsw_core_env(core); + int err; + + mutex_lock(&mlxsw_env->module_info_lock); + err = __mlxsw_env_validate_module_type(core, module); + mutex_unlock(&mlxsw_env->module_info_lock); + + return err; +} + +static int +mlxsw_env_validate_cable_ident(struct mlxsw_core *core, int id, bool *qsfp, + bool *cmis) { char mcia_pl[MLXSW_REG_MCIA_LEN]; char *eeprom_tmp; u8 ident; int err; + err = mlxsw_env_validate_module_type(core, id); + if (err) + return err; + mlxsw_reg_mcia_pack(mcia_pl, id, 0, MLXSW_REG_MCIA_PAGE0_LO_OFF, 0, 1, MLXSW_REG_MCIA_I2C_ADDR_LOW); err = mlxsw_reg_query(core, MLXSW_REG(mcia), mcia_pl); @@ -217,6 +250,13 @@ int mlxsw_env_get_module_info(struct net_device *netdev, unsigned int read_size; int err; + err = mlxsw_env_validate_module_type(mlxsw_core, module); + if (err) { + netdev_err(netdev, + "EEPROM is not equipped on port module type"); + return err; + } + err = mlxsw_env_query_module_eeprom(mlxsw_core, module, 0, offset, module_info, false, &read_size); if (err) @@ -358,6 +398,13 @@ mlxsw_env_get_module_eeprom_by_page(struct mlxsw_core *mlxsw_core, u8 module, { u32 bytes_read = 0; u16 device_addr; + int err; + + err = mlxsw_env_validate_module_type(mlxsw_core, module); + if (err) { + NL_SET_ERR_MSG_MOD(extack, "EEPROM is not equipped on port module type"); + return err; + } /* Offset cannot be larger than 2 * ETH_MODULE_EEPROM_PAGE_LEN */ device_addr = page->offset; @@ -366,7 +413,6 @@ mlxsw_env_get_module_eeprom_by_page(struct mlxsw_core *mlxsw_core, u8 module, char mcia_pl[MLXSW_REG_MCIA_LEN]; char *eeprom_tmp; u8 size; - int err; size = min_t(u8, page->length - bytes_read, MLXSW_REG_MCIA_EEPROM_SIZE); From patchwork Wed Jan 26 10:30:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 12724924 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 4DE3AC2BA4C for ; Wed, 26 Jan 2022 10:32:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240019AbiAZKcV (ORCPT ); Wed, 26 Jan 2022 05:32:21 -0500 Received: from mail-mw2nam12on2053.outbound.protection.outlook.com ([40.107.244.53]:38710 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S240022AbiAZKcM (ORCPT ); Wed, 26 Jan 2022 05:32:12 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PYajfYgWF5sWmWD0IxjUzgB4VmIsUTzIssT9toTCuboexap9o9Pyi8hLqzXHjq8m/wqZq5PwWrB2eIiJpNXXtWZ+fY34o1estLlnc0TeAnUg1n0dnPoNrSBUJdMvJFovREO+LJOs9uqG75+5bm9sKTUAw/ApBcENtTvuVPo1L05n+TJFKZ93+cFduxaVa1NxdtmvBSHFVoUjlfSDmgNOF2SogtHekEnrTQygWoOUpRLI/YioW21b4Kar5fQW5NHHlYua/eyprxw6P9lrC61Brfilyt8GOXUaLKofEqj9k8p4LhGxF7lPh0ArsIuykoEvymW9UuXo4nNvBEhLd2cNxQ== 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=632JOpyC55vp2OTBfszsoyIcEJc3fg9fjY/74GTAuJ8=; b=GF51rrVXdrauGYLbxD1JhRpF8jM8UQ7gsSu3ENA6jIkxRtv2Hpvdj2AtVYFbgusyiAffadAMsJD5isCHl4ooAP3ZJKYo+SxZbwHT5C5Almw3FwTuqzcqMjQmN36CW9jEvXYfSg6nOHsivEybwJoUn5OB1xaS5CdKMvMLBVKPfZ6ztRfHna96eLz4kylVRFcvXKPZZW/6jNfzD9C5+k7Ss+s3fMzGmC1s87wkqA4wi3JSFMxoSPH5I1XX7e7CNbtn4ZZkkPouMh31a0JBO13IcAbW6CdWyNOdUvccVPFAjBoBaBv6sVFlZiDU8o2czb4Xhj/A21du0Eo/rNQp6HRsyg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=632JOpyC55vp2OTBfszsoyIcEJc3fg9fjY/74GTAuJ8=; b=S4Hj6FbGqdPm4+J0jsJNoAfUJHbsoj/08k/XdKQSsD9ij/SHy5i8P5epYuBCq49BuqK1db5nacqIqN0fv2+n7ZwAb88cqmvd1YrlEtSd5MKwT2g/UUTGGoKRax5Vt2Y4BEfde0rBWTrbTzwbQsfQBgtR3Xh793E3NpT3fo+k0rs7+gO/JfVzxNWQ2a3XVha599c4bcslmSLEoRCpBDPmtxla+X+5YoeJOTiSnXjCRkJlDidK6Pcjp7dAsPDhM7s/VwWW554jwwynt8g3MW1RdVkwBqXTfPndpSRLCUj4D5OnkAbgqHFimyhhqRAd6yQTfEUsjitY7iRfqCQun0LS7w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BYAPR12MB3527.namprd12.prod.outlook.com (2603:10b6:a03:13c::12) by BN8PR12MB3620.namprd12.prod.outlook.com (2603:10b6:408:49::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.12; Wed, 26 Jan 2022 10:32:10 +0000 Received: from BYAPR12MB3527.namprd12.prod.outlook.com ([fe80::3dfb:4df1:dcf1:4561]) by BYAPR12MB3527.namprd12.prod.outlook.com ([fe80::3dfb:4df1:dcf1:4561%5]) with mapi id 15.20.4909.017; Wed, 26 Jan 2022 10:32:10 +0000 From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, petrm@nvidia.com, danieller@nvidia.com, vadimp@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next 8/9] mlxsw: core_env: Forbid power mode set and get on RJ45 ports Date: Wed, 26 Jan 2022 12:30:36 +0200 Message-Id: <20220126103037.234986-9-idosch@nvidia.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220126103037.234986-1-idosch@nvidia.com> References: <20220126103037.234986-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR0701CA0071.eurprd07.prod.outlook.com (2603:10a6:800:5f::33) To BYAPR12MB3527.namprd12.prod.outlook.com (2603:10b6:a03:13c::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 96a3e71a-7f46-4584-f29b-08d9e0b71c3e X-MS-TrafficTypeDiagnostic: BN8PR12MB3620:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2803; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LIoIZEaV1f8nhx3m9cnU5uEz6fkT7SUXdAUtOn3IUvDPNy8jTUZP4kFF9X6dVij9ZpXbcBKVOz73NXLNqk6MMExtJU1PnetktB1hQLGZbZVPA8iv6hKh6yCLmnpHdaaiAllWxIanEflafLtJJ68kXOYBPxHue87jJole246nGMzG/2qbZs9GIABSh3Dry1G0HnTb/CFhL6bcpflCsxf/fcOe01xVUvhnIhWau4HXbIidXJiZwtNAhlDXZSO41I7tbUqgC1RiZRKKE7vuPN9jDD/g0jhkuAbHAeSnLui+W8U2HV2Bh51vDFYh/GIk4MI66jWqUgZOfLY5UWcdR6HFEskn5MknMp3PZNM5tHfCEWcaifLfabh/oZiVRcmpS5+TcwvsF6l932Bc7KINU1MDVTQfo50+lBrprX0Njkj/SEgxvaLS1UIydQbTxKWpQH/F1JG0P/WbxRh0rUn3C8nMnSRCEh1gBl+hFQiMoqxh3AkTwBVef3v/dnngBNhEgeUIuukKEEt4EmxTMp+lgWTeum1OHDmUx1q7m6h8sx72cHpacShlS0XdGGOP0F1ENYDo5Ok+e5MZEwZdEvU0sk1iwfIaMk/uQcexUjQ4XbLBOSvD++OebAXCXQTuDdPJmWJYgaTLs+PntT6blO3VhtWbxw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB3527.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(8676002)(26005)(6512007)(8936002)(316002)(2616005)(508600001)(36756003)(186003)(66476007)(38100700002)(6486002)(107886003)(6506007)(4326008)(6916009)(86362001)(1076003)(66556008)(2906002)(6666004)(66946007)(83380400001)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zor5jJSvQOYepoclcR8GjKstubmJaWo0wSiM3bfZK6XE+n5noIyqQ2VAwdKdrA2IEOQwS2NmN8yf3aKmcPIRMq3OPElMj36A4XTblUom6viAo5DI8cZniQfCWwvGCqZZZUdNIcxLXTt+sUgYlNDfJjWPm/8auB7PRFvSR8+6ewa8Kgo6fWjcGki7TGzA44W9Y6ENS1xxX3hv8rmOQyqqu5LESrdY6i1WV4ILHBkCJ4/EZYtWoWUiDfvOk8FBI8N80Go6D5/I9VnWAkS+N4vx7W8iAdsStvTaeDBQXKdoxjiU91KrPTy2FW4Z2wcOIogGutjbMOcUqe9EuuSVYb1o91JTgtzfLunLLU/m5qcxdj5rKrtoLjwI7znRahizojEMsDueBDaGfP2Gb/9yAE5oSIWnRy1B6Y60UoFDjmIl1NW+JdRB5iVn4rQU0Jg/14btBET8XKKt7DQYcXNt7PUMjU/+qb7Zb+0vBEbQVyjl5wVsC6mbdsnHUdMi0qhUVzXLIOkZlI5JDQKGaSPaFmHvlWmpJhPaykicxqnKwHvojqP5nws8s2DQqEa14NGRAn18yVRW3zWmGZ66W1QW73hgAiuxZyHyqqH896UYP591TB7+C4nzB1WloQMeVIkgp2hLVqRHZLWp8r5E+9yFPs3ak4+Cu28eY7RhdFMn7KOvzp5OftFB0165FqkmEg2Ngpi9j1ZUx1Bk1UEeYe0FnASOn8BX7s36t7tw3VUDS4xrREuy3TFJQ0Os5uiMtKsG3tIPB6SwOGwmdEQhoYDtFnfDKPUvjn1DZvoic9AmFExZiZNq7mvvd+I0u/9OfueMTqKuuHh4/4kcWKoz+3Uidbt6P6nr/YxyynTDrVGCbjENklykav8gOC/hI13G/kCt+W7mZB2qsQtHajp22QzE5aGG5bSR/9iaR3i4te78cKXcYB5ZMB11+mLU+NucQNJFvb9yTGp4RQjv6sXv21CsWzhNpZIwPvBpiMRxVhtkeRJ/i14Fsyxj11ac9kUbEJN9nEjl1YUdc3MRKhy7zTxSbVihzMb4Ifoo6J0JJr3B4rx8SxmhO/I58HlM+30qHB2aMO1Hqb7aEQErLAXCd06q42dyGgTXDkO6gk3ZIthHjEMPab93HQzSejB23alY+DJGe13ds9lM5g8JppLOTyyUQAcsRq9620urdYORX7964zO6Y2GS7ZOgFrFMIeGclafSBYWBD/5VfSYBdjA3aMPVNBBUL7ZUYQp26uh+/XHsIqB6adxgShvtMPfAC5CE4jYi/wOYy7W6NoBpJpVzlVO1ztz5aYpdO1m1wqHaDm9GtQ6zuuGRJDS5VCjITcyjxGLDEzcXgNXRgwo/JCTtv9JQ1JM9+aNRMbg8Deio/dDxx820b1mPCI58w2fP8fdVTJLHwvDlRRF+tiDVdGRW19CUmucm5nWttpXiP1H+bsMXpe+pponChJPnTVmZj8g2zidvqF3mB0nHGIcSEOB6bQyAm8HbEz6wfEZ6+6K3zAZhrqClLmG83tskUsai7riJEQHD7eQyb2+JpGfNzS9QAsOW2RwH+r3vuZzAq//7XU6MwbYOEEiRK5iP6hHDhnldTpwCL9H/I/6pkchNj+4IK1aN7m7IZM4c7+Vzx6FyhbS0xJOEgo4= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 96a3e71a-7f46-4584-f29b-08d9e0b71c3e X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB3527.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2022 10:32:10.8410 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: FoSCz8qe1LIkZUD2YSsL8zzdovu97CaqleXnB34vlZN8G+qePDbfF5nqDnBT02APzc6bJw2rhlLhrl6FVlLkRQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3620 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Danielle Ratson PMMP (Port Module Memory Map Properties) and MCION (Management Cable IO and Notifications) registers are not supported on RJ45 ports, so setting and getting power mode should be rejected. Therefore, before trying to access those registers, validate the port module type that was queried during initialization and return an error to user space in case the port module type is RJ45 (twisted pair). Set output example: # ethtool --set-module swp1 power-mode-policy auto netlink error: mlxsw_core: Power mode is not supported on port module type netlink error: Invalid argument Get output example: $ ethtool --show-module swp11 netlink error: mlxsw_core: Power mode is not supported on port module type netlink error: Invalid argument Signed-off-by: Danielle Ratson Signed-off-by: Ido Schimmel --- drivers/net/ethernet/mellanox/mlxsw/core_env.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_env.c b/drivers/net/ethernet/mellanox/mlxsw/core_env.c index b63e66b7e2b1..b34de64a4082 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core_env.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core_env.c @@ -509,6 +509,12 @@ mlxsw_env_get_module_power_mode(struct mlxsw_core *mlxsw_core, u8 module, mutex_lock(&mlxsw_env->module_info_lock); + err = __mlxsw_env_validate_module_type(mlxsw_core, module); + if (err) { + NL_SET_ERR_MSG_MOD(extack, "Power mode is not supported on port module type"); + goto out; + } + params->policy = mlxsw_env->module_info[module].power_mode_policy; mlxsw_reg_mcion_pack(mcion_pl, module); @@ -619,6 +625,13 @@ mlxsw_env_set_module_power_mode(struct mlxsw_core *mlxsw_core, u8 module, mutex_lock(&mlxsw_env->module_info_lock); + err = __mlxsw_env_validate_module_type(mlxsw_core, module); + if (err) { + NL_SET_ERR_MSG_MOD(extack, + "Power mode set is not supported on port module type"); + goto out; + } + if (mlxsw_env->module_info[module].power_mode_policy == policy) goto out; From patchwork Wed Jan 26 10:30:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 12724925 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 877F7C28CF5 for ; Wed, 26 Jan 2022 10:32:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240025AbiAZKcY (ORCPT ); Wed, 26 Jan 2022 05:32:24 -0500 Received: from mail-mw2nam12on2053.outbound.protection.outlook.com ([40.107.244.53]:38710 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S240017AbiAZKcV (ORCPT ); Wed, 26 Jan 2022 05:32:21 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dBZFz8QlBUkMIFTeX+nAi/Wqe3FmzrOFmjmqNSDhzv5jUKUF3fEKYRAW1XNuGtUYasQFi2LGntJvMS8j/lxLi8kKQ9oE4EvB2PlqS0IdFFb9SnjFlu87se5FxEFC5B9y1PUf5163YYHy3PI3bwQWWDDWlsfQ9Vf2dUzSR+86tKshtGDXTsVU2XIhMrYOIdiMrDRtFe+Ue1okbwbgVPDPcatEYsu53RYybijdt7kK8skxRQPbF+COd4HJQ+que72JPu3T7EPAI3BK4Rcg53oSEJxDIsC/ThBWvN8cyrB2e1WCb84H8t9V64G/jGBIamwhHeV6zzGFWUXTCwmmeoyOPg== 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=gxMwLKZe8RZ4OKhxyiu2wixQuuaaP2gVGCtxMgUG+no=; b=Z8gxUJqcA67ZsEppC8bp4HR55lF1rB9So2eLMgyDTNzKUfeZNl3zRCfXcNtKC0nXSxZgC/rSinS+/IQuMtcLDPgRhhWCnm2IOE4il31hlAyYk4oq/8BKzPSE3eEKkptXN7Sqdj+ftPLwlnXFRiaH9x/nUkpNMvIfGGBnptj8+jjU8x5sTJmKeK4V3v2pWumSD33u31aMdOriVUzpQ+kPuCZFIDDYF1wk244/CiLZ0JyqIkFcgRSDLl1F7iVS/sS2SMt39kNRRiIymPDecWJY85b8Q61tLom7qXJ0fagV2rVTdlWoEkc1zIvSUNv+LHwRkDX1VTA6fo/ZxF0L3OSbGQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gxMwLKZe8RZ4OKhxyiu2wixQuuaaP2gVGCtxMgUG+no=; b=BaocvN32OKSF7+50SFHG/SbT8R/WoVXiqH9uB+NI2gD/avFsl1B8sI/5d26EAenCAa+WjnZWiIwg9avtbsEjHQDMs1tLZ/MP0hzw6x8GGCJL0HMkwTtBLCKtyCPuph/h3YMXrH4AFZyzyXxluEcX1hsGRn+0mgm0oPqkKQFUaEfhdqaK3zxQNFQZSt8nXMxxTD3FsD8qp2pNmLu5BhX3ydRTXKfrR9XQyw0TdfNTbq+7wxgK50QI2gl1bn0KC12HpaHeVbkXgyc+u7xYlOE8K5IaQCy81Kro7h57GCED7ymMsfA6hi+8pmfywecoArPzZuKhf+50h3tyj9Q1n1hE3A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BYAPR12MB3527.namprd12.prod.outlook.com (2603:10b6:a03:13c::12) by BN8PR12MB3620.namprd12.prod.outlook.com (2603:10b6:408:49::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.12; Wed, 26 Jan 2022 10:32:18 +0000 Received: from BYAPR12MB3527.namprd12.prod.outlook.com ([fe80::3dfb:4df1:dcf1:4561]) by BYAPR12MB3527.namprd12.prod.outlook.com ([fe80::3dfb:4df1:dcf1:4561%5]) with mapi id 15.20.4909.017; Wed, 26 Jan 2022 10:32:18 +0000 From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, petrm@nvidia.com, danieller@nvidia.com, vadimp@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next 9/9] mlxsw: core_env: Forbid module reset on RJ45 ports Date: Wed, 26 Jan 2022 12:30:37 +0200 Message-Id: <20220126103037.234986-10-idosch@nvidia.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220126103037.234986-1-idosch@nvidia.com> References: <20220126103037.234986-1-idosch@nvidia.com> X-ClientProxiedBy: VI1P189CA0015.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::28) To BYAPR12MB3527.namprd12.prod.outlook.com (2603:10b6:a03:13c::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c40c98e2-f48e-48ab-d503-08d9e0b72063 X-MS-TrafficTypeDiagnostic: BN8PR12MB3620:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aPe0y/bbuAFh4SyEOygpK4/PYmhBdzyOmJiJtkYOSZ6+cvSu5VupfVlbSBsxfcV1OMiM60FWVsrHK3DYZW6RdgwIp/Ai8rGP2j/VYUfioXdldWRJyQnDusw10/APXQlZuQLJUWbse/4gvnUYOOVbSknckTbuv0myM2/dC28iPIBh0lqP8Nq6UVU6DfzLQvXbNKMOv1n5sNqLfCVgbHHLtX+EcS0ayYD+WEYTGoF/ak9uM5trgroGU13MJCC+BfY57pVvs5QYVktcw3hjAcG8RQxoCYg3b90f/T2YtE7GitoD2C8/MALq3eOghBTvTCN4aJqgdIVZaeyAj1qeU0uyEzpwcdfStOp/mXX/MnoseotPNAbrIp6VPslQ38PSrrp6aOdoVUiPbg+hbxAe24FyoV5XWyLQ2k26z8yyglUngDn7Ms7He2z0yshS06SpPYUH269BjQvlnOqlMpJG60xhJtWD2B8/h4f656KJrypk/OEIRaMjnQgNQhwVi4cOdDyxBIZHW2Zag+R8EM/ojIUHisykQ83Y6znQMzvdnEIfVrQWJeDKgdCyUr4MevKSCEplt4jUNQ/5nIQ6XQEk20b7xqSo658RoQozctQVTTMO/BaFbkqGXhTb88TMBJ8gMuwodlvCC3J2TUzH9GqjOWllvg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB3527.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(8676002)(26005)(6512007)(8936002)(316002)(2616005)(508600001)(36756003)(186003)(66476007)(38100700002)(6486002)(107886003)(6506007)(4326008)(6916009)(86362001)(1076003)(66556008)(2906002)(6666004)(66946007)(83380400001)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wn4/Quj6oEns9waqSBLJtPkdX2bJ53dzkPx095wxXsrLgYlu8QVUzGOXgwYkN+0tBVbx10bxnxmcLWaSELIzw8G4Dp2gTawPDYRU6k8Fh43HWhEYHoPTbqZBi68szy4h6EC3MIa6p3R777P8KgWzTOZ090gyz/tdWKgD+rTCEBXHb7P9zt3sqia9FUbRNDHc8gnKCTef+LaMGw8tpwEDdd9hLmsksUGI5roG7aOCwzIaugwyVsS0axU9bnN1jR6Jve7h0VuFFozrgYO6FASK83fWHUycHSLMG8lxmUTvuWVJcM16fJznucaZ4HHt+m9FcAJwLpSO/cqDt8omW0Qno4WAOWEPF7vOhfhKDWaI7ZgaD9o3WgGnHzPRgYK70KUtOZOvE0VJunFSj2q0xujSxvCT+IeKAV1O5gG+fWuswztnxL0hNo3z541OyzHLGFv2OFkuuJZvnaI1ImCRiPiBRZLfqpZpQM24FUQ7tT12xA7rig05LroVfI+R3qzgEqsfsCJ1nWSH274LByrWqor0HMa7ELtWPUELE49Oe7wRNKxozG4ECt6cUaFDGI7iCFTkKZOrymYqWjIl0jpVp0uddkdk9gKFDeBnF47XMvrWLK+S2rq9dA2U7EKt96RdvMWTllo5WofSqnwmx4KChLN6AulN5k7PEtUVFmEJjHKxxKd3FAFGZUx2dnXzYqlY7ZkOHIwfpRIVfVm+SL6LRMUpF4SVsIBp+jON2BUF4vAhvQpn4/HMkqrWFzNDNiE2UiQ5kDFGxdlbbqnfnUlyAUANZalvQFBOXVHKP+xQCdiQtIhmwKdPlQyMkD0elHywHTkWw/cE248DaV9xo9g2OLC7lvN0XpwHMfiFE/AkH/9mSG91PX8si7k/E7aBIpA4bxNHJwl8nfJE2zCGrHwddjYWp8Bq2qotDhFl8XsWhGaWf6dunkVZNdMAbmuYonJPpzFGfyrgcRDxWp2Qcn9xHVCCPFomStoClxTt+sdBB8ECFiuwNLbKheRxQuftOQRXyQr32pK6UrV4PO+hi/B+NhOGH3Js3YLtYKa40y9Ayd1+RXSkFijL4npgHwIw7jy15GdBG+s3uKsl1nzHDcAucpTEWxQDvDt5V5HefaZKb4CphC7ki47oakEAwfEZa2bcyDel5QpayqV/uFluvJNwgxLvmkziX8pk2Ai/ZZ4IqQjP2R76mDerCH56hlAaAVI3bpo/ZNYTlYh3uIHee4oRhiWEvjwcua27ovLg9mhXEQFddCLIp4WOcnb793AOZklvcKZLvuvGrVZKtce1ItnbXCfwnsvr3G463iPyB/5wfurwmZftBBEIPdO22gzia5OARELcBtRMSnjKnI57SmWuZRtcWTXeyjVXykT/2AzLvYxUdIO2S5R8BUJtJhIfdLOi1I8AJBruFPVo1iipcsdx0LHrh2Wxrnai8QLwI2BNeknnLCmJGKLTayLqzUFTejA6CXdtOp2mR0Tx2ChraCMW1FFOdZ3m24ofAlUl6pW5bu6Fge+C49pbPygJAepCLf45n7jdQH6bgWc/B1+LkWPUNo667iHm5/V48dQNnGS5Ssi8kY7rf3NHCnxub8tRzDjJZ2XfgF5UHL+0fyqR98RweRMkMYX/+m4lv2Y9QeYpX3ki8sg= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: c40c98e2-f48e-48ab-d503-08d9e0b72063 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB3527.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2022 10:32:17.8092 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: PWRuxUT7WciP85USpbJ4/MeBW8ckqqglFdNVPmMtCWvlRT+hknEYlE8W4oeSaluVaFVdG7Ag36cxHoaDuuCdsg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3620 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Danielle Ratson Transceiver module reset through 'rst' field in PMAOS register is not supported on RJ45 ports, so module reset should be rejected. Therefore, before trying to access this field, validate the port module type that was queried during initialization and return an error to user space in case the port module type is RJ45 (twisted pair). Output example: # ethtool --reset swp11 phy ETHTOOL_RESET 0x40 Cannot issue ETHTOOL_RESET: Invalid argument $ dmesg mlxsw_spectrum 0000:03:00.0 swp11: Reset module is not supported on port module type Signed-off-by: Danielle Ratson Signed-off-by: Ido Schimmel --- drivers/net/ethernet/mellanox/mlxsw/core_env.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_env.c b/drivers/net/ethernet/mellanox/mlxsw/core_env.c index b34de64a4082..4e3de2846205 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core_env.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core_env.c @@ -467,6 +467,12 @@ int mlxsw_env_reset_module(struct net_device *netdev, mutex_lock(&mlxsw_env->module_info_lock); + err = __mlxsw_env_validate_module_type(mlxsw_core, module); + if (err) { + netdev_err(netdev, "Reset module is not supported on port module type\n"); + goto out; + } + if (mlxsw_env->module_info[module].num_ports_up) { netdev_err(netdev, "Cannot reset module when ports using it are administratively up\n"); err = -EINVAL;