aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-05-07 05:17:13 -0400
committerIngo Molnar <mingo@elte.hu>2009-05-07 05:17:34 -0400
commit44347d947f628060b92449702071bfe1d31dfb75 (patch)
treec6ed74610d5b3295df4296659f80f5feb94b28cc /drivers/net/bonding
parentd94fc523f3c35bd8013f04827e94756cbc0212f4 (diff)
parent413f81eba35d6ede9289b0c8a920c013a84fac71 (diff)
Merge branch 'linus' into tracing/core
Merge reason: tracing/core was on a .30-rc1 base and was missing out on on a handful of tracing fixes present in .30-rc5-almost. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r--drivers/net/bonding/bond_alb.c14
-rw-r--r--drivers/net/bonding/bond_main.c41
-rw-r--r--drivers/net/bonding/bond_sysfs.c14
3 files changed, 26 insertions, 43 deletions
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 8dc6fbb9a41e..46d312bedfb8 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -370,8 +370,6 @@ static int rlb_arp_recv(struct sk_buff *skb, struct net_device *bond_dev, struct
370 370
371 if (arp->op_code == htons(ARPOP_REPLY)) { 371 if (arp->op_code == htons(ARPOP_REPLY)) {
372 /* update rx hash table for this ARP */ 372 /* update rx hash table for this ARP */
373 printk("rar: update orig %s bond_dev %s\n", orig_dev->name,
374 bond_dev->name);
375 bond = netdev_priv(bond_dev); 373 bond = netdev_priv(bond_dev);
376 rlb_update_entry_from_arp(bond, arp); 374 rlb_update_entry_from_arp(bond, arp);
377 pr_debug("Server received an ARP Reply from client\n"); 375 pr_debug("Server received an ARP Reply from client\n");
@@ -1708,10 +1706,8 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave
1708 * Called with RTNL 1706 * Called with RTNL
1709 */ 1707 */
1710int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr) 1708int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr)
1711 __releases(&bond->curr_slave_lock)
1712 __releases(&bond->lock)
1713 __acquires(&bond->lock) 1709 __acquires(&bond->lock)
1714 __acquires(&bond->curr_slave_lock) 1710 __releases(&bond->lock)
1715{ 1711{
1716 struct bonding *bond = netdev_priv(bond_dev); 1712 struct bonding *bond = netdev_priv(bond_dev);
1717 struct sockaddr *sa = addr; 1713 struct sockaddr *sa = addr;
@@ -1747,9 +1743,6 @@ int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr)
1747 } 1743 }
1748 } 1744 }
1749 1745
1750 write_unlock_bh(&bond->curr_slave_lock);
1751 read_unlock(&bond->lock);
1752
1753 if (swap_slave) { 1746 if (swap_slave) {
1754 alb_swap_mac_addr(bond, swap_slave, bond->curr_active_slave); 1747 alb_swap_mac_addr(bond, swap_slave, bond->curr_active_slave);
1755 alb_fasten_mac_swap(bond, swap_slave, bond->curr_active_slave); 1748 alb_fasten_mac_swap(bond, swap_slave, bond->curr_active_slave);
@@ -1757,16 +1750,15 @@ int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr)
1757 alb_set_slave_mac_addr(bond->curr_active_slave, bond_dev->dev_addr, 1750 alb_set_slave_mac_addr(bond->curr_active_slave, bond_dev->dev_addr,
1758 bond->alb_info.rlb_enabled); 1751 bond->alb_info.rlb_enabled);
1759 1752
1753 read_lock(&bond->lock);
1760 alb_send_learning_packets(bond->curr_active_slave, bond_dev->dev_addr); 1754 alb_send_learning_packets(bond->curr_active_slave, bond_dev->dev_addr);
1761 if (bond->alb_info.rlb_enabled) { 1755 if (bond->alb_info.rlb_enabled) {
1762 /* inform clients mac address has changed */ 1756 /* inform clients mac address has changed */
1763 rlb_req_update_slave_clients(bond, bond->curr_active_slave); 1757 rlb_req_update_slave_clients(bond, bond->curr_active_slave);
1764 } 1758 }
1759 read_unlock(&bond->lock);
1765 } 1760 }
1766 1761
1767 read_lock(&bond->lock);
1768 write_lock_bh(&bond->curr_slave_lock);
1769
1770 return 0; 1762 return 0;
1771} 1763}
1772 1764
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 99610f358c40..2188a96fc090 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:
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 18cf4787874c..d28731535226 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -684,17 +684,15 @@ static ssize_t bonding_store_arp_targets(struct device *d,
684 goto out; 684 goto out;
685 } 685 }
686 /* look for an empty slot to put the target in, and check for dupes */ 686 /* look for an empty slot to put the target in, and check for dupes */
687 for (i = 0; (i < BOND_MAX_ARP_TARGETS); i++) { 687 for (i = 0; (i < BOND_MAX_ARP_TARGETS) && !done; i++) {
688 if (targets[i] == newtarget) { /* duplicate */ 688 if (targets[i] == newtarget) { /* duplicate */
689 printk(KERN_ERR DRV_NAME 689 printk(KERN_ERR DRV_NAME
690 ": %s: ARP target %pI4 is already present\n", 690 ": %s: ARP target %pI4 is already present\n",
691 bond->dev->name, &newtarget); 691 bond->dev->name, &newtarget);
692 if (done)
693 targets[i] = 0;
694 ret = -EINVAL; 692 ret = -EINVAL;
695 goto out; 693 goto out;
696 } 694 }
697 if (targets[i] == 0 && !done) { 695 if (targets[i] == 0) {
698 printk(KERN_INFO DRV_NAME 696 printk(KERN_INFO DRV_NAME
699 ": %s: adding ARP target %pI4.\n", 697 ": %s: adding ARP target %pI4.\n",
700 bond->dev->name, &newtarget); 698 bond->dev->name, &newtarget);
@@ -720,12 +718,16 @@ static ssize_t bonding_store_arp_targets(struct device *d,
720 goto out; 718 goto out;
721 } 719 }
722 720
723 for (i = 0; (i < BOND_MAX_ARP_TARGETS); i++) { 721 for (i = 0; (i < BOND_MAX_ARP_TARGETS) && !done; i++) {
724 if (targets[i] == newtarget) { 722 if (targets[i] == newtarget) {
723 int j;
725 printk(KERN_INFO DRV_NAME 724 printk(KERN_INFO DRV_NAME
726 ": %s: removing ARP target %pI4.\n", 725 ": %s: removing ARP target %pI4.\n",
727 bond->dev->name, &newtarget); 726 bond->dev->name, &newtarget);
728 targets[i] = 0; 727 for (j = i; (j < (BOND_MAX_ARP_TARGETS-1)) && targets[j+1]; j++)
728 targets[j] = targets[j+1];
729
730 targets[j] = 0;
729 done = 1; 731 done = 1;
730 } 732 }
731 } 733 }