aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_main.c
diff options
context:
space:
mode:
authorJiri Pirko <jpirko@redhat.com>2010-05-18 01:42:40 -0400
committerDavid S. Miller <davem@davemloft.net>2010-06-02 06:39:41 -0400
commitb15ba0fbdc2e54c3885fed91c54aeef7fe474033 (patch)
treebc51f9675212866b4f7ae68fd54fa28b3e85e6d0 /drivers/net/bonding/bond_main.c
parent64585909996de7deaf8aa5cf7629d775b16ee417 (diff)
bonding: move slave MTU handling from sysfs V2
V1->V2: corrected res/ret use For some reason, MTU handling (storing, and restoring) is taking place in bond_sysfs. The correct place for this code is in bond_enslave, bond_release. So move it there. Signed-off-by: Jiri Pirko <jpirko@redhat.com> Signed-off-by: Jay Vosburgh <fubar@us.ibm.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.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 5e12462a9d5e..2c3f9db91b50 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1533,6 +1533,14 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1533 */ 1533 */
1534 new_slave->original_flags = slave_dev->flags; 1534 new_slave->original_flags = slave_dev->flags;
1535 1535
1536 /* Save slave's original mtu and then set it to match the bond */
1537 new_slave->original_mtu = slave_dev->mtu;
1538 res = dev_set_mtu(slave_dev, bond->dev->mtu);
1539 if (res) {
1540 pr_debug("Error %d calling dev_set_mtu\n", res);
1541 goto err_free;
1542 }
1543
1536 /* 1544 /*
1537 * Save slave's original ("permanent") mac address for modes 1545 * Save slave's original ("permanent") mac address for modes
1538 * that need it, and for restoring it upon release, and then 1546 * that need it, and for restoring it upon release, and then
@@ -1550,7 +1558,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1550 res = dev_set_mac_address(slave_dev, &addr); 1558 res = dev_set_mac_address(slave_dev, &addr);
1551 if (res) { 1559 if (res) {
1552 pr_debug("Error %d calling set_mac_address\n", res); 1560 pr_debug("Error %d calling set_mac_address\n", res);
1553 goto err_free; 1561 goto err_restore_mtu;
1554 } 1562 }
1555 } 1563 }
1556 1564
@@ -1785,6 +1793,9 @@ err_restore_mac:
1785 dev_set_mac_address(slave_dev, &addr); 1793 dev_set_mac_address(slave_dev, &addr);
1786 } 1794 }
1787 1795
1796err_restore_mtu:
1797 dev_set_mtu(slave_dev, new_slave->original_mtu);
1798
1788err_free: 1799err_free:
1789 kfree(new_slave); 1800 kfree(new_slave);
1790 1801
@@ -1969,6 +1980,8 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
1969 dev_set_mac_address(slave_dev, &addr); 1980 dev_set_mac_address(slave_dev, &addr);
1970 } 1981 }
1971 1982
1983 dev_set_mtu(slave_dev, slave->original_mtu);
1984
1972 slave_dev->priv_flags &= ~(IFF_MASTER_8023AD | IFF_MASTER_ALB | 1985 slave_dev->priv_flags &= ~(IFF_MASTER_8023AD | IFF_MASTER_ALB |
1973 IFF_SLAVE_INACTIVE | IFF_BONDING | 1986 IFF_SLAVE_INACTIVE | IFF_BONDING |
1974 IFF_SLAVE_NEEDARP); 1987 IFF_SLAVE_NEEDARP);