diff options
author | Andy Gospodarek <andy@greyhouse.net> | 2010-06-02 04:39:21 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-06-05 05:23:17 -0400 |
commit | ebd8e4977a87cb81d93c62a9bff0102a9713722f (patch) | |
tree | c91a15f48f3156a5ff6d60fd879a97b7e789fe8a /drivers/net/bonding/bond_sysfs.c | |
parent | b78462ebc6a4ef9074aa80abebcdd470dc5f0ce0 (diff) |
bonding: add all_slaves_active parameter
v2: changed parameter name from 'keep_all' to 'all_slaves_active' and
skipped setting slaves to inactive rather than creating a new flag at
Jay's suggestion.
In an effort to suppress duplicate frames on certain bonding modes
(specifically the modes that do not require additional configuration on
the switch or switches connected to the host), code was added in the
generic receive patch in 2.6.16. The current behavior works quite well
for most users, but there are some times it would be nice to restore old
functionality and allow all frames to make their way up the stack.
This patch adds support for a new module option and sysfs file called
'all_slaves_active' that will restore pre-2.6.16 functionality if the
user desires. The default value is '0' and retains existing behavior,
but the user can set it to '1' and allow all frames up if desired.
Signed-off-by: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding/bond_sysfs.c')
-rw-r--r-- | drivers/net/bonding/bond_sysfs.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 496ac1ec614d..066311a5e084 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -1411,7 +1411,58 @@ static ssize_t bonding_show_ad_partner_mac(struct device *d, | |||
1411 | } | 1411 | } |
1412 | static DEVICE_ATTR(ad_partner_mac, S_IRUGO, bonding_show_ad_partner_mac, NULL); | 1412 | static DEVICE_ATTR(ad_partner_mac, S_IRUGO, bonding_show_ad_partner_mac, NULL); |
1413 | 1413 | ||
1414 | /* | ||
1415 | * Show and set the all_slaves_active flag. | ||
1416 | */ | ||
1417 | static ssize_t bonding_show_slaves_active(struct device *d, | ||
1418 | struct device_attribute *attr, | ||
1419 | char *buf) | ||
1420 | { | ||
1421 | struct bonding *bond = to_bond(d); | ||
1422 | |||
1423 | return sprintf(buf, "%d\n", bond->params.all_slaves_active); | ||
1424 | } | ||
1425 | |||
1426 | static ssize_t bonding_store_slaves_active(struct device *d, | ||
1427 | struct device_attribute *attr, | ||
1428 | const char *buf, size_t count) | ||
1429 | { | ||
1430 | int i, new_value, ret = count; | ||
1431 | struct bonding *bond = to_bond(d); | ||
1432 | struct slave *slave; | ||
1433 | |||
1434 | if (sscanf(buf, "%d", &new_value) != 1) { | ||
1435 | pr_err("%s: no all_slaves_active value specified.\n", | ||
1436 | bond->dev->name); | ||
1437 | ret = -EINVAL; | ||
1438 | goto out; | ||
1439 | } | ||
1440 | |||
1441 | if (new_value == bond->params.all_slaves_active) | ||
1442 | goto out; | ||
1443 | |||
1444 | if ((new_value == 0) || (new_value == 1)) { | ||
1445 | bond->params.all_slaves_active = new_value; | ||
1446 | } else { | ||
1447 | pr_info("%s: Ignoring invalid all_slaves_active value %d.\n", | ||
1448 | bond->dev->name, new_value); | ||
1449 | ret = -EINVAL; | ||
1450 | goto out; | ||
1451 | } | ||
1414 | 1452 | ||
1453 | bond_for_each_slave(bond, slave, i) { | ||
1454 | if (slave->state == BOND_STATE_BACKUP) { | ||
1455 | if (new_value) | ||
1456 | slave->dev->priv_flags &= ~IFF_SLAVE_INACTIVE; | ||
1457 | else | ||
1458 | slave->dev->priv_flags |= IFF_SLAVE_INACTIVE; | ||
1459 | } | ||
1460 | } | ||
1461 | out: | ||
1462 | return count; | ||
1463 | } | ||
1464 | static DEVICE_ATTR(all_slaves_active, S_IRUGO | S_IWUSR, | ||
1465 | bonding_show_slaves_active, bonding_store_slaves_active); | ||
1415 | 1466 | ||
1416 | static struct attribute *per_bond_attrs[] = { | 1467 | static struct attribute *per_bond_attrs[] = { |
1417 | &dev_attr_slaves.attr, | 1468 | &dev_attr_slaves.attr, |
@@ -1438,6 +1489,7 @@ static struct attribute *per_bond_attrs[] = { | |||
1438 | &dev_attr_ad_actor_key.attr, | 1489 | &dev_attr_ad_actor_key.attr, |
1439 | &dev_attr_ad_partner_key.attr, | 1490 | &dev_attr_ad_partner_key.attr, |
1440 | &dev_attr_ad_partner_mac.attr, | 1491 | &dev_attr_ad_partner_mac.attr, |
1492 | &dev_attr_all_slaves_active.attr, | ||
1441 | NULL, | 1493 | NULL, |
1442 | }; | 1494 | }; |
1443 | 1495 | ||