diff options
author | Kulikov Vasiliy <segooon@gmail.com> | 2010-07-04 22:14:09 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-07-05 22:41:18 -0400 |
commit | 174afef4ea65fc58e8d18a0c64c890cf7d4e5924 (patch) | |
tree | 2925ba6aa5c72d5c079d52fe708825398d469264 /drivers/net/mac89x0.c | |
parent | 2321e80ac84cc616edda926aa1932b344409dccc (diff) |
mac89x0: Use the instance of net_device_stats from net_device.
Since net_device has an instance of net_device_stats,
we can remove the instance of this from the adapter structure.
Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/mac89x0.c')
-rw-r--r-- | drivers/net/mac89x0.c | 52 |
1 files changed, 29 insertions, 23 deletions
diff --git a/drivers/net/mac89x0.c b/drivers/net/mac89x0.c index 69fa4ef64dd2..669b317974a8 100644 --- a/drivers/net/mac89x0.c +++ b/drivers/net/mac89x0.c | |||
@@ -110,7 +110,6 @@ static unsigned int net_debug = NET_DEBUG; | |||
110 | 110 | ||
111 | /* Information that need to be kept for each board. */ | 111 | /* Information that need to be kept for each board. */ |
112 | struct net_local { | 112 | struct net_local { |
113 | struct net_device_stats stats; | ||
114 | int chip_type; /* one of: CS8900, CS8920, CS8920M */ | 113 | int chip_type; /* one of: CS8900, CS8920, CS8920M */ |
115 | char chip_revision; /* revision letter of the chip ('A'...) */ | 114 | char chip_revision; /* revision letter of the chip ('A'...) */ |
116 | int send_cmd; /* the propercommand used to send a packet. */ | 115 | int send_cmd; /* the propercommand used to send a packet. */ |
@@ -444,13 +443,18 @@ static irqreturn_t net_interrupt(int irq, void *dev_id) | |||
444 | net_rx(dev); | 443 | net_rx(dev); |
445 | break; | 444 | break; |
446 | case ISQ_TRANSMITTER_EVENT: | 445 | case ISQ_TRANSMITTER_EVENT: |
447 | lp->stats.tx_packets++; | 446 | dev->stats.tx_packets++; |
448 | netif_wake_queue(dev); | 447 | netif_wake_queue(dev); |
449 | if ((status & TX_OK) == 0) lp->stats.tx_errors++; | 448 | if ((status & TX_OK) == 0) |
450 | if (status & TX_LOST_CRS) lp->stats.tx_carrier_errors++; | 449 | dev->stats.tx_errors++; |
451 | if (status & TX_SQE_ERROR) lp->stats.tx_heartbeat_errors++; | 450 | if (status & TX_LOST_CRS) |
452 | if (status & TX_LATE_COL) lp->stats.tx_window_errors++; | 451 | dev->stats.tx_carrier_errors++; |
453 | if (status & TX_16_COL) lp->stats.tx_aborted_errors++; | 452 | if (status & TX_SQE_ERROR) |
453 | dev->stats.tx_heartbeat_errors++; | ||
454 | if (status & TX_LATE_COL) | ||
455 | dev->stats.tx_window_errors++; | ||
456 | if (status & TX_16_COL) | ||
457 | dev->stats.tx_aborted_errors++; | ||
454 | break; | 458 | break; |
455 | case ISQ_BUFFER_EVENT: | 459 | case ISQ_BUFFER_EVENT: |
456 | if (status & READY_FOR_TX) { | 460 | if (status & READY_FOR_TX) { |
@@ -469,10 +473,10 @@ static irqreturn_t net_interrupt(int irq, void *dev_id) | |||
469 | } | 473 | } |
470 | break; | 474 | break; |
471 | case ISQ_RX_MISS_EVENT: | 475 | case ISQ_RX_MISS_EVENT: |
472 | lp->stats.rx_missed_errors += (status >>6); | 476 | dev->stats.rx_missed_errors += (status >> 6); |
473 | break; | 477 | break; |
474 | case ISQ_TX_COL_EVENT: | 478 | case ISQ_TX_COL_EVENT: |
475 | lp->stats.collisions += (status >>6); | 479 | dev->stats.collisions += (status >> 6); |
476 | break; | 480 | break; |
477 | } | 481 | } |
478 | } | 482 | } |
@@ -483,19 +487,22 @@ static irqreturn_t net_interrupt(int irq, void *dev_id) | |||
483 | static void | 487 | static void |
484 | net_rx(struct net_device *dev) | 488 | net_rx(struct net_device *dev) |
485 | { | 489 | { |
486 | struct net_local *lp = netdev_priv(dev); | ||
487 | struct sk_buff *skb; | 490 | struct sk_buff *skb; |
488 | int status, length; | 491 | int status, length; |
489 | 492 | ||
490 | status = readreg(dev, PP_RxStatus); | 493 | status = readreg(dev, PP_RxStatus); |
491 | if ((status & RX_OK) == 0) { | 494 | if ((status & RX_OK) == 0) { |
492 | lp->stats.rx_errors++; | 495 | dev->stats.rx_errors++; |
493 | if (status & RX_RUNT) lp->stats.rx_length_errors++; | 496 | if (status & RX_RUNT) |
494 | if (status & RX_EXTRA_DATA) lp->stats.rx_length_errors++; | 497 | dev->stats.rx_length_errors++; |
495 | if (status & RX_CRC_ERROR) if (!(status & (RX_EXTRA_DATA|RX_RUNT))) | 498 | if (status & RX_EXTRA_DATA) |
499 | dev->stats.rx_length_errors++; | ||
500 | if ((status & RX_CRC_ERROR) && | ||
501 | !(status & (RX_EXTRA_DATA|RX_RUNT))) | ||
496 | /* per str 172 */ | 502 | /* per str 172 */ |
497 | lp->stats.rx_crc_errors++; | 503 | dev->stats.rx_crc_errors++; |
498 | if (status & RX_DRIBBLE) lp->stats.rx_frame_errors++; | 504 | if (status & RX_DRIBBLE) |
505 | dev->stats.rx_frame_errors++; | ||
499 | return; | 506 | return; |
500 | } | 507 | } |
501 | 508 | ||
@@ -504,7 +511,7 @@ net_rx(struct net_device *dev) | |||
504 | skb = alloc_skb(length, GFP_ATOMIC); | 511 | skb = alloc_skb(length, GFP_ATOMIC); |
505 | if (skb == NULL) { | 512 | if (skb == NULL) { |
506 | printk("%s: Memory squeeze, dropping packet.\n", dev->name); | 513 | printk("%s: Memory squeeze, dropping packet.\n", dev->name); |
507 | lp->stats.rx_dropped++; | 514 | dev->stats.rx_dropped++; |
508 | return; | 515 | return; |
509 | } | 516 | } |
510 | skb_put(skb, length); | 517 | skb_put(skb, length); |
@@ -519,8 +526,8 @@ net_rx(struct net_device *dev) | |||
519 | 526 | ||
520 | skb->protocol=eth_type_trans(skb,dev); | 527 | skb->protocol=eth_type_trans(skb,dev); |
521 | netif_rx(skb); | 528 | netif_rx(skb); |
522 | lp->stats.rx_packets++; | 529 | dev->stats.rx_packets++; |
523 | lp->stats.rx_bytes += length; | 530 | dev->stats.rx_bytes += length; |
524 | } | 531 | } |
525 | 532 | ||
526 | /* The inverse routine to net_open(). */ | 533 | /* The inverse routine to net_open(). */ |
@@ -548,16 +555,15 @@ net_close(struct net_device *dev) | |||
548 | static struct net_device_stats * | 555 | static struct net_device_stats * |
549 | net_get_stats(struct net_device *dev) | 556 | net_get_stats(struct net_device *dev) |
550 | { | 557 | { |
551 | struct net_local *lp = netdev_priv(dev); | ||
552 | unsigned long flags; | 558 | unsigned long flags; |
553 | 559 | ||
554 | local_irq_save(flags); | 560 | local_irq_save(flags); |
555 | /* Update the statistics from the device registers. */ | 561 | /* Update the statistics from the device registers. */ |
556 | lp->stats.rx_missed_errors += (readreg(dev, PP_RxMiss) >> 6); | 562 | dev->stats.rx_missed_errors += (readreg(dev, PP_RxMiss) >> 6); |
557 | lp->stats.collisions += (readreg(dev, PP_TxCol) >> 6); | 563 | dev->stats.collisions += (readreg(dev, PP_TxCol) >> 6); |
558 | local_irq_restore(flags); | 564 | local_irq_restore(flags); |
559 | 565 | ||
560 | return &lp->stats; | 566 | return &dev->stats; |
561 | } | 567 | } |
562 | 568 | ||
563 | static void set_multicast_list(struct net_device *dev) | 569 | static void set_multicast_list(struct net_device *dev) |