aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding
diff options
context:
space:
mode:
authorNikolay Aleksandrov <nikolay@redhat.com>2014-09-11 16:49:28 -0400
committerDavid S. Miller <davem@davemloft.net>2014-09-13 16:29:07 -0400
commit8c0bc550288d81e9ad8a2ed9136a72140b9ef507 (patch)
tree40b4a29e8721c329dbc2d1b2332f4beecbef45e5 /drivers/net/bonding
parente470259fa1bd7ce5a375b16c5ec97cc0e83b058d (diff)
bonding: adjust locking comments
Now that locks have been removed, remove some unnecessary comments and adjust others to reflect reality. Also add a comment to "mode_lock" to describe its current users and give a brief summary why they need it. 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_alb.c8
-rw-r--r--drivers/net/bonding/bond_main.c6
-rw-r--r--drivers/net/bonding/bonding.h6
3 files changed, 10 insertions, 10 deletions
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 876b97fb55e9..85af961f1317 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -119,7 +119,6 @@ static inline void tlb_init_slave(struct slave *slave)
119 SLAVE_TLB_INFO(slave).head = TLB_NULL_INDEX; 119 SLAVE_TLB_INFO(slave).head = TLB_NULL_INDEX;
120} 120}
121 121
122/* Caller must hold bond lock for read, BH disabled */
123static void __tlb_clear_slave(struct bonding *bond, struct slave *slave, 122static void __tlb_clear_slave(struct bonding *bond, struct slave *slave,
124 int save_load) 123 int save_load)
125{ 124{
@@ -142,7 +141,6 @@ static void __tlb_clear_slave(struct bonding *bond, struct slave *slave,
142 tlb_init_slave(slave); 141 tlb_init_slave(slave);
143} 142}
144 143
145/* Caller must hold bond lock for read */
146static void tlb_clear_slave(struct bonding *bond, struct slave *slave, 144static void tlb_clear_slave(struct bonding *bond, struct slave *slave,
147 int save_load) 145 int save_load)
148{ 146{
@@ -199,7 +197,6 @@ static long long compute_gap(struct slave *slave)
199 (s64) (SLAVE_TLB_INFO(slave).load << 3); /* Bytes to bits */ 197 (s64) (SLAVE_TLB_INFO(slave).load << 3); /* Bytes to bits */
200} 198}
201 199
202/* Caller must hold bond lock for read */
203static struct slave *tlb_get_least_loaded_slave(struct bonding *bond) 200static struct slave *tlb_get_least_loaded_slave(struct bonding *bond)
204{ 201{
205 struct slave *slave, *least_loaded; 202 struct slave *slave, *least_loaded;
@@ -337,7 +334,6 @@ out:
337 return RX_HANDLER_ANOTHER; 334 return RX_HANDLER_ANOTHER;
338} 335}
339 336
340/* Caller must hold bond lock for read */
341static struct slave *rlb_next_rx_slave(struct bonding *bond) 337static struct slave *rlb_next_rx_slave(struct bonding *bond)
342{ 338{
343 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); 339 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
@@ -370,7 +366,7 @@ static struct slave *rlb_next_rx_slave(struct bonding *bond)
370 return rx_slave; 366 return rx_slave;
371} 367}
372 368
373/* Caller must hold rcu_read_lock() for read */ 369/* Caller must hold rcu_read_lock() */
374static struct slave *__rlb_next_rx_slave(struct bonding *bond) 370static struct slave *__rlb_next_rx_slave(struct bonding *bond)
375{ 371{
376 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); 372 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
@@ -749,7 +745,6 @@ static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond)
749 return tx_slave; 745 return tx_slave;
750} 746}
751 747
752/* Caller must hold bond lock for read */
753static void rlb_rebalance(struct bonding *bond) 748static void rlb_rebalance(struct bonding *bond)
754{ 749{
755 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); 750 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
@@ -1677,7 +1672,6 @@ void bond_alb_deinit_slave(struct bonding *bond, struct slave *slave)
1677 1672
1678} 1673}
1679 1674
1680/* Caller must hold bond lock for read */
1681void bond_alb_handle_link_change(struct bonding *bond, struct slave *slave, char link) 1675void bond_alb_handle_link_change(struct bonding *bond, struct slave *slave, char link)
1682{ 1676{
1683 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); 1677 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 116cf6965bc5..2d90a8b7f62e 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1629,7 +1629,7 @@ err_undo_flags:
1629/* 1629/*
1630 * 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 1631 * It is legal to access curr_active_slave without a lock because all the function
1632 * is write-locked. If "all" is true it means that the function is being called 1632 * 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. 1633 * while destroying a bond interface and all slaves are being released.
1634 * 1634 *
1635 * The rules for slave state should be: 1635 * The rules for slave state should be:
@@ -2494,7 +2494,7 @@ re_arm:
2494 * place for the slave. Returns 0 if no changes are found, >0 if changes 2494 * place for the slave. Returns 0 if no changes are found, >0 if changes
2495 * to link states must be committed. 2495 * to link states must be committed.
2496 * 2496 *
2497 * Called with rcu_read_lock hold. 2497 * Called with rcu_read_lock held.
2498 */ 2498 */
2499static int bond_ab_arp_inspect(struct bonding *bond) 2499static int bond_ab_arp_inspect(struct bonding *bond)
2500{ 2500{
@@ -2642,7 +2642,7 @@ do_failover:
2642/* 2642/*
2643 * Send ARP probes for active-backup mode ARP monitor. 2643 * Send ARP probes for active-backup mode ARP monitor.
2644 * 2644 *
2645 * Called with rcu_read_lock hold. 2645 * Called with rcu_read_lock held.
2646 */ 2646 */
2647static bool bond_ab_arp_probe(struct bonding *bond) 2647static bool bond_ab_arp_probe(struct bonding *bond)
2648{ 2648{
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 0cda34b827f8..3aff1a815e89 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -195,6 +195,12 @@ struct bonding {
195 s32 slave_cnt; /* never change this value outside the attach/detach wrappers */ 195 s32 slave_cnt; /* never change this value outside the attach/detach wrappers */
196 int (*recv_probe)(const struct sk_buff *, struct bonding *, 196 int (*recv_probe)(const struct sk_buff *, struct bonding *,
197 struct slave *); 197 struct slave *);
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
200 * bond_3ad_state_machine_handler() concurrently.
201 * 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 */
198 spinlock_t mode_lock; 204 spinlock_t mode_lock;
199 u8 send_peer_notif; 205 u8 send_peer_notif;
200 u8 igmp_retrans; 206 u8 igmp_retrans;