diff options
author | Nikolay Aleksandrov <nikolay@redhat.com> | 2014-09-15 11:19:34 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-09-15 17:19:49 -0400 |
commit | 547942cace50e536dcda9ce8397792bc992291d6 (patch) | |
tree | bf6f6d59aee34e92b3b00fd6d1e4c5e49f5a964f /drivers/net/bonding/bond_alb.c | |
parent | 56924c3811ae843527f7a1090ead73a0acf704a4 (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/bond_alb.c')
-rw-r--r-- | drivers/net/bonding/bond_alb.c | 48 |
1 files changed, 20 insertions, 28 deletions
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 */ |
760 | static void rlb_init_table_entry_dst(struct rlb_client_info *entry) | 759 | static 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 | */ | ||
849 | static void rlb_purge_src_ip(struct bonding *bond, struct arp_pkt *arp) | 849 | static 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 | |||
1044 | static void alb_swap_mac_addr(struct slave *slave1, struct slave *slave2) | 1042 | static 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 | ||
1308 | static int bond_do_alb_xmit(struct sk_buff *skb, struct bonding *bond, | 1304 | static 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 | */ |