aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorsfeldma@cumulusnetworks.com <sfeldma@cumulusnetworks.com>2013-12-18 00:30:09 -0500
committerDavid S. Miller <davem@davemloft.net>2013-12-19 18:32:09 -0500
commit2c9839c143bbc8c6612f56351dae8d57111aee37 (patch)
tree94e73e0c75f6c83cd00ff5dc03e61dba3b440cca /drivers
parentde47c4ab25d43a98e629cc11c2d90ae56145b35d (diff)
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')
-rw-r--r--drivers/net/bonding/bond_netlink.c14
-rw-r--r--drivers/net/bonding/bond_options.c6
-rw-r--r--drivers/net/bonding/bond_sysfs.c21
-rw-r--r--drivers/net/bonding/bonding.h1
4 files changed, 40 insertions, 2 deletions
diff --git a/drivers/net/bonding/bond_netlink.c b/drivers/net/bonding/bond_netlink.c
index e161c9cbd91e..07123a0fcf5d 100644
--- a/drivers/net/bonding/bond_netlink.c
+++ b/drivers/net/bonding/bond_netlink.c
@@ -37,6 +37,7 @@ static const struct nla_policy bond_policy[IFLA_BOND_MAX + 1] = {
37 [IFLA_BOND_FAIL_OVER_MAC] = { .type = NLA_U8 }, 37 [IFLA_BOND_FAIL_OVER_MAC] = { .type = NLA_U8 },
38 [IFLA_BOND_XMIT_HASH_POLICY] = { .type = NLA_U8 }, 38 [IFLA_BOND_XMIT_HASH_POLICY] = { .type = NLA_U8 },
39 [IFLA_BOND_RESEND_IGMP] = { .type = NLA_U32 }, 39 [IFLA_BOND_RESEND_IGMP] = { .type = NLA_U32 },
40 [IFLA_BOND_NUM_PEER_NOTIF] = { .type = NLA_U8 },
40}; 41};
41 42
42static int bond_validate(struct nlattr *tb[], struct nlattr *data[]) 43static int bond_validate(struct nlattr *tb[], struct nlattr *data[])
@@ -204,6 +205,14 @@ static int bond_changelink(struct net_device *bond_dev,
204 if (err) 205 if (err)
205 return err; 206 return err;
206 } 207 }
208 if (data[IFLA_BOND_NUM_PEER_NOTIF]) {
209 int num_peer_notif =
210 nla_get_u8(data[IFLA_BOND_NUM_PEER_NOTIF]);
211
212 err = bond_option_num_peer_notif_set(bond, num_peer_notif);
213 if (err)
214 return err;
215 }
207 return 0; 216 return 0;
208} 217}
209 218
@@ -237,6 +246,7 @@ static size_t bond_get_size(const struct net_device *bond_dev)
237 nla_total_size(sizeof(u8)) + /* IFLA_BOND_FAIL_OVER_MAC */ 246 nla_total_size(sizeof(u8)) + /* IFLA_BOND_FAIL_OVER_MAC */
238 nla_total_size(sizeof(u8)) + /* IFLA_BOND_XMIT_HASH_POLICY */ 247 nla_total_size(sizeof(u8)) + /* IFLA_BOND_XMIT_HASH_POLICY */
239 nla_total_size(sizeof(u32)) + /* IFLA_BOND_RESEND_IGMP */ 248 nla_total_size(sizeof(u32)) + /* IFLA_BOND_RESEND_IGMP */
249 nla_total_size(sizeof(u8)) + /* IFLA_BOND_NUM_PEER_NOTIF */
240 0; 250 0;
241} 251}
242 252
@@ -317,6 +327,10 @@ static int bond_fill_info(struct sk_buff *skb,
317 bond->params.resend_igmp)) 327 bond->params.resend_igmp))
318 goto nla_put_failure; 328 goto nla_put_failure;
319 329
330 if (nla_put_u8(skb, IFLA_BOND_NUM_PEER_NOTIF,
331 bond->params.num_peer_notif))
332 goto nla_put_failure;
333
320 return 0; 334 return 0;
321 335
322nla_put_failure: 336nla_put_failure:
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
index 1ed7dff9a679..01a966916dcb 100644
--- a/drivers/net/bonding/bond_options.c
+++ b/drivers/net/bonding/bond_options.c
@@ -576,3 +576,9 @@ int bond_option_resend_igmp_set(struct bonding *bond, int resend_igmp)
576 576
577 return 0; 577 return 0;
578} 578}
579
580int bond_option_num_peer_notif_set(struct bonding *bond, int num_peer_notif)
581{
582 bond->params.num_peer_notif = num_peer_notif;
583 return 0;
584}
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,
790 const char *buf, size_t count) 790 const char *buf, size_t count)
791{ 791{
792 struct bonding *bond = to_bond(d); 792 struct bonding *bond = to_bond(d);
793 int err = kstrtou8(buf, 10, &bond->params.num_peer_notif); 793 u8 new_value;
794 return err ? err : count; 794 int ret;
795
796 ret = kstrtou8(buf, 10, &new_value);
797 if (!ret) {
798 pr_err("%s: invalid value %s specified.\n",
799 bond->dev->name, buf);
800 return ret;
801 }
802
803 if (!rtnl_trylock())
804 return restart_syscall();
805
806 ret = bond_option_num_peer_notif_set(bond, new_value);
807 if (!ret)
808 ret = count;
809
810 rtnl_unlock();
811 return ret;
795} 812}
796static DEVICE_ATTR(num_grat_arp, S_IRUGO | S_IWUSR, 813static DEVICE_ATTR(num_grat_arp, S_IRUGO | S_IWUSR,
797 bonding_show_num_peer_notif, bonding_store_num_peer_notif); 814 bonding_show_num_peer_notif, bonding_store_num_peer_notif);
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index c70ad9f02b1e..73538b7a45e1 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -461,6 +461,7 @@ int bond_option_fail_over_mac_set(struct bonding *bond, int fail_over_mac);
461int bond_option_xmit_hash_policy_set(struct bonding *bond, 461int bond_option_xmit_hash_policy_set(struct bonding *bond,
462 int xmit_hash_policy); 462 int xmit_hash_policy);
463int bond_option_resend_igmp_set(struct bonding *bond, int resend_igmp); 463int bond_option_resend_igmp_set(struct bonding *bond, int resend_igmp);
464int bond_option_num_peer_notif_set(struct bonding *bond, int num_peer_notif);
464struct net_device *bond_option_active_slave_get_rcu(struct bonding *bond); 465struct net_device *bond_option_active_slave_get_rcu(struct bonding *bond);
465struct net_device *bond_option_active_slave_get(struct bonding *bond); 466struct net_device *bond_option_active_slave_get(struct bonding *bond);
466 467