diff options
author | sfeldma@cumulusnetworks.com <sfeldma@cumulusnetworks.com> | 2014-01-03 22:18:41 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-04 02:03:21 (GMT) |
commit | 998e40bbf8f0e10b5d84107afc61e29dbc8d2de4 (patch) | |
tree | 1c46087ba4a99b12a9891d397d8c1adc14c9d243 /drivers/net/bonding/bond_sysfs.c | |
parent | baf42552c7c42c39a5a61c98ac655b40e6f96781 (diff) | |
download | linux-998e40bbf8f0e10b5d84107afc61e29dbc8d2de4.tar.xz |
bonding: add lacp_rate attribute netlink support
Add IFLA_BOND_AD_LACP_RATE to allow get/set of bonding parameter
lacp_rate 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.c | 40 |
1 files changed, 11 insertions, 29 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index a0a3476f..62d33dc 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c @@ -658,41 +658,23 @@ static ssize_t bonding_store_lacp(struct device *d, const char *buf, size_t count) { struct bonding *bond = to_bond(d); - int new_value, ret = count; - - if (!rtnl_trylock()) - return restart_syscall(); - - if (bond->dev->flags & IFF_UP) { - pr_err("%s: Unable to update LACP rate because interface is up.\n", - bond->dev->name); - ret = -EPERM; - goto out; - } - - if (bond->params.mode != BOND_MODE_8023AD) { - pr_err("%s: Unable to update LACP rate because bond is not in 802.3ad mode.\n", - bond->dev->name); - ret = -EPERM; - goto out; - } + int new_value, ret; new_value = bond_parse_parm(buf, bond_lacp_tbl); - - if ((new_value == 1) || (new_value == 0)) { - bond->params.lacp_fast = new_value; - bond_3ad_update_lacp_rate(bond); - pr_info("%s: Setting LACP rate to %s (%d).\n", - bond->dev->name, bond_lacp_tbl[new_value].modename, - new_value); - } else { + if (new_value < 0) { pr_err("%s: Ignoring invalid LACP rate value %.*s.\n", bond->dev->name, (int)strlen(buf) - 1, buf); - ret = -EINVAL; + return -EINVAL; } -out: - rtnl_unlock(); + if (!rtnl_trylock()) + return restart_syscall(); + + ret = bond_option_lacp_rate_set(bond, new_value); + if (!ret) + ret = count; + + rtnl_unlock(); return ret; } static DEVICE_ATTR(lacp_rate, S_IRUGO | S_IWUSR, |