Skip to contentSkip to conversation

ethtool: reset #lanes when lanes is omitted

PATCH In review Andy Roulin 2 participants 3 messages Mar 30, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ethtool: reset #lanes when lanes is omitted

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")
---
 net/ethtool/linkmodes.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
net/ethtool/linkmodes.c +4 -3
index fab66c169b9f..20165e07ef90 100644
@@ -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,
Signature · 1 line
2.20.1
maintainer
#1 lore raw
Quoted 1 line · 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?

Quoted 12 lines

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")
#2 lore raw
Quoted 5 lines · Jakub Kicinski
Quoted 1 line · 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.

Quoted 12 lines
Quoted 12 lines

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")