aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPaulius Zaleckas <paulius.zaleckas@teltonika.lt>2008-04-29 18:49:15 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-05-13 01:35:24 -0400
commitde0561c43550f78cd837a24179f1859817f24578 (patch)
tree9b9e66edc1fcdc0c6b8e6efcce46aba6b79484c0 /drivers
parentcd65284f6ec482622d2b30cd9996712d830ba228 (diff)
6pack: use netstats in net_device structure
Use net_device_stats from net_device structure instead of local. Kill sp_get_stats function, because by default it is used identical internal_stats function from net/core/dev.c Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/hamradio/6pack.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
index 9d5721287d6f..06ad9f302b5a 100644
--- a/drivers/net/hamradio/6pack.c
+++ b/drivers/net/hamradio/6pack.c
@@ -99,9 +99,6 @@ struct sixpack {
99 unsigned int rx_count; 99 unsigned int rx_count;
100 unsigned int rx_count_cooked; 100 unsigned int rx_count_cooked;
101 101
102 /* 6pack interface statistics. */
103 struct net_device_stats stats;
104
105 int mtu; /* Our mtu (to spot changes!) */ 102 int mtu; /* Our mtu (to spot changes!) */
106 int buffsize; /* Max buffers sizes */ 103 int buffsize; /* Max buffers sizes */
107 104
@@ -237,7 +234,7 @@ static void sp_encaps(struct sixpack *sp, unsigned char *icp, int len)
237 return; 234 return;
238 235
239out_drop: 236out_drop:
240 sp->stats.tx_dropped++; 237 sp->dev->stats.tx_dropped++;
241 netif_start_queue(sp->dev); 238 netif_start_queue(sp->dev);
242 if (net_ratelimit()) 239 if (net_ratelimit())
243 printk(KERN_DEBUG "%s: %s - dropped.\n", sp->dev->name, msg); 240 printk(KERN_DEBUG "%s: %s - dropped.\n", sp->dev->name, msg);
@@ -252,7 +249,7 @@ static int sp_xmit(struct sk_buff *skb, struct net_device *dev)
252 spin_lock_bh(&sp->lock); 249 spin_lock_bh(&sp->lock);
253 /* We were not busy, so we are now... :-) */ 250 /* We were not busy, so we are now... :-) */
254 netif_stop_queue(dev); 251 netif_stop_queue(dev);
255 sp->stats.tx_bytes += skb->len; 252 dev->stats.tx_bytes += skb->len;
256 sp_encaps(sp, skb->data, skb->len); 253 sp_encaps(sp, skb->data, skb->len);
257 spin_unlock_bh(&sp->lock); 254 spin_unlock_bh(&sp->lock);
258 255
@@ -298,12 +295,6 @@ static int sp_header(struct sk_buff *skb, struct net_device *dev,
298 return 0; 295 return 0;
299} 296}
300 297
301static struct net_device_stats *sp_get_stats(struct net_device *dev)
302{
303 struct sixpack *sp = netdev_priv(dev);
304 return &sp->stats;
305}
306
307static int sp_set_mac_address(struct net_device *dev, void *addr) 298static int sp_set_mac_address(struct net_device *dev, void *addr)
308{ 299{
309 struct sockaddr_ax25 *sa = addr; 300 struct sockaddr_ax25 *sa = addr;
@@ -338,7 +329,6 @@ static void sp_setup(struct net_device *dev)
338 dev->destructor = free_netdev; 329 dev->destructor = free_netdev;
339 dev->stop = sp_close; 330 dev->stop = sp_close;
340 331
341 dev->get_stats = sp_get_stats;
342 dev->set_mac_address = sp_set_mac_address; 332 dev->set_mac_address = sp_set_mac_address;
343 dev->hard_header_len = AX25_MAX_HEADER_LEN; 333 dev->hard_header_len = AX25_MAX_HEADER_LEN;
344 dev->header_ops = &sp_header_ops; 334 dev->header_ops = &sp_header_ops;
@@ -370,7 +360,7 @@ static void sp_bump(struct sixpack *sp, char cmd)
370 360
371 count = sp->rcount + 1; 361 count = sp->rcount + 1;
372 362
373 sp->stats.rx_bytes += count; 363 sp->dev->stats.rx_bytes += count;
374 364
375 if ((skb = dev_alloc_skb(count)) == NULL) 365 if ((skb = dev_alloc_skb(count)) == NULL)
376 goto out_mem; 366 goto out_mem;
@@ -382,12 +372,12 @@ static void sp_bump(struct sixpack *sp, char cmd)
382 skb->protocol = ax25_type_trans(skb, sp->dev); 372 skb->protocol = ax25_type_trans(skb, sp->dev);
383 netif_rx(skb); 373 netif_rx(skb);
384 sp->dev->last_rx = jiffies; 374 sp->dev->last_rx = jiffies;
385 sp->stats.rx_packets++; 375 sp->dev->stats.rx_packets++;
386 376
387 return; 377 return;
388 378
389out_mem: 379out_mem:
390 sp->stats.rx_dropped++; 380 sp->dev->stats.rx_dropped++;
391} 381}
392 382
393 383
@@ -436,7 +426,7 @@ static void sixpack_write_wakeup(struct tty_struct *tty)
436 if (sp->xleft <= 0) { 426 if (sp->xleft <= 0) {
437 /* Now serial buffer is almost free & we can start 427 /* Now serial buffer is almost free & we can start
438 * transmission of another packet */ 428 * transmission of another packet */
439 sp->stats.tx_packets++; 429 sp->dev->stats.tx_packets++;
440 clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); 430 clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
441 sp->tx_enable = 0; 431 sp->tx_enable = 0;
442 netif_wake_queue(sp->dev); 432 netif_wake_queue(sp->dev);
@@ -484,7 +474,7 @@ static void sixpack_receive_buf(struct tty_struct *tty,
484 count--; 474 count--;
485 if (fp && *fp++) { 475 if (fp && *fp++) {
486 if (!test_and_set_bit(SIXPF_ERROR, &sp->flags)) 476 if (!test_and_set_bit(SIXPF_ERROR, &sp->flags))
487 sp->stats.rx_errors++; 477 sp->dev->stats.rx_errors++;
488 continue; 478 continue;
489 } 479 }
490 } 480 }