diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/net/slip.c | 61 | ||||
| -rw-r--r-- | drivers/net/slip.h | 9 |
2 files changed, 31 insertions, 39 deletions
diff --git a/drivers/net/slip.c b/drivers/net/slip.c index d5a36f5417cc..38547a8938fe 100644 --- a/drivers/net/slip.c +++ b/drivers/net/slip.c | |||
| @@ -271,7 +271,7 @@ static int sl_realloc_bufs(struct slip *sl, int mtu) | |||
| 271 | memcpy(sl->xbuff, sl->xhead, sl->xleft); | 271 | memcpy(sl->xbuff, sl->xhead, sl->xleft); |
| 272 | } else { | 272 | } else { |
| 273 | sl->xleft = 0; | 273 | sl->xleft = 0; |
| 274 | sl->tx_dropped++; | 274 | dev->stats.tx_dropped++; |
| 275 | } | 275 | } |
| 276 | } | 276 | } |
| 277 | sl->xhead = sl->xbuff; | 277 | sl->xhead = sl->xbuff; |
| @@ -281,7 +281,7 @@ static int sl_realloc_bufs(struct slip *sl, int mtu) | |||
| 281 | memcpy(sl->rbuff, rbuff, sl->rcount); | 281 | memcpy(sl->rbuff, rbuff, sl->rcount); |
| 282 | } else { | 282 | } else { |
| 283 | sl->rcount = 0; | 283 | sl->rcount = 0; |
| 284 | sl->rx_over_errors++; | 284 | dev->stats.rx_over_errors++; |
| 285 | set_bit(SLF_ERROR, &sl->flags); | 285 | set_bit(SLF_ERROR, &sl->flags); |
| 286 | } | 286 | } |
| 287 | } | 287 | } |
| @@ -319,6 +319,7 @@ static inline void sl_unlock(struct slip *sl) | |||
| 319 | /* Send one completely decapsulated IP datagram to the IP layer. */ | 319 | /* Send one completely decapsulated IP datagram to the IP layer. */ |
| 320 | static void sl_bump(struct slip *sl) | 320 | static void sl_bump(struct slip *sl) |
| 321 | { | 321 | { |
| 322 | struct net_device *dev = sl->dev; | ||
| 322 | struct sk_buff *skb; | 323 | struct sk_buff *skb; |
| 323 | int count; | 324 | int count; |
| 324 | 325 | ||
| @@ -329,13 +330,13 @@ static void sl_bump(struct slip *sl) | |||
| 329 | if (c & SL_TYPE_COMPRESSED_TCP) { | 330 | if (c & SL_TYPE_COMPRESSED_TCP) { |
| 330 | /* ignore compressed packets when CSLIP is off */ | 331 | /* ignore compressed packets when CSLIP is off */ |
| 331 | if (!(sl->mode & SL_MODE_CSLIP)) { | 332 | if (!(sl->mode & SL_MODE_CSLIP)) { |
| 332 | printk(KERN_WARNING "%s: compressed packet ignored\n", sl->dev->name); | 333 | printk(KERN_WARNING "%s: compressed packet ignored\n", dev->name); |
| 333 | return; | 334 | return; |
| 334 | } | 335 | } |
| 335 | /* make sure we've reserved enough space for uncompress | 336 | /* make sure we've reserved enough space for uncompress |
| 336 | to use */ | 337 | to use */ |
| 337 | if (count + 80 > sl->buffsize) { | 338 | if (count + 80 > sl->buffsize) { |
| 338 | sl->rx_over_errors++; | 339 | dev->stats.rx_over_errors++; |
| 339 | return; | 340 | return; |
| 340 | } | 341 | } |
| 341 | count = slhc_uncompress(sl->slcomp, sl->rbuff, count); | 342 | count = slhc_uncompress(sl->slcomp, sl->rbuff, count); |
| @@ -346,7 +347,7 @@ static void sl_bump(struct slip *sl) | |||
| 346 | /* turn on header compression */ | 347 | /* turn on header compression */ |
| 347 | sl->mode |= SL_MODE_CSLIP; | 348 | sl->mode |= SL_MODE_CSLIP; |
| 348 | sl->mode &= ~SL_MODE_ADAPTIVE; | 349 | sl->mode &= ~SL_MODE_ADAPTIVE; |
| 349 | printk(KERN_INFO "%s: header compression turned on\n", sl->dev->name); | 350 | printk(KERN_INFO "%s: header compression turned on\n", dev->name); |
| 350 | } | 351 | } |
| 351 | sl->rbuff[0] &= 0x4f; | 352 | sl->rbuff[0] &= 0x4f; |
| 352 | if (slhc_remember(sl->slcomp, sl->rbuff, count) <= 0) | 353 | if (slhc_remember(sl->slcomp, sl->rbuff, count) <= 0) |
| @@ -355,20 +356,20 @@ static void sl_bump(struct slip *sl) | |||
| 355 | } | 356 | } |
| 356 | #endif /* SL_INCLUDE_CSLIP */ | 357 | #endif /* SL_INCLUDE_CSLIP */ |
| 357 | 358 | ||
| 358 | sl->rx_bytes += count; | 359 | dev->stats.rx_bytes += count; |
| 359 | 360 | ||
| 360 | skb = dev_alloc_skb(count); | 361 | skb = dev_alloc_skb(count); |
| 361 | if (skb == NULL) { | 362 | if (skb == NULL) { |
| 362 | printk(KERN_WARNING "%s: memory squeeze, dropping packet.\n", sl->dev->name); | 363 | printk(KERN_WARNING "%s: memory squeeze, dropping packet.\n", dev->name); |
| 363 | sl->rx_dropped++; | 364 | dev->stats.rx_dropped++; |
| 364 | return; | 365 | return; |
| 365 | } | 366 | } |
| 366 | skb->dev = sl->dev; | 367 | skb->dev = dev; |
| 367 | memcpy(skb_put(skb, count), sl->rbuff, count); | 368 | memcpy(skb_put(skb, count), sl->rbuff, count); |
| 368 | skb_reset_mac_header(skb); | 369 | skb_reset_mac_header(skb); |
| 369 | skb->protocol = htons(ETH_P_IP); | 370 | skb->protocol = htons(ETH_P_IP); |
| 370 | netif_rx(skb); | 371 | netif_rx(skb); |
| 371 | sl->rx_packets++; | 372 | dev->stats.rx_packets++; |
| 372 | } | 373 | } |
| 373 | 374 | ||
| 374 | /* Encapsulate one IP datagram and stuff into a TTY queue. */ | 375 | /* Encapsulate one IP datagram and stuff into a TTY queue. */ |
| @@ -379,7 +380,7 @@ static void sl_encaps(struct slip *sl, unsigned char *icp, int len) | |||
| 379 | 380 | ||
| 380 | if (len > sl->mtu) { /* Sigh, shouldn't occur BUT ... */ | 381 | if (len > sl->mtu) { /* Sigh, shouldn't occur BUT ... */ |
| 381 | printk(KERN_WARNING "%s: truncating oversized transmit packet!\n", sl->dev->name); | 382 | printk(KERN_WARNING "%s: truncating oversized transmit packet!\n", sl->dev->name); |
| 382 | sl->tx_dropped++; | 383 | sl->dev->stats.tx_dropped++; |
| 383 | sl_unlock(sl); | 384 | sl_unlock(sl); |
| 384 | return; | 385 | return; |
| 385 | } | 386 | } |
| @@ -433,7 +434,7 @@ static void slip_write_wakeup(struct tty_struct *tty) | |||
| 433 | if (sl->xleft <= 0) { | 434 | if (sl->xleft <= 0) { |
| 434 | /* Now serial buffer is almost free & we can start | 435 | /* Now serial buffer is almost free & we can start |
| 435 | * transmission of another packet */ | 436 | * transmission of another packet */ |
| 436 | sl->tx_packets++; | 437 | sl->dev->stats.tx_packets++; |
| 437 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); | 438 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); |
| 438 | sl_unlock(sl); | 439 | sl_unlock(sl); |
| 439 | return; | 440 | return; |
| @@ -496,7 +497,7 @@ sl_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 496 | } | 497 | } |
| 497 | 498 | ||
| 498 | sl_lock(sl); | 499 | sl_lock(sl); |
| 499 | sl->tx_bytes += skb->len; | 500 | dev->stats.tx_bytes += skb->len; |
| 500 | sl_encaps(sl, skb->data, skb->len); | 501 | sl_encaps(sl, skb->data, skb->len); |
| 501 | spin_unlock(&sl->lock); | 502 | spin_unlock(&sl->lock); |
| 502 | 503 | ||
| @@ -558,16 +559,16 @@ static int sl_change_mtu(struct net_device *dev, int new_mtu) | |||
| 558 | 559 | ||
| 559 | /* Netdevice get statistics request */ | 560 | /* Netdevice get statistics request */ |
| 560 | 561 | ||
| 561 | static struct net_device_stats * | 562 | static struct rtnl_link_stats64 * |
| 562 | sl_get_stats(struct net_device *dev) | 563 | sl_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) |
| 563 | { | 564 | { |
| 564 | struct net_device_stats *stats = &dev->stats; | 565 | struct net_device_stats *devstats = &dev->stats; |
| 565 | struct slip *sl = netdev_priv(dev); | ||
| 566 | unsigned long c_rx_dropped = 0; | 566 | unsigned long c_rx_dropped = 0; |
| 567 | #ifdef SL_INCLUDE_CSLIP | 567 | #ifdef SL_INCLUDE_CSLIP |
| 568 | unsigned long c_rx_fifo_errors = 0; | 568 | unsigned long c_rx_fifo_errors = 0; |
| 569 | unsigned long c_tx_fifo_errors = 0; | 569 | unsigned long c_tx_fifo_errors = 0; |
| 570 | unsigned long c_collisions = 0; | 570 | unsigned long c_collisions = 0; |
| 571 | struct slip *sl = netdev_priv(dev); | ||
| 571 | struct slcompress *comp = sl->slcomp; | 572 | struct slcompress *comp = sl->slcomp; |
| 572 | 573 | ||
| 573 | if (comp) { | 574 | if (comp) { |
| @@ -580,16 +581,16 @@ sl_get_stats(struct net_device *dev) | |||
| 580 | stats->tx_fifo_errors = sl->tx_compressed + c_tx_fifo_errors; | 581 | stats->tx_fifo_errors = sl->tx_compressed + c_tx_fifo_errors; |
| 581 | stats->collisions = sl->tx_misses + c_collisions; | 582 | stats->collisions = sl->tx_misses + c_collisions; |
| 582 | #endif | 583 | #endif |
| 584 | stats->rx_packets = devstats->rx_packets; | ||
| 585 | stats->tx_packets = devstats->tx_packets; | ||
| 586 | stats->rx_bytes = devstats->rx_bytes; | ||
| 587 | stats->tx_bytes = devstats->tx_bytes; | ||
| 588 | stats->rx_dropped = devstats->rx_dropped + c_rx_dropped; | ||
| 589 | stats->tx_dropped = devstats->tx_dropped; | ||
| 590 | stats->tx_errors = devstats->tx_errors; | ||
| 591 | stats->rx_errors = devstats->rx_errors; | ||
| 592 | stats->rx_over_errors = devstats->rx_over_errors; | ||
| 583 | 593 | ||
| 584 | stats->rx_packets = sl->rx_packets; | ||
| 585 | stats->tx_packets = sl->tx_packets; | ||
| 586 | stats->rx_bytes = sl->rx_bytes; | ||
| 587 | stats->tx_bytes = sl->tx_bytes; | ||
| 588 | stats->rx_dropped = sl->rx_dropped + c_rx_dropped; | ||
| 589 | stats->tx_dropped = sl->tx_dropped; | ||
| 590 | stats->tx_errors = sl->tx_errors; | ||
| 591 | stats->rx_errors = sl->rx_errors; | ||
| 592 | stats->rx_over_errors = sl->rx_over_errors; | ||
| 593 | return stats; | 594 | return stats; |
| 594 | } | 595 | } |
| 595 | 596 | ||
| @@ -633,7 +634,7 @@ static const struct net_device_ops sl_netdev_ops = { | |||
| 633 | .ndo_open = sl_open, | 634 | .ndo_open = sl_open, |
| 634 | .ndo_stop = sl_close, | 635 | .ndo_stop = sl_close, |
| 635 | .ndo_start_xmit = sl_xmit, | 636 | .ndo_start_xmit = sl_xmit, |
| 636 | .ndo_get_stats = sl_get_stats, | 637 | .ndo_get_stats64 = sl_get_stats64, |
| 637 | .ndo_change_mtu = sl_change_mtu, | 638 | .ndo_change_mtu = sl_change_mtu, |
| 638 | .ndo_tx_timeout = sl_tx_timeout, | 639 | .ndo_tx_timeout = sl_tx_timeout, |
| 639 | #ifdef CONFIG_SLIP_SMART | 640 | #ifdef CONFIG_SLIP_SMART |
| @@ -681,7 +682,7 @@ static void slip_receive_buf(struct tty_struct *tty, const unsigned char *cp, | |||
| 681 | while (count--) { | 682 | while (count--) { |
| 682 | if (fp && *fp++) { | 683 | if (fp && *fp++) { |
| 683 | if (!test_and_set_bit(SLF_ERROR, &sl->flags)) | 684 | if (!test_and_set_bit(SLF_ERROR, &sl->flags)) |
| 684 | sl->rx_errors++; | 685 | sl->dev->stats.rx_errors++; |
| 685 | cp++; | 686 | cp++; |
| 686 | continue; | 687 | continue; |
| 687 | } | 688 | } |
| @@ -981,7 +982,7 @@ static void slip_unesc(struct slip *sl, unsigned char s) | |||
| 981 | sl->rbuff[sl->rcount++] = s; | 982 | sl->rbuff[sl->rcount++] = s; |
| 982 | return; | 983 | return; |
| 983 | } | 984 | } |
| 984 | sl->rx_over_errors++; | 985 | sl->dev->stats.rx_over_errors++; |
| 985 | set_bit(SLF_ERROR, &sl->flags); | 986 | set_bit(SLF_ERROR, &sl->flags); |
| 986 | } | 987 | } |
| 987 | } | 988 | } |
| @@ -1057,7 +1058,7 @@ static void slip_unesc6(struct slip *sl, unsigned char s) | |||
| 1057 | sl->rbuff[sl->rcount++] = c; | 1058 | sl->rbuff[sl->rcount++] = c; |
| 1058 | return; | 1059 | return; |
| 1059 | } | 1060 | } |
| 1060 | sl->rx_over_errors++; | 1061 | sl->dev->stats.rx_over_errors++; |
| 1061 | set_bit(SLF_ERROR, &sl->flags); | 1062 | set_bit(SLF_ERROR, &sl->flags); |
| 1062 | } | 1063 | } |
| 1063 | } | 1064 | } |
diff --git a/drivers/net/slip.h b/drivers/net/slip.h index 9ea5c11287d2..914e958abbfc 100644 --- a/drivers/net/slip.h +++ b/drivers/net/slip.h | |||
| @@ -67,15 +67,6 @@ struct slip { | |||
| 67 | int xleft; /* bytes left in XMIT queue */ | 67 | int xleft; /* bytes left in XMIT queue */ |
| 68 | 68 | ||
| 69 | /* SLIP interface statistics. */ | 69 | /* SLIP interface statistics. */ |
| 70 | unsigned long rx_packets; /* inbound frames counter */ | ||
| 71 | unsigned long tx_packets; /* outbound frames counter */ | ||
| 72 | unsigned long rx_bytes; /* inbound byte counte */ | ||
| 73 | unsigned long tx_bytes; /* outbound byte counter */ | ||
| 74 | unsigned long rx_errors; /* Parity, etc. errors */ | ||
| 75 | unsigned long tx_errors; /* Planned stuff */ | ||
| 76 | unsigned long rx_dropped; /* No memory for skb */ | ||
| 77 | unsigned long tx_dropped; /* When MTU change */ | ||
| 78 | unsigned long rx_over_errors; /* Frame bigger than SLIP buf. */ | ||
| 79 | #ifdef SL_INCLUDE_CSLIP | 70 | #ifdef SL_INCLUDE_CSLIP |
| 80 | unsigned long tx_compressed; | 71 | unsigned long tx_compressed; |
| 81 | unsigned long rx_compressed; | 72 | unsigned long rx_compressed; |
