Subject: Re: [PATCH net-next-2.6 3/3] bonding,ipv4,ipv6,vlan: Handle NETDEV_BONDING_FAILOVER like NETDEV_NOTIFY_PEERS

From: Brian Haley <[email-masked]>
Date: Mon, 18 Apr 2011 21:32:40 -0400

On 04/18/2011 03:09 PM, Ben Hutchings wrote:
> How about restoring the parameters like this:
> 
> ---
> From: Ben Hutchings <[email-masked]>
> Date: Mon, 18 Apr 2011 19:36:48 +0100
> Subject: [PATCH net-next-2.6] ipv4,ipv6,bonding: Restore control over number of peer notifications
> 
> For backward compatibility, we should retain the module parameters and
> sysfs attributes to control the number of peer notifications
> (gratuitous ARPs and unsolicited NAs) sent after bonding failover.
> Also, it is possible for failover to take place even though the new
> active slave does not have link up, and in that case the peer
> notification should be deferred until it does.
> 
> Change ipv4 and ipv6 so they do not automatically send peer
> notifications on bonding failover.  Change the bonding driver to send
> separate NETDEV_NOTIFY_PEERS notifications when the link is up, as
> many times as requested.  Since it does not directly control which
> protocols send notifications, make num_grat_arp and num_unsol_na
> aliases for a single parameter.

Hi Ben,

I think this looks good, I'll try and get this tested here when I have
a chance, but for now I can:

Acked-by: Brian Haley <[email-masked]>

Should we just go ahead and make a new parameter for peer notification?
Compiled but untested patch below.

Thanks,

-Brian

--
Make a new bonding parameter, called num_peer_notif, to control how
many peer notifications are sent on fail-over.  Mark the old values,
num_grat_arp and num_unsol_na, as deprecated in the documentation.

Signed-off-by: Brian Haley <[email-masked]>

diff --git a/Documentation/networking/bonding.txt b/Documentation/networking/bonding.txt
index 511b4e5..8b16beb 100644
--- a/Documentation/networking/bonding.txt
+++ b/Documentation/networking/bonding.txt
@@ -585,8 +585,15 @@ mode
 		chosen.
 
 num_grat_arp
+
+	Deprecated.  Use num_peer_notif instead.
+
 num_unsol_na
 
+	Deprecated.  Use num_peer_notif instead.
+
+num_peer_notif
+
 	Specify the number of peer notifications (gratuitous ARPs and
 	unsolicited IPv6 Neighbor Advertisements) to be issued after a
 	failover event.  As soon as the link is up on the new slave
@@ -595,7 +602,7 @@ num_unsol_na
 	each link monitor interval (arp_interval or miimon, whichever
 	is active) if the number is greater than 1.
 
-	These notifications are now generated by the ipv4 and ipv6 code
+	These notifications are now generated by the IPv4 and IPv6 code
 	and the numbers of repetitions cannot be set independently.
 
 	The valid range is 0 - 255; the default value is 1.  These options
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 956a6f7..631ca9e 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -116,6 +116,8 @@ module_param_named(num_grat_arp, num_peer_notif, int, 0644);
 MODULE_PARM_DESC(num_grat_arp, "Number of peer notifications to send on failover event");
 module_param_named(num_unsol_na, num_peer_notif, int, 0644);
 MODULE_PARM_DESC(num_unsol_na, "Number of peer notifications to send on failover event");
+module_param_named(num_peer_notif, num_peer_notif, int, 0644);
+MODULE_PARM_DESC(num_unsol_na, "Number of peer notifications to send on failover event");
 module_param(miimon, int, 0);
 MODULE_PARM_DESC(miimon, "Link check interval in milliseconds");
 module_param(updelay, int, 0);
@@ -4699,7 +4701,7 @@ static int bond_check_params(struct bond_params *params)
 	}
 
 	if (num_peer_notif < 0 || num_peer_notif > 255) {
-		pr_warning("Warning: num_grat_arp/num_unsol_na (%d) not in range 0-255 so it was reset to 1\n",
+		pr_warning("Warning: num_peer_notif (%d) not in range 0-255 so it was reset to 1\n",
 			   num_peer_notif);
 		num_peer_notif = 1;
 	}
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 58fb3e9..b03e7be 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -896,6 +896,8 @@ static DEVICE_ATTR(num_grat_arp, S_IRUGO | S_IWUSR,
 		   bonding_show_num_peer_notif, bonding_store_num_peer_notif);
 static DEVICE_ATTR(num_unsol_na, S_IRUGO | S_IWUSR,
 		   bonding_show_num_peer_notif, bonding_store_num_peer_notif);
+static DEVICE_ATTR(num_peer_notif, S_IRUGO | S_IWUSR,
+		   bonding_show_num_peer_notif, bonding_store_num_peer_notif);
 
 /*
  * Show and set the MII monitor interval.  There are two tricky bits
@@ -1598,6 +1600,7 @@ static struct attribute *per_bond_attrs[] = {
 	&dev_attr_xmit_hash_policy.attr,
 	&dev_attr_num_grat_arp.attr,
 	&dev_attr_num_unsol_na.attr,
+	&dev_attr_num_peer_notif.attr,
 	&dev_attr_miimon.attr,
 	&dev_attr_primary.attr,
 	&dev_attr_primary_reselect.attr,