diff options
Diffstat (limited to 'drivers/net/bonding/bond_sysfs.c')
-rw-r--r-- | drivers/net/bonding/bond_sysfs.c | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index cfe4dc3a93a3..ced9ed8f995a 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -51,6 +51,7 @@ extern struct bond_params bonding_defaults; | |||
51 | extern struct bond_parm_tbl bond_mode_tbl[]; | 51 | extern struct bond_parm_tbl bond_mode_tbl[]; |
52 | extern struct bond_parm_tbl bond_lacp_tbl[]; | 52 | extern struct bond_parm_tbl bond_lacp_tbl[]; |
53 | extern struct bond_parm_tbl xmit_hashtype_tbl[]; | 53 | extern struct bond_parm_tbl xmit_hashtype_tbl[]; |
54 | extern struct bond_parm_tbl arp_validate_tbl[]; | ||
54 | 55 | ||
55 | static int expected_refcount = -1; | 56 | static int expected_refcount = -1; |
56 | static struct class *netdev_class; | 57 | static struct class *netdev_class; |
@@ -503,6 +504,53 @@ out: | |||
503 | static CLASS_DEVICE_ATTR(xmit_hash_policy, S_IRUGO | S_IWUSR, bonding_show_xmit_hash, bonding_store_xmit_hash); | 504 | static CLASS_DEVICE_ATTR(xmit_hash_policy, S_IRUGO | S_IWUSR, bonding_show_xmit_hash, bonding_store_xmit_hash); |
504 | 505 | ||
505 | /* | 506 | /* |
507 | * Show and set arp_validate. | ||
508 | */ | ||
509 | static ssize_t bonding_show_arp_validate(struct class_device *cd, char *buf) | ||
510 | { | ||
511 | struct bonding *bond = to_bond(cd); | ||
512 | |||
513 | return sprintf(buf, "%s %d\n", | ||
514 | arp_validate_tbl[bond->params.arp_validate].modename, | ||
515 | bond->params.arp_validate) + 1; | ||
516 | } | ||
517 | |||
518 | static ssize_t bonding_store_arp_validate(struct class_device *cd, const char *buf, size_t count) | ||
519 | { | ||
520 | int new_value; | ||
521 | struct bonding *bond = to_bond(cd); | ||
522 | |||
523 | new_value = bond_parse_parm((char *)buf, arp_validate_tbl); | ||
524 | if (new_value < 0) { | ||
525 | printk(KERN_ERR DRV_NAME | ||
526 | ": %s: Ignoring invalid arp_validate value %s\n", | ||
527 | bond->dev->name, buf); | ||
528 | return -EINVAL; | ||
529 | } | ||
530 | if (new_value && (bond->params.mode != BOND_MODE_ACTIVEBACKUP)) { | ||
531 | printk(KERN_ERR DRV_NAME | ||
532 | ": %s: arp_validate only supported in active-backup mode.\n", | ||
533 | bond->dev->name); | ||
534 | return -EINVAL; | ||
535 | } | ||
536 | printk(KERN_INFO DRV_NAME ": %s: setting arp_validate to %s (%d).\n", | ||
537 | bond->dev->name, arp_validate_tbl[new_value].modename, | ||
538 | new_value); | ||
539 | |||
540 | if (!bond->params.arp_validate && new_value) { | ||
541 | bond_register_arp(bond); | ||
542 | } else if (bond->params.arp_validate && !new_value) { | ||
543 | bond_unregister_arp(bond); | ||
544 | } | ||
545 | |||
546 | bond->params.arp_validate = new_value; | ||
547 | |||
548 | return count; | ||
549 | } | ||
550 | |||
551 | static CLASS_DEVICE_ATTR(arp_validate, S_IRUGO | S_IWUSR, bonding_show_arp_validate, bonding_store_arp_validate); | ||
552 | |||
553 | /* | ||
506 | * Show and set the arp timer interval. There are two tricky bits | 554 | * Show and set the arp timer interval. There are two tricky bits |
507 | * here. First, if ARP monitoring is activated, then we must disable | 555 | * here. First, if ARP monitoring is activated, then we must disable |
508 | * MII monitoring. Second, if the ARP timer isn't running, we must | 556 | * MII monitoring. Second, if the ARP timer isn't running, we must |
@@ -914,6 +962,11 @@ static ssize_t bonding_store_miimon(struct class_device *cd, const char *buf, si | |||
914 | "ARP monitoring. Disabling ARP monitoring...\n", | 962 | "ARP monitoring. Disabling ARP monitoring...\n", |
915 | bond->dev->name); | 963 | bond->dev->name); |
916 | bond->params.arp_interval = 0; | 964 | bond->params.arp_interval = 0; |
965 | if (bond->params.arp_validate) { | ||
966 | bond_unregister_arp(bond); | ||
967 | bond->params.arp_validate = | ||
968 | BOND_ARP_VALIDATE_NONE; | ||
969 | } | ||
917 | /* Kill ARP timer, else it brings bond's link down */ | 970 | /* Kill ARP timer, else it brings bond's link down */ |
918 | if (bond->mii_timer.function) { | 971 | if (bond->mii_timer.function) { |
919 | printk(KERN_INFO DRV_NAME | 972 | printk(KERN_INFO DRV_NAME |
@@ -1093,7 +1146,7 @@ static ssize_t bonding_store_active_slave(struct class_device *cd, const char *b | |||
1093 | strlen(slave->dev->name)) == 0) { | 1146 | strlen(slave->dev->name)) == 0) { |
1094 | old_active = bond->curr_active_slave; | 1147 | old_active = bond->curr_active_slave; |
1095 | new_active = slave; | 1148 | new_active = slave; |
1096 | if (new_active && (new_active == old_active)) { | 1149 | if (new_active == old_active) { |
1097 | /* do nothing */ | 1150 | /* do nothing */ |
1098 | printk(KERN_INFO DRV_NAME | 1151 | printk(KERN_INFO DRV_NAME |
1099 | ": %s: %s is already the current active slave.\n", | 1152 | ": %s: %s is already the current active slave.\n", |
@@ -1273,6 +1326,7 @@ static CLASS_DEVICE_ATTR(ad_partner_mac, S_IRUGO, bonding_show_ad_partner_mac, N | |||
1273 | static struct attribute *per_bond_attrs[] = { | 1326 | static struct attribute *per_bond_attrs[] = { |
1274 | &class_device_attr_slaves.attr, | 1327 | &class_device_attr_slaves.attr, |
1275 | &class_device_attr_mode.attr, | 1328 | &class_device_attr_mode.attr, |
1329 | &class_device_attr_arp_validate.attr, | ||
1276 | &class_device_attr_arp_interval.attr, | 1330 | &class_device_attr_arp_interval.attr, |
1277 | &class_device_attr_arp_ip_target.attr, | 1331 | &class_device_attr_arp_ip_target.attr, |
1278 | &class_device_attr_downdelay.attr, | 1332 | &class_device_attr_downdelay.attr, |