aboutsummaryrefslogtreecommitdiffstats
path: root/net/8021q/vlan.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/8021q/vlan.c')
-rw-r--r--net/8021q/vlan.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index d058c0ef3b6e..8b93799c6a0d 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -43,7 +43,6 @@
43 43
44/* Our listing of VLAN group(s) */ 44/* Our listing of VLAN group(s) */
45static struct hlist_head vlan_group_hash[VLAN_GRP_HASH_SIZE]; 45static struct hlist_head vlan_group_hash[VLAN_GRP_HASH_SIZE];
46#define vlan_grp_hashfn(IDX) ((((IDX) >> VLAN_GRP_HASH_SHIFT) ^ (IDX)) & VLAN_GRP_HASH_MASK)
47 46
48static char vlan_fullname[] = "802.1Q VLAN Support"; 47static char vlan_fullname[] = "802.1Q VLAN Support";
49static char vlan_version[] = DRV_VERSION; 48static char vlan_version[] = DRV_VERSION;
@@ -60,6 +59,11 @@ static struct packet_type vlan_packet_type = {
60 59
61/* End of global variables definitions. */ 60/* End of global variables definitions. */
62 61
62static inline unsigned int vlan_grp_hashfn(unsigned int idx)
63{
64 return ((idx >> VLAN_GRP_HASH_SHIFT) ^ idx) & VLAN_GRP_HASH_MASK;
65}
66
63/* Must be invoked with RCU read lock (no preempt) */ 67/* Must be invoked with RCU read lock (no preempt) */
64static struct vlan_group *__vlan_find_group(int real_dev_ifindex) 68static struct vlan_group *__vlan_find_group(int real_dev_ifindex)
65{ 69{
@@ -94,7 +98,7 @@ static void vlan_group_free(struct vlan_group *grp)
94{ 98{
95 int i; 99 int i;
96 100
97 for (i=0; i < VLAN_GROUP_ARRAY_SPLIT_PARTS; i++) 101 for (i = 0; i < VLAN_GROUP_ARRAY_SPLIT_PARTS; i++)
98 kfree(grp->vlan_devices_arrays[i]); 102 kfree(grp->vlan_devices_arrays[i]);
99 kfree(grp); 103 kfree(grp);
100} 104}
@@ -174,7 +178,8 @@ void unregister_vlan_dev(struct net_device *dev)
174 unregister_netdevice(dev); 178 unregister_netdevice(dev);
175} 179}
176 180
177static void vlan_transfer_operstate(const struct net_device *dev, struct net_device *vlandev) 181static void vlan_transfer_operstate(const struct net_device *dev,
182 struct net_device *vlandev)
178{ 183{
179 /* Have to respect userspace enforced dormant state 184 /* Have to respect userspace enforced dormant state
180 * of real device, also must allow supplicant running 185 * of real device, also must allow supplicant running
@@ -369,7 +374,8 @@ static void vlan_sync_address(struct net_device *dev,
369 memcpy(vlan->real_dev_addr, dev->dev_addr, ETH_ALEN); 374 memcpy(vlan->real_dev_addr, dev->dev_addr, ETH_ALEN);
370} 375}
371 376
372static int vlan_device_event(struct notifier_block *unused, unsigned long event, void *ptr) 377static int vlan_device_event(struct notifier_block *unused, unsigned long event,
378 void *ptr)
373{ 379{
374 struct net_device *dev = ptr; 380 struct net_device *dev = ptr;
375 struct vlan_group *grp = __vlan_find_group(dev->ifindex); 381 struct vlan_group *grp = __vlan_find_group(dev->ifindex);
@@ -569,9 +575,8 @@ static int vlan_ioctl_handler(struct net *net, void __user *arg)
569 err = 0; 575 err = 0;
570 vlan_dev_get_realdev_name(dev, args.u.device2); 576 vlan_dev_get_realdev_name(dev, args.u.device2);
571 if (copy_to_user(arg, &args, 577 if (copy_to_user(arg, &args,
572 sizeof(struct vlan_ioctl_args))) { 578 sizeof(struct vlan_ioctl_args)))
573 err = -EFAULT; 579 err = -EFAULT;
574 }
575 break; 580 break;
576 581
577 case GET_VLAN_VID_CMD: 582 case GET_VLAN_VID_CMD:
@@ -579,9 +584,8 @@ static int vlan_ioctl_handler(struct net *net, void __user *arg)
579 vlan_dev_get_vid(dev, &vid); 584 vlan_dev_get_vid(dev, &vid);
580 args.u.VID = vid; 585 args.u.VID = vid;
581 if (copy_to_user(arg, &args, 586 if (copy_to_user(arg, &args,
582 sizeof(struct vlan_ioctl_args))) { 587 sizeof(struct vlan_ioctl_args)))
583 err = -EFAULT; 588 err = -EFAULT;
584 }
585 break; 589 break;
586 590
587 default: 591 default: