diff options
Diffstat (limited to 'drivers/net/bonding/bond_main.c')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 4c08018d7333..1c6104d3501d 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -1270,9 +1270,13 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1270 | 1270 | ||
1271 | if (slave_ops->ndo_set_mac_address == NULL) { | 1271 | if (slave_ops->ndo_set_mac_address == NULL) { |
1272 | if (!bond_has_slaves(bond)) { | 1272 | if (!bond_has_slaves(bond)) { |
1273 | pr_warning("%s: Warning: The first slave device specified does not support setting the MAC address. Setting fail_over_mac to active.", | 1273 | pr_warn("%s: Warning: The first slave device specified does not support setting the MAC address.\n", |
1274 | bond_dev->name); | 1274 | bond_dev->name); |
1275 | bond->params.fail_over_mac = BOND_FOM_ACTIVE; | 1275 | if (bond->params.mode == BOND_MODE_ACTIVEBACKUP) { |
1276 | bond->params.fail_over_mac = BOND_FOM_ACTIVE; | ||
1277 | pr_warn("%s: Setting fail_over_mac to active for active-backup mode.\n", | ||
1278 | bond_dev->name); | ||
1279 | } | ||
1276 | } else if (bond->params.fail_over_mac != BOND_FOM_ACTIVE) { | 1280 | } else if (bond->params.fail_over_mac != BOND_FOM_ACTIVE) { |
1277 | pr_err("%s: Error: The slave device specified does not support setting the MAC address, but fail_over_mac is not set to active.\n", | 1281 | pr_err("%s: Error: The slave device specified does not support setting the MAC address, but fail_over_mac is not set to active.\n", |
1278 | bond_dev->name); | 1282 | bond_dev->name); |
@@ -1315,7 +1319,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1315 | */ | 1319 | */ |
1316 | memcpy(new_slave->perm_hwaddr, slave_dev->dev_addr, ETH_ALEN); | 1320 | memcpy(new_slave->perm_hwaddr, slave_dev->dev_addr, ETH_ALEN); |
1317 | 1321 | ||
1318 | if (!bond->params.fail_over_mac) { | 1322 | if (!bond->params.fail_over_mac || |
1323 | bond->params.mode != BOND_MODE_ACTIVEBACKUP) { | ||
1319 | /* | 1324 | /* |
1320 | * Set slave to master's mac address. The application already | 1325 | * Set slave to master's mac address. The application already |
1321 | * set the master's mac address to that of the first slave | 1326 | * set the master's mac address to that of the first slave |
@@ -1505,7 +1510,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1505 | slave_dev->npinfo = bond->dev->npinfo; | 1510 | slave_dev->npinfo = bond->dev->npinfo; |
1506 | if (slave_dev->npinfo) { | 1511 | if (slave_dev->npinfo) { |
1507 | if (slave_enable_netpoll(new_slave)) { | 1512 | if (slave_enable_netpoll(new_slave)) { |
1508 | read_unlock(&bond->lock); | ||
1509 | pr_info("Error, %s: master_dev is using netpoll, " | 1513 | pr_info("Error, %s: master_dev is using netpoll, " |
1510 | "but new slave device does not support netpoll.\n", | 1514 | "but new slave device does not support netpoll.\n", |
1511 | bond_dev->name); | 1515 | bond_dev->name); |
@@ -1539,9 +1543,11 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1539 | bond_set_carrier(bond); | 1543 | bond_set_carrier(bond); |
1540 | 1544 | ||
1541 | if (USES_PRIMARY(bond->params.mode)) { | 1545 | if (USES_PRIMARY(bond->params.mode)) { |
1546 | block_netpoll_tx(); | ||
1542 | write_lock_bh(&bond->curr_slave_lock); | 1547 | write_lock_bh(&bond->curr_slave_lock); |
1543 | bond_select_active_slave(bond); | 1548 | bond_select_active_slave(bond); |
1544 | write_unlock_bh(&bond->curr_slave_lock); | 1549 | write_unlock_bh(&bond->curr_slave_lock); |
1550 | unblock_netpoll_tx(); | ||
1545 | } | 1551 | } |
1546 | 1552 | ||
1547 | pr_info("%s: enslaving %s as a%s interface with a%s link.\n", | 1553 | pr_info("%s: enslaving %s as a%s interface with a%s link.\n", |
@@ -1567,10 +1573,12 @@ err_detach: | |||
1567 | if (bond->primary_slave == new_slave) | 1573 | if (bond->primary_slave == new_slave) |
1568 | bond->primary_slave = NULL; | 1574 | bond->primary_slave = NULL; |
1569 | if (bond->curr_active_slave == new_slave) { | 1575 | if (bond->curr_active_slave == new_slave) { |
1576 | block_netpoll_tx(); | ||
1570 | write_lock_bh(&bond->curr_slave_lock); | 1577 | write_lock_bh(&bond->curr_slave_lock); |
1571 | bond_change_active_slave(bond, NULL); | 1578 | bond_change_active_slave(bond, NULL); |
1572 | bond_select_active_slave(bond); | 1579 | bond_select_active_slave(bond); |
1573 | write_unlock_bh(&bond->curr_slave_lock); | 1580 | write_unlock_bh(&bond->curr_slave_lock); |
1581 | unblock_netpoll_tx(); | ||
1574 | } | 1582 | } |
1575 | slave_disable_netpoll(new_slave); | 1583 | slave_disable_netpoll(new_slave); |
1576 | 1584 | ||
@@ -1579,7 +1587,8 @@ err_close: | |||
1579 | dev_close(slave_dev); | 1587 | dev_close(slave_dev); |
1580 | 1588 | ||
1581 | err_restore_mac: | 1589 | err_restore_mac: |
1582 | if (!bond->params.fail_over_mac) { | 1590 | if (!bond->params.fail_over_mac || |
1591 | bond->params.mode != BOND_MODE_ACTIVEBACKUP) { | ||
1583 | /* XXX TODO - fom follow mode needs to change master's | 1592 | /* XXX TODO - fom follow mode needs to change master's |
1584 | * MAC if this slave's MAC is in use by the bond, or at | 1593 | * MAC if this slave's MAC is in use by the bond, or at |
1585 | * least print a warning. | 1594 | * least print a warning. |
@@ -1672,7 +1681,8 @@ static int __bond_release_one(struct net_device *bond_dev, | |||
1672 | 1681 | ||
1673 | bond->current_arp_slave = NULL; | 1682 | bond->current_arp_slave = NULL; |
1674 | 1683 | ||
1675 | if (!all && !bond->params.fail_over_mac) { | 1684 | if (!all && (!bond->params.fail_over_mac || |
1685 | bond->params.mode != BOND_MODE_ACTIVEBACKUP)) { | ||
1676 | if (ether_addr_equal_64bits(bond_dev->dev_addr, slave->perm_hwaddr) && | 1686 | if (ether_addr_equal_64bits(bond_dev->dev_addr, slave->perm_hwaddr) && |
1677 | bond_has_slaves(bond)) | 1687 | bond_has_slaves(bond)) |
1678 | pr_warn("%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", | 1688 | pr_warn("%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", |
@@ -1769,7 +1779,8 @@ static int __bond_release_one(struct net_device *bond_dev, | |||
1769 | /* close slave before restoring its mac address */ | 1779 | /* close slave before restoring its mac address */ |
1770 | dev_close(slave_dev); | 1780 | dev_close(slave_dev); |
1771 | 1781 | ||
1772 | if (bond->params.fail_over_mac != BOND_FOM_ACTIVE) { | 1782 | if (bond->params.fail_over_mac != BOND_FOM_ACTIVE || |
1783 | bond->params.mode != BOND_MODE_ACTIVEBACKUP) { | ||
1773 | /* restore original ("permanent") mac address */ | 1784 | /* restore original ("permanent") mac address */ |
1774 | memcpy(addr.sa_data, slave->perm_hwaddr, ETH_ALEN); | 1785 | memcpy(addr.sa_data, slave->perm_hwaddr, ETH_ALEN); |
1775 | addr.sa_family = slave_dev->type; | 1786 | addr.sa_family = slave_dev->type; |
@@ -2857,9 +2868,12 @@ static int bond_slave_netdev_event(unsigned long event, | |||
2857 | pr_info("%s: Primary slave changed to %s, reselecting active slave.\n", | 2868 | pr_info("%s: Primary slave changed to %s, reselecting active slave.\n", |
2858 | bond->dev->name, bond->primary_slave ? slave_dev->name : | 2869 | bond->dev->name, bond->primary_slave ? slave_dev->name : |
2859 | "none"); | 2870 | "none"); |
2871 | |||
2872 | block_netpoll_tx(); | ||
2860 | write_lock_bh(&bond->curr_slave_lock); | 2873 | write_lock_bh(&bond->curr_slave_lock); |
2861 | bond_select_active_slave(bond); | 2874 | bond_select_active_slave(bond); |
2862 | write_unlock_bh(&bond->curr_slave_lock); | 2875 | write_unlock_bh(&bond->curr_slave_lock); |
2876 | unblock_netpoll_tx(); | ||
2863 | break; | 2877 | break; |
2864 | case NETDEV_FEAT_CHANGE: | 2878 | case NETDEV_FEAT_CHANGE: |
2865 | bond_compute_features(bond); | 2879 | bond_compute_features(bond); |
@@ -3431,7 +3445,8 @@ static int bond_set_mac_address(struct net_device *bond_dev, void *addr) | |||
3431 | /* If fail_over_mac is enabled, do nothing and return success. | 3445 | /* If fail_over_mac is enabled, do nothing and return success. |
3432 | * Returning an error causes ifenslave to fail. | 3446 | * Returning an error causes ifenslave to fail. |
3433 | */ | 3447 | */ |
3434 | if (bond->params.fail_over_mac) | 3448 | if (bond->params.fail_over_mac && |
3449 | bond->params.mode == BOND_MODE_ACTIVEBACKUP) | ||
3435 | return 0; | 3450 | return 0; |
3436 | 3451 | ||
3437 | if (!is_valid_ether_addr(sa->sa_data)) | 3452 | if (!is_valid_ether_addr(sa->sa_data)) |
@@ -3692,7 +3707,7 @@ static inline int bond_slave_override(struct bonding *bond, | |||
3692 | 3707 | ||
3693 | 3708 | ||
3694 | static u16 bond_select_queue(struct net_device *dev, struct sk_buff *skb, | 3709 | static u16 bond_select_queue(struct net_device *dev, struct sk_buff *skb, |
3695 | void *accel_priv) | 3710 | void *accel_priv, select_queue_fallback_t fallback) |
3696 | { | 3711 | { |
3697 | /* | 3712 | /* |
3698 | * This helper function exists to help dev_pick_tx get the correct | 3713 | * This helper function exists to help dev_pick_tx get the correct |