diff options
author | Flavio Leitner <fbl@redhat.com> | 2011-05-25 04:38:58 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-05-25 17:55:33 -0400 |
commit | 94265cf5f731c7df29fdfde262ca3e6d51e6828c (patch) | |
tree | e19d43a5e8b19a220a4258a5a9f30d63ffc4bf55 | |
parent | 9fe0617d9b6d21f700ee9e658e1c9fe3be2fb402 (diff) |
bonding: documentation and code cleanup for resend_igmp
Improves the documentation about how IGMP resend parameter
works, fix two missing checks and coding style issues.
Signed-off-by: Flavio Leitner <fbl@redhat.com>
Acked-by: Rick Jones <rick.jones2@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | Documentation/networking/bonding.txt | 13 | ||||
-rw-r--r-- | drivers/net/bonding/bond_main.c | 12 | ||||
-rw-r--r-- | drivers/net/bonding/bond_sysfs.c | 10 |
3 files changed, 23 insertions, 12 deletions
diff --git a/Documentation/networking/bonding.txt b/Documentation/networking/bonding.txt index 1f45bd887d65..675612ff41ae 100644 --- a/Documentation/networking/bonding.txt +++ b/Documentation/networking/bonding.txt | |||
@@ -770,8 +770,17 @@ resend_igmp | |||
770 | a failover event. One membership report is issued immediately after | 770 | a failover event. One membership report is issued immediately after |
771 | the failover, subsequent packets are sent in each 200ms interval. | 771 | the failover, subsequent packets are sent in each 200ms interval. |
772 | 772 | ||
773 | The valid range is 0 - 255; the default value is 1. This option | 773 | The valid range is 0 - 255; the default value is 1. A value of 0 |
774 | was added for bonding version 3.7.0. | 774 | prevents the IGMP membership report from being issued in response |
775 | to the failover event. | ||
776 | |||
777 | This option is useful for bonding modes balance-rr (0), active-backup | ||
778 | (1), balance-tlb (5) and balance-alb (6), in which a failover can | ||
779 | switch the IGMP traffic from one slave to another. Therefore a fresh | ||
780 | IGMP report must be issued to cause the switch to forward the incoming | ||
781 | IGMP traffic over the newly selected slave. | ||
782 | |||
783 | This option was added for bonding version 3.7.0. | ||
775 | 784 | ||
776 | 3. Configuring Bonding Devices | 785 | 3. Configuring Bonding Devices |
777 | ============================== | 786 | ============================== |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 9ec4a505a79f..6141667c5fb7 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -852,7 +852,7 @@ static void bond_resend_igmp_join_requests(struct bonding *bond) | |||
852 | static void bond_resend_igmp_join_requests_delayed(struct work_struct *work) | 852 | static void bond_resend_igmp_join_requests_delayed(struct work_struct *work) |
853 | { | 853 | { |
854 | struct bonding *bond = container_of(work, struct bonding, | 854 | struct bonding *bond = container_of(work, struct bonding, |
855 | mcast_work.work); | 855 | mcast_work.work); |
856 | bond_resend_igmp_join_requests(bond); | 856 | bond_resend_igmp_join_requests(bond); |
857 | } | 857 | } |
858 | 858 | ||
@@ -1172,10 +1172,12 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active) | |||
1172 | } | 1172 | } |
1173 | 1173 | ||
1174 | /* resend IGMP joins since active slave has changed or | 1174 | /* resend IGMP joins since active slave has changed or |
1175 | * all were sent on curr_active_slave */ | 1175 | * all were sent on curr_active_slave. |
1176 | if (((USES_PRIMARY(bond->params.mode) && new_active) || | 1176 | * resend only if bond is brought up with the affected |
1177 | bond->params.mode == BOND_MODE_ROUNDROBIN) && | 1177 | * bonding modes and the retransmission is enabled */ |
1178 | netif_running(bond->dev)) { | 1178 | if (netif_running(bond->dev) && (bond->params.resend_igmp > 0) && |
1179 | ((USES_PRIMARY(bond->params.mode) && new_active) || | ||
1180 | bond->params.mode == BOND_MODE_ROUNDROBIN)) { | ||
1179 | bond->igmp_retrans = bond->params.resend_igmp; | 1181 | bond->igmp_retrans = bond->params.resend_igmp; |
1180 | queue_delayed_work(bond->wq, &bond->mcast_work, 0); | 1182 | queue_delayed_work(bond->wq, &bond->mcast_work, 0); |
1181 | } | 1183 | } |
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index bb1319f9f173..88fcb25e554a 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -1533,8 +1533,8 @@ static DEVICE_ATTR(all_slaves_active, S_IRUGO | S_IWUSR, | |||
1533 | * Show and set the number of IGMP membership reports to send on link failure | 1533 | * Show and set the number of IGMP membership reports to send on link failure |
1534 | */ | 1534 | */ |
1535 | static ssize_t bonding_show_resend_igmp(struct device *d, | 1535 | static ssize_t bonding_show_resend_igmp(struct device *d, |
1536 | struct device_attribute *attr, | 1536 | struct device_attribute *attr, |
1537 | char *buf) | 1537 | char *buf) |
1538 | { | 1538 | { |
1539 | struct bonding *bond = to_bond(d); | 1539 | struct bonding *bond = to_bond(d); |
1540 | 1540 | ||
@@ -1542,8 +1542,8 @@ static ssize_t bonding_show_resend_igmp(struct device *d, | |||
1542 | } | 1542 | } |
1543 | 1543 | ||
1544 | static ssize_t bonding_store_resend_igmp(struct device *d, | 1544 | static ssize_t bonding_store_resend_igmp(struct device *d, |
1545 | struct device_attribute *attr, | 1545 | struct device_attribute *attr, |
1546 | const char *buf, size_t count) | 1546 | const char *buf, size_t count) |
1547 | { | 1547 | { |
1548 | int new_value, ret = count; | 1548 | int new_value, ret = count; |
1549 | struct bonding *bond = to_bond(d); | 1549 | struct bonding *bond = to_bond(d); |
@@ -1555,7 +1555,7 @@ static ssize_t bonding_store_resend_igmp(struct device *d, | |||
1555 | goto out; | 1555 | goto out; |
1556 | } | 1556 | } |
1557 | 1557 | ||
1558 | if (new_value < 0) { | 1558 | if (new_value < 0 || new_value > 255) { |
1559 | pr_err("%s: Invalid resend_igmp value %d not in range 0-255; rejected.\n", | 1559 | pr_err("%s: Invalid resend_igmp value %d not in range 0-255; rejected.\n", |
1560 | bond->dev->name, new_value); | 1560 | bond->dev->name, new_value); |
1561 | ret = -EINVAL; | 1561 | ret = -EINVAL; |