diff options
author | Nikolay Aleksandrov <nikolay@redhat.com> | 2014-09-11 16:49:26 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-09-13 16:29:07 -0400 |
commit | 4bab16d7c97498e91564231b922d49f52efaf7d4 (patch) | |
tree | 78d3ab74fa02b046b773bf7e2b547a7079e121a4 /drivers/net/bonding | |
parent | b743562819bd97cc7c282e870896bae8016b64b5 (diff) |
bonding: alb: convert to bond->mode_lock
The ALB/TLB specific spinlocks are no longer necessary as we now have
bond->mode_lock for this purpose, so convert them and remove them from
struct alb_bond_info.
Also remove the unneeded lock/unlock functions and use spin_lock/unlock
directly.
Suggested-by: Jay Vosburgh <jay.vosburgh@canonical.com>
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.c | 108 | ||||
-rw-r--r-- | drivers/net/bonding/bond_alb.h | 2 | ||||
-rw-r--r-- | drivers/net/bonding/bond_debugfs.c | 4 | ||||
-rw-r--r-- | drivers/net/bonding/bond_main.c | 10 |
4 files changed, 35 insertions, 89 deletions
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index b755659ddfdc..876b97fb55e9 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c | |||
@@ -100,27 +100,6 @@ static inline u8 _simple_hash(const u8 *hash_start, int hash_size) | |||
100 | 100 | ||
101 | /*********************** tlb specific functions ***************************/ | 101 | /*********************** tlb specific functions ***************************/ |
102 | 102 | ||
103 | static inline void _lock_tx_hashtbl_bh(struct bonding *bond) | ||
104 | { | ||
105 | spin_lock_bh(&(BOND_ALB_INFO(bond).tx_hashtbl_lock)); | ||
106 | } | ||
107 | |||
108 | static inline void _unlock_tx_hashtbl_bh(struct bonding *bond) | ||
109 | { | ||
110 | spin_unlock_bh(&(BOND_ALB_INFO(bond).tx_hashtbl_lock)); | ||
111 | } | ||
112 | |||
113 | static inline void _lock_tx_hashtbl(struct bonding *bond) | ||
114 | { | ||
115 | spin_lock(&(BOND_ALB_INFO(bond).tx_hashtbl_lock)); | ||
116 | } | ||
117 | |||
118 | static inline void _unlock_tx_hashtbl(struct bonding *bond) | ||
119 | { | ||
120 | spin_unlock(&(BOND_ALB_INFO(bond).tx_hashtbl_lock)); | ||
121 | } | ||
122 | |||
123 | /* Caller must hold tx_hashtbl lock */ | ||
124 | static inline void tlb_init_table_entry(struct tlb_client_info *entry, int save_load) | 103 | static inline void tlb_init_table_entry(struct tlb_client_info *entry, int save_load) |
125 | { | 104 | { |
126 | if (save_load) { | 105 | if (save_load) { |
@@ -167,9 +146,9 @@ static void __tlb_clear_slave(struct bonding *bond, struct slave *slave, | |||
167 | static void tlb_clear_slave(struct bonding *bond, struct slave *slave, | 146 | static void tlb_clear_slave(struct bonding *bond, struct slave *slave, |
168 | int save_load) | 147 | int save_load) |
169 | { | 148 | { |
170 | _lock_tx_hashtbl_bh(bond); | 149 | spin_lock_bh(&bond->mode_lock); |
171 | __tlb_clear_slave(bond, slave, save_load); | 150 | __tlb_clear_slave(bond, slave, save_load); |
172 | _unlock_tx_hashtbl_bh(bond); | 151 | spin_unlock_bh(&bond->mode_lock); |
173 | } | 152 | } |
174 | 153 | ||
175 | /* Must be called before starting the monitor timer */ | 154 | /* Must be called before starting the monitor timer */ |
@@ -184,14 +163,14 @@ static int tlb_initialize(struct bonding *bond) | |||
184 | if (!new_hashtbl) | 163 | if (!new_hashtbl) |
185 | return -1; | 164 | return -1; |
186 | 165 | ||
187 | _lock_tx_hashtbl_bh(bond); | 166 | spin_lock_bh(&bond->mode_lock); |
188 | 167 | ||
189 | bond_info->tx_hashtbl = new_hashtbl; | 168 | bond_info->tx_hashtbl = new_hashtbl; |
190 | 169 | ||
191 | for (i = 0; i < TLB_HASH_TABLE_SIZE; i++) | 170 | for (i = 0; i < TLB_HASH_TABLE_SIZE; i++) |
192 | tlb_init_table_entry(&bond_info->tx_hashtbl[i], 0); | 171 | tlb_init_table_entry(&bond_info->tx_hashtbl[i], 0); |
193 | 172 | ||
194 | _unlock_tx_hashtbl_bh(bond); | 173 | spin_unlock_bh(&bond->mode_lock); |
195 | 174 | ||
196 | return 0; | 175 | return 0; |
197 | } | 176 | } |
@@ -202,12 +181,12 @@ static void tlb_deinitialize(struct bonding *bond) | |||
202 | struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); | 181 | struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); |
203 | struct tlb_up_slave *arr; | 182 | struct tlb_up_slave *arr; |
204 | 183 | ||
205 | _lock_tx_hashtbl_bh(bond); | 184 | spin_lock_bh(&bond->mode_lock); |
206 | 185 | ||
207 | kfree(bond_info->tx_hashtbl); | 186 | kfree(bond_info->tx_hashtbl); |
208 | bond_info->tx_hashtbl = NULL; | 187 | bond_info->tx_hashtbl = NULL; |
209 | 188 | ||
210 | _unlock_tx_hashtbl_bh(bond); | 189 | spin_unlock_bh(&bond->mode_lock); |
211 | 190 | ||
212 | arr = rtnl_dereference(bond_info->slave_arr); | 191 | arr = rtnl_dereference(bond_info->slave_arr); |
213 | if (arr) | 192 | if (arr) |
@@ -281,7 +260,6 @@ static struct slave *__tlb_choose_channel(struct bonding *bond, u32 hash_index, | |||
281 | return assigned_slave; | 260 | return assigned_slave; |
282 | } | 261 | } |
283 | 262 | ||
284 | /* Caller must hold bond lock for read */ | ||
285 | static struct slave *tlb_choose_channel(struct bonding *bond, u32 hash_index, | 263 | static struct slave *tlb_choose_channel(struct bonding *bond, u32 hash_index, |
286 | u32 skb_len) | 264 | u32 skb_len) |
287 | { | 265 | { |
@@ -291,32 +269,13 @@ static struct slave *tlb_choose_channel(struct bonding *bond, u32 hash_index, | |||
291 | * tlb_choose_channel() is only called by bond_alb_xmit() | 269 | * tlb_choose_channel() is only called by bond_alb_xmit() |
292 | * which already has softirq disabled. | 270 | * which already has softirq disabled. |
293 | */ | 271 | */ |
294 | _lock_tx_hashtbl(bond); | 272 | spin_lock(&bond->mode_lock); |
295 | tx_slave = __tlb_choose_channel(bond, hash_index, skb_len); | 273 | tx_slave = __tlb_choose_channel(bond, hash_index, skb_len); |
296 | _unlock_tx_hashtbl(bond); | 274 | spin_unlock(&bond->mode_lock); |
297 | return tx_slave; | 275 | return tx_slave; |
298 | } | 276 | } |
299 | 277 | ||
300 | /*********************** rlb specific functions ***************************/ | 278 | /*********************** rlb specific functions ***************************/ |
301 | static inline void _lock_rx_hashtbl_bh(struct bonding *bond) | ||
302 | { | ||
303 | spin_lock_bh(&(BOND_ALB_INFO(bond).rx_hashtbl_lock)); | ||
304 | } | ||
305 | |||
306 | static inline void _unlock_rx_hashtbl_bh(struct bonding *bond) | ||
307 | { | ||
308 | spin_unlock_bh(&(BOND_ALB_INFO(bond).rx_hashtbl_lock)); | ||
309 | } | ||
310 | |||
311 | static inline void _lock_rx_hashtbl(struct bonding *bond) | ||
312 | { | ||
313 | spin_lock(&(BOND_ALB_INFO(bond).rx_hashtbl_lock)); | ||
314 | } | ||
315 | |||
316 | static inline void _unlock_rx_hashtbl(struct bonding *bond) | ||
317 | { | ||
318 | spin_unlock(&(BOND_ALB_INFO(bond).rx_hashtbl_lock)); | ||
319 | } | ||
320 | 279 | ||
321 | /* when an ARP REPLY is received from a client update its info | 280 | /* when an ARP REPLY is received from a client update its info |
322 | * in the rx_hashtbl | 281 | * in the rx_hashtbl |
@@ -327,7 +286,7 @@ static void rlb_update_entry_from_arp(struct bonding *bond, struct arp_pkt *arp) | |||
327 | struct rlb_client_info *client_info; | 286 | struct rlb_client_info *client_info; |
328 | u32 hash_index; | 287 | u32 hash_index; |
329 | 288 | ||
330 | _lock_rx_hashtbl_bh(bond); | 289 | spin_lock_bh(&bond->mode_lock); |
331 | 290 | ||
332 | hash_index = _simple_hash((u8 *)&(arp->ip_src), sizeof(arp->ip_src)); | 291 | hash_index = _simple_hash((u8 *)&(arp->ip_src), sizeof(arp->ip_src)); |
333 | client_info = &(bond_info->rx_hashtbl[hash_index]); | 292 | client_info = &(bond_info->rx_hashtbl[hash_index]); |
@@ -342,7 +301,7 @@ static void rlb_update_entry_from_arp(struct bonding *bond, struct arp_pkt *arp) | |||
342 | bond_info->rx_ntt = 1; | 301 | bond_info->rx_ntt = 1; |
343 | } | 302 | } |
344 | 303 | ||
345 | _unlock_rx_hashtbl_bh(bond); | 304 | spin_unlock_bh(&bond->mode_lock); |
346 | } | 305 | } |
347 | 306 | ||
348 | static int rlb_arp_recv(const struct sk_buff *skb, struct bonding *bond, | 307 | static int rlb_arp_recv(const struct sk_buff *skb, struct bonding *bond, |
@@ -479,7 +438,7 @@ static void rlb_clear_slave(struct bonding *bond, struct slave *slave) | |||
479 | u32 index, next_index; | 438 | u32 index, next_index; |
480 | 439 | ||
481 | /* clear slave from rx_hashtbl */ | 440 | /* clear slave from rx_hashtbl */ |
482 | _lock_rx_hashtbl_bh(bond); | 441 | spin_lock_bh(&bond->mode_lock); |
483 | 442 | ||
484 | rx_hash_table = bond_info->rx_hashtbl; | 443 | rx_hash_table = bond_info->rx_hashtbl; |
485 | index = bond_info->rx_hashtbl_used_head; | 444 | index = bond_info->rx_hashtbl_used_head; |
@@ -510,7 +469,7 @@ static void rlb_clear_slave(struct bonding *bond, struct slave *slave) | |||
510 | } | 469 | } |
511 | } | 470 | } |
512 | 471 | ||
513 | _unlock_rx_hashtbl_bh(bond); | 472 | spin_unlock_bh(&bond->mode_lock); |
514 | 473 | ||
515 | if (slave != rtnl_dereference(bond->curr_active_slave)) | 474 | if (slave != rtnl_dereference(bond->curr_active_slave)) |
516 | rlb_teach_disabled_mac_on_primary(bond, slave->dev->dev_addr); | 475 | rlb_teach_disabled_mac_on_primary(bond, slave->dev->dev_addr); |
@@ -561,7 +520,7 @@ static void rlb_update_rx_clients(struct bonding *bond) | |||
561 | struct rlb_client_info *client_info; | 520 | struct rlb_client_info *client_info; |
562 | u32 hash_index; | 521 | u32 hash_index; |
563 | 522 | ||
564 | _lock_rx_hashtbl_bh(bond); | 523 | spin_lock_bh(&bond->mode_lock); |
565 | 524 | ||
566 | hash_index = bond_info->rx_hashtbl_used_head; | 525 | hash_index = bond_info->rx_hashtbl_used_head; |
567 | for (; hash_index != RLB_NULL_INDEX; | 526 | for (; hash_index != RLB_NULL_INDEX; |
@@ -579,7 +538,7 @@ static void rlb_update_rx_clients(struct bonding *bond) | |||
579 | */ | 538 | */ |
580 | bond_info->rlb_update_delay_counter = RLB_UPDATE_DELAY; | 539 | bond_info->rlb_update_delay_counter = RLB_UPDATE_DELAY; |
581 | 540 | ||
582 | _unlock_rx_hashtbl_bh(bond); | 541 | spin_unlock_bh(&bond->mode_lock); |
583 | } | 542 | } |
584 | 543 | ||
585 | /* The slave was assigned a new mac address - update the clients */ | 544 | /* The slave was assigned a new mac address - update the clients */ |
@@ -590,7 +549,7 @@ static void rlb_req_update_slave_clients(struct bonding *bond, struct slave *sla | |||
590 | int ntt = 0; | 549 | int ntt = 0; |
591 | u32 hash_index; | 550 | u32 hash_index; |
592 | 551 | ||
593 | _lock_rx_hashtbl_bh(bond); | 552 | spin_lock_bh(&bond->mode_lock); |
594 | 553 | ||
595 | hash_index = bond_info->rx_hashtbl_used_head; | 554 | hash_index = bond_info->rx_hashtbl_used_head; |
596 | for (; hash_index != RLB_NULL_INDEX; | 555 | for (; hash_index != RLB_NULL_INDEX; |
@@ -611,7 +570,7 @@ static void rlb_req_update_slave_clients(struct bonding *bond, struct slave *sla | |||
611 | bond_info->rlb_update_retry_counter = RLB_UPDATE_RETRY; | 570 | bond_info->rlb_update_retry_counter = RLB_UPDATE_RETRY; |
612 | } | 571 | } |
613 | 572 | ||
614 | _unlock_rx_hashtbl_bh(bond); | 573 | spin_unlock_bh(&bond->mode_lock); |
615 | } | 574 | } |
616 | 575 | ||
617 | /* mark all clients using src_ip to be updated */ | 576 | /* mark all clients using src_ip to be updated */ |
@@ -621,7 +580,7 @@ static void rlb_req_update_subnet_clients(struct bonding *bond, __be32 src_ip) | |||
621 | struct rlb_client_info *client_info; | 580 | struct rlb_client_info *client_info; |
622 | u32 hash_index; | 581 | u32 hash_index; |
623 | 582 | ||
624 | _lock_rx_hashtbl(bond); | 583 | spin_lock(&bond->mode_lock); |
625 | 584 | ||
626 | hash_index = bond_info->rx_hashtbl_used_head; | 585 | hash_index = bond_info->rx_hashtbl_used_head; |
627 | for (; hash_index != RLB_NULL_INDEX; | 586 | for (; hash_index != RLB_NULL_INDEX; |
@@ -645,10 +604,9 @@ static void rlb_req_update_subnet_clients(struct bonding *bond, __be32 src_ip) | |||
645 | } | 604 | } |
646 | } | 605 | } |
647 | 606 | ||
648 | _unlock_rx_hashtbl(bond); | 607 | spin_unlock(&bond->mode_lock); |
649 | } | 608 | } |
650 | 609 | ||
651 | /* Caller must hold both bond and ptr locks for read */ | ||
652 | static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bond) | 610 | static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bond) |
653 | { | 611 | { |
654 | struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); | 612 | struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); |
@@ -657,7 +615,7 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bon | |||
657 | struct rlb_client_info *client_info; | 615 | struct rlb_client_info *client_info; |
658 | u32 hash_index = 0; | 616 | u32 hash_index = 0; |
659 | 617 | ||
660 | _lock_rx_hashtbl(bond); | 618 | spin_lock(&bond->mode_lock); |
661 | 619 | ||
662 | curr_active_slave = rcu_dereference(bond->curr_active_slave); | 620 | curr_active_slave = rcu_dereference(bond->curr_active_slave); |
663 | 621 | ||
@@ -676,7 +634,7 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bon | |||
676 | 634 | ||
677 | assigned_slave = client_info->slave; | 635 | assigned_slave = client_info->slave; |
678 | if (assigned_slave) { | 636 | if (assigned_slave) { |
679 | _unlock_rx_hashtbl(bond); | 637 | spin_unlock(&bond->mode_lock); |
680 | return assigned_slave; | 638 | return assigned_slave; |
681 | } | 639 | } |
682 | } else { | 640 | } else { |
@@ -738,7 +696,7 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bon | |||
738 | } | 696 | } |
739 | } | 697 | } |
740 | 698 | ||
741 | _unlock_rx_hashtbl(bond); | 699 | spin_unlock(&bond->mode_lock); |
742 | 700 | ||
743 | return assigned_slave; | 701 | return assigned_slave; |
744 | } | 702 | } |
@@ -800,7 +758,7 @@ static void rlb_rebalance(struct bonding *bond) | |||
800 | int ntt; | 758 | int ntt; |
801 | u32 hash_index; | 759 | u32 hash_index; |
802 | 760 | ||
803 | _lock_rx_hashtbl_bh(bond); | 761 | spin_lock_bh(&bond->mode_lock); |
804 | 762 | ||
805 | ntt = 0; | 763 | ntt = 0; |
806 | hash_index = bond_info->rx_hashtbl_used_head; | 764 | hash_index = bond_info->rx_hashtbl_used_head; |
@@ -818,7 +776,7 @@ static void rlb_rebalance(struct bonding *bond) | |||
818 | /* update the team's flag only after the whole iteration */ | 776 | /* update the team's flag only after the whole iteration */ |
819 | if (ntt) | 777 | if (ntt) |
820 | bond_info->rx_ntt = 1; | 778 | bond_info->rx_ntt = 1; |
821 | _unlock_rx_hashtbl_bh(bond); | 779 | spin_unlock_bh(&bond->mode_lock); |
822 | } | 780 | } |
823 | 781 | ||
824 | /* Caller must hold rx_hashtbl lock */ | 782 | /* Caller must hold rx_hashtbl lock */ |
@@ -917,7 +875,7 @@ static void rlb_purge_src_ip(struct bonding *bond, struct arp_pkt *arp) | |||
917 | u32 ip_src_hash = _simple_hash((u8 *)&(arp->ip_src), sizeof(arp->ip_src)); | 875 | u32 ip_src_hash = _simple_hash((u8 *)&(arp->ip_src), sizeof(arp->ip_src)); |
918 | u32 index; | 876 | u32 index; |
919 | 877 | ||
920 | _lock_rx_hashtbl_bh(bond); | 878 | spin_lock_bh(&bond->mode_lock); |
921 | 879 | ||
922 | index = bond_info->rx_hashtbl[ip_src_hash].src_first; | 880 | index = bond_info->rx_hashtbl[ip_src_hash].src_first; |
923 | while (index != RLB_NULL_INDEX) { | 881 | while (index != RLB_NULL_INDEX) { |
@@ -928,7 +886,7 @@ static void rlb_purge_src_ip(struct bonding *bond, struct arp_pkt *arp) | |||
928 | rlb_delete_table_entry(bond, index); | 886 | rlb_delete_table_entry(bond, index); |
929 | index = next_index; | 887 | index = next_index; |
930 | } | 888 | } |
931 | _unlock_rx_hashtbl_bh(bond); | 889 | spin_unlock_bh(&bond->mode_lock); |
932 | } | 890 | } |
933 | 891 | ||
934 | static int rlb_initialize(struct bonding *bond) | 892 | static int rlb_initialize(struct bonding *bond) |
@@ -942,7 +900,7 @@ static int rlb_initialize(struct bonding *bond) | |||
942 | if (!new_hashtbl) | 900 | if (!new_hashtbl) |
943 | return -1; | 901 | return -1; |
944 | 902 | ||
945 | _lock_rx_hashtbl_bh(bond); | 903 | spin_lock_bh(&bond->mode_lock); |
946 | 904 | ||
947 | bond_info->rx_hashtbl = new_hashtbl; | 905 | bond_info->rx_hashtbl = new_hashtbl; |
948 | 906 | ||
@@ -951,7 +909,7 @@ static int rlb_initialize(struct bonding *bond) | |||
951 | for (i = 0; i < RLB_HASH_TABLE_SIZE; i++) | 909 | for (i = 0; i < RLB_HASH_TABLE_SIZE; i++) |
952 | rlb_init_table_entry(bond_info->rx_hashtbl + i); | 910 | rlb_init_table_entry(bond_info->rx_hashtbl + i); |
953 | 911 | ||
954 | _unlock_rx_hashtbl_bh(bond); | 912 | spin_unlock_bh(&bond->mode_lock); |
955 | 913 | ||
956 | /* register to receive ARPs */ | 914 | /* register to receive ARPs */ |
957 | bond->recv_probe = rlb_arp_recv; | 915 | bond->recv_probe = rlb_arp_recv; |
@@ -963,13 +921,13 @@ static void rlb_deinitialize(struct bonding *bond) | |||
963 | { | 921 | { |
964 | struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); | 922 | struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); |
965 | 923 | ||
966 | _lock_rx_hashtbl_bh(bond); | 924 | spin_lock_bh(&bond->mode_lock); |
967 | 925 | ||
968 | kfree(bond_info->rx_hashtbl); | 926 | kfree(bond_info->rx_hashtbl); |
969 | bond_info->rx_hashtbl = NULL; | 927 | bond_info->rx_hashtbl = NULL; |
970 | bond_info->rx_hashtbl_used_head = RLB_NULL_INDEX; | 928 | bond_info->rx_hashtbl_used_head = RLB_NULL_INDEX; |
971 | 929 | ||
972 | _unlock_rx_hashtbl_bh(bond); | 930 | spin_unlock_bh(&bond->mode_lock); |
973 | } | 931 | } |
974 | 932 | ||
975 | static void rlb_clear_vlan(struct bonding *bond, unsigned short vlan_id) | 933 | static void rlb_clear_vlan(struct bonding *bond, unsigned short vlan_id) |
@@ -977,7 +935,7 @@ static void rlb_clear_vlan(struct bonding *bond, unsigned short vlan_id) | |||
977 | struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); | 935 | struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); |
978 | u32 curr_index; | 936 | u32 curr_index; |
979 | 937 | ||
980 | _lock_rx_hashtbl_bh(bond); | 938 | spin_lock_bh(&bond->mode_lock); |
981 | 939 | ||
982 | curr_index = bond_info->rx_hashtbl_used_head; | 940 | curr_index = bond_info->rx_hashtbl_used_head; |
983 | while (curr_index != RLB_NULL_INDEX) { | 941 | while (curr_index != RLB_NULL_INDEX) { |
@@ -990,7 +948,7 @@ static void rlb_clear_vlan(struct bonding *bond, unsigned short vlan_id) | |||
990 | curr_index = next_index; | 948 | curr_index = next_index; |
991 | } | 949 | } |
992 | 950 | ||
993 | _unlock_rx_hashtbl_bh(bond); | 951 | spin_unlock_bh(&bond->mode_lock); |
994 | } | 952 | } |
995 | 953 | ||
996 | /*********************** tlb/rlb shared functions *********************/ | 954 | /*********************** tlb/rlb shared functions *********************/ |
@@ -1394,9 +1352,9 @@ static int bond_do_alb_xmit(struct sk_buff *skb, struct bonding *bond, | |||
1394 | } | 1352 | } |
1395 | 1353 | ||
1396 | if (tx_slave && bond->params.tlb_dynamic_lb) { | 1354 | if (tx_slave && bond->params.tlb_dynamic_lb) { |
1397 | _lock_tx_hashtbl(bond); | 1355 | spin_lock(&bond->mode_lock); |
1398 | __tlb_clear_slave(bond, tx_slave, 0); | 1356 | __tlb_clear_slave(bond, tx_slave, 0); |
1399 | _unlock_tx_hashtbl(bond); | 1357 | spin_unlock(&bond->mode_lock); |
1400 | } | 1358 | } |
1401 | 1359 | ||
1402 | /* no suitable interface, frame not sent */ | 1360 | /* no suitable interface, frame not sent */ |
diff --git a/drivers/net/bonding/bond_alb.h b/drivers/net/bonding/bond_alb.h index aaeac61d03cf..3c6a7ff974d7 100644 --- a/drivers/net/bonding/bond_alb.h +++ b/drivers/net/bonding/bond_alb.h | |||
@@ -147,7 +147,6 @@ struct tlb_up_slave { | |||
147 | 147 | ||
148 | struct alb_bond_info { | 148 | struct alb_bond_info { |
149 | struct tlb_client_info *tx_hashtbl; /* Dynamically allocated */ | 149 | struct tlb_client_info *tx_hashtbl; /* Dynamically allocated */ |
150 | spinlock_t tx_hashtbl_lock; | ||
151 | u32 unbalanced_load; | 150 | u32 unbalanced_load; |
152 | int tx_rebalance_counter; | 151 | int tx_rebalance_counter; |
153 | int lp_counter; | 152 | int lp_counter; |
@@ -156,7 +155,6 @@ struct alb_bond_info { | |||
156 | /* -------- rlb parameters -------- */ | 155 | /* -------- rlb parameters -------- */ |
157 | int rlb_enabled; | 156 | int rlb_enabled; |
158 | struct rlb_client_info *rx_hashtbl; /* Receive hash table */ | 157 | struct rlb_client_info *rx_hashtbl; /* Receive hash table */ |
159 | spinlock_t rx_hashtbl_lock; | ||
160 | u32 rx_hashtbl_used_head; | 158 | u32 rx_hashtbl_used_head; |
161 | u8 rx_ntt; /* flag - need to transmit | 159 | u8 rx_ntt; /* flag - need to transmit |
162 | * to all rx clients | 160 | * to all rx clients |
diff --git a/drivers/net/bonding/bond_debugfs.c b/drivers/net/bonding/bond_debugfs.c index 280971b227ea..652f6c5d1bf7 100644 --- a/drivers/net/bonding/bond_debugfs.c +++ b/drivers/net/bonding/bond_debugfs.c | |||
@@ -29,7 +29,7 @@ static int bond_debug_rlb_hash_show(struct seq_file *m, void *v) | |||
29 | seq_printf(m, "SourceIP DestinationIP " | 29 | seq_printf(m, "SourceIP DestinationIP " |
30 | "Destination MAC DEV\n"); | 30 | "Destination MAC DEV\n"); |
31 | 31 | ||
32 | spin_lock_bh(&(BOND_ALB_INFO(bond).rx_hashtbl_lock)); | 32 | spin_lock_bh(&bond->mode_lock); |
33 | 33 | ||
34 | hash_index = bond_info->rx_hashtbl_used_head; | 34 | hash_index = bond_info->rx_hashtbl_used_head; |
35 | for (; hash_index != RLB_NULL_INDEX; | 35 | for (; hash_index != RLB_NULL_INDEX; |
@@ -42,7 +42,7 @@ static int bond_debug_rlb_hash_show(struct seq_file *m, void *v) | |||
42 | client_info->slave->dev->name); | 42 | client_info->slave->dev->name); |
43 | } | 43 | } |
44 | 44 | ||
45 | spin_unlock_bh(&(BOND_ALB_INFO(bond).rx_hashtbl_lock)); | 45 | spin_unlock_bh(&bond->mode_lock); |
46 | 46 | ||
47 | return 0; | 47 | return 0; |
48 | } | 48 | } |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 99d21c2fd44f..e06251417a7d 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -4297,19 +4297,9 @@ static int bond_init(struct net_device *bond_dev) | |||
4297 | { | 4297 | { |
4298 | struct bonding *bond = netdev_priv(bond_dev); | 4298 | struct bonding *bond = netdev_priv(bond_dev); |
4299 | struct bond_net *bn = net_generic(dev_net(bond_dev), bond_net_id); | 4299 | struct bond_net *bn = net_generic(dev_net(bond_dev), bond_net_id); |
4300 | struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); | ||
4301 | 4300 | ||
4302 | netdev_dbg(bond_dev, "Begin bond_init\n"); | 4301 | netdev_dbg(bond_dev, "Begin bond_init\n"); |
4303 | 4302 | ||
4304 | /* | ||
4305 | * Initialize locks that may be required during | ||
4306 | * en/deslave operations. All of the bond_open work | ||
4307 | * (of which this is part) should really be moved to | ||
4308 | * a phase prior to dev_open | ||
4309 | */ | ||
4310 | spin_lock_init(&(bond_info->tx_hashtbl_lock)); | ||
4311 | spin_lock_init(&(bond_info->rx_hashtbl_lock)); | ||
4312 | |||
4313 | bond->wq = create_singlethread_workqueue(bond_dev->name); | 4303 | bond->wq = create_singlethread_workqueue(bond_dev->name); |
4314 | if (!bond->wq) | 4304 | if (!bond->wq) |
4315 | return -ENOMEM; | 4305 | return -ENOMEM; |