summaryrefslogtreecommitdiff
path: root/drivers/net/bonding/bond_options.c
diff options
context:
space:
mode:
authorNikolay Aleksandrov <nikolay@redhat.com>2014-01-22 14:53:34 +0100
committerDavid S. Miller <davem@davemloft.net>2014-01-22 15:38:43 -0800
commit0fff060877426f3faf6754c201e28cd5b34756c0 (patch)
treefa4c65b3091a5a8d244e1932c0ce27391aba4c84 /drivers/net/bonding/bond_options.c
parent388d3a6d4aa356b885bcd023c185060df9ea2484 (diff)
bonding: convert use_carrier to use the new option API
This patch adds the necessary changes so use_carrier 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.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
index eaa3d4057cd3..18b1cc0d8b80 100644
--- a/drivers/net/bonding/bond_options.c
+++ b/drivers/net/bonding/bond_options.c
@@ -99,6 +99,12 @@ static struct bond_opt_value bond_primary_reselect_tbl[] = {
{ NULL, -1},
};
+static struct bond_opt_value bond_use_carrier_tbl[] = {
+ { "off", 0, 0},
+ { "on", 1, BOND_VALFLAG_DEFAULT},
+ { NULL, -1, 0}
+};
+
static struct bond_option bond_opts[] = {
[BOND_OPT_MODE] = {
.id = BOND_OPT_MODE,
@@ -231,6 +237,13 @@ static struct bond_option bond_opts[] = {
.values = bond_primary_reselect_tbl,
.set = bond_option_primary_reselect_set
},
+ [BOND_OPT_USE_CARRIER] = {
+ .id = BOND_OPT_USE_CARRIER,
+ .name = "use_carrier",
+ .desc = "Use netif_carrier_ok (vs MII ioctls) in miimon",
+ .values = bond_use_carrier_tbl,
+ .set = bond_option_use_carrier_set
+ },
{ }
};
@@ -688,16 +701,12 @@ int bond_option_downdelay_set(struct bonding *bond,
return 0;
}
-int bond_option_use_carrier_set(struct bonding *bond, int use_carrier)
+int bond_option_use_carrier_set(struct bonding *bond,
+ struct bond_opt_value *newval)
{
- if ((use_carrier == 0) || (use_carrier == 1)) {
- bond->params.use_carrier = use_carrier;
- pr_info("%s: Setting use_carrier to %d.\n",
- bond->dev->name, use_carrier);
- } else {
- pr_info("%s: Ignoring invalid use_carrier value %d.\n",
- bond->dev->name, use_carrier);
- }
+ pr_info("%s: Setting use_carrier to %llu.\n",
+ bond->dev->name, newval->value);
+ bond->params.use_carrier = newval->value;
return 0;
}