diff options
author | Nikolay Aleksandrov <nikolay@redhat.com> | 2014-01-22 14:53:23 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-22 15:38:42 -0800 |
commit | 7bdb04ed0dbf9f0e94110be43db4f8bb7df58de2 (patch) | |
tree | 32d3faa0349f33912923606058c082bcf712437d /drivers/net/bonding/bond_options.c | |
parent | 1df6b6aa334c99b39f9366f4199b7f5e479a8899 (diff) | |
download | lwn-7bdb04ed0dbf9f0e94110be43db4f8bb7df58de2.tar.gz lwn-7bdb04ed0dbf9f0e94110be43db4f8bb7df58de2.zip |
bonding: convert arp_interval to use the new option API
This patch adds the necessary changes so arp_interval would use
the new bonding option API. The "default" definition has been removed as
it was 0.
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 | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c index c73d3acbdd37..df693afbb1a5 100644 --- a/drivers/net/bonding/bond_options.c +++ b/drivers/net/bonding/bond_options.c @@ -66,6 +66,11 @@ static struct bond_opt_value bond_fail_over_mac_tbl[] = { { NULL, -1, 0}, }; +static struct bond_opt_value bond_intmax_tbl[] = { + { "off", 0, BOND_VALFLAG_DEFAULT}, + { "maxval", INT_MAX, BOND_VALFLAG_MAX}, +}; + static struct bond_option bond_opts[] = { [BOND_OPT_MODE] = { .id = BOND_OPT_MODE, @@ -113,6 +118,15 @@ static struct bond_option bond_opts[] = { .values = bond_fail_over_mac_tbl, .set = bond_option_fail_over_mac_set }, + [BOND_OPT_ARP_INTERVAL] = { + .id = BOND_OPT_ARP_INTERVAL, + .name = "arp_interval", + .desc = "arp interval in milliseconds", + .unsuppmodes = BIT(BOND_MODE_8023AD) | BIT(BOND_MODE_TLB) | + BIT(BOND_MODE_ALB), + .values = bond_intmax_tbl, + .set = bond_option_arp_interval_set + }, { } }; @@ -601,22 +615,13 @@ int bond_option_use_carrier_set(struct bonding *bond, int use_carrier) return 0; } -int bond_option_arp_interval_set(struct bonding *bond, int arp_interval) +int bond_option_arp_interval_set(struct bonding *bond, + struct bond_opt_value *newval) { - if (arp_interval < 0) { - pr_err("%s: Invalid arp_interval value %d not in range 0-%d; rejected.\n", - bond->dev->name, arp_interval, INT_MAX); - return -EINVAL; - } - if (BOND_NO_USES_ARP(bond->params.mode)) { - pr_info("%s: ARP monitoring cannot be used with ALB/TLB/802.3ad. Only MII monitoring is supported on %s.\n", - bond->dev->name, bond->dev->name); - return -EINVAL; - } - pr_info("%s: Setting ARP monitoring interval to %d.\n", - bond->dev->name, arp_interval); - bond->params.arp_interval = arp_interval; - if (arp_interval) { + pr_info("%s: Setting ARP monitoring interval to %llu.\n", + bond->dev->name, newval->value); + bond->params.arp_interval = newval->value; + if (newval->value) { if (bond->params.miimon) { pr_info("%s: ARP monitoring cannot be used with MII monitoring. %s Disabling MII monitoring.\n", bond->dev->name, bond->dev->name); @@ -632,7 +637,7 @@ int bond_option_arp_interval_set(struct bonding *bond, int arp_interval) * timer will get fired off when the open function * is called. */ - if (!arp_interval) { + if (!newval->value) { if (bond->params.arp_validate) bond->recv_probe = NULL; cancel_delayed_work_sync(&bond->arp_work); |