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.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 18fcb9fa518d..c1c205fad4fb 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -5,7 +5,7 @@
5 * Authors: Ben Greear <greearb@candelatech.com> 5 * Authors: Ben Greear <greearb@candelatech.com>
6 * Please send support related email to: vlan@scry.wanfear.com 6 * Please send support related email to: vlan@scry.wanfear.com
7 * VLAN Home Page: http://www.candelatech.com/~greear/vlan.html 7 * VLAN Home Page: http://www.candelatech.com/~greear/vlan.html
8 * 8 *
9 * Fixes: 9 * Fixes:
10 * Fix for packet capture - Nick Eggleston <nick@dccinc.com>; 10 * Fix for packet capture - Nick Eggleston <nick@dccinc.com>;
11 * Add HW acceleration hooks - David S. Miller <davem@redhat.com>; 11 * Add HW acceleration hooks - David S. Miller <davem@redhat.com>;
@@ -72,7 +72,7 @@ static struct packet_type vlan_packet_type = {
72/* 72/*
73 * Function vlan_proto_init (pro) 73 * Function vlan_proto_init (pro)
74 * 74 *
75 * Initialize VLAN protocol layer, 75 * Initialize VLAN protocol layer,
76 * 76 *
77 */ 77 */
78static int __init vlan_proto_init(void) 78static int __init vlan_proto_init(void)
@@ -87,7 +87,7 @@ static int __init vlan_proto_init(void)
87 /* proc file system initialization */ 87 /* proc file system initialization */
88 err = vlan_proc_init(); 88 err = vlan_proc_init();
89 if (err < 0) { 89 if (err < 0) {
90 printk(KERN_ERR 90 printk(KERN_ERR
91 "%s %s: can't create entry in proc filesystem!\n", 91 "%s %s: can't create entry in proc filesystem!\n",
92 __FUNCTION__, VLAN_NAME); 92 __FUNCTION__, VLAN_NAME);
93 return err; 93 return err;
@@ -108,7 +108,7 @@ static int __init vlan_proto_init(void)
108 return 0; 108 return 0;
109} 109}
110 110
111/* Cleanup all vlan devices 111/* Cleanup all vlan devices
112 * Note: devices that have been registered that but not 112 * Note: devices that have been registered that but not
113 * brought up will exist but have no module ref count. 113 * brought up will exist but have no module ref count.
114 */ 114 */
@@ -132,7 +132,7 @@ static void __exit vlan_cleanup_devices(void)
132/* 132/*
133 * Module 'remove' entry point. 133 * Module 'remove' entry point.
134 * o delete /proc/net/router directory and static entries. 134 * o delete /proc/net/router directory and static entries.
135 */ 135 */
136static void __exit vlan_cleanup_module(void) 136static void __exit vlan_cleanup_module(void)
137{ 137{
138 int i; 138 int i;
@@ -184,7 +184,7 @@ 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 grp->vlan_devices[VID];
188 188
189 return NULL; 189 return NULL;
190} 190}
@@ -269,7 +269,7 @@ static int unregister_vlan_dev(struct net_device *real_dev,
269 } 269 }
270 } 270 }
271 271
272 return ret; 272 return ret;
273} 273}
274 274
275static int unregister_vlan_device(const char *vlan_IF_name) 275static int unregister_vlan_device(const char *vlan_IF_name)
@@ -295,7 +295,7 @@ static int unregister_vlan_device(const char *vlan_IF_name)
295 if (ret == 1) 295 if (ret == 1)
296 ret = 0; 296 ret = 0;
297 } else { 297 } else {
298 printk(VLAN_ERR 298 printk(VLAN_ERR
299 "%s: ERROR: Tried to remove a non-vlan device " 299 "%s: ERROR: Tried to remove a non-vlan device "
300 "with VLAN code, name: %s priv_flags: %hX\n", 300 "with VLAN code, name: %s priv_flags: %hX\n",
301 __FUNCTION__, dev->name, dev->priv_flags); 301 __FUNCTION__, dev->name, dev->priv_flags);
@@ -315,7 +315,7 @@ static int unregister_vlan_device(const char *vlan_IF_name)
315static void vlan_setup(struct net_device *new_dev) 315static void vlan_setup(struct net_device *new_dev)
316{ 316{
317 SET_MODULE_OWNER(new_dev); 317 SET_MODULE_OWNER(new_dev);
318 318
319 /* new_dev->ifindex = 0; it will be set when added to 319 /* new_dev->ifindex = 0; it will be set when added to
320 * the global list. 320 * the global list.
321 * iflink is set as well. 321 * iflink is set as well.
@@ -324,7 +324,7 @@ static void vlan_setup(struct net_device *new_dev)
324 324
325 /* Make this thing known as a VLAN device */ 325 /* Make this thing known as a VLAN device */
326 new_dev->priv_flags |= IFF_802_1Q_VLAN; 326 new_dev->priv_flags |= IFF_802_1Q_VLAN;
327 327
328 /* Set us up to have no queue, as the underlying Hardware device 328 /* Set us up to have no queue, as the underlying Hardware device
329 * can do all the queueing we could want. 329 * can do all the queueing we could want.
330 */ 330 */
@@ -461,7 +461,7 @@ static struct net_device *register_vlan_device(const char *eth_IF_name,
461 default: 461 default:
462 snprintf(name, IFNAMSIZ, "vlan%.4i", VLAN_ID); 462 snprintf(name, IFNAMSIZ, "vlan%.4i", VLAN_ID);
463 }; 463 };
464 464
465 new_dev = alloc_netdev(sizeof(struct vlan_dev_info), name, 465 new_dev = alloc_netdev(sizeof(struct vlan_dev_info), name,
466 vlan_setup); 466 vlan_setup);
467 467
@@ -477,7 +477,7 @@ static struct net_device *register_vlan_device(const char *eth_IF_name,
477 477
478 new_dev->state = (real_dev->state & ((1<<__LINK_STATE_NOCARRIER) | 478 new_dev->state = (real_dev->state & ((1<<__LINK_STATE_NOCARRIER) |
479 (1<<__LINK_STATE_DORMANT))) | 479 (1<<__LINK_STATE_DORMANT))) |
480 (1<<__LINK_STATE_PRESENT); 480 (1<<__LINK_STATE_PRESENT);
481 481
482 /* need 4 bytes for extra VLAN header info, 482 /* need 4 bytes for extra VLAN header info,
483 * hope the underlying device can handle it. 483 * hope the underlying device can handle it.
@@ -496,7 +496,7 @@ static struct net_device *register_vlan_device(const char *eth_IF_name,
496 VLAN_MEM_DBG("new_dev->priv malloc, addr: %p size: %i\n", 496 VLAN_MEM_DBG("new_dev->priv malloc, addr: %p size: %i\n",
497 new_dev->priv, 497 new_dev->priv,
498 sizeof(struct vlan_dev_info)); 498 sizeof(struct vlan_dev_info));
499 499
500 memcpy(new_dev->broadcast, real_dev->broadcast, real_dev->addr_len); 500 memcpy(new_dev->broadcast, real_dev->broadcast, real_dev->addr_len);
501 memcpy(new_dev->dev_addr, real_dev->dev_addr, real_dev->addr_len); 501 memcpy(new_dev->dev_addr, real_dev->dev_addr, real_dev->addr_len);
502 new_dev->addr_len = real_dev->addr_len; 502 new_dev->addr_len = real_dev->addr_len;
@@ -521,7 +521,7 @@ static struct net_device *register_vlan_device(const char *eth_IF_name,
521 printk(VLAN_DBG "About to go find the group for idx: %i\n", 521 printk(VLAN_DBG "About to go find the group for idx: %i\n",
522 real_dev->ifindex); 522 real_dev->ifindex);
523#endif 523#endif
524 524
525 if (register_netdevice(new_dev)) 525 if (register_netdevice(new_dev))
526 goto out_free_newdev; 526 goto out_free_newdev;
527 527
@@ -543,22 +543,22 @@ static struct net_device *register_vlan_device(const char *eth_IF_name,
543 grp = kzalloc(sizeof(struct vlan_group), GFP_KERNEL); 543 grp = kzalloc(sizeof(struct vlan_group), GFP_KERNEL);
544 if (!grp) 544 if (!grp)
545 goto out_free_unregister; 545 goto out_free_unregister;
546 546
547 /* printk(KERN_ALERT "VLAN REGISTER: Allocated new group.\n"); */ 547 /* printk(KERN_ALERT "VLAN REGISTER: Allocated new group.\n"); */
548 grp->real_dev_ifindex = real_dev->ifindex; 548 grp->real_dev_ifindex = real_dev->ifindex;
549 549
550 hlist_add_head_rcu(&grp->hlist, 550 hlist_add_head_rcu(&grp->hlist,
551 &vlan_group_hash[vlan_grp_hashfn(real_dev->ifindex)]); 551 &vlan_group_hash[vlan_grp_hashfn(real_dev->ifindex)]);
552 552
553 if (real_dev->features & NETIF_F_HW_VLAN_RX) 553 if (real_dev->features & NETIF_F_HW_VLAN_RX)
554 real_dev->vlan_rx_register(real_dev, grp); 554 real_dev->vlan_rx_register(real_dev, grp);
555 } 555 }
556 556
557 grp->vlan_devices[VLAN_ID] = new_dev; 557 grp->vlan_devices[VLAN_ID] = new_dev;
558 558
559 if (vlan_proc_add_dev(new_dev)<0)/* create it's proc entry */ 559 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", 560 printk(KERN_WARNING "VLAN: failed to add proc entry for %s\n",
561 new_dev->name); 561 new_dev->name);
562 562
563 if (real_dev->features & NETIF_F_HW_VLAN_FILTER) 563 if (real_dev->features & NETIF_F_HW_VLAN_FILTER)
564 real_dev->vlan_rx_add_vid(real_dev, VLAN_ID); 564 real_dev->vlan_rx_add_vid(real_dev, VLAN_ID);
@@ -635,7 +635,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
635 vlandev = grp->vlan_devices[i]; 635 vlandev = grp->vlan_devices[i];
636 if (!vlandev) 636 if (!vlandev)
637 continue; 637 continue;
638 638
639 flgs = vlandev->flags; 639 flgs = vlandev->flags;
640 if (flgs & IFF_UP) 640 if (flgs & IFF_UP)
641 continue; 641 continue;
@@ -643,7 +643,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
643 dev_change_flags(vlandev, flgs | IFF_UP); 643 dev_change_flags(vlandev, flgs | IFF_UP);
644 } 644 }
645 break; 645 break;
646 646
647 case NETDEV_UNREGISTER: 647 case NETDEV_UNREGISTER:
648 /* Delete all VLANs for this dev. */ 648 /* Delete all VLANs for this dev. */
649 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) { 649 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
@@ -755,8 +755,8 @@ static int vlan_ioctl_handler(void __user *arg)
755 /* TODO: Implement 755 /* TODO: Implement
756 err = vlan_dev_get_ingress_priority(args); 756 err = vlan_dev_get_ingress_priority(args);
757 if (copy_to_user((void*)arg, &args, 757 if (copy_to_user((void*)arg, &args,
758 sizeof(struct vlan_ioctl_args))) { 758 sizeof(struct vlan_ioctl_args))) {
759 err = -EFAULT; 759 err = -EFAULT;
760 } 760 }
761 */ 761 */
762 err = -EINVAL; 762 err = -EINVAL;
@@ -765,8 +765,8 @@ static int vlan_ioctl_handler(void __user *arg)
765 /* TODO: Implement 765 /* TODO: Implement
766 err = vlan_dev_get_egress_priority(args.device1, &(args.args); 766 err = vlan_dev_get_egress_priority(args.device1, &(args.args);
767 if (copy_to_user((void*)arg, &args, 767 if (copy_to_user((void*)arg, &args,
768 sizeof(struct vlan_ioctl_args))) { 768 sizeof(struct vlan_ioctl_args))) {
769 err = -EFAULT; 769 err = -EFAULT;
770 } 770 }
771 */ 771 */
772 err = -EINVAL; 772 err = -EINVAL;
@@ -788,7 +788,7 @@ static int vlan_ioctl_handler(void __user *arg)
788 args.u.VID = vid; 788 args.u.VID = vid;
789 if (copy_to_user(arg, &args, 789 if (copy_to_user(arg, &args,
790 sizeof(struct vlan_ioctl_args))) { 790 sizeof(struct vlan_ioctl_args))) {
791 err = -EFAULT; 791 err = -EFAULT;
792 } 792 }
793 break; 793 break;
794 794