diff options
-rw-r--r-- | drivers/net/bonding/bond_main.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 423298c84a1d..e4a47149735f 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -74,6 +74,7 @@ | |||
74 | #include <linux/ethtool.h> | 74 | #include <linux/ethtool.h> |
75 | #include <linux/if_vlan.h> | 75 | #include <linux/if_vlan.h> |
76 | #include <linux/if_bonding.h> | 76 | #include <linux/if_bonding.h> |
77 | #include <linux/jiffies.h> | ||
77 | #include <net/route.h> | 78 | #include <net/route.h> |
78 | #include <net/net_namespace.h> | 79 | #include <net/net_namespace.h> |
79 | #include "bonding.h" | 80 | #include "bonding.h" |
@@ -2722,8 +2723,8 @@ void bond_loadbalance_arp_mon(struct work_struct *work) | |||
2722 | */ | 2723 | */ |
2723 | bond_for_each_slave(bond, slave, i) { | 2724 | bond_for_each_slave(bond, slave, i) { |
2724 | if (slave->link != BOND_LINK_UP) { | 2725 | if (slave->link != BOND_LINK_UP) { |
2725 | if (((jiffies - slave->dev->trans_start) <= delta_in_ticks) && | 2726 | if (time_before_eq(jiffies, slave->dev->trans_start + delta_in_ticks) && |
2726 | ((jiffies - slave->dev->last_rx) <= delta_in_ticks)) { | 2727 | time_before_eq(jiffies, slave->dev->last_rx + delta_in_ticks)) { |
2727 | 2728 | ||
2728 | slave->link = BOND_LINK_UP; | 2729 | slave->link = BOND_LINK_UP; |
2729 | slave->state = BOND_STATE_ACTIVE; | 2730 | slave->state = BOND_STATE_ACTIVE; |
@@ -2754,8 +2755,8 @@ void bond_loadbalance_arp_mon(struct work_struct *work) | |||
2754 | * when the source ip is 0, so don't take the link down | 2755 | * when the source ip is 0, so don't take the link down |
2755 | * if we don't know our ip yet | 2756 | * if we don't know our ip yet |
2756 | */ | 2757 | */ |
2757 | if (((jiffies - slave->dev->trans_start) >= (2*delta_in_ticks)) || | 2758 | if (time_after_eq(jiffies, slave->dev->trans_start + 2*delta_in_ticks) || |
2758 | (((jiffies - slave->dev->last_rx) >= (2*delta_in_ticks)) && | 2759 | (time_after_eq(jiffies, slave->dev->last_rx + 2*delta_in_ticks) && |
2759 | bond_has_ip(bond))) { | 2760 | bond_has_ip(bond))) { |
2760 | 2761 | ||
2761 | slave->link = BOND_LINK_DOWN; | 2762 | slave->link = BOND_LINK_DOWN; |
@@ -2848,8 +2849,8 @@ void bond_activebackup_arp_mon(struct work_struct *work) | |||
2848 | */ | 2849 | */ |
2849 | bond_for_each_slave(bond, slave, i) { | 2850 | bond_for_each_slave(bond, slave, i) { |
2850 | if (slave->link != BOND_LINK_UP) { | 2851 | if (slave->link != BOND_LINK_UP) { |
2851 | if ((jiffies - slave_last_rx(bond, slave)) <= | 2852 | if (time_before_eq(jiffies, |
2852 | delta_in_ticks) { | 2853 | slave_last_rx(bond, slave) + delta_in_ticks)) { |
2853 | 2854 | ||
2854 | slave->link = BOND_LINK_UP; | 2855 | slave->link = BOND_LINK_UP; |
2855 | 2856 | ||
@@ -2858,7 +2859,7 @@ void bond_activebackup_arp_mon(struct work_struct *work) | |||
2858 | write_lock_bh(&bond->curr_slave_lock); | 2859 | write_lock_bh(&bond->curr_slave_lock); |
2859 | 2860 | ||
2860 | if ((!bond->curr_active_slave) && | 2861 | if ((!bond->curr_active_slave) && |
2861 | ((jiffies - slave->dev->trans_start) <= delta_in_ticks)) { | 2862 | time_before_eq(jiffies, slave->dev->trans_start + delta_in_ticks)) { |
2862 | bond_change_active_slave(bond, slave); | 2863 | bond_change_active_slave(bond, slave); |
2863 | bond->current_arp_slave = NULL; | 2864 | bond->current_arp_slave = NULL; |
2864 | } else if (bond->curr_active_slave != slave) { | 2865 | } else if (bond->curr_active_slave != slave) { |
@@ -2897,7 +2898,7 @@ void bond_activebackup_arp_mon(struct work_struct *work) | |||
2897 | 2898 | ||
2898 | if ((slave != bond->curr_active_slave) && | 2899 | if ((slave != bond->curr_active_slave) && |
2899 | (!bond->current_arp_slave) && | 2900 | (!bond->current_arp_slave) && |
2900 | (((jiffies - slave_last_rx(bond, slave)) >= 3*delta_in_ticks) && | 2901 | (time_after_eq(jiffies, slave_last_rx(bond, slave) + 3*delta_in_ticks) && |
2901 | bond_has_ip(bond))) { | 2902 | bond_has_ip(bond))) { |
2902 | /* a backup slave has gone down; three times | 2903 | /* a backup slave has gone down; three times |
2903 | * the delta allows the current slave to be | 2904 | * the delta allows the current slave to be |
@@ -2943,10 +2944,10 @@ void bond_activebackup_arp_mon(struct work_struct *work) | |||
2943 | * before being taken out. if a primary is being used, check | 2944 | * before being taken out. if a primary is being used, check |
2944 | * if it is up and needs to take over as the curr_active_slave | 2945 | * if it is up and needs to take over as the curr_active_slave |
2945 | */ | 2946 | */ |
2946 | if ((((jiffies - slave->dev->trans_start) >= (2*delta_in_ticks)) || | 2947 | if ((time_after_eq(jiffies, slave->dev->trans_start + 2*delta_in_ticks) || |
2947 | (((jiffies - slave_last_rx(bond, slave)) >= (2*delta_in_ticks)) && | 2948 | (time_after_eq(jiffies, slave_last_rx(bond, slave) + 2*delta_in_ticks) && |
2948 | bond_has_ip(bond))) && | 2949 | bond_has_ip(bond))) && |
2949 | ((jiffies - slave->jiffies) >= 2*delta_in_ticks)) { | 2950 | time_after_eq(jiffies, slave->jiffies + 2*delta_in_ticks)) { |
2950 | 2951 | ||
2951 | slave->link = BOND_LINK_DOWN; | 2952 | slave->link = BOND_LINK_DOWN; |
2952 | 2953 | ||