aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-02-04 22:47:55 -0500
committerDavid S. Miller <davem@davemloft.net>2014-02-04 22:47:55 -0500
commit9330ed16da840b1b68cd99600d403b6f3e9fa4e2 (patch)
tree57e07faeb8def276e9cb83446758ed1043d093d4
parentb045d37bd68c20ca88123c2b363cac5e3dae815f (diff)
parentcc689aaa7abf33b2ccb02482e5e17885ea8903d1 (diff)
Merge branch 'bonding_fail_over_mac'
Ding Tianhong says: ==================== bonding: Fix some issues for fail_over_mac The parameter fail_over_mac only affect active-backup mode, if it was set to active or follow and works with other modes, just like RR or XOR mode, the bonding could not set all slaves to the master's address, it will cause the slave could not work well with master. v1->v2: According Jay's suggestion, that we should permit setting an option at any time, but only have it take effect in active-backup mode, so I add mode checking together with fail_over_mac during enslavement and rebuild the patches. v2->v3: The correct way to fix the problem is that we should not add restrictions when setting options, just need to modify the bond enslave and removal processing to check the mode in addition to fail_over_mac when setting a slave's MAC during enslavement. The change active slave processing already only calls the fail_over_mac function when in active-backup mode. Remove the cleanup patch because the net-next is frozen now. ==================== Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
-rw-r--r--drivers/net/bonding/bond_main.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 4c08018d7333..35f7e90aef72 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
@@ -1579,7 +1584,8 @@ err_close:
1579 dev_close(slave_dev); 1584 dev_close(slave_dev);
1580 1585
1581err_restore_mac: 1586err_restore_mac:
1582 if (!bond->params.fail_over_mac) { 1587 if (!bond->params.fail_over_mac ||
1588 bond->params.mode != BOND_MODE_ACTIVEBACKUP) {
1583 /* XXX TODO - fom follow mode needs to change master's 1589 /* 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 1590 * MAC if this slave's MAC is in use by the bond, or at
1585 * least print a warning. 1591 * least print a warning.
@@ -1672,7 +1678,8 @@ static int __bond_release_one(struct net_device *bond_dev,
1672 1678
1673 bond->current_arp_slave = NULL; 1679 bond->current_arp_slave = NULL;
1674 1680
1675 if (!all && !bond->params.fail_over_mac) { 1681 if (!all && (!bond->params.fail_over_mac ||
1682 bond->params.mode != BOND_MODE_ACTIVEBACKUP)) {
1676 if (ether_addr_equal_64bits(bond_dev->dev_addr, slave->perm_hwaddr) && 1683 if (ether_addr_equal_64bits(bond_dev->dev_addr, slave->perm_hwaddr) &&
1677 bond_has_slaves(bond)) 1684 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", 1685 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 +1776,8 @@ static int __bond_release_one(struct net_device *bond_dev,
1769 /* close slave before restoring its mac address */ 1776 /* close slave before restoring its mac address */
1770 dev_close(slave_dev); 1777 dev_close(slave_dev);
1771 1778
1772 if (bond->params.fail_over_mac != BOND_FOM_ACTIVE) { 1779 if (bond->params.fail_over_mac != BOND_FOM_ACTIVE ||
1780 bond->params.mode != BOND_MODE_ACTIVEBACKUP) {
1773 /* restore original ("permanent") mac address */ 1781 /* restore original ("permanent") mac address */
1774 memcpy(addr.sa_data, slave->perm_hwaddr, ETH_ALEN); 1782 memcpy(addr.sa_data, slave->perm_hwaddr, ETH_ALEN);
1775 addr.sa_family = slave_dev->type; 1783 addr.sa_family = slave_dev->type;
@@ -3431,7 +3439,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. 3439 /* If fail_over_mac is enabled, do nothing and return success.
3432 * Returning an error causes ifenslave to fail. 3440 * Returning an error causes ifenslave to fail.
3433 */ 3441 */
3434 if (bond->params.fail_over_mac) 3442 if (bond->params.fail_over_mac &&
3443 bond->params.mode == BOND_MODE_ACTIVEBACKUP)
3435 return 0; 3444 return 0;
3436 3445
3437 if (!is_valid_ether_addr(sa->sa_data)) 3446 if (!is_valid_ether_addr(sa->sa_data))