diff options
Diffstat (limited to 'drivers/net/macmace.c')
-rw-r--r-- | drivers/net/macmace.c | 49 |
1 files changed, 19 insertions, 30 deletions
diff --git a/drivers/net/macmace.c b/drivers/net/macmace.c index 5d2daa248873..57f7c1a2c1d7 100644 --- a/drivers/net/macmace.c +++ b/drivers/net/macmace.c | |||
@@ -65,7 +65,6 @@ struct mace_data { | |||
65 | unsigned char *rx_ring; | 65 | unsigned char *rx_ring; |
66 | dma_addr_t rx_ring_phys; | 66 | dma_addr_t rx_ring_phys; |
67 | int dma_intr; | 67 | int dma_intr; |
68 | struct net_device_stats stats; | ||
69 | int rx_slot, rx_tail; | 68 | int rx_slot, rx_tail; |
70 | int tx_slot, tx_sloti, tx_count; | 69 | int tx_slot, tx_sloti, tx_count; |
71 | int chipid; | 70 | int chipid; |
@@ -92,7 +91,6 @@ struct mace_frame { | |||
92 | static int mace_open(struct net_device *dev); | 91 | static int mace_open(struct net_device *dev); |
93 | static int mace_close(struct net_device *dev); | 92 | static int mace_close(struct net_device *dev); |
94 | static int mace_xmit_start(struct sk_buff *skb, struct net_device *dev); | 93 | static int mace_xmit_start(struct sk_buff *skb, struct net_device *dev); |
95 | static struct net_device_stats *mace_stats(struct net_device *dev); | ||
96 | static void mace_set_multicast(struct net_device *dev); | 94 | static void mace_set_multicast(struct net_device *dev); |
97 | static int mace_set_address(struct net_device *dev, void *addr); | 95 | static int mace_set_address(struct net_device *dev, void *addr); |
98 | static void mace_reset(struct net_device *dev); | 96 | static void mace_reset(struct net_device *dev); |
@@ -242,14 +240,11 @@ static int __devinit mace_probe(struct platform_device *pdev) | |||
242 | return -ENODEV; | 240 | return -ENODEV; |
243 | } | 241 | } |
244 | 242 | ||
245 | memset(&mp->stats, 0, sizeof(mp->stats)); | ||
246 | |||
247 | dev->open = mace_open; | 243 | dev->open = mace_open; |
248 | dev->stop = mace_close; | 244 | dev->stop = mace_close; |
249 | dev->hard_start_xmit = mace_xmit_start; | 245 | dev->hard_start_xmit = mace_xmit_start; |
250 | dev->tx_timeout = mace_tx_timeout; | 246 | dev->tx_timeout = mace_tx_timeout; |
251 | dev->watchdog_timeo = TX_TIMEOUT; | 247 | dev->watchdog_timeo = TX_TIMEOUT; |
252 | dev->get_stats = mace_stats; | ||
253 | dev->set_multicast_list = mace_set_multicast; | 248 | dev->set_multicast_list = mace_set_multicast; |
254 | dev->set_mac_address = mace_set_address; | 249 | dev->set_mac_address = mace_set_address; |
255 | 250 | ||
@@ -472,8 +467,8 @@ static int mace_xmit_start(struct sk_buff *skb, struct net_device *dev) | |||
472 | mp->tx_count--; | 467 | mp->tx_count--; |
473 | local_irq_restore(flags); | 468 | local_irq_restore(flags); |
474 | 469 | ||
475 | mp->stats.tx_packets++; | 470 | dev->stats.tx_packets++; |
476 | mp->stats.tx_bytes += skb->len; | 471 | dev->stats.tx_bytes += skb->len; |
477 | 472 | ||
478 | /* We need to copy into our xmit buffer to take care of alignment and caching issues */ | 473 | /* We need to copy into our xmit buffer to take care of alignment and caching issues */ |
479 | skb_copy_from_linear_data(skb, mp->tx_ring, skb->len); | 474 | skb_copy_from_linear_data(skb, mp->tx_ring, skb->len); |
@@ -492,12 +487,6 @@ static int mace_xmit_start(struct sk_buff *skb, struct net_device *dev) | |||
492 | return NETDEV_TX_OK; | 487 | return NETDEV_TX_OK; |
493 | } | 488 | } |
494 | 489 | ||
495 | static struct net_device_stats *mace_stats(struct net_device *dev) | ||
496 | { | ||
497 | struct mace_data *mp = netdev_priv(dev); | ||
498 | return &mp->stats; | ||
499 | } | ||
500 | |||
501 | static void mace_set_multicast(struct net_device *dev) | 490 | static void mace_set_multicast(struct net_device *dev) |
502 | { | 491 | { |
503 | struct mace_data *mp = netdev_priv(dev); | 492 | struct mace_data *mp = netdev_priv(dev); |
@@ -555,13 +544,13 @@ static void mace_handle_misc_intrs(struct mace_data *mp, int intr) | |||
555 | static int mace_babbles, mace_jabbers; | 544 | static int mace_babbles, mace_jabbers; |
556 | 545 | ||
557 | if (intr & MPCO) | 546 | if (intr & MPCO) |
558 | mp->stats.rx_missed_errors += 256; | 547 | dev->stats.rx_missed_errors += 256; |
559 | mp->stats.rx_missed_errors += mb->mpc; /* reading clears it */ | 548 | dev->stats.rx_missed_errors += mb->mpc; /* reading clears it */ |
560 | if (intr & RNTPCO) | 549 | if (intr & RNTPCO) |
561 | mp->stats.rx_length_errors += 256; | 550 | dev->stats.rx_length_errors += 256; |
562 | mp->stats.rx_length_errors += mb->rntpc; /* reading clears it */ | 551 | dev->stats.rx_length_errors += mb->rntpc; /* reading clears it */ |
563 | if (intr & CERR) | 552 | if (intr & CERR) |
564 | ++mp->stats.tx_heartbeat_errors; | 553 | ++dev->stats.tx_heartbeat_errors; |
565 | if (intr & BABBLE) | 554 | if (intr & BABBLE) |
566 | if (mace_babbles++ < 4) | 555 | if (mace_babbles++ < 4) |
567 | printk(KERN_DEBUG "macmace: babbling transmitter\n"); | 556 | printk(KERN_DEBUG "macmace: babbling transmitter\n"); |
@@ -600,14 +589,14 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id) | |||
600 | } | 589 | } |
601 | /* Update stats */ | 590 | /* Update stats */ |
602 | if (fs & (UFLO|LCOL|LCAR|RTRY)) { | 591 | if (fs & (UFLO|LCOL|LCAR|RTRY)) { |
603 | ++mp->stats.tx_errors; | 592 | ++dev->stats.tx_errors; |
604 | if (fs & LCAR) | 593 | if (fs & LCAR) |
605 | ++mp->stats.tx_carrier_errors; | 594 | ++dev->stats.tx_carrier_errors; |
606 | else if (fs & (UFLO|LCOL|RTRY)) { | 595 | else if (fs & (UFLO|LCOL|RTRY)) { |
607 | ++mp->stats.tx_aborted_errors; | 596 | ++dev->stats.tx_aborted_errors; |
608 | if (mb->xmtfs & UFLO) { | 597 | if (mb->xmtfs & UFLO) { |
609 | printk(KERN_ERR "%s: DMA underrun.\n", dev->name); | 598 | printk(KERN_ERR "%s: DMA underrun.\n", dev->name); |
610 | mp->stats.tx_fifo_errors++; | 599 | dev->stats.tx_fifo_errors++; |
611 | mace_txdma_reset(dev); | 600 | mace_txdma_reset(dev); |
612 | } | 601 | } |
613 | } | 602 | } |
@@ -661,23 +650,23 @@ static void mace_dma_rx_frame(struct net_device *dev, struct mace_frame *mf) | |||
661 | unsigned int frame_status = mf->rcvsts; | 650 | unsigned int frame_status = mf->rcvsts; |
662 | 651 | ||
663 | if (frame_status & (RS_OFLO | RS_CLSN | RS_FRAMERR | RS_FCSERR)) { | 652 | if (frame_status & (RS_OFLO | RS_CLSN | RS_FRAMERR | RS_FCSERR)) { |
664 | mp->stats.rx_errors++; | 653 | dev->stats.rx_errors++; |
665 | if (frame_status & RS_OFLO) { | 654 | if (frame_status & RS_OFLO) { |
666 | printk(KERN_DEBUG "%s: fifo overflow.\n", dev->name); | 655 | printk(KERN_DEBUG "%s: fifo overflow.\n", dev->name); |
667 | mp->stats.rx_fifo_errors++; | 656 | dev->stats.rx_fifo_errors++; |
668 | } | 657 | } |
669 | if (frame_status & RS_CLSN) | 658 | if (frame_status & RS_CLSN) |
670 | mp->stats.collisions++; | 659 | dev->stats.collisions++; |
671 | if (frame_status & RS_FRAMERR) | 660 | if (frame_status & RS_FRAMERR) |
672 | mp->stats.rx_frame_errors++; | 661 | dev->stats.rx_frame_errors++; |
673 | if (frame_status & RS_FCSERR) | 662 | if (frame_status & RS_FCSERR) |
674 | mp->stats.rx_crc_errors++; | 663 | dev->stats.rx_crc_errors++; |
675 | } else { | 664 | } else { |
676 | unsigned int frame_length = mf->rcvcnt + ((frame_status & 0x0F) << 8 ); | 665 | unsigned int frame_length = mf->rcvcnt + ((frame_status & 0x0F) << 8 ); |
677 | 666 | ||
678 | skb = dev_alloc_skb(frame_length + 2); | 667 | skb = dev_alloc_skb(frame_length + 2); |
679 | if (!skb) { | 668 | if (!skb) { |
680 | mp->stats.rx_dropped++; | 669 | dev->stats.rx_dropped++; |
681 | return; | 670 | return; |
682 | } | 671 | } |
683 | skb_reserve(skb, 2); | 672 | skb_reserve(skb, 2); |
@@ -686,8 +675,8 @@ static void mace_dma_rx_frame(struct net_device *dev, struct mace_frame *mf) | |||
686 | skb->protocol = eth_type_trans(skb, dev); | 675 | skb->protocol = eth_type_trans(skb, dev); |
687 | netif_rx(skb); | 676 | netif_rx(skb); |
688 | dev->last_rx = jiffies; | 677 | dev->last_rx = jiffies; |
689 | mp->stats.rx_packets++; | 678 | dev->stats.rx_packets++; |
690 | mp->stats.rx_bytes += frame_length; | 679 | dev->stats.rx_bytes += frame_length; |
691 | } | 680 | } |
692 | } | 681 | } |
693 | 682 | ||