aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/lance.c
diff options
context:
space:
mode:
authorKulikov Vasiliy <segooon@gmail.com>2010-07-04 22:14:03 -0400
committerDavid S. Miller <davem@davemloft.net>2010-07-05 22:41:16 -0400
commit7bfba0b0c15962265950ac0efe6bd4f42414db6d (patch)
tree16b65b729a5fee3dde7cc80ed5f3dbc54d9e2ba1 /drivers/net/lance.c
parentad6f84b4ba7e304dc51dba3b3cbc10b8e348e319 (diff)
lance: 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>
Diffstat (limited to 'drivers/net/lance.c')
-rw-r--r--drivers/net/lance.c56
1 files changed, 32 insertions, 24 deletions
diff --git a/drivers/net/lance.c b/drivers/net/lance.c
index 21f8adaa87c1..f06296bfe293 100644
--- a/drivers/net/lance.c
+++ b/drivers/net/lance.c
@@ -248,7 +248,6 @@ struct lance_private {
248 int cur_rx, cur_tx; /* The next free ring entry */ 248 int cur_rx, cur_tx; /* The next free ring entry */
249 int dirty_rx, dirty_tx; /* The ring entries to be free()ed. */ 249 int dirty_rx, dirty_tx; /* The ring entries to be free()ed. */
250 int dma; 250 int dma;
251 struct net_device_stats stats;
252 unsigned char chip_version; /* See lance_chip_type. */ 251 unsigned char chip_version; /* See lance_chip_type. */
253 spinlock_t devlock; 252 spinlock_t devlock;
254}; 253};
@@ -925,7 +924,7 @@ static void lance_tx_timeout (struct net_device *dev)
925 printk ("%s: transmit timed out, status %4.4x, resetting.\n", 924 printk ("%s: transmit timed out, status %4.4x, resetting.\n",
926 dev->name, inw (ioaddr + LANCE_DATA)); 925 dev->name, inw (ioaddr + LANCE_DATA));
927 outw (0x0004, ioaddr + LANCE_DATA); 926 outw (0x0004, ioaddr + LANCE_DATA);
928 lp->stats.tx_errors++; 927 dev->stats.tx_errors++;
929#ifndef final_version 928#ifndef final_version
930 if (lance_debug > 3) { 929 if (lance_debug > 3) {
931 int i; 930 int i;
@@ -989,7 +988,7 @@ static netdev_tx_t lance_start_xmit(struct sk_buff *skb,
989 988
990 lp->tx_ring[entry].misc = 0x0000; 989 lp->tx_ring[entry].misc = 0x0000;
991 990
992 lp->stats.tx_bytes += skb->len; 991 dev->stats.tx_bytes += skb->len;
993 992
994 /* If any part of this buffer is >16M we must copy it to a low-memory 993 /* If any part of this buffer is >16M we must copy it to a low-memory
995 buffer. */ 994 buffer. */
@@ -1062,13 +1061,16 @@ static irqreturn_t lance_interrupt(int irq, void *dev_id)
1062 if (status & 0x40000000) { 1061 if (status & 0x40000000) {
1063 /* There was an major error, log it. */ 1062 /* There was an major error, log it. */
1064 int err_status = lp->tx_ring[entry].misc; 1063 int err_status = lp->tx_ring[entry].misc;
1065 lp->stats.tx_errors++; 1064 dev->stats.tx_errors++;
1066 if (err_status & 0x0400) lp->stats.tx_aborted_errors++; 1065 if (err_status & 0x0400)
1067 if (err_status & 0x0800) lp->stats.tx_carrier_errors++; 1066 dev->stats.tx_aborted_errors++;
1068 if (err_status & 0x1000) lp->stats.tx_window_errors++; 1067 if (err_status & 0x0800)
1068 dev->stats.tx_carrier_errors++;
1069 if (err_status & 0x1000)
1070 dev->stats.tx_window_errors++;
1069 if (err_status & 0x4000) { 1071 if (err_status & 0x4000) {
1070 /* Ackk! On FIFO errors the Tx unit is turned off! */ 1072 /* Ackk! On FIFO errors the Tx unit is turned off! */
1071 lp->stats.tx_fifo_errors++; 1073 dev->stats.tx_fifo_errors++;
1072 /* Remove this verbosity later! */ 1074 /* Remove this verbosity later! */
1073 printk("%s: Tx FIFO error! Status %4.4x.\n", 1075 printk("%s: Tx FIFO error! Status %4.4x.\n",
1074 dev->name, csr0); 1076 dev->name, csr0);
@@ -1077,8 +1079,8 @@ static irqreturn_t lance_interrupt(int irq, void *dev_id)
1077 } 1079 }
1078 } else { 1080 } else {
1079 if (status & 0x18000000) 1081 if (status & 0x18000000)
1080 lp->stats.collisions++; 1082 dev->stats.collisions++;
1081 lp->stats.tx_packets++; 1083 dev->stats.tx_packets++;
1082 } 1084 }
1083 1085
1084 /* We must free the original skb if it's not a data-only copy 1086 /* We must free the original skb if it's not a data-only copy
@@ -1108,8 +1110,10 @@ static irqreturn_t lance_interrupt(int irq, void *dev_id)
1108 } 1110 }
1109 1111
1110 /* Log misc errors. */ 1112 /* Log misc errors. */
1111 if (csr0 & 0x4000) lp->stats.tx_errors++; /* Tx babble. */ 1113 if (csr0 & 0x4000)
1112 if (csr0 & 0x1000) lp->stats.rx_errors++; /* Missed a Rx frame. */ 1114 dev->stats.tx_errors++; /* Tx babble. */
1115 if (csr0 & 0x1000)
1116 dev->stats.rx_errors++; /* Missed a Rx frame. */
1113 if (csr0 & 0x0800) { 1117 if (csr0 & 0x0800) {
1114 printk("%s: Bus master arbitration failure, status %4.4x.\n", 1118 printk("%s: Bus master arbitration failure, status %4.4x.\n",
1115 dev->name, csr0); 1119 dev->name, csr0);
@@ -1155,11 +1159,15 @@ lance_rx(struct net_device *dev)
1155 buffers it's possible for a jabber packet to use two 1159 buffers it's possible for a jabber packet to use two
1156 buffers, with only the last correctly noting the error. */ 1160 buffers, with only the last correctly noting the error. */
1157 if (status & 0x01) /* Only count a general error at the */ 1161 if (status & 0x01) /* Only count a general error at the */
1158 lp->stats.rx_errors++; /* end of a packet.*/ 1162 dev->stats.rx_errors++; /* end of a packet.*/
1159 if (status & 0x20) lp->stats.rx_frame_errors++; 1163 if (status & 0x20)
1160 if (status & 0x10) lp->stats.rx_over_errors++; 1164 dev->stats.rx_frame_errors++;
1161 if (status & 0x08) lp->stats.rx_crc_errors++; 1165 if (status & 0x10)
1162 if (status & 0x04) lp->stats.rx_fifo_errors++; 1166 dev->stats.rx_over_errors++;
1167 if (status & 0x08)
1168 dev->stats.rx_crc_errors++;
1169 if (status & 0x04)
1170 dev->stats.rx_fifo_errors++;
1163 lp->rx_ring[entry].base &= 0x03ffffff; 1171 lp->rx_ring[entry].base &= 0x03ffffff;
1164 } 1172 }
1165 else 1173 else
@@ -1171,7 +1179,7 @@ lance_rx(struct net_device *dev)
1171 if(pkt_len<60) 1179 if(pkt_len<60)
1172 { 1180 {
1173 printk("%s: Runt packet!\n",dev->name); 1181 printk("%s: Runt packet!\n",dev->name);
1174 lp->stats.rx_errors++; 1182 dev->stats.rx_errors++;
1175 } 1183 }
1176 else 1184 else
1177 { 1185 {
@@ -1185,7 +1193,7 @@ lance_rx(struct net_device *dev)
1185 1193
1186 if (i > RX_RING_SIZE -2) 1194 if (i > RX_RING_SIZE -2)
1187 { 1195 {
1188 lp->stats.rx_dropped++; 1196 dev->stats.rx_dropped++;
1189 lp->rx_ring[entry].base |= 0x80000000; 1197 lp->rx_ring[entry].base |= 0x80000000;
1190 lp->cur_rx++; 1198 lp->cur_rx++;
1191 } 1199 }
@@ -1198,8 +1206,8 @@ lance_rx(struct net_device *dev)
1198 pkt_len); 1206 pkt_len);
1199 skb->protocol=eth_type_trans(skb,dev); 1207 skb->protocol=eth_type_trans(skb,dev);
1200 netif_rx(skb); 1208 netif_rx(skb);
1201 lp->stats.rx_packets++; 1209 dev->stats.rx_packets++;
1202 lp->stats.rx_bytes+=pkt_len; 1210 dev->stats.rx_bytes += pkt_len;
1203 } 1211 }
1204 } 1212 }
1205 /* The docs say that the buffer length isn't touched, but Andrew Boyd 1213 /* The docs say that the buffer length isn't touched, but Andrew Boyd
@@ -1225,7 +1233,7 @@ lance_close(struct net_device *dev)
1225 1233
1226 if (chip_table[lp->chip_version].flags & LANCE_HAS_MISSED_FRAME) { 1234 if (chip_table[lp->chip_version].flags & LANCE_HAS_MISSED_FRAME) {
1227 outw(112, ioaddr+LANCE_ADDR); 1235 outw(112, ioaddr+LANCE_ADDR);
1228 lp->stats.rx_missed_errors = inw(ioaddr+LANCE_DATA); 1236 dev->stats.rx_missed_errors = inw(ioaddr+LANCE_DATA);
1229 } 1237 }
1230 outw(0, ioaddr+LANCE_ADDR); 1238 outw(0, ioaddr+LANCE_ADDR);
1231 1239
@@ -1262,12 +1270,12 @@ static struct net_device_stats *lance_get_stats(struct net_device *dev)
1262 spin_lock_irqsave(&lp->devlock, flags); 1270 spin_lock_irqsave(&lp->devlock, flags);
1263 saved_addr = inw(ioaddr+LANCE_ADDR); 1271 saved_addr = inw(ioaddr+LANCE_ADDR);
1264 outw(112, ioaddr+LANCE_ADDR); 1272 outw(112, ioaddr+LANCE_ADDR);
1265 lp->stats.rx_missed_errors = inw(ioaddr+LANCE_DATA); 1273 dev->stats.rx_missed_errors = inw(ioaddr+LANCE_DATA);
1266 outw(saved_addr, ioaddr+LANCE_ADDR); 1274 outw(saved_addr, ioaddr+LANCE_ADDR);
1267 spin_unlock_irqrestore(&lp->devlock, flags); 1275 spin_unlock_irqrestore(&lp->devlock, flags);
1268 } 1276 }
1269 1277
1270 return &lp->stats; 1278 return &dev->stats;
1271} 1279}
1272 1280
1273/* Set or clear the multicast filter for this adaptor. 1281/* Set or clear the multicast filter for this adaptor.