diff mbox series

[net-next] ethtool: reset #lanes when lanes is omitted

Message ID 6e02aaab-18fe-692d-52cb-71212db44ade@nvidia.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net-next] ethtool: reset #lanes when lanes is omitted | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 20 this patch: 20
netdev/cc_maintainers warning 3 maintainers not CCed: edumazet@google.com sean.anderson@seco.com pabeni@redhat.com
netdev/build_clang success Errors and warnings before: 18 this patch: 18
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 20 this patch: 20
netdev/checkpatch warning WARNING: line length of 84 exceeds 80 columns
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Andy Roulin March 30, 2023, 4:56 p.m. UTC
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 <aroulin@nvidia.com>
Reviewed-by: Danielle Ratson <danieller@nvidia.com>
---
 net/ethtool/linkmodes.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Jakub Kicinski March 30, 2023, 5:38 p.m. UTC | #1
On Thu, 30 Mar 2023 09:56:58 -0700 Andy Roulin wrote:
> Subject: [PATCH net-next] ethtool: reset #lanes when lanes is omitted

This should have been tagged for net, right?

> 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 <aroulin@nvidia.com>
> Reviewed-by: Danielle Ratson <danieller@nvidia.com>
Andy Roulin March 30, 2023, 6:18 p.m. UTC | #2
On 3/30/23 10:38 AM, Jakub Kicinski wrote:
> On Thu, 30 Mar 2023 09:56:58 -0700 Andy Roulin wrote:
>> Subject: [PATCH net-next] ethtool: reset #lanes when lanes is omitted
> 
> This should have been tagged for net, right?
>

Yes, sorry, I will resend.

>> 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 <aroulin@nvidia.com>
>> Reviewed-by: Danielle Ratson <danieller@nvidia.com>
diff mbox series

Patch

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,