Commit 0f7bffd9 authored by Nikolay Aleksandrov's avatar Nikolay Aleksandrov Committed by David S. Miller

bonding: add tlb_dynamic_lb netlink support

tlb_dynamic_lb could be set only via sysfs, this patch allows it to be
set via netlink.
Signed-off-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b7a0925e
...@@ -111,6 +111,7 @@ static const struct nla_policy bond_policy[IFLA_BOND_MAX + 1] = { ...@@ -111,6 +111,7 @@ static const struct nla_policy bond_policy[IFLA_BOND_MAX + 1] = {
[IFLA_BOND_AD_USER_PORT_KEY] = { .type = NLA_U16 }, [IFLA_BOND_AD_USER_PORT_KEY] = { .type = NLA_U16 },
[IFLA_BOND_AD_ACTOR_SYSTEM] = { .type = NLA_BINARY, [IFLA_BOND_AD_ACTOR_SYSTEM] = { .type = NLA_BINARY,
.len = ETH_ALEN }, .len = ETH_ALEN },
[IFLA_BOND_TLB_DYNAMIC_LB] = { .type = NLA_U8 },
}; };
static const struct nla_policy bond_slave_policy[IFLA_BOND_SLAVE_MAX + 1] = { static const struct nla_policy bond_slave_policy[IFLA_BOND_SLAVE_MAX + 1] = {
...@@ -405,7 +406,6 @@ static int bond_changelink(struct net_device *bond_dev, ...@@ -405,7 +406,6 @@ static int bond_changelink(struct net_device *bond_dev,
if (err) if (err)
return err; return err;
} }
if (data[IFLA_BOND_AD_USER_PORT_KEY]) { if (data[IFLA_BOND_AD_USER_PORT_KEY]) {
int port_key = int port_key =
nla_get_u16(data[IFLA_BOND_AD_USER_PORT_KEY]); nla_get_u16(data[IFLA_BOND_AD_USER_PORT_KEY]);
...@@ -415,7 +415,6 @@ static int bond_changelink(struct net_device *bond_dev, ...@@ -415,7 +415,6 @@ static int bond_changelink(struct net_device *bond_dev,
if (err) if (err)
return err; return err;
} }
if (data[IFLA_BOND_AD_ACTOR_SYSTEM]) { if (data[IFLA_BOND_AD_ACTOR_SYSTEM]) {
if (nla_len(data[IFLA_BOND_AD_ACTOR_SYSTEM]) != ETH_ALEN) if (nla_len(data[IFLA_BOND_AD_ACTOR_SYSTEM]) != ETH_ALEN)
return -EINVAL; return -EINVAL;
...@@ -426,6 +425,15 @@ static int bond_changelink(struct net_device *bond_dev, ...@@ -426,6 +425,15 @@ static int bond_changelink(struct net_device *bond_dev,
if (err) if (err)
return err; return err;
} }
if (data[IFLA_BOND_TLB_DYNAMIC_LB]) {
int dynamic_lb = nla_get_u8(data[IFLA_BOND_TLB_DYNAMIC_LB]);
bond_opt_initval(&newval, dynamic_lb);
err = __bond_opt_set(bond, BOND_OPT_TLB_DYNAMIC_LB, &newval);
if (err)
return err;
}
return 0; return 0;
} }
...@@ -476,6 +484,7 @@ static size_t bond_get_size(const struct net_device *bond_dev) ...@@ -476,6 +484,7 @@ static size_t bond_get_size(const struct net_device *bond_dev)
nla_total_size(sizeof(u16)) + /* IFLA_BOND_AD_ACTOR_SYS_PRIO */ nla_total_size(sizeof(u16)) + /* IFLA_BOND_AD_ACTOR_SYS_PRIO */
nla_total_size(sizeof(u16)) + /* IFLA_BOND_AD_USER_PORT_KEY */ nla_total_size(sizeof(u16)) + /* IFLA_BOND_AD_USER_PORT_KEY */
nla_total_size(ETH_ALEN) + /* IFLA_BOND_AD_ACTOR_SYSTEM */ nla_total_size(ETH_ALEN) + /* IFLA_BOND_AD_ACTOR_SYSTEM */
nla_total_size(sizeof(u8)) + /* IFLA_BOND_TLB_DYNAMIC_LB */
0; 0;
} }
...@@ -598,6 +607,10 @@ static int bond_fill_info(struct sk_buff *skb, ...@@ -598,6 +607,10 @@ static int bond_fill_info(struct sk_buff *skb,
bond->params.ad_select)) bond->params.ad_select))
goto nla_put_failure; goto nla_put_failure;
if (nla_put_u8(skb, IFLA_BOND_TLB_DYNAMIC_LB,
bond->params.tlb_dynamic_lb))
goto nla_put_failure;
if (BOND_MODE(bond) == BOND_MODE_8023AD) { if (BOND_MODE(bond) == BOND_MODE_8023AD) {
struct ad_info info; struct ad_info info;
......
...@@ -434,6 +434,7 @@ enum { ...@@ -434,6 +434,7 @@ enum {
IFLA_BOND_AD_ACTOR_SYS_PRIO, IFLA_BOND_AD_ACTOR_SYS_PRIO,
IFLA_BOND_AD_USER_PORT_KEY, IFLA_BOND_AD_USER_PORT_KEY,
IFLA_BOND_AD_ACTOR_SYSTEM, IFLA_BOND_AD_ACTOR_SYSTEM,
IFLA_BOND_TLB_DYNAMIC_LB,
__IFLA_BOND_MAX, __IFLA_BOND_MAX,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment