aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/shaper.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-10-03 20:41:50 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:51:16 -0400
commit09f75cd7bf13720738e6a196cc0107ce9a5bd5a0 (patch)
tree4c85b0b395abe7f88c87162fc22570e5de255cb1 /drivers/net/shaper.c
parentff8ac60948ba819b89e9c87083e8050fc2f89999 (diff)
[NET] drivers/net: statistics cleanup #1 -- save memory and shrink code
We now have struct net_device_stats embedded in struct net_device, and the default ->get_stats() hook does the obvious thing for us. Run through drivers/net/* and remove the driver-local storage of statistics, and driver-local ->get_stats() hook where applicable. This was just the low-hanging fruit in drivers/net; plenty more drivers remain to be updated. [ Resolved conflicts with napi_struct changes and fix sunqe build regression... -DaveM ] Signed-off-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/shaper.c')
-rw-r--r--drivers/net/shaper.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/net/shaper.c b/drivers/net/shaper.c
index b56721a68a85..315feba7dacc 100644
--- a/drivers/net/shaper.c
+++ b/drivers/net/shaper.c
@@ -171,7 +171,7 @@ static int shaper_start_xmit(struct sk_buff *skb, struct net_device *dev)
171 */ 171 */
172 if(time_after(SHAPERCB(skb)->shapeclock,jiffies + SHAPER_LATENCY)) { 172 if(time_after(SHAPERCB(skb)->shapeclock,jiffies + SHAPER_LATENCY)) {
173 dev_kfree_skb(skb); 173 dev_kfree_skb(skb);
174 shaper->stats.tx_dropped++; 174 dev->stats.tx_dropped++;
175 } else 175 } else
176 skb_queue_tail(&shaper->sendq, skb); 176 skb_queue_tail(&shaper->sendq, skb);
177 } 177 }
@@ -182,7 +182,7 @@ static int shaper_start_xmit(struct sk_buff *skb, struct net_device *dev)
182 { 182 {
183 ptr=skb_dequeue(&shaper->sendq); 183 ptr=skb_dequeue(&shaper->sendq);
184 dev_kfree_skb(ptr); 184 dev_kfree_skb(ptr);
185 shaper->stats.collisions++; 185 dev->stats.collisions++;
186 } 186 }
187 shaper_kick(shaper); 187 shaper_kick(shaper);
188 spin_unlock(&shaper->lock); 188 spin_unlock(&shaper->lock);
@@ -207,8 +207,8 @@ static void shaper_queue_xmit(struct shaper *shaper, struct sk_buff *skb)
207 shaper->dev->name,newskb->priority); 207 shaper->dev->name,newskb->priority);
208 dev_queue_xmit(newskb); 208 dev_queue_xmit(newskb);
209 209
210 shaper->stats.tx_bytes += skb->len; 210 shaper->dev->stats.tx_bytes += skb->len;
211 shaper->stats.tx_packets++; 211 shaper->dev->stats.tx_packets++;
212 212
213 if(sh_debug) 213 if(sh_debug)
214 printk("Kicked new frame out.\n"); 214 printk("Kicked new frame out.\n");
@@ -330,12 +330,6 @@ static int shaper_close(struct net_device *dev)
330 * ARP and other resolutions and not before. 330 * ARP and other resolutions and not before.
331 */ 331 */
332 332
333static struct net_device_stats *shaper_get_stats(struct net_device *dev)
334{
335 struct shaper *sh=dev->priv;
336 return &sh->stats;
337}
338
339static int shaper_header(struct sk_buff *skb, struct net_device *dev, 333static int shaper_header(struct sk_buff *skb, struct net_device *dev,
340 unsigned short type, void *daddr, void *saddr, unsigned len) 334 unsigned short type, void *daddr, void *saddr, unsigned len)
341{ 335{
@@ -538,7 +532,6 @@ static void __init shaper_setup(struct net_device *dev)
538 dev->open = shaper_open; 532 dev->open = shaper_open;
539 dev->stop = shaper_close; 533 dev->stop = shaper_close;
540 dev->hard_start_xmit = shaper_start_xmit; 534 dev->hard_start_xmit = shaper_start_xmit;
541 dev->get_stats = shaper_get_stats;
542 dev->set_multicast_list = NULL; 535 dev->set_multicast_list = NULL;
543 536
544 /* 537 /*