diff options
author | Nikolay Aleksandrov <nikolay@redhat.com> | 2014-01-22 14:53:21 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-22 15:38:42 -0800 |
commit | edf36b24c58dbbd5f2e708096537bf0a88ffa477 (patch) | |
tree | 0eb18f5930e6e524124df2fc0ac1dd99236fb3cd /drivers/net/bonding/bond_options.c | |
parent | 162288810c9ebd2efb79ee6dc364e266044cac9e (diff) |
bonding: convert arp_all_targets to use the new option API
This patch adds the necessary changes so arp_all_targets would use the
new bonding option API.
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 | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c index eff68a0f71f..e136e7525a0 100644 --- a/drivers/net/bonding/bond_options.c +++ b/drivers/net/bonding/bond_options.c @@ -53,6 +53,12 @@ static struct bond_opt_value bond_arp_validate_tbl[] = { { NULL, -1, 0}, }; +static struct bond_opt_value bond_arp_all_targets_tbl[] = { + { "any", BOND_ARP_TARGETS_ANY, BOND_VALFLAG_DEFAULT}, + { "all", BOND_ARP_TARGETS_ALL, 0}, + { NULL, -1, 0}, +}; + static struct bond_option bond_opts[] = { [BOND_OPT_MODE] = { .id = BOND_OPT_MODE, @@ -85,6 +91,13 @@ static struct bond_option bond_opts[] = { .values = bond_arp_validate_tbl, .set = bond_option_arp_validate_set }, + [BOND_OPT_ARP_ALL_TARGETS] = { + .id = BOND_OPT_ARP_ALL_TARGETS, + .name = "arp_all_targets", + .desc = "fail on any/all arp targets timeout", + .values = bond_arp_all_targets_tbl, + .set = bond_option_arp_all_targets_set + }, { } }; @@ -767,19 +780,12 @@ int bond_option_arp_validate_set(struct bonding *bond, return 0; } -int bond_option_arp_all_targets_set(struct bonding *bond, int arp_all_targets) +int bond_option_arp_all_targets_set(struct bonding *bond, + struct bond_opt_value *newval) { - if (bond_parm_tbl_lookup(arp_all_targets, arp_all_targets_tbl) < 0) { - pr_err("%s: Ignoring invalid arp_all_targets value %d.\n", - bond->dev->name, arp_all_targets); - return -EINVAL; - } - - pr_info("%s: setting arp_all_targets to %s (%d).\n", - bond->dev->name, arp_all_targets_tbl[arp_all_targets].modename, - arp_all_targets); - - bond->params.arp_all_targets = arp_all_targets; + pr_info("%s: setting arp_all_targets to %s (%llu).\n", + bond->dev->name, newval->string, newval->value); + bond->params.arp_all_targets = newval->value; return 0; } |