diff options
Diffstat (limited to 'drivers/net/bonding/bond_sysfs.c')
-rw-r--r-- | drivers/net/bonding/bond_sysfs.c | 39 |
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: | |||
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 | ||