summaryrefslogtreecommitdiff
path: root/drivers/net/bonding/bond_options.c
diff options
context:
space:
mode:
authorNikolay Aleksandrov <nikolay@redhat.com>2014-01-22 14:53:31 +0100
committerDavid S. Miller <davem@davemloft.net>2014-01-22 15:38:43 -0800
commitb98d9c66e1c3823c50a3cd5e8e59f12b97d7ba5d (patch)
treef184fb9017994853bcbed1f208bb029a137617cc /drivers/net/bonding/bond_options.c
parentef56becbb37251f0371ad94210f50dc90e18830a (diff)
bonding: convert miimon to use the new option API
This patch adds the necessary changes so miimon 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.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
index 1bd19f1f1af2..cb515d94864d 100644
--- a/drivers/net/bonding/bond_options.c
+++ b/drivers/net/bonding/bond_options.c
@@ -200,6 +200,13 @@ static struct bond_option bond_opts[] = {
.values = bond_num_peer_notif_tbl,
.set = bond_option_num_peer_notif_set
},
+ [BOND_OPT_MIIMON] = {
+ .id = BOND_OPT_MIIMON,
+ .name = "miimon",
+ .desc = "Link check interval in milliseconds",
+ .values = bond_intmax_tbl,
+ .set = bond_option_miimon_set
+ },
{ }
};
@@ -575,16 +582,11 @@ int bond_option_active_slave_set(struct bonding *bond,
return ret;
}
-int bond_option_miimon_set(struct bonding *bond, int miimon)
+int bond_option_miimon_set(struct bonding *bond, struct bond_opt_value *newval)
{
- if (miimon < 0) {
- pr_err("%s: Invalid miimon value %d not in range %d-%d; rejected.\n",
- bond->dev->name, miimon, 0, INT_MAX);
- return -EINVAL;
- }
- pr_info("%s: Setting MII monitoring interval to %d.\n",
- bond->dev->name, miimon);
- bond->params.miimon = miimon;
+ pr_info("%s: Setting MII monitoring interval to %llu.\n",
+ bond->dev->name, newval->value);
+ bond->params.miimon = newval->value;
if (bond->params.updelay)
pr_info("%s: Note: Updating updelay (to %d) since it is a multiple of the miimon value.\n",
bond->dev->name,
@@ -593,7 +595,7 @@ int bond_option_miimon_set(struct bonding *bond, int miimon)
pr_info("%s: Note: Updating downdelay (to %d) since it is a multiple of the miimon value.\n",
bond->dev->name,
bond->params.downdelay * bond->params.miimon);
- if (miimon && bond->params.arp_interval) {
+ if (newval->value && bond->params.arp_interval) {
pr_info("%s: MII monitoring cannot be used with ARP monitoring. Disabling ARP monitoring...\n",
bond->dev->name);
bond->params.arp_interval = 0;
@@ -606,13 +608,14 @@ int bond_option_miimon_set(struct bonding *bond, int miimon)
* timer will get fired off when the open function
* is called.
*/
- if (!miimon) {
+ if (!newval->value) {
cancel_delayed_work_sync(&bond->mii_work);
} else {
cancel_delayed_work_sync(&bond->arp_work);
queue_delayed_work(bond->wq, &bond->mii_work, 0);
}
}
+
return 0;
}