Skip to contentSkip to conversation

bonding: allow all slave speeds

PATCH Applied Jiri Pirko 3 participants 3 messages Jun 1, 2011 – Jun 2, 2011

Subsystems (3)
lore
Share & tools
lore

Jiri Pirko

author
#0 lore raw

PATCH 1/1 bonding: allow all slave speeds

No need to check for 10, 100, 1000, 10000 explicitly. Just make this generic and check for invalid values only (similar check is in ethtool userspace app). This enables correct speed handling for slave devices with "nonstandard" speeds.

---
 drivers/net/bonding/bond_main.c |    9 +--------
 1 files changed, 1 insertions(+), 8 deletions(-)
drivers/net/bonding/bond_main.c +1 -8
index 17b4dd9..716c852 100644
@@ -629,15 +629,8 @@ static int bond_update_speed_duplex(struct slave *slave)
 		return -1;
 
 	slave_speed = ethtool_cmd_speed(&etool);
-	switch (slave_speed) {
-	case SPEED_10:
-	case SPEED_100:
-	case SPEED_1000:
-	case SPEED_10000:
-		break;
-	default:
+	if (slave_speed == 0 || slave_speed == ((__u32) -1))
 		return -1;
-	}
 
 	switch (etool.duplex) {
 	case DUPLEX_FULL:
Signature · 1 line
1.7.4.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 21 lines · Jiri Pirko

No need to check for 10, 100, 1000, 10000 explicitly. Just make this generic and check for invalid values only (similar check is in ethtool userspace app). This enables correct speed handling for slave devices with "nonstandard" speeds.

---
  drivers/net/bonding/bond_main.c |    9 +--------
  1 files changed, 1 insertions(+), 8 deletions(-)
drivers/net/bonding/bond_main.c +0 -3
index 17b4dd9..716c852 100644
@@ -629,15 +629,8 @@ static int bond_update_speed_duplex(struct slave *slave)
  		return -1;
 
  	slave_speed = ethtool_cmd_speed(&etool);
-	switch (slave_speed) {
-	case SPEED_10:
-	case SPEED_100:

drivers/net/bonding/bond_main.c static int bond_update_speed_duplex(struct slave *slave) · line 636

Quoted 10 lines
drivers/net/bonding/bond_main.c +1 -5
-	case SPEED_1000:
-	case SPEED_10000:
-		break;
-	default:
+	if (slave_speed == 0 || slave_speed == ((__u32) -1))
  		return -1;
-	}
 
  	switch (etool.duplex) {
  	case DUPLEX_FULL:

This makes sense to me. In particular, with Wifi slaves, this should allow the actual speed of the wireless link to be taken into account for active slave selection. We may need to add more stuffs for this to work, because Wifi link speed may change after enslavement, but this is a first step in the right direction.

Also, the same is true for FULL/HALF duplex. Why should we check the returned value, instead of just storing it?

maintainer Applied
#2 lore raw
In reply to Jiri Pirko

From: Jiri Pirko <[email protected]>
Date: Wed, 1 Jun 2011 22:36:33 +0200

Quoted 6 lines

No need to check for 10, 100, 1000, 10000 explicitly. Just make this generic and check for invalid values only (similar check is in ethtool userspace app). This enables correct speed handling for slave devices with "nonstandard" speeds.

Applied, thanks.