aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/bonding/bond_main.c')
-rw-r--r--drivers/net/bonding/bond_main.c49
1 files changed, 15 insertions, 34 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 99610f358c40..74824028f85c 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2213,33 +2213,24 @@ static int bond_slave_info_query(struct net_device *bond_dev, struct ifslave *in
2213{ 2213{
2214 struct bonding *bond = netdev_priv(bond_dev); 2214 struct bonding *bond = netdev_priv(bond_dev);
2215 struct slave *slave; 2215 struct slave *slave;
2216 int i, found = 0; 2216 int i, res = -ENODEV;
2217
2218 if (info->slave_id < 0) {
2219 return -ENODEV;
2220 }
2221 2217
2222 read_lock(&bond->lock); 2218 read_lock(&bond->lock);
2223 2219
2224 bond_for_each_slave(bond, slave, i) { 2220 bond_for_each_slave(bond, slave, i) {
2225 if (i == (int)info->slave_id) { 2221 if (i == (int)info->slave_id) {
2226 found = 1; 2222 res = 0;
2223 strcpy(info->slave_name, slave->dev->name);
2224 info->link = slave->link;
2225 info->state = slave->state;
2226 info->link_failure_count = slave->link_failure_count;
2227 break; 2227 break;
2228 } 2228 }
2229 } 2229 }
2230 2230
2231 read_unlock(&bond->lock); 2231 read_unlock(&bond->lock);
2232 2232
2233 if (found) { 2233 return res;
2234 strcpy(info->slave_name, slave->dev->name);
2235 info->link = slave->link;
2236 info->state = slave->state;
2237 info->link_failure_count = slave->link_failure_count;
2238 } else {
2239 return -ENODEV;
2240 }
2241
2242 return 0;
2243} 2234}
2244 2235
2245/*-------------------------------- Monitoring -------------------------------*/ 2236/*-------------------------------- Monitoring -------------------------------*/
@@ -2570,7 +2561,7 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
2570 2561
2571 for (i = 0; (i < BOND_MAX_ARP_TARGETS); i++) { 2562 for (i = 0; (i < BOND_MAX_ARP_TARGETS); i++) {
2572 if (!targets[i]) 2563 if (!targets[i])
2573 continue; 2564 break;
2574 pr_debug("basa: target %x\n", targets[i]); 2565 pr_debug("basa: target %x\n", targets[i]);
2575 if (list_empty(&bond->vlan_list)) { 2566 if (list_empty(&bond->vlan_list)) {
2576 pr_debug("basa: empty vlan: arp_send\n"); 2567 pr_debug("basa: empty vlan: arp_send\n");
@@ -2677,7 +2668,6 @@ static void bond_validate_arp(struct bonding *bond, struct slave *slave, __be32
2677 int i; 2668 int i;
2678 __be32 *targets = bond->params.arp_targets; 2669 __be32 *targets = bond->params.arp_targets;
2679 2670
2680 targets = bond->params.arp_targets;
2681 for (i = 0; (i < BOND_MAX_ARP_TARGETS) && targets[i]; i++) { 2671 for (i = 0; (i < BOND_MAX_ARP_TARGETS) && targets[i]; i++) {
2682 pr_debug("bva: sip %pI4 tip %pI4 t[%d] %pI4 bhti(tip) %d\n", 2672 pr_debug("bva: sip %pI4 tip %pI4 t[%d] %pI4 bhti(tip) %d\n",
2683 &sip, &tip, i, &targets[i], bond_has_this_ip(bond, tip)); 2673 &sip, &tip, i, &targets[i], bond_has_this_ip(bond, tip));
@@ -3303,7 +3293,7 @@ static void bond_info_show_master(struct seq_file *seq)
3303 3293
3304 for(i = 0; (i < BOND_MAX_ARP_TARGETS) ;i++) { 3294 for(i = 0; (i < BOND_MAX_ARP_TARGETS) ;i++) {
3305 if (!bond->params.arp_targets[i]) 3295 if (!bond->params.arp_targets[i])
3306 continue; 3296 break;
3307 if (printed) 3297 if (printed)
3308 seq_printf(seq, ","); 3298 seq_printf(seq, ",");
3309 seq_printf(seq, " %pI4", &bond->params.arp_targets[i]); 3299 seq_printf(seq, " %pI4", &bond->params.arp_targets[i]);
@@ -5168,16 +5158,15 @@ int bond_create(char *name, struct bond_params *params)
5168 up_write(&bonding_rwsem); 5158 up_write(&bonding_rwsem);
5169 rtnl_unlock(); /* allows sysfs registration of net device */ 5159 rtnl_unlock(); /* allows sysfs registration of net device */
5170 res = bond_create_sysfs_entry(netdev_priv(bond_dev)); 5160 res = bond_create_sysfs_entry(netdev_priv(bond_dev));
5171 if (res < 0) { 5161 if (res < 0)
5172 rtnl_lock(); 5162 goto out_unreg;
5173 down_write(&bonding_rwsem);
5174 bond_deinit(bond_dev);
5175 unregister_netdevice(bond_dev);
5176 goto out_rtnl;
5177 }
5178 5163
5179 return 0; 5164 return 0;
5180 5165
5166out_unreg:
5167 rtnl_lock();
5168 down_write(&bonding_rwsem);
5169 unregister_netdevice(bond_dev);
5181out_bond: 5170out_bond:
5182 bond_deinit(bond_dev); 5171 bond_deinit(bond_dev);
5183out_netdev: 5172out_netdev:
@@ -5192,7 +5181,6 @@ static int __init bonding_init(void)
5192{ 5181{
5193 int i; 5182 int i;
5194 int res; 5183 int res;
5195 struct bonding *bond;
5196 5184
5197 printk(KERN_INFO "%s", version); 5185 printk(KERN_INFO "%s", version);
5198 5186
@@ -5223,13 +5211,6 @@ static int __init bonding_init(void)
5223 5211
5224 goto out; 5212 goto out;
5225err: 5213err:
5226 list_for_each_entry(bond, &bond_dev_list, bond_list) {
5227 bond_work_cancel_all(bond);
5228 destroy_workqueue(bond->wq);
5229 }
5230
5231 bond_destroy_sysfs();
5232
5233 rtnl_lock(); 5214 rtnl_lock();
5234 bond_free_all(); 5215 bond_free_all();
5235 rtnl_unlock(); 5216 rtnl_unlock();