diff options
Diffstat (limited to 'drivers/net/sun3lance.c')
-rw-r--r-- | drivers/net/sun3lance.c | 53 |
1 files changed, 20 insertions, 33 deletions
diff --git a/drivers/net/sun3lance.c b/drivers/net/sun3lance.c index c67632dcac49..f8fbc0492706 100644 --- a/drivers/net/sun3lance.c +++ b/drivers/net/sun3lance.c | |||
@@ -152,7 +152,6 @@ struct lance_private { | |||
152 | struct lance_memory *mem; | 152 | struct lance_memory *mem; |
153 | int new_rx, new_tx; /* The next free ring entry */ | 153 | int new_rx, new_tx; /* The next free ring entry */ |
154 | int old_tx, old_rx; /* ring entry to be processed */ | 154 | int old_tx, old_rx; /* ring entry to be processed */ |
155 | struct net_device_stats stats; | ||
156 | /* These two must be longs for set_bit() */ | 155 | /* These two must be longs for set_bit() */ |
157 | long tx_full; | 156 | long tx_full; |
158 | long lock; | 157 | long lock; |
@@ -241,7 +240,6 @@ static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev ); | |||
241 | static irqreturn_t lance_interrupt( int irq, void *dev_id); | 240 | static irqreturn_t lance_interrupt( int irq, void *dev_id); |
242 | static int lance_rx( struct net_device *dev ); | 241 | static int lance_rx( struct net_device *dev ); |
243 | static int lance_close( struct net_device *dev ); | 242 | static int lance_close( struct net_device *dev ); |
244 | static struct net_device_stats *lance_get_stats( struct net_device *dev ); | ||
245 | static void set_multicast_list( struct net_device *dev ); | 243 | static void set_multicast_list( struct net_device *dev ); |
246 | 244 | ||
247 | /************************* End of Prototypes **************************/ | 245 | /************************* End of Prototypes **************************/ |
@@ -401,15 +399,12 @@ static int __init lance_probe( struct net_device *dev) | |||
401 | dev->open = &lance_open; | 399 | dev->open = &lance_open; |
402 | dev->hard_start_xmit = &lance_start_xmit; | 400 | dev->hard_start_xmit = &lance_start_xmit; |
403 | dev->stop = &lance_close; | 401 | dev->stop = &lance_close; |
404 | dev->get_stats = &lance_get_stats; | ||
405 | dev->set_multicast_list = &set_multicast_list; | 402 | dev->set_multicast_list = &set_multicast_list; |
406 | dev->set_mac_address = NULL; | 403 | dev->set_mac_address = NULL; |
407 | // KLUDGE -- REMOVE ME | 404 | // KLUDGE -- REMOVE ME |
408 | set_bit(__LINK_STATE_PRESENT, &dev->state); | 405 | set_bit(__LINK_STATE_PRESENT, &dev->state); |
409 | 406 | ||
410 | 407 | ||
411 | memset( &lp->stats, 0, sizeof(lp->stats) ); | ||
412 | |||
413 | return 1; | 408 | return 1; |
414 | } | 409 | } |
415 | 410 | ||
@@ -534,7 +529,7 @@ static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev ) | |||
534 | * little endian mode. | 529 | * little endian mode. |
535 | */ | 530 | */ |
536 | REGA(CSR3) = CSR3_BSWP; | 531 | REGA(CSR3) = CSR3_BSWP; |
537 | lp->stats.tx_errors++; | 532 | dev->stats.tx_errors++; |
538 | 533 | ||
539 | if(lance_debug >= 2) { | 534 | if(lance_debug >= 2) { |
540 | int i; | 535 | int i; |
@@ -634,7 +629,7 @@ static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev ) | |||
634 | 629 | ||
635 | head->flag = TMD1_OWN_CHIP | TMD1_ENP | TMD1_STP; | 630 | head->flag = TMD1_OWN_CHIP | TMD1_ENP | TMD1_STP; |
636 | lp->new_tx = (lp->new_tx + 1) & TX_RING_MOD_MASK; | 631 | lp->new_tx = (lp->new_tx + 1) & TX_RING_MOD_MASK; |
637 | lp->stats.tx_bytes += skb->len; | 632 | dev->stats.tx_bytes += skb->len; |
638 | 633 | ||
639 | /* Trigger an immediate send poll. */ | 634 | /* Trigger an immediate send poll. */ |
640 | REGA(CSR0) = CSR0_INEA | CSR0_TDMD | CSR0_STRT; | 635 | REGA(CSR0) = CSR0_INEA | CSR0_TDMD | CSR0_STRT; |
@@ -712,12 +707,12 @@ static irqreturn_t lance_interrupt( int irq, void *dev_id) | |||
712 | 707 | ||
713 | if (head->flag & TMD1_ERR) { | 708 | if (head->flag & TMD1_ERR) { |
714 | int status = head->misc; | 709 | int status = head->misc; |
715 | lp->stats.tx_errors++; | 710 | dev->stats.tx_errors++; |
716 | if (status & TMD3_RTRY) lp->stats.tx_aborted_errors++; | 711 | if (status & TMD3_RTRY) dev->stats.tx_aborted_errors++; |
717 | if (status & TMD3_LCAR) lp->stats.tx_carrier_errors++; | 712 | if (status & TMD3_LCAR) dev->stats.tx_carrier_errors++; |
718 | if (status & TMD3_LCOL) lp->stats.tx_window_errors++; | 713 | if (status & TMD3_LCOL) dev->stats.tx_window_errors++; |
719 | if (status & (TMD3_UFLO | TMD3_BUFF)) { | 714 | if (status & (TMD3_UFLO | TMD3_BUFF)) { |
720 | lp->stats.tx_fifo_errors++; | 715 | dev->stats.tx_fifo_errors++; |
721 | printk("%s: Tx FIFO error\n", | 716 | printk("%s: Tx FIFO error\n", |
722 | dev->name); | 717 | dev->name); |
723 | REGA(CSR0) = CSR0_STOP; | 718 | REGA(CSR0) = CSR0_STOP; |
@@ -730,9 +725,9 @@ static irqreturn_t lance_interrupt( int irq, void *dev_id) | |||
730 | 725 | ||
731 | head->flag &= ~(TMD1_ENP | TMD1_STP); | 726 | head->flag &= ~(TMD1_ENP | TMD1_STP); |
732 | if(head->flag & (TMD1_ONE | TMD1_MORE)) | 727 | if(head->flag & (TMD1_ONE | TMD1_MORE)) |
733 | lp->stats.collisions++; | 728 | dev->stats.collisions++; |
734 | 729 | ||
735 | lp->stats.tx_packets++; | 730 | dev->stats.tx_packets++; |
736 | DPRINTK(3, ("cleared tx ring %d\n", old_tx)); | 731 | DPRINTK(3, ("cleared tx ring %d\n", old_tx)); |
737 | } | 732 | } |
738 | old_tx = (old_tx +1) & TX_RING_MOD_MASK; | 733 | old_tx = (old_tx +1) & TX_RING_MOD_MASK; |
@@ -752,8 +747,8 @@ static irqreturn_t lance_interrupt( int irq, void *dev_id) | |||
752 | lance_rx( dev ); | 747 | lance_rx( dev ); |
753 | 748 | ||
754 | /* Log misc errors. */ | 749 | /* Log misc errors. */ |
755 | if (csr0 & CSR0_BABL) lp->stats.tx_errors++; /* Tx babble. */ | 750 | if (csr0 & CSR0_BABL) dev->stats.tx_errors++; /* Tx babble. */ |
756 | if (csr0 & CSR0_MISS) lp->stats.rx_errors++; /* Missed a Rx frame. */ | 751 | if (csr0 & CSR0_MISS) dev->stats.rx_errors++; /* Missed a Rx frame. */ |
757 | if (csr0 & CSR0_MERR) { | 752 | if (csr0 & CSR0_MERR) { |
758 | DPRINTK( 1, ( "%s: Bus master arbitration failure (?!?), " | 753 | DPRINTK( 1, ( "%s: Bus master arbitration failure (?!?), " |
759 | "status %04x.\n", dev->name, csr0 )); | 754 | "status %04x.\n", dev->name, csr0 )); |
@@ -799,11 +794,11 @@ static int lance_rx( struct net_device *dev ) | |||
799 | full-sized buffers it's possible for a jabber packet to use two | 794 | full-sized buffers it's possible for a jabber packet to use two |
800 | buffers, with only the last correctly noting the error. */ | 795 | buffers, with only the last correctly noting the error. */ |
801 | if (status & RMD1_ENP) /* Only count a general error at the */ | 796 | if (status & RMD1_ENP) /* Only count a general error at the */ |
802 | lp->stats.rx_errors++; /* end of a packet.*/ | 797 | dev->stats.rx_errors++; /* end of a packet.*/ |
803 | if (status & RMD1_FRAM) lp->stats.rx_frame_errors++; | 798 | if (status & RMD1_FRAM) dev->stats.rx_frame_errors++; |
804 | if (status & RMD1_OFLO) lp->stats.rx_over_errors++; | 799 | if (status & RMD1_OFLO) dev->stats.rx_over_errors++; |
805 | if (status & RMD1_CRC) lp->stats.rx_crc_errors++; | 800 | if (status & RMD1_CRC) dev->stats.rx_crc_errors++; |
806 | if (status & RMD1_BUFF) lp->stats.rx_fifo_errors++; | 801 | if (status & RMD1_BUFF) dev->stats.rx_fifo_errors++; |
807 | head->flag &= (RMD1_ENP|RMD1_STP); | 802 | head->flag &= (RMD1_ENP|RMD1_STP); |
808 | } else { | 803 | } else { |
809 | /* Malloc up new buffer, compatible with net-3. */ | 804 | /* Malloc up new buffer, compatible with net-3. */ |
@@ -813,7 +808,7 @@ static int lance_rx( struct net_device *dev ) | |||
813 | 808 | ||
814 | if (pkt_len < 60) { | 809 | if (pkt_len < 60) { |
815 | printk( "%s: Runt packet!\n", dev->name ); | 810 | printk( "%s: Runt packet!\n", dev->name ); |
816 | lp->stats.rx_errors++; | 811 | dev->stats.rx_errors++; |
817 | } | 812 | } |
818 | else { | 813 | else { |
819 | skb = dev_alloc_skb( pkt_len+2 ); | 814 | skb = dev_alloc_skb( pkt_len+2 ); |
@@ -821,7 +816,7 @@ static int lance_rx( struct net_device *dev ) | |||
821 | DPRINTK( 1, ( "%s: Memory squeeze, deferring packet.\n", | 816 | DPRINTK( 1, ( "%s: Memory squeeze, deferring packet.\n", |
822 | dev->name )); | 817 | dev->name )); |
823 | 818 | ||
824 | lp->stats.rx_dropped++; | 819 | dev->stats.rx_dropped++; |
825 | head->msg_length = 0; | 820 | head->msg_length = 0; |
826 | head->flag |= RMD1_OWN_CHIP; | 821 | head->flag |= RMD1_OWN_CHIP; |
827 | lp->new_rx = (lp->new_rx+1) & | 822 | lp->new_rx = (lp->new_rx+1) & |
@@ -859,8 +854,8 @@ static int lance_rx( struct net_device *dev ) | |||
859 | skb->protocol = eth_type_trans( skb, dev ); | 854 | skb->protocol = eth_type_trans( skb, dev ); |
860 | netif_rx( skb ); | 855 | netif_rx( skb ); |
861 | dev->last_rx = jiffies; | 856 | dev->last_rx = jiffies; |
862 | lp->stats.rx_packets++; | 857 | dev->stats.rx_packets++; |
863 | lp->stats.rx_bytes += pkt_len; | 858 | dev->stats.rx_bytes += pkt_len; |
864 | } | 859 | } |
865 | } | 860 | } |
866 | 861 | ||
@@ -897,14 +892,6 @@ static int lance_close( struct net_device *dev ) | |||
897 | } | 892 | } |
898 | 893 | ||
899 | 894 | ||
900 | static struct net_device_stats *lance_get_stats( struct net_device *dev ) | ||
901 | { | ||
902 | struct lance_private *lp = netdev_priv(dev); | ||
903 | |||
904 | return &lp->stats; | ||
905 | } | ||
906 | |||
907 | |||
908 | /* Set or clear the multicast filter for this adaptor. | 895 | /* Set or clear the multicast filter for this adaptor. |
909 | num_addrs == -1 Promiscuous mode, receive all packets | 896 | num_addrs == -1 Promiscuous mode, receive all packets |
910 | num_addrs == 0 Normal mode, clear multicast list | 897 | num_addrs == 0 Normal mode, clear multicast list |