diff options
author | Nikolay Aleksandrov <nikolay@redhat.com> | 2014-01-22 14:53:19 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-23 00:38:41 +0100 |
commit | a4b32ce7f891d507aa663bc78118ef267f0d6d4c (patch) | |
tree | 292a816b471d2aac09e070835eaf6535b70df2f9 /drivers/net/bonding/bond_sysfs.c | |
parent | bonding: convert packets_per_slave to use the new option API (diff) | |
download | linux-a4b32ce7f891d507aa663bc78118ef267f0d6d4c.tar.xz linux-a4b32ce7f891d507aa663bc78118ef267f0d6d4c.zip |
bonding: convert xmit_hash_policy to use the new option API
This patch adds the necessary changes so xmit_hash_policy would use the
new bonding option API. Also fix some trivial/style errors.
Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.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 | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 34815843f6a9..d81638c33fdb 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c @@ -294,35 +294,24 @@ static ssize_t bonding_show_xmit_hash(struct device *d, char *buf) { struct bonding *bond = to_bond(d); + struct bond_opt_value *val; - return sprintf(buf, "%s %d\n", - xmit_hashtype_tbl[bond->params.xmit_policy].modename, - bond->params.xmit_policy); + val = bond_opt_get_val(BOND_OPT_XMIT_HASH, bond->params.xmit_policy); + + return sprintf(buf, "%s %d\n", val->string, bond->params.xmit_policy); } static ssize_t bonding_store_xmit_hash(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - int new_value, ret; struct bonding *bond = to_bond(d); + int ret; - new_value = bond_parse_parm(buf, xmit_hashtype_tbl); - if (new_value < 0) { - pr_err("%s: Ignoring invalid xmit hash policy value %.*s.\n", - bond->dev->name, - (int)strlen(buf) - 1, buf); - return -EINVAL; - } - - if (!rtnl_trylock()) - return restart_syscall(); - - ret = bond_option_xmit_hash_policy_set(bond, new_value); + ret = bond_opt_tryset_rtnl(bond, BOND_OPT_XMIT_HASH, (char *)buf); if (!ret) ret = count; - rtnl_unlock(); return ret; } static DEVICE_ATTR(xmit_hash_policy, S_IRUGO | S_IWUSR, |