diff options
author | Nikolay Aleksandrov <nikolay@redhat.com> | 2014-01-22 14:53:19 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-22 15:38:41 -0800 |
commit | a4b32ce7f891d507aa663bc78118ef267f0d6d4c (patch) | |
tree | 292a816b471d2aac09e070835eaf6535b70df2f9 /drivers/net/bonding/bond_options.c | |
parent | aa59d8517d1017e571b803ba6302c4b693b324ab (diff) | |
download | lwn-a4b32ce7f891d507aa663bc78118ef267f0d6d4c.tar.gz lwn-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_options.c')
-rw-r--r-- | drivers/net/bonding/bond_options.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c index 6d2a7d9cee19..71e8c5279bc1 100644 --- a/drivers/net/bonding/bond_options.c +++ b/drivers/net/bonding/bond_options.c @@ -36,6 +36,15 @@ static struct bond_opt_value bond_pps_tbl[] = { { NULL, -1, 0}, }; +static struct bond_opt_value bond_xmit_hashtype_tbl[] = { + { "layer2", BOND_XMIT_POLICY_LAYER2, BOND_VALFLAG_DEFAULT}, + { "layer3+4", BOND_XMIT_POLICY_LAYER34, 0}, + { "layer2+3", BOND_XMIT_POLICY_LAYER23, 0}, + { "encap2+3", BOND_XMIT_POLICY_ENCAP23, 0}, + { "encap3+4", BOND_XMIT_POLICY_ENCAP34, 0}, + { NULL, -1, 0}, +}; + static struct bond_option bond_opts[] = { [BOND_OPT_MODE] = { .id = BOND_OPT_MODE, @@ -53,6 +62,13 @@ static struct bond_option bond_opts[] = { .values = bond_pps_tbl, .set = bond_option_pps_set }, + [BOND_OPT_XMIT_HASH] = { + .id = BOND_OPT_XMIT_HASH, + .name = "xmit_hash_policy", + .desc = "balance-xor and 802.3ad hashing method", + .values = bond_xmit_hashtype_tbl, + .set = bond_option_xmit_hash_policy_set + }, { } }; @@ -860,18 +876,12 @@ int bond_option_fail_over_mac_set(struct bonding *bond, int fail_over_mac) return 0; } -int bond_option_xmit_hash_policy_set(struct bonding *bond, int xmit_hash_policy) +int bond_option_xmit_hash_policy_set(struct bonding *bond, + struct bond_opt_value *newval) { - if (bond_parm_tbl_lookup(xmit_hash_policy, xmit_hashtype_tbl) < 0) { - pr_err("%s: Ignoring invalid xmit_hash_policy value %d.\n", - bond->dev->name, xmit_hash_policy); - return -EINVAL; - } - - bond->params.xmit_policy = xmit_hash_policy; - pr_info("%s: setting xmit hash policy to %s (%d).\n", - bond->dev->name, - xmit_hashtype_tbl[xmit_hash_policy].modename, xmit_hash_policy); + pr_info("%s: setting xmit hash policy to %s (%llu).\n", + bond->dev->name, newval->string, newval->value); + bond->params.xmit_policy = newval->value; return 0; } |