Commit f3253339 authored by stephen hemminger's avatar stephen hemminger Committed by David S. Miller

bonding: options handling cleanup

Make local functions static (ie. only used in bond_options.c)
Make bond options parsing tables constant.
Signed-off-by: default avatarStephen Hemminger <stephen@networkplumber.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fca28094
...@@ -3950,7 +3950,8 @@ static void bond_uninit(struct net_device *bond_dev) ...@@ -3950,7 +3950,8 @@ static void bond_uninit(struct net_device *bond_dev)
static int bond_check_params(struct bond_params *params) static int bond_check_params(struct bond_params *params)
{ {
int arp_validate_value, fail_over_mac_value, primary_reselect_value, i; int arp_validate_value, fail_over_mac_value, primary_reselect_value, i;
struct bond_opt_value newval, *valptr; struct bond_opt_value newval;
const struct bond_opt_value *valptr;
int arp_all_targets_value; int arp_all_targets_value;
/* /*
......
...@@ -20,7 +20,59 @@ ...@@ -20,7 +20,59 @@
#include <linux/inet.h> #include <linux/inet.h>
#include "bonding.h" #include "bonding.h"
static struct bond_opt_value bond_mode_tbl[] = { static int bond_option_active_slave_set(struct bonding *bond,
struct bond_opt_value *newval);
static int bond_option_miimon_set(struct bonding *bond,
struct bond_opt_value *newval);
static int bond_option_updelay_set(struct bonding *bond,
struct bond_opt_value *newval);
static int bond_option_downdelay_set(struct bonding *bond,
struct bond_opt_value *newval);
static int bond_option_use_carrier_set(struct bonding *bond,
struct bond_opt_value *newval);
static int bond_option_arp_interval_set(struct bonding *bond,
struct bond_opt_value *newval);
static int bond_option_arp_ip_target_add(struct bonding *bond, __be32 target);
static int bond_option_arp_ip_target_rem(struct bonding *bond, __be32 target);
static int bond_option_arp_ip_targets_set(struct bonding *bond,
struct bond_opt_value *newval);
static int bond_option_arp_validate_set(struct bonding *bond,
struct bond_opt_value *newval);
static int bond_option_arp_all_targets_set(struct bonding *bond,
struct bond_opt_value *newval);
static int bond_option_primary_set(struct bonding *bond,
struct bond_opt_value *newval);
static int bond_option_primary_reselect_set(struct bonding *bond,
struct bond_opt_value *newval);
static int bond_option_fail_over_mac_set(struct bonding *bond,
struct bond_opt_value *newval);
static int bond_option_xmit_hash_policy_set(struct bonding *bond,
struct bond_opt_value *newval);
static int bond_option_resend_igmp_set(struct bonding *bond,
struct bond_opt_value *newval);
static int bond_option_num_peer_notif_set(struct bonding *bond,
struct bond_opt_value *newval);
static int bond_option_all_slaves_active_set(struct bonding *bond,
struct bond_opt_value *newval);
static int bond_option_min_links_set(struct bonding *bond,
struct bond_opt_value *newval);
static int bond_option_lp_interval_set(struct bonding *bond,
struct bond_opt_value *newval);
static int bond_option_pps_set(struct bonding *bond,
struct bond_opt_value *newval);
static int bond_option_lacp_rate_set(struct bonding *bond,
struct bond_opt_value *newval);
static int bond_option_ad_select_set(struct bonding *bond,
struct bond_opt_value *newval);
static int bond_option_queue_id_set(struct bonding *bond,
struct bond_opt_value *newval);
static int bond_option_mode_set(struct bonding *bond,
struct bond_opt_value *newval);
static int bond_option_slaves_set(struct bonding *bond,
struct bond_opt_value *newval);
static const struct bond_opt_value bond_mode_tbl[] = {
{ "balance-rr", BOND_MODE_ROUNDROBIN, BOND_VALFLAG_DEFAULT}, { "balance-rr", BOND_MODE_ROUNDROBIN, BOND_VALFLAG_DEFAULT},
{ "active-backup", BOND_MODE_ACTIVEBACKUP, 0}, { "active-backup", BOND_MODE_ACTIVEBACKUP, 0},
{ "balance-xor", BOND_MODE_XOR, 0}, { "balance-xor", BOND_MODE_XOR, 0},
...@@ -31,13 +83,13 @@ static struct bond_opt_value bond_mode_tbl[] = { ...@@ -31,13 +83,13 @@ static struct bond_opt_value bond_mode_tbl[] = {
{ NULL, -1, 0}, { NULL, -1, 0},
}; };
static struct bond_opt_value bond_pps_tbl[] = { static const struct bond_opt_value bond_pps_tbl[] = {
{ "default", 1, BOND_VALFLAG_DEFAULT}, { "default", 1, BOND_VALFLAG_DEFAULT},
{ "maxval", USHRT_MAX, BOND_VALFLAG_MAX}, { "maxval", USHRT_MAX, BOND_VALFLAG_MAX},
{ NULL, -1, 0}, { NULL, -1, 0},
}; };
static struct bond_opt_value bond_xmit_hashtype_tbl[] = { static const struct bond_opt_value bond_xmit_hashtype_tbl[] = {
{ "layer2", BOND_XMIT_POLICY_LAYER2, BOND_VALFLAG_DEFAULT}, { "layer2", BOND_XMIT_POLICY_LAYER2, BOND_VALFLAG_DEFAULT},
{ "layer3+4", BOND_XMIT_POLICY_LAYER34, 0}, { "layer3+4", BOND_XMIT_POLICY_LAYER34, 0},
{ "layer2+3", BOND_XMIT_POLICY_LAYER23, 0}, { "layer2+3", BOND_XMIT_POLICY_LAYER23, 0},
...@@ -46,7 +98,7 @@ static struct bond_opt_value bond_xmit_hashtype_tbl[] = { ...@@ -46,7 +98,7 @@ static struct bond_opt_value bond_xmit_hashtype_tbl[] = {
{ NULL, -1, 0}, { NULL, -1, 0},
}; };
static struct bond_opt_value bond_arp_validate_tbl[] = { static const struct bond_opt_value bond_arp_validate_tbl[] = {
{ "none", BOND_ARP_VALIDATE_NONE, BOND_VALFLAG_DEFAULT}, { "none", BOND_ARP_VALIDATE_NONE, BOND_VALFLAG_DEFAULT},
{ "active", BOND_ARP_VALIDATE_ACTIVE, 0}, { "active", BOND_ARP_VALIDATE_ACTIVE, 0},
{ "backup", BOND_ARP_VALIDATE_BACKUP, 0}, { "backup", BOND_ARP_VALIDATE_BACKUP, 0},
...@@ -57,76 +109,76 @@ static struct bond_opt_value bond_arp_validate_tbl[] = { ...@@ -57,76 +109,76 @@ static struct bond_opt_value bond_arp_validate_tbl[] = {
{ NULL, -1, 0}, { NULL, -1, 0},
}; };
static struct bond_opt_value bond_arp_all_targets_tbl[] = { static const struct bond_opt_value bond_arp_all_targets_tbl[] = {
{ "any", BOND_ARP_TARGETS_ANY, BOND_VALFLAG_DEFAULT}, { "any", BOND_ARP_TARGETS_ANY, BOND_VALFLAG_DEFAULT},
{ "all", BOND_ARP_TARGETS_ALL, 0}, { "all", BOND_ARP_TARGETS_ALL, 0},
{ NULL, -1, 0}, { NULL, -1, 0},
}; };
static struct bond_opt_value bond_fail_over_mac_tbl[] = { static const struct bond_opt_value bond_fail_over_mac_tbl[] = {
{ "none", BOND_FOM_NONE, BOND_VALFLAG_DEFAULT}, { "none", BOND_FOM_NONE, BOND_VALFLAG_DEFAULT},
{ "active", BOND_FOM_ACTIVE, 0}, { "active", BOND_FOM_ACTIVE, 0},
{ "follow", BOND_FOM_FOLLOW, 0}, { "follow", BOND_FOM_FOLLOW, 0},
{ NULL, -1, 0}, { NULL, -1, 0},
}; };
static struct bond_opt_value bond_intmax_tbl[] = { static const struct bond_opt_value bond_intmax_tbl[] = {
{ "off", 0, BOND_VALFLAG_DEFAULT}, { "off", 0, BOND_VALFLAG_DEFAULT},
{ "maxval", INT_MAX, BOND_VALFLAG_MAX}, { "maxval", INT_MAX, BOND_VALFLAG_MAX},
}; };
static struct bond_opt_value bond_lacp_rate_tbl[] = { static const struct bond_opt_value bond_lacp_rate_tbl[] = {
{ "slow", AD_LACP_SLOW, 0}, { "slow", AD_LACP_SLOW, 0},
{ "fast", AD_LACP_FAST, 0}, { "fast", AD_LACP_FAST, 0},
{ NULL, -1, 0}, { NULL, -1, 0},
}; };
static struct bond_opt_value bond_ad_select_tbl[] = { static const struct bond_opt_value bond_ad_select_tbl[] = {
{ "stable", BOND_AD_STABLE, BOND_VALFLAG_DEFAULT}, { "stable", BOND_AD_STABLE, BOND_VALFLAG_DEFAULT},
{ "bandwidth", BOND_AD_BANDWIDTH, 0}, { "bandwidth", BOND_AD_BANDWIDTH, 0},
{ "count", BOND_AD_COUNT, 0}, { "count", BOND_AD_COUNT, 0},
{ NULL, -1, 0}, { NULL, -1, 0},
}; };
static struct bond_opt_value bond_num_peer_notif_tbl[] = { static const struct bond_opt_value bond_num_peer_notif_tbl[] = {
{ "off", 0, 0}, { "off", 0, 0},
{ "maxval", 255, BOND_VALFLAG_MAX}, { "maxval", 255, BOND_VALFLAG_MAX},
{ "default", 1, BOND_VALFLAG_DEFAULT}, { "default", 1, BOND_VALFLAG_DEFAULT},
{ NULL, -1, 0} { NULL, -1, 0}
}; };
static struct bond_opt_value bond_primary_reselect_tbl[] = { static const struct bond_opt_value bond_primary_reselect_tbl[] = {
{ "always", BOND_PRI_RESELECT_ALWAYS, BOND_VALFLAG_DEFAULT}, { "always", BOND_PRI_RESELECT_ALWAYS, BOND_VALFLAG_DEFAULT},
{ "better", BOND_PRI_RESELECT_BETTER, 0}, { "better", BOND_PRI_RESELECT_BETTER, 0},
{ "failure", BOND_PRI_RESELECT_FAILURE, 0}, { "failure", BOND_PRI_RESELECT_FAILURE, 0},
{ NULL, -1}, { NULL, -1},
}; };
static struct bond_opt_value bond_use_carrier_tbl[] = { static const struct bond_opt_value bond_use_carrier_tbl[] = {
{ "off", 0, 0}, { "off", 0, 0},
{ "on", 1, BOND_VALFLAG_DEFAULT}, { "on", 1, BOND_VALFLAG_DEFAULT},
{ NULL, -1, 0} { NULL, -1, 0}
}; };
static struct bond_opt_value bond_all_slaves_active_tbl[] = { static const struct bond_opt_value bond_all_slaves_active_tbl[] = {
{ "off", 0, BOND_VALFLAG_DEFAULT}, { "off", 0, BOND_VALFLAG_DEFAULT},
{ "on", 1, 0}, { "on", 1, 0},
{ NULL, -1, 0} { NULL, -1, 0}
}; };
static struct bond_opt_value bond_resend_igmp_tbl[] = { static const struct bond_opt_value bond_resend_igmp_tbl[] = {
{ "off", 0, 0}, { "off", 0, 0},
{ "maxval", 255, BOND_VALFLAG_MAX}, { "maxval", 255, BOND_VALFLAG_MAX},
{ "default", 1, BOND_VALFLAG_DEFAULT}, { "default", 1, BOND_VALFLAG_DEFAULT},
{ NULL, -1, 0} { NULL, -1, 0}
}; };
static struct bond_opt_value bond_lp_interval_tbl[] = { static const struct bond_opt_value bond_lp_interval_tbl[] = {
{ "minval", 1, BOND_VALFLAG_MIN | BOND_VALFLAG_DEFAULT}, { "minval", 1, BOND_VALFLAG_MIN | BOND_VALFLAG_DEFAULT},
{ "maxval", INT_MAX, BOND_VALFLAG_MAX}, { "maxval", INT_MAX, BOND_VALFLAG_MAX},
}; };
static struct bond_option bond_opts[] = { static const struct bond_option bond_opts[] = {
[BOND_OPT_MODE] = { [BOND_OPT_MODE] = {
.id = BOND_OPT_MODE, .id = BOND_OPT_MODE,
.name = "mode", .name = "mode",
...@@ -315,9 +367,9 @@ static struct bond_option bond_opts[] = { ...@@ -315,9 +367,9 @@ static struct bond_option bond_opts[] = {
}; };
/* Searches for a value in opt's values[] table */ /* Searches for a value in opt's values[] table */
struct bond_opt_value *bond_opt_get_val(unsigned int option, u64 val) const struct bond_opt_value *bond_opt_get_val(unsigned int option, u64 val)
{ {
struct bond_option *opt; const struct bond_option *opt;
int i; int i;
opt = bond_opt_get(option); opt = bond_opt_get(option);
...@@ -331,7 +383,7 @@ struct bond_opt_value *bond_opt_get_val(unsigned int option, u64 val) ...@@ -331,7 +383,7 @@ struct bond_opt_value *bond_opt_get_val(unsigned int option, u64 val)
} }
/* Searches for a value in opt's values[] table which matches the flagmask */ /* Searches for a value in opt's values[] table which matches the flagmask */
static struct bond_opt_value *bond_opt_get_flags(const struct bond_option *opt, static const struct bond_opt_value *bond_opt_get_flags(const struct bond_option *opt,
u32 flagmask) u32 flagmask)
{ {
int i; int i;
...@@ -348,7 +400,7 @@ static struct bond_opt_value *bond_opt_get_flags(const struct bond_option *opt, ...@@ -348,7 +400,7 @@ static struct bond_opt_value *bond_opt_get_flags(const struct bond_option *opt,
*/ */
static bool bond_opt_check_range(const struct bond_option *opt, u64 val) static bool bond_opt_check_range(const struct bond_option *opt, u64 val)
{ {
struct bond_opt_value *minval, *maxval; const struct bond_opt_value *minval, *maxval;
minval = bond_opt_get_flags(opt, BOND_VALFLAG_MIN); minval = bond_opt_get_flags(opt, BOND_VALFLAG_MIN);
maxval = bond_opt_get_flags(opt, BOND_VALFLAG_MAX); maxval = bond_opt_get_flags(opt, BOND_VALFLAG_MAX);
...@@ -368,11 +420,12 @@ static bool bond_opt_check_range(const struct bond_option *opt, u64 val) ...@@ -368,11 +420,12 @@ static bool bond_opt_check_range(const struct bond_option *opt, u64 val)
* or the struct_opt_value that matched. It also strips the new line from * or the struct_opt_value that matched. It also strips the new line from
* @val->string if it's present. * @val->string if it's present.
*/ */
struct bond_opt_value *bond_opt_parse(const struct bond_option *opt, const struct bond_opt_value *bond_opt_parse(const struct bond_option *opt,
struct bond_opt_value *val) struct bond_opt_value *val)
{ {
char *p, valstr[BOND_OPT_MAX_NAMELEN + 1] = { 0, }; char *p, valstr[BOND_OPT_MAX_NAMELEN + 1] = { 0, };
struct bond_opt_value *tbl, *ret = NULL; const struct bond_opt_value *tbl;
const struct bond_opt_value *ret = NULL;
bool checkval; bool checkval;
int i, rv; int i, rv;
...@@ -576,7 +629,7 @@ int bond_opt_tryset_rtnl(struct bonding *bond, unsigned int option, char *buf) ...@@ -576,7 +629,7 @@ int bond_opt_tryset_rtnl(struct bonding *bond, unsigned int option, char *buf)
* This function checks if option is valid and if so returns a pointer * This function checks if option is valid and if so returns a pointer
* to its entry in the bond_opts[] option array. * to its entry in the bond_opts[] option array.
*/ */
struct bond_option *bond_opt_get(unsigned int option) const struct bond_option *bond_opt_get(unsigned int option)
{ {
if (!BOND_OPT_VALID(option)) if (!BOND_OPT_VALID(option))
return NULL; return NULL;
...@@ -622,7 +675,7 @@ struct net_device *bond_option_active_slave_get(struct bonding *bond) ...@@ -622,7 +675,7 @@ struct net_device *bond_option_active_slave_get(struct bonding *bond)
return __bond_option_active_slave_get(bond, bond->curr_active_slave); return __bond_option_active_slave_get(bond, bond->curr_active_slave);
} }
int bond_option_active_slave_set(struct bonding *bond, static int bond_option_active_slave_set(struct bonding *bond,
struct bond_opt_value *newval) struct bond_opt_value *newval)
{ {
char ifname[IFNAMSIZ] = { 0, }; char ifname[IFNAMSIZ] = { 0, };
...@@ -691,7 +744,8 @@ int bond_option_active_slave_set(struct bonding *bond, ...@@ -691,7 +744,8 @@ int bond_option_active_slave_set(struct bonding *bond,
return ret; return ret;
} }
int bond_option_miimon_set(struct bonding *bond, struct bond_opt_value *newval) static int bond_option_miimon_set(struct bonding *bond,
struct bond_opt_value *newval)
{ {
pr_info("%s: Setting MII monitoring interval to %llu\n", pr_info("%s: Setting MII monitoring interval to %llu\n",
bond->dev->name, newval->value); bond->dev->name, newval->value);
...@@ -728,7 +782,8 @@ int bond_option_miimon_set(struct bonding *bond, struct bond_opt_value *newval) ...@@ -728,7 +782,8 @@ int bond_option_miimon_set(struct bonding *bond, struct bond_opt_value *newval)
return 0; return 0;
} }
int bond_option_updelay_set(struct bonding *bond, struct bond_opt_value *newval) static int bond_option_updelay_set(struct bonding *bond,
struct bond_opt_value *newval)
{ {
int value = newval->value; int value = newval->value;
...@@ -751,7 +806,7 @@ int bond_option_updelay_set(struct bonding *bond, struct bond_opt_value *newval) ...@@ -751,7 +806,7 @@ int bond_option_updelay_set(struct bonding *bond, struct bond_opt_value *newval)
return 0; return 0;
} }
int bond_option_downdelay_set(struct bonding *bond, static int bond_option_downdelay_set(struct bonding *bond,
struct bond_opt_value *newval) struct bond_opt_value *newval)
{ {
int value = newval->value; int value = newval->value;
...@@ -775,7 +830,7 @@ int bond_option_downdelay_set(struct bonding *bond, ...@@ -775,7 +830,7 @@ int bond_option_downdelay_set(struct bonding *bond,
return 0; return 0;
} }
int bond_option_use_carrier_set(struct bonding *bond, static int bond_option_use_carrier_set(struct bonding *bond,
struct bond_opt_value *newval) struct bond_opt_value *newval)
{ {
pr_info("%s: Setting use_carrier to %llu\n", pr_info("%s: Setting use_carrier to %llu\n",
...@@ -785,7 +840,7 @@ int bond_option_use_carrier_set(struct bonding *bond, ...@@ -785,7 +840,7 @@ int bond_option_use_carrier_set(struct bonding *bond,
return 0; return 0;
} }
int bond_option_arp_interval_set(struct bonding *bond, static int bond_option_arp_interval_set(struct bonding *bond,
struct bond_opt_value *newval) struct bond_opt_value *newval)
{ {
pr_info("%s: Setting ARP monitoring interval to %llu\n", pr_info("%s: Setting ARP monitoring interval to %llu\n",
...@@ -867,7 +922,7 @@ static int _bond_option_arp_ip_target_add(struct bonding *bond, __be32 target) ...@@ -867,7 +922,7 @@ static int _bond_option_arp_ip_target_add(struct bonding *bond, __be32 target)
return 0; return 0;
} }
int bond_option_arp_ip_target_add(struct bonding *bond, __be32 target) static int bond_option_arp_ip_target_add(struct bonding *bond, __be32 target)
{ {
int ret; int ret;
...@@ -879,7 +934,7 @@ int bond_option_arp_ip_target_add(struct bonding *bond, __be32 target) ...@@ -879,7 +934,7 @@ int bond_option_arp_ip_target_add(struct bonding *bond, __be32 target)
return ret; return ret;
} }
int bond_option_arp_ip_target_rem(struct bonding *bond, __be32 target) static int bond_option_arp_ip_target_rem(struct bonding *bond, __be32 target)
{ {
__be32 *targets = bond->params.arp_targets; __be32 *targets = bond->params.arp_targets;
struct list_head *iter; struct list_head *iter;
...@@ -935,7 +990,7 @@ void bond_option_arp_ip_targets_clear(struct bonding *bond) ...@@ -935,7 +990,7 @@ void bond_option_arp_ip_targets_clear(struct bonding *bond)
write_unlock_bh(&bond->lock); write_unlock_bh(&bond->lock);
} }
int bond_option_arp_ip_targets_set(struct bonding *bond, static int bond_option_arp_ip_targets_set(struct bonding *bond,
struct bond_opt_value *newval) struct bond_opt_value *newval)
{ {
int ret = -EPERM; int ret = -EPERM;
...@@ -962,7 +1017,7 @@ int bond_option_arp_ip_targets_set(struct bonding *bond, ...@@ -962,7 +1017,7 @@ int bond_option_arp_ip_targets_set(struct bonding *bond,
return ret; return ret;
} }
int bond_option_arp_validate_set(struct bonding *bond, static int bond_option_arp_validate_set(struct bonding *bond,
struct bond_opt_value *newval) struct bond_opt_value *newval)
{ {
pr_info("%s: Setting arp_validate to %s (%llu)\n", pr_info("%s: Setting arp_validate to %s (%llu)\n",
...@@ -979,7 +1034,7 @@ int bond_option_arp_validate_set(struct bonding *bond, ...@@ -979,7 +1034,7 @@ int bond_option_arp_validate_set(struct bonding *bond,
return 0; return 0;
} }
int bond_option_arp_all_targets_set(struct bonding *bond, static int bond_option_arp_all_targets_set(struct bonding *bond,
struct bond_opt_value *newval) struct bond_opt_value *newval)
{ {
pr_info("%s: Setting arp_all_targets to %s (%llu)\n", pr_info("%s: Setting arp_all_targets to %s (%llu)\n",
...@@ -989,7 +1044,8 @@ int bond_option_arp_all_targets_set(struct bonding *bond, ...@@ -989,7 +1044,8 @@ int bond_option_arp_all_targets_set(struct bonding *bond,
return 0; return 0;
} }
int bond_option_primary_set(struct bonding *bond, struct bond_opt_value *newval) static int bond_option_primary_set(struct bonding *bond,
struct bond_opt_value *newval)
{ {
char *p, *primary = newval->string; char *p, *primary = newval->string;
struct list_head *iter; struct list_head *iter;
...@@ -1041,7 +1097,7 @@ int bond_option_primary_set(struct bonding *bond, struct bond_opt_value *newval) ...@@ -1041,7 +1097,7 @@ int bond_option_primary_set(struct bonding *bond, struct bond_opt_value *newval)
return 0; return 0;
} }
int bond_option_primary_reselect_set(struct bonding *bond, static int bond_option_primary_reselect_set(struct bonding *bond,
struct bond_opt_value *newval) struct bond_opt_value *newval)
{ {
pr_info("%s: Setting primary_reselect to %s (%llu)\n", pr_info("%s: Setting primary_reselect to %s (%llu)\n",
...@@ -1057,7 +1113,7 @@ int bond_option_primary_reselect_set(struct bonding *bond, ...@@ -1057,7 +1113,7 @@ int bond_option_primary_reselect_set(struct bonding *bond,
return 0; return 0;
} }
int bond_option_fail_over_mac_set(struct bonding *bond, static int bond_option_fail_over_mac_set(struct bonding *bond,
struct bond_opt_value *newval) struct bond_opt_value *newval)
{ {
pr_info("%s: Setting fail_over_mac to %s (%llu)\n", pr_info("%s: Setting fail_over_mac to %s (%llu)\n",
...@@ -1067,7 +1123,7 @@ int bond_option_fail_over_mac_set(struct bonding *bond, ...@@ -1067,7 +1123,7 @@ int bond_option_fail_over_mac_set(struct bonding *bond,
return 0; return 0;
} }
int bond_option_xmit_hash_policy_set(struct bonding *bond, static int bond_option_xmit_hash_policy_set(struct bonding *bond,
struct bond_opt_value *newval) struct bond_opt_value *newval)
{ {
pr_info("%s: Setting xmit hash policy to %s (%llu)\n", pr_info("%s: Setting xmit hash policy to %s (%llu)\n",
...@@ -1077,7 +1133,7 @@ int bond_option_xmit_hash_policy_set(struct bonding *bond, ...@@ -1077,7 +1133,7 @@ int bond_option_xmit_hash_policy_set(struct bonding *bond,
return 0; return 0;
} }
int bond_option_resend_igmp_set(struct bonding *bond, static int bond_option_resend_igmp_set(struct bonding *bond,
struct bond_opt_value *newval) struct bond_opt_value *newval)
{ {
pr_info("%s: Setting resend_igmp to %llu\n", pr_info("%s: Setting resend_igmp to %llu\n",
...@@ -1087,7 +1143,7 @@ int bond_option_resend_igmp_set(struct bonding *bond, ...@@ -1087,7 +1143,7 @@ int bond_option_resend_igmp_set(struct bonding *bond,
return 0; return 0;
} }
int bond_option_num_peer_notif_set(struct bonding *bond, static int bond_option_num_peer_notif_set(struct bonding *bond,
struct bond_opt_value *newval) struct bond_opt_value *newval)
{ {
bond->params.num_peer_notif = newval->value; bond->params.num_peer_notif = newval->value;
...@@ -1095,7 +1151,7 @@ int bond_option_num_peer_notif_set(struct bonding *bond, ...@@ -1095,7 +1151,7 @@ int bond_option_num_peer_notif_set(struct bonding *bond,
return 0; return 0;
} }
int bond_option_all_slaves_active_set(struct bonding *bond, static int bond_option_all_slaves_active_set(struct bonding *bond,
struct bond_opt_value *newval) struct bond_opt_value *newval)
{ {
struct list_head *iter; struct list_head *iter;
...@@ -1116,7 +1172,7 @@ int bond_option_all_slaves_active_set(struct bonding *bond, ...@@ -1116,7 +1172,7 @@ int bond_option_all_slaves_active_set(struct bonding *bond,
return 0; return 0;
} }
int bond_option_min_links_set(struct bonding *bond, static int bond_option_min_links_set(struct bonding *bond,
struct bond_opt_value *newval) struct bond_opt_value *newval)
{ {
pr_info("%s: Setting min links value to %llu\n", pr_info("%s: Setting min links value to %llu\n",
...@@ -1126,7 +1182,7 @@ int bond_option_min_links_set(struct bonding *bond, ...@@ -1126,7 +1182,7 @@ int bond_option_min_links_set(struct bonding *bond,
return 0; return 0;
} }
int bond_option_lp_interval_set(struct bonding *bond, static int bond_option_lp_interval_set(struct bonding *bond,
struct bond_opt_value *newval) struct bond_opt_value *newval)
{ {
bond->params.lp_interval = newval->value; bond->params.lp_interval = newval->value;
...@@ -1134,7 +1190,8 @@ int bond_option_lp_interval_set(struct bonding *bond, ...@@ -1134,7 +1190,8 @@ int bond_option_lp_interval_set(struct bonding *bond,
return 0; return 0;
} }
int bond_option_pps_set(struct bonding *bond, struct bond_opt_value *newval) static int bond_option_pps_set(struct bonding *bond,
struct bond_opt_value *newval)
{ {
bond->params.packets_per_slave = newval->value; bond->params.packets_per_slave = newval->value;
if (newval->value > 0) { if (newval->value > 0) {
...@@ -1151,7 +1208,7 @@ int bond_option_pps_set(struct bonding *bond, struct bond_opt_value *newval) ...@@ -1151,7 +1208,7 @@ int bond_option_pps_set(struct bonding *bond, struct bond_opt_value *newval)
return 0; return 0;
} }
int bond_option_lacp_rate_set(struct bonding *bond, static int bond_option_lacp_rate_set(struct bonding *bond,
struct bond_opt_value *newval) struct bond_opt_value *newval)
{ {
pr_info("%s: Setting LACP rate to %s (%llu)\n", pr_info("%s: Setting LACP rate to %s (%llu)\n",
...@@ -1162,7 +1219,7 @@ int bond_option_lacp_rate_set(struct bonding *bond, ...@@ -1162,7 +1219,7 @@ int bond_option_lacp_rate_set(struct bonding *bond,
return 0; return 0;
} }
int bond_option_ad_select_set(struct bonding *bond, static int bond_option_ad_select_set(struct bonding *bond,
struct bond_opt_value *newval) struct bond_opt_value *newval)
{ {
pr_info("%s: Setting ad_select to %s (%llu)\n", pr_info("%s: Setting ad_select to %s (%llu)\n",
...@@ -1172,7 +1229,7 @@ int bond_option_ad_select_set(struct bonding *bond, ...@@ -1172,7 +1229,7 @@ int bond_option_ad_select_set(struct bonding *bond,
return 0; return 0;
} }
int bond_option_queue_id_set(struct bonding *bond, static int bond_option_queue_id_set(struct bonding *bond,
struct bond_opt_value *newval) struct bond_opt_value *newval)
{ {
struct slave *slave, *update_slave; struct slave *slave, *update_slave;
...@@ -1233,7 +1290,8 @@ int bond_option_queue_id_set(struct bonding *bond, ...@@ -1233,7 +1290,8 @@ int bond_option_queue_id_set(struct bonding *bond,
} }
int bond_option_slaves_set(struct bonding *bond, struct bond_opt_value *newval) static int bond_option_slaves_set(struct bonding *bond,
struct bond_opt_value *newval)
{ {
char command[IFNAMSIZ + 1] = { 0, }; char command[IFNAMSIZ + 1] = { 0, };
struct net_device *dev; struct net_device *dev;
......
...@@ -81,8 +81,8 @@ struct bonding; ...@@ -81,8 +81,8 @@ struct bonding;
struct bond_option { struct bond_option {
int id; int id;
char *name; const char *name;
char *desc; const char *desc;
u32 flags; u32 flags;
/* unsuppmodes is used to denote modes in which the option isn't /* unsuppmodes is used to denote modes in which the option isn't
...@@ -92,7 +92,7 @@ struct bond_option { ...@@ -92,7 +92,7 @@ struct bond_option {
/* supported values which this option can have, can be a subset of /* supported values which this option can have, can be a subset of
* BOND_OPTVAL_RANGE's value range * BOND_OPTVAL_RANGE's value range
*/ */
struct bond_opt_value *values; const struct bond_opt_value *values;
int (*set)(struct bonding *bond, struct bond_opt_value *val); int (*set)(struct bonding *bond, struct bond_opt_value *val);
}; };
...@@ -100,10 +100,10 @@ struct bond_option { ...@@ -100,10 +100,10 @@ struct bond_option {
int __bond_opt_set(struct bonding *bond, unsigned int option, int __bond_opt_set(struct bonding *bond, unsigned int option,
struct bond_opt_value *val); struct bond_opt_value *val);
int bond_opt_tryset_rtnl(struct bonding *bond, unsigned int option, char *buf); int bond_opt_tryset_rtnl(struct bonding *bond, unsigned int option, char *buf);
struct bond_opt_value *bond_opt_parse(const struct bond_option *opt, const struct bond_opt_value *bond_opt_parse(const struct bond_option *opt,
struct bond_opt_value *val); struct bond_opt_value *val);
struct bond_option *bond_opt_get(unsigned int option); const struct bond_option *bond_opt_get(unsigned int option);
struct bond_opt_value *bond_opt_get_val(unsigned int option, u64 val); const struct bond_opt_value *bond_opt_get_val(unsigned int option, u64 val);
/* This helper is used to initialize a bond_opt_value structure for parameter /* This helper is used to initialize a bond_opt_value structure for parameter
* passing. There should be either a valid string or value, but not both. * passing. There should be either a valid string or value, but not both.
...@@ -122,49 +122,6 @@ static inline void __bond_opt_init(struct bond_opt_value *optval, ...@@ -122,49 +122,6 @@ static inline void __bond_opt_init(struct bond_opt_value *optval,
#define bond_opt_initval(optval, value) __bond_opt_init(optval, NULL, value) #define bond_opt_initval(optval, value) __bond_opt_init(optval, NULL, value)
#define bond_opt_initstr(optval, str) __bond_opt_init(optval, str, ULLONG_MAX) #define bond_opt_initstr(optval, str) __bond_opt_init(optval, str, ULLONG_MAX)
int bond_option_mode_set(struct bonding *bond, struct bond_opt_value *newval);
int bond_option_pps_set(struct bonding *bond, struct bond_opt_value *newval);
int bond_option_xmit_hash_policy_set(struct bonding *bond,
struct bond_opt_value *newval);
int bond_option_arp_validate_set(struct bonding *bond,
struct bond_opt_value *newval);
int bond_option_arp_all_targets_set(struct bonding *bond,
struct bond_opt_value *newval);
int bond_option_fail_over_mac_set(struct bonding *bond,
struct bond_opt_value *newval);
int bond_option_arp_interval_set(struct bonding *bond,
struct bond_opt_value *newval);
int bond_option_arp_ip_targets_set(struct bonding *bond,
struct bond_opt_value *newval);
void bond_option_arp_ip_targets_clear(struct bonding *bond); void bond_option_arp_ip_targets_clear(struct bonding *bond);
int bond_option_downdelay_set(struct bonding *bond,
struct bond_opt_value *newval);
int bond_option_updelay_set(struct bonding *bond,
struct bond_opt_value *newval);
int bond_option_lacp_rate_set(struct bonding *bond,
struct bond_opt_value *newval);
int bond_option_min_links_set(struct bonding *bond,
struct bond_opt_value *newval);
int bond_option_ad_select_set(struct bonding *bond,
struct bond_opt_value *newval);
int bond_option_num_peer_notif_set(struct bonding *bond,
struct bond_opt_value *newval);
int bond_option_miimon_set(struct bonding *bond, struct bond_opt_value *newval);
int bond_option_primary_set(struct bonding *bond,
struct bond_opt_value *newval);
int bond_option_primary_reselect_set(struct bonding *bond,
struct bond_opt_value *newval);
int bond_option_use_carrier_set(struct bonding *bond,
struct bond_opt_value *newval);
int bond_option_active_slave_set(struct bonding *bond,
struct bond_opt_value *newval);
int bond_option_queue_id_set(struct bonding *bond,
struct bond_opt_value *newval);
int bond_option_all_slaves_active_set(struct bonding *bond,
struct bond_opt_value *newval);
int bond_option_resend_igmp_set(struct bonding *bond,
struct bond_opt_value *newval);
int bond_option_lp_interval_set(struct bonding *bond,
struct bond_opt_value *newval);
int bond_option_slaves_set(struct bonding *bond, struct bond_opt_value *newval);
#endif /* _BOND_OPTIONS_H */ #endif /* _BOND_OPTIONS_H */
...@@ -220,7 +220,7 @@ static ssize_t bonding_show_mode(struct device *d, ...@@ -220,7 +220,7 @@ static ssize_t bonding_show_mode(struct device *d,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct bonding *bond = to_bond(d); struct bonding *bond = to_bond(d);
struct bond_opt_value *val; const struct bond_opt_value *val;
val = bond_opt_get_val(BOND_OPT_MODE, bond->params.mode); val = bond_opt_get_val(BOND_OPT_MODE, bond->params.mode);
...@@ -251,7 +251,7 @@ static ssize_t bonding_show_xmit_hash(struct device *d, ...@@ -251,7 +251,7 @@ static ssize_t bonding_show_xmit_hash(struct device *d,
char *buf) char *buf)
{ {
struct bonding *bond = to_bond(d); struct bonding *bond = to_bond(d);
struct bond_opt_value *val; const struct bond_opt_value *val;
val = bond_opt_get_val(BOND_OPT_XMIT_HASH, bond->params.xmit_policy); val = bond_opt_get_val(BOND_OPT_XMIT_HASH, bond->params.xmit_policy);
...@@ -282,7 +282,7 @@ static ssize_t bonding_show_arp_validate(struct device *d, ...@@ -282,7 +282,7 @@ static ssize_t bonding_show_arp_validate(struct device *d,
char *buf) char *buf)
{ {
struct bonding *bond = to_bond(d); struct bonding *bond = to_bond(d);
struct bond_opt_value *val; const struct bond_opt_value *val;
val = bond_opt_get_val(BOND_OPT_ARP_VALIDATE, val = bond_opt_get_val(BOND_OPT_ARP_VALIDATE,
bond->params.arp_validate); bond->params.arp_validate);
...@@ -314,7 +314,7 @@ static ssize_t bonding_show_arp_all_targets(struct device *d, ...@@ -314,7 +314,7 @@ static ssize_t bonding_show_arp_all_targets(struct device *d,
char *buf) char *buf)
{ {
struct bonding *bond = to_bond(d); struct bonding *bond = to_bond(d);
struct bond_opt_value *val; const struct bond_opt_value *val;
val = bond_opt_get_val(BOND_OPT_ARP_ALL_TARGETS, val = bond_opt_get_val(BOND_OPT_ARP_ALL_TARGETS,
bond->params.arp_all_targets); bond->params.arp_all_targets);
...@@ -348,7 +348,7 @@ static ssize_t bonding_show_fail_over_mac(struct device *d, ...@@ -348,7 +348,7 @@ static ssize_t bonding_show_fail_over_mac(struct device *d,
char *buf) char *buf)
{ {
struct bonding *bond = to_bond(d); struct bonding *bond = to_bond(d);
struct bond_opt_value *val; const struct bond_opt_value *val;
val = bond_opt_get_val(BOND_OPT_FAIL_OVER_MAC, val = bond_opt_get_val(BOND_OPT_FAIL_OVER_MAC,
bond->params.fail_over_mac); bond->params.fail_over_mac);
...@@ -505,7 +505,7 @@ static ssize_t bonding_show_lacp(struct device *d, ...@@ -505,7 +505,7 @@ static ssize_t bonding_show_lacp(struct device *d,
char *buf) char *buf)
{ {
struct bonding *bond = to_bond(d); struct bonding *bond = to_bond(d);
struct bond_opt_value *val; const struct bond_opt_value *val;
val = bond_opt_get_val(BOND_OPT_LACP_RATE, bond->params.lacp_fast); val = bond_opt_get_val(BOND_OPT_LACP_RATE, bond->params.lacp_fast);
...@@ -558,7 +558,7 @@ static ssize_t bonding_show_ad_select(struct device *d, ...@@ -558,7 +558,7 @@ static ssize_t bonding_show_ad_select(struct device *d,
char *buf) char *buf)
{ {
struct bonding *bond = to_bond(d); struct bonding *bond = to_bond(d);
struct bond_opt_value *val; const struct bond_opt_value *val;
val = bond_opt_get_val(BOND_OPT_AD_SELECT, bond->params.ad_select); val = bond_opt_get_val(BOND_OPT_AD_SELECT, bond->params.ad_select);
...@@ -686,7 +686,7 @@ static ssize_t bonding_show_primary_reselect(struct device *d, ...@@ -686,7 +686,7 @@ static ssize_t bonding_show_primary_reselect(struct device *d,
char *buf) char *buf)
{ {
struct bonding *bond = to_bond(d); struct bonding *bond = to_bond(d);
struct bond_opt_value *val; const struct bond_opt_value *val;
val = bond_opt_get_val(BOND_OPT_PRIMARY_RESELECT, val = bond_opt_get_val(BOND_OPT_PRIMARY_RESELECT,
bond->params.primary_reselect); bond->params.primary_reselect);
......
...@@ -507,8 +507,6 @@ void bond_setup(struct net_device *bond_dev); ...@@ -507,8 +507,6 @@ void bond_setup(struct net_device *bond_dev);
unsigned int bond_get_num_tx_queues(void); unsigned int bond_get_num_tx_queues(void);
int bond_netlink_init(void); int bond_netlink_init(void);
void bond_netlink_fini(void); void bond_netlink_fini(void);
int bond_option_arp_ip_target_add(struct bonding *bond, __be32 target);
int bond_option_arp_ip_target_rem(struct bonding *bond, __be32 target);
struct net_device *bond_option_active_slave_get_rcu(struct bonding *bond); struct net_device *bond_option_active_slave_get_rcu(struct bonding *bond);
struct net_device *bond_option_active_slave_get(struct bonding *bond); struct net_device *bond_option_active_slave_get(struct bonding *bond);
const char *bond_slave_link_status(s8 link); const char *bond_slave_link_status(s8 link);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment