From patchwork Thu Mar 30 18:38:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Roulin X-Patchwork-Id: 13194728 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 02991C77B62 for ; Thu, 30 Mar 2023 18:38:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231439AbjC3Sid (ORCPT ); Thu, 30 Mar 2023 14:38:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231433AbjC3Sib (ORCPT ); Thu, 30 Mar 2023 14:38:31 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2060.outbound.protection.outlook.com [40.107.92.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F439AD14 for ; Thu, 30 Mar 2023 11:38:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XrClhVYr0KtR5UAPXbJHCjPuD4LkIqtfT69DYoPM7+tqXIS1P+fw9jfh/q2a2ez3VuZOCxrB5wMgyVqhpWt8waLScQZQ7m0X9GyrkUiDK7F6QFU/Hoyf3V4j31D+p4CC2GobSuSp+SRqH78gCfxWmWN1Sn6RCAgszUWmK5JxBIKWhOFlu6yWaNQ0Ezoh/aXpv3uKE7u4Rmx/2KBfZNL/oF0NnOZZLsz1NrieyC0rYvHlRHYU3V9uP2le62QU90fh27QaIWyU3zBXAEzDKi7/MbOqqLwgU6R9lgr0DZtV6frkjUcAUle9Gz0Jaf4Uce9rU6Xpo5Oc6rwVvwHxqsW63w== 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=SyVH1QBmP9LLaQVgemarr8zduIzdlY2exjL2N7i0zaw=; b=TF1OxpDy8SaClbY3R6s5IA07IFoTi9OziSuWjJQTWfVQBNze++SZF0cbvZ+uakGdA0pjbN4nS3sp6ULcyEkGXcI8zKPV23AkjO3VI879CngTatB7R+2pVOUkQin0gqX9fCx+hSqPNxhyCIuq3UVd7liUIdQzzpwhPlvn44yr5V0XlhNPPVJQD+cI8a1hMRZaSHcG9OLifoB/qqSwekEgGgmBDt7MRRt1oCYR0DvAGWBOgMqHn2KyRLCTpb5YxeiwO9zsq1KhVYnAG7WohZD3lVhU0qj0EWtM7iksgtGOsc4X9ExT0oWZu+T9TvAuVVKCiGfy2fGZ8pC7XR6k++QSvA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; 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=SyVH1QBmP9LLaQVgemarr8zduIzdlY2exjL2N7i0zaw=; b=fAvBsy18fdBL5rxrl58nyy7jlgDMSKLPxy1VUMFmvUteEUmfJHczcIrEhMY+x9p6xe1h6GD4BNpvYQiz+YWU8e4WPJf0FlPyleJFGcsUrPGWh77IHMR680OrWSZbYiZWHUaJCAhH3ZtZCloCMmOfjsE/z93oLO88zTn1l2ox0a8HNzhWvUJKTN25m0o49Xu5sRTOhRHs0OgHpg8cxcrUWhBn633MKBeGxorcbSHzIoWBDXYZkfVxZ5j6pd7w9DPf1ubL/F8n1c40iKin0dkzSCflDumnsSeCJKJJqyl9tRugOeNZphJeM203Lk1laSQJo7z0IQn/SMTxPkbM20bZCA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BYAPR12MB3127.namprd12.prod.outlook.com (2603:10b6:a03:d8::33) by DM4PR12MB6544.namprd12.prod.outlook.com (2603:10b6:8:8d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.22; Thu, 30 Mar 2023 18:38:28 +0000 Received: from BYAPR12MB3127.namprd12.prod.outlook.com ([fe80::ebc5:c372:d99a:fdb5]) by BYAPR12MB3127.namprd12.prod.outlook.com ([fe80::ebc5:c372:d99a:fdb5%4]) with mapi id 15.20.6222.033; Thu, 30 Mar 2023 18:38:28 +0000 Message-ID: <659c7c1d-6aa9-0d90-00e4-7a6025ae40b5@nvidia.com> Date: Thu, 30 Mar 2023 11:38:26 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Content-Language: en-US To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, jiri@nvidia.com, andrew@lunn.ch, f.fainelli@gmail.com, mkubecek@suse.cz, mlxsw@nvidia.com, idosch@nvidia.com, Danielle Ratson From: Andy Roulin Subject: [PATCH net] ethtool: reset #lanes when lanes is omitted X-ClientProxiedBy: BYAPR11CA0048.namprd11.prod.outlook.com (2603:10b6:a03:80::25) To BYAPR12MB3127.namprd12.prod.outlook.com (2603:10b6:a03:d8::33) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR12MB3127:EE_|DM4PR12MB6544:EE_ X-MS-Office365-Filtering-Correlation-Id: 4e9aa569-9a55-4293-680b-08db314df408 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QpfnxYFfu/pTCxTkkv+3uaGztyOC5pprNVFhuJkZ4Rb6n5gR4IMy6x/oqQrDec8zQlBoz4yjvTKRMzWj2SX+UPIJn1w1DKXtmQw32i9PX991CrQ1gwf9qNIYS0z+cUzu3OP92CDDqGH15m78SmxsuzvaICCDOZITVSQnO+gExBfrDI0n+zBOXVr9iaAeqNwQI9M7UttiiKLqQZSOzgvO+V0bcHwUfqwfy32OQ3MaL+z4Dzd6CnoHkJ5+XAtoNtbXmAxfE6E3vJ2zYw4MsiC56p0oepxkgk1ygtekEq0jM95nFFxaEzxZHycaDwl8dr46QsbBsT3ev/7g/6PgXe5JCOmrFKQ4pdvRVseo3Y+Xrlga1lM1ZP0Ty5fjWkPlyavn8+XulaU71D4HNzUBOJkNeA69VzIoLrDiIRTTphYb+E7/zBsLkzQgovFw6YS4OjYrz5ZWB/MWFfjVVJmFdIdIQwmOjP7nisLGvDvEk+zobYUDVnBBCEM9IZSLgv9nx2ZzmY+Ant95rGCSp0L1hxUMIBWRi3IHi3RZ52nCyG+ZseaHgq2Cgc9wXfgSt/+deOx+MBBn8tl5FWLpEVKWpwE0LJ9aylK74yLzHeDE+Vk3qcPVVPjbQBymSSY+IqtuelNbYtsxDaVEEnPCFZTeuGYHFQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB3127.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(366004)(136003)(39860400002)(346002)(376002)(451199021)(6486002)(478600001)(31696002)(86362001)(38100700002)(36756003)(2616005)(107886003)(83380400001)(186003)(6512007)(6506007)(26005)(41300700001)(31686004)(2906002)(8936002)(5660300002)(316002)(8676002)(6916009)(66476007)(4326008)(66556008)(66946007)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Ca6xzg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92aJu6VjKZQP1PphsgF?= =?utf-8?q?QTtb4FVu2G5RhSMW1AmDX4ZTHOqJ0ajAsNqZRZReIjcCbXOsQooGi7AZF0gayjx/I?= =?utf-8?q?Zv377TpAcb0c/h5g48VZZBEFmCwi39GqL1sEEIrQfHz2oSAzvNd+UEiiEpDhuI10s?= =?utf-8?q?X5NBpRsjZ9m/8kiRHPCTpC8v1k9XHEttaCH4xhioRAZTXX3jNsLcJh19Y2/WC0mbV?= =?utf-8?q?Bn2zohjqZHT2Fz9Itq4fpwXJ/eTUs3I40RevNo0Vn0FH6NV/IJ7q5fuNL9N7bN7Hs?= =?utf-8?q?j0VNvymlqLdo6P9idOcZQGYNagTGpnG09dim9qm8G021PqQLT60B6EaHuUI0lhFgF?= =?utf-8?q?5+7VDBRLlzKK9rVbv/VmpY0LwdDkrXjEjvaoAF+av6Jk5Kpyu4CuWznKhUDEzdKaO?= =?utf-8?q?/moLzsPrhXgtKhUodz/Xa+REhd+5Tzv+3micUuAqrvSdVvlyyjDcw9viFH8rEgmEG?= =?utf-8?q?E0VdQAW0rM0Uosq/XY9Pz0CVITaZgMgcIaWXy7rufgu6fljhb5R+Jt4teTCeQe5TK?= =?utf-8?q?S5S7nmcafvq1Ttmgoxso11DN88ox0Z0ZwMgoos1PtyTAptfD9bZniFpATvbtEnWkl?= =?utf-8?q?63xhaJvAOvszAVST5vXUcNtYU4Vq9IWLQTmhIVu7PSAH0D8qUgURDnI5g27Yqv2RT?= =?utf-8?q?DogFcaEpiTPo?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4e9aa569-9a55-4293-680b-08db314df408 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB3127.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2023 18:38:28.1538 (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: smTE9QDSW7ZSphJwALjRFx4WuxIrIiGBkIubGmXhPtoEGFolBMjLEdDop3jiKHkZuUy6GlpvINSrqmqQKo7XQg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6544 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org If the number of lanes was forced and then subsequently the user omits this parameter, the ksettings->lanes is reset. The driver should then reset the number of lanes to the device's default for the specified speed. However, although the ksettings->lanes is set to 0, the mod variable is not set to true to indicate the driver and userspace should be notified of the changes. Fixes: 012ce4dd3102 ("ethtool: Extend link modes settings uAPI with lanes") Signed-off-by: Andy Roulin Reviewed-by: Danielle Ratson --- net/ethtool/linkmodes.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/net/ethtool/linkmodes.c b/net/ethtool/linkmodes.c index fab66c169b9f..20165e07ef90 100644 --- a/net/ethtool/linkmodes.c +++ b/net/ethtool/linkmodes.c @@ -270,11 +270,12 @@ static int ethnl_update_linkmodes(struct genl_info *info, struct nlattr **tb, "lanes configuration not supported by device"); return -EOPNOTSUPP; } - } else if (!lsettings->autoneg) { - /* If autoneg is off and lanes parameter is not passed from user, - * set the lanes parameter to 0. + } else if (!lsettings->autoneg && ksettings->lanes) { + /* If autoneg is off and lanes parameter is not passed from user but + * it was defined previously then set the lanes parameter to 0. */ ksettings->lanes = 0; + *mod = true; } ret = ethnl_update_bitset(ksettings->link_modes.advertising,