Commit 174afef4ea65fc58e8d18a0c64c890cf7d4e5924
Committed by
David S. Miller
1 parent
2321e80ac8
Exists in
master
and in
39 other branches
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>
Showing 1 changed file with 29 additions and 23 deletions Side-by-side Diff
drivers/net/mac89x0.c
... | ... | @@ -110,7 +110,6 @@ |
110 | 110 | |
111 | 111 | /* Information that need to be kept for each board. */ |
112 | 112 | struct net_local { |
113 | - struct net_device_stats stats; | |
114 | 113 | int chip_type; /* one of: CS8900, CS8920, CS8920M */ |
115 | 114 | char chip_revision; /* revision letter of the chip ('A'...) */ |
116 | 115 | int send_cmd; /* the propercommand used to send a packet. */ |
117 | 116 | |
... | ... | @@ -444,13 +443,18 @@ |
444 | 443 | net_rx(dev); |
445 | 444 | break; |
446 | 445 | case ISQ_TRANSMITTER_EVENT: |
447 | - lp->stats.tx_packets++; | |
446 | + dev->stats.tx_packets++; | |
448 | 447 | netif_wake_queue(dev); |
449 | - if ((status & TX_OK) == 0) lp->stats.tx_errors++; | |
450 | - if (status & TX_LOST_CRS) lp->stats.tx_carrier_errors++; | |
451 | - if (status & TX_SQE_ERROR) lp->stats.tx_heartbeat_errors++; | |
452 | - if (status & TX_LATE_COL) lp->stats.tx_window_errors++; | |
453 | - if (status & TX_16_COL) lp->stats.tx_aborted_errors++; | |
448 | + if ((status & TX_OK) == 0) | |
449 | + dev->stats.tx_errors++; | |
450 | + if (status & TX_LOST_CRS) | |
451 | + dev->stats.tx_carrier_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 | 458 | break; |
455 | 459 | case ISQ_BUFFER_EVENT: |
456 | 460 | if (status & READY_FOR_TX) { |
457 | 461 | |
... | ... | @@ -469,10 +473,10 @@ |
469 | 473 | } |
470 | 474 | break; |
471 | 475 | case ISQ_RX_MISS_EVENT: |
472 | - lp->stats.rx_missed_errors += (status >>6); | |
476 | + dev->stats.rx_missed_errors += (status >> 6); | |
473 | 477 | break; |
474 | 478 | case ISQ_TX_COL_EVENT: |
475 | - lp->stats.collisions += (status >>6); | |
479 | + dev->stats.collisions += (status >> 6); | |
476 | 480 | break; |
477 | 481 | } |
478 | 482 | } |
479 | 483 | |
480 | 484 | |
... | ... | @@ -483,19 +487,22 @@ |
483 | 487 | static void |
484 | 488 | net_rx(struct net_device *dev) |
485 | 489 | { |
486 | - struct net_local *lp = netdev_priv(dev); | |
487 | 490 | struct sk_buff *skb; |
488 | 491 | int status, length; |
489 | 492 | |
490 | 493 | status = readreg(dev, PP_RxStatus); |
491 | 494 | if ((status & RX_OK) == 0) { |
492 | - lp->stats.rx_errors++; | |
493 | - if (status & RX_RUNT) lp->stats.rx_length_errors++; | |
494 | - if (status & RX_EXTRA_DATA) lp->stats.rx_length_errors++; | |
495 | - if (status & RX_CRC_ERROR) if (!(status & (RX_EXTRA_DATA|RX_RUNT))) | |
495 | + dev->stats.rx_errors++; | |
496 | + if (status & RX_RUNT) | |
497 | + dev->stats.rx_length_errors++; | |
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 | 502 | /* per str 172 */ |
497 | - lp->stats.rx_crc_errors++; | |
498 | - if (status & RX_DRIBBLE) lp->stats.rx_frame_errors++; | |
503 | + dev->stats.rx_crc_errors++; | |
504 | + if (status & RX_DRIBBLE) | |
505 | + dev->stats.rx_frame_errors++; | |
499 | 506 | return; |
500 | 507 | } |
501 | 508 | |
... | ... | @@ -504,7 +511,7 @@ |
504 | 511 | skb = alloc_skb(length, GFP_ATOMIC); |
505 | 512 | if (skb == NULL) { |
506 | 513 | printk("%s: Memory squeeze, dropping packet.\n", dev->name); |
507 | - lp->stats.rx_dropped++; | |
514 | + dev->stats.rx_dropped++; | |
508 | 515 | return; |
509 | 516 | } |
510 | 517 | skb_put(skb, length); |
... | ... | @@ -519,8 +526,8 @@ |
519 | 526 | |
520 | 527 | skb->protocol=eth_type_trans(skb,dev); |
521 | 528 | netif_rx(skb); |
522 | - lp->stats.rx_packets++; | |
523 | - lp->stats.rx_bytes += length; | |
529 | + dev->stats.rx_packets++; | |
530 | + dev->stats.rx_bytes += length; | |
524 | 531 | } |
525 | 532 | |
526 | 533 | /* The inverse routine to net_open(). */ |
527 | 534 | |
528 | 535 | |
... | ... | @@ -548,16 +555,15 @@ |
548 | 555 | static struct net_device_stats * |
549 | 556 | net_get_stats(struct net_device *dev) |
550 | 557 | { |
551 | - struct net_local *lp = netdev_priv(dev); | |
552 | 558 | unsigned long flags; |
553 | 559 | |
554 | 560 | local_irq_save(flags); |
555 | 561 | /* Update the statistics from the device registers. */ |
556 | - lp->stats.rx_missed_errors += (readreg(dev, PP_RxMiss) >> 6); | |
557 | - lp->stats.collisions += (readreg(dev, PP_TxCol) >> 6); | |
562 | + dev->stats.rx_missed_errors += (readreg(dev, PP_RxMiss) >> 6); | |
563 | + dev->stats.collisions += (readreg(dev, PP_TxCol) >> 6); | |
558 | 564 | local_irq_restore(flags); |
559 | 565 | |
560 | - return &lp->stats; | |
566 | + return &dev->stats; | |
561 | 567 | } |
562 | 568 | |
563 | 569 | static void set_multicast_list(struct net_device *dev) |