Commit 94265cf5 authored by Flavio Leitner's avatar Flavio Leitner Committed by David S. Miller

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: default avatarFlavio Leitner <fbl@redhat.com>
Acked-by: default avatarRick Jones <rick.jones2@hp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9fe0617d
...@@ -770,8 +770,17 @@ resend_igmp ...@@ -770,8 +770,17 @@ resend_igmp
a failover event. One membership report is issued immediately after a failover event. One membership report is issued immediately after
the failover, subsequent packets are sent in each 200ms interval. the failover, subsequent packets are sent in each 200ms interval.
The valid range is 0 - 255; the default value is 1. This option The valid range is 0 - 255; the default value is 1. A value of 0
was added for bonding version 3.7.0. prevents the IGMP membership report from being issued in response
to the failover event.
This option is useful for bonding modes balance-rr (0), active-backup
(1), balance-tlb (5) and balance-alb (6), in which a failover can
switch the IGMP traffic from one slave to another. Therefore a fresh
IGMP report must be issued to cause the switch to forward the incoming
IGMP traffic over the newly selected slave.
This option was added for bonding version 3.7.0.
3. Configuring Bonding Devices 3. Configuring Bonding Devices
============================== ==============================
......
...@@ -852,7 +852,7 @@ static void bond_resend_igmp_join_requests(struct bonding *bond) ...@@ -852,7 +852,7 @@ static void bond_resend_igmp_join_requests(struct bonding *bond)
static void bond_resend_igmp_join_requests_delayed(struct work_struct *work) static void bond_resend_igmp_join_requests_delayed(struct work_struct *work)
{ {
struct bonding *bond = container_of(work, struct bonding, struct bonding *bond = container_of(work, struct bonding,
mcast_work.work); mcast_work.work);
bond_resend_igmp_join_requests(bond); bond_resend_igmp_join_requests(bond);
} }
...@@ -1172,10 +1172,12 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active) ...@@ -1172,10 +1172,12 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
} }
/* resend IGMP joins since active slave has changed or /* resend IGMP joins since active slave has changed or
* all were sent on curr_active_slave */ * all were sent on curr_active_slave.
if (((USES_PRIMARY(bond->params.mode) && new_active) || * resend only if bond is brought up with the affected
bond->params.mode == BOND_MODE_ROUNDROBIN) && * bonding modes and the retransmission is enabled */
netif_running(bond->dev)) { if (netif_running(bond->dev) && (bond->params.resend_igmp > 0) &&
((USES_PRIMARY(bond->params.mode) && new_active) ||
bond->params.mode == BOND_MODE_ROUNDROBIN)) {
bond->igmp_retrans = bond->params.resend_igmp; bond->igmp_retrans = bond->params.resend_igmp;
queue_delayed_work(bond->wq, &bond->mcast_work, 0); queue_delayed_work(bond->wq, &bond->mcast_work, 0);
} }
......
...@@ -1533,8 +1533,8 @@ static DEVICE_ATTR(all_slaves_active, S_IRUGO | S_IWUSR, ...@@ -1533,8 +1533,8 @@ static DEVICE_ATTR(all_slaves_active, S_IRUGO | S_IWUSR,
* Show and set the number of IGMP membership reports to send on link failure * Show and set the number of IGMP membership reports to send on link failure
*/ */
static ssize_t bonding_show_resend_igmp(struct device *d, static ssize_t bonding_show_resend_igmp(struct device *d,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct bonding *bond = to_bond(d); struct bonding *bond = to_bond(d);
...@@ -1542,8 +1542,8 @@ static ssize_t bonding_show_resend_igmp(struct device *d, ...@@ -1542,8 +1542,8 @@ static ssize_t bonding_show_resend_igmp(struct device *d,
} }
static ssize_t bonding_store_resend_igmp(struct device *d, static ssize_t bonding_store_resend_igmp(struct device *d,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
int new_value, ret = count; int new_value, ret = count;
struct bonding *bond = to_bond(d); struct bonding *bond = to_bond(d);
...@@ -1555,7 +1555,7 @@ static ssize_t bonding_store_resend_igmp(struct device *d, ...@@ -1555,7 +1555,7 @@ static ssize_t bonding_store_resend_igmp(struct device *d,
goto out; goto out;
} }
if (new_value < 0) { if (new_value < 0 || new_value > 255) {
pr_err("%s: Invalid resend_igmp value %d not in range 0-255; rejected.\n", pr_err("%s: Invalid resend_igmp value %d not in range 0-255; rejected.\n",
bond->dev->name, new_value); bond->dev->name, new_value);
ret = -EINVAL; ret = -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment