aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_sysfs.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_sysfs.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_sysfs.c')
-rw-r--r--drivers/net/bonding/bond_sysfs.c22
1 files changed, 2 insertions, 20 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 392e29115c3c..29a7a8a6d16f 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -220,7 +220,6 @@ static ssize_t bonding_store_slaves(struct device *d,
220 char command[IFNAMSIZ + 1] = { 0, }; 220 char command[IFNAMSIZ + 1] = { 0, };
221 char *ifname; 221 char *ifname;
222 int i, res, ret = count; 222 int i, res, ret = count;
223 u32 original_mtu;
224 struct slave *slave; 223 struct slave *slave;
225 struct net_device *dev = NULL; 224 struct net_device *dev = NULL;
226 struct bonding *bond = to_bond(d); 225 struct bonding *bond = to_bond(d);
@@ -281,18 +280,7 @@ static ssize_t bonding_store_slaves(struct device *d,
281 memcpy(bond->dev->dev_addr, dev->dev_addr, 280 memcpy(bond->dev->dev_addr, dev->dev_addr,
282 dev->addr_len); 281 dev->addr_len);
283 282
284 /* Set the slave's MTU to match the bond */
285 original_mtu = dev->mtu;
286 res = dev_set_mtu(dev, bond->dev->mtu);
287 if (res) {
288 ret = res;
289 goto out;
290 }
291
292 res = bond_enslave(bond->dev, dev); 283 res = bond_enslave(bond->dev, dev);
293 bond_for_each_slave(bond, slave, i)
294 if (strnicmp(slave->dev->name, ifname, IFNAMSIZ) == 0)
295 slave->original_mtu = original_mtu;
296 if (res) 284 if (res)
297 ret = res; 285 ret = res;
298 286
@@ -301,23 +289,17 @@ static ssize_t bonding_store_slaves(struct device *d,
301 289
302 if (command[0] == '-') { 290 if (command[0] == '-') {
303 dev = NULL; 291 dev = NULL;
304 original_mtu = 0;
305 bond_for_each_slave(bond, slave, i) 292 bond_for_each_slave(bond, slave, i)
306 if (strnicmp(slave->dev->name, ifname, IFNAMSIZ) == 0) { 293 if (strnicmp(slave->dev->name, ifname, IFNAMSIZ) == 0) {
307 dev = slave->dev; 294 dev = slave->dev;
308 original_mtu = slave->original_mtu;
309 break; 295 break;
310 } 296 }
311 if (dev) { 297 if (dev) {
312 pr_info("%s: Removing slave %s\n", 298 pr_info("%s: Removing slave %s\n",
313 bond->dev->name, dev->name); 299 bond->dev->name, dev->name);
314 res = bond_release(bond->dev, dev); 300 res = bond_release(bond->dev, dev);
315 if (res) { 301 if (res)
316 ret = res; 302 ret = res;
317 goto out;
318 }
319 /* set the slave MTU to the default */
320 dev_set_mtu(dev, original_mtu);
321 } else { 303 } else {
322 pr_err("unable to remove non-existent slave %s for bond %s.\n", 304 pr_err("unable to remove non-existent slave %s for bond %s.\n",
323 ifname, bond->dev->name); 305 ifname, bond->dev->name);