diff options
author | sfeldma@cumulusnetworks.com <sfeldma@cumulusnetworks.com> | 2013-12-18 09:30:09 +0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-12-20 03:32:09 +0400 |
commit | 2c9839c143bbc8c6612f56351dae8d57111aee37 (patch) | |
tree | 94e73e0c75f6c83cd00ff5dc03e61dba3b440cca /drivers/net/bonding/bond_sysfs.c | |
parent | de47c4ab25d43a98e629cc11c2d90ae56145b35d (diff) | |
download | linux-2c9839c143bbc8c6612f56351dae8d57111aee37.tar.xz |
bonding: add num_grat_arp attribute netlink support
Add IFLA_BOND_NUM_PEER_NOTIF to allow get/set of bonding parameter
num_grat_arp via netlink. Bonding parameter num_unsol_na is
synonymous with num_grat_arp, so add only one netlink attribute
to represent both bonding parameters.
Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
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 | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index f5c1a54095b9..7efa33a8553f 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c @@ -790,8 +790,25 @@ static ssize_t bonding_store_num_peer_notif(struct device *d, const char *buf, size_t count) { struct bonding *bond = to_bond(d); - int err = kstrtou8(buf, 10, &bond->params.num_peer_notif); - return err ? err : count; + u8 new_value; + int ret; + + ret = kstrtou8(buf, 10, &new_value); + if (!ret) { + pr_err("%s: invalid value %s specified.\n", + bond->dev->name, buf); + return ret; + } + + if (!rtnl_trylock()) + return restart_syscall(); + + ret = bond_option_num_peer_notif_set(bond, new_value); + if (!ret) + ret = count; + + rtnl_unlock(); + return ret; } static DEVICE_ATTR(num_grat_arp, S_IRUGO | S_IWUSR, bonding_show_num_peer_notif, bonding_store_num_peer_notif); |