All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 1/3] bonding: add option lp_interval for loading module
@ 2013-12-20  5:10 Ding Tianhong
  2013-12-20 13:42 ` Sergei Shtylyov
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Ding Tianhong @ 2013-12-20  5:10 UTC (permalink / raw)
  To: Jay Vosburgh, Andy Gospodarek, David S. Miller, Veaceslav Falico,
	Netdev

The bond driver could set the lp_interval when loading module.

Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
---
 drivers/net/bonding/bond_main.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index c0456cc..368f7e4 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -113,6 +113,7 @@ static int all_slaves_active;
 static struct bond_params bonding_defaults;
 static int resend_igmp = BOND_DEFAULT_RESEND_IGMP;
 static int packets_per_slave = 1;
+static int lp_interval = BOND_ALB_DEFAULT_LP_INTERVAL;
 
 module_param(max_bonds, int, 0);
 MODULE_PARM_DESC(max_bonds, "Max number of bonded devices");
@@ -189,7 +190,11 @@ module_param(packets_per_slave, int, 0);
 MODULE_PARM_DESC(packets_per_slave, "Packets to send per slave in balance-rr "
 				    "mode; 0 for a random slave, 1 packet per "
 				    "slave (default), >1 packets per slave.");
-
+module_param(lp_interval, uint, 0);
+MODULE_PARM_DESC(lp_interval, "The number of seconds between instances where "
+			      "the bonding driver sends learning packets to "
+			      "each slaves peer switch. The default is 1.");
+	
 /*----------------------------- Global variables ----------------------------*/
 
 #ifdef CONFIG_NET_POLL_CONTROLLER
@@ -4271,6 +4276,12 @@ static int bond_check_params(struct bond_params *params)
 		fail_over_mac_value = BOND_FOM_NONE;
 	}
 
+	if (lp_interval == 0) {
+		pr_warning("Warning: ip_interval must be between 1 and %d, so it was reset to %d\n",
+			INT_MAX, BOND_ALB_DEFAULT_LP_INTERVAL);
+		lp_interval = BOND_ALB_DEFAULT_LP_INTERVAL;
+	}
+
 	/* fill params struct with the proper values */
 	params->mode = bond_mode;
 	params->xmit_policy = xmit_hashtype;
@@ -4290,7 +4301,7 @@ static int bond_check_params(struct bond_params *params)
 	params->all_slaves_active = all_slaves_active;
 	params->resend_igmp = resend_igmp;
 	params->min_links = min_links;
-	params->lp_interval = BOND_ALB_DEFAULT_LP_INTERVAL;
+	params->lp_interval = lp_interval;
 	if (packets_per_slave > 1)
 		params->packets_per_slave = reciprocal_value(packets_per_slave);
 	else
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next 1/3] bonding: add option lp_interval for loading module
  2013-12-20  5:10 [PATCH net-next 1/3] bonding: add option lp_interval for loading module Ding Tianhong
@ 2013-12-20 13:42 ` Sergei Shtylyov
  2013-12-21  6:00   ` Ding Tianhong
  2013-12-21  2:04 ` Scott Feldman
  2013-12-21  2:06 ` Scott Feldman
  2 siblings, 1 reply; 6+ messages in thread
From: Sergei Shtylyov @ 2013-12-20 13:42 UTC (permalink / raw)
  To: Ding Tianhong, Jay Vosburgh, Andy Gospodarek, David S. Miller,
	Veaceslav Falico, Netdev

Hello.

On 20-12-2013 9:10, Ding Tianhong wrote:

> The bond driver could set the lp_interval when loading module.

> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
> ---
>   drivers/net/bonding/bond_main.c | 15 +++++++++++++--
>   1 file changed, 13 insertions(+), 2 deletions(-)

> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index c0456cc..368f7e4 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
[...]
> @@ -4271,6 +4276,12 @@ static int bond_check_params(struct bond_params *params)
>   		fail_over_mac_value = BOND_FOM_NONE;
>   	}
>
> +	if (lp_interval == 0) {
> +		pr_warning("Warning: ip_interval must be between 1 and %d, so it was reset to %d\n",
> +			INT_MAX, BOND_ALB_DEFAULT_LP_INTERVAL);

    The continuation line should be aligned under ", according to the 
networking coding style.

WBR, Sergei

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next 1/3] bonding: add option lp_interval for loading module
  2013-12-20  5:10 [PATCH net-next 1/3] bonding: add option lp_interval for loading module Ding Tianhong
  2013-12-20 13:42 ` Sergei Shtylyov
@ 2013-12-21  2:04 ` Scott Feldman
  2013-12-21  2:06 ` Scott Feldman
  2 siblings, 0 replies; 6+ messages in thread
From: Scott Feldman @ 2013-12-21  2:04 UTC (permalink / raw)
  To: Ding Tianhong
  Cc: Jay Vosburgh, Andy Gospodarek, David S. Miller, Veaceslav Falico,
	Netdev


On Dec 19, 2013, at 9:10 PM, Ding Tianhong <dingtianhong@huawei.com> wrote:

> @@ -4271,6 +4276,12 @@ static int bond_check_params(struct bond_params *params)
> 		fail_over_mac_value = BOND_FOM_NONE;
> 	}
> 
> +	if (lp_interval == 0) {
> +		pr_warning("Warning: ip_interval must be between 1 and %d, so it was reset to %d\n",
> +			INT_MAX, BOND_ALB_DEFAULT_LP_INTERVAL);
> +		lp_interval = BOND_ALB_DEFAULT_LP_INTERVAL;
> +	}
> +

What do you think about using the new bond_option_xxx_set() functions for module parameters also?  The above code, for example, is duplicated in bond_option_lp_interval_set().  This way, we have a unified solution, where option bounds checking, compatibility, warnings, etc happened in one place for all three modes of input: sysfs, netlink, and module params.

-scott

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next 1/3] bonding: add option lp_interval for loading module
  2013-12-20  5:10 [PATCH net-next 1/3] bonding: add option lp_interval for loading module Ding Tianhong
  2013-12-20 13:42 ` Sergei Shtylyov
  2013-12-21  2:04 ` Scott Feldman
@ 2013-12-21  2:06 ` Scott Feldman
  2013-12-21  6:28   ` Ding Tianhong
  2 siblings, 1 reply; 6+ messages in thread
From: Scott Feldman @ 2013-12-21  2:06 UTC (permalink / raw)
  To: Ding Tianhong
  Cc: Jay Vosburgh, Andy Gospodarek, David S. Miller, Veaceslav Falico,
	Netdev


On Dec 19, 2013, at 9:10 PM, Ding Tianhong <dingtianhong@huawei.com> wrote:

> @@ -4271,6 +4276,12 @@ static int bond_check_params(struct bond_params *params)
> 		fail_over_mac_value = BOND_FOM_NONE;
> 	}
> 
> +	if (lp_interval == 0) {
> +		pr_warning("Warning: ip_interval must be between 1 and %d, so it was reset to %d\n",
> +			INT_MAX, BOND_ALB_DEFAULT_LP_INTERVAL);
> +		lp_interval = BOND_ALB_DEFAULT_LP_INTERVAL;
> +	}
> +

[sorry, replied with wrong email]

What do you think about using the new bond_option_xxx_set() functions for module parameters also?  The above code, for example, is duplicated in bond_option_lp_interval_set().  This way, we have a unified solution, where option bounds checking, compatibility, warnings, etc happened in one place for all three modes of input: sysfs, netlink, and module params.

-scott

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next 1/3] bonding: add option lp_interval for loading module
  2013-12-20 13:42 ` Sergei Shtylyov
@ 2013-12-21  6:00   ` Ding Tianhong
  0 siblings, 0 replies; 6+ messages in thread
From: Ding Tianhong @ 2013-12-21  6:00 UTC (permalink / raw)
  To: Sergei Shtylyov, Jay Vosburgh, Andy Gospodarek, David S. Miller,
	Veaceslav Falico, Netdev

On 2013/12/20 21:42, Sergei Shtylyov wrote:
> Hello.
> 
> On 20-12-2013 9:10, Ding Tianhong wrote:
> 
>> The bond driver could set the lp_interval when loading module.
> 
>> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
>> ---
>>   drivers/net/bonding/bond_main.c | 15 +++++++++++++--
>>   1 file changed, 13 insertions(+), 2 deletions(-)
> 
>> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>> index c0456cc..368f7e4 100644
>> --- a/drivers/net/bonding/bond_main.c
>> +++ b/drivers/net/bonding/bond_main.c
> [...]
>> @@ -4271,6 +4276,12 @@ static int bond_check_params(struct bond_params *params)
>>           fail_over_mac_value = BOND_FOM_NONE;
>>       }
>>
>> +    if (lp_interval == 0) {
>> +        pr_warning("Warning: ip_interval must be between 1 and %d, so it was reset to %d\n",
>> +            INT_MAX, BOND_ALB_DEFAULT_LP_INTERVAL);
> 
>    The continuation line should be aligned under ", according to the networking coding style.
> 
> WBR, Sergei
> 
> 

Ok, I will fix it, thanks.

Regards
Ding

> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next 1/3] bonding: add option lp_interval for loading module
  2013-12-21  2:06 ` Scott Feldman
@ 2013-12-21  6:28   ` Ding Tianhong
  0 siblings, 0 replies; 6+ messages in thread
From: Ding Tianhong @ 2013-12-21  6:28 UTC (permalink / raw)
  To: Scott Feldman
  Cc: Jay Vosburgh, Andy Gospodarek, David S. Miller, Veaceslav Falico,
	Netdev

On 2013/12/21 10:06, Scott Feldman wrote:
> 
> On Dec 19, 2013, at 9:10 PM, Ding Tianhong <dingtianhong@huawei.com> wrote:
> 
>> @@ -4271,6 +4276,12 @@ static int bond_check_params(struct bond_params *params)
>> 		fail_over_mac_value = BOND_FOM_NONE;
>> 	}
>>
>> +	if (lp_interval == 0) {
>> +		pr_warning("Warning: ip_interval must be between 1 and %d, so it was reset to %d\n",
>> +			INT_MAX, BOND_ALB_DEFAULT_LP_INTERVAL);
>> +		lp_interval = BOND_ALB_DEFAULT_LP_INTERVAL;
>> +	}
>> +
> 
> [sorry, replied with wrong email]
> 
> What do you think about using the new bond_option_xxx_set() functions for module parameters also?  The above code, for example, is duplicated in bond_option_lp_interval_set().  This way, we have a unified solution, where option bounds checking, compatibility, warnings, etc happened in one place for all three modes of input: sysfs, netlink, and module params.
> 
> -scott
> 

Yes, I agree with you, and I will wait for you to finish the bond_option_xxx_set() and then make the bond_check_params() use them, I think the code will be more simplify.
Thanks

Regards
ding 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-12-21  6:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-20  5:10 [PATCH net-next 1/3] bonding: add option lp_interval for loading module Ding Tianhong
2013-12-20 13:42 ` Sergei Shtylyov
2013-12-21  6:00   ` Ding Tianhong
2013-12-21  2:04 ` Scott Feldman
2013-12-21  2:06 ` Scott Feldman
2013-12-21  6:28   ` Ding Tianhong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.