Skip to contentSkip to conversation

bonding: make IGMP flooding on active-backup bonds configurable

PATCH In review Andy Gospodarek 2 participants 5 messages Feb 28, 2007 – Mar 1, 2007

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bonding: make IGMP flooding on active-backup bonds configurable

A while back the following change was made to the bonding code:

commit df49898a47061e82219c991dfbe9ac6ddf7a866b

Author: John W. Linville <[email protected]>
Date:   Tue Oct 18 21:30:58 2005 -0400

[PATCH] bonding: cleanup comment for mode 1 IGMP xmit hack

Expand comment explaining MAC address selection for replicated IGMP frames transmitted in bonding mode 1 (active-backup). Also, a small whitespace cleanup.

In general this patch is good, but this tweaks that feature by allowing that functionality to be enabled and disabled. This patch adds a new module option as well as a sysfs entry. It sets the default to be the current behavior so existing users shouldn't notice any difference.

---

 drivers/net/bonding/bond_main.c  |   65 +++++++++++++++++++++++++++++++--------
 drivers/net/bonding/bond_sysfs.c |   46 +++++++++++++++++++++++++++
 drivers/net/bonding/bonding.h    |    1
 include/linux/if_bonding.h       |    3 +
 4 files changed, 102 insertions(+), 13 deletions(-)
drivers/net/bonding/bond_main.c +52 -13
index a7c8f98..b531d4a 100644
@@ -96,6 +96,7 @@ static char *xmit_hash_policy = NULL;
 static int arp_interval = BOND_LINK_ARP_INTERV;
 static char *arp_ip_target[BOND_MAX_ARP_TARGETS] = { NULL, };
 static char *arp_validate = NULL;
+static char *igmp_flood = NULL;
 struct bond_params bonding_defaults;
 
 module_param(max_bonds, int, 0);
@@ -129,6 +130,8 @@ module_param_array(arp_ip_target, charp, NULL, 0);
 MODULE_PARM_DESC(arp_ip_target, "arp targets in n.n.n.n form");
 module_param(arp_validate, charp, 0);
 MODULE_PARM_DESC(arp_validate, "validate src/dst of ARP probes: none (default), active, backup or all");
+module_param(igmp_flood, charp, 0);
+MODULE_PARM_DESC(igmp_flood, "flood IGMP control traffic on active-backup bonding: yes (default) or no");
 
 /*----------------------------- Global variables ----------------------------*/
 
@@ -180,6 +183,12 @@ struct bond_parm_tbl arp_validate_tbl[] = {
 {	NULL,			-1},
 };
 
+struct bond_parm_tbl igmp_flood_tbl[] = {
+{	"no",			BOND_IGMP_ACTIVEONLY},
+{	"yes",			BOND_IGMP_ALLMEMBERS},
+{	NULL,			-1},
+};
+
 /*-------------------------- Forward declarations ---------------------------*/
 
 static void bond_send_gratuitous_arp(struct bonding *bond);
@@ -3070,6 +3079,9 @@ static void bond_info_show_slave(struct seq_file *seq, const struct slave *slave
 		   slave->perm_hwaddr[2], slave->perm_hwaddr[3],
 		   slave->perm_hwaddr[4], slave->perm_hwaddr[5]);
 
+	seq_printf(seq, "IGMP Flood: %s\n", (bond->params.igmp_flood) ? 
+					    "yes" : "no");
+						
 	if (bond->params.mode == BOND_MODE_8023AD) {
 		const struct aggregator *agg
 			= SLAVE_AD_INFO(slave).port.aggregator;
@@ -4067,19 +4079,24 @@ static int bond_xmit_activebackup(struct sk_buff *skb, struct net_device *bond_d
 	if (!bond->curr_active_slave)
 		goto out;
 
-	/* Xmit IGMP frames on all slaves to ensure rapid fail-over
-	   for multicast traffic on snooping switches */
-	if (skb->protocol == __constant_htons(ETH_P_IP) &&
-	    skb->nh.iph->protocol == IPPROTO_IGMP) {
-		struct slave *slave, *active_slave;
-		int i;
-
-		active_slave = bond->curr_active_slave;
-		bond_for_each_slave_from_to(bond, slave, i, active_slave->next,
-		                            active_slave->prev)
-			if (IS_UP(slave->dev) &&
-			    (slave->link == BOND_LINK_UP))
-				bond_activebackup_xmit_copy(skb, bond, slave);
+	/* Let's make this behavior optional since it causes problems
+	   when the links are connected to different switches. */
+	if (bond->params.igmp_flood) {
+
+		/* Xmit IGMP frames on all slaves to ensure rapid fail-over
+		   for multicast traffic on snooping switches */
+		if (skb->protocol == __constant_htons(ETH_P_IP) &&
+		    skb->nh.iph->protocol == IPPROTO_IGMP) {
+			struct slave *slave, *active_slave;
+			int i;
+
+			active_slave = bond->curr_active_slave;
+			bond_for_each_slave_from_to(bond, slave, i, active_slave->next,
+			                            active_slave->prev)
+				if (IS_UP(slave->dev) &&
+				    (slave->link == BOND_LINK_UP))
+					bond_activebackup_xmit_copy(skb, bond, slave);
+		}
 	}
 
 	res = bond_dev_queue_xmit(bond, skb, bond->curr_active_slave->dev);
@@ -4409,6 +4426,7 @@ int bond_parse_parm(char *mode_arg, struct bond_parm_tbl *tbl)
 static int bond_check_params(struct bond_params *params)
 {
 	int arp_validate_value;
+	int igmp_flood_value;
 
 	/*
 	 * Convert string parameters.
@@ -4636,6 +4654,26 @@ static int bond_check_params(struct bond_params *params)
 	} else
 		arp_validate_value = 0;
 
+	if (igmp_flood) {
+		if (bond_mode != BOND_MODE_ACTIVEBACKUP) {
+			printk(KERN_WARNING DRV_NAME
+		": igmp_flood only supported in active-backup mode\n");
+			return -EINVAL;
+		}
+		igmp_flood_value = bond_parse_parm(igmp_flood,
+						   igmp_flood_tbl);
+
+		if (igmp_flood_value == -1) {
+			printk(KERN_ERR DRV_NAME
+			       ": Error: invalid igmp_flood \"%s\"\n",
+			       igmp_flood == NULL ? "NULL" : igmp_flood);
+			return -EINVAL;
+		}	
+	}
+	else
+		igmp_flood_value = 1;
+
+
 	if (miimon) {
 		printk(KERN_INFO DRV_NAME
 		       ": MII link monitoring set to %d ms\n",
@@ -4687,6 +4725,7 @@ static int bond_check_params(struct bond_params *params)
 	params->use_carrier = use_carrier;
 	params->lacp_fast = lacp_fast;
 	params->primary[0] = 0;
+	params->igmp_flood = igmp_flood_value;
 
 	if (primary) {
 		strncpy(params->primary, primary, IFNAMSIZ);
drivers/net/bonding/bonding.h +1 -0
index 41aa78b..abb34d5 100644
@@ -131,6 +131,7 @@ struct bond_params {
 	int updelay;
 	int downdelay;
 	int lacp_fast;
+	int igmp_flood;
 	char primary[IFNAMSIZ];
 	u32 arp_targets[BOND_MAX_ARP_TARGETS];
 };
include/linux/if_bonding.h +3 -0
index 84598fa..3be5598 100644
@@ -87,6 +87,9 @@
 #define BOND_XMIT_POLICY_LAYER2		0 /* layer 2 (MAC only), default */
 #define BOND_XMIT_POLICY_LAYER34	1 /* layer 3+4 (IP ^ MAC) */
 
+#define BOND_IGMP_ACTIVEONLY		0
+#define BOND_IGMP_ALLMEMBERS		1
+
 typedef struct ifbond {
 	__s32 bond_mode;
 	__s32 num_slaves;
drivers/net/bonding/bond_sysfs.c +46 -0

64 lines not on this page · raw message

#1 lore raw
Quoted 12 lines · Andy Gospodarek

A while back the following change was made to the bonding code:

commit df49898a47061e82219c991dfbe9ac6ddf7a866b

Author: John W. Linville <[email protected]>
Date:   Tue Oct 18 21:30:58 2005 -0400

[PATCH] bonding: cleanup comment for mode 1 IGMP xmit hack

Expand comment explaining MAC address selection for replicated IGMP frames transmitted in bonding mode 1 (active-backup). Also, a small whitespace cleanup.

Quoted 7 lines

In general this patch is good, but this tweaks that feature by allowing that functionality to be enabled and disabled. This patch adds a new module option as well as a sysfs entry. It sets the default to be the current behavior so existing users shouldn't notice any difference.

Why would you want to turn this off?

Also, I've got a replacement patch for this functionality that
seems to be better in all regards. It sends bonus IGMP joins when a failover occurs, rather than simply duplicating them on all slaves (the current system can leave switches in the dark if the slaves fail back to the originals). As chance would have it, I'm planning to post it as part of a set in a a little while.

	-J

---
-Jay Vosburgh, IBM Linux Technology Center, [email protected]

#2 lore raw
Quoted 17 lines · Jay Vosburgh
Quoted 15 lines · Andy Gospodarek

A while back the following change was made to the bonding code:

commit df49898a47061e82219c991dfbe9ac6ddf7a866b

Author: John W. Linville <[email protected]>
Date:   Tue Oct 18 21:30:58 2005 -0400

[PATCH] bonding: cleanup comment for mode 1 IGMP xmit hack

Expand comment explaining MAC address selection for replicated IGMP frames transmitted in bonding mode 1 (active-backup). Also, a small whitespace cleanup.

Quoted 7 lines
Quoted 4 lines

In general this patch is good, but this tweaks that feature by allowing that functionality to be enabled and disabled. This patch adds a new module option as well as a sysfs entry. It sets the default to be the current behavior so existing users shouldn't notice any difference.

Why would you want to turn this off?

When you connect active-backup bonds to 2 separate switches that are in 'distant' parts of the network you can end up with a bunch of unwanted multicast data flowing everywhere and if you don't care whether or not your multicast traffic is highly available then it just seems like noise. I thought the flexibility seemed nice.

Quoted 7 lines

Also, I've got a replacement patch for this functionality that
seems to be better in all regards. It sends bonus IGMP joins when a failover occurs, rather than simply duplicating them on all slaves (the current system can leave switches in the dark if the slaves fail back to the originals). As chance would have it, I'm planning to post it as part of a set in a a little while.

That sounds like a nice add-on to the existing functionality. I can see the value in something dynamic like that, but I can also see the value in something static like the functionality we have. Did you plan to keep the existing functionality intact or just have it done dynamically?

Is this separate from your workqueue/refactoring patch or does it work on the existing code?

Quoted 7 lines
	-J

---
-Jay Vosburgh, IBM Linux Technology Center, [email protected]
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [email protected]> More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 1 line · Andy Gospodarek

On Wed, Feb 28, 2007 at 02:39:42PM -0800, Jay Vosburgh wrote:

[...]

Quoted 7 lines
Quoted 1 line

Why would you want to turn this off?

When you connect active-backup bonds to 2 separate switches that are in 'distant' parts of the network you can end up with a bunch of unwanted multicast data flowing everywhere and if you don't care whether or not your multicast traffic is highly available then it just seems like noise. I thought the flexibility seemed nice.

Ok, I can buy the "multicast spew" argument.

Quoted 8 lines
Quoted 7 lines

Also, I've got a replacement patch for this functionality that
seems to be better in all regards. It sends bonus IGMP joins when a failover occurs, rather than simply duplicating them on all slaves (the current system can leave switches in the dark if the slaves fail back to the originals). As chance would have it, I'm planning to post it as part of a set in a a little while.

Quoted 4 lines

That sounds like a nice add-on to the existing functionality. I can see the value in something dynamic like that, but I can also see the value in something static like the functionality we have. Did you plan to keep the existing functionality intact or just have it done dynamically?

Well, I posted the patch just a bit ago, so you can see for
yourself, but no, it removes the existing "copy IGMP everywhere" behavior. I couldn't really think of an advantage to flooding everywhere all the time if the hose is re-aimed during failover (if you'll pardon my cheesy metaphor).

Quoted 2 lines

Is this separate from your workqueue/refactoring patch or does it work on the existing code?

	This is separate, for the current mainline.

	-J

---
-Jay Vosburgh, IBM Linux Technology Center, [email protected]

#4 lore raw
Quoted 8 lines · Jay Vosburgh
Quoted 5 lines

That sounds like a nice add-on to the existing functionality. I can see the value in something dynamic like that, but I can also see the value in something static like the functionality we have. Did you plan to keep the existing functionality intact or just have it done dynamically?

Well, I posted the patch just a bit ago, so you can see for
yourself, but no, it removes the existing "copy IGMP everywhere"

I see them now -- I'll check them out and make any comments there.