Skip to contentSkip to conversation

bonding: make it possible to have unlimited nested upper vlans

PATCH In review Veaceslav Falico 2 participants 2 messages Jul 17, 2014 – Jul 21, 2014

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

PATCH 1/1 bonding: make it possible to have unlimited nested upper vlans

Currently we're limited by a constant level of vlan nestings, and fail to find anything beyound that level (currently 2).

To fix this - remove the limit of nestings when going through device tree, and when the end device is found - allocate the needed amount of vlan tags and return them, instead of found/not found.

CC Jay Vosburgh <[email protected]>
CC Andy Gospodarek <[email protected]>
---
 drivers/net/bonding/bond_alb.c  |  8 ++--
 drivers/net/bonding/bond_main.c | 82 +++++++++++++++++++++++++----------------
 drivers/net/bonding/bonding.h   |  7 ++--
 3 files changed, 58 insertions(+), 39 deletions(-)
drivers/net/bonding/bond_alb.c +5 -3
index d3c6801..95dd1f5 100644
@@ -1042,7 +1042,7 @@ static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[],
 	struct bonding *bond = bond_get_bond_by_slave(slave);
 	struct net_device *upper;
 	struct list_head *iter;
-	struct bond_vlan_tag tags[BOND_MAX_VLAN_ENCAP];
+	struct bond_vlan_tag *tags;
 
 	/* send untagged */
 	alb_send_lp_vid(slave, mac_addr, 0, 0);
@@ -1070,10 +1070,12 @@ static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[],
 		 * when strict_match is turned off.
 		 */
 		if (netif_is_macvlan(upper) && !strict_match) {
-			memset(tags, 0, sizeof(tags));
-			bond_verify_device_path(bond->dev, upper, tags);
+			tags = bond_verify_device_path(bond->dev, upper, 0);
+			if (IS_ERR_OR_NULL(tags))
+				BUG();
 			alb_send_lp_vid(slave, upper->dev_addr,
 					tags[0].vlan_proto, tags[0].vlan_id);
+			kfree(tags);
 		}
 	}
 	rcu_read_unlock();
drivers/net/bonding/bond_main.c +50 -32

149 lines not on this page · raw message

drivers/net/bonding/bonding.h +3 -4
index a85ca51..aace510 100644
@@ -36,7 +36,6 @@
 
 #define bond_version DRV_DESCRIPTION ": v" DRV_VERSION " (" DRV_RELDATE ")\n"
 
-#define BOND_MAX_VLAN_ENCAP	2
 #define BOND_MAX_ARP_TARGETS	16
 
 #define BOND_DEFAULT_MIIMON	100
@@ -525,9 +524,9 @@ int bond_netlink_init(void);
 void bond_netlink_fini(void);
 struct net_device *bond_option_active_slave_get_rcu(struct bonding *bond);
 const char *bond_slave_link_status(s8 link);
-bool bond_verify_device_path(struct net_device *start_dev,
-			     struct net_device *end_dev,
-			     struct bond_vlan_tag *tags);
+struct bond_vlan_tag *bond_verify_device_path(struct net_device *start_dev,
+					      struct net_device *end_dev,
+					      int level);
 
 #ifdef CONFIG_PROC_FS
 void bond_create_proc_entry(struct bonding *bond);
Signature · 1 line
1.8.4
maintainer
#1 lore raw

From: Veaceslav Falico <[email protected]>
Date: Thu, 17 Jul 2014 17:02:23 +0200

Quoted 10 lines

Currently we're limited by a constant level of vlan nestings, and fail to find anything beyound that level (currently 2).

To fix this - remove the limit of nestings when going through device tree, and when the end device is found - allocate the needed amount of vlan tags and return them, instead of found/not found.

CC Jay Vosburgh <[email protected]>
CC Andy Gospodarek <[email protected]>

Looks good, applied, thanks.