diff options
author | Nikolay Aleksandrov <nikolay@redhat.com> | 2014-01-22 14:53:17 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-22 15:38:41 -0800 |
commit | 2b3798d5e1377ce6c67993bb271754c9c5ab4833 (patch) | |
tree | 29e37d916f2312c62d9e2f46a6cbe54125e1f3bb /drivers/net/bonding/bond_main.c | |
parent | 0911736245df19b423a3b156f6709e7bba48b18a (diff) |
bonding: convert mode setting to use the new option API
This patch makes the bond's mode setting use the new option API and
adds support for dependency printing which relies on having an entry for
the mode option in the bond_opts[] array.
Also add the ability to print the mode name when mode dependency fails
and 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_main.c')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index f100bd958b8..7a04f0f8449 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -214,17 +214,6 @@ const struct bond_parm_tbl bond_lacp_tbl[] = { { NULL, -1}, }; -const struct bond_parm_tbl bond_mode_tbl[] = { -{ "balance-rr", BOND_MODE_ROUNDROBIN}, -{ "active-backup", BOND_MODE_ACTIVEBACKUP}, -{ "balance-xor", BOND_MODE_XOR}, -{ "broadcast", BOND_MODE_BROADCAST}, -{ "802.3ad", BOND_MODE_8023AD}, -{ "balance-tlb", BOND_MODE_TLB}, -{ "balance-alb", BOND_MODE_ALB}, -{ NULL, -1}, -}; - const struct bond_parm_tbl xmit_hashtype_tbl[] = { { "layer2", BOND_XMIT_POLICY_LAYER2}, { "layer3+4", BOND_XMIT_POLICY_LAYER34}, @@ -4028,18 +4017,20 @@ int bond_parse_parm(const char *buf, const struct bond_parm_tbl *tbl) static int bond_check_params(struct bond_params *params) { int arp_validate_value, fail_over_mac_value, primary_reselect_value, i; + struct bond_opt_value newval, *valptr; int arp_all_targets_value; /* * Convert string parameters. */ if (mode) { - bond_mode = bond_parse_parm(mode, bond_mode_tbl); - if (bond_mode == -1) { - pr_err("Error: Invalid bonding mode \"%s\"\n", - mode == NULL ? "NULL" : mode); + bond_opt_initstr(&newval, mode); + valptr = bond_opt_parse(bond_opt_get(BOND_OPT_MODE), &newval); + if (!valptr) { + pr_err("Error: Invalid bonding mode \"%s\"\n", mode); return -EINVAL; } + bond_mode = valptr->value; } if (xmit_hash_policy) { |