[2.6] Add VLAN support in TLB mode
Subsystems (3)
PATCH 5/6 [2.6] Add VLAN support in TLB mode
Add capability to tag self generated learning packets that are required to speed up port selection in the switch after a fail over in bonding since some switches will only update their MAC tables from tagged packets when VLAN support is turned on. All VLAN Id's that have been configured on top of the bond interface will be used in cyclic order.
drivers/net/bonding/bond_alb.c +32 -2
@@ -50,6 +50,7 @@#include <linux/if_arp.h> #include <linux/if_ether.h> #include <linux/if_bonding.h> +#include <linux/if_vlan.h> #include <net/ipx.h> #include <net/arp.h> #include <asm/byteorder.h>
@@ -79,7 +80,7 @@#define TLB_NULL_INDEX 0xffffffff -#define MAX_LP_RETRY 3 +#define MAX_LP_BURST 3/* rlb defs */ #define RLB_HASH_TABLE_SIZE 256
@@ -816,6 +817,7 @@ static void rlb_deinitialize(struct bondstatic void alb_send_learning_packets (struct slave *slave,u8 mac_addr[]) { +struct bonding *bond =bond_get_bond_by_slave (slave);struct learning_pkt pkt;int size =sizeof (struct learning_pkt );int i;
@@ -825,7 +827,7 @@ static void alb_send_learning_packets(stmemcpy (pkt.mac_src, mac_addr,ETH_ALEN ); pkt.type =__constant_htons (ETH_P_LOOP ); -for (i =0 ; i <MAX_LP_RETRY ; i++) { +for (i =0 ; i <MAX_LP_BURST ; i++) {struct sk_buff *skb;char *data;
@@ -843,6 +845,26 @@ static void alb_send_learning_packets(st skb->priority =TC_PRIO_CONTROL ; skb->dev = slave->dev; +if (!list_empty (&bond->vlan_list)) { +struct vlan_entry *vlan; + + vlan =bond_next_vlan (bond, + bond->alb_info.current_alb_vlan); + + bond->alb_info.current_alb_vlan = vlan; +if (!vlan) { +kfree_skb (skb); +continue ; + } + + skb =vlan_put_tag (skb, vlan->vlan_id); +if (!skb) { + printk(KERN_ERR DRV_NAME + ": Error: failed to insert VLAN tag\n"); +continue ; + } + } +dev_queue_xmit (skb); } }
@@ -1588,3 +1610,11 @@ int bond_alb_set_mac_address(struct net_return 0 ; } +void bond_alb_clear_vlan (struct bonding *bond,unsigned short vlan_id) +{ +if (bond->alb_info.current_alb_vlan && + (bond->alb_info.current_alb_vlan->vlan_id == vlan_id)) { + bond->alb_info.current_alb_vlan =NULL ; + } +} +
drivers/net/bonding/bond_alb.h +2 -1
@@ -122,6 +122,7 @@ struct alb_bond_info {* rx traffic should be * rebalanced */ +struct vlan_entry *current_alb_vlan; };int bond_alb_initialize (struct bonding *bond,int rlb_enabled);
@@ -133,6 +134,6 @@ void bond_alb_handle_active_change(strucint bond_alb_xmit (struct sk_buff *skb,struct net_device *bond_dev);void bond_alb_monitor (struct bonding *bond);int bond_alb_set_mac_address (struct net_device *bond_dev,void *addr); - +void bond_alb_clear_vlan (struct bonding *bond,unsigned short vlan_id);#endif /* __BOND_ALB_H__ */
drivers/net/bonding/bond_main.c +41 -0
53 lines not on this page · raw message
drivers/net/bonding/bonding.h +1 -0
@@ -245,6 +245,7 @@ extern inline void bond_set_slave_active slave->dev->flags &= ~IFF_NOARP; } +struct vlan_entry *bond_next_vlan (struct bonding *bond,struct vlan_entry *curr);int bond_dev_queue_xmit (struct bonding *bond,struct sk_buff *skb,struct net_device *slave_dev);#endif /* _LINUX_BONDING_H */