bonding: Make alb learning packet interval configurable
Subsystems (4)
PATCH 1/1 bonding: Make alb learning packet interval configurable
From: Neil Horman <[email protected]>
running bonding in ALB mode requires that learning packets be sent periodically, so that the switch knows where to send responding traffic. However, depending on switch configuration, there may not be any need to send traffic at the default rate of 3 packets per second, which represents little more than wasted data. Allow the ALB learning packet interval to be made configurable via sysfs
--- drivers/net/bonding/bond_alb.c | 2 +- drivers/net/bonding/bond_alb.h | 8 ++++---- drivers/net/bonding/bond_main.c | 1 + drivers/net/bonding/bond_sysfs.c | 39 +++++++++++++++++++++++++++++++++++++++ drivers/net/bonding/bonding.h | 1 + 5 files changed, 46 insertions(+), 5 deletions(-)
drivers/net/bonding/bond_alb.c +1 -1
@@ -1472,7 +1472,7 @@ void bond_alb_monitor(struct work_struct *work) bond_info->lp_counter++;/* send learning packets */ -if (bond_info->lp_counter >=BOND_ALB_LP_TICKS ) { +if (bond_info->lp_counter >=BOND_ALB_LP_TICKS (bond)) {/* change of curr_active_slave involves swapping of mac addresses. * in order to avoid this swapping from happening while * sending the learning packets, the curr_slave_lock must be held for
drivers/net/bonding/bond_alb.h +4 -4
@@ -36,14 +36,14 @@ struct slave;* Used for division - never set * to zero !!! */ -#define BOND_ALB_LP_INTERVAL 1/* In seconds, periodic send of -* learning packets to the switch -*/ +#define BOND_ALB_LP_INTERVAL (bond) (bond->params.lp_interval)/* In seconds, periodic send of +* learning packets to the switch +*/ #define BOND_TLB_REBALANCE_TICKS (BOND_TLB_REBALANCE_INTERVAL \ * ALB_TIMER_TICKS_PER_SEC) -#define BOND_ALB_LP_TICKS (BOND_ALB_LP_INTERVAL \ +#define BOND_ALB_LP_TICKS (bond) (BOND_ALB_LP_INTERVAL(bond) \ * ALB_TIMER_TICKS_PER_SEC)#define TLB_HASH_TABLE_SIZE 256/* The size of the clients hash table.
drivers/net/bonding/bond_main.c +1 -0
@@ -4416,6 +4416,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 =1 ;if (primary) {strncpy (params->primary, primary,IFNAMSIZ );
drivers/net/bonding/bond_sysfs.c +39 -0
@@ -1680,6 +1680,44 @@ out: static DEVICE_ATTR(resend_igmp, S_IRUGO | S_IWUSR, bonding_show_resend_igmp, bonding_store_resend_igmp); + +static ssize_t bonding_show_lp_interval (struct device *d, +struct device_attribute *attr, +char *buf) +{ +struct bonding *bond =to_bond (d); +return sprintf (buf,"%d\n" , bond->params.lp_interval); +} + +static ssize_t bonding_store_lp_interval (struct device *d, +struct device_attribute *attr, +const char *buf,size_t count) +{ +struct bonding *bond =to_bond (d); +int new_value, ret = count; + +if (sscanf (buf,"%d" , &new_value) !=1 ) { +pr_err ("%s: no lp interval value specified.\n" , + bond->dev->name); + ret = -EINVAL ; + goto out; + } + +if (new_value <=0 ) { +pr_err ("%s: lp_interval must be between 1 and %d\n" , + bond->dev->name,INT_MAX ); + ret = -EINVAL ; + goto out; + } + + bond->params.lp_interval = new_value; +out: +return ret; +} + +static DEVICE_ATTR(lp_interval, S_IRUGO | S_IWUSR, + bonding_show_lp_interval, bonding_store_lp_interval); +static struct attribute *per_bond_attrs[] = { &dev_attr_slaves.attr, &dev_attr_mode.attr,
@@ -1710,6 +1748,7 @@ static struct attribute *per_bond_attrs[] = { &dev_attr_all_slaves_active.attr, &dev_attr_resend_igmp.attr, &dev_attr_min_links.attr, + &dev_attr_lp_interval.attr, NULL, };
drivers/net/bonding/bonding.h +1 -0
@@ -176,6 +176,7 @@ struct bond_params {int tx_queues;int all_slaves_active;int resend_igmp; +int lp_interval; };struct bond_parm_tbl {
Signature · 1 line
1.8.3.1
Quoted 13 lines · Neil Horman
From: Neil Horman <[email protected]>
running bonding in ALB mode requires that learning packets be sent periodically, so that the switch knows where to send responding traffic. However, depending on switch configuration, there may not be any need to send traffic at the default rate of 3 packets per second, which represents little more than wasted data. Allow the ALB learning packet interval to be made configurable via sysfs
Signed-off-by Neil Horman <[email protected]>CC Jay Vosburgh <[email protected]>CC Andy Gospodarek <[email protected]>CC "David S. Miller" <[email protected]>
Quoted 7 lines
---
drivers/net/bonding/bond_alb.c | 2 +- drivers/net/bonding/bond_alb.h | 8 ++++---- drivers/net/bonding/bond_main.c | 1 + drivers/net/bonding/bond_sysfs.c | 39 +++++++++++++++++++++++++++++++++++++++ drivers/net/bonding/bonding.h | 1 + 5 files changed, 46 insertions(+), 5 deletions(-)
Maybe add some description about it to Documentation/networking/bonding.txt?
Otherwise seems good.
Quoted 118 lines
drivers/net/bonding/bond_alb.c +1
-1@@ -1472,7 +1472,7 @@ void bond_alb_monitor(struct work_struct *work) bond_info->lp_counter++;/* send learning packets */ -if (bond_info->lp_counter >=BOND_ALB_LP_TICKS ) { +if (bond_info->lp_counter >=BOND_ALB_LP_TICKS (bond)) {/* change of curr_active_slave involves swapping of mac addresses. * in order to avoid this swapping from happening while * sending the learning packets, the curr_slave_lock must be held for drivers/net/bonding/bond_alb.h +4
-4@@ -36,14 +36,14 @@ struct slave;* Used for division - never set * to zero !!! */ -#define BOND_ALB_LP_INTERVAL 1/* In seconds, periodic send of -* learning packets to the switch -*/ +#define BOND_ALB_LP_INTERVAL (bond) (bond->params.lp_interval)/* In seconds, periodic send of +* learning packets to the switch +*/ #define BOND_TLB_REBALANCE_TICKS (BOND_TLB_REBALANCE_INTERVAL \ * ALB_TIMER_TICKS_PER_SEC) -#define BOND_ALB_LP_TICKS (BOND_ALB_LP_INTERVAL \ +#define BOND_ALB_LP_TICKS (bond) (BOND_ALB_LP_INTERVAL(bond) \ * ALB_TIMER_TICKS_PER_SEC)#define TLB_HASH_TABLE_SIZE 256/* The size of the clients hash table. drivers/net/bonding/bond_main.c +1
-0@@ -4416,6 +4416,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 =1 ;if (primary) {strncpy (params->primary, primary,IFNAMSIZ );drivers/net/bonding/bond_sysfs.c +39
-0@@ -1680,6 +1680,44 @@ out: static DEVICE_ATTR(resend_igmp, S_IRUGO | S_IWUSR, bonding_show_resend_igmp, bonding_store_resend_igmp); + +static ssize_t bonding_show_lp_interval (struct device *d, +struct device_attribute *attr, +char *buf) +{ +struct bonding *bond =to_bond (d); +return sprintf (buf,"%d\n" , bond->params.lp_interval); +} + +static ssize_t bonding_store_lp_interval (struct device *d, +struct device_attribute *attr, +const char *buf,size_t count) +{ +struct bonding *bond =to_bond (d); +int new_value, ret = count; + +if (sscanf (buf,"%d" , &new_value) !=1 ) { +pr_err ("%s: no lp interval value specified.\n" , + bond->dev->name); + ret = -EINVAL ; + goto out; + } + +if (new_value <=0 ) { +pr_err ("%s: lp_interval must be between 1 and %d\n" , + bond->dev->name,INT_MAX ); + ret = -EINVAL ; + goto out; + } + + bond->params.lp_interval = new_value; +out: +return ret; +} + +static DEVICE_ATTR(lp_interval, S_IRUGO | S_IWUSR, + bonding_show_lp_interval, bonding_store_lp_interval); +static struct attribute *per_bond_attrs[] = { &dev_attr_slaves.attr, &dev_attr_mode.attr,@@ -1710,6 +1748,7 @@ static struct attribute *per_bond_attrs[] = { &dev_attr_all_slaves_active.attr, &dev_attr_resend_igmp.attr, &dev_attr_min_links.attr, + &dev_attr_lp_interval.attr, NULL, };drivers/net/bonding/bonding.h +1
-0@@ -176,6 +176,7 @@ struct bond_params {int tx_queues;int all_slaves_active;int resend_igmp; +int lp_interval; };struct bond_parm_tbl {
Quoted 22 lines · Veaceslav Falico
Quoted 13 lines · Neil Horman
From: Neil Horman <[email protected]>
running bonding in ALB mode requires that learning packets be sent periodically, so that the switch knows where to send responding traffic. However, depending on switch configuration, there may not be any need to send traffic at the default rate of 3 packets per second, which represents little more than wasted data. Allow the ALB learning packet interval to be made configurable via sysfs
Signed-off-by Neil Horman <[email protected]>CC Jay Vosburgh <[email protected]>CC Andy Gospodarek <[email protected]>CC "David S. Miller" <[email protected]>Quoted 7 lines
---
drivers/net/bonding/bond_alb.c | 2 +- drivers/net/bonding/bond_alb.h | 8 ++++---- drivers/net/bonding/bond_main.c | 1 + drivers/net/bonding/bond_sysfs.c | 39 +++++++++++++++++++++++++++++++++++++++ drivers/net/bonding/bonding.h | 1 + 5 files changed, 46 insertions(+), 5 deletions(-)
Quoted 2 lines
Maybe add some description about it to
Documentation/networking/bonding.txt?
Crap, yes, you're right of course. Thanks. I'll respin with that added.
Thanks
Neil
Quoted 121 lines
Otherwise seems good.
Quoted 118 lines
drivers/net/bonding/bond_alb.c +1
-1@@ -1472,7 +1472,7 @@ void bond_alb_monitor(struct work_struct *work) bond_info->lp_counter++;/* send learning packets */ -if (bond_info->lp_counter >=BOND_ALB_LP_TICKS ) { +if (bond_info->lp_counter >=BOND_ALB_LP_TICKS (bond)) {/* change of curr_active_slave involves swapping of mac addresses. * in order to avoid this swapping from happening while * sending the learning packets, the curr_slave_lock must be held for drivers/net/bonding/bond_alb.h +4
-4@@ -36,14 +36,14 @@ struct slave;* Used for division - never set * to zero !!! */ -#define BOND_ALB_LP_INTERVAL 1/* In seconds, periodic send of -* learning packets to the switch -*/ +#define BOND_ALB_LP_INTERVAL (bond) (bond->params.lp_interval)/* In seconds, periodic send of +* learning packets to the switch +*/ #define BOND_TLB_REBALANCE_TICKS (BOND_TLB_REBALANCE_INTERVAL \ * ALB_TIMER_TICKS_PER_SEC) -#define BOND_ALB_LP_TICKS (BOND_ALB_LP_INTERVAL \ +#define BOND_ALB_LP_TICKS (bond) (BOND_ALB_LP_INTERVAL(bond) \ * ALB_TIMER_TICKS_PER_SEC)#define TLB_HASH_TABLE_SIZE 256/* The size of the clients hash table. drivers/net/bonding/bond_main.c +1
-0@@ -4416,6 +4416,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 =1 ;if (primary) {strncpy (params->primary, primary,IFNAMSIZ );drivers/net/bonding/bond_sysfs.c +39
-0@@ -1680,6 +1680,44 @@ out: static DEVICE_ATTR(resend_igmp, S_IRUGO | S_IWUSR, bonding_show_resend_igmp, bonding_store_resend_igmp); + +static ssize_t bonding_show_lp_interval (struct device *d, +struct device_attribute *attr, +char *buf) +{ +struct bonding *bond =to_bond (d); +return sprintf (buf,"%d\n" , bond->params.lp_interval); +} + +static ssize_t bonding_store_lp_interval (struct device *d, +struct device_attribute *attr, +const char *buf,size_t count) +{ +struct bonding *bond =to_bond (d); +int new_value, ret = count; + +if (sscanf (buf,"%d" , &new_value) !=1 ) { +pr_err ("%s: no lp interval value specified.\n" , + bond->dev->name); + ret = -EINVAL ; + goto out; + } + +if (new_value <=0 ) { +pr_err ("%s: lp_interval must be between 1 and %d\n" , + bond->dev->name,INT_MAX ); + ret = -EINVAL ; + goto out; + } + + bond->params.lp_interval = new_value; +out: +return ret; +} + +static DEVICE_ATTR(lp_interval, S_IRUGO | S_IWUSR, + bonding_show_lp_interval, bonding_store_lp_interval); +static struct attribute *per_bond_attrs[] = { &dev_attr_slaves.attr, &dev_attr_mode.attr,@@ -1710,6 +1748,7 @@ static struct attribute *per_bond_attrs[] = { &dev_attr_all_slaves_active.attr, &dev_attr_resend_igmp.attr, &dev_attr_min_links.attr, + &dev_attr_lp_interval.attr, NULL, };drivers/net/bonding/bonding.h +1
-0@@ -176,6 +176,7 @@ struct bond_params {int tx_queues;int all_slaves_active;int resend_igmp; +int lp_interval; };struct bond_parm_tbl {
PATCH v2 1/1 bonding: Make alb learning packet interval configurable
In reply to Neil HormanFrom: Neil Horman <[email protected]>
running bonding in ALB mode requires that learning packets be sent periodically, so that the switch knows where to send responding traffic. However, depending on switch configuration, there may not be any need to send traffic at the default rate of 3 packets per second, which represents little more than wasted data. Allow the ALB learning packet interval to be made configurable via sysfs
---
Change Notes:
v2)
Add documentation
--- Documentation/networking/bonding.txt | 5 +++++ drivers/net/bonding/bond_alb.c | 2 +- drivers/net/bonding/bond_alb.h | 8 ++++---- drivers/net/bonding/bond_main.c | 1 + drivers/net/bonding/bond_sysfs.c | 39 ++++++++++++++++++++++++++++++++++++ drivers/net/bonding/bonding.h | 1 + 6 files changed, 51 insertions(+), 5 deletions(-)
Documentation/networking/bonding.txt +5 -0
@@ -1362,6 +1362,11 @@ To add ARP targets: To remove an ARP target: # echo -192.168.0.100 > /sys/class/net/bond0/bonding/arp_ip_target +To configure the interval between learning packet transmits: +# echo 12 > /sys/class/net/bond0/bonding/lp_interval + NOTE: the lp_inteval is the number of seconds between instances where +the bonding driver sends learning packets to each slaves peer switch. + Example Configuration --------------------- We begin with the same example that is shown in section 3.3,
drivers/net/bonding/bond_alb.c +1 -1
@@ -1472,7 +1472,7 @@ void bond_alb_monitor(struct work_struct *work) bond_info->lp_counter++;/* send learning packets */ -if (bond_info->lp_counter >=BOND_ALB_LP_TICKS ) { +if (bond_info->lp_counter >=BOND_ALB_LP_TICKS (bond)) {/* change of curr_active_slave involves swapping of mac addresses. * in order to avoid this swapping from happening while * sending the learning packets, the curr_slave_lock must be held for
drivers/net/bonding/bond_alb.h +4 -4
@@ -36,14 +36,14 @@ struct slave;* Used for division - never set * to zero !!! */ -#define BOND_ALB_LP_INTERVAL 1/* In seconds, periodic send of -* learning packets to the switch -*/ +#define BOND_ALB_LP_INTERVAL (bond) (bond->params.lp_interval)/* In seconds, periodic send of +* learning packets to the switch +*/ #define BOND_TLB_REBALANCE_TICKS (BOND_TLB_REBALANCE_INTERVAL \ * ALB_TIMER_TICKS_PER_SEC) -#define BOND_ALB_LP_TICKS (BOND_ALB_LP_INTERVAL \ +#define BOND_ALB_LP_TICKS (bond) (BOND_ALB_LP_INTERVAL(bond) \ * ALB_TIMER_TICKS_PER_SEC)#define TLB_HASH_TABLE_SIZE 256/* The size of the clients hash table.
drivers/net/bonding/bond_main.c +1 -0
@@ -4416,6 +4416,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 =1 ;if (primary) {strncpy (params->primary, primary,IFNAMSIZ );
drivers/net/bonding/bond_sysfs.c +39 -0
@@ -1680,6 +1680,44 @@ out: static DEVICE_ATTR(resend_igmp, S_IRUGO | S_IWUSR, bonding_show_resend_igmp, bonding_store_resend_igmp); + +static ssize_t bonding_show_lp_interval (struct device *d, +struct device_attribute *attr, +char *buf) +{ +struct bonding *bond =to_bond (d); +return sprintf (buf,"%d\n" , bond->params.lp_interval); +} + +static ssize_t bonding_store_lp_interval (struct device *d, +struct device_attribute *attr, +const char *buf,size_t count) +{ +struct bonding *bond =to_bond (d); +int new_value, ret = count; + +if (sscanf (buf,"%d" , &new_value) !=1 ) { +pr_err ("%s: no lp interval value specified.\n" , + bond->dev->name); + ret = -EINVAL ; + goto out; + } + +if (new_value <=0 ) { +pr_err ("%s: lp_interval must be between 1 and %d\n" , + bond->dev->name,INT_MAX ); + ret = -EINVAL ; + goto out; + } + + bond->params.lp_interval = new_value; +out: +return ret; +} + +static DEVICE_ATTR(lp_interval, S_IRUGO | S_IWUSR, + bonding_show_lp_interval, bonding_store_lp_interval); +static struct attribute *per_bond_attrs[] = { &dev_attr_slaves.attr, &dev_attr_mode.attr,
@@ -1710,6 +1748,7 @@ static struct attribute *per_bond_attrs[] = { &dev_attr_all_slaves_active.attr, &dev_attr_resend_igmp.attr, &dev_attr_min_links.attr, + &dev_attr_lp_interval.attr, NULL, };
drivers/net/bonding/bonding.h +1 -0
@@ -176,6 +176,7 @@ struct bond_params {int tx_queues;int all_slaves_active;int resend_igmp; +int lp_interval; };struct bond_parm_tbl {
Signature · 1 line
1.8.3.1
Quoted 13 lines · Neil Horman
From: Neil Horman <[email protected]>
running bonding in ALB mode requires that learning packets be sent periodically, so that the switch knows where to send responding traffic. However, depending on switch configuration, there may not be any need to send traffic at the default rate of 3 packets per second, which represents little more than wasted data. Allow the ALB learning packet interval to be made configurable via sysfs
Signed-off-by Neil Horman <[email protected]>CC Jay Vosburgh <[email protected]>CC Andy Gospodarek <[email protected]>CC "David S. Miller" <[email protected]>
Quoted 4 lines
---
Change Notes:
v2)
Add documentation
Nice, thank you!
Quoted 145 lines
---
Documentation/networking/bonding.txt | 5 +++++ drivers/net/bonding/bond_alb.c | 2 +- drivers/net/bonding/bond_alb.h | 8 ++++---- drivers/net/bonding/bond_main.c | 1 + drivers/net/bonding/bond_sysfs.c | 39 ++++++++++++++++++++++++++++++++++++ drivers/net/bonding/bonding.h | 1 + 6 files changed, 51 insertions(+), 5 deletions(-)Documentation/networking/bonding.txt +0
-0@@ -1362,6 +1362,11 @@ To add ARP targets:To remove an ARP target:
# echo -192.168.0.100 > /sys/class/net/bond0/bonding/arp_ip_targetDocumentation/networking/bonding.txt +5
-0+To configure the interval between learning packet transmits: +# echo 12 > /sys/class/net/bond0/bonding/lp_interval + NOTE: the lp_inteval is the number of seconds between instances where +the bonding driver sends learning packets to each slaves peer switch. +Example Configuration
---------------------
We begin with the same example that is shown in section 3.3,drivers/net/bonding/bond_alb.c +1
-1@@ -1472,7 +1472,7 @@ void bond_alb_monitor(struct work_struct *work) bond_info->lp_counter++;/* send learning packets */ -if (bond_info->lp_counter >=BOND_ALB_LP_TICKS ) { +if (bond_info->lp_counter >=BOND_ALB_LP_TICKS (bond)) {/* change of curr_active_slave involves swapping of mac addresses. * in order to avoid this swapping from happening while * sending the learning packets, the curr_slave_lock must be held for drivers/net/bonding/bond_alb.h +4
-4@@ -36,14 +36,14 @@ struct slave;* Used for division - never set * to zero !!! */ -#define BOND_ALB_LP_INTERVAL 1/* In seconds, periodic send of -* learning packets to the switch -*/ +#define BOND_ALB_LP_INTERVAL (bond) (bond->params.lp_interval)/* In seconds, periodic send of +* learning packets to the switch +*/ #define BOND_TLB_REBALANCE_TICKS (BOND_TLB_REBALANCE_INTERVAL \ * ALB_TIMER_TICKS_PER_SEC) -#define BOND_ALB_LP_TICKS (BOND_ALB_LP_INTERVAL \ +#define BOND_ALB_LP_TICKS (bond) (BOND_ALB_LP_INTERVAL(bond) \ * ALB_TIMER_TICKS_PER_SEC)#define TLB_HASH_TABLE_SIZE 256/* The size of the clients hash table. drivers/net/bonding/bond_main.c +1
-0@@ -4416,6 +4416,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 =1 ;if (primary) {strncpy (params->primary, primary,IFNAMSIZ );drivers/net/bonding/bond_sysfs.c +39
-0@@ -1680,6 +1680,44 @@ out: static DEVICE_ATTR(resend_igmp, S_IRUGO | S_IWUSR, bonding_show_resend_igmp, bonding_store_resend_igmp); + +static ssize_t bonding_show_lp_interval (struct device *d, +struct device_attribute *attr, +char *buf) +{ +struct bonding *bond =to_bond (d); +return sprintf (buf,"%d\n" , bond->params.lp_interval); +} + +static ssize_t bonding_store_lp_interval (struct device *d, +struct device_attribute *attr, +const char *buf,size_t count) +{ +struct bonding *bond =to_bond (d); +int new_value, ret = count; + +if (sscanf (buf,"%d" , &new_value) !=1 ) { +pr_err ("%s: no lp interval value specified.\n" , + bond->dev->name); + ret = -EINVAL ; + goto out; + } + +if (new_value <=0 ) { +pr_err ("%s: lp_interval must be between 1 and %d\n" , + bond->dev->name,INT_MAX ); + ret = -EINVAL ; + goto out; + } + + bond->params.lp_interval = new_value; +out: +return ret; +} + +static DEVICE_ATTR(lp_interval, S_IRUGO | S_IWUSR, + bonding_show_lp_interval, bonding_store_lp_interval); +static struct attribute *per_bond_attrs[] = { &dev_attr_slaves.attr, &dev_attr_mode.attr,@@ -1710,6 +1748,7 @@ static struct attribute *per_bond_attrs[] = { &dev_attr_all_slaves_active.attr, &dev_attr_resend_igmp.attr, &dev_attr_min_links.attr, + &dev_attr_lp_interval.attr, NULL, };drivers/net/bonding/bonding.h +1
-0@@ -176,6 +176,7 @@ struct bond_params {int tx_queues;int all_slaves_active;int resend_igmp; +int lp_interval; };struct bond_parm_tbl {Signature · 1 line
1.8.3.1
David Miller
maintainerFrom: Neil Horman <[email protected]>
Date: Tue, 10 Sep 2013 16:39:03 -0400
Quoted 9 lines
From: Neil Horman <[email protected]>
running bonding in ALB mode requires that learning packets be sent periodically, so that the switch knows where to send responding traffic. However, depending on switch configuration, there may not be any need to send traffic at the default rate of 3 packets per second, which represents little more than wasted data. Allow the ALB learning packet interval to be made configurable via sysfs
Signed-off-by Neil Horman <[email protected]>
I hate to be a stickler, but I'd like you to make the default value documented both in the code and in the documentation.
Use some macro for the code "#define BOND_ALB_DEFAULT_LP_INTERVAL 1" and mention the default in the bonding.txt changes.
Thanks.
Quoted 11 lines · David Miller
From: Neil Horman <[email protected]>
Date: Tue, 10 Sep 2013 16:39:03 -0400Quoted 8 lines
From: Neil Horman <[email protected]>
running bonding in ALB mode requires that learning packets be sent periodically, so that the switch knows where to send responding traffic. However, depending on switch configuration, there may not be any need to send traffic at the default rate of 3 packets per second, which represents little more than wasted data. Allow the ALB learning packet interval to be made configurable via sysfs
Quoted 8 lines
Quoted 1 line
Signed-off-by Neil Horman <[email protected]>I hate to be a stickler, but I'd like you to make the default value documented both in the code and in the documentation.
Use some macro for the code "#define
BOND_ALB_DEFAULT_LP_INTERVAL1" and mention the default in the bonding.txt changes.
Agree with DaveM on this. You can just keep the one that was there and it should be pretty easy.
Quoted 17 lines · Andy Gospodarek
Quoted 16 lines · David Miller
From: Neil Horman <[email protected]>
Date: Tue, 10 Sep 2013 16:39:03 -0400Quoted 9 lines
From: Neil Horman <[email protected]>
running bonding in ALB mode requires that learning packets be sent periodically, so that the switch knows where to send responding traffic. However, depending on switch configuration, there may not be any need to send traffic at the default rate of 3 packets per second, which represents little more than wasted data. Allow the ALB learning packet interval to be made configurable via sysfs
Signed-off-by Neil Horman <[email protected]>I hate to be a stickler, but I'd like you to make the default value documented both in the code and in the documentation.
Quoted 7 lines
Quoted 3 lines
Use some macro for the code "#define
BOND_ALB_DEFAULT_LP_INTERVAL1" and mention the default in the bonding.txt changes.Agree with DaveM on this. You can just keep the one that was there and it should be pretty easy.
Yeah, sure I can do that. v3 in the AM
Neil
PATCH v3 1/1 bonding: Make alb learning packet interval configurable
In reply to Neil Hormanrunning bonding in ALB mode requires that learning packets be sent periodically, so that the switch knows where to send responding traffic. However, depending on switch configuration, there may not be any need to send traffic at the default rate of 3 packets per second, which represents little more than wasted data. Allow the ALB learning packet interval to be made configurable via sysfs
---
Change Notes:
v2)
Add documentation
v3)
Document the default value and make it a new macro
--- Documentation/networking/bonding.txt | 6 ++++++ drivers/net/bonding/bond_alb.c | 2 +- drivers/net/bonding/bond_alb.h | 9 +++++---- drivers/net/bonding/bond_main.c | 1 + drivers/net/bonding/bond_sysfs.c | 39 ++++++++++++++++++++++++++++++++++++ drivers/net/bonding/bonding.h | 1 + 6 files changed, 53 insertions(+), 5 deletions(-)
Documentation/networking/bonding.txt +6 -0
@@ -1362,6 +1362,12 @@ To add ARP targets: To remove an ARP target: # echo -192.168.0.100 > /sys/class/net/bond0/bonding/arp_ip_target +To configure the interval between learning packet transmits: +# echo 12 > /sys/class/net/bond0/bonding/lp_interval + NOTE: the lp_inteval is the number of seconds between instances where +the bonding driver sends learning packets to each slaves peer switch. The +default interval is 1 second. + Example Configuration --------------------- We begin with the same example that is shown in section 3.3,
drivers/net/bonding/bond_alb.c +1 -1
@@ -1472,7 +1472,7 @@ void bond_alb_monitor(struct work_struct *work) bond_info->lp_counter++;/* send learning packets */ -if (bond_info->lp_counter >=BOND_ALB_LP_TICKS ) { +if (bond_info->lp_counter >=BOND_ALB_LP_TICKS (bond)) {/* change of curr_active_slave involves swapping of mac addresses. * in order to avoid this swapping from happening while * sending the learning packets, the curr_slave_lock must be held for
drivers/net/bonding/bond_alb.h +5 -4
@@ -36,14 +36,15 @@ struct slave;* Used for division - never set * to zero !!! */ -#define BOND_ALB_LP_INTERVAL 1/* In seconds, periodic send of -* learning packets to the switch -*/ +#define BOND_ALB_DEFAULT_LP_INTERVAL 1 +#define BOND_ALB_LP_INTERVAL (bond) (bond->params.lp_interval)/* In seconds, periodic send of +* learning packets to the switch +*/ #define BOND_TLB_REBALANCE_TICKS (BOND_TLB_REBALANCE_INTERVAL \ * ALB_TIMER_TICKS_PER_SEC) -#define BOND_ALB_LP_TICKS (BOND_ALB_LP_INTERVAL \ +#define BOND_ALB_LP_TICKS (bond) (BOND_ALB_LP_INTERVAL(bond) \ * ALB_TIMER_TICKS_PER_SEC)#define TLB_HASH_TABLE_SIZE 256/* The size of the clients hash table.
drivers/net/bonding/bond_main.c +1 -0
@@ -4416,6 +4416,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 ;if (primary) {strncpy (params->primary, primary,IFNAMSIZ );
drivers/net/bonding/bond_sysfs.c +39 -0
@@ -1680,6 +1680,44 @@ out: static DEVICE_ATTR(resend_igmp, S_IRUGO | S_IWUSR, bonding_show_resend_igmp, bonding_store_resend_igmp); + +static ssize_t bonding_show_lp_interval (struct device *d, +struct device_attribute *attr, +char *buf) +{ +struct bonding *bond =to_bond (d); +return sprintf (buf,"%d\n" , bond->params.lp_interval); +} + +static ssize_t bonding_store_lp_interval (struct device *d, +struct device_attribute *attr, +const char *buf,size_t count) +{ +struct bonding *bond =to_bond (d); +int new_value, ret = count; + +if (sscanf (buf,"%d" , &new_value) !=1 ) { +pr_err ("%s: no lp interval value specified.\n" , + bond->dev->name); + ret = -EINVAL ; + goto out; + } + +if (new_value <=0 ) { +pr_err ("%s: lp_interval must be between 1 and %d\n" , + bond->dev->name,INT_MAX ); + ret = -EINVAL ; + goto out; + } + + bond->params.lp_interval = new_value; +out: +return ret; +} + +static DEVICE_ATTR(lp_interval, S_IRUGO | S_IWUSR, + bonding_show_lp_interval, bonding_store_lp_interval); +static struct attribute *per_bond_attrs[] = { &dev_attr_slaves.attr, &dev_attr_mode.attr,
@@ -1710,6 +1748,7 @@ static struct attribute *per_bond_attrs[] = { &dev_attr_all_slaves_active.attr, &dev_attr_resend_igmp.attr, &dev_attr_min_links.attr, + &dev_attr_lp_interval.attr, NULL, };
drivers/net/bonding/bonding.h +1 -0
@@ -176,6 +176,7 @@ struct bond_params {int tx_queues;int all_slaves_active;int resend_igmp; +int lp_interval; };struct bond_parm_tbl {
Signature · 1 line
1.8.3.1
Quoted 7 lines · Neil Horman
running bonding in ALB mode requires that learning packets be sent periodically, so that the switch knows where to send responding traffic. However, depending on switch configuration, there may not be any need to send traffic at the default rate of 3 packets per second, which represents little more than wasted data. Allow the ALB learning packet interval to be made configurable via sysfs
Signed-off-by Neil Horman <[email protected]>
Thanks for making those changes, Neil.
Quoted 163 lines
CC Jay Vosburgh <[email protected]>CC Andy Gospodarek <[email protected]>CC "David S. Miller" <[email protected]>---
Change Notes:
v2)
Add documentationv3)
Document the default value and make it a new macro--- Documentation/networking/bonding.txt | 6 ++++++ drivers/net/bonding/bond_alb.c | 2 +- drivers/net/bonding/bond_alb.h | 9 +++++---- drivers/net/bonding/bond_main.c | 1 + drivers/net/bonding/bond_sysfs.c | 39 ++++++++++++++++++++++++++++++++++++ drivers/net/bonding/bonding.h | 1 + 6 files changed, 53 insertions(+), 5 deletions(-)Documentation/networking/bonding.txt +6
-0@@ -1362,6 +1362,12 @@ To add ARP targets: To remove an ARP target: # echo -192.168.0.100 > /sys/class/net/bond0/bonding/arp_ip_target +To configure the interval between learning packet transmits: +# echo 12 > /sys/class/net/bond0/bonding/lp_interval + NOTE: the lp_inteval is the number of seconds between instances where +the bonding driver sends learning packets to each slaves peer switch. The +default interval is 1 second. + Example Configuration --------------------- We begin with the same example that is shown in section 3.3,drivers/net/bonding/bond_alb.c +1
-1@@ -1472,7 +1472,7 @@ void bond_alb_monitor(struct work_struct *work) bond_info->lp_counter++;/* send learning packets */ -if (bond_info->lp_counter >=BOND_ALB_LP_TICKS ) { +if (bond_info->lp_counter >=BOND_ALB_LP_TICKS (bond)) {/* change of curr_active_slave involves swapping of mac addresses. * in order to avoid this swapping from happening while * sending the learning packets, the curr_slave_lock must be held for drivers/net/bonding/bond_alb.h +5
-4@@ -36,14 +36,15 @@ struct slave;* Used for division - never set * to zero !!! */ -#define BOND_ALB_LP_INTERVAL 1/* In seconds, periodic send of -* learning packets to the switch -*/ +#define BOND_ALB_DEFAULT_LP_INTERVAL 1 +#define BOND_ALB_LP_INTERVAL (bond) (bond->params.lp_interval)/* In seconds, periodic send of +* learning packets to the switch +*/ #define BOND_TLB_REBALANCE_TICKS (BOND_TLB_REBALANCE_INTERVAL \ * ALB_TIMER_TICKS_PER_SEC) -#define BOND_ALB_LP_TICKS (BOND_ALB_LP_INTERVAL \ +#define BOND_ALB_LP_TICKS (bond) (BOND_ALB_LP_INTERVAL(bond) \ * ALB_TIMER_TICKS_PER_SEC)#define TLB_HASH_TABLE_SIZE 256/* The size of the clients hash table. drivers/net/bonding/bond_main.c +1
-0@@ -4416,6 +4416,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 ;if (primary) {strncpy (params->primary, primary,IFNAMSIZ );drivers/net/bonding/bond_sysfs.c +39
-0@@ -1680,6 +1680,44 @@ out: static DEVICE_ATTR(resend_igmp, S_IRUGO | S_IWUSR, bonding_show_resend_igmp, bonding_store_resend_igmp); + +static ssize_t bonding_show_lp_interval (struct device *d, +struct device_attribute *attr, +char *buf) +{ +struct bonding *bond =to_bond (d); +return sprintf (buf,"%d\n" , bond->params.lp_interval); +} + +static ssize_t bonding_store_lp_interval (struct device *d, +struct device_attribute *attr, +const char *buf,size_t count) +{ +struct bonding *bond =to_bond (d); +int new_value, ret = count; + +if (sscanf (buf,"%d" , &new_value) !=1 ) { +pr_err ("%s: no lp interval value specified.\n" , + bond->dev->name); + ret = -EINVAL ; + goto out; + } + +if (new_value <=0 ) { +pr_err ("%s: lp_interval must be between 1 and %d\n" , + bond->dev->name,INT_MAX ); + ret = -EINVAL ; + goto out; + } + + bond->params.lp_interval = new_value; +out: +return ret; +} + +static DEVICE_ATTR(lp_interval, S_IRUGO | S_IWUSR, + bonding_show_lp_interval, bonding_store_lp_interval); +static struct attribute *per_bond_attrs[] = { &dev_attr_slaves.attr, &dev_attr_mode.attr,@@ -1710,6 +1748,7 @@ static struct attribute *per_bond_attrs[] = { &dev_attr_all_slaves_active.attr, &dev_attr_resend_igmp.attr, &dev_attr_min_links.attr, + &dev_attr_lp_interval.attr, NULL, };drivers/net/bonding/bonding.h +1
-0@@ -176,6 +176,7 @@ struct bond_params {int tx_queues;int all_slaves_active;int resend_igmp; +int lp_interval; };struct bond_parm_tbl {Signature · 6 lines
1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Neil Horman <[email protected]>
Date: Fri, 13 Sep 2013 11:05:33 -0400
Quoted 8 lines
running bonding in ALB mode requires that learning packets be sent periodically, so that the switch knows where to send responding traffic. However, depending on switch configuration, there may not be any need to send traffic at the default rate of 3 packets per second, which represents little more than wasted data. Allow the ALB learning packet interval to be made configurable via sysfs
Signed-off-by Neil Horman <[email protected]>
Applied, thanks Neil.