diff options
author | Nikolay Aleksandrov <nikolay@redhat.com> | 2014-01-22 14:53:20 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-22 15:38:42 -0800 |
commit | 162288810c9ebd2efb79ee6dc364e266044cac9e (patch) | |
tree | 2638c5904daed142d5bbaa8d0dbcfde0c35f1d22 /drivers/net/bonding/bond_options.c | |
parent | a4b32ce7f891d507aa663bc78118ef267f0d6d4c (diff) | |
download | op-kernel-dev-162288810c9ebd2efb79ee6dc364e266044cac9e.zip op-kernel-dev-162288810c9ebd2efb79ee6dc364e266044cac9e.tar.gz |
bonding: convert arp_validate to use the new option API
This patch adds the necessary changes so arp_validate 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 | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c index 71e8c527..eff68a0 100644 --- a/drivers/net/bonding/bond_options.c +++ b/drivers/net/bonding/bond_options.c @@ -45,6 +45,14 @@ static struct bond_opt_value bond_xmit_hashtype_tbl[] = { { NULL, -1, 0}, }; +static struct bond_opt_value bond_arp_validate_tbl[] = { + { "none", BOND_ARP_VALIDATE_NONE, BOND_VALFLAG_DEFAULT}, + { "active", BOND_ARP_VALIDATE_ACTIVE, 0}, + { "backup", BOND_ARP_VALIDATE_BACKUP, 0}, + { "all", BOND_ARP_VALIDATE_ALL, 0}, + { NULL, -1, 0}, +}; + static struct bond_option bond_opts[] = { [BOND_OPT_MODE] = { .id = BOND_OPT_MODE, @@ -69,6 +77,14 @@ static struct bond_option bond_opts[] = { .values = bond_xmit_hashtype_tbl, .set = bond_option_xmit_hash_policy_set }, + [BOND_OPT_ARP_VALIDATE] = { + .id = BOND_OPT_ARP_VALIDATE, + .name = "arp_validate", + .desc = "validate src/dst of ARP probes", + .unsuppmodes = BOND_MODE_ALL_EX(BIT(BOND_MODE_ACTIVEBACKUP)), + .values = bond_arp_validate_tbl, + .set = bond_option_arp_validate_set + }, { } }; @@ -734,31 +750,19 @@ int bond_option_arp_ip_targets_set(struct bonding *bond, __be32 *targets, return ret; } -int bond_option_arp_validate_set(struct bonding *bond, int arp_validate) +int bond_option_arp_validate_set(struct bonding *bond, + struct bond_opt_value *newval) { - if (bond_parm_tbl_lookup(arp_validate, arp_validate_tbl) < 0) { - pr_err("%s: Ignoring invalid arp_validate value %d.\n", - bond->dev->name, arp_validate); - return -EINVAL; - } - - if (bond->params.mode != BOND_MODE_ACTIVEBACKUP) { - pr_err("%s: arp_validate only supported in active-backup mode.\n", - bond->dev->name); - return -EINVAL; - } - - pr_info("%s: setting arp_validate to %s (%d).\n", - bond->dev->name, arp_validate_tbl[arp_validate].modename, - arp_validate); + pr_info("%s: setting arp_validate to %s (%llu).\n", + bond->dev->name, newval->string, newval->value); if (bond->dev->flags & IFF_UP) { - if (!arp_validate) + if (!newval->value) bond->recv_probe = NULL; else if (bond->params.arp_interval) bond->recv_probe = bond_arp_rcv; } - bond->params.arp_validate = arp_validate; + bond->params.arp_validate = newval->value; return 0; } |