diff options
author | Michal Kubeček <mkubecek@suse.cz> | 2012-04-16 22:02:06 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-04-19 15:25:02 -0400 |
commit | f31c7937c2548bfa73da5074808c29617a932e29 (patch) | |
tree | 97a9a4fbe102eb894e6dd1a15f65e87852d8ae09 /drivers/net/bonding/bond_main.c | |
parent | bf1ac5ca6f0dede02635588704d216da474b4baa (diff) |
bonding: start slaves with link down for ARP monitor
Initialize slave device link state as down if ARP monitor is
active and net_carrier_ok() returns zero. Also shift initial
value of its last_arp_tx so that it doesn't immediately cause
fake detection of "up" state.
When ARP monitoring is used, initializing the slave device with
up link state can cause ARP monitor to detect link failure
before the device is really up (with igb driver, this can take
more than two seconds).
Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding/bond_main.c')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index bb928993db3a..44e6a64eecdd 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -1726,7 +1726,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1726 | 1726 | ||
1727 | read_lock(&bond->lock); | 1727 | read_lock(&bond->lock); |
1728 | 1728 | ||
1729 | new_slave->last_arp_rx = jiffies; | 1729 | new_slave->last_arp_rx = jiffies - |
1730 | (msecs_to_jiffies(bond->params.arp_interval) + 1); | ||
1730 | 1731 | ||
1731 | if (bond->params.miimon && !bond->params.use_carrier) { | 1732 | if (bond->params.miimon && !bond->params.use_carrier) { |
1732 | link_reporting = bond_check_dev_link(bond, slave_dev, 1); | 1733 | link_reporting = bond_check_dev_link(bond, slave_dev, 1); |
@@ -1751,22 +1752,30 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1751 | } | 1752 | } |
1752 | 1753 | ||
1753 | /* check for initial state */ | 1754 | /* check for initial state */ |
1754 | if (!bond->params.miimon || | 1755 | if (bond->params.miimon) { |
1755 | (bond_check_dev_link(bond, slave_dev, 0) == BMSR_LSTATUS)) { | 1756 | if (bond_check_dev_link(bond, slave_dev, 0) == BMSR_LSTATUS) { |
1756 | if (bond->params.updelay) { | 1757 | if (bond->params.updelay) { |
1757 | pr_debug("Initial state of slave_dev is BOND_LINK_BACK\n"); | 1758 | new_slave->link = BOND_LINK_BACK; |
1758 | new_slave->link = BOND_LINK_BACK; | 1759 | new_slave->delay = bond->params.updelay; |
1759 | new_slave->delay = bond->params.updelay; | 1760 | } else { |
1761 | new_slave->link = BOND_LINK_UP; | ||
1762 | } | ||
1760 | } else { | 1763 | } else { |
1761 | pr_debug("Initial state of slave_dev is BOND_LINK_UP\n"); | 1764 | new_slave->link = BOND_LINK_DOWN; |
1762 | new_slave->link = BOND_LINK_UP; | ||
1763 | } | 1765 | } |
1764 | new_slave->jiffies = jiffies; | 1766 | } else if (bond->params.arp_interval) { |
1767 | new_slave->link = (netif_carrier_ok(slave_dev) ? | ||
1768 | BOND_LINK_UP : BOND_LINK_DOWN); | ||
1765 | } else { | 1769 | } else { |
1766 | pr_debug("Initial state of slave_dev is BOND_LINK_DOWN\n"); | 1770 | new_slave->link = BOND_LINK_UP; |
1767 | new_slave->link = BOND_LINK_DOWN; | ||
1768 | } | 1771 | } |
1769 | 1772 | ||
1773 | if (new_slave->link != BOND_LINK_DOWN) | ||
1774 | new_slave->jiffies = jiffies; | ||
1775 | pr_debug("Initial state of slave_dev is BOND_LINK_%s\n", | ||
1776 | new_slave->link == BOND_LINK_DOWN ? "DOWN" : | ||
1777 | (new_slave->link == BOND_LINK_UP ? "UP" : "BACK")); | ||
1778 | |||
1770 | bond_update_speed_duplex(new_slave); | 1779 | bond_update_speed_duplex(new_slave); |
1771 | 1780 | ||
1772 | if (USES_PRIMARY(bond->params.mode) && bond->params.primary[0]) { | 1781 | if (USES_PRIMARY(bond->params.mode) && bond->params.primary[0]) { |