net-bonding: Fix minor sparse complaints
Subsystems (3)
PATCH 1/3 net-bonding: Fix minor sparse complaints
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?
--- 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(-)
drivers/net/bonding/bond_main.c +2 -2
@@ -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; }
drivers/net/bonding/bond_procfs.c +0 -2
@@ -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)
drivers/net/bonding/bonding.h +1 -0
@@ -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 */
Signature · 1 line
1.7.3.1
PATCH 2/3 net-bonding: Fix minor/cosmetic type inconsistencies
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.
--- drivers/net/bonding/bond_3ad.c | 4 +--- drivers/net/bonding/bond_main.c | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/bonding/bond_3ad.c +1 -3
@@ -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 ;
drivers/net/bonding/bond_main.c +1 -1
@@ -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);
Signature · 1 line
1.7.3.1
Re: [PATCH 2/3] net-bonding: Fix minor/cosmetic type inconsistencies
aFrom: David Decotigny <[email protected]>
Date: Wed, 13 Apr 2011 18:22:30 -0700
Quoted 9 lines
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 <[email protected]>
Applied.
PATCH 3/3 net-bonding: Adding support for throughputs larger than 65536 Mbps
In reply to David DecotignyThis 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.
--- drivers/net/bonding/bond_main.c | 12 +++++++----- drivers/net/bonding/bonding.h | 6 +++--- 2 files changed, 10 insertions(+), 8 deletions(-)
drivers/net/bonding/bond_main.c +7 -5
@@ -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);
drivers/net/bonding/bonding.h +3 -3
@@ -196,12 +196,12 @@ struct slave { u8 backup:1, /* indicates backup slave. Value corresponds withBOND_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
Signature · 1 line
1.7.3.1
Re: [PATCH 3/3] net-bonding: Adding support for throughputs larger than 65536 Mbps
From: David Decotigny <[email protected]>
Date: Wed, 13 Apr 2011 18:22:31 -0700
Quoted 9 lines
This updates the bonding driver to support v2.6.27-rc3 enhancements (
b11f8d8caka. "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 <[email protected]>
Applied.
From: David Decotigny <[email protected]>
Date: Wed, 13 Apr 2011 18:22:29 -0700
Quoted 5 lines
This gets rid of minor sparse complaints:
drivers/net/bonding/bond_main.c:4361:4: warning: do-while statement is not a compound statementdrivers/net/bonding/bond_main.c:243:12: warning: symbol 'bond_mode_name' was not declared. Should it be static?Signed-off-by David Decotigny <[email protected]>
Applied.