bonding: allow xmit hash policy change while bond dev is up
Since the xmit_hash_policy pointer is always valid and not dependent on anything, we can change it while the bond device is up and running. The only downside would be the out of order packets but that is a small price to pay. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
1a9561a3bd
commit
53edee2cfb
@@ -383,20 +383,12 @@ static ssize_t bonding_store_xmit_hash(struct device *d,
|
|||||||
int new_value, ret = count;
|
int new_value, ret = count;
|
||||||
struct bonding *bond = to_bond(d);
|
struct bonding *bond = to_bond(d);
|
||||||
|
|
||||||
if (bond->dev->flags & IFF_UP) {
|
|
||||||
pr_err("%s: Interface is up. Unable to update xmit policy.\n",
|
|
||||||
bond->dev->name);
|
|
||||||
ret = -EPERM;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
new_value = bond_parse_parm(buf, xmit_hashtype_tbl);
|
new_value = bond_parse_parm(buf, xmit_hashtype_tbl);
|
||||||
if (new_value < 0) {
|
if (new_value < 0) {
|
||||||
pr_err("%s: Ignoring invalid xmit hash policy value %.*s.\n",
|
pr_err("%s: Ignoring invalid xmit hash policy value %.*s.\n",
|
||||||
bond->dev->name,
|
bond->dev->name,
|
||||||
(int)strlen(buf) - 1, buf);
|
(int)strlen(buf) - 1, buf);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out;
|
|
||||||
} else {
|
} else {
|
||||||
bond->params.xmit_policy = new_value;
|
bond->params.xmit_policy = new_value;
|
||||||
bond_set_mode_ops(bond, bond->params.mode);
|
bond_set_mode_ops(bond, bond->params.mode);
|
||||||
@@ -404,7 +396,7 @@ static ssize_t bonding_store_xmit_hash(struct device *d,
|
|||||||
bond->dev->name,
|
bond->dev->name,
|
||||||
xmit_hashtype_tbl[new_value].modename, new_value);
|
xmit_hashtype_tbl[new_value].modename, new_value);
|
||||||
}
|
}
|
||||||
out:
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
static DEVICE_ATTR(xmit_hash_policy, S_IRUGO | S_IWUSR,
|
static DEVICE_ATTR(xmit_hash_policy, S_IRUGO | S_IWUSR,
|
||||||
|
Reference in New Issue
Block a user