aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_sysfs.c
diff options
context:
space:
mode:
authorsfeldma@cumulusnetworks.com <sfeldma@cumulusnetworks.com>2013-12-15 19:42:05 -0500
committerDavid S. Miller <davem@davemloft.net>2013-12-17 16:08:45 -0500
commit89901972de4c00e74e56529804493734d77ee3d3 (patch)
tree1ca8eb5d436b00fb9b5c921efdd74ed5bd64dfaa /drivers/net/bonding/bond_sysfs.c
parent8a41ae4496e534a8b68d9bc3c79113e16d1fcd4c (diff)
bonding: add fail_over_mac attribute netlink support
Add IFLA_BOND_FAIL_OVER_MAC to allow get/set of bonding parameter fail_over_mac via netlink. Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.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.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 324afa5fda93..c84a90f9a0ac 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -442,33 +442,23 @@ static ssize_t bonding_store_fail_over_mac(struct device *d,
442 struct device_attribute *attr, 442 struct device_attribute *attr,
443 const char *buf, size_t count) 443 const char *buf, size_t count)
444{ 444{
445 int new_value, ret = count; 445 int new_value, ret;
446 struct bonding *bond = to_bond(d); 446 struct bonding *bond = to_bond(d);
447 447
448 if (!rtnl_trylock())
449 return restart_syscall();
450
451 if (bond_has_slaves(bond)) {
452 pr_err("%s: Can't alter fail_over_mac with slaves in bond.\n",
453 bond->dev->name);
454 ret = -EPERM;
455 goto out;
456 }
457
458 new_value = bond_parse_parm(buf, fail_over_mac_tbl); 448 new_value = bond_parse_parm(buf, fail_over_mac_tbl);
459 if (new_value < 0) { 449 if (new_value < 0) {
460 pr_err("%s: Ignoring invalid fail_over_mac value %s.\n", 450 pr_err("%s: Ignoring invalid fail_over_mac value %s.\n",
461 bond->dev->name, buf); 451 bond->dev->name, buf);
462 ret = -EINVAL; 452 return -EINVAL;
463 goto out;
464 } 453 }
465 454
466 bond->params.fail_over_mac = new_value; 455 if (!rtnl_trylock())
467 pr_info("%s: Setting fail_over_mac to %s (%d).\n", 456 return restart_syscall();
468 bond->dev->name, fail_over_mac_tbl[new_value].modename, 457
469 new_value); 458 ret = bond_option_fail_over_mac_set(bond, new_value);
459 if (!ret)
460 ret = count;
470 461
471out:
472 rtnl_unlock(); 462 rtnl_unlock();
473 return ret; 463 return ret;
474} 464}