Skip to contentSkip to conversation

drivers/net/shaper.c: cleanups

PATCH In review Adrian Bunk 2 participants 3 messages Feb 19, 2005 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/net/shaper.c: cleanups

This patch contains the following cleanups:
- remove an unused #define SHAPER_BANNER
- remove the sh_debug flag

---

 drivers/net/shaper.c |   30 +++++-------------------------
 1 files changed, 5 insertions(+), 25 deletions(-)
drivers/net/shaper.c renamed from drivers/net/shaper.c.old +5 -25
@@ -96,10 +96,6 @@
 }; 
 #define SHAPERCB(skb) ((struct shaper_cb *) ((skb)->cb))
 
-int sh_debug;		/* Debug flag */
-
-#define SHAPER_BANNER	"CymruNet Traffic Shaper BETA 0.04 for Linux 2.1\n"
-
 /*
  *	Locking
  */
@@ -252,8 +248,6 @@
 			skb_queue_tail(&shaper->sendq, skb);
 	}
 #endif 	
-	if(sh_debug)
- 		printk("Frame queued.\n");
  	if(skb_queue_len(&shaper->sendq)>SHAPER_QLEN)
  	{
  		ptr=skb_dequeue(&shaper->sendq);
@@ -271,22 +265,16 @@
 static void shaper_queue_xmit(struct shaper *shaper, struct sk_buff *skb)
 {
 	struct sk_buff *newskb=skb_clone(skb, GFP_ATOMIC);
-	if(sh_debug)
-		printk("Kick frame on %p\n",newskb);
 	if(newskb)
 	{
 		newskb->dev=shaper->dev;
 		newskb->priority=2;
-		if(sh_debug)
-			printk("Kick new frame to %s, %d\n",
-				shaper->dev->name,newskb->priority);
+
 		dev_queue_xmit(newskb);
 
                 shaper->stats.tx_bytes += skb->len;
 		shaper->stats.tx_packets++;
 
-                if(sh_debug)
-			printk("Kicked new frame out.\n");
 		dev_kfree_skb(skb);
 	}
 }
@@ -316,8 +304,6 @@
 	 
 	if (test_and_set_bit(0, &shaper->locked))
 	{
-		if(sh_debug)
-			printk("Shaper locked.\n");
 		mod_timer(&shaper->timer, jiffies);
 		return;
 	}
@@ -334,8 +320,6 @@
 		 *	of SHAPER_BURST) gets kicked onto the link 
 		 */
 		 
-		if(sh_debug)
-			printk("Clock = %ld, jiffies = %ld\n", SHAPERCB(skb)->shapeclock, jiffies);
 		if(time_before_eq(SHAPERCB(skb)->shapeclock, jiffies + SHAPER_BURST))
 		{
 			/*
@@ -444,8 +428,7 @@
 {
 	struct shaper *sh=dev->priv;
 	int v;
-	if(sh_debug)
-		printk("Shaper header\n");
+
 	skb->dev=sh->dev;
 	v=sh->hard_header(skb,sh->dev,type,daddr,saddr,len);
 	skb->dev=dev;
@@ -457,8 +440,7 @@
 	struct shaper *sh=skb->dev->priv;
 	struct net_device *dev=skb->dev;
 	int v;
-	if(sh_debug)
-		printk("Shaper rebuild header\n");
+
 	skb->dev=sh->dev;
 	v=sh->rebuild_header(skb);
 	skb->dev=dev;
@@ -471,8 +453,7 @@
 	struct shaper *sh=neigh->dev->priv;
 	struct net_device *tmp;
 	int ret;
-	if(sh_debug)
-		printk("Shaper header cache bind\n");
+
 	tmp=neigh->dev;
 	neigh->dev=sh->dev;
 	ret=sh->hard_header_cache(neigh,hh);
@@ -484,8 +465,7 @@
 	unsigned char *haddr)
 {
 	struct shaper *sh=dev->priv;
-	if(sh_debug)
-		printk("Shaper cache update\n");
+
 	sh->header_cache_update(hh, sh->dev, haddr);
 }
 #endif
#1 lore raw
Quoted 5 lines · Adrian Bunk

This patch contains the following cleanups:
- remove an unused #define SHAPER_BANNER
- remove the sh_debug flag

you are removing presumably-useful debug code; NAK.

#2 lore raw

Re: [2.6 patch] drivers/net/shaper.c: make a variable static

Quoted 8 lines · Jeff Garzik
Quoted 5 lines · Adrian Bunk

This patch contains the following cleanups:
- remove an unused #define SHAPER_BANNER
- remove the sh_debug flag

you are removing presumably-useful debug code; NAK.

OK, less invasive patch below.

<-- snip -->

This patch makes a needlessly global variable static.

drivers/net/shaper.c renamed from drivers/net/shaper.c.old +1 -1
@@ -96,7 +96,7 @@
 }; 
 #define SHAPERCB(skb) ((struct shaper_cb *) ((skb)->cb))
 
-int sh_debug;		/* Debug flag */
+static int sh_debug;		/* Debug flag */
 
 #define SHAPER_BANNER	"CymruNet Traffic Shaper BETA 0.04 for Linux 2.1\n"