bonding: Allow setting and querying xmit policy regardless of mode

From: Wagner Ferenc <wferi@niif.hu>

For consistency with the behaviour of the arp_ip_target option,
let /sys/class/net/bond0/bonding/xmit_hash_policy accept and report
current policy even if the bonding mode in effect does not use it.

Signed-off-by: Ferenc Wagner <wferi@niif.hu>
Acked-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
This commit is contained in:
Wagner Ferenc 2007-12-06 23:40:32 -08:00 committed by Jeff Garzik
parent 1dcdcd6954
commit 8e4b932908

View file

@ -456,17 +456,11 @@ static ssize_t bonding_show_xmit_hash(struct device *d,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
int count = 0;
struct bonding *bond = to_bond(d); struct bonding *bond = to_bond(d);
if ((bond->params.mode == BOND_MODE_XOR) || return sprintf(buf, "%s %d\n",
(bond->params.mode == BOND_MODE_8023AD)) { xmit_hashtype_tbl[bond->params.xmit_policy].modename,
count = sprintf(buf, "%s %d\n", bond->params.xmit_policy);
xmit_hashtype_tbl[bond->params.xmit_policy].modename,
bond->params.xmit_policy);
}
return count;
} }
static ssize_t bonding_store_xmit_hash(struct device *d, static ssize_t bonding_store_xmit_hash(struct device *d,
@ -484,15 +478,6 @@ static ssize_t bonding_store_xmit_hash(struct device *d,
goto out; goto out;
} }
if ((bond->params.mode != BOND_MODE_XOR) &&
(bond->params.mode != BOND_MODE_8023AD)) {
printk(KERN_ERR DRV_NAME
"%s: Transmit hash policy is irrelevant in this mode.\n",
bond->dev->name);
ret = -EPERM;
goto out;
}
new_value = bond_parse_parm((char *)buf, xmit_hashtype_tbl); new_value = bond_parse_parm((char *)buf, xmit_hashtype_tbl);
if (new_value < 0) { if (new_value < 0) {
printk(KERN_ERR DRV_NAME printk(KERN_ERR DRV_NAME