aboutsummaryrefslogtreecommitdiffstats
path: root/net/8021q/vlan_dev.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_dev.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_dev.c')
-rw-r--r--net/8021q/vlan_dev.c56
1 files changed, 19 insertions, 37 deletions
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 50d8edcbb897..756a71c1f4a5 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -60,9 +60,8 @@ static int vlan_dev_rebuild_header(struct sk_buff *skb)
60 return arp_find(veth->h_dest, skb); 60 return arp_find(veth->h_dest, skb);
61#endif 61#endif
62 default: 62 default:
63 printk(VLAN_DBG 63 pr_debug("%s: unable to resolve type %X addresses.\n",
64 "%s: unable to resolve type %X addresses.\n", 64 dev->name, ntohs(veth->h_vlan_encapsulated_proto));
65 dev->name, ntohs(veth->h_vlan_encapsulated_proto));
66 65
67 memcpy(veth->h_source, dev->dev_addr, ETH_ALEN); 66 memcpy(veth->h_source, dev->dev_addr, ETH_ALEN);
68 break; 67 break;
@@ -142,11 +141,6 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
142 141
143 vid = (vlan_TCI & VLAN_VID_MASK); 142 vid = (vlan_TCI & VLAN_VID_MASK);
144 143
145#ifdef VLAN_DEBUG
146 printk(VLAN_DBG "%s: skb: %p vlan_id: %hx\n",
147 __FUNCTION__, skb, vid);
148#endif
149
150 /* Ok, we will find the correct VLAN device, strip the header, 144 /* Ok, we will find the correct VLAN device, strip the header,
151 * and then go on as usual. 145 * and then go on as usual.
152 */ 146 */
@@ -162,11 +156,8 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
162 skb->dev = __find_vlan_dev(dev, vid); 156 skb->dev = __find_vlan_dev(dev, vid);
163 if (!skb->dev) { 157 if (!skb->dev) {
164 rcu_read_unlock(); 158 rcu_read_unlock();
165 159 pr_debug("%s: ERROR: No net_device for VID: %u on dev: %s [%i]\n",
166#ifdef VLAN_DEBUG 160 __FUNCTION__, (unsigned int)vid, dev->name, dev->ifindex);
167 printk(VLAN_DBG "%s: ERROR: No net_device for VID: %i on dev: %s [%i]\n",
168 __FUNCTION__, (unsigned int)(vid), dev->name, dev->ifindex);
169#endif
170 kfree_skb(skb); 161 kfree_skb(skb);
171 return -1; 162 return -1;
172 } 163 }
@@ -186,11 +177,8 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
186 */ 177 */
187 skb->priority = vlan_get_ingress_priority(skb->dev, ntohs(vhdr->h_vlan_TCI)); 178 skb->priority = vlan_get_ingress_priority(skb->dev, ntohs(vhdr->h_vlan_TCI));
188 179
189#ifdef VLAN_DEBUG 180 pr_debug("%s: priority: %u for TCI: %hu\n",
190 printk(VLAN_DBG "%s: priority: %lu for TCI: %hu (hbo)\n", 181 __FUNCTION__, skb->priority, ntohs(vhdr->h_vlan_TCI));
191 __FUNCTION__, (unsigned long)(skb->priority),
192 ntohs(vhdr->h_vlan_TCI));
193#endif
194 182
195 /* The ethernet driver already did the pkt_type calculations 183 /* The ethernet driver already did the pkt_type calculations
196 * for us... 184 * for us...
@@ -335,10 +323,8 @@ static int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
335 int build_vlan_header = 0; 323 int build_vlan_header = 0;
336 struct net_device *vdev = dev; /* save this for the bottom of the method */ 324 struct net_device *vdev = dev; /* save this for the bottom of the method */
337 325
338#ifdef VLAN_DEBUG 326 pr_debug("%s: skb: %p type: %hx len: %u vlan_id: %hx, daddr: %p\n",
339 printk(VLAN_DBG "%s: skb: %p type: %hx len: %x vlan_id: %hx, daddr: %p\n", 327 __FUNCTION__, skb, type, len, VLAN_DEV_INFO(dev)->vlan_id, daddr);
340 __FUNCTION__, skb, type, len, VLAN_DEV_INFO(dev)->vlan_id, daddr);
341#endif
342 328
343 /* build vlan header only if re_order_header flag is NOT set. This 329 /* build vlan header only if re_order_header flag is NOT set. This
344 * fixes some programs that get confused when they see a VLAN device 330 * fixes some programs that get confused when they see a VLAN device
@@ -410,9 +396,7 @@ static int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
410 return -ENOMEM; 396 return -ENOMEM;
411 } 397 }
412 VLAN_DEV_INFO(vdev)->cnt_inc_headroom_on_tx++; 398 VLAN_DEV_INFO(vdev)->cnt_inc_headroom_on_tx++;
413#ifdef VLAN_DEBUG 399 pr_debug("%s: %s: had to grow skb.\n", __FUNCTION__, vdev->name);
414 printk(VLAN_DBG "%s: %s: had to grow skb.\n", __FUNCTION__, vdev->name);
415#endif
416 } 400 }
417 401
418 if (build_vlan_header) { 402 if (build_vlan_header) {
@@ -453,10 +437,8 @@ static int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
453 /* This is not a VLAN frame...but we can fix that! */ 437 /* This is not a VLAN frame...but we can fix that! */
454 VLAN_DEV_INFO(dev)->cnt_encap_on_xmit++; 438 VLAN_DEV_INFO(dev)->cnt_encap_on_xmit++;
455 439
456#ifdef VLAN_DEBUG 440 pr_debug("%s: proto to encap: 0x%hx\n",
457 printk(VLAN_DBG "%s: proto to encap: 0x%hx (hbo)\n", 441 __FUNCTION__, htons(veth->h_vlan_proto));
458 __FUNCTION__, htons(veth->h_vlan_proto));
459#endif
460 /* Construct the second two bytes. This field looks something 442 /* Construct the second two bytes. This field looks something
461 * like: 443 * like:
462 * usr_priority: 3 bits (high bits) 444 * usr_priority: 3 bits (high bits)
@@ -477,14 +459,15 @@ static int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
477 } 459 }
478 } 460 }
479 461
480#ifdef VLAN_DEBUG 462 pr_debug("%s: about to send skb: %p to dev: %s\n",
481 printk(VLAN_DBG "%s: about to send skb: %p to dev: %s\n",
482 __FUNCTION__, skb, skb->dev->name); 463 __FUNCTION__, skb, skb->dev->name);
483 printk(VLAN_DBG " %2hx.%2hx.%2hx.%2xh.%2hx.%2hx %2hx.%2hx.%2hx.%2hx.%2hx.%2hx %4hx %4hx %4hx\n", 464 pr_debug(" " MAC_FMT " " MAC_FMT " %4hx %4hx %4hx\n",
484 veth->h_dest[0], veth->h_dest[1], veth->h_dest[2], veth->h_dest[3], veth->h_dest[4], veth->h_dest[5], 465 veth->h_dest[0], veth->h_dest[1], veth->h_dest[2],
485 veth->h_source[0], veth->h_source[1], veth->h_source[2], veth->h_source[3], veth->h_source[4], veth->h_source[5], 466 veth->h_dest[3], veth->h_dest[4], veth->h_dest[5],
486 veth->h_vlan_proto, veth->h_vlan_TCI, veth->h_vlan_encapsulated_proto); 467 veth->h_source[0], veth->h_source[1], veth->h_source[2],
487#endif 468 veth->h_source[3], veth->h_source[4], veth->h_source[5],
469 veth->h_vlan_proto, veth->h_vlan_TCI,
470 veth->h_vlan_encapsulated_proto);
488 471
489 stats->tx_packets++; /* for statics only */ 472 stats->tx_packets++; /* for statics only */
490 stats->tx_bytes += skb->len; 473 stats->tx_bytes += skb->len;
@@ -596,7 +579,6 @@ int vlan_dev_set_vlan_flag(const struct net_device *dev,
596 } 579 }
597 return 0; 580 return 0;
598 } 581 }
599 printk(KERN_ERR "%s: flag %i is not valid.\n", __FUNCTION__, flag);
600 return -EINVAL; 582 return -EINVAL;
601} 583}
602 584