aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/8139cp.c3
-rw-r--r--drivers/net/acenic.c5
-rw-r--r--drivers/net/amd8111e.c3
-rw-r--r--drivers/net/atl1/atl1_main.c5
-rw-r--r--drivers/net/bnx2.c4
-rw-r--r--drivers/net/bonding/bond_main.c14
-rw-r--r--drivers/net/chelsio/cxgb2.c3
-rw-r--r--drivers/net/cxgb3/cxgb3_offload.c6
-rw-r--r--drivers/net/e1000/e1000_main.c13
-rw-r--r--drivers/net/ehea/ehea_main.c3
-rw-r--r--drivers/net/gianfar.c3
-rw-r--r--drivers/net/ixgb/ixgb_main.c5
-rw-r--r--drivers/net/ns83820.c3
-rw-r--r--drivers/net/r8169.c3
-rw-r--r--drivers/net/s2io.c3
-rw-r--r--drivers/net/sky2.c3
-rw-r--r--drivers/net/starfire.c5
-rw-r--r--drivers/net/tg3.c3
-rw-r--r--drivers/net/typhoon.c3
-rw-r--r--drivers/s390/net/qeth_main.c25
-rw-r--r--include/linux/if_vlan.h25
-rw-r--r--net/8021q/vlan.c42
22 files changed, 102 insertions, 80 deletions
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index 6f93a765e564..12c8453f44bc 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -448,8 +448,7 @@ static void cp_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
448 spin_lock_irqsave(&cp->lock, flags); 448 spin_lock_irqsave(&cp->lock, flags);
449 cp->cpcmd &= ~RxVlanOn; 449 cp->cpcmd &= ~RxVlanOn;
450 cpw16(CpCmd, cp->cpcmd); 450 cpw16(CpCmd, cp->cpcmd);
451 if (cp->vlgrp) 451 vlan_group_set_device(cp->vlgrp, vid, NULL);
452 cp->vlgrp->vlan_devices[vid] = NULL;
453 spin_unlock_irqrestore(&cp->lock, flags); 452 spin_unlock_irqrestore(&cp->lock, flags);
454} 453}
455#endif /* CP_VLAN_TAG_USED */ 454#endif /* CP_VLAN_TAG_USED */
diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c
index 33c6645455ae..7138e0e025bc 100644
--- a/drivers/net/acenic.c
+++ b/drivers/net/acenic.c
@@ -2293,10 +2293,7 @@ static void ace_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
2293 2293
2294 local_irq_save(flags); 2294 local_irq_save(flags);
2295 ace_mask_irq(dev); 2295 ace_mask_irq(dev);
2296 2296 vlan_group_set_device(ap->vlgrp, vid, NULL);
2297 if (ap->vlgrp)
2298 ap->vlgrp->vlan_devices[vid] = NULL;
2299
2300 ace_unmask_irq(dev); 2297 ace_unmask_irq(dev);
2301 local_irq_restore(flags); 2298 local_irq_restore(flags);
2302} 2299}
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c
index 9c399aaefbdd..962c954c2d56 100644
--- a/drivers/net/amd8111e.c
+++ b/drivers/net/amd8111e.c
@@ -1737,8 +1737,7 @@ static void amd8111e_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid
1737{ 1737{
1738 struct amd8111e_priv *lp = netdev_priv(dev); 1738 struct amd8111e_priv *lp = netdev_priv(dev);
1739 spin_lock_irq(&lp->lock); 1739 spin_lock_irq(&lp->lock);
1740 if (lp->vlgrp) 1740 vlan_group_set_device(lp->vlgrp, vid, NULL);
1741 lp->vlgrp->vlan_devices[vid] = NULL;
1742 spin_unlock_irq(&lp->lock); 1741 spin_unlock_irq(&lp->lock);
1743} 1742}
1744#endif 1743#endif
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 65673485bb6b..88d4f70035bb 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -1252,8 +1252,7 @@ static void atl1_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
1252 1252
1253 spin_lock_irqsave(&adapter->lock, flags); 1253 spin_lock_irqsave(&adapter->lock, flags);
1254 /* atl1_irq_disable(adapter); */ 1254 /* atl1_irq_disable(adapter); */
1255 if (adapter->vlgrp) 1255 vlan_group_set_device(adapter->vlgrp, vid, NULL);
1256 adapter->vlgrp->vlan_devices[vid] = NULL;
1257 /* atl1_irq_enable(adapter); */ 1256 /* atl1_irq_enable(adapter); */
1258 spin_unlock_irqrestore(&adapter->lock, flags); 1257 spin_unlock_irqrestore(&adapter->lock, flags);
1259 /* We don't do Vlan filtering */ 1258 /* We don't do Vlan filtering */
@@ -1266,7 +1265,7 @@ static void atl1_restore_vlan(struct atl1_adapter *adapter)
1266 if (adapter->vlgrp) { 1265 if (adapter->vlgrp) {
1267 u16 vid; 1266 u16 vid;
1268 for (vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) { 1267 for (vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) {
1269 if (!adapter->vlgrp->vlan_devices[vid]) 1268 if (!vlan_group_get_device(adapter->vlgrp, vid))
1270 continue; 1269 continue;
1271 atl1_vlan_rx_add_vid(adapter->netdev, vid); 1270 atl1_vlan_rx_add_vid(adapter->netdev, vid);
1272 } 1271 }
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 5a96d7611af1..c12e5ea61819 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -4467,9 +4467,7 @@ bnx2_vlan_rx_kill_vid(struct net_device *dev, uint16_t vid)
4467 struct bnx2 *bp = netdev_priv(dev); 4467 struct bnx2 *bp = netdev_priv(dev);
4468 4468
4469 bnx2_netif_stop(bp); 4469 bnx2_netif_stop(bp);
4470 4470 vlan_group_set_device(bp->vlgrp, vid, NULL);
4471 if (bp->vlgrp)
4472 bp->vlgrp->vlan_devices[vid] = NULL;
4473 bnx2_set_rx_mode(dev); 4471 bnx2_set_rx_mode(dev);
4474 4472
4475 bnx2_netif_start(bp); 4473 bnx2_netif_start(bp);
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index a7c8f98a890c..ea73ebff4387 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -488,9 +488,9 @@ static void bond_vlan_rx_kill_vid(struct net_device *bond_dev, uint16_t vid)
488 /* Save and then restore vlan_dev in the grp array, 488 /* Save and then restore vlan_dev in the grp array,
489 * since the slave's driver might clear it. 489 * since the slave's driver might clear it.
490 */ 490 */
491 vlan_dev = bond->vlgrp->vlan_devices[vid]; 491 vlan_dev = vlan_group_get_device(bond->vlgrp, vid);
492 slave_dev->vlan_rx_kill_vid(slave_dev, vid); 492 slave_dev->vlan_rx_kill_vid(slave_dev, vid);
493 bond->vlgrp->vlan_devices[vid] = vlan_dev; 493 vlan_group_set_device(bond->vlgrp, vid, vlan_dev);
494 } 494 }
495 } 495 }
496 496
@@ -550,9 +550,9 @@ static void bond_del_vlans_from_slave(struct bonding *bond, struct net_device *s
550 /* Save and then restore vlan_dev in the grp array, 550 /* Save and then restore vlan_dev in the grp array,
551 * since the slave's driver might clear it. 551 * since the slave's driver might clear it.
552 */ 552 */
553 vlan_dev = bond->vlgrp->vlan_devices[vlan->vlan_id]; 553 vlan_dev = vlan_group_get_device(bond->vlgrp, vlan->vlan_id);
554 slave_dev->vlan_rx_kill_vid(slave_dev, vlan->vlan_id); 554 slave_dev->vlan_rx_kill_vid(slave_dev, vlan->vlan_id);
555 bond->vlgrp->vlan_devices[vlan->vlan_id] = vlan_dev; 555 vlan_group_set_device(bond->vlgrp, vlan->vlan_id, vlan_dev);
556 } 556 }
557 557
558unreg: 558unreg:
@@ -2397,7 +2397,7 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
2397 vlan_id = 0; 2397 vlan_id = 0;
2398 list_for_each_entry_safe(vlan, vlan_next, &bond->vlan_list, 2398 list_for_each_entry_safe(vlan, vlan_next, &bond->vlan_list,
2399 vlan_list) { 2399 vlan_list) {
2400 vlan_dev = bond->vlgrp->vlan_devices[vlan->vlan_id]; 2400 vlan_dev = vlan_group_get_device(bond->vlgrp, vlan->vlan_id);
2401 if (vlan_dev == rt->u.dst.dev) { 2401 if (vlan_dev == rt->u.dst.dev) {
2402 vlan_id = vlan->vlan_id; 2402 vlan_id = vlan->vlan_id;
2403 dprintk("basa: vlan match on %s %d\n", 2403 dprintk("basa: vlan match on %s %d\n",
@@ -2444,7 +2444,7 @@ static void bond_send_gratuitous_arp(struct bonding *bond)
2444 } 2444 }
2445 2445
2446 list_for_each_entry(vlan, &bond->vlan_list, vlan_list) { 2446 list_for_each_entry(vlan, &bond->vlan_list, vlan_list) {
2447 vlan_dev = bond->vlgrp->vlan_devices[vlan->vlan_id]; 2447 vlan_dev = vlan_group_get_device(bond->vlgrp, vlan->vlan_id);
2448 if (vlan->vlan_ip) { 2448 if (vlan->vlan_ip) {
2449 bond_arp_send(slave->dev, ARPOP_REPLY, vlan->vlan_ip, 2449 bond_arp_send(slave->dev, ARPOP_REPLY, vlan->vlan_ip,
2450 vlan->vlan_ip, vlan->vlan_id); 2450 vlan->vlan_ip, vlan->vlan_id);
@@ -3371,7 +3371,7 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event,
3371 3371
3372 list_for_each_entry_safe(vlan, vlan_next, &bond->vlan_list, 3372 list_for_each_entry_safe(vlan, vlan_next, &bond->vlan_list,
3373 vlan_list) { 3373 vlan_list) {
3374 vlan_dev = bond->vlgrp->vlan_devices[vlan->vlan_id]; 3374 vlan_dev = vlan_group_get_device(bond->vlgrp, vlan->vlan_id);
3375 if (vlan_dev == event_dev) { 3375 if (vlan_dev == event_dev) {
3376 switch (event) { 3376 switch (event) {
3377 case NETDEV_UP: 3377 case NETDEV_UP:
diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c
index 7d0f24f69777..125c9b105869 100644
--- a/drivers/net/chelsio/cxgb2.c
+++ b/drivers/net/chelsio/cxgb2.c
@@ -889,8 +889,7 @@ static void vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
889 struct adapter *adapter = dev->priv; 889 struct adapter *adapter = dev->priv;
890 890
891 spin_lock_irq(&adapter->async_lock); 891 spin_lock_irq(&adapter->async_lock);
892 if (adapter->vlan_grp) 892 vlan_group_set_device(adapter->vlan_grp, vid, NULL);
893 adapter->vlan_grp->vlan_devices[vid] = NULL;
894 spin_unlock_irq(&adapter->async_lock); 893 spin_unlock_irq(&adapter->async_lock);
895} 894}
896#endif 895#endif
diff --git a/drivers/net/cxgb3/cxgb3_offload.c b/drivers/net/cxgb3/cxgb3_offload.c
index b2cf5f6feb4a..f6ed033efb56 100644
--- a/drivers/net/cxgb3/cxgb3_offload.c
+++ b/drivers/net/cxgb3/cxgb3_offload.c
@@ -160,14 +160,16 @@ static struct net_device *get_iff_from_mac(struct adapter *adapter,
160 int i; 160 int i;
161 161
162 for_each_port(adapter, i) { 162 for_each_port(adapter, i) {
163 const struct vlan_group *grp; 163 struct vlan_group *grp;
164 struct net_device *dev = adapter->port[i]; 164 struct net_device *dev = adapter->port[i];
165 const struct port_info *p = netdev_priv(dev); 165 const struct port_info *p = netdev_priv(dev);
166 166
167 if (!memcmp(dev->dev_addr, mac, ETH_ALEN)) { 167 if (!memcmp(dev->dev_addr, mac, ETH_ALEN)) {
168 if (vlan && vlan != VLAN_VID_MASK) { 168 if (vlan && vlan != VLAN_VID_MASK) {
169 grp = p->vlan_grp; 169 grp = p->vlan_grp;
170 dev = grp ? grp->vlan_devices[vlan] : NULL; 170 dev = NULL;
171 if (grp)
172 dev = vlan_group_get_device(grp, vlan);
171 } else 173 } else
172 while (dev->master) 174 while (dev->master)
173 dev = dev->master; 175 dev = dev->master;
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 98215fdd7d10..1d08e937af82 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -376,7 +376,7 @@ e1000_update_mng_vlan(struct e1000_adapter *adapter)
376 uint16_t vid = adapter->hw.mng_cookie.vlan_id; 376 uint16_t vid = adapter->hw.mng_cookie.vlan_id;
377 uint16_t old_vid = adapter->mng_vlan_id; 377 uint16_t old_vid = adapter->mng_vlan_id;
378 if (adapter->vlgrp) { 378 if (adapter->vlgrp) {
379 if (!adapter->vlgrp->vlan_devices[vid]) { 379 if (!vlan_group_get_device(adapter->vlgrp, vid)) {
380 if (adapter->hw.mng_cookie.status & 380 if (adapter->hw.mng_cookie.status &
381 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) { 381 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) {
382 e1000_vlan_rx_add_vid(netdev, vid); 382 e1000_vlan_rx_add_vid(netdev, vid);
@@ -386,7 +386,7 @@ e1000_update_mng_vlan(struct e1000_adapter *adapter)
386 386
387 if ((old_vid != (uint16_t)E1000_MNG_VLAN_NONE) && 387 if ((old_vid != (uint16_t)E1000_MNG_VLAN_NONE) &&
388 (vid != old_vid) && 388 (vid != old_vid) &&
389 !adapter->vlgrp->vlan_devices[old_vid]) 389 !vlan_group_get_device(adapter->vlgrp, old_vid))
390 e1000_vlan_rx_kill_vid(netdev, old_vid); 390 e1000_vlan_rx_kill_vid(netdev, old_vid);
391 } else 391 } else
392 adapter->mng_vlan_id = vid; 392 adapter->mng_vlan_id = vid;
@@ -1482,7 +1482,7 @@ e1000_close(struct net_device *netdev)
1482 if ((adapter->hw.mng_cookie.status & 1482 if ((adapter->hw.mng_cookie.status &
1483 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) && 1483 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) &&
1484 !(adapter->vlgrp && 1484 !(adapter->vlgrp &&
1485 adapter->vlgrp->vlan_devices[adapter->mng_vlan_id])) { 1485 vlan_group_get_device(adapter->vlgrp, adapter->mng_vlan_id))) {
1486 e1000_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id); 1486 e1000_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id);
1487 } 1487 }
1488 1488
@@ -4998,10 +4998,7 @@ e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid)
4998 uint32_t vfta, index; 4998 uint32_t vfta, index;
4999 4999
5000 e1000_irq_disable(adapter); 5000 e1000_irq_disable(adapter);
5001 5001 vlan_group_set_device(adapter->vlgrp, vid, NULL);
5002 if (adapter->vlgrp)
5003 adapter->vlgrp->vlan_devices[vid] = NULL;
5004
5005 e1000_irq_enable(adapter); 5002 e1000_irq_enable(adapter);
5006 5003
5007 if ((adapter->hw.mng_cookie.status & 5004 if ((adapter->hw.mng_cookie.status &
@@ -5027,7 +5024,7 @@ e1000_restore_vlan(struct e1000_adapter *adapter)
5027 if (adapter->vlgrp) { 5024 if (adapter->vlgrp) {
5028 uint16_t vid; 5025 uint16_t vid;
5029 for (vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) { 5026 for (vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) {
5030 if (!adapter->vlgrp->vlan_devices[vid]) 5027 if (!vlan_group_get_device(adapter->vlgrp, vid))
5031 continue; 5028 continue;
5032 e1000_vlan_rx_add_vid(adapter->netdev, vid); 5029 e1000_vlan_rx_add_vid(adapter->netdev, vid);
5033 } 5030 }
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index 88ad1c8bcee4..0e4042bc0a48 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -1939,8 +1939,7 @@ static void ehea_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
1939 int index; 1939 int index;
1940 u64 hret; 1940 u64 hret;
1941 1941
1942 if (port->vgrp) 1942 vlan_group_set_device(port->vgrp, vid, NULL);
1943 port->vgrp->vlan_devices[vid] = NULL;
1944 1943
1945 cb1 = kzalloc(PAGE_SIZE, GFP_KERNEL); 1944 cb1 = kzalloc(PAGE_SIZE, GFP_KERNEL);
1946 if (!cb1) { 1945 if (!cb1) {
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 1f83988a6a64..02b61b85b62c 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -1132,8 +1132,7 @@ static void gfar_vlan_rx_kill_vid(struct net_device *dev, uint16_t vid)
1132 1132
1133 spin_lock_irqsave(&priv->rxlock, flags); 1133 spin_lock_irqsave(&priv->rxlock, flags);
1134 1134
1135 if (priv->vlgrp) 1135 vlan_group_set_device(priv->vgrp, vid, NULL);
1136 priv->vlgrp->vlan_devices[vid] = NULL;
1137 1136
1138 spin_unlock_irqrestore(&priv->rxlock, flags); 1137 spin_unlock_irqrestore(&priv->rxlock, flags);
1139} 1138}
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index 0c3682889344..afc2ec72529e 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -2213,8 +2213,7 @@ ixgb_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid)
2213 2213
2214 ixgb_irq_disable(adapter); 2214 ixgb_irq_disable(adapter);
2215 2215
2216 if(adapter->vlgrp) 2216 vlan_group_set_device(adapter->vlgrp, vid, NULL);
2217 adapter->vlgrp->vlan_devices[vid] = NULL;
2218 2217
2219 ixgb_irq_enable(adapter); 2218 ixgb_irq_enable(adapter);
2220 2219
@@ -2234,7 +2233,7 @@ ixgb_restore_vlan(struct ixgb_adapter *adapter)
2234 if(adapter->vlgrp) { 2233 if(adapter->vlgrp) {
2235 uint16_t vid; 2234 uint16_t vid;
2236 for(vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) { 2235 for(vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) {
2237 if(!adapter->vlgrp->vlan_devices[vid]) 2236 if(!vlan_group_get_device(adapter->vlgrp, vid))
2238 continue; 2237 continue;
2239 ixgb_vlan_rx_add_vid(adapter->netdev, vid); 2238 ixgb_vlan_rx_add_vid(adapter->netdev, vid);
2240 } 2239 }
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c
index 568daeb3e9d8..9ec6e9e54f47 100644
--- a/drivers/net/ns83820.c
+++ b/drivers/net/ns83820.c
@@ -514,8 +514,7 @@ static void ns83820_vlan_rx_kill_vid(struct net_device *ndev, unsigned short vid
514 514
515 spin_lock_irq(&dev->misc_lock); 515 spin_lock_irq(&dev->misc_lock);
516 spin_lock(&dev->tx_lock); 516 spin_lock(&dev->tx_lock);
517 if (dev->vlgrp) 517 vlan_group_set_device(dev->vlgrp, vid, NULL);
518 dev->vlgrp->vlan_devices[vid] = NULL;
519 spin_unlock(&dev->tx_lock); 518 spin_unlock(&dev->tx_lock);
520 spin_unlock_irq(&dev->misc_lock); 519 spin_unlock_irq(&dev->misc_lock);
521} 520}
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 13cf06ee97f7..15d954e50cae 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -890,8 +890,7 @@ static void rtl8169_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
890 unsigned long flags; 890 unsigned long flags;
891 891
892 spin_lock_irqsave(&tp->lock, flags); 892 spin_lock_irqsave(&tp->lock, flags);
893 if (tp->vlgrp) 893 vlan_group_set_device(tp->vlgrp, vid, NULL);
894 tp->vlgrp->vlan_devices[vid] = NULL;
895 spin_unlock_irqrestore(&tp->lock, flags); 894 spin_unlock_irqrestore(&tp->lock, flags);
896} 895}
897 896
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 44bb2395af84..46ebf141ee5a 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -325,8 +325,7 @@ static void s2io_vlan_rx_kill_vid(struct net_device *dev, unsigned long vid)
325 unsigned long flags; 325 unsigned long flags;
326 326
327 spin_lock_irqsave(&nic->tx_lock, flags); 327 spin_lock_irqsave(&nic->tx_lock, flags);
328 if (nic->vlgrp) 328 vlan_group_set_device(nic->vlgrp, vid, NULL);
329 nic->vlgrp->vlan_devices[vid] = NULL;
330 spin_unlock_irqrestore(&nic->tx_lock, flags); 329 spin_unlock_irqrestore(&nic->tx_lock, flags);
331} 330}
332 331
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 52edbd7ac17e..53839979cfb8 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -1053,8 +1053,7 @@ static void sky2_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
1053 1053
1054 sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T), RX_VLAN_STRIP_OFF); 1054 sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T), RX_VLAN_STRIP_OFF);
1055 sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), TX_VLAN_TAG_OFF); 1055 sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), TX_VLAN_TAG_OFF);
1056 if (sky2->vlgrp) 1056 vlan_group_set_device(sky2->vlgrp, vid, NULL);
1057 sky2->vlgrp->vlan_devices[vid] = NULL;
1058 1057
1059 netif_tx_unlock_bh(dev); 1058 netif_tx_unlock_bh(dev);
1060} 1059}
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index bf873ea25797..8bba2e3da7e1 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -677,8 +677,7 @@ static void netdev_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
677 spin_lock(&np->lock); 677 spin_lock(&np->lock);
678 if (debug > 1) 678 if (debug > 1)
679 printk("%s: removing vlanid %d from vlan filter\n", dev->name, vid); 679 printk("%s: removing vlanid %d from vlan filter\n", dev->name, vid);
680 if (np->vlgrp) 680 vlan_group_set_device(np->vlgrp, vid, NULL);
681 np->vlgrp->vlan_devices[vid] = NULL;
682 set_rx_mode(dev); 681 set_rx_mode(dev);
683 spin_unlock(&np->lock); 682 spin_unlock(&np->lock);
684} 683}
@@ -1738,7 +1737,7 @@ static void set_rx_mode(struct net_device *dev)
1738 int vlan_count = 0; 1737 int vlan_count = 0;
1739 void __iomem *filter_addr = ioaddr + HashTable + 8; 1738 void __iomem *filter_addr = ioaddr + HashTable + 8;
1740 for (i = 0; i < VLAN_VID_MASK; i++) { 1739 for (i = 0; i < VLAN_VID_MASK; i++) {
1741 if (np->vlgrp->vlan_devices[i]) { 1740 if (vlan_group_get_device(np->vlgrp, i)) {
1742 if (vlan_count >= 32) 1741 if (vlan_count >= 32)
1743 break; 1742 break;
1744 writew(cpu_to_be16(i), filter_addr); 1743 writew(cpu_to_be16(i), filter_addr);
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 26c6ac48288c..8c8f9f4d47a5 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -9114,8 +9114,7 @@ static void tg3_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
9114 tg3_netif_stop(tp); 9114 tg3_netif_stop(tp);
9115 9115
9116 tg3_full_lock(tp, 0); 9116 tg3_full_lock(tp, 0);
9117 if (tp->vlgrp) 9117 vlan_group_set_device(tp->vlgrp, vid, NULL);
9118 tp->vlgrp->vlan_devices[vid] = NULL;
9119 tg3_full_unlock(tp); 9118 tg3_full_unlock(tp);
9120 9119
9121 if (netif_running(dev)) 9120 if (netif_running(dev))
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c
index 9781b16bb8b6..0d91d094edd9 100644
--- a/drivers/net/typhoon.c
+++ b/drivers/net/typhoon.c
@@ -746,8 +746,7 @@ typhoon_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
746{ 746{
747 struct typhoon *tp = netdev_priv(dev); 747 struct typhoon *tp = netdev_priv(dev);
748 spin_lock_bh(&tp->state_lock); 748 spin_lock_bh(&tp->state_lock);
749 if(tp->vlgrp) 749 vlan_group_set_device(tp->vlgrp, vid, NULL);
750 tp->vlgrp->vlan_devices[vid] = NULL;
751 spin_unlock_bh(&tp->state_lock); 750 spin_unlock_bh(&tp->state_lock);
752} 751}
753 752
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c
index 2257e45594b3..d8a86f5af379 100644
--- a/drivers/s390/net/qeth_main.c
+++ b/drivers/s390/net/qeth_main.c
@@ -3654,7 +3654,7 @@ qeth_verify_vlan_dev(struct net_device *dev, struct qeth_card *card)
3654 return rc; 3654 return rc;
3655 3655
3656 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++){ 3656 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++){
3657 if (vg->vlan_devices[i] == dev){ 3657 if (vlan_group_get_device(vg, i) == dev){
3658 rc = QETH_VLAN_CARD; 3658 rc = QETH_VLAN_CARD;
3659 break; 3659 break;
3660 } 3660 }
@@ -5261,7 +5261,7 @@ qeth_free_vlan_addresses4(struct qeth_card *card, unsigned short vid)
5261 QETH_DBF_TEXT(trace, 4, "frvaddr4"); 5261 QETH_DBF_TEXT(trace, 4, "frvaddr4");
5262 5262
5263 rcu_read_lock(); 5263 rcu_read_lock();
5264 in_dev = __in_dev_get_rcu(card->vlangrp->vlan_devices[vid]); 5264 in_dev = __in_dev_get_rcu(vlan_group_get_device(card->vlangrp, vid));
5265 if (!in_dev) 5265 if (!in_dev)
5266 goto out; 5266 goto out;
5267 for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) { 5267 for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) {
@@ -5288,7 +5288,7 @@ qeth_free_vlan_addresses6(struct qeth_card *card, unsigned short vid)
5288 5288
5289 QETH_DBF_TEXT(trace, 4, "frvaddr6"); 5289 QETH_DBF_TEXT(trace, 4, "frvaddr6");
5290 5290
5291 in6_dev = in6_dev_get(card->vlangrp->vlan_devices[vid]); 5291 in6_dev = in6_dev_get(vlan_group_get_device(card->vlangrp, vid));
5292 if (!in6_dev) 5292 if (!in6_dev)
5293 return; 5293 return;
5294 for (ifa = in6_dev->addr_list; ifa; ifa = ifa->lst_next){ 5294 for (ifa = in6_dev->addr_list; ifa; ifa = ifa->lst_next){
@@ -5360,7 +5360,7 @@ qeth_layer2_process_vlans(struct qeth_card *card, int clear)
5360 if (!card->vlangrp) 5360 if (!card->vlangrp)
5361 return; 5361 return;
5362 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) { 5362 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
5363 if (card->vlangrp->vlan_devices[i] == NULL) 5363 if (vlan_group_get_device(card->vlangrp, i) == NULL)
5364 continue; 5364 continue;
5365 if (clear) 5365 if (clear)
5366 qeth_layer2_send_setdelvlan(card, i, IPA_CMD_DELVLAN); 5366 qeth_layer2_send_setdelvlan(card, i, IPA_CMD_DELVLAN);
@@ -5398,8 +5398,7 @@ qeth_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
5398 spin_lock_irqsave(&card->vlanlock, flags); 5398 spin_lock_irqsave(&card->vlanlock, flags);
5399 /* unregister IP addresses of vlan device */ 5399 /* unregister IP addresses of vlan device */
5400 qeth_free_vlan_addresses(card, vid); 5400 qeth_free_vlan_addresses(card, vid);
5401 if (card->vlangrp) 5401 vlan_group_set_device(card->vlangrp, vid, NULL);
5402 card->vlangrp->vlan_devices[vid] = NULL;
5403 spin_unlock_irqrestore(&card->vlanlock, flags); 5402 spin_unlock_irqrestore(&card->vlanlock, flags);
5404 if (card->options.layer2) 5403 if (card->options.layer2)
5405 qeth_layer2_send_setdelvlan(card, vid, IPA_CMD_DELVLAN); 5404 qeth_layer2_send_setdelvlan(card, vid, IPA_CMD_DELVLAN);
@@ -5662,10 +5661,11 @@ qeth_add_vlan_mc(struct qeth_card *card)
5662 5661
5663 vg = card->vlangrp; 5662 vg = card->vlangrp;
5664 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) { 5663 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
5665 if (vg->vlan_devices[i] == NULL || 5664 struct net_device *netdev = vlan_group_get_device(vg, i);
5666 !(vg->vlan_devices[i]->flags & IFF_UP)) 5665 if (netdev == NULL ||
5666 !(netdev->flags & IFF_UP))
5667 continue; 5667 continue;
5668 in_dev = in_dev_get(vg->vlan_devices[i]); 5668 in_dev = in_dev_get(netdev);
5669 if (!in_dev) 5669 if (!in_dev)
5670 continue; 5670 continue;
5671 read_lock(&in_dev->mc_list_lock); 5671 read_lock(&in_dev->mc_list_lock);
@@ -5749,10 +5749,11 @@ qeth_add_vlan_mc6(struct qeth_card *card)
5749 5749
5750 vg = card->vlangrp; 5750 vg = card->vlangrp;
5751 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) { 5751 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
5752 if (vg->vlan_devices[i] == NULL || 5752 struct net_device *netdev = vlan_group_get_device(vg, i);
5753 !(vg->vlan_devices[i]->flags & IFF_UP)) 5753 if (netdev == NULL ||
5754 !(netdev->flags & IFF_UP))
5754 continue; 5755 continue;
5755 in_dev = in6_dev_get(vg->vlan_devices[i]); 5756 in_dev = in6_dev_get(netdev);
5756 if (!in_dev) 5757 if (!in_dev)
5757 continue; 5758 continue;
5758 read_lock(&in_dev->lock); 5759 read_lock(&in_dev->lock);
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 35cb38573583..d103580c72d2 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -70,15 +70,34 @@ extern void vlan_ioctl_set(int (*hook)(void __user *));
70 * depends on completely exhausting the VLAN identifier space. Thus 70 * depends on completely exhausting the VLAN identifier space. Thus
71 * it gives constant time look-up, but in many cases it wastes memory. 71 * it gives constant time look-up, but in many cases it wastes memory.
72 */ 72 */
73#define VLAN_GROUP_ARRAY_LEN 4096 73#define VLAN_GROUP_ARRAY_LEN 4096
74#define VLAN_GROUP_ARRAY_SPLIT_PARTS 8
75#define VLAN_GROUP_ARRAY_PART_LEN (VLAN_GROUP_ARRAY_LEN/VLAN_GROUP_ARRAY_SPLIT_PARTS)
74 76
75struct vlan_group { 77struct vlan_group {
76 int real_dev_ifindex; /* The ifindex of the ethernet(like) device the vlan is attached to. */ 78 int real_dev_ifindex; /* The ifindex of the ethernet(like) device the vlan is attached to. */
77 struct hlist_node hlist; /* linked list */ 79 struct hlist_node hlist; /* linked list */
78 struct net_device *vlan_devices[VLAN_GROUP_ARRAY_LEN]; 80 struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS];
79 struct rcu_head rcu; 81 struct rcu_head rcu;
80}; 82};
81 83
84static inline struct net_device *vlan_group_get_device(struct vlan_group *vg, int vlan_id)
85{
86 struct net_device **array;
87 array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN];
88 return array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN];
89}
90
91static inline void vlan_group_set_device(struct vlan_group *vg, int vlan_id,
92 struct net_device *dev)
93{
94 struct net_device **array;
95 if (!vg)
96 return;
97 array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN];
98 array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] = dev;
99}
100
82struct vlan_priority_tci_mapping { 101struct vlan_priority_tci_mapping {
83 unsigned long priority; 102 unsigned long priority;
84 unsigned short vlan_qos; /* This should be shifted when first set, so we only do it 103 unsigned short vlan_qos; /* This should be shifted when first set, so we only do it
@@ -160,7 +179,7 @@ static inline int __vlan_hwaccel_rx(struct sk_buff *skb,
160 return NET_RX_DROP; 179 return NET_RX_DROP;
161 } 180 }
162 181
163 skb->dev = grp->vlan_devices[vlan_tag & VLAN_VID_MASK]; 182 skb->dev = vlan_group_get_device(grp, vlan_tag & VLAN_VID_MASK);
164 if (skb->dev == NULL) { 183 if (skb->dev == NULL) {
165 dev_kfree_skb_any(skb); 184 dev_kfree_skb_any(skb);
166 185
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index c1c205fad4fb..eb1c71ed7dfe 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -184,14 +184,23 @@ struct net_device *__find_vlan_dev(struct net_device *real_dev,
184 struct vlan_group *grp = __vlan_find_group(real_dev->ifindex); 184 struct vlan_group *grp = __vlan_find_group(real_dev->ifindex);
185 185
186 if (grp) 186 if (grp)
187 return grp->vlan_devices[VID]; 187 return vlan_group_get_device(grp, VID);
188 188
189 return NULL; 189 return NULL;
190} 190}
191 191
192static void vlan_group_free(struct vlan_group *grp)
193{
194 int i;
195
196 for (i=0; i < VLAN_GROUP_ARRAY_SPLIT_PARTS; i++)
197 kfree(grp->vlan_devices_arrays[i]);
198 kfree(grp);
199}
200
192static void vlan_rcu_free(struct rcu_head *rcu) 201static void vlan_rcu_free(struct rcu_head *rcu)
193{ 202{
194 kfree(container_of(rcu, struct vlan_group, rcu)); 203 vlan_group_free(container_of(rcu, struct vlan_group, rcu));
195} 204}
196 205
197 206
@@ -223,7 +232,7 @@ static int unregister_vlan_dev(struct net_device *real_dev,
223 ret = 0; 232 ret = 0;
224 233
225 if (grp) { 234 if (grp) {
226 dev = grp->vlan_devices[vlan_id]; 235 dev = vlan_group_get_device(grp, vlan_id);
227 if (dev) { 236 if (dev) {
228 /* Remove proc entry */ 237 /* Remove proc entry */
229 vlan_proc_rem_dev(dev); 238 vlan_proc_rem_dev(dev);
@@ -237,7 +246,7 @@ static int unregister_vlan_dev(struct net_device *real_dev,
237 real_dev->vlan_rx_kill_vid(real_dev, vlan_id); 246 real_dev->vlan_rx_kill_vid(real_dev, vlan_id);
238 } 247 }
239 248
240 grp->vlan_devices[vlan_id] = NULL; 249 vlan_group_set_device(grp, vlan_id, NULL);
241 synchronize_net(); 250 synchronize_net();
242 251
243 252
@@ -251,7 +260,7 @@ static int unregister_vlan_dev(struct net_device *real_dev,
251 * group. 260 * group.
252 */ 261 */
253 for (i = 0; i < VLAN_VID_MASK; i++) 262 for (i = 0; i < VLAN_VID_MASK; i++)
254 if (grp->vlan_devices[i]) 263 if (vlan_group_get_device(grp, i))
255 break; 264 break;
256 265
257 if (i == VLAN_VID_MASK) { 266 if (i == VLAN_VID_MASK) {
@@ -379,6 +388,7 @@ static struct net_device *register_vlan_device(const char *eth_IF_name,
379 struct net_device *new_dev; 388 struct net_device *new_dev;
380 struct net_device *real_dev; /* the ethernet device */ 389 struct net_device *real_dev; /* the ethernet device */
381 char name[IFNAMSIZ]; 390 char name[IFNAMSIZ];
391 int i;
382 392
383#ifdef VLAN_DEBUG 393#ifdef VLAN_DEBUG
384 printk(VLAN_DBG "%s: if_name -:%s:- vid: %i\n", 394 printk(VLAN_DBG "%s: if_name -:%s:- vid: %i\n",
@@ -544,6 +554,15 @@ static struct net_device *register_vlan_device(const char *eth_IF_name,
544 if (!grp) 554 if (!grp)
545 goto out_free_unregister; 555 goto out_free_unregister;
546 556
557 for (i=0; i < VLAN_GROUP_ARRAY_SPLIT_PARTS; i++) {
558 grp->vlan_devices_arrays[i] = kzalloc(
559 sizeof(struct net_device *)*VLAN_GROUP_ARRAY_PART_LEN,
560 GFP_KERNEL);
561
562 if (!grp->vlan_devices_arrays[i])
563 goto out_free_arrays;
564 }
565
547 /* printk(KERN_ALERT "VLAN REGISTER: Allocated new group.\n"); */ 566 /* printk(KERN_ALERT "VLAN REGISTER: Allocated new group.\n"); */
548 grp->real_dev_ifindex = real_dev->ifindex; 567 grp->real_dev_ifindex = real_dev->ifindex;
549 568
@@ -554,7 +573,7 @@ static struct net_device *register_vlan_device(const char *eth_IF_name,
554 real_dev->vlan_rx_register(real_dev, grp); 573 real_dev->vlan_rx_register(real_dev, grp);
555 } 574 }
556 575
557 grp->vlan_devices[VLAN_ID] = new_dev; 576 vlan_group_set_device(grp, VLAN_ID, new_dev);
558 577
559 if (vlan_proc_add_dev(new_dev)<0)/* create it's proc entry */ 578 if (vlan_proc_add_dev(new_dev)<0)/* create it's proc entry */
560 printk(KERN_WARNING "VLAN: failed to add proc entry for %s\n", 579 printk(KERN_WARNING "VLAN: failed to add proc entry for %s\n",
@@ -571,6 +590,9 @@ static struct net_device *register_vlan_device(const char *eth_IF_name,
571#endif 590#endif
572 return new_dev; 591 return new_dev;
573 592
593out_free_arrays:
594 vlan_group_free(grp);
595
574out_free_unregister: 596out_free_unregister:
575 unregister_netdev(new_dev); 597 unregister_netdev(new_dev);
576 goto out_unlock; 598 goto out_unlock;
@@ -606,7 +628,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
606 case NETDEV_CHANGE: 628 case NETDEV_CHANGE:
607 /* Propagate real device state to vlan devices */ 629 /* Propagate real device state to vlan devices */
608 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) { 630 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
609 vlandev = grp->vlan_devices[i]; 631 vlandev = vlan_group_get_device(grp, i);
610 if (!vlandev) 632 if (!vlandev)
611 continue; 633 continue;
612 634
@@ -617,7 +639,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
617 case NETDEV_DOWN: 639 case NETDEV_DOWN:
618 /* Put all VLANs for this dev in the down state too. */ 640 /* Put all VLANs for this dev in the down state too. */
619 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) { 641 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
620 vlandev = grp->vlan_devices[i]; 642 vlandev = vlan_group_get_device(grp, i);
621 if (!vlandev) 643 if (!vlandev)
622 continue; 644 continue;
623 645
@@ -632,7 +654,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
632 case NETDEV_UP: 654 case NETDEV_UP:
633 /* Put all VLANs for this dev in the up state too. */ 655 /* Put all VLANs for this dev in the up state too. */
634 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) { 656 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
635 vlandev = grp->vlan_devices[i]; 657 vlandev = vlan_group_get_device(grp, i);
636 if (!vlandev) 658 if (!vlandev)
637 continue; 659 continue;
638 660
@@ -649,7 +671,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
649 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) { 671 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
650 int ret; 672 int ret;
651 673
652 vlandev = grp->vlan_devices[i]; 674 vlandev = vlan_group_get_device(grp, i);
653 if (!vlandev) 675 if (!vlandev)
654 continue; 676 continue;
655 677