aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_netlink.c
diff options
context:
space:
mode:
authorsfeldma@cumulusnetworks.com <sfeldma@cumulusnetworks.com>2013-12-15 19:42:12 -0500
committerDavid S. Miller <davem@davemloft.net>2013-12-17 16:08:45 -0500
commitf70161c67231f54f784529d7447ce4386d258b7a (patch)
tree62fa462795924d403b6fb03f8d3fccd54afd5162 /drivers/net/bonding/bond_netlink.c
parent89901972de4c00e74e56529804493734d77ee3d3 (diff)
bonding: add xmit_hash_policy attribute netlink support
Add IFLA_BOND_XMIT_HASH_POLICY to allow get/set of bonding parameter xmit_hash_policy 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_netlink.c')
-rw-r--r--drivers/net/bonding/bond_netlink.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/net/bonding/bond_netlink.c b/drivers/net/bonding/bond_netlink.c
index dc465ad3fb7c..67acd21a2170 100644
--- a/drivers/net/bonding/bond_netlink.c
+++ b/drivers/net/bonding/bond_netlink.c
@@ -35,6 +35,7 @@ static const struct nla_policy bond_policy[IFLA_BOND_MAX + 1] = {
35 [IFLA_BOND_PRIMARY] = { .type = NLA_U32 }, 35 [IFLA_BOND_PRIMARY] = { .type = NLA_U32 },
36 [IFLA_BOND_PRIMARY_RESELECT] = { .type = NLA_U8 }, 36 [IFLA_BOND_PRIMARY_RESELECT] = { .type = NLA_U8 },
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}; 39};
39 40
40static int bond_validate(struct nlattr *tb[], struct nlattr *data[]) 41static int bond_validate(struct nlattr *tb[], struct nlattr *data[])
@@ -186,6 +187,14 @@ static int bond_changelink(struct net_device *bond_dev,
186 if (err) 187 if (err)
187 return err; 188 return err;
188 } 189 }
190 if (data[IFLA_BOND_XMIT_HASH_POLICY]) {
191 int xmit_hash_policy =
192 nla_get_u8(data[IFLA_BOND_XMIT_HASH_POLICY]);
193
194 err = bond_option_xmit_hash_policy_set(bond, xmit_hash_policy);
195 if (err)
196 return err;
197 }
189 return 0; 198 return 0;
190} 199}
191 200
@@ -217,6 +226,7 @@ static size_t bond_get_size(const struct net_device *bond_dev)
217 nla_total_size(sizeof(u32)) + /* IFLA_BOND_PRIMARY */ 226 nla_total_size(sizeof(u32)) + /* IFLA_BOND_PRIMARY */
218 nla_total_size(sizeof(u8)) + /* IFLA_BOND_PRIMARY_RESELECT */ 227 nla_total_size(sizeof(u8)) + /* IFLA_BOND_PRIMARY_RESELECT */
219 nla_total_size(sizeof(u8)) + /* IFLA_BOND_FAIL_OVER_MAC */ 228 nla_total_size(sizeof(u8)) + /* IFLA_BOND_FAIL_OVER_MAC */
229 nla_total_size(sizeof(u8)) + /* IFLA_BOND_XMIT_HASH_POLICY */
220 0; 230 0;
221} 231}
222 232
@@ -289,6 +299,10 @@ static int bond_fill_info(struct sk_buff *skb,
289 bond->params.fail_over_mac)) 299 bond->params.fail_over_mac))
290 goto nla_put_failure; 300 goto nla_put_failure;
291 301
302 if (nla_put_u8(skb, IFLA_BOND_XMIT_HASH_POLICY,
303 bond->params.xmit_policy))
304 goto nla_put_failure;
305
292 return 0; 306 return 0;
293 307
294nla_put_failure: 308nla_put_failure: