All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] net-bonding: Fix minor sparse complaints
@ 2011-04-14  1:22 David Decotigny
  2011-04-14  1:22 ` [PATCH 2/3] net-bonding: Fix minor/cosmetic type inconsistencies David Decotigny
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: David Decotigny @ 2011-04-14  1:22 UTC (permalink / raw)
  To: Jay Vosburgh, Andy Gospodarek, netdev, linux-kernel; +Cc: David Decotigny

This gets rid of minor sparse complaints:
drivers/net/bonding/bond_main.c:4361:4: warning: do-while statement is not a compound statement
drivers/net/bonding/bond_main.c:243:12: warning: symbol 'bond_mode_name' was not declared. Should it be static?

Signed-off-by: David Decotigny <decot@google.com>
---
 drivers/net/bonding/bond_main.c   |    4 ++--
 drivers/net/bonding/bond_procfs.c |    2 --
 drivers/net/bonding/bonding.h     |    1 +
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 16d6fe9..8264ed7 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4357,9 +4357,9 @@ static u16 bond_select_queue(struct net_device *dev, struct sk_buff *skb)
 	u16 txq = skb_rx_queue_recorded(skb) ? skb_get_rx_queue(skb) : 0;
 
 	if (unlikely(txq >= dev->real_num_tx_queues)) {
-		do
+		do {
 			txq -= dev->real_num_tx_queues;
-		while (txq >= dev->real_num_tx_queues);
+		} while (txq >= dev->real_num_tx_queues);
 	}
 	return txq;
 }
diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c
index c32ff55..c97307d 100644
--- a/drivers/net/bonding/bond_procfs.c
+++ b/drivers/net/bonding/bond_procfs.c
@@ -4,8 +4,6 @@
 #include "bonding.h"
 
 
-extern const char *bond_mode_name(int mode);
-
 static void *bond_info_seq_start(struct seq_file *seq, loff_t *pos)
 	__acquires(RCU)
 	__acquires(&bond->lock)
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 90736cb..3ca503e 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -416,6 +416,7 @@ void bond_destroy_debugfs(void);
 void bond_debug_register(struct bonding *bond);
 void bond_debug_unregister(struct bonding *bond);
 void bond_debug_reregister(struct bonding *bond);
+const char *bond_mode_name(int mode);
 
 struct bond_net {
 	struct net *		net;	/* Associated network namespace */
-- 
1.7.3.1


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

* [PATCH 2/3] net-bonding: Fix minor/cosmetic type inconsistencies
  2011-04-14  1:22 [PATCH 1/3] net-bonding: Fix minor sparse complaints David Decotigny
@ 2011-04-14  1:22 ` David Decotigny
  2011-04-15  5:04   ` David Miller
  2011-04-14  1:22 ` [PATCH 3/3] net-bonding: Adding support for throughputs larger than 65536 Mbps David Decotigny
  2011-04-15  5:03 ` [PATCH 1/3] net-bonding: Fix minor sparse complaints David Miller
  2 siblings, 1 reply; 6+ messages in thread
From: David Decotigny @ 2011-04-14  1:22 UTC (permalink / raw)
  To: Jay Vosburgh, Andy Gospodarek, netdev, linux-kernel; +Cc: David Decotigny

The __get_link_speed() function returns a u16 value which was stored
in a u32 local variable. This patch uses the return value directly,
thus fixing that minor type consistency.

The 'duplex' field in struct slave being encoded on 8 bits, to be more
consistent we use a u8 integer (instead of u16) whenever we copy it to
local variables.

Signed-off-by: David Decotigny <decot@google.com>
---
 drivers/net/bonding/bond_3ad.c  |    4 +---
 drivers/net/bonding/bond_main.c |    2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index 494bf96..123dd60 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -716,11 +716,9 @@ static void __set_agg_ports_ready(struct aggregator *aggregator, int val)
 static u32 __get_agg_bandwidth(struct aggregator *aggregator)
 {
 	u32 bandwidth = 0;
-	u32 basic_speed;
 
 	if (aggregator->num_of_ports) {
-		basic_speed = __get_link_speed(aggregator->lag_ports);
-		switch (basic_speed) {
+		switch (__get_link_speed(aggregator->lag_ports)) {
 		case AD_LINK_SPEED_BITMASK_1MBPS:
 			bandwidth = aggregator->num_of_ports;
 			break;
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 8264ed7..145f9be 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3340,7 +3340,7 @@ static int bond_slave_netdev_event(unsigned long event,
 			slave = bond_get_slave_by_dev(bond, slave_dev);
 			if (slave) {
 				u16 old_speed = slave->speed;
-				u16 old_duplex = slave->duplex;
+				u8  old_duplex = slave->duplex;
 
 				bond_update_speed_duplex(slave);
 
-- 
1.7.3.1


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

* [PATCH 3/3] net-bonding: Adding support for throughputs larger than 65536 Mbps
  2011-04-14  1:22 [PATCH 1/3] net-bonding: Fix minor sparse complaints David Decotigny
  2011-04-14  1:22 ` [PATCH 2/3] net-bonding: Fix minor/cosmetic type inconsistencies David Decotigny
@ 2011-04-14  1:22 ` David Decotigny
  2011-04-15  5:04   ` David Miller
  2011-04-15  5:03 ` [PATCH 1/3] net-bonding: Fix minor sparse complaints David Miller
  2 siblings, 1 reply; 6+ messages in thread
From: David Decotigny @ 2011-04-14  1:22 UTC (permalink / raw)
  To: Jay Vosburgh, Andy Gospodarek, netdev, linux-kernel; +Cc: David Decotigny

This updates the bonding driver to support v2.6.27-rc3 enhancements
(b11f8d8c aka. "ethtool: Expand ethtool_cmd.speed to 32 bits") which
allow to encode the Mbps link speed on 32-bits (Max 4 Pbps) instead of
16 (Max 65536 Mbps).

This patch also attempts to compact struct slave by reordering its
fields.

Signed-off-by: David Decotigny <decot@google.com>
---
 drivers/net/bonding/bond_main.c |   12 +++++++-----
 drivers/net/bonding/bonding.h   |    6 +++---
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 145f9be..c5d8ac2 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -631,7 +631,8 @@ down:
 static int bond_update_speed_duplex(struct slave *slave)
 {
 	struct net_device *slave_dev = slave->dev;
-	struct ethtool_cmd etool;
+	struct ethtool_cmd etool = { .cmd = ETHTOOL_GSET };
+	u32 slave_speed;
 	int res;
 
 	/* Fake speed and duplex */
@@ -645,7 +646,8 @@ static int bond_update_speed_duplex(struct slave *slave)
 	if (res < 0)
 		return -1;
 
-	switch (etool.speed) {
+	slave_speed = ethtool_cmd_speed(&etool);
+	switch (slave_speed) {
 	case SPEED_10:
 	case SPEED_100:
 	case SPEED_1000:
@@ -663,7 +665,7 @@ static int bond_update_speed_duplex(struct slave *slave)
 		return -1;
 	}
 
-	slave->speed = etool.speed;
+	slave->speed = slave_speed;
 	slave->duplex = etool.duplex;
 
 	return 0;
@@ -2493,7 +2495,7 @@ static void bond_miimon_commit(struct bonding *bond)
 
 			bond_update_speed_duplex(slave);
 
-			pr_info("%s: link status definitely up for interface %s, %d Mbps %s duplex.\n",
+			pr_info("%s: link status definitely up for interface %s, %u Mbps %s duplex.\n",
 				bond->dev->name, slave->dev->name,
 				slave->speed, slave->duplex ? "full" : "half");
 
@@ -3339,7 +3341,7 @@ static int bond_slave_netdev_event(unsigned long event,
 
 			slave = bond_get_slave_by_dev(bond, slave_dev);
 			if (slave) {
-				u16 old_speed = slave->speed;
+				u32 old_speed = slave->speed;
 				u8  old_duplex = slave->duplex;
 
 				bond_update_speed_duplex(slave);
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 3ca503e..553c764 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -196,12 +196,12 @@ struct slave {
 	u8     backup:1,   /* indicates backup slave. Value corresponds with
 			      BOND_STATE_ACTIVE and BOND_STATE_BACKUP */
 	       inactive:1; /* indicates inactive slave */
+	u8     duplex;
 	u32    original_mtu;
 	u32    link_failure_count;
-	u8     perm_hwaddr[ETH_ALEN];
-	u16    speed;
-	u8     duplex;
+	u32    speed;
 	u16    queue_id;
+	u8     perm_hwaddr[ETH_ALEN];
 	struct ad_slave_info ad_info; /* HUGE - better to dynamically alloc */
 	struct tlb_slave_info tlb_info;
 #ifdef CONFIG_NET_POLL_CONTROLLER
-- 
1.7.3.1


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

* Re: [PATCH 1/3] net-bonding: Fix minor sparse complaints
  2011-04-14  1:22 [PATCH 1/3] net-bonding: Fix minor sparse complaints David Decotigny
  2011-04-14  1:22 ` [PATCH 2/3] net-bonding: Fix minor/cosmetic type inconsistencies David Decotigny
  2011-04-14  1:22 ` [PATCH 3/3] net-bonding: Adding support for throughputs larger than 65536 Mbps David Decotigny
@ 2011-04-15  5:03 ` David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2011-04-15  5:03 UTC (permalink / raw)
  To: decot; +Cc: fubar, andy, netdev, linux-kernel

From: David Decotigny <decot@google.com>
Date: Wed, 13 Apr 2011 18:22:29 -0700

> This gets rid of minor sparse complaints:
> drivers/net/bonding/bond_main.c:4361:4: warning: do-while statement is not a compound statement
> drivers/net/bonding/bond_main.c:243:12: warning: symbol 'bond_mode_name' was not declared. Should it be static?
> 
> Signed-off-by: David Decotigny <decot@google.com>

Applied.

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

* Re: [PATCH 2/3] net-bonding: Fix minor/cosmetic type inconsistencies
  2011-04-14  1:22 ` [PATCH 2/3] net-bonding: Fix minor/cosmetic type inconsistencies David Decotigny
@ 2011-04-15  5:04   ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2011-04-15  5:04 UTC (permalink / raw)
  To: decot; +Cc: fubar, andy, netdev, linux-kernel

aFrom: David Decotigny <decot@google.com>
Date: Wed, 13 Apr 2011 18:22:30 -0700

> The __get_link_speed() function returns a u16 value which was stored
> in a u32 local variable. This patch uses the return value directly,
> thus fixing that minor type consistency.
> 
> The 'duplex' field in struct slave being encoded on 8 bits, to be more
> consistent we use a u8 integer (instead of u16) whenever we copy it to
> local variables.
> 
> Signed-off-by: David Decotigny <decot@google.com>

Applied.

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

* Re: [PATCH 3/3] net-bonding: Adding support for throughputs larger than 65536 Mbps
  2011-04-14  1:22 ` [PATCH 3/3] net-bonding: Adding support for throughputs larger than 65536 Mbps David Decotigny
@ 2011-04-15  5:04   ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2011-04-15  5:04 UTC (permalink / raw)
  To: decot; +Cc: fubar, andy, netdev, linux-kernel

From: David Decotigny <decot@google.com>
Date: Wed, 13 Apr 2011 18:22:31 -0700

> This updates the bonding driver to support v2.6.27-rc3 enhancements
> (b11f8d8c aka. "ethtool: Expand ethtool_cmd.speed to 32 bits") which
> allow to encode the Mbps link speed on 32-bits (Max 4 Pbps) instead of
> 16 (Max 65536 Mbps).
> 
> This patch also attempts to compact struct slave by reordering its
> fields.
> 
> Signed-off-by: David Decotigny <decot@google.com>

Applied.

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

end of thread, other threads:[~2011-04-15  5:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-14  1:22 [PATCH 1/3] net-bonding: Fix minor sparse complaints David Decotigny
2011-04-14  1:22 ` [PATCH 2/3] net-bonding: Fix minor/cosmetic type inconsistencies David Decotigny
2011-04-15  5:04   ` David Miller
2011-04-14  1:22 ` [PATCH 3/3] net-bonding: Adding support for throughputs larger than 65536 Mbps David Decotigny
2011-04-15  5:04   ` David Miller
2011-04-15  5:03 ` [PATCH 1/3] net-bonding: Fix minor sparse complaints David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.