aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_main.c
diff options
context:
space:
mode:
authorNikolay Aleksandrov <nikolay@redhat.com>2014-01-22 08:53:17 -0500
committerDavid S. Miller <davem@davemloft.net>2014-01-22 18:38:41 -0500
commit2b3798d5e1377ce6c67993bb271754c9c5ab4833 (patch)
tree29e37d916f2312c62d9e2f46a6cbe54125e1f3bb /drivers/net/bonding/bond_main.c
parent0911736245df19b423a3b156f6709e7bba48b18a (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.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index f100bd958b88..7a04f0f8449e 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[] = {
214{ NULL, -1}, 214{ NULL, -1},
215}; 215};
216 216
217const struct bond_parm_tbl bond_mode_tbl[] = {
218{ "balance-rr", BOND_MODE_ROUNDROBIN},
219{ "active-backup", BOND_MODE_ACTIVEBACKUP},
220{ "balance-xor", BOND_MODE_XOR},
221{ "broadcast", BOND_MODE_BROADCAST},
222{ "802.3ad", BOND_MODE_8023AD},
223{ "balance-tlb", BOND_MODE_TLB},
224{ "balance-alb", BOND_MODE_ALB},
225{ NULL, -1},
226};
227
228const struct bond_parm_tbl xmit_hashtype_tbl[] = { 217const struct bond_parm_tbl xmit_hashtype_tbl[] = {
229{ "layer2", BOND_XMIT_POLICY_LAYER2}, 218{ "layer2", BOND_XMIT_POLICY_LAYER2},
230{ "layer3+4", BOND_XMIT_POLICY_LAYER34}, 219{ "layer3+4", BOND_XMIT_POLICY_LAYER34},
@@ -4028,18 +4017,20 @@ int bond_parse_parm(const char *buf, const struct bond_parm_tbl *tbl)
4028static int bond_check_params(struct bond_params *params) 4017static int bond_check_params(struct bond_params *params)
4029{ 4018{
4030 int arp_validate_value, fail_over_mac_value, primary_reselect_value, i; 4019 int arp_validate_value, fail_over_mac_value, primary_reselect_value, i;
4020 struct bond_opt_value newval, *valptr;
4031 int arp_all_targets_value; 4021 int arp_all_targets_value;
4032 4022
4033 /* 4023 /*
4034 * Convert string parameters. 4024 * Convert string parameters.
4035 */ 4025 */
4036 if (mode) { 4026 if (mode) {
4037 bond_mode = bond_parse_parm(mode, bond_mode_tbl); 4027 bond_opt_initstr(&newval, mode);
4038 if (bond_mode == -1) { 4028 valptr = bond_opt_parse(bond_opt_get(BOND_OPT_MODE), &newval);
4039 pr_err("Error: Invalid bonding mode \"%s\"\n", 4029 if (!valptr) {
4040 mode == NULL ? "NULL" : mode); 4030 pr_err("Error: Invalid bonding mode \"%s\"\n", mode);
4041 return -EINVAL; 4031 return -EINVAL;
4042 } 4032 }
4033 bond_mode = valptr->value;
4043 } 4034 }
4044 4035
4045 if (xmit_hash_policy) { 4036 if (xmit_hash_policy) {