diff options
author | sfeldma@cumulusnetworks.com <sfeldma@cumulusnetworks.com> | 2014-01-03 14:18:49 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-03 21:03:21 -0500 |
commit | ec029fac3e96980fa8f6f81b8327787a9600dfaa (patch) | |
tree | 81313ab42dfee3f1795dd250aa94217f73543939 /drivers/net/bonding/bond_sysfs.c | |
parent | 998e40bbf8f0e10b5d84107afc61e29dbc8d2de4 (diff) | |
download | op-kernel-dev-ec029fac3e96980fa8f6f81b8327787a9600dfaa.zip op-kernel-dev-ec029fac3e96980fa8f6f81b8327787a9600dfaa.tar.gz |
bonding: add ad_select attribute netlink support
Add IFLA_BOND_AD_SELECT to allow get/set of bonding parameter
ad_select 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.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 62d33dc..9a1ea4a 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c @@ -733,29 +733,24 @@ static ssize_t bonding_store_ad_select(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - int new_value, ret = count; + int new_value, ret; struct bonding *bond = to_bond(d); - if (bond->dev->flags & IFF_UP) { - pr_err("%s: Unable to update ad_select because interface is up.\n", - bond->dev->name); - ret = -EPERM; - goto out; - } - new_value = bond_parse_parm(buf, ad_select_tbl); - - if (new_value != -1) { - bond->params.ad_select = new_value; - pr_info("%s: Setting ad_select to %s (%d).\n", - bond->dev->name, ad_select_tbl[new_value].modename, - new_value); - } else { + if (new_value < 0) { pr_err("%s: Ignoring invalid ad_select value %.*s.\n", bond->dev->name, (int)strlen(buf) - 1, buf); - ret = -EINVAL; + return -EINVAL; } -out: + + if (!rtnl_trylock()) + return restart_syscall(); + + ret = bond_option_ad_select_set(bond, new_value); + if (!ret) + ret = count; + + rtnl_unlock(); return ret; } static DEVICE_ATTR(ad_select, S_IRUGO | S_IWUSR, |