aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/znet.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/znet.c')
-rw-r--r--drivers/net/znet.c50
1 files changed, 19 insertions, 31 deletions
diff --git a/drivers/net/znet.c b/drivers/net/znet.c
index dcd4e1b136b5..43712c7b9ecf 100644
--- a/drivers/net/znet.c
+++ b/drivers/net/znet.c
@@ -128,7 +128,6 @@ MODULE_LICENSE("GPL");
128 128
129struct znet_private { 129struct znet_private {
130 int rx_dma, tx_dma; 130 int rx_dma, tx_dma;
131 struct net_device_stats stats;
132 spinlock_t lock; 131 spinlock_t lock;
133 short sia_base, sia_size, io_size; 132 short sia_base, sia_size, io_size;
134 struct i82593_conf_block i593_init; 133 struct i82593_conf_block i593_init;
@@ -161,7 +160,6 @@ static int znet_send_packet(struct sk_buff *skb, struct net_device *dev);
161static irqreturn_t znet_interrupt(int irq, void *dev_id); 160static irqreturn_t znet_interrupt(int irq, void *dev_id);
162static void znet_rx(struct net_device *dev); 161static void znet_rx(struct net_device *dev);
163static int znet_close(struct net_device *dev); 162static int znet_close(struct net_device *dev);
164static struct net_device_stats *net_get_stats(struct net_device *dev);
165static void hardware_init(struct net_device *dev); 163static void hardware_init(struct net_device *dev);
166static void update_stop_hit(short ioaddr, unsigned short rx_stop_offset); 164static void update_stop_hit(short ioaddr, unsigned short rx_stop_offset);
167static void znet_tx_timeout (struct net_device *dev); 165static void znet_tx_timeout (struct net_device *dev);
@@ -445,7 +443,6 @@ static int __init znet_probe (void)
445 dev->open = &znet_open; 443 dev->open = &znet_open;
446 dev->hard_start_xmit = &znet_send_packet; 444 dev->hard_start_xmit = &znet_send_packet;
447 dev->stop = &znet_close; 445 dev->stop = &znet_close;
448 dev->get_stats = net_get_stats;
449 dev->set_multicast_list = &znet_set_multicast_list; 446 dev->set_multicast_list = &znet_set_multicast_list;
450 dev->tx_timeout = znet_tx_timeout; 447 dev->tx_timeout = znet_tx_timeout;
451 dev->watchdog_timeo = TX_TIMEOUT; 448 dev->watchdog_timeo = TX_TIMEOUT;
@@ -564,7 +561,7 @@ static int znet_send_packet(struct sk_buff *skb, struct net_device *dev)
564 ushort *tx_link = znet->tx_cur - 1; 561 ushort *tx_link = znet->tx_cur - 1;
565 ushort rnd_len = (length + 1)>>1; 562 ushort rnd_len = (length + 1)>>1;
566 563
567 znet->stats.tx_bytes+=length; 564 dev->stats.tx_bytes+=length;
568 565
569 if (znet->tx_cur >= znet->tx_end) 566 if (znet->tx_cur >= znet->tx_end)
570 znet->tx_cur = znet->tx_start; 567 znet->tx_cur = znet->tx_start;
@@ -639,20 +636,20 @@ static irqreturn_t znet_interrupt(int irq, void *dev_id)
639 tx_status = inw(ioaddr); 636 tx_status = inw(ioaddr);
640 /* It's undocumented, but tx_status seems to match the i82586. */ 637 /* It's undocumented, but tx_status seems to match the i82586. */
641 if (tx_status & TX_OK) { 638 if (tx_status & TX_OK) {
642 znet->stats.tx_packets++; 639 dev->stats.tx_packets++;
643 znet->stats.collisions += tx_status & TX_NCOL_MASK; 640 dev->stats.collisions += tx_status & TX_NCOL_MASK;
644 } else { 641 } else {
645 if (tx_status & (TX_LOST_CTS | TX_LOST_CRS)) 642 if (tx_status & (TX_LOST_CTS | TX_LOST_CRS))
646 znet->stats.tx_carrier_errors++; 643 dev->stats.tx_carrier_errors++;
647 if (tx_status & TX_UND_RUN) 644 if (tx_status & TX_UND_RUN)
648 znet->stats.tx_fifo_errors++; 645 dev->stats.tx_fifo_errors++;
649 if (!(tx_status & TX_HRT_BEAT)) 646 if (!(tx_status & TX_HRT_BEAT))
650 znet->stats.tx_heartbeat_errors++; 647 dev->stats.tx_heartbeat_errors++;
651 if (tx_status & TX_MAX_COL) 648 if (tx_status & TX_MAX_COL)
652 znet->stats.tx_aborted_errors++; 649 dev->stats.tx_aborted_errors++;
653 /* ...and the catch-all. */ 650 /* ...and the catch-all. */
654 if ((tx_status | (TX_LOST_CRS | TX_LOST_CTS | TX_UND_RUN | TX_HRT_BEAT | TX_MAX_COL)) != (TX_LOST_CRS | TX_LOST_CTS | TX_UND_RUN | TX_HRT_BEAT | TX_MAX_COL)) 651 if ((tx_status | (TX_LOST_CRS | TX_LOST_CTS | TX_UND_RUN | TX_HRT_BEAT | TX_MAX_COL)) != (TX_LOST_CRS | TX_LOST_CTS | TX_UND_RUN | TX_HRT_BEAT | TX_MAX_COL))
655 znet->stats.tx_errors++; 652 dev->stats.tx_errors++;
656 653
657 /* Transceiver may be stuck if cable 654 /* Transceiver may be stuck if cable
658 * was removed while emiting a 655 * was removed while emiting a
@@ -748,19 +745,19 @@ static void znet_rx(struct net_device *dev)
748 this_rfp_ptr[-3]<<1); 745 this_rfp_ptr[-3]<<1);
749 /* Once again we must assume that the i82586 docs apply. */ 746 /* Once again we must assume that the i82586 docs apply. */
750 if ( ! (status & RX_RCV_OK)) { /* There was an error. */ 747 if ( ! (status & RX_RCV_OK)) { /* There was an error. */
751 znet->stats.rx_errors++; 748 dev->stats.rx_errors++;
752 if (status & RX_CRC_ERR) znet->stats.rx_crc_errors++; 749 if (status & RX_CRC_ERR) dev->stats.rx_crc_errors++;
753 if (status & RX_ALG_ERR) znet->stats.rx_frame_errors++; 750 if (status & RX_ALG_ERR) dev->stats.rx_frame_errors++;
754#if 0 751#if 0
755 if (status & 0x0200) znet->stats.rx_over_errors++; /* Wrong. */ 752 if (status & 0x0200) dev->stats.rx_over_errors++; /* Wrong. */
756 if (status & 0x0100) znet->stats.rx_fifo_errors++; 753 if (status & 0x0100) dev->stats.rx_fifo_errors++;
757#else 754#else
758 /* maz : Wild guess... */ 755 /* maz : Wild guess... */
759 if (status & RX_OVRRUN) znet->stats.rx_over_errors++; 756 if (status & RX_OVRRUN) dev->stats.rx_over_errors++;
760#endif 757#endif
761 if (status & RX_SRT_FRM) znet->stats.rx_length_errors++; 758 if (status & RX_SRT_FRM) dev->stats.rx_length_errors++;
762 } else if (pkt_len > 1536) { 759 } else if (pkt_len > 1536) {
763 znet->stats.rx_length_errors++; 760 dev->stats.rx_length_errors++;
764 } else { 761 } else {
765 /* Malloc up new buffer. */ 762 /* Malloc up new buffer. */
766 struct sk_buff *skb; 763 struct sk_buff *skb;
@@ -769,7 +766,7 @@ static void znet_rx(struct net_device *dev)
769 if (skb == NULL) { 766 if (skb == NULL) {
770 if (znet_debug) 767 if (znet_debug)
771 printk(KERN_WARNING "%s: Memory squeeze, dropping packet.\n", dev->name); 768 printk(KERN_WARNING "%s: Memory squeeze, dropping packet.\n", dev->name);
772 znet->stats.rx_dropped++; 769 dev->stats.rx_dropped++;
773 break; 770 break;
774 } 771 }
775 772
@@ -789,8 +786,8 @@ static void znet_rx(struct net_device *dev)
789 skb->protocol=eth_type_trans(skb,dev); 786 skb->protocol=eth_type_trans(skb,dev);
790 netif_rx(skb); 787 netif_rx(skb);
791 dev->last_rx = jiffies; 788 dev->last_rx = jiffies;
792 znet->stats.rx_packets++; 789 dev->stats.rx_packets++;
793 znet->stats.rx_bytes += pkt_len; 790 dev->stats.rx_bytes += pkt_len;
794 } 791 }
795 znet->rx_cur = this_rfp_ptr; 792 znet->rx_cur = this_rfp_ptr;
796 if (znet->rx_cur >= znet->rx_end) 793 if (znet->rx_cur >= znet->rx_end)
@@ -827,15 +824,6 @@ static int znet_close(struct net_device *dev)
827 return 0; 824 return 0;
828} 825}
829 826
830/* Get the current statistics. This may be called with the card open or
831 closed. */
832static struct net_device_stats *net_get_stats(struct net_device *dev)
833{
834 struct znet_private *znet = dev->priv;
835
836 return &znet->stats;
837}
838
839static void show_dma(struct net_device *dev) 827static void show_dma(struct net_device *dev)
840{ 828{
841 short ioaddr = dev->base_addr; 829 short ioaddr = dev->base_addr;