diff options
author | dingtianhong <dingtianhong@huawei.com> | 2013-12-21 01:40:12 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-12-31 00:40:31 -0500 |
commit | 3a7129e52766f015f0d4035ac9c7c9408829b9a1 (patch) | |
tree | 3d36accd72b2036e0ac92ac28ce0495493c9544c | |
parent | 24245a1b055df246dc94517c1a8b1fdfe7668da0 (diff) |
bonding: add option lp_interval for loading module
The bond driver could set the lp_interval when loading module.
Suggested-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/bonding/bond_main.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 881fade98919..8c973398fef6 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -113,6 +113,7 @@ static int all_slaves_active; | |||
113 | static struct bond_params bonding_defaults; | 113 | static struct bond_params bonding_defaults; |
114 | static int resend_igmp = BOND_DEFAULT_RESEND_IGMP; | 114 | static int resend_igmp = BOND_DEFAULT_RESEND_IGMP; |
115 | static int packets_per_slave = 1; | 115 | static int packets_per_slave = 1; |
116 | static int lp_interval = BOND_ALB_DEFAULT_LP_INTERVAL; | ||
116 | 117 | ||
117 | module_param(max_bonds, int, 0); | 118 | module_param(max_bonds, int, 0); |
118 | MODULE_PARM_DESC(max_bonds, "Max number of bonded devices"); | 119 | MODULE_PARM_DESC(max_bonds, "Max number of bonded devices"); |
@@ -189,6 +190,10 @@ module_param(packets_per_slave, int, 0); | |||
189 | MODULE_PARM_DESC(packets_per_slave, "Packets to send per slave in balance-rr " | 190 | MODULE_PARM_DESC(packets_per_slave, "Packets to send per slave in balance-rr " |
190 | "mode; 0 for a random slave, 1 packet per " | 191 | "mode; 0 for a random slave, 1 packet per " |
191 | "slave (default), >1 packets per slave."); | 192 | "slave (default), >1 packets per slave."); |
193 | module_param(lp_interval, uint, 0); | ||
194 | MODULE_PARM_DESC(lp_interval, "The number of seconds between instances where " | ||
195 | "the bonding driver sends learning packets to " | ||
196 | "each slaves peer switch. The default is 1."); | ||
192 | 197 | ||
193 | /*----------------------------- Global variables ----------------------------*/ | 198 | /*----------------------------- Global variables ----------------------------*/ |
194 | 199 | ||
@@ -4271,6 +4276,12 @@ static int bond_check_params(struct bond_params *params) | |||
4271 | fail_over_mac_value = BOND_FOM_NONE; | 4276 | fail_over_mac_value = BOND_FOM_NONE; |
4272 | } | 4277 | } |
4273 | 4278 | ||
4279 | if (lp_interval == 0) { | ||
4280 | pr_warning("Warning: ip_interval must be between 1 and %d, so it was reset to %d\n", | ||
4281 | INT_MAX, BOND_ALB_DEFAULT_LP_INTERVAL); | ||
4282 | lp_interval = BOND_ALB_DEFAULT_LP_INTERVAL; | ||
4283 | } | ||
4284 | |||
4274 | /* fill params struct with the proper values */ | 4285 | /* fill params struct with the proper values */ |
4275 | params->mode = bond_mode; | 4286 | params->mode = bond_mode; |
4276 | params->xmit_policy = xmit_hashtype; | 4287 | params->xmit_policy = xmit_hashtype; |
@@ -4290,7 +4301,7 @@ static int bond_check_params(struct bond_params *params) | |||
4290 | params->all_slaves_active = all_slaves_active; | 4301 | params->all_slaves_active = all_slaves_active; |
4291 | params->resend_igmp = resend_igmp; | 4302 | params->resend_igmp = resend_igmp; |
4292 | params->min_links = min_links; | 4303 | params->min_links = min_links; |
4293 | params->lp_interval = BOND_ALB_DEFAULT_LP_INTERVAL; | 4304 | params->lp_interval = lp_interval; |
4294 | if (packets_per_slave > 1) | 4305 | if (packets_per_slave > 1) |
4295 | params->packets_per_slave = reciprocal_value(packets_per_slave); | 4306 | params->packets_per_slave = reciprocal_value(packets_per_slave); |
4296 | else | 4307 | else |