aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_sysfs.c
diff options
context:
space:
mode:
authorsfeldma@cumulusnetworks.com <sfeldma@cumulusnetworks.com>2014-01-03 17:18:49 -0500
committerDavid S. Miller <davem@davemloft.net>2014-01-03 21:03:21 -0500
commitec029fac3e96980fa8f6f81b8327787a9600dfaa (patch)
tree81313ab42dfee3f1795dd250aa94217f73543939 /drivers/net/bonding/bond_sysfs.c
parent998e40bbf8f0e10b5d84107afc61e29dbc8d2de4 (diff)
bonding: add ad_select attribute netlink support
Add IFLA_BOND_AD_SELECT to allow get/set of bonding parameter ad_select via netlink. Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com> 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.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 62d33dcc9243..9a1ea4a171c7 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -733,29 +733,24 @@ static ssize_t bonding_store_ad_select(struct device *d,
733 struct device_attribute *attr, 733 struct device_attribute *attr,
734 const char *buf, size_t count) 734 const char *buf, size_t count)
735{ 735{
736 int new_value, ret = count; 736 int new_value, ret;
737 struct bonding *bond = to_bond(d); 737 struct bonding *bond = to_bond(d);
738 738
739 if (bond->dev->flags & IFF_UP) {
740 pr_err("%s: Unable to update ad_select because interface is up.\n",
741 bond->dev->name);
742 ret = -EPERM;
743 goto out;
744 }
745
746 new_value = bond_parse_parm(buf, ad_select_tbl); 739 new_value = bond_parse_parm(buf, ad_select_tbl);
747 740 if (new_value < 0) {
748 if (new_value != -1) {
749 bond->params.ad_select = new_value;
750 pr_info("%s: Setting ad_select to %s (%d).\n",
751 bond->dev->name, ad_select_tbl[new_value].modename,
752 new_value);
753 } else {
754 pr_err("%s: Ignoring invalid ad_select value %.*s.\n", 741 pr_err("%s: Ignoring invalid ad_select value %.*s.\n",
755 bond->dev->name, (int)strlen(buf) - 1, buf); 742 bond->dev->name, (int)strlen(buf) - 1, buf);
756 ret = -EINVAL; 743 return -EINVAL;
757 } 744 }
758out: 745
746 if (!rtnl_trylock())
747 return restart_syscall();
748
749 ret = bond_option_ad_select_set(bond, new_value);
750 if (!ret)
751 ret = count;
752
753 rtnl_unlock();
759 return ret; 754 return ret;
760} 755}
761static DEVICE_ATTR(ad_select, S_IRUGO | S_IWUSR, 756static DEVICE_ATTR(ad_select, S_IRUGO | S_IWUSR,