diff options
author | Stephen Hemminger <shemminger@linux-foundation.org> | 2009-01-09 08:01:40 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-01-21 17:02:40 -0500 |
commit | ddbe9a686805c36a0e68451ebb8cb51b21d0c718 (patch) | |
tree | b43edf7899d00f241c2efc19290ead835541c113 /drivers/net/hamradio/mkiss.c | |
parent | ff908cf83498010e832819cf50a23e16c43b1373 (diff) |
mkiss: convert to internal network device stats
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/hamradio/mkiss.c')
-rw-r--r-- | drivers/net/hamradio/mkiss.c | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c index bbdb311b8420..6fc0e698bcb7 100644 --- a/drivers/net/hamradio/mkiss.c +++ b/drivers/net/hamradio/mkiss.c | |||
@@ -59,8 +59,6 @@ struct mkiss { | |||
59 | unsigned char *xhead; /* pointer to next byte to XMIT */ | 59 | unsigned char *xhead; /* pointer to next byte to XMIT */ |
60 | int xleft; /* bytes left in XMIT queue */ | 60 | int xleft; /* bytes left in XMIT queue */ |
61 | 61 | ||
62 | struct net_device_stats stats; | ||
63 | |||
64 | /* Detailed SLIP statistics. */ | 62 | /* Detailed SLIP statistics. */ |
65 | int mtu; /* Our mtu (to spot changes!) */ | 63 | int mtu; /* Our mtu (to spot changes!) */ |
66 | int buffsize; /* Max buffers sizes */ | 64 | int buffsize; /* Max buffers sizes */ |
@@ -253,7 +251,7 @@ static void ax_bump(struct mkiss *ax) | |||
253 | if (ax->rbuff[0] > 0x0f) { | 251 | if (ax->rbuff[0] > 0x0f) { |
254 | if (ax->rbuff[0] & 0x80) { | 252 | if (ax->rbuff[0] & 0x80) { |
255 | if (check_crc_16(ax->rbuff, ax->rcount) < 0) { | 253 | if (check_crc_16(ax->rbuff, ax->rcount) < 0) { |
256 | ax->stats.rx_errors++; | 254 | ax->dev->stats.rx_errors++; |
257 | spin_unlock_bh(&ax->buflock); | 255 | spin_unlock_bh(&ax->buflock); |
258 | 256 | ||
259 | return; | 257 | return; |
@@ -268,7 +266,7 @@ static void ax_bump(struct mkiss *ax) | |||
268 | *ax->rbuff &= ~0x80; | 266 | *ax->rbuff &= ~0x80; |
269 | } else if (ax->rbuff[0] & 0x20) { | 267 | } else if (ax->rbuff[0] & 0x20) { |
270 | if (check_crc_flex(ax->rbuff, ax->rcount) < 0) { | 268 | if (check_crc_flex(ax->rbuff, ax->rcount) < 0) { |
271 | ax->stats.rx_errors++; | 269 | ax->dev->stats.rx_errors++; |
272 | spin_unlock_bh(&ax->buflock); | 270 | spin_unlock_bh(&ax->buflock); |
273 | return; | 271 | return; |
274 | } | 272 | } |
@@ -295,7 +293,7 @@ static void ax_bump(struct mkiss *ax) | |||
295 | if ((skb = dev_alloc_skb(count)) == NULL) { | 293 | if ((skb = dev_alloc_skb(count)) == NULL) { |
296 | printk(KERN_ERR "mkiss: %s: memory squeeze, dropping packet.\n", | 294 | printk(KERN_ERR "mkiss: %s: memory squeeze, dropping packet.\n", |
297 | ax->dev->name); | 295 | ax->dev->name); |
298 | ax->stats.rx_dropped++; | 296 | ax->dev->stats.rx_dropped++; |
299 | spin_unlock_bh(&ax->buflock); | 297 | spin_unlock_bh(&ax->buflock); |
300 | return; | 298 | return; |
301 | } | 299 | } |
@@ -303,8 +301,8 @@ static void ax_bump(struct mkiss *ax) | |||
303 | memcpy(skb_put(skb,count), ax->rbuff, count); | 301 | memcpy(skb_put(skb,count), ax->rbuff, count); |
304 | skb->protocol = ax25_type_trans(skb, ax->dev); | 302 | skb->protocol = ax25_type_trans(skb, ax->dev); |
305 | netif_rx(skb); | 303 | netif_rx(skb); |
306 | ax->stats.rx_packets++; | 304 | ax->dev->stats.rx_packets++; |
307 | ax->stats.rx_bytes += count; | 305 | ax->dev->stats.rx_bytes += count; |
308 | spin_unlock_bh(&ax->buflock); | 306 | spin_unlock_bh(&ax->buflock); |
309 | } | 307 | } |
310 | 308 | ||
@@ -344,7 +342,7 @@ static void kiss_unesc(struct mkiss *ax, unsigned char s) | |||
344 | return; | 342 | return; |
345 | } | 343 | } |
346 | 344 | ||
347 | ax->stats.rx_over_errors++; | 345 | ax->dev->stats.rx_over_errors++; |
348 | set_bit(AXF_ERROR, &ax->flags); | 346 | set_bit(AXF_ERROR, &ax->flags); |
349 | } | 347 | } |
350 | spin_unlock_bh(&ax->buflock); | 348 | spin_unlock_bh(&ax->buflock); |
@@ -406,7 +404,7 @@ static void ax_changedmtu(struct mkiss *ax) | |||
406 | memcpy(ax->xbuff, ax->xhead, ax->xleft); | 404 | memcpy(ax->xbuff, ax->xhead, ax->xleft); |
407 | } else { | 405 | } else { |
408 | ax->xleft = 0; | 406 | ax->xleft = 0; |
409 | ax->stats.tx_dropped++; | 407 | dev->stats.tx_dropped++; |
410 | } | 408 | } |
411 | } | 409 | } |
412 | 410 | ||
@@ -417,7 +415,7 @@ static void ax_changedmtu(struct mkiss *ax) | |||
417 | memcpy(ax->rbuff, orbuff, ax->rcount); | 415 | memcpy(ax->rbuff, orbuff, ax->rcount); |
418 | } else { | 416 | } else { |
419 | ax->rcount = 0; | 417 | ax->rcount = 0; |
420 | ax->stats.rx_over_errors++; | 418 | dev->stats.rx_over_errors++; |
421 | set_bit(AXF_ERROR, &ax->flags); | 419 | set_bit(AXF_ERROR, &ax->flags); |
422 | } | 420 | } |
423 | } | 421 | } |
@@ -444,7 +442,7 @@ static void ax_encaps(struct net_device *dev, unsigned char *icp, int len) | |||
444 | if (len > ax->mtu) { /* Sigh, shouldn't occur BUT ... */ | 442 | if (len > ax->mtu) { /* Sigh, shouldn't occur BUT ... */ |
445 | len = ax->mtu; | 443 | len = ax->mtu; |
446 | printk(KERN_ERR "mkiss: %s: truncating oversized transmit packet!\n", ax->dev->name); | 444 | printk(KERN_ERR "mkiss: %s: truncating oversized transmit packet!\n", ax->dev->name); |
447 | ax->stats.tx_dropped++; | 445 | dev->stats.tx_dropped++; |
448 | netif_start_queue(dev); | 446 | netif_start_queue(dev); |
449 | return; | 447 | return; |
450 | } | 448 | } |
@@ -518,8 +516,8 @@ static void ax_encaps(struct net_device *dev, unsigned char *icp, int len) | |||
518 | 516 | ||
519 | set_bit(TTY_DO_WRITE_WAKEUP, &ax->tty->flags); | 517 | set_bit(TTY_DO_WRITE_WAKEUP, &ax->tty->flags); |
520 | actual = ax->tty->ops->write(ax->tty, ax->xbuff, count); | 518 | actual = ax->tty->ops->write(ax->tty, ax->xbuff, count); |
521 | ax->stats.tx_packets++; | 519 | dev->stats.tx_packets++; |
522 | ax->stats.tx_bytes += actual; | 520 | dev->stats.tx_bytes += actual; |
523 | 521 | ||
524 | ax->dev->trans_start = jiffies; | 522 | ax->dev->trans_start = jiffies; |
525 | ax->xleft = count - actual; | 523 | ax->xleft = count - actual; |
@@ -664,13 +662,6 @@ static int ax_close(struct net_device *dev) | |||
664 | return 0; | 662 | return 0; |
665 | } | 663 | } |
666 | 664 | ||
667 | static struct net_device_stats *ax_get_stats(struct net_device *dev) | ||
668 | { | ||
669 | struct mkiss *ax = netdev_priv(dev); | ||
670 | |||
671 | return &ax->stats; | ||
672 | } | ||
673 | |||
674 | static const struct header_ops ax_header_ops = { | 665 | static const struct header_ops ax_header_ops = { |
675 | .create = ax_header, | 666 | .create = ax_header, |
676 | .rebuild = ax_rebuild_header, | 667 | .rebuild = ax_rebuild_header, |
@@ -683,7 +674,6 @@ static void ax_setup(struct net_device *dev) | |||
683 | dev->hard_start_xmit = ax_xmit; | 674 | dev->hard_start_xmit = ax_xmit; |
684 | dev->open = ax_open_dev; | 675 | dev->open = ax_open_dev; |
685 | dev->stop = ax_close; | 676 | dev->stop = ax_close; |
686 | dev->get_stats = ax_get_stats; | ||
687 | dev->set_mac_address = ax_set_mac_address; | 677 | dev->set_mac_address = ax_set_mac_address; |
688 | dev->hard_header_len = 0; | 678 | dev->hard_header_len = 0; |
689 | dev->addr_len = 0; | 679 | dev->addr_len = 0; |
@@ -929,7 +919,7 @@ static void mkiss_receive_buf(struct tty_struct *tty, const unsigned char *cp, | |||
929 | while (count--) { | 919 | while (count--) { |
930 | if (fp != NULL && *fp++) { | 920 | if (fp != NULL && *fp++) { |
931 | if (!test_and_set_bit(AXF_ERROR, &ax->flags)) | 921 | if (!test_and_set_bit(AXF_ERROR, &ax->flags)) |
932 | ax->stats.rx_errors++; | 922 | ax->dev->stats.rx_errors++; |
933 | cp++; | 923 | cp++; |
934 | continue; | 924 | continue; |
935 | } | 925 | } |