aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/atarilance.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-10-03 20:41:50 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:51:16 -0400
commit09f75cd7bf13720738e6a196cc0107ce9a5bd5a0 (patch)
tree4c85b0b395abe7f88c87162fc22570e5de255cb1 /drivers/net/atarilance.c
parentff8ac60948ba819b89e9c87083e8050fc2f89999 (diff)
[NET] drivers/net: statistics cleanup #1 -- save memory and shrink code
We now have struct net_device_stats embedded in struct net_device, and the default ->get_stats() hook does the obvious thing for us. Run through drivers/net/* and remove the driver-local storage of statistics, and driver-local ->get_stats() hook where applicable. This was just the low-hanging fruit in drivers/net; plenty more drivers remain to be updated. [ Resolved conflicts with napi_struct changes and fix sunqe build regression... -DaveM ] Signed-off-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/atarilance.c')
-rw-r--r--drivers/net/atarilance.c58
1 files changed, 20 insertions, 38 deletions
diff --git a/drivers/net/atarilance.c b/drivers/net/atarilance.c
index 17b9dbf7bd68..8bf548e1cb4e 100644
--- a/drivers/net/atarilance.c
+++ b/drivers/net/atarilance.c
@@ -224,7 +224,6 @@ struct lance_private {
224 int dirty_tx; /* Ring entries to be freed. */ 224 int dirty_tx; /* Ring entries to be freed. */
225 /* copy function */ 225 /* copy function */
226 void *(*memcpy_f)( void *, const void *, size_t ); 226 void *(*memcpy_f)( void *, const void *, size_t );
227 struct net_device_stats stats;
228/* This must be long for set_bit() */ 227/* This must be long for set_bit() */
229 long tx_full; 228 long tx_full;
230 spinlock_t devlock; 229 spinlock_t devlock;
@@ -347,7 +346,6 @@ static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev );
347static irqreturn_t lance_interrupt( int irq, void *dev_id ); 346static irqreturn_t lance_interrupt( int irq, void *dev_id );
348static int lance_rx( struct net_device *dev ); 347static int lance_rx( struct net_device *dev );
349static int lance_close( struct net_device *dev ); 348static int lance_close( struct net_device *dev );
350static struct net_device_stats *lance_get_stats( struct net_device *dev );
351static void set_multicast_list( struct net_device *dev ); 349static void set_multicast_list( struct net_device *dev );
352static int lance_set_mac_address( struct net_device *dev, void *addr ); 350static int lance_set_mac_address( struct net_device *dev, void *addr );
353static void lance_tx_timeout (struct net_device *dev); 351static void lance_tx_timeout (struct net_device *dev);
@@ -631,7 +629,6 @@ static unsigned long __init lance_probe1( struct net_device *dev,
631 dev->open = &lance_open; 629 dev->open = &lance_open;
632 dev->hard_start_xmit = &lance_start_xmit; 630 dev->hard_start_xmit = &lance_start_xmit;
633 dev->stop = &lance_close; 631 dev->stop = &lance_close;
634 dev->get_stats = &lance_get_stats;
635 dev->set_multicast_list = &set_multicast_list; 632 dev->set_multicast_list = &set_multicast_list;
636 dev->set_mac_address = &lance_set_mac_address; 633 dev->set_mac_address = &lance_set_mac_address;
637 634
@@ -639,13 +636,6 @@ static unsigned long __init lance_probe1( struct net_device *dev,
639 dev->tx_timeout = lance_tx_timeout; 636 dev->tx_timeout = lance_tx_timeout;
640 dev->watchdog_timeo = TX_TIMEOUT; 637 dev->watchdog_timeo = TX_TIMEOUT;
641 638
642
643#if 0
644 dev->start = 0;
645#endif
646
647 memset( &lp->stats, 0, sizeof(lp->stats) );
648
649 return( 1 ); 639 return( 1 );
650} 640}
651 641
@@ -753,7 +743,7 @@ static void lance_tx_timeout (struct net_device *dev)
753 * little endian mode. 743 * little endian mode.
754 */ 744 */
755 REGA( CSR3 ) = CSR3_BSWP | (lp->cardtype == PAM_CARD ? CSR3_ACON : 0); 745 REGA( CSR3 ) = CSR3_BSWP | (lp->cardtype == PAM_CARD ? CSR3_ACON : 0);
756 lp->stats.tx_errors++; 746 dev->stats.tx_errors++;
757#ifndef final_version 747#ifndef final_version
758 { int i; 748 { int i;
759 DPRINTK( 2, ( "Ring data: dirty_tx %d cur_tx %d%s cur_rx %d\n", 749 DPRINTK( 2, ( "Ring data: dirty_tx %d cur_tx %d%s cur_rx %d\n",
@@ -841,7 +831,7 @@ static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev )
841 head->misc = 0; 831 head->misc = 0;
842 lp->memcpy_f( PKTBUF_ADDR(head), (void *)skb->data, skb->len ); 832 lp->memcpy_f( PKTBUF_ADDR(head), (void *)skb->data, skb->len );
843 head->flag = TMD1_OWN_CHIP | TMD1_ENP | TMD1_STP; 833 head->flag = TMD1_OWN_CHIP | TMD1_ENP | TMD1_STP;
844 lp->stats.tx_bytes += skb->len; 834 dev->stats.tx_bytes += skb->len;
845 dev_kfree_skb( skb ); 835 dev_kfree_skb( skb );
846 lp->cur_tx++; 836 lp->cur_tx++;
847 while( lp->cur_tx >= TX_RING_SIZE && lp->dirty_tx >= TX_RING_SIZE ) { 837 while( lp->cur_tx >= TX_RING_SIZE && lp->dirty_tx >= TX_RING_SIZE ) {
@@ -912,13 +902,13 @@ static irqreturn_t lance_interrupt( int irq, void *dev_id )
912 if (status & TMD1_ERR) { 902 if (status & TMD1_ERR) {
913 /* There was an major error, log it. */ 903 /* There was an major error, log it. */
914 int err_status = MEM->tx_head[entry].misc; 904 int err_status = MEM->tx_head[entry].misc;
915 lp->stats.tx_errors++; 905 dev->stats.tx_errors++;
916 if (err_status & TMD3_RTRY) lp->stats.tx_aborted_errors++; 906 if (err_status & TMD3_RTRY) dev->stats.tx_aborted_errors++;
917 if (err_status & TMD3_LCAR) lp->stats.tx_carrier_errors++; 907 if (err_status & TMD3_LCAR) dev->stats.tx_carrier_errors++;
918 if (err_status & TMD3_LCOL) lp->stats.tx_window_errors++; 908 if (err_status & TMD3_LCOL) dev->stats.tx_window_errors++;
919 if (err_status & TMD3_UFLO) { 909 if (err_status & TMD3_UFLO) {
920 /* Ackk! On FIFO errors the Tx unit is turned off! */ 910 /* Ackk! On FIFO errors the Tx unit is turned off! */
921 lp->stats.tx_fifo_errors++; 911 dev->stats.tx_fifo_errors++;
922 /* Remove this verbosity later! */ 912 /* Remove this verbosity later! */
923 DPRINTK( 1, ( "%s: Tx FIFO error! Status %04x\n", 913 DPRINTK( 1, ( "%s: Tx FIFO error! Status %04x\n",
924 dev->name, csr0 )); 914 dev->name, csr0 ));
@@ -927,8 +917,8 @@ static irqreturn_t lance_interrupt( int irq, void *dev_id )
927 } 917 }
928 } else { 918 } else {
929 if (status & (TMD1_MORE | TMD1_ONE | TMD1_DEF)) 919 if (status & (TMD1_MORE | TMD1_ONE | TMD1_DEF))
930 lp->stats.collisions++; 920 dev->stats.collisions++;
931 lp->stats.tx_packets++; 921 dev->stats.tx_packets++;
932 } 922 }
933 923
934 /* XXX MSch: free skb?? */ 924 /* XXX MSch: free skb?? */
@@ -955,8 +945,8 @@ static irqreturn_t lance_interrupt( int irq, void *dev_id )
955 } 945 }
956 946
957 /* Log misc errors. */ 947 /* Log misc errors. */
958 if (csr0 & CSR0_BABL) lp->stats.tx_errors++; /* Tx babble. */ 948 if (csr0 & CSR0_BABL) dev->stats.tx_errors++; /* Tx babble. */
959 if (csr0 & CSR0_MISS) lp->stats.rx_errors++; /* Missed a Rx frame. */ 949 if (csr0 & CSR0_MISS) dev->stats.rx_errors++; /* Missed a Rx frame. */
960 if (csr0 & CSR0_MERR) { 950 if (csr0 & CSR0_MERR) {
961 DPRINTK( 1, ( "%s: Bus master arbitration failure (?!?), " 951 DPRINTK( 1, ( "%s: Bus master arbitration failure (?!?), "
962 "status %04x.\n", dev->name, csr0 )); 952 "status %04x.\n", dev->name, csr0 ));
@@ -997,11 +987,11 @@ static int lance_rx( struct net_device *dev )
997 buffers it's possible for a jabber packet to use two 987 buffers it's possible for a jabber packet to use two
998 buffers, with only the last correctly noting the error. */ 988 buffers, with only the last correctly noting the error. */
999 if (status & RMD1_ENP) /* Only count a general error at the */ 989 if (status & RMD1_ENP) /* Only count a general error at the */
1000 lp->stats.rx_errors++; /* end of a packet.*/ 990 dev->stats.rx_errors++; /* end of a packet.*/
1001 if (status & RMD1_FRAM) lp->stats.rx_frame_errors++; 991 if (status & RMD1_FRAM) dev->stats.rx_frame_errors++;
1002 if (status & RMD1_OFLO) lp->stats.rx_over_errors++; 992 if (status & RMD1_OFLO) dev->stats.rx_over_errors++;
1003 if (status & RMD1_CRC) lp->stats.rx_crc_errors++; 993 if (status & RMD1_CRC) dev->stats.rx_crc_errors++;
1004 if (status & RMD1_BUFF) lp->stats.rx_fifo_errors++; 994 if (status & RMD1_BUFF) dev->stats.rx_fifo_errors++;
1005 head->flag &= (RMD1_ENP|RMD1_STP); 995 head->flag &= (RMD1_ENP|RMD1_STP);
1006 } else { 996 } else {
1007 /* Malloc up new buffer, compatible with net-3. */ 997 /* Malloc up new buffer, compatible with net-3. */
@@ -1010,7 +1000,7 @@ static int lance_rx( struct net_device *dev )
1010 1000
1011 if (pkt_len < 60) { 1001 if (pkt_len < 60) {
1012 printk( "%s: Runt packet!\n", dev->name ); 1002 printk( "%s: Runt packet!\n", dev->name );
1013 lp->stats.rx_errors++; 1003 dev->stats.rx_errors++;
1014 } 1004 }
1015 else { 1005 else {
1016 skb = dev_alloc_skb( pkt_len+2 ); 1006 skb = dev_alloc_skb( pkt_len+2 );
@@ -1023,7 +1013,7 @@ static int lance_rx( struct net_device *dev )
1023 break; 1013 break;
1024 1014
1025 if (i > RX_RING_SIZE - 2) { 1015 if (i > RX_RING_SIZE - 2) {
1026 lp->stats.rx_dropped++; 1016 dev->stats.rx_dropped++;
1027 head->flag |= RMD1_OWN_CHIP; 1017 head->flag |= RMD1_OWN_CHIP;
1028 lp->cur_rx++; 1018 lp->cur_rx++;
1029 } 1019 }
@@ -1052,8 +1042,8 @@ static int lance_rx( struct net_device *dev )
1052 skb->protocol = eth_type_trans( skb, dev ); 1042 skb->protocol = eth_type_trans( skb, dev );
1053 netif_rx( skb ); 1043 netif_rx( skb );
1054 dev->last_rx = jiffies; 1044 dev->last_rx = jiffies;
1055 lp->stats.rx_packets++; 1045 dev->stats.rx_packets++;
1056 lp->stats.rx_bytes += pkt_len; 1046 dev->stats.rx_bytes += pkt_len;
1057 } 1047 }
1058 } 1048 }
1059 1049
@@ -1090,14 +1080,6 @@ static int lance_close( struct net_device *dev )
1090} 1080}
1091 1081
1092 1082
1093static struct net_device_stats *lance_get_stats( struct net_device *dev )
1094
1095{ struct lance_private *lp = (struct lance_private *)dev->priv;
1096
1097 return &lp->stats;
1098}
1099
1100
1101/* Set or clear the multicast filter for this adaptor. 1083/* Set or clear the multicast filter for this adaptor.
1102 num_addrs == -1 Promiscuous mode, receive all packets 1084 num_addrs == -1 Promiscuous mode, receive all packets
1103 num_addrs == 0 Normal mode, clear multicast list 1085 num_addrs == 0 Normal mode, clear multicast list