diff options
Diffstat (limited to 'drivers/net/bonding/bond_main.c')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 54 |
1 files changed, 30 insertions, 24 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index bc13b3d77432..2ee8cf9e8a3b 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -549,9 +549,9 @@ down: | |||
549 | * Get link speed and duplex from the slave's base driver | 549 | * Get link speed and duplex from the slave's base driver |
550 | * using ethtool. If for some reason the call fails or the | 550 | * using ethtool. If for some reason the call fails or the |
551 | * values are invalid, set speed and duplex to -1, | 551 | * values are invalid, set speed and duplex to -1, |
552 | * and return error. | 552 | * and return. |
553 | */ | 553 | */ |
554 | static int bond_update_speed_duplex(struct slave *slave) | 554 | static void bond_update_speed_duplex(struct slave *slave) |
555 | { | 555 | { |
556 | struct net_device *slave_dev = slave->dev; | 556 | struct net_device *slave_dev = slave->dev; |
557 | struct ethtool_cmd ecmd; | 557 | struct ethtool_cmd ecmd; |
@@ -563,24 +563,24 @@ static int bond_update_speed_duplex(struct slave *slave) | |||
563 | 563 | ||
564 | res = __ethtool_get_settings(slave_dev, &ecmd); | 564 | res = __ethtool_get_settings(slave_dev, &ecmd); |
565 | if (res < 0) | 565 | if (res < 0) |
566 | return -1; | 566 | return; |
567 | 567 | ||
568 | slave_speed = ethtool_cmd_speed(&ecmd); | 568 | slave_speed = ethtool_cmd_speed(&ecmd); |
569 | if (slave_speed == 0 || slave_speed == ((__u32) -1)) | 569 | if (slave_speed == 0 || slave_speed == ((__u32) -1)) |
570 | return -1; | 570 | return; |
571 | 571 | ||
572 | switch (ecmd.duplex) { | 572 | switch (ecmd.duplex) { |
573 | case DUPLEX_FULL: | 573 | case DUPLEX_FULL: |
574 | case DUPLEX_HALF: | 574 | case DUPLEX_HALF: |
575 | break; | 575 | break; |
576 | default: | 576 | default: |
577 | return -1; | 577 | return; |
578 | } | 578 | } |
579 | 579 | ||
580 | slave->speed = slave_speed; | 580 | slave->speed = slave_speed; |
581 | slave->duplex = ecmd.duplex; | 581 | slave->duplex = ecmd.duplex; |
582 | 582 | ||
583 | return 0; | 583 | return; |
584 | } | 584 | } |
585 | 585 | ||
586 | /* | 586 | /* |
@@ -1731,7 +1731,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1731 | 1731 | ||
1732 | read_lock(&bond->lock); | 1732 | read_lock(&bond->lock); |
1733 | 1733 | ||
1734 | new_slave->last_arp_rx = jiffies; | 1734 | new_slave->last_arp_rx = jiffies - |
1735 | (msecs_to_jiffies(bond->params.arp_interval) + 1); | ||
1735 | 1736 | ||
1736 | if (bond->params.miimon && !bond->params.use_carrier) { | 1737 | if (bond->params.miimon && !bond->params.use_carrier) { |
1737 | link_reporting = bond_check_dev_link(bond, slave_dev, 1); | 1738 | link_reporting = bond_check_dev_link(bond, slave_dev, 1); |
@@ -1756,22 +1757,30 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1756 | } | 1757 | } |
1757 | 1758 | ||
1758 | /* check for initial state */ | 1759 | /* check for initial state */ |
1759 | if (!bond->params.miimon || | 1760 | if (bond->params.miimon) { |
1760 | (bond_check_dev_link(bond, slave_dev, 0) == BMSR_LSTATUS)) { | 1761 | if (bond_check_dev_link(bond, slave_dev, 0) == BMSR_LSTATUS) { |
1761 | if (bond->params.updelay) { | 1762 | if (bond->params.updelay) { |
1762 | pr_debug("Initial state of slave_dev is BOND_LINK_BACK\n"); | 1763 | new_slave->link = BOND_LINK_BACK; |
1763 | new_slave->link = BOND_LINK_BACK; | 1764 | new_slave->delay = bond->params.updelay; |
1764 | new_slave->delay = bond->params.updelay; | 1765 | } else { |
1766 | new_slave->link = BOND_LINK_UP; | ||
1767 | } | ||
1765 | } else { | 1768 | } else { |
1766 | pr_debug("Initial state of slave_dev is BOND_LINK_UP\n"); | 1769 | new_slave->link = BOND_LINK_DOWN; |
1767 | new_slave->link = BOND_LINK_UP; | ||
1768 | } | 1770 | } |
1769 | new_slave->jiffies = jiffies; | 1771 | } else if (bond->params.arp_interval) { |
1772 | new_slave->link = (netif_carrier_ok(slave_dev) ? | ||
1773 | BOND_LINK_UP : BOND_LINK_DOWN); | ||
1770 | } else { | 1774 | } else { |
1771 | pr_debug("Initial state of slave_dev is BOND_LINK_DOWN\n"); | 1775 | new_slave->link = BOND_LINK_UP; |
1772 | new_slave->link = BOND_LINK_DOWN; | ||
1773 | } | 1776 | } |
1774 | 1777 | ||
1778 | if (new_slave->link != BOND_LINK_DOWN) | ||
1779 | new_slave->jiffies = jiffies; | ||
1780 | pr_debug("Initial state of slave_dev is BOND_LINK_%s\n", | ||
1781 | new_slave->link == BOND_LINK_DOWN ? "DOWN" : | ||
1782 | (new_slave->link == BOND_LINK_UP ? "UP" : "BACK")); | ||
1783 | |||
1775 | bond_update_speed_duplex(new_slave); | 1784 | bond_update_speed_duplex(new_slave); |
1776 | 1785 | ||
1777 | if (USES_PRIMARY(bond->params.mode) && bond->params.primary[0]) { | 1786 | if (USES_PRIMARY(bond->params.mode) && bond->params.primary[0]) { |
@@ -1957,7 +1966,7 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1957 | write_lock_bh(&bond->lock); | 1966 | write_lock_bh(&bond->lock); |
1958 | 1967 | ||
1959 | if (!bond->params.fail_over_mac) { | 1968 | if (!bond->params.fail_over_mac) { |
1960 | if (!compare_ether_addr(bond_dev->dev_addr, slave->perm_hwaddr) && | 1969 | if (ether_addr_equal(bond_dev->dev_addr, slave->perm_hwaddr) && |
1961 | bond->slave_cnt > 1) | 1970 | bond->slave_cnt > 1) |
1962 | pr_warning("%s: Warning: the permanent HWaddr of %s - %pM - is still in use by %s. Set the HWaddr of %s to a different address to avoid conflicts.\n", | 1971 | pr_warning("%s: Warning: the permanent HWaddr of %s - %pM - is still in use by %s. Set the HWaddr of %s to a different address to avoid conflicts.\n", |
1963 | bond_dev->name, slave_dev->name, | 1972 | bond_dev->name, slave_dev->name, |
@@ -4826,12 +4835,9 @@ static int bond_validate(struct nlattr *tb[], struct nlattr *data[]) | |||
4826 | return 0; | 4835 | return 0; |
4827 | } | 4836 | } |
4828 | 4837 | ||
4829 | static int bond_get_tx_queues(struct net *net, struct nlattr *tb[], | 4838 | static int bond_get_tx_queues(struct net *net, struct nlattr *tb[]) |
4830 | unsigned int *num_queues, | ||
4831 | unsigned int *real_num_queues) | ||
4832 | { | 4839 | { |
4833 | *num_queues = tx_queues; | 4840 | return tx_queues; |
4834 | return 0; | ||
4835 | } | 4841 | } |
4836 | 4842 | ||
4837 | static struct rtnl_link_ops bond_link_ops __read_mostly = { | 4843 | static struct rtnl_link_ops bond_link_ops __read_mostly = { |