diff options
author | Jay Vosburgh <fubar@us.ibm.com> | 2007-10-09 22:57:24 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-10-15 14:20:46 -0400 |
commit | dd957c57c52a3964b8446a3e868a08186274b628 (patch) | |
tree | e745b1d3cfe5fbcb4bc6b85084dd90a22e1a1da9 /drivers/net/bonding/bond_sysfs.c | |
parent | d90a162a4ee280201e84944a84f86d6728dc0c27 (diff) |
net/bonding: Optionally allow ethernet slaves to keep own MAC
Update the "don't change MAC of slaves" functionality added in
previous changes to be a generic option, rather than something tied to
IB devices, as it's occasionally useful for regular ethernet devices as
well.
Adds "fail_over_mac" option (which is automatically enabled for IB
slaves), applicable only to active-backup mode.
Includes documentation update.
Updates bonding driver version to 3.2.0.
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/bonding/bond_sysfs.c')
-rw-r--r-- | drivers/net/bonding/bond_sysfs.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index b5d2a13fe627..80c0c8c415ed 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -568,6 +568,54 @@ static ssize_t bonding_store_arp_validate(struct device *d, | |||
568 | static DEVICE_ATTR(arp_validate, S_IRUGO | S_IWUSR, bonding_show_arp_validate, bonding_store_arp_validate); | 568 | static DEVICE_ATTR(arp_validate, S_IRUGO | S_IWUSR, bonding_show_arp_validate, bonding_store_arp_validate); |
569 | 569 | ||
570 | /* | 570 | /* |
571 | * Show and store fail_over_mac. User only allowed to change the | ||
572 | * value when there are no slaves. | ||
573 | */ | ||
574 | static ssize_t bonding_show_fail_over_mac(struct device *d, struct device_attribute *attr, char *buf) | ||
575 | { | ||
576 | struct bonding *bond = to_bond(d); | ||
577 | |||
578 | return sprintf(buf, "%d\n", bond->params.fail_over_mac) + 1; | ||
579 | } | ||
580 | |||
581 | static ssize_t bonding_store_fail_over_mac(struct device *d, struct device_attribute *attr, const char *buf, size_t count) | ||
582 | { | ||
583 | int new_value; | ||
584 | int ret = count; | ||
585 | struct bonding *bond = to_bond(d); | ||
586 | |||
587 | if (bond->slave_cnt != 0) { | ||
588 | printk(KERN_ERR DRV_NAME | ||
589 | ": %s: Can't alter fail_over_mac with slaves in bond.\n", | ||
590 | bond->dev->name); | ||
591 | ret = -EPERM; | ||
592 | goto out; | ||
593 | } | ||
594 | |||
595 | if (sscanf(buf, "%d", &new_value) != 1) { | ||
596 | printk(KERN_ERR DRV_NAME | ||
597 | ": %s: no fail_over_mac value specified.\n", | ||
598 | bond->dev->name); | ||
599 | ret = -EINVAL; | ||
600 | goto out; | ||
601 | } | ||
602 | |||
603 | if ((new_value == 0) || (new_value == 1)) { | ||
604 | bond->params.fail_over_mac = new_value; | ||
605 | printk(KERN_INFO DRV_NAME ": %s: Setting fail_over_mac to %d.\n", | ||
606 | bond->dev->name, new_value); | ||
607 | } else { | ||
608 | printk(KERN_INFO DRV_NAME | ||
609 | ": %s: Ignoring invalid fail_over_mac value %d.\n", | ||
610 | bond->dev->name, new_value); | ||
611 | } | ||
612 | out: | ||
613 | return ret; | ||
614 | } | ||
615 | |||
616 | static DEVICE_ATTR(fail_over_mac, S_IRUGO | S_IWUSR, bonding_show_fail_over_mac, bonding_store_fail_over_mac); | ||
617 | |||
618 | /* | ||
571 | * Show and set the arp timer interval. There are two tricky bits | 619 | * Show and set the arp timer interval. There are two tricky bits |
572 | * here. First, if ARP monitoring is activated, then we must disable | 620 | * here. First, if ARP monitoring is activated, then we must disable |
573 | * MII monitoring. Second, if the ARP timer isn't running, we must | 621 | * MII monitoring. Second, if the ARP timer isn't running, we must |
@@ -1388,6 +1436,7 @@ static DEVICE_ATTR(ad_partner_mac, S_IRUGO, bonding_show_ad_partner_mac, NULL); | |||
1388 | static struct attribute *per_bond_attrs[] = { | 1436 | static struct attribute *per_bond_attrs[] = { |
1389 | &dev_attr_slaves.attr, | 1437 | &dev_attr_slaves.attr, |
1390 | &dev_attr_mode.attr, | 1438 | &dev_attr_mode.attr, |
1439 | &dev_attr_fail_over_mac.attr, | ||
1391 | &dev_attr_arp_validate.attr, | 1440 | &dev_attr_arp_validate.attr, |
1392 | &dev_attr_arp_interval.attr, | 1441 | &dev_attr_arp_interval.attr, |
1393 | &dev_attr_arp_ip_target.attr, | 1442 | &dev_attr_arp_ip_target.attr, |