aboutsummaryrefslogtreecommitdiffstats
path: root/net/8021q/vlan.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2008-01-21 03:24:30 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:08:28 -0500
commit40f98e1af4c6082f7f98391540a2a1ade030480a (patch)
tree3e1c0ea34e63ad65adcf8a75ae583e21cd14ace9 /net/8021q/vlan.c
parenta5250a36954c6658e28cc2e7e07e314e0c79e8bb (diff)
[VLAN]: Clean up debugging and printks
- use pr_* functions and common prefix for non-device related messages - remove VLAN_ printk levels - kill lots of useless debugging statements - remove a few unnecessary printks like for double VID registration (already returns -EEXIST) and kill of a number of unnecessary checks in vlan_proc_{add,rem}_dev() that are already performed by the caller Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/8021q/vlan.c')
-rw-r--r--net/8021q/vlan.c58
1 files changed, 11 insertions, 47 deletions
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 8bc6385a06ee..6edd1919d183 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -80,16 +80,13 @@ static int __init vlan_proto_init(void)
80{ 80{
81 int err; 81 int err;
82 82
83 printk(VLAN_INF "%s v%s %s\n", 83 pr_info("%s v%s %s\n", vlan_fullname, vlan_version, vlan_copyright);
84 vlan_fullname, vlan_version, vlan_copyright); 84 pr_info("All bugs added by %s\n", vlan_buggyright);
85 printk(VLAN_INF "All bugs added by %s\n",
86 vlan_buggyright);
87 85
88 /* proc file system initialization */ 86 /* proc file system initialization */
89 err = vlan_proc_init(); 87 err = vlan_proc_init();
90 if (err < 0) { 88 if (err < 0) {
91 printk(KERN_ERR 89 pr_err("%s: can't create entry in proc filesystem!\n",
92 "%s: can't create entry in proc filesystem!\n",
93 __FUNCTION__); 90 __FUNCTION__);
94 return err; 91 return err;
95 } 92 }
@@ -233,10 +230,6 @@ static int unregister_vlan_dev(struct net_device *real_dev,
233 struct vlan_group *grp; 230 struct vlan_group *grp;
234 int i, ret; 231 int i, ret;
235 232
236#ifdef VLAN_DEBUG
237 printk(VLAN_DBG "%s: VID: %i\n", __FUNCTION__, vlan_id);
238#endif
239
240 /* sanity check */ 233 /* sanity check */
241 if (vlan_id >= VLAN_VID_MASK) 234 if (vlan_id >= VLAN_VID_MASK)
242 return -EINVAL; 235 return -EINVAL;
@@ -329,23 +322,22 @@ static void vlan_transfer_operstate(const struct net_device *dev, struct net_dev
329 322
330int vlan_check_real_dev(struct net_device *real_dev, unsigned short vlan_id) 323int vlan_check_real_dev(struct net_device *real_dev, unsigned short vlan_id)
331{ 324{
325 char *name = real_dev->name;
326
332 if (real_dev->features & NETIF_F_VLAN_CHALLENGED) { 327 if (real_dev->features & NETIF_F_VLAN_CHALLENGED) {
333 printk(VLAN_DBG "%s: VLANs not supported on %s.\n", 328 pr_info("8021q: VLANs not supported on %s\n", name);
334 __FUNCTION__, real_dev->name);
335 return -EOPNOTSUPP; 329 return -EOPNOTSUPP;
336 } 330 }
337 331
338 if ((real_dev->features & NETIF_F_HW_VLAN_RX) && 332 if ((real_dev->features & NETIF_F_HW_VLAN_RX) &&
339 !real_dev->vlan_rx_register) { 333 !real_dev->vlan_rx_register) {
340 printk(VLAN_DBG "%s: Device %s has buggy VLAN hw accel.\n", 334 pr_info("8021q: device %s has buggy VLAN hw accel\n", name);
341 __FUNCTION__, real_dev->name);
342 return -EOPNOTSUPP; 335 return -EOPNOTSUPP;
343 } 336 }
344 337
345 if ((real_dev->features & NETIF_F_HW_VLAN_FILTER) && 338 if ((real_dev->features & NETIF_F_HW_VLAN_FILTER) &&
346 (!real_dev->vlan_rx_add_vid || !real_dev->vlan_rx_kill_vid)) { 339 (!real_dev->vlan_rx_add_vid || !real_dev->vlan_rx_kill_vid)) {
347 printk(VLAN_DBG "%s: Device %s has buggy VLAN hw accel.\n", 340 pr_info("8021q: Device %s has buggy VLAN hw accel\n", name);
348 __FUNCTION__, real_dev->name);
349 return -EOPNOTSUPP; 341 return -EOPNOTSUPP;
350 } 342 }
351 343
@@ -355,11 +347,8 @@ int vlan_check_real_dev(struct net_device *real_dev, unsigned short vlan_id)
355 if (!(real_dev->flags & IFF_UP)) 347 if (!(real_dev->flags & IFF_UP))
356 return -ENETDOWN; 348 return -ENETDOWN;
357 349
358 if (__find_vlan_dev(real_dev, vlan_id) != NULL) { 350 if (__find_vlan_dev(real_dev, vlan_id) != NULL)
359 /* was already registered. */
360 printk(VLAN_DBG "%s: ALREADY had VLAN registered\n", __FUNCTION__);
361 return -EEXIST; 351 return -EEXIST;
362 }
363 352
364 return 0; 353 return 0;
365} 354}
@@ -399,8 +388,8 @@ int register_vlan_dev(struct net_device *dev)
399 real_dev->vlan_rx_add_vid(real_dev, vlan_id); 388 real_dev->vlan_rx_add_vid(real_dev, vlan_id);
400 389
401 if (vlan_proc_add_dev(dev) < 0) 390 if (vlan_proc_add_dev(dev) < 0)
402 printk(KERN_WARNING "VLAN: failed to add proc entry for %s\n", 391 pr_warning("8021q: failed to add proc entry for %s\n",
403 dev->name); 392 dev->name);
404 return 0; 393 return 0;
405 394
406out_free_group: 395out_free_group:
@@ -419,11 +408,6 @@ static int register_vlan_device(struct net_device *real_dev,
419 char name[IFNAMSIZ]; 408 char name[IFNAMSIZ];
420 int err; 409 int err;
421 410
422#ifdef VLAN_DEBUG
423 printk(VLAN_DBG "%s: if_name -:%s:- vid: %i\n",
424 __FUNCTION__, eth_IF_name, VLAN_ID);
425#endif
426
427 if (VLAN_ID >= VLAN_VID_MASK) 411 if (VLAN_ID >= VLAN_VID_MASK)
428 return -ERANGE; 412 return -ERANGE;
429 413
@@ -432,10 +416,6 @@ static int register_vlan_device(struct net_device *real_dev,
432 return err; 416 return err;
433 417
434 /* Gotta set up the fields for the device. */ 418 /* Gotta set up the fields for the device. */
435#ifdef VLAN_DEBUG
436 printk(VLAN_DBG "About to allocate name, vlan_name_type: %i\n",
437 vlan_name_type);
438#endif
439 switch (vlan_name_type) { 419 switch (vlan_name_type) {
440 case VLAN_NAME_TYPE_RAW_PLUS_VID: 420 case VLAN_NAME_TYPE_RAW_PLUS_VID:
441 /* name will look like: eth1.0005 */ 421 /* name will look like: eth1.0005 */
@@ -472,13 +452,6 @@ static int register_vlan_device(struct net_device *real_dev,
472 */ 452 */
473 new_dev->mtu = real_dev->mtu; 453 new_dev->mtu = real_dev->mtu;
474 454
475#ifdef VLAN_DEBUG
476 printk(VLAN_DBG "Allocated new name -:%s:-\n", new_dev->name);
477 VLAN_MEM_DBG("new_dev->priv malloc, addr: %p size: %i\n",
478 new_dev->priv,
479 sizeof(struct vlan_dev_info));
480#endif
481
482 VLAN_DEV_INFO(new_dev)->vlan_id = VLAN_ID; /* 1 through VLAN_VID_MASK */ 455 VLAN_DEV_INFO(new_dev)->vlan_id = VLAN_ID; /* 1 through VLAN_VID_MASK */
483 VLAN_DEV_INFO(new_dev)->real_dev = real_dev; 456 VLAN_DEV_INFO(new_dev)->real_dev = real_dev;
484 VLAN_DEV_INFO(new_dev)->dent = NULL; 457 VLAN_DEV_INFO(new_dev)->dent = NULL;
@@ -489,9 +462,6 @@ static int register_vlan_device(struct net_device *real_dev,
489 if (err < 0) 462 if (err < 0)
490 goto out_free_newdev; 463 goto out_free_newdev;
491 464
492#ifdef VLAN_DEBUG
493 printk(VLAN_DBG "Allocated new device successfully, returning.\n");
494#endif
495 return 0; 465 return 0;
496 466
497out_free_newdev: 467out_free_newdev:
@@ -641,10 +611,6 @@ static int vlan_ioctl_handler(struct net *net, void __user *arg)
641 args.device1[23] = 0; 611 args.device1[23] = 0;
642 args.u.device2[23] = 0; 612 args.u.device2[23] = 0;
643 613
644#ifdef VLAN_DEBUG
645 printk(VLAN_DBG "%s: args.cmd: %x\n", __FUNCTION__, args.cmd);
646#endif
647
648 rtnl_lock(); 614 rtnl_lock();
649 615
650 switch (args.cmd) { 616 switch (args.cmd) {
@@ -763,8 +729,6 @@ static int vlan_ioctl_handler(struct net *net, void __user *arg)
763 729
764 default: 730 default:
765 /* pass on to underlying device instead?? */ 731 /* pass on to underlying device instead?? */
766 printk(VLAN_DBG "%s: Unknown VLAN CMD: %x \n",
767 __FUNCTION__, args.cmd);
768 err = -EINVAL; 732 err = -EINVAL;
769 break; 733 break;
770 } 734 }