diff options
author | Veaceslav Falico <vfalico@gmail.com> | 2014-05-15 15:39:57 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-05-16 16:34:32 -0400 |
commit | b6adc610f183061bd607d965857870e618d229a6 (patch) | |
tree | 6f4f597f0fec36063bf7ed66144f711de5d9e697 | |
parent | 2807a9feb2393648f4db114fdf3fa99860ff6a36 (diff) |
bonding: convert IS_UP(slave->dev) to inline function
Also, remove the IFF_UP verification cause we can't be netif_running() with
being also IFF_UP.
CC: Jay Vosburgh <j.vosburgh@gmail.com>
CC: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Veaceslav Falico <vfalico@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/bonding/bond_3ad.c | 2 | ||||
-rw-r--r-- | drivers/net/bonding/bond_main.c | 16 | ||||
-rw-r--r-- | drivers/net/bonding/bond_options.c | 2 | ||||
-rw-r--r-- | drivers/net/bonding/bonding.h | 12 |
4 files changed, 16 insertions, 16 deletions
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index 24faddddf11e..7997a1e7cfd0 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c | |||
@@ -192,7 +192,7 @@ static inline void __enable_port(struct port *port) | |||
192 | { | 192 | { |
193 | struct slave *slave = port->slave; | 193 | struct slave *slave = port->slave; |
194 | 194 | ||
195 | if ((slave->link == BOND_LINK_UP) && IS_UP(slave->dev)) | 195 | if ((slave->link == BOND_LINK_UP) && bond_slave_is_up(slave)) |
196 | bond_set_slave_active_flags(slave, BOND_SLAVE_NOTIFY_LATER); | 196 | bond_set_slave_active_flags(slave, BOND_SLAVE_NOTIFY_LATER); |
197 | } | 197 | } |
198 | 198 | ||
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 1af2be53ebb5..db323e6cb314 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -747,7 +747,7 @@ static struct slave *bond_find_best_slave(struct bonding *bond) | |||
747 | bond_for_each_slave(bond, slave, iter) { | 747 | bond_for_each_slave(bond, slave, iter) { |
748 | if (slave->link == BOND_LINK_UP) | 748 | if (slave->link == BOND_LINK_UP) |
749 | return slave; | 749 | return slave; |
750 | if (slave->link == BOND_LINK_BACK && IS_UP(slave->dev) && | 750 | if (slave->link == BOND_LINK_BACK && bond_slave_is_up(slave) && |
751 | slave->delay < mintime) { | 751 | slave->delay < mintime) { |
752 | mintime = slave->delay; | 752 | mintime = slave->delay; |
753 | bestslave = slave; | 753 | bestslave = slave; |
@@ -958,7 +958,7 @@ static void bond_netpoll_cleanup(struct net_device *bond_dev) | |||
958 | struct slave *slave; | 958 | struct slave *slave; |
959 | 959 | ||
960 | bond_for_each_slave(bond, slave, iter) | 960 | bond_for_each_slave(bond, slave, iter) |
961 | if (IS_UP(slave->dev)) | 961 | if (bond_slave_is_up(slave)) |
962 | slave_disable_netpoll(slave); | 962 | slave_disable_netpoll(slave); |
963 | } | 963 | } |
964 | 964 | ||
@@ -2490,7 +2490,7 @@ static void bond_loadbalance_arp_mon(struct work_struct *work) | |||
2490 | * do - all replies will be rx'ed on same link causing slaves | 2490 | * do - all replies will be rx'ed on same link causing slaves |
2491 | * to be unstable during low/no traffic periods | 2491 | * to be unstable during low/no traffic periods |
2492 | */ | 2492 | */ |
2493 | if (IS_UP(slave->dev)) | 2493 | if (bond_slave_is_up(slave)) |
2494 | bond_arp_send_all(bond, slave); | 2494 | bond_arp_send_all(bond, slave); |
2495 | } | 2495 | } |
2496 | 2496 | ||
@@ -2712,10 +2712,10 @@ static bool bond_ab_arp_probe(struct bonding *bond) | |||
2712 | bond_set_slave_inactive_flags(curr_arp_slave, BOND_SLAVE_NOTIFY_LATER); | 2712 | bond_set_slave_inactive_flags(curr_arp_slave, BOND_SLAVE_NOTIFY_LATER); |
2713 | 2713 | ||
2714 | bond_for_each_slave_rcu(bond, slave, iter) { | 2714 | bond_for_each_slave_rcu(bond, slave, iter) { |
2715 | if (!found && !before && IS_UP(slave->dev)) | 2715 | if (!found && !before && bond_slave_is_up(slave)) |
2716 | before = slave; | 2716 | before = slave; |
2717 | 2717 | ||
2718 | if (found && !new_slave && IS_UP(slave->dev)) | 2718 | if (found && !new_slave && bond_slave_is_up(slave)) |
2719 | new_slave = slave; | 2719 | new_slave = slave; |
2720 | /* if the link state is up at this point, we | 2720 | /* if the link state is up at this point, we |
2721 | * mark it down - this can happen if we have | 2721 | * mark it down - this can happen if we have |
@@ -2724,7 +2724,7 @@ static bool bond_ab_arp_probe(struct bonding *bond) | |||
2724 | * one the current slave so it is still marked | 2724 | * one the current slave so it is still marked |
2725 | * up when it is actually down | 2725 | * up when it is actually down |
2726 | */ | 2726 | */ |
2727 | if (!IS_UP(slave->dev) && slave->link == BOND_LINK_UP) { | 2727 | if (!bond_slave_is_up(slave) && slave->link == BOND_LINK_UP) { |
2728 | slave->link = BOND_LINK_DOWN; | 2728 | slave->link = BOND_LINK_DOWN; |
2729 | if (slave->link_failure_count < UINT_MAX) | 2729 | if (slave->link_failure_count < UINT_MAX) |
2730 | slave->link_failure_count++; | 2730 | slave->link_failure_count++; |
@@ -3710,7 +3710,7 @@ static int bond_xmit_broadcast(struct sk_buff *skb, struct net_device *bond_dev) | |||
3710 | bond_for_each_slave_rcu(bond, slave, iter) { | 3710 | bond_for_each_slave_rcu(bond, slave, iter) { |
3711 | if (bond_is_last_slave(bond, slave)) | 3711 | if (bond_is_last_slave(bond, slave)) |
3712 | break; | 3712 | break; |
3713 | if (IS_UP(slave->dev) && slave->link == BOND_LINK_UP) { | 3713 | if (bond_slave_is_up(slave) && slave->link == BOND_LINK_UP) { |
3714 | struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC); | 3714 | struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC); |
3715 | 3715 | ||
3716 | if (!skb2) { | 3716 | if (!skb2) { |
@@ -3722,7 +3722,7 @@ static int bond_xmit_broadcast(struct sk_buff *skb, struct net_device *bond_dev) | |||
3722 | bond_dev_queue_xmit(bond, skb2, slave->dev); | 3722 | bond_dev_queue_xmit(bond, skb2, slave->dev); |
3723 | } | 3723 | } |
3724 | } | 3724 | } |
3725 | if (slave && IS_UP(slave->dev) && slave->link == BOND_LINK_UP) | 3725 | if (slave && bond_slave_is_up(slave) && slave->link == BOND_LINK_UP) |
3726 | bond_dev_queue_xmit(bond, skb, slave->dev); | 3726 | bond_dev_queue_xmit(bond, skb, slave->dev); |
3727 | else | 3727 | else |
3728 | dev_kfree_skb_any(skb); | 3728 | dev_kfree_skb_any(skb); |
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c index 0cf4c1a9bb7b..94094b3d5a3e 100644 --- a/drivers/net/bonding/bond_options.c +++ b/drivers/net/bonding/bond_options.c | |||
@@ -758,7 +758,7 @@ static int bond_option_active_slave_set(struct bonding *bond, | |||
758 | bond->dev->name, new_active->dev->name); | 758 | bond->dev->name, new_active->dev->name); |
759 | } else { | 759 | } else { |
760 | if (old_active && (new_active->link == BOND_LINK_UP) && | 760 | if (old_active && (new_active->link == BOND_LINK_UP) && |
761 | IS_UP(new_active->dev)) { | 761 | bond_slave_is_up(new_active)) { |
762 | pr_info("%s: Setting %s as active slave\n", | 762 | pr_info("%s: Setting %s as active slave\n", |
763 | bond->dev->name, new_active->dev->name); | 763 | bond->dev->name, new_active->dev->name); |
764 | bond_change_active_slave(bond, new_active); | 764 | bond_change_active_slave(bond, new_active); |
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index ac75b0fbf768..6a5393b52ae0 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
@@ -40,11 +40,6 @@ | |||
40 | 40 | ||
41 | #define BOND_DEFAULT_MIIMON 100 | 41 | #define BOND_DEFAULT_MIIMON 100 |
42 | 42 | ||
43 | #define IS_UP(dev) \ | ||
44 | ((((dev)->flags & IFF_UP) == IFF_UP) && \ | ||
45 | netif_running(dev) && \ | ||
46 | netif_carrier_ok(dev)) | ||
47 | |||
48 | /* | 43 | /* |
49 | * Checks whether slave is ready for transmit. | 44 | * Checks whether slave is ready for transmit. |
50 | */ | 45 | */ |
@@ -297,6 +292,11 @@ static inline bool bond_uses_primary(struct bonding *bond) | |||
297 | return bond_mode_uses_primary(BOND_MODE(bond)); | 292 | return bond_mode_uses_primary(BOND_MODE(bond)); |
298 | } | 293 | } |
299 | 294 | ||
295 | static inline bool bond_slave_is_up(struct slave *slave) | ||
296 | { | ||
297 | return netif_running(slave->dev) && netif_carrier_ok(slave->dev); | ||
298 | } | ||
299 | |||
300 | static inline void bond_set_active_slave(struct slave *slave) | 300 | static inline void bond_set_active_slave(struct slave *slave) |
301 | { | 301 | { |
302 | if (slave->backup) { | 302 | if (slave->backup) { |
@@ -487,7 +487,7 @@ static inline __be32 bond_confirm_addr(struct net_device *dev, __be32 dst, __be3 | |||
487 | 487 | ||
488 | static inline bool slave_can_tx(struct slave *slave) | 488 | static inline bool slave_can_tx(struct slave *slave) |
489 | { | 489 | { |
490 | if (IS_UP(slave->dev) && slave->link == BOND_LINK_UP && | 490 | if (bond_slave_is_up(slave) && slave->link == BOND_LINK_UP && |
491 | bond_is_active_slave(slave)) | 491 | bond_is_active_slave(slave)) |
492 | return true; | 492 | return true; |
493 | else | 493 | else |