diff options
author | Veaceslav Falico <vfalico@redhat.com> | 2013-09-25 03:20:14 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-09-26 16:02:05 -0400 |
commit | 9caff1e7b761c28018bf1858f6661439b4055f51 (patch) | |
tree | f68f67537234e09d2b7a033573de4649c92865af /drivers/net/bonding/bond_alb.c | |
parent | 81f23b13ac985e9a3cfb889c690695a8932e02c2 (diff) |
bonding: make bond_for_each_slave() use lower neighbour's private
It needs a list_head *iter, so add it wherever needed. Use both non-rcu and
rcu variants.
CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
CC: Dimitris Michailidis <dm@chelsio.com>
Signed-off-by: Veaceslav Falico <vfalico@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 | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index 6437657375d7..f4929cee21a6 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c | |||
@@ -223,13 +223,14 @@ static long long compute_gap(struct slave *slave) | |||
223 | static struct slave *tlb_get_least_loaded_slave(struct bonding *bond) | 223 | static struct slave *tlb_get_least_loaded_slave(struct bonding *bond) |
224 | { | 224 | { |
225 | struct slave *slave, *least_loaded; | 225 | struct slave *slave, *least_loaded; |
226 | struct list_head *iter; | ||
226 | long long max_gap; | 227 | long long max_gap; |
227 | 228 | ||
228 | least_loaded = NULL; | 229 | least_loaded = NULL; |
229 | max_gap = LLONG_MIN; | 230 | max_gap = LLONG_MIN; |
230 | 231 | ||
231 | /* Find the slave with the largest gap */ | 232 | /* Find the slave with the largest gap */ |
232 | bond_for_each_slave(bond, slave) { | 233 | bond_for_each_slave(bond, slave, iter) { |
233 | if (SLAVE_IS_OK(slave)) { | 234 | if (SLAVE_IS_OK(slave)) { |
234 | long long gap = compute_gap(slave); | 235 | long long gap = compute_gap(slave); |
235 | 236 | ||
@@ -1172,8 +1173,9 @@ static void alb_change_hw_addr_on_detach(struct bonding *bond, struct slave *sla | |||
1172 | */ | 1173 | */ |
1173 | static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slave *slave) | 1174 | static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slave *slave) |
1174 | { | 1175 | { |
1175 | struct slave *tmp_slave1, *free_mac_slave = NULL; | ||
1176 | struct slave *has_bond_addr = bond->curr_active_slave; | 1176 | struct slave *has_bond_addr = bond->curr_active_slave; |
1177 | struct slave *tmp_slave1, *free_mac_slave = NULL; | ||
1178 | struct list_head *iter; | ||
1177 | 1179 | ||
1178 | if (list_empty(&bond->slave_list)) { | 1180 | if (list_empty(&bond->slave_list)) { |
1179 | /* this is the first slave */ | 1181 | /* this is the first slave */ |
@@ -1196,7 +1198,7 @@ static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slav | |||
1196 | /* The slave's address is equal to the address of the bond. | 1198 | /* The slave's address is equal to the address of the bond. |
1197 | * Search for a spare address in the bond for this slave. | 1199 | * Search for a spare address in the bond for this slave. |
1198 | */ | 1200 | */ |
1199 | bond_for_each_slave(bond, tmp_slave1) { | 1201 | bond_for_each_slave(bond, tmp_slave1, iter) { |
1200 | if (!bond_slave_has_mac(bond, tmp_slave1->perm_hwaddr)) { | 1202 | if (!bond_slave_has_mac(bond, tmp_slave1->perm_hwaddr)) { |
1201 | /* no slave has tmp_slave1's perm addr | 1203 | /* no slave has tmp_slave1's perm addr |
1202 | * as its curr addr | 1204 | * as its curr addr |
@@ -1247,6 +1249,7 @@ static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slav | |||
1247 | static int alb_set_mac_address(struct bonding *bond, void *addr) | 1249 | static int alb_set_mac_address(struct bonding *bond, void *addr) |
1248 | { | 1250 | { |
1249 | struct slave *slave, *rollback_slave; | 1251 | struct slave *slave, *rollback_slave; |
1252 | struct list_head *iter; | ||
1250 | struct sockaddr sa; | 1253 | struct sockaddr sa; |
1251 | char tmp_addr[ETH_ALEN]; | 1254 | char tmp_addr[ETH_ALEN]; |
1252 | int res; | 1255 | int res; |
@@ -1254,7 +1257,7 @@ static int alb_set_mac_address(struct bonding *bond, void *addr) | |||
1254 | if (bond->alb_info.rlb_enabled) | 1257 | if (bond->alb_info.rlb_enabled) |
1255 | return 0; | 1258 | return 0; |
1256 | 1259 | ||
1257 | bond_for_each_slave(bond, slave) { | 1260 | bond_for_each_slave(bond, slave, iter) { |
1258 | /* save net_device's current hw address */ | 1261 | /* save net_device's current hw address */ |
1259 | memcpy(tmp_addr, slave->dev->dev_addr, ETH_ALEN); | 1262 | memcpy(tmp_addr, slave->dev->dev_addr, ETH_ALEN); |
1260 | 1263 | ||
@@ -1274,7 +1277,7 @@ unwind: | |||
1274 | sa.sa_family = bond->dev->type; | 1277 | sa.sa_family = bond->dev->type; |
1275 | 1278 | ||
1276 | /* unwind from head to the slave that failed */ | 1279 | /* unwind from head to the slave that failed */ |
1277 | bond_for_each_slave(bond, rollback_slave) { | 1280 | bond_for_each_slave(bond, rollback_slave, iter) { |
1278 | if (rollback_slave == slave) | 1281 | if (rollback_slave == slave) |
1279 | break; | 1282 | break; |
1280 | memcpy(tmp_addr, rollback_slave->dev->dev_addr, ETH_ALEN); | 1283 | memcpy(tmp_addr, rollback_slave->dev->dev_addr, ETH_ALEN); |
@@ -1460,6 +1463,7 @@ void bond_alb_monitor(struct work_struct *work) | |||
1460 | struct bonding *bond = container_of(work, struct bonding, | 1463 | struct bonding *bond = container_of(work, struct bonding, |
1461 | alb_work.work); | 1464 | alb_work.work); |
1462 | struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); | 1465 | struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); |
1466 | struct list_head *iter; | ||
1463 | struct slave *slave; | 1467 | struct slave *slave; |
1464 | 1468 | ||
1465 | read_lock(&bond->lock); | 1469 | read_lock(&bond->lock); |
@@ -1482,7 +1486,7 @@ void bond_alb_monitor(struct work_struct *work) | |||
1482 | */ | 1486 | */ |
1483 | read_lock(&bond->curr_slave_lock); | 1487 | read_lock(&bond->curr_slave_lock); |
1484 | 1488 | ||
1485 | bond_for_each_slave(bond, slave) | 1489 | bond_for_each_slave(bond, slave, iter) |
1486 | alb_send_learning_packets(slave, slave->dev->dev_addr); | 1490 | alb_send_learning_packets(slave, slave->dev->dev_addr); |
1487 | 1491 | ||
1488 | read_unlock(&bond->curr_slave_lock); | 1492 | read_unlock(&bond->curr_slave_lock); |
@@ -1495,7 +1499,7 @@ void bond_alb_monitor(struct work_struct *work) | |||
1495 | 1499 | ||
1496 | read_lock(&bond->curr_slave_lock); | 1500 | read_lock(&bond->curr_slave_lock); |
1497 | 1501 | ||
1498 | bond_for_each_slave(bond, slave) { | 1502 | bond_for_each_slave(bond, slave, iter) { |
1499 | tlb_clear_slave(bond, slave, 1); | 1503 | tlb_clear_slave(bond, slave, 1); |
1500 | if (slave == bond->curr_active_slave) { | 1504 | if (slave == bond->curr_active_slave) { |
1501 | SLAVE_TLB_INFO(slave).load = | 1505 | SLAVE_TLB_INFO(slave).load = |