netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch net-next-2.6] bonding: allow all slave speeds
@ 2011-06-01 20:36 Jiri Pirko
  2011-06-01 21:30 ` Nicolas de Pesloüan
  2011-06-02 21:44 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Jiri Pirko @ 2011-06-01 20:36 UTC (permalink / raw)
  To: netdev; +Cc: davem, fubar, andy

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.

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
 drivers/net/bonding/bond_main.c |    9 +--------
 1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 17b4dd9..716c852 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -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:
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch net-next-2.6] bonding: allow all slave speeds
  2011-06-01 20:36 [patch net-next-2.6] bonding: allow all slave speeds Jiri Pirko
@ 2011-06-01 21:30 ` Nicolas de Pesloüan
  2011-06-02 21:44 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Nicolas de Pesloüan @ 2011-06-01 21:30 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: netdev, davem, fubar, andy

Le 01/06/2011 22:36, Jiri Pirko a écrit :
> 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.
>
> Signed-off-by: Jiri Pirko<jpirko@redhat.com>
> ---
>   drivers/net/bonding/bond_main.c |    9 +--------
>   1 files changed, 1 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 17b4dd9..716c852 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -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:

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?

Reviewed-by: Nicolas de Pesloüan <nicolas.2p.debian@free.fr>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch net-next-2.6] bonding: allow all slave speeds
  2011-06-01 20:36 [patch net-next-2.6] bonding: allow all slave speeds Jiri Pirko
  2011-06-01 21:30 ` Nicolas de Pesloüan
@ 2011-06-02 21:44 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2011-06-02 21:44 UTC (permalink / raw)
  To: jpirko; +Cc: netdev, fubar, andy

From: Jiri Pirko <jpirko@redhat.com>
Date: Wed,  1 Jun 2011 22:36:33 +0200

> 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.
> 
> Signed-off-by: Jiri Pirko <jpirko@redhat.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-06-02 21:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-01 20:36 [patch net-next-2.6] bonding: allow all slave speeds Jiri Pirko
2011-06-01 21:30 ` Nicolas de Pesloüan
2011-06-02 21:44 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).