aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_sysfs.c
diff options
context:
space:
mode:
authorNeil Horman <nhorman@tuxdriver.com>2013-09-13 11:05:33 -0400
committerDavid S. Miller <davem@davemloft.net>2013-09-15 22:20:44 -0400
commit7eacd03810960823393521063734fc8188446bca (patch)
treebea38507321d0f20caf41af8ce79e65ab513717d /drivers/net/bonding/bond_sysfs.c
parentd2bb3905ab9bafebd0872ceef9466c32849429d7 (diff)
bonding: Make alb learning packet interval configurable
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 <nhorman@tuxdriver.com> Acked-by: Acked-by: Veaceslav Falico <vfalico@redhat.com> CC: Jay Vosburgh <fubar@us.ibm.com> CC: Andy Gospodarek <andy@greyhouse.net> CC: "David S. Miller" <davem@davemloft.net> Signed-off-by: Andy Gospodarek <andy@greyhouse.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding/bond_sysfs.c')
-rw-r--r--drivers/net/bonding/bond_sysfs.c39
1 files changed, 39 insertions, 0 deletions
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:
1699static DEVICE_ATTR(resend_igmp, S_IRUGO | S_IWUSR, 1699static 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
1703static 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
1711static 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;
1733out:
1734 return ret;
1735}
1736
1737static DEVICE_ATTR(lp_interval, S_IRUGO | S_IWUSR,
1738 bonding_show_lp_interval, bonding_store_lp_interval);
1739
1702static struct attribute *per_bond_attrs[] = { 1740static 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