diff options
Diffstat (limited to 'drivers/net/bonding/bond_sysfs.c')
-rw-r--r-- | drivers/net/bonding/bond_sysfs.c | 97 |
1 files changed, 53 insertions, 44 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 1c9e09fbdff8..ea7a388f4843 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -183,6 +183,11 @@ int bond_create_slave_symlinks(struct net_device *master, | |||
183 | sprintf(linkname, "slave_%s", slave->name); | 183 | sprintf(linkname, "slave_%s", slave->name); |
184 | ret = sysfs_create_link(&(master->dev.kobj), &(slave->dev.kobj), | 184 | ret = sysfs_create_link(&(master->dev.kobj), &(slave->dev.kobj), |
185 | linkname); | 185 | linkname); |
186 | |||
187 | /* free the master link created earlier in case of error */ | ||
188 | if (ret) | ||
189 | sysfs_remove_link(&(slave->dev.kobj), "master"); | ||
190 | |||
186 | return ret; | 191 | return ret; |
187 | 192 | ||
188 | } | 193 | } |
@@ -522,7 +527,7 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
522 | goto out; | 527 | goto out; |
523 | } | 528 | } |
524 | if (new_value < 0) { | 529 | if (new_value < 0) { |
525 | pr_err("%s: Invalid arp_interval value %d not in range 1-%d; rejected.\n", | 530 | pr_err("%s: Invalid arp_interval value %d not in range 0-%d; rejected.\n", |
526 | bond->dev->name, new_value, INT_MAX); | 531 | bond->dev->name, new_value, INT_MAX); |
527 | ret = -EINVAL; | 532 | ret = -EINVAL; |
528 | goto out; | 533 | goto out; |
@@ -537,14 +542,15 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
537 | pr_info("%s: Setting ARP monitoring interval to %d.\n", | 542 | pr_info("%s: Setting ARP monitoring interval to %d.\n", |
538 | bond->dev->name, new_value); | 543 | bond->dev->name, new_value); |
539 | bond->params.arp_interval = new_value; | 544 | bond->params.arp_interval = new_value; |
540 | if (bond->params.miimon) { | 545 | if (new_value) { |
541 | pr_info("%s: ARP monitoring cannot be used with MII monitoring. %s Disabling MII monitoring.\n", | 546 | if (bond->params.miimon) { |
542 | bond->dev->name, bond->dev->name); | 547 | pr_info("%s: ARP monitoring cannot be used with MII monitoring. %s Disabling MII monitoring.\n", |
543 | bond->params.miimon = 0; | 548 | bond->dev->name, bond->dev->name); |
544 | } | 549 | bond->params.miimon = 0; |
545 | if (!bond->params.arp_targets[0]) { | 550 | } |
546 | pr_info("%s: ARP monitoring has been set up, but no ARP targets have been specified.\n", | 551 | if (!bond->params.arp_targets[0]) |
547 | bond->dev->name); | 552 | pr_info("%s: ARP monitoring has been set up, but no ARP targets have been specified.\n", |
553 | bond->dev->name); | ||
548 | } | 554 | } |
549 | if (bond->dev->flags & IFF_UP) { | 555 | if (bond->dev->flags & IFF_UP) { |
550 | /* If the interface is up, we may need to fire off | 556 | /* If the interface is up, we may need to fire off |
@@ -552,10 +558,13 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
552 | * timer will get fired off when the open function | 558 | * timer will get fired off when the open function |
553 | * is called. | 559 | * is called. |
554 | */ | 560 | */ |
555 | cancel_delayed_work_sync(&bond->mii_work); | 561 | if (!new_value) { |
556 | queue_delayed_work(bond->wq, &bond->arp_work, 0); | 562 | cancel_delayed_work_sync(&bond->arp_work); |
563 | } else { | ||
564 | cancel_delayed_work_sync(&bond->mii_work); | ||
565 | queue_delayed_work(bond->wq, &bond->arp_work, 0); | ||
566 | } | ||
557 | } | 567 | } |
558 | |||
559 | out: | 568 | out: |
560 | rtnl_unlock(); | 569 | rtnl_unlock(); |
561 | return ret; | 570 | return ret; |
@@ -697,7 +706,7 @@ static ssize_t bonding_store_downdelay(struct device *d, | |||
697 | } | 706 | } |
698 | if (new_value < 0) { | 707 | if (new_value < 0) { |
699 | pr_err("%s: Invalid down delay value %d not in range %d-%d; rejected.\n", | 708 | pr_err("%s: Invalid down delay value %d not in range %d-%d; rejected.\n", |
700 | bond->dev->name, new_value, 1, INT_MAX); | 709 | bond->dev->name, new_value, 0, INT_MAX); |
701 | ret = -EINVAL; | 710 | ret = -EINVAL; |
702 | goto out; | 711 | goto out; |
703 | } else { | 712 | } else { |
@@ -752,8 +761,8 @@ static ssize_t bonding_store_updelay(struct device *d, | |||
752 | goto out; | 761 | goto out; |
753 | } | 762 | } |
754 | if (new_value < 0) { | 763 | if (new_value < 0) { |
755 | pr_err("%s: Invalid down delay value %d not in range %d-%d; rejected.\n", | 764 | pr_err("%s: Invalid up delay value %d not in range %d-%d; rejected.\n", |
756 | bond->dev->name, new_value, 1, INT_MAX); | 765 | bond->dev->name, new_value, 0, INT_MAX); |
757 | ret = -EINVAL; | 766 | ret = -EINVAL; |
758 | goto out; | 767 | goto out; |
759 | } else { | 768 | } else { |
@@ -963,37 +972,37 @@ static ssize_t bonding_store_miimon(struct device *d, | |||
963 | } | 972 | } |
964 | if (new_value < 0) { | 973 | if (new_value < 0) { |
965 | pr_err("%s: Invalid miimon value %d not in range %d-%d; rejected.\n", | 974 | pr_err("%s: Invalid miimon value %d not in range %d-%d; rejected.\n", |
966 | bond->dev->name, new_value, 1, INT_MAX); | 975 | bond->dev->name, new_value, 0, INT_MAX); |
967 | ret = -EINVAL; | 976 | ret = -EINVAL; |
968 | goto out; | 977 | goto out; |
969 | } else { | 978 | } |
970 | pr_info("%s: Setting MII monitoring interval to %d.\n", | 979 | pr_info("%s: Setting MII monitoring interval to %d.\n", |
971 | bond->dev->name, new_value); | 980 | bond->dev->name, new_value); |
972 | bond->params.miimon = new_value; | 981 | bond->params.miimon = new_value; |
973 | if (bond->params.updelay) | 982 | if (bond->params.updelay) |
974 | pr_info("%s: Note: Updating updelay (to %d) since it is a multiple of the miimon value.\n", | 983 | pr_info("%s: Note: Updating updelay (to %d) since it is a multiple of the miimon value.\n", |
975 | bond->dev->name, | 984 | bond->dev->name, |
976 | bond->params.updelay * bond->params.miimon); | 985 | bond->params.updelay * bond->params.miimon); |
977 | if (bond->params.downdelay) | 986 | if (bond->params.downdelay) |
978 | pr_info("%s: Note: Updating downdelay (to %d) since it is a multiple of the miimon value.\n", | 987 | pr_info("%s: Note: Updating downdelay (to %d) since it is a multiple of the miimon value.\n", |
979 | bond->dev->name, | 988 | bond->dev->name, |
980 | bond->params.downdelay * bond->params.miimon); | 989 | bond->params.downdelay * bond->params.miimon); |
981 | if (bond->params.arp_interval) { | 990 | if (new_value && bond->params.arp_interval) { |
982 | pr_info("%s: MII monitoring cannot be used with ARP monitoring. Disabling ARP monitoring...\n", | 991 | pr_info("%s: MII monitoring cannot be used with ARP monitoring. Disabling ARP monitoring...\n", |
983 | bond->dev->name); | 992 | bond->dev->name); |
984 | bond->params.arp_interval = 0; | 993 | bond->params.arp_interval = 0; |
985 | if (bond->params.arp_validate) { | 994 | if (bond->params.arp_validate) |
986 | bond->params.arp_validate = | 995 | bond->params.arp_validate = BOND_ARP_VALIDATE_NONE; |
987 | BOND_ARP_VALIDATE_NONE; | 996 | } |
988 | } | 997 | if (bond->dev->flags & IFF_UP) { |
989 | } | 998 | /* If the interface is up, we may need to fire off |
990 | 999 | * the MII timer. If the interface is down, the | |
991 | if (bond->dev->flags & IFF_UP) { | 1000 | * timer will get fired off when the open function |
992 | /* If the interface is up, we may need to fire off | 1001 | * is called. |
993 | * the MII timer. If the interface is down, the | 1002 | */ |
994 | * timer will get fired off when the open function | 1003 | if (!new_value) { |
995 | * is called. | 1004 | cancel_delayed_work_sync(&bond->mii_work); |
996 | */ | 1005 | } else { |
997 | cancel_delayed_work_sync(&bond->arp_work); | 1006 | cancel_delayed_work_sync(&bond->arp_work); |
998 | queue_delayed_work(bond->wq, &bond->mii_work, 0); | 1007 | queue_delayed_work(bond->wq, &bond->mii_work, 0); |
999 | } | 1008 | } |