aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/bonding/bond_3ad.c4
-rw-r--r--drivers/net/bonding/bond_alb.c14
-rw-r--r--drivers/net/bonding/bond_main.c4
-rw-r--r--drivers/net/bonding/bonding.h9
4 files changed, 11 insertions, 20 deletions
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index 7997a1e7cfd0..0dfeaf5da3f2 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -2449,13 +2449,13 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
2449 continue; 2449 continue;
2450 2450
2451 if (slave_agg_no >= 0) { 2451 if (slave_agg_no >= 0) {
2452 if (!first_ok_slave && SLAVE_IS_OK(slave)) 2452 if (!first_ok_slave && bond_slave_can_tx(slave))
2453 first_ok_slave = slave; 2453 first_ok_slave = slave;
2454 slave_agg_no--; 2454 slave_agg_no--;
2455 continue; 2455 continue;
2456 } 2456 }
2457 2457
2458 if (SLAVE_IS_OK(slave)) { 2458 if (bond_slave_can_tx(slave)) {
2459 bond_dev_queue_xmit(bond, skb, slave->dev); 2459 bond_dev_queue_xmit(bond, skb, slave->dev);
2460 goto out; 2460 goto out;
2461 } 2461 }
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index efacb0e98ed7..03e0bcade234 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -228,7 +228,7 @@ static struct slave *tlb_get_least_loaded_slave(struct bonding *bond)
228 228
229 /* Find the slave with the largest gap */ 229 /* Find the slave with the largest gap */
230 bond_for_each_slave_rcu(bond, slave, iter) { 230 bond_for_each_slave_rcu(bond, slave, iter) {
231 if (SLAVE_IS_OK(slave)) { 231 if (bond_slave_can_tx(slave)) {
232 long long gap = compute_gap(slave); 232 long long gap = compute_gap(slave);
233 233
234 if (max_gap < gap) { 234 if (max_gap < gap) {
@@ -383,7 +383,7 @@ static struct slave *rlb_next_rx_slave(struct bonding *bond)
383 bool found = false; 383 bool found = false;
384 384
385 bond_for_each_slave(bond, slave, iter) { 385 bond_for_each_slave(bond, slave, iter) {
386 if (!SLAVE_IS_OK(slave)) 386 if (!bond_slave_can_tx(slave))
387 continue; 387 continue;
388 if (!found) { 388 if (!found) {
389 if (!before || before->speed < slave->speed) 389 if (!before || before->speed < slave->speed)
@@ -416,7 +416,7 @@ static struct slave *__rlb_next_rx_slave(struct bonding *bond)
416 bool found = false; 416 bool found = false;
417 417
418 bond_for_each_slave_rcu(bond, slave, iter) { 418 bond_for_each_slave_rcu(bond, slave, iter) {
419 if (!SLAVE_IS_OK(slave)) 419 if (!bond_slave_can_tx(slave))
420 continue; 420 continue;
421 if (!found) { 421 if (!found) {
422 if (!before || before->speed < slave->speed) 422 if (!before || before->speed < slave->speed)
@@ -1100,13 +1100,13 @@ static void alb_swap_mac_addr(struct slave *slave1, struct slave *slave2)
1100static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1, 1100static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1,
1101 struct slave *slave2) 1101 struct slave *slave2)
1102{ 1102{
1103 int slaves_state_differ = (SLAVE_IS_OK(slave1) != SLAVE_IS_OK(slave2)); 1103 int slaves_state_differ = (bond_slave_can_tx(slave1) != bond_slave_can_tx(slave2));
1104 struct slave *disabled_slave = NULL; 1104 struct slave *disabled_slave = NULL;
1105 1105
1106 ASSERT_RTNL(); 1106 ASSERT_RTNL();
1107 1107
1108 /* fasten the change in the switch */ 1108 /* fasten the change in the switch */
1109 if (SLAVE_IS_OK(slave1)) { 1109 if (bond_slave_can_tx(slave1)) {
1110 alb_send_learning_packets(slave1, slave1->dev->dev_addr); 1110 alb_send_learning_packets(slave1, slave1->dev->dev_addr);
1111 if (bond->alb_info.rlb_enabled) { 1111 if (bond->alb_info.rlb_enabled) {
1112 /* inform the clients that the mac address 1112 /* inform the clients that the mac address
@@ -1118,7 +1118,7 @@ static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1,
1118 disabled_slave = slave1; 1118 disabled_slave = slave1;
1119 } 1119 }
1120 1120
1121 if (SLAVE_IS_OK(slave2)) { 1121 if (bond_slave_can_tx(slave2)) {
1122 alb_send_learning_packets(slave2, slave2->dev->dev_addr); 1122 alb_send_learning_packets(slave2, slave2->dev->dev_addr);
1123 if (bond->alb_info.rlb_enabled) { 1123 if (bond->alb_info.rlb_enabled) {
1124 /* inform the clients that the mac address 1124 /* inform the clients that the mac address
@@ -1360,7 +1360,7 @@ static int bond_do_alb_xmit(struct sk_buff *skb, struct bonding *bond,
1360 bond_info->unbalanced_load += skb->len; 1360 bond_info->unbalanced_load += skb->len;
1361 } 1361 }
1362 1362
1363 if (tx_slave && SLAVE_IS_OK(tx_slave)) { 1363 if (tx_slave && bond_slave_can_tx(tx_slave)) {
1364 if (tx_slave != rcu_dereference(bond->curr_active_slave)) { 1364 if (tx_slave != rcu_dereference(bond->curr_active_slave)) {
1365 ether_addr_copy(eth_data->h_source, 1365 ether_addr_copy(eth_data->h_source,
1366 tx_slave->dev->dev_addr); 1366 tx_slave->dev->dev_addr);
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 5a1e7b779cbe..712320532105 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3850,14 +3850,14 @@ static int bond_ethtool_get_settings(struct net_device *bond_dev,
3850 ecmd->duplex = DUPLEX_UNKNOWN; 3850 ecmd->duplex = DUPLEX_UNKNOWN;
3851 ecmd->port = PORT_OTHER; 3851 ecmd->port = PORT_OTHER;
3852 3852
3853 /* Since SLAVE_IS_OK returns false for all inactive or down slaves, we 3853 /* Since bond_slave_can_tx returns false for all inactive or down slaves, we
3854 * do not need to check mode. Though link speed might not represent 3854 * do not need to check mode. Though link speed might not represent
3855 * the true receive or transmit bandwidth (not all modes are symmetric) 3855 * the true receive or transmit bandwidth (not all modes are symmetric)
3856 * this is an accurate maximum. 3856 * this is an accurate maximum.
3857 */ 3857 */
3858 read_lock(&bond->lock); 3858 read_lock(&bond->lock);
3859 bond_for_each_slave(bond, slave, iter) { 3859 bond_for_each_slave(bond, slave, iter) {
3860 if (SLAVE_IS_OK(slave)) { 3860 if (bond_slave_can_tx(slave)) {
3861 if (slave->speed != SPEED_UNKNOWN) 3861 if (slave->speed != SPEED_UNKNOWN)
3862 speed += slave->speed; 3862 speed += slave->speed;
3863 if (ecmd->duplex == DUPLEX_UNKNOWN && 3863 if (ecmd->duplex == DUPLEX_UNKNOWN &&
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 60ffd57cf625..44334b3d3b88 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -41,15 +41,6 @@
41#define BOND_DEFAULT_MIIMON 100 41#define BOND_DEFAULT_MIIMON 100
42 42
43/* 43/*
44 * Checks whether slave is ready for transmit.
45 */
46#define SLAVE_IS_OK(slave) \
47 (((slave)->dev->flags & IFF_UP) && \
48 netif_running((slave)->dev) && \
49 ((slave)->link == BOND_LINK_UP) && \
50 bond_is_active_slave(slave))
51
52/*
53 * Less bad way to call ioctl from within the kernel; this needs to be 44 * Less bad way to call ioctl from within the kernel; this needs to be
54 * done some other way to get the call out of interrupt context. 45 * done some other way to get the call out of interrupt context.
55 * Needs "ioctl" variable to be supplied by calling context. 46 * Needs "ioctl" variable to be supplied by calling context.