diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/bonding/bond_alb.c | 2 | ||||
-rw-r--r-- | drivers/net/bonding/bond_alb.h | 9 | ||||
-rw-r--r-- | drivers/net/bonding/bond_main.c | 1 | ||||
-rw-r--r-- | drivers/net/bonding/bond_sysfs.c | 39 | ||||
-rw-r--r-- | drivers/net/bonding/bonding.h | 1 |
5 files changed, 47 insertions, 5 deletions
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index 91f179d5135c..f428ef574372 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c | |||
@@ -1472,7 +1472,7 @@ void bond_alb_monitor(struct work_struct *work) | |||
1472 | bond_info->lp_counter++; | 1472 | bond_info->lp_counter++; |
1473 | 1473 | ||
1474 | /* send learning packets */ | 1474 | /* send learning packets */ |
1475 | if (bond_info->lp_counter >= BOND_ALB_LP_TICKS) { | 1475 | if (bond_info->lp_counter >= BOND_ALB_LP_TICKS(bond)) { |
1476 | /* change of curr_active_slave involves swapping of mac addresses. | 1476 | /* change of curr_active_slave involves swapping of mac addresses. |
1477 | * in order to avoid this swapping from happening while | 1477 | * in order to avoid this swapping from happening while |
1478 | * sending the learning packets, the curr_slave_lock must be held for | 1478 | * sending the learning packets, the curr_slave_lock must be held for |
diff --git a/drivers/net/bonding/bond_alb.h b/drivers/net/bonding/bond_alb.h index 28d8e4c7dc06..c5eff5dafdfe 100644 --- a/drivers/net/bonding/bond_alb.h +++ b/drivers/net/bonding/bond_alb.h | |||
@@ -36,14 +36,15 @@ struct slave; | |||
36 | * Used for division - never set | 36 | * Used for division - never set |
37 | * to zero !!! | 37 | * to zero !!! |
38 | */ | 38 | */ |
39 | #define BOND_ALB_LP_INTERVAL 1 /* In seconds, periodic send of | 39 | #define BOND_ALB_DEFAULT_LP_INTERVAL 1 |
40 | * learning packets to the switch | 40 | #define BOND_ALB_LP_INTERVAL(bond) (bond->params.lp_interval) /* In seconds, periodic send of |
41 | */ | 41 | * learning packets to the switch |
42 | */ | ||
42 | 43 | ||
43 | #define BOND_TLB_REBALANCE_TICKS (BOND_TLB_REBALANCE_INTERVAL \ | 44 | #define BOND_TLB_REBALANCE_TICKS (BOND_TLB_REBALANCE_INTERVAL \ |
44 | * ALB_TIMER_TICKS_PER_SEC) | 45 | * ALB_TIMER_TICKS_PER_SEC) |
45 | 46 | ||
46 | #define BOND_ALB_LP_TICKS (BOND_ALB_LP_INTERVAL \ | 47 | #define BOND_ALB_LP_TICKS(bond) (BOND_ALB_LP_INTERVAL(bond) \ |
47 | * ALB_TIMER_TICKS_PER_SEC) | 48 | * ALB_TIMER_TICKS_PER_SEC) |
48 | 49 | ||
49 | #define TLB_HASH_TABLE_SIZE 256 /* The size of the clients hash table. | 50 | #define TLB_HASH_TABLE_SIZE 256 /* The size of the clients hash table. |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 72df399c4ab3..55bbb8b8200c 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -4416,6 +4416,7 @@ static int bond_check_params(struct bond_params *params) | |||
4416 | params->all_slaves_active = all_slaves_active; | 4416 | params->all_slaves_active = all_slaves_active; |
4417 | params->resend_igmp = resend_igmp; | 4417 | params->resend_igmp = resend_igmp; |
4418 | params->min_links = min_links; | 4418 | params->min_links = min_links; |
4419 | params->lp_interval = BOND_ALB_DEFAULT_LP_INTERVAL; | ||
4419 | 4420 | ||
4420 | if (primary) { | 4421 | if (primary) { |
4421 | strncpy(params->primary, primary, IFNAMSIZ); | 4422 | strncpy(params->primary, primary, IFNAMSIZ); |
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index eeab40b01b7a..c29b836749b6 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -1699,6 +1699,44 @@ out: | |||
1699 | static DEVICE_ATTR(resend_igmp, S_IRUGO | S_IWUSR, | 1699 | static DEVICE_ATTR(resend_igmp, S_IRUGO | S_IWUSR, |
1700 | bonding_show_resend_igmp, bonding_store_resend_igmp); | 1700 | bonding_show_resend_igmp, bonding_store_resend_igmp); |
1701 | 1701 | ||
1702 | |||
1703 | static ssize_t bonding_show_lp_interval(struct device *d, | ||
1704 | struct device_attribute *attr, | ||
1705 | char *buf) | ||
1706 | { | ||
1707 | struct bonding *bond = to_bond(d); | ||
1708 | return sprintf(buf, "%d\n", bond->params.lp_interval); | ||
1709 | } | ||
1710 | |||
1711 | static ssize_t bonding_store_lp_interval(struct device *d, | ||
1712 | struct device_attribute *attr, | ||
1713 | const char *buf, size_t count) | ||
1714 | { | ||
1715 | struct bonding *bond = to_bond(d); | ||
1716 | int new_value, ret = count; | ||
1717 | |||
1718 | if (sscanf(buf, "%d", &new_value) != 1) { | ||
1719 | pr_err("%s: no lp interval value specified.\n", | ||
1720 | bond->dev->name); | ||
1721 | ret = -EINVAL; | ||
1722 | goto out; | ||
1723 | } | ||
1724 | |||
1725 | if (new_value <= 0) { | ||
1726 | pr_err ("%s: lp_interval must be between 1 and %d\n", | ||
1727 | bond->dev->name, INT_MAX); | ||
1728 | ret = -EINVAL; | ||
1729 | goto out; | ||
1730 | } | ||
1731 | |||
1732 | bond->params.lp_interval = new_value; | ||
1733 | out: | ||
1734 | return ret; | ||
1735 | } | ||
1736 | |||
1737 | static DEVICE_ATTR(lp_interval, S_IRUGO | S_IWUSR, | ||
1738 | bonding_show_lp_interval, bonding_store_lp_interval); | ||
1739 | |||
1702 | static struct attribute *per_bond_attrs[] = { | 1740 | static struct attribute *per_bond_attrs[] = { |
1703 | &dev_attr_slaves.attr, | 1741 | &dev_attr_slaves.attr, |
1704 | &dev_attr_mode.attr, | 1742 | &dev_attr_mode.attr, |
@@ -1729,6 +1767,7 @@ static struct attribute *per_bond_attrs[] = { | |||
1729 | &dev_attr_all_slaves_active.attr, | 1767 | &dev_attr_all_slaves_active.attr, |
1730 | &dev_attr_resend_igmp.attr, | 1768 | &dev_attr_resend_igmp.attr, |
1731 | &dev_attr_min_links.attr, | 1769 | &dev_attr_min_links.attr, |
1770 | &dev_attr_lp_interval.attr, | ||
1732 | NULL, | 1771 | NULL, |
1733 | }; | 1772 | }; |
1734 | 1773 | ||
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index 7ad8bd5cc947..03cf3fd14490 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
@@ -176,6 +176,7 @@ struct bond_params { | |||
176 | int tx_queues; | 176 | int tx_queues; |
177 | int all_slaves_active; | 177 | int all_slaves_active; |
178 | int resend_igmp; | 178 | int resend_igmp; |
179 | int lp_interval; | ||
179 | }; | 180 | }; |
180 | 181 | ||
181 | struct bond_parm_tbl { | 182 | struct bond_parm_tbl { |