aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding
diff options
context:
space:
mode:
authorNikolay Aleksandrov <nikolay@redhat.com>2014-09-15 11:19:34 -0400
committerDavid S. Miller <davem@davemloft.net>2014-09-15 17:19:49 -0400
commit547942cace50e536dcda9ce8397792bc992291d6 (patch)
treebf6f6d59aee34e92b3b00fd6d1e4c5e49f5a964f /drivers/net/bonding
parent56924c3811ae843527f7a1090ead73a0acf704a4 (diff)
bonding: trivial: style and comment fixes
First adjust a couple of locking comments that were left inaccurate, then adjust comments to use the netdev styling and remove extra new lines where necessary and add a couple of new lines between declarations and code. These are all trivial styling changes, no functional change. Also removed a couple of outdated or obvious comments. This patch is by no means a complete fix of all netdev style violations but it gets the bonding closer. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r--drivers/net/bonding/bond_3ad.c5
-rw-r--r--drivers/net/bonding/bond_alb.c48
-rw-r--r--drivers/net/bonding/bond_debugfs.c4
-rw-r--r--drivers/net/bonding/bond_main.c199
-rw-r--r--drivers/net/bonding/bond_sysfs.c1
-rw-r--r--drivers/net/bonding/bonding.h3
6 files changed, 93 insertions, 167 deletions
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index 2bb360f32a64..7e9e522fd476 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -297,15 +297,14 @@ static u16 __get_link_speed(struct port *port)
297static u8 __get_duplex(struct port *port) 297static u8 __get_duplex(struct port *port)
298{ 298{
299 struct slave *slave = port->slave; 299 struct slave *slave = port->slave;
300
301 u8 retval; 300 u8 retval;
302 301
303 /* handling a special case: when the configuration starts with 302 /* handling a special case: when the configuration starts with
304 * link down, it sets the duplex to 0. 303 * link down, it sets the duplex to 0.
305 */ 304 */
306 if (slave->link != BOND_LINK_UP) 305 if (slave->link != BOND_LINK_UP) {
307 retval = 0x0; 306 retval = 0x0;
308 else { 307 } else {
309 switch (slave->duplex) { 308 switch (slave->duplex) {
310 case DUPLEX_FULL: 309 case DUPLEX_FULL:
311 retval = 0x1; 310 retval = 0x1;
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 4efdeb67ab7c..615f3bebd019 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -261,14 +261,15 @@ static struct slave *tlb_choose_channel(struct bonding *bond, u32 hash_index,
261 u32 skb_len) 261 u32 skb_len)
262{ 262{
263 struct slave *tx_slave; 263 struct slave *tx_slave;
264 /* 264
265 * We don't need to disable softirq here, becase 265 /* We don't need to disable softirq here, becase
266 * tlb_choose_channel() is only called by bond_alb_xmit() 266 * tlb_choose_channel() is only called by bond_alb_xmit()
267 * which already has softirq disabled. 267 * which already has softirq disabled.
268 */ 268 */
269 spin_lock(&bond->mode_lock); 269 spin_lock(&bond->mode_lock);
270 tx_slave = __tlb_choose_channel(bond, hash_index, skb_len); 270 tx_slave = __tlb_choose_channel(bond, hash_index, skb_len);
271 spin_unlock(&bond->mode_lock); 271 spin_unlock(&bond->mode_lock);
272
272 return tx_slave; 273 return tx_slave;
273} 274}
274 275
@@ -569,7 +570,7 @@ static void rlb_req_update_subnet_clients(struct bonding *bond, __be32 src_ip)
569 netdev_err(bond->dev, "found a client with no channel in the client's hash table\n"); 570 netdev_err(bond->dev, "found a client with no channel in the client's hash table\n");
570 continue; 571 continue;
571 } 572 }
572 /*update all clients using this src_ip, that are not assigned 573 /* update all clients using this src_ip, that are not assigned
573 * to the team's address (curr_active_slave) and have a known 574 * to the team's address (curr_active_slave) and have a known
574 * unicast mac address. 575 * unicast mac address.
575 */ 576 */
@@ -695,9 +696,7 @@ static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond)
695 return NULL; 696 return NULL;
696 697
697 if (arp->op_code == htons(ARPOP_REPLY)) { 698 if (arp->op_code == htons(ARPOP_REPLY)) {
698 /* the arp must be sent on the selected 699 /* the arp must be sent on the selected rx channel */
699 * rx channel
700 */
701 tx_slave = rlb_choose_channel(skb, bond); 700 tx_slave = rlb_choose_channel(skb, bond);
702 if (tx_slave) 701 if (tx_slave)
703 ether_addr_copy(arp->mac_src, tx_slave->dev->dev_addr); 702 ether_addr_copy(arp->mac_src, tx_slave->dev->dev_addr);
@@ -756,7 +755,7 @@ static void rlb_rebalance(struct bonding *bond)
756 spin_unlock_bh(&bond->mode_lock); 755 spin_unlock_bh(&bond->mode_lock);
757} 756}
758 757
759/* Caller must hold rx_hashtbl lock */ 758/* Caller must hold mode_lock */
760static void rlb_init_table_entry_dst(struct rlb_client_info *entry) 759static void rlb_init_table_entry_dst(struct rlb_client_info *entry)
761{ 760{
762 entry->used_next = RLB_NULL_INDEX; 761 entry->used_next = RLB_NULL_INDEX;
@@ -844,8 +843,9 @@ static void rlb_src_link(struct bonding *bond, u32 ip_src_hash, u32 ip_dst_hash)
844 bond_info->rx_hashtbl[ip_src_hash].src_first = ip_dst_hash; 843 bond_info->rx_hashtbl[ip_src_hash].src_first = ip_dst_hash;
845} 844}
846 845
847/* deletes all rx_hashtbl entries with arp->ip_src if their mac_src does 846/* deletes all rx_hashtbl entries with arp->ip_src if their mac_src does
848 * not match arp->mac_src */ 847 * not match arp->mac_src
848 */
849static void rlb_purge_src_ip(struct bonding *bond, struct arp_pkt *arp) 849static void rlb_purge_src_ip(struct bonding *bond, struct arp_pkt *arp)
850{ 850{
851 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); 851 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
@@ -1022,8 +1022,9 @@ static int alb_set_slave_mac_addr(struct slave *slave, u8 addr[])
1022 return 0; 1022 return 0;
1023 } 1023 }
1024 1024
1025 /* for rlb each slave must have a unique hw mac addresses so that */ 1025 /* for rlb each slave must have a unique hw mac addresses so that
1026 /* each slave will receive packets destined to a different mac */ 1026 * each slave will receive packets destined to a different mac
1027 */
1027 memcpy(s_addr.sa_data, addr, dev->addr_len); 1028 memcpy(s_addr.sa_data, addr, dev->addr_len);
1028 s_addr.sa_family = dev->type; 1029 s_addr.sa_family = dev->type;
1029 if (dev_set_mac_address(dev, &s_addr)) { 1030 if (dev_set_mac_address(dev, &s_addr)) {
@@ -1034,13 +1035,10 @@ static int alb_set_slave_mac_addr(struct slave *slave, u8 addr[])
1034 return 0; 1035 return 0;
1035} 1036}
1036 1037
1037/* 1038/* Swap MAC addresses between two slaves.
1038 * Swap MAC addresses between two slaves.
1039 * 1039 *
1040 * Called with RTNL held, and no other locks. 1040 * Called with RTNL held, and no other locks.
1041 *
1042 */ 1041 */
1043
1044static void alb_swap_mac_addr(struct slave *slave1, struct slave *slave2) 1042static void alb_swap_mac_addr(struct slave *slave1, struct slave *slave2)
1045{ 1043{
1046 u8 tmp_mac_addr[ETH_ALEN]; 1044 u8 tmp_mac_addr[ETH_ALEN];
@@ -1051,8 +1049,7 @@ static void alb_swap_mac_addr(struct slave *slave1, struct slave *slave2)
1051 1049
1052} 1050}
1053 1051
1054/* 1052/* Send learning packets after MAC address swap.
1055 * Send learning packets after MAC address swap.
1056 * 1053 *
1057 * Called with RTNL and no other locks 1054 * Called with RTNL and no other locks
1058 */ 1055 */
@@ -1125,7 +1122,6 @@ static void alb_change_hw_addr_on_detach(struct bonding *bond, struct slave *sla
1125 found_slave = bond_slave_has_mac(bond, slave->perm_hwaddr); 1122 found_slave = bond_slave_has_mac(bond, slave->perm_hwaddr);
1126 1123
1127 if (found_slave) { 1124 if (found_slave) {
1128 /* locking: needs RTNL and nothing else */
1129 alb_swap_mac_addr(slave, found_slave); 1125 alb_swap_mac_addr(slave, found_slave);
1130 alb_fasten_mac_swap(bond, slave, found_slave); 1126 alb_fasten_mac_swap(bond, slave, found_slave);
1131 } 1127 }
@@ -1174,7 +1170,8 @@ static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slav
1174 return 0; 1170 return 0;
1175 1171
1176 /* Try setting slave mac to bond address and fall-through 1172 /* Try setting slave mac to bond address and fall-through
1177 to code handling that situation below... */ 1173 * to code handling that situation below...
1174 */
1178 alb_set_slave_mac_addr(slave, bond->dev->dev_addr); 1175 alb_set_slave_mac_addr(slave, bond->dev->dev_addr);
1179 } 1176 }
1180 1177
@@ -1282,7 +1279,6 @@ int bond_alb_initialize(struct bonding *bond, int rlb_enabled)
1282 1279
1283 if (rlb_enabled) { 1280 if (rlb_enabled) {
1284 bond->alb_info.rlb_enabled = 1; 1281 bond->alb_info.rlb_enabled = 1;
1285 /* initialize rlb */
1286 res = rlb_initialize(bond); 1282 res = rlb_initialize(bond);
1287 if (res) { 1283 if (res) {
1288 tlb_deinitialize(bond); 1284 tlb_deinitialize(bond);
@@ -1306,7 +1302,7 @@ void bond_alb_deinitialize(struct bonding *bond)
1306} 1302}
1307 1303
1308static int bond_do_alb_xmit(struct sk_buff *skb, struct bonding *bond, 1304static int bond_do_alb_xmit(struct sk_buff *skb, struct bonding *bond,
1309 struct slave *tx_slave) 1305 struct slave *tx_slave)
1310{ 1306{
1311 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); 1307 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
1312 struct ethhdr *eth_data = eth_hdr(skb); 1308 struct ethhdr *eth_data = eth_hdr(skb);
@@ -1554,13 +1550,11 @@ void bond_alb_monitor(struct work_struct *work)
1554 bond_info->tx_rebalance_counter = 0; 1550 bond_info->tx_rebalance_counter = 0;
1555 } 1551 }
1556 1552
1557 /* handle rlb stuff */
1558 if (bond_info->rlb_enabled) { 1553 if (bond_info->rlb_enabled) {
1559 if (bond_info->primary_is_promisc && 1554 if (bond_info->primary_is_promisc &&
1560 (++bond_info->rlb_promisc_timeout_counter >= RLB_PROMISC_TIMEOUT)) { 1555 (++bond_info->rlb_promisc_timeout_counter >= RLB_PROMISC_TIMEOUT)) {
1561 1556
1562 /* 1557 /* dev_set_promiscuity requires rtnl and
1563 * dev_set_promiscuity requires rtnl and
1564 * nothing else. Avoid race with bond_close. 1558 * nothing else. Avoid race with bond_close.
1565 */ 1559 */
1566 rcu_read_unlock(); 1560 rcu_read_unlock();
@@ -1630,8 +1624,7 @@ int bond_alb_init_slave(struct bonding *bond, struct slave *slave)
1630 return 0; 1624 return 0;
1631} 1625}
1632 1626
1633/* 1627/* Remove slave from tlb and rlb hash tables, and fix up MAC addresses
1634 * Remove slave from tlb and rlb hash tables, and fix up MAC addresses
1635 * if necessary. 1628 * if necessary.
1636 * 1629 *
1637 * Caller must hold RTNL and no other locks 1630 * Caller must hold RTNL and no other locks
@@ -1718,8 +1711,7 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave
1718 if (!swap_slave) 1711 if (!swap_slave)
1719 swap_slave = bond_slave_has_mac(bond, bond->dev->dev_addr); 1712 swap_slave = bond_slave_has_mac(bond, bond->dev->dev_addr);
1720 1713
1721 /* 1714 /* Arrange for swap_slave and new_slave to temporarily be
1722 * Arrange for swap_slave and new_slave to temporarily be
1723 * ignored so we can mess with their MAC addresses without 1715 * ignored so we can mess with their MAC addresses without
1724 * fear of interference from transmit activity. 1716 * fear of interference from transmit activity.
1725 */ 1717 */
diff --git a/drivers/net/bonding/bond_debugfs.c b/drivers/net/bonding/bond_debugfs.c
index 652f6c5d1bf7..8f99082f90eb 100644
--- a/drivers/net/bonding/bond_debugfs.c
+++ b/drivers/net/bonding/bond_debugfs.c
@@ -13,9 +13,7 @@
13 13
14static struct dentry *bonding_debug_root; 14static struct dentry *bonding_debug_root;
15 15
16/* 16/* Show RLB hash table */
17 * Show RLB hash table
18 */
19static int bond_debug_rlb_hash_show(struct seq_file *m, void *v) 17static int bond_debug_rlb_hash_show(struct seq_file *m, void *v)
20{ 18{
21 struct bonding *bond = m->private; 19 struct bonding *bond = m->private;
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 2d90a8b7f62e..943a899fbfde 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -253,8 +253,7 @@ void bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb,
253 dev_queue_xmit(skb); 253 dev_queue_xmit(skb);
254} 254}
255 255
256/* 256/* In the following 2 functions, bond_vlan_rx_add_vid and bond_vlan_rx_kill_vid,
257 * In the following 2 functions, bond_vlan_rx_add_vid and bond_vlan_rx_kill_vid,
258 * We don't protect the slave list iteration with a lock because: 257 * We don't protect the slave list iteration with a lock because:
259 * a. This operation is performed in IOCTL context, 258 * a. This operation is performed in IOCTL context,
260 * b. The operation is protected by the RTNL semaphore in the 8021q code, 259 * b. The operation is protected by the RTNL semaphore in the 8021q code,
@@ -326,8 +325,7 @@ static int bond_vlan_rx_kill_vid(struct net_device *bond_dev,
326 325
327/*------------------------------- Link status -------------------------------*/ 326/*------------------------------- Link status -------------------------------*/
328 327
329/* 328/* Set the carrier state for the master according to the state of its
330 * Set the carrier state for the master according to the state of its
331 * slaves. If any slaves are up, the master is up. In 802.3ad mode, 329 * slaves. If any slaves are up, the master is up. In 802.3ad mode,
332 * do special 802.3ad magic. 330 * do special 802.3ad magic.
333 * 331 *
@@ -362,8 +360,7 @@ down:
362 return 0; 360 return 0;
363} 361}
364 362
365/* 363/* Get link speed and duplex from the slave's base driver
366 * Get link speed and duplex from the slave's base driver
367 * using ethtool. If for some reason the call fails or the 364 * using ethtool. If for some reason the call fails or the
368 * values are invalid, set speed and duplex to -1, 365 * values are invalid, set speed and duplex to -1,
369 * and return. 366 * and return.
@@ -416,8 +413,7 @@ const char *bond_slave_link_status(s8 link)
416 } 413 }
417} 414}
418 415
419/* 416/* if <dev> supports MII link status reporting, check its link status.
420 * if <dev> supports MII link status reporting, check its link status.
421 * 417 *
422 * We either do MII/ETHTOOL ioctls, or check netif_carrier_ok(), 418 * We either do MII/ETHTOOL ioctls, or check netif_carrier_ok(),
423 * depending upon the setting of the use_carrier parameter. 419 * depending upon the setting of the use_carrier parameter.
@@ -454,14 +450,14 @@ static int bond_check_dev_link(struct bonding *bond,
454 /* Ethtool can't be used, fallback to MII ioctls. */ 450 /* Ethtool can't be used, fallback to MII ioctls. */
455 ioctl = slave_ops->ndo_do_ioctl; 451 ioctl = slave_ops->ndo_do_ioctl;
456 if (ioctl) { 452 if (ioctl) {
457 /* TODO: set pointer to correct ioctl on a per team member */ 453 /* TODO: set pointer to correct ioctl on a per team member
458 /* bases to make this more efficient. that is, once */ 454 * bases to make this more efficient. that is, once
459 /* we determine the correct ioctl, we will always */ 455 * we determine the correct ioctl, we will always
460 /* call it and not the others for that team */ 456 * call it and not the others for that team
461 /* member. */ 457 * member.
462 458 */
463 /* 459
464 * We cannot assume that SIOCGMIIPHY will also read a 460 /* We cannot assume that SIOCGMIIPHY will also read a
465 * register; not all network drivers (e.g., e100) 461 * register; not all network drivers (e.g., e100)
466 * support that. 462 * support that.
467 */ 463 */
@@ -476,8 +472,7 @@ static int bond_check_dev_link(struct bonding *bond,
476 } 472 }
477 } 473 }
478 474
479 /* 475 /* If reporting, report that either there's no dev->do_ioctl,
480 * If reporting, report that either there's no dev->do_ioctl,
481 * or both SIOCGMIIREG and get_link failed (meaning that we 476 * or both SIOCGMIIREG and get_link failed (meaning that we
482 * cannot report link status). If not reporting, pretend 477 * cannot report link status). If not reporting, pretend
483 * we're ok. 478 * we're ok.
@@ -487,9 +482,7 @@ static int bond_check_dev_link(struct bonding *bond,
487 482
488/*----------------------------- Multicast list ------------------------------*/ 483/*----------------------------- Multicast list ------------------------------*/
489 484
490/* 485/* Push the promiscuity flag down to appropriate slaves */
491 * Push the promiscuity flag down to appropriate slaves
492 */
493static int bond_set_promiscuity(struct bonding *bond, int inc) 486static int bond_set_promiscuity(struct bonding *bond, int inc)
494{ 487{
495 struct list_head *iter; 488 struct list_head *iter;
@@ -512,9 +505,7 @@ static int bond_set_promiscuity(struct bonding *bond, int inc)
512 return err; 505 return err;
513} 506}
514 507
515/* 508/* Push the allmulti flag down to all slaves */
516 * Push the allmulti flag down to all slaves
517 */
518static int bond_set_allmulti(struct bonding *bond, int inc) 509static int bond_set_allmulti(struct bonding *bond, int inc)
519{ 510{
520 struct list_head *iter; 511 struct list_head *iter;
@@ -537,8 +528,7 @@ static int bond_set_allmulti(struct bonding *bond, int inc)
537 return err; 528 return err;
538} 529}
539 530
540/* 531/* Retrieve the list of registered multicast addresses for the bonding
541 * Retrieve the list of registered multicast addresses for the bonding
542 * device and retransmit an IGMP JOIN request to the current active 532 * device and retransmit an IGMP JOIN request to the current active
543 * slave. 533 * slave.
544 */ 534 */
@@ -560,8 +550,7 @@ static void bond_resend_igmp_join_requests_delayed(struct work_struct *work)
560 rtnl_unlock(); 550 rtnl_unlock();
561} 551}
562 552
563/* Flush bond's hardware addresses from slave 553/* Flush bond's hardware addresses from slave */
564 */
565static void bond_hw_addr_flush(struct net_device *bond_dev, 554static void bond_hw_addr_flush(struct net_device *bond_dev,
566 struct net_device *slave_dev) 555 struct net_device *slave_dev)
567{ 556{
@@ -632,8 +621,7 @@ static void bond_set_dev_addr(struct net_device *bond_dev,
632 call_netdevice_notifiers(NETDEV_CHANGEADDR, bond_dev); 621 call_netdevice_notifiers(NETDEV_CHANGEADDR, bond_dev);
633} 622}
634 623
635/* 624/* bond_do_fail_over_mac
636 * bond_do_fail_over_mac
637 * 625 *
638 * Perform special MAC address swapping for fail_over_mac settings 626 * Perform special MAC address swapping for fail_over_mac settings
639 * 627 *
@@ -653,8 +641,7 @@ static void bond_do_fail_over_mac(struct bonding *bond,
653 bond_set_dev_addr(bond->dev, new_active->dev); 641 bond_set_dev_addr(bond->dev, new_active->dev);
654 break; 642 break;
655 case BOND_FOM_FOLLOW: 643 case BOND_FOM_FOLLOW:
656 /* 644 /* if new_active && old_active, swap them
657 * if new_active && old_active, swap them
658 * if just old_active, do nothing (going to no active slave) 645 * if just old_active, do nothing (going to no active slave)
659 * if just new_active, set new_active to bond's MAC 646 * if just new_active, set new_active to bond's MAC
660 */ 647 */
@@ -863,7 +850,8 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
863 /* resend IGMP joins since active slave has changed or 850 /* resend IGMP joins since active slave has changed or
864 * all were sent on curr_active_slave. 851 * all were sent on curr_active_slave.
865 * resend only if bond is brought up with the affected 852 * resend only if bond is brought up with the affected
866 * bonding modes and the retransmission is enabled */ 853 * bonding modes and the retransmission is enabled
854 */
867 if (netif_running(bond->dev) && (bond->params.resend_igmp > 0) && 855 if (netif_running(bond->dev) && (bond->params.resend_igmp > 0) &&
868 ((bond_uses_primary(bond) && new_active) || 856 ((bond_uses_primary(bond) && new_active) ||
869 BOND_MODE(bond) == BOND_MODE_ROUNDROBIN)) { 857 BOND_MODE(bond) == BOND_MODE_ROUNDROBIN)) {
@@ -1229,8 +1217,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1229 slave_dev->name); 1217 slave_dev->name);
1230 } 1218 }
1231 1219
1232 /* 1220 /* Old ifenslave binaries are no longer supported. These can
1233 * Old ifenslave binaries are no longer supported. These can
1234 * be identified with moderate accuracy by the state of the slave: 1221 * be identified with moderate accuracy by the state of the slave:
1235 * the current ifenslave will set the interface down prior to 1222 * the current ifenslave will set the interface down prior to
1236 * enslaving it; the old ifenslave will not. 1223 * enslaving it; the old ifenslave will not.
@@ -1302,7 +1289,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1302 call_netdevice_notifiers(NETDEV_JOIN, slave_dev); 1289 call_netdevice_notifiers(NETDEV_JOIN, slave_dev);
1303 1290
1304 /* If this is the first slave, then we need to set the master's hardware 1291 /* If this is the first slave, then we need to set the master's hardware
1305 * address to be the same as the slave's. */ 1292 * address to be the same as the slave's.
1293 */
1306 if (!bond_has_slaves(bond) && 1294 if (!bond_has_slaves(bond) &&
1307 bond->dev->addr_assign_type == NET_ADDR_RANDOM) 1295 bond->dev->addr_assign_type == NET_ADDR_RANDOM)
1308 bond_set_dev_addr(bond->dev, slave_dev); 1296 bond_set_dev_addr(bond->dev, slave_dev);
@@ -1315,8 +1303,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1315 1303
1316 new_slave->bond = bond; 1304 new_slave->bond = bond;
1317 new_slave->dev = slave_dev; 1305 new_slave->dev = slave_dev;
1318 /* 1306 /* Set the new_slave's queue_id to be zero. Queue ID mapping
1319 * Set the new_slave's queue_id to be zero. Queue ID mapping
1320 * is set via sysfs or module option if desired. 1307 * is set via sysfs or module option if desired.
1321 */ 1308 */
1322 new_slave->queue_id = 0; 1309 new_slave->queue_id = 0;
@@ -1329,8 +1316,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1329 goto err_free; 1316 goto err_free;
1330 } 1317 }
1331 1318
1332 /* 1319 /* Save slave's original ("permanent") mac address for modes
1333 * Save slave's original ("permanent") mac address for modes
1334 * that need it, and for restoring it upon release, and then 1320 * that need it, and for restoring it upon release, and then
1335 * set it to the master's address 1321 * set it to the master's address
1336 */ 1322 */
@@ -1338,8 +1324,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1338 1324
1339 if (!bond->params.fail_over_mac || 1325 if (!bond->params.fail_over_mac ||
1340 BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) { 1326 BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) {
1341 /* 1327 /* Set slave to master's mac address. The application already
1342 * Set slave to master's mac address. The application already
1343 * set the master's mac address to that of the first slave 1328 * set the master's mac address to that of the first slave
1344 */ 1329 */
1345 memcpy(addr.sa_data, bond_dev->dev_addr, bond_dev->addr_len); 1330 memcpy(addr.sa_data, bond_dev->dev_addr, bond_dev->addr_len);
@@ -1425,8 +1410,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1425 link_reporting = bond_check_dev_link(bond, slave_dev, 1); 1410 link_reporting = bond_check_dev_link(bond, slave_dev, 1);
1426 1411
1427 if ((link_reporting == -1) && !bond->params.arp_interval) { 1412 if ((link_reporting == -1) && !bond->params.arp_interval) {
1428 /* 1413 /* miimon is set but a bonded network driver
1429 * miimon is set but a bonded network driver
1430 * does not support ETHTOOL/MII and 1414 * does not support ETHTOOL/MII and
1431 * arp_interval is not set. Note: if 1415 * arp_interval is not set. Note: if
1432 * use_carrier is enabled, we will never go 1416 * use_carrier is enabled, we will never go
@@ -1626,8 +1610,7 @@ err_undo_flags:
1626 return res; 1610 return res;
1627} 1611}
1628 1612
1629/* 1613/* Try to release the slave device <slave> from the bond device <master>
1630 * Try to release the slave device <slave> from the bond device <master>
1631 * It is legal to access curr_active_slave without a lock because all the function 1614 * It is legal to access curr_active_slave without a lock because all the function
1632 * is RTNL-locked. If "all" is true it means that the function is being called 1615 * is RTNL-locked. If "all" is true it means that the function is being called
1633 * while destroying a bond interface and all slaves are being released. 1616 * while destroying a bond interface and all slaves are being released.
@@ -1713,8 +1696,7 @@ static int __bond_release_one(struct net_device *bond_dev,
1713 if (all) { 1696 if (all) {
1714 RCU_INIT_POINTER(bond->curr_active_slave, NULL); 1697 RCU_INIT_POINTER(bond->curr_active_slave, NULL);
1715 } else if (oldcurrent == slave) { 1698 } else if (oldcurrent == slave) {
1716 /* 1699 /* Note that we hold RTNL over this sequence, so there
1717 * Note that we hold RTNL over this sequence, so there
1718 * is no concern that another slave add/remove event 1700 * is no concern that another slave add/remove event
1719 * will interfere. 1701 * will interfere.
1720 */ 1702 */
@@ -1741,10 +1723,9 @@ static int __bond_release_one(struct net_device *bond_dev,
1741 netdev_info(bond_dev, "last VLAN challenged slave %s left bond %s - VLAN blocking is removed\n", 1723 netdev_info(bond_dev, "last VLAN challenged slave %s left bond %s - VLAN blocking is removed\n",
1742 slave_dev->name, bond_dev->name); 1724 slave_dev->name, bond_dev->name);
1743 1725
1744 /* must do this from outside any spinlocks */
1745 vlan_vids_del_by_dev(slave_dev, bond_dev); 1726 vlan_vids_del_by_dev(slave_dev, bond_dev);
1746 1727
1747 /* If the mode uses primary, then this cases was handled above by 1728 /* If the mode uses primary, then this case was handled above by
1748 * bond_change_active_slave(..., NULL) 1729 * bond_change_active_slave(..., NULL)
1749 */ 1730 */
1750 if (!bond_uses_primary(bond)) { 1731 if (!bond_uses_primary(bond)) {
@@ -1784,7 +1765,7 @@ static int __bond_release_one(struct net_device *bond_dev,
1784 1765
1785 bond_free_slave(slave); 1766 bond_free_slave(slave);
1786 1767
1787 return 0; /* deletion OK */ 1768 return 0;
1788} 1769}
1789 1770
1790/* A wrapper used because of ndo_del_link */ 1771/* A wrapper used because of ndo_del_link */
@@ -1793,10 +1774,9 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
1793 return __bond_release_one(bond_dev, slave_dev, false); 1774 return __bond_release_one(bond_dev, slave_dev, false);
1794} 1775}
1795 1776
1796/* 1777/* First release a slave and then destroy the bond if no more slaves are left.
1797* First release a slave and then destroy the bond if no more slaves are left. 1778 * Must be under rtnl_lock when this function is called.
1798* Must be under rtnl_lock when this function is called. 1779 */
1799*/
1800static int bond_release_and_destroy(struct net_device *bond_dev, 1780static int bond_release_and_destroy(struct net_device *bond_dev,
1801 struct net_device *slave_dev) 1781 struct net_device *slave_dev)
1802{ 1782{
@@ -1819,7 +1799,6 @@ static int bond_info_query(struct net_device *bond_dev, struct ifbond *info)
1819 1799
1820 info->bond_mode = BOND_MODE(bond); 1800 info->bond_mode = BOND_MODE(bond);
1821 info->miimon = bond->params.miimon; 1801 info->miimon = bond->params.miimon;
1822
1823 info->num_slaves = bond->slave_cnt; 1802 info->num_slaves = bond->slave_cnt;
1824 1803
1825 return 0; 1804 return 0;
@@ -1882,9 +1861,7 @@ static int bond_miimon_inspect(struct bonding *bond)
1882 /*FALLTHRU*/ 1861 /*FALLTHRU*/
1883 case BOND_LINK_FAIL: 1862 case BOND_LINK_FAIL:
1884 if (link_state) { 1863 if (link_state) {
1885 /* 1864 /* recovered before downdelay expired */
1886 * recovered before downdelay expired
1887 */
1888 slave->link = BOND_LINK_UP; 1865 slave->link = BOND_LINK_UP;
1889 slave->last_link_up = jiffies; 1866 slave->last_link_up = jiffies;
1890 netdev_info(bond->dev, "link status up again after %d ms for interface %s\n", 1867 netdev_info(bond->dev, "link status up again after %d ms for interface %s\n",
@@ -2036,8 +2013,7 @@ do_failover:
2036 bond_set_carrier(bond); 2013 bond_set_carrier(bond);
2037} 2014}
2038 2015
2039/* 2016/* bond_mii_monitor
2040 * bond_mii_monitor
2041 * 2017 *
2042 * Really a wrapper that splits the mii monitor into two phases: an 2018 * Really a wrapper that splits the mii monitor into two phases: an
2043 * inspection, then (if inspection indicates something needs to be done) 2019 * inspection, then (if inspection indicates something needs to be done)
@@ -2109,8 +2085,7 @@ static bool bond_has_this_ip(struct bonding *bond, __be32 ip)
2109 return ret; 2085 return ret;
2110} 2086}
2111 2087
2112/* 2088/* We go to the (large) trouble of VLAN tagging ARP frames because
2113 * We go to the (large) trouble of VLAN tagging ARP frames because
2114 * switches in VLAN mode (especially if ports are configured as 2089 * switches in VLAN mode (especially if ports are configured as
2115 * "native" to a VLAN) might not pass non-tagged frames. 2090 * "native" to a VLAN) might not pass non-tagged frames.
2116 */ 2091 */
@@ -2337,8 +2312,7 @@ int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond,
2337 2312
2338 curr_active_slave = rcu_dereference(bond->curr_active_slave); 2313 curr_active_slave = rcu_dereference(bond->curr_active_slave);
2339 2314
2340 /* 2315 /* Backup slaves won't see the ARP reply, but do come through
2341 * Backup slaves won't see the ARP reply, but do come through
2342 * here for each ARP probe (so we swap the sip/tip to validate 2316 * here for each ARP probe (so we swap the sip/tip to validate
2343 * the probe). In a "redundant switch, common router" type of 2317 * the probe). In a "redundant switch, common router" type of
2344 * configuration, the ARP probe will (hopefully) travel from 2318 * configuration, the ARP probe will (hopefully) travel from
@@ -2378,8 +2352,7 @@ static bool bond_time_in_interval(struct bonding *bond, unsigned long last_act,
2378 last_act + mod * delta_in_ticks + delta_in_ticks/2); 2352 last_act + mod * delta_in_ticks + delta_in_ticks/2);
2379} 2353}
2380 2354
2381/* 2355/* This function is called regularly to monitor each slave's link
2382 * this function is called regularly to monitor each slave's link
2383 * ensuring that traffic is being sent and received when arp monitoring 2356 * ensuring that traffic is being sent and received when arp monitoring
2384 * is used in load-balancing mode. if the adapter has been dormant, then an 2357 * is used in load-balancing mode. if the adapter has been dormant, then an
2385 * arp is transmitted to generate traffic. see activebackup_arp_monitor for 2358 * arp is transmitted to generate traffic. see activebackup_arp_monitor for
@@ -2488,8 +2461,7 @@ re_arm:
2488 msecs_to_jiffies(bond->params.arp_interval)); 2461 msecs_to_jiffies(bond->params.arp_interval));
2489} 2462}
2490 2463
2491/* 2464/* Called to inspect slaves for active-backup mode ARP monitor link state
2492 * Called to inspect slaves for active-backup mode ARP monitor link state
2493 * changes. Sets new_link in slaves to specify what action should take 2465 * changes. Sets new_link in slaves to specify what action should take
2494 * place for the slave. Returns 0 if no changes are found, >0 if changes 2466 * place for the slave. Returns 0 if no changes are found, >0 if changes
2495 * to link states must be committed. 2467 * to link states must be committed.
@@ -2515,16 +2487,14 @@ static int bond_ab_arp_inspect(struct bonding *bond)
2515 continue; 2487 continue;
2516 } 2488 }
2517 2489
2518 /* 2490 /* Give slaves 2*delta after being enslaved or made
2519 * Give slaves 2*delta after being enslaved or made
2520 * active. This avoids bouncing, as the last receive 2491 * active. This avoids bouncing, as the last receive
2521 * times need a full ARP monitor cycle to be updated. 2492 * times need a full ARP monitor cycle to be updated.
2522 */ 2493 */
2523 if (bond_time_in_interval(bond, slave->last_link_up, 2)) 2494 if (bond_time_in_interval(bond, slave->last_link_up, 2))
2524 continue; 2495 continue;
2525 2496
2526 /* 2497 /* Backup slave is down if:
2527 * Backup slave is down if:
2528 * - No current_arp_slave AND 2498 * - No current_arp_slave AND
2529 * - more than 3*delta since last receive AND 2499 * - more than 3*delta since last receive AND
2530 * - the bond has an IP address 2500 * - the bond has an IP address
@@ -2543,8 +2513,7 @@ static int bond_ab_arp_inspect(struct bonding *bond)
2543 commit++; 2513 commit++;
2544 } 2514 }
2545 2515
2546 /* 2516 /* Active slave is down if:
2547 * Active slave is down if:
2548 * - more than 2*delta since transmitting OR 2517 * - more than 2*delta since transmitting OR
2549 * - (more than 2*delta since receive AND 2518 * - (more than 2*delta since receive AND
2550 * the bond has an IP address) 2519 * the bond has an IP address)
@@ -2561,8 +2530,7 @@ static int bond_ab_arp_inspect(struct bonding *bond)
2561 return commit; 2530 return commit;
2562} 2531}
2563 2532
2564/* 2533/* Called to commit link state changes noted by inspection step of
2565 * Called to commit link state changes noted by inspection step of
2566 * active-backup mode ARP monitor. 2534 * active-backup mode ARP monitor.
2567 * 2535 *
2568 * Called with RTNL hold. 2536 * Called with RTNL hold.
@@ -2639,8 +2607,7 @@ do_failover:
2639 bond_set_carrier(bond); 2607 bond_set_carrier(bond);
2640} 2608}
2641 2609
2642/* 2610/* Send ARP probes for active-backup mode ARP monitor.
2643 * Send ARP probes for active-backup mode ARP monitor.
2644 * 2611 *
2645 * Called with rcu_read_lock held. 2612 * Called with rcu_read_lock held.
2646 */ 2613 */
@@ -2782,9 +2749,7 @@ re_arm:
2782 2749
2783/*-------------------------- netdev event handling --------------------------*/ 2750/*-------------------------- netdev event handling --------------------------*/
2784 2751
2785/* 2752/* Change device name */
2786 * Change device name
2787 */
2788static int bond_event_changename(struct bonding *bond) 2753static int bond_event_changename(struct bonding *bond)
2789{ 2754{
2790 bond_remove_proc_entry(bond); 2755 bond_remove_proc_entry(bond);
@@ -2861,13 +2826,9 @@ static int bond_slave_netdev_event(unsigned long event,
2861 } 2826 }
2862 break; 2827 break;
2863 case NETDEV_DOWN: 2828 case NETDEV_DOWN:
2864 /*
2865 * ... Or is it this?
2866 */
2867 break; 2829 break;
2868 case NETDEV_CHANGEMTU: 2830 case NETDEV_CHANGEMTU:
2869 /* 2831 /* TODO: Should slaves be allowed to
2870 * TODO: Should slaves be allowed to
2871 * independently alter their MTU? For 2832 * independently alter their MTU? For
2872 * an active-backup bond, slaves need 2833 * an active-backup bond, slaves need
2873 * not be the same type of device, so 2834 * not be the same type of device, so
@@ -2916,8 +2877,7 @@ static int bond_slave_netdev_event(unsigned long event,
2916 return NOTIFY_DONE; 2877 return NOTIFY_DONE;
2917} 2878}
2918 2879
2919/* 2880/* bond_netdev_event: handle netdev notifier chain events.
2920 * bond_netdev_event: handle netdev notifier chain events.
2921 * 2881 *
2922 * This function receives events for the netdev chain. The caller (an 2882 * This function receives events for the netdev chain. The caller (an
2923 * ioctl handler calling blocking_notifier_call_chain) holds the necessary 2883 * ioctl handler calling blocking_notifier_call_chain) holds the necessary
@@ -3187,8 +3147,7 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd
3187 mii->phy_id = 0; 3147 mii->phy_id = 0;
3188 /* Fall Through */ 3148 /* Fall Through */
3189 case SIOCGMIIREG: 3149 case SIOCGMIIREG:
3190 /* 3150 /* We do this again just in case we were called by SIOCGMIIREG
3191 * We do this again just in case we were called by SIOCGMIIREG
3192 * instead of SIOCGMIIPHY. 3151 * instead of SIOCGMIIPHY.
3193 */ 3152 */
3194 mii = if_mii(ifr); 3153 mii = if_mii(ifr);
@@ -3229,7 +3188,6 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd
3229 3188
3230 return res; 3189 return res;
3231 default: 3190 default:
3232 /* Go on */
3233 break; 3191 break;
3234 } 3192 }
3235 3193
@@ -3291,7 +3249,6 @@ static void bond_set_rx_mode(struct net_device *bond_dev)
3291 struct list_head *iter; 3249 struct list_head *iter;
3292 struct slave *slave; 3250 struct slave *slave;
3293 3251
3294
3295 rcu_read_lock(); 3252 rcu_read_lock();
3296 if (bond_uses_primary(bond)) { 3253 if (bond_uses_primary(bond)) {
3297 slave = rcu_dereference(bond->curr_active_slave); 3254 slave = rcu_dereference(bond->curr_active_slave);
@@ -3329,8 +3286,7 @@ static int bond_neigh_init(struct neighbour *n)
3329 if (ret) 3286 if (ret)
3330 return ret; 3287 return ret;
3331 3288
3332 /* 3289 /* Assign slave's neigh_cleanup to neighbour in case cleanup is called
3333 * Assign slave's neigh_cleanup to neighbour in case cleanup is called
3334 * after the last slave has been detached. Assumes that all slaves 3290 * after the last slave has been detached. Assumes that all slaves
3335 * utilize the same neigh_cleanup (true at this writing as only user 3291 * utilize the same neigh_cleanup (true at this writing as only user
3336 * is ipoib). 3292 * is ipoib).
@@ -3343,8 +3299,7 @@ static int bond_neigh_init(struct neighbour *n)
3343 return parms.neigh_setup(n); 3299 return parms.neigh_setup(n);
3344} 3300}
3345 3301
3346/* 3302/* The bonding ndo_neigh_setup is called at init time beofre any
3347 * The bonding ndo_neigh_setup is called at init time beofre any
3348 * slave exists. So we must declare proxy setup function which will 3303 * slave exists. So we must declare proxy setup function which will
3349 * be used at run time to resolve the actual slave neigh param setup. 3304 * be used at run time to resolve the actual slave neigh param setup.
3350 * 3305 *
@@ -3362,9 +3317,7 @@ static int bond_neigh_setup(struct net_device *dev,
3362 return 0; 3317 return 0;
3363} 3318}
3364 3319
3365/* 3320/* Change the MTU of all of a master's slaves to match the master */
3366 * Change the MTU of all of a master's slaves to match the master
3367 */
3368static int bond_change_mtu(struct net_device *bond_dev, int new_mtu) 3321static int bond_change_mtu(struct net_device *bond_dev, int new_mtu)
3369{ 3322{
3370 struct bonding *bond = netdev_priv(bond_dev); 3323 struct bonding *bond = netdev_priv(bond_dev);
@@ -3417,8 +3370,7 @@ unwind:
3417 return res; 3370 return res;
3418} 3371}
3419 3372
3420/* 3373/* Change HW address
3421 * Change HW address
3422 * 3374 *
3423 * Note that many devices must be down to change the HW address, and 3375 * Note that many devices must be down to change the HW address, and
3424 * downing the master releases all slaves. We can make bonds full of 3376 * downing the master releases all slaves. We can make bonds full of
@@ -3588,8 +3540,7 @@ static int bond_xmit_roundrobin(struct sk_buff *skb, struct net_device *bond_dev
3588 return NETDEV_TX_OK; 3540 return NETDEV_TX_OK;
3589} 3541}
3590 3542
3591/* 3543/* In active-backup mode, we know that bond->curr_active_slave is always valid if
3592 * in active-backup mode, we know that bond->curr_active_slave is always valid if
3593 * the bond has a usable interface. 3544 * the bond has a usable interface.
3594 */ 3545 */
3595static int bond_xmit_activebackup(struct sk_buff *skb, struct net_device *bond_dev) 3546static int bond_xmit_activebackup(struct sk_buff *skb, struct net_device *bond_dev)
@@ -3651,9 +3602,7 @@ static int bond_xmit_broadcast(struct sk_buff *skb, struct net_device *bond_dev)
3651 3602
3652/*------------------------- Device initialization ---------------------------*/ 3603/*------------------------- Device initialization ---------------------------*/
3653 3604
3654/* 3605/* Lookup the slave that corresponds to a qid */
3655 * Lookup the slave that corresponds to a qid
3656 */
3657static inline int bond_slave_override(struct bonding *bond, 3606static inline int bond_slave_override(struct bonding *bond,
3658 struct sk_buff *skb) 3607 struct sk_buff *skb)
3659{ 3608{
@@ -3682,17 +3631,14 @@ static inline int bond_slave_override(struct bonding *bond,
3682static u16 bond_select_queue(struct net_device *dev, struct sk_buff *skb, 3631static u16 bond_select_queue(struct net_device *dev, struct sk_buff *skb,
3683 void *accel_priv, select_queue_fallback_t fallback) 3632 void *accel_priv, select_queue_fallback_t fallback)
3684{ 3633{
3685 /* 3634 /* This helper function exists to help dev_pick_tx get the correct
3686 * This helper function exists to help dev_pick_tx get the correct
3687 * destination queue. Using a helper function skips a call to 3635 * destination queue. Using a helper function skips a call to
3688 * skb_tx_hash and will put the skbs in the queue we expect on their 3636 * skb_tx_hash and will put the skbs in the queue we expect on their
3689 * way down to the bonding driver. 3637 * way down to the bonding driver.
3690 */ 3638 */
3691 u16 txq = skb_rx_queue_recorded(skb) ? skb_get_rx_queue(skb) : 0; 3639 u16 txq = skb_rx_queue_recorded(skb) ? skb_get_rx_queue(skb) : 0;
3692 3640
3693 /* 3641 /* Save the original txq to restore before passing to the driver */
3694 * Save the original txq to restore before passing to the driver
3695 */
3696 qdisc_skb_cb(skb)->slave_dev_queue_mapping = skb->queue_mapping; 3642 qdisc_skb_cb(skb)->slave_dev_queue_mapping = skb->queue_mapping;
3697 3643
3698 if (unlikely(txq >= dev->real_num_tx_queues)) { 3644 if (unlikely(txq >= dev->real_num_tx_queues)) {
@@ -3740,8 +3686,7 @@ static netdev_tx_t bond_start_xmit(struct sk_buff *skb, struct net_device *dev)
3740 struct bonding *bond = netdev_priv(dev); 3686 struct bonding *bond = netdev_priv(dev);
3741 netdev_tx_t ret = NETDEV_TX_OK; 3687 netdev_tx_t ret = NETDEV_TX_OK;
3742 3688
3743 /* 3689 /* If we risk deadlock from transmitting this in the
3744 * If we risk deadlock from transmitting this in the
3745 * netpoll path, tell netpoll to queue the frame for later tx 3690 * netpoll path, tell netpoll to queue the frame for later tx
3746 */ 3691 */
3747 if (unlikely(is_netpoll_tx_blocked(dev))) 3692 if (unlikely(is_netpoll_tx_blocked(dev)))
@@ -3865,8 +3810,7 @@ void bond_setup(struct net_device *bond_dev)
3865 bond_dev->priv_flags |= IFF_BONDING | IFF_UNICAST_FLT; 3810 bond_dev->priv_flags |= IFF_BONDING | IFF_UNICAST_FLT;
3866 bond_dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING); 3811 bond_dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING);
3867 3812
3868 /* don't acquire bond device's netif_tx_lock when 3813 /* don't acquire bond device's netif_tx_lock when transmitting */
3869 * transmitting */
3870 bond_dev->features |= NETIF_F_LLTX; 3814 bond_dev->features |= NETIF_F_LLTX;
3871 3815
3872 /* By default, we declare the bond to be fully 3816 /* By default, we declare the bond to be fully
@@ -3889,10 +3833,9 @@ void bond_setup(struct net_device *bond_dev)
3889 bond_dev->features |= bond_dev->hw_features; 3833 bond_dev->features |= bond_dev->hw_features;
3890} 3834}
3891 3835
3892/* 3836/* Destroy a bonding device.
3893* Destroy a bonding device. 3837 * Must be under rtnl_lock when this function is called.
3894* Must be under rtnl_lock when this function is called. 3838 */
3895*/
3896static void bond_uninit(struct net_device *bond_dev) 3839static void bond_uninit(struct net_device *bond_dev)
3897{ 3840{
3898 struct bonding *bond = netdev_priv(bond_dev); 3841 struct bonding *bond = netdev_priv(bond_dev);
@@ -3920,9 +3863,7 @@ static int bond_check_params(struct bond_params *params)
3920 const struct bond_opt_value *valptr; 3863 const struct bond_opt_value *valptr;
3921 int arp_all_targets_value; 3864 int arp_all_targets_value;
3922 3865
3923 /* 3866 /* Convert string parameters. */
3924 * Convert string parameters.
3925 */
3926 if (mode) { 3867 if (mode) {
3927 bond_opt_initstr(&newval, mode); 3868 bond_opt_initstr(&newval, mode);
3928 valptr = bond_opt_parse(bond_opt_get(BOND_OPT_MODE), &newval); 3869 valptr = bond_opt_parse(bond_opt_get(BOND_OPT_MODE), &newval);
@@ -4099,9 +4040,9 @@ static int bond_check_params(struct bond_params *params)
4099 4040
4100 for (arp_ip_count = 0, i = 0; 4041 for (arp_ip_count = 0, i = 0;
4101 (arp_ip_count < BOND_MAX_ARP_TARGETS) && arp_ip_target[i]; i++) { 4042 (arp_ip_count < BOND_MAX_ARP_TARGETS) && arp_ip_target[i]; i++) {
4102 /* not complete check, but should be good enough to
4103 catch mistakes */
4104 __be32 ip; 4043 __be32 ip;
4044
4045 /* not a complete check, but good enough to catch mistakes */
4105 if (!in4_pton(arp_ip_target[i], -1, (u8 *)&ip, -1, NULL) || 4046 if (!in4_pton(arp_ip_target[i], -1, (u8 *)&ip, -1, NULL) ||
4106 !bond_is_ip_target_ok(ip)) { 4047 !bond_is_ip_target_ok(ip)) {
4107 pr_warn("Warning: bad arp_ip_target module parameter (%s), ARP monitoring will not be performed\n", 4048 pr_warn("Warning: bad arp_ip_target module parameter (%s), ARP monitoring will not be performed\n",
@@ -4284,9 +4225,7 @@ static void bond_set_lockdep_class(struct net_device *dev)
4284 dev->qdisc_tx_busylock = &bonding_tx_busylock_key; 4225 dev->qdisc_tx_busylock = &bonding_tx_busylock_key;
4285} 4226}
4286 4227
4287/* 4228/* Called from registration process */
4288 * Called from registration process
4289 */
4290static int bond_init(struct net_device *bond_dev) 4229static int bond_init(struct net_device *bond_dev)
4291{ 4230{
4292 struct bonding *bond = netdev_priv(bond_dev); 4231 struct bonding *bond = netdev_priv(bond_dev);
@@ -4440,9 +4379,7 @@ static void __exit bonding_exit(void)
4440 unregister_pernet_subsys(&bond_net_ops); 4379 unregister_pernet_subsys(&bond_net_ops);
4441 4380
4442#ifdef CONFIG_NET_POLL_CONTROLLER 4381#ifdef CONFIG_NET_POLL_CONTROLLER
4443 /* 4382 /* Make sure we don't have an imbalance on our netpoll blocking */
4444 * Make sure we don't have an imbalance on our netpoll blocking
4445 */
4446 WARN_ON(atomic_read(&netpoll_block_tx)); 4383 WARN_ON(atomic_read(&netpoll_block_tx));
4447#endif 4384#endif
4448} 4385}
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 5555517284db..8ffbafd500fd 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -91,7 +91,6 @@ static struct net_device *bond_get_by_name(struct bond_net *bn, const char *ifna
91 * creates and deletes entire bonds. 91 * creates and deletes entire bonds.
92 * 92 *
93 * The class parameter is ignored. 93 * The class parameter is ignored.
94 *
95 */ 94 */
96static ssize_t bonding_store_bonds(struct class *cls, 95static ssize_t bonding_store_bonds(struct class *cls,
97 struct class_attribute *attr, 96 struct class_attribute *attr,
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 3aff1a815e89..6140bf0264a4 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -197,7 +197,8 @@ struct bonding {
197 struct slave *); 197 struct slave *);
198 /* mode_lock is used for mode-specific locking needs, currently used by: 198 /* mode_lock is used for mode-specific locking needs, currently used by:
199 * 3ad mode (4) - protect against running bond_3ad_unbind_slave() and 199 * 3ad mode (4) - protect against running bond_3ad_unbind_slave() and
200 * bond_3ad_state_machine_handler() concurrently. 200 * bond_3ad_state_machine_handler() concurrently and also
201 * the access to the state machine shared variables.
201 * TLB mode (5) - to sync the use and modifications of its hash table 202 * TLB mode (5) - to sync the use and modifications of its hash table
202 * ALB mode (6) - to sync the use and modifications of its hash table 203 * ALB mode (6) - to sync the use and modifications of its hash table
203 */ 204 */