Commit 7bfba0b0c15962265950ac0efe6bd4f42414db6d

Authored by Kulikov Vasiliy
Committed by David S. Miller
1 parent ad6f84b4ba

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>

Showing 1 changed file with 32 additions and 24 deletions Side-by-side Diff

... ... @@ -248,7 +248,6 @@
248 248 int cur_rx, cur_tx; /* The next free ring entry */
249 249 int dirty_rx, dirty_tx; /* The ring entries to be free()ed. */
250 250 int dma;
251   - struct net_device_stats stats;
252 251 unsigned char chip_version; /* See lance_chip_type. */
253 252 spinlock_t devlock;
254 253 };
... ... @@ -925,7 +924,7 @@
925 924 printk ("%s: transmit timed out, status %4.4x, resetting.\n",
926 925 dev->name, inw (ioaddr + LANCE_DATA));
927 926 outw (0x0004, ioaddr + LANCE_DATA);
928   - lp->stats.tx_errors++;
  927 + dev->stats.tx_errors++;
929 928 #ifndef final_version
930 929 if (lance_debug > 3) {
931 930 int i;
... ... @@ -989,7 +988,7 @@
989 988  
990 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 993 /* If any part of this buffer is >16M we must copy it to a low-memory
995 994 buffer. */
996 995  
... ... @@ -1062,13 +1061,16 @@
1062 1061 if (status & 0x40000000) {
1063 1062 /* There was an major error, log it. */
1064 1063 int err_status = lp->tx_ring[entry].misc;
1065   - lp->stats.tx_errors++;
1066   - if (err_status & 0x0400) lp->stats.tx_aborted_errors++;
1067   - if (err_status & 0x0800) lp->stats.tx_carrier_errors++;
1068   - if (err_status & 0x1000) lp->stats.tx_window_errors++;
  1064 + dev->stats.tx_errors++;
  1065 + if (err_status & 0x0400)
  1066 + dev->stats.tx_aborted_errors++;
  1067 + if (err_status & 0x0800)
  1068 + dev->stats.tx_carrier_errors++;
  1069 + if (err_status & 0x1000)
  1070 + dev->stats.tx_window_errors++;
1069 1071 if (err_status & 0x4000) {
1070 1072 /* Ackk! On FIFO errors the Tx unit is turned off! */
1071   - lp->stats.tx_fifo_errors++;
  1073 + dev->stats.tx_fifo_errors++;
1072 1074 /* Remove this verbosity later! */
1073 1075 printk("%s: Tx FIFO error! Status %4.4x.\n",
1074 1076 dev->name, csr0);
... ... @@ -1077,8 +1079,8 @@
1077 1079 }
1078 1080 } else {
1079 1081 if (status & 0x18000000)
1080   - lp->stats.collisions++;
1081   - lp->stats.tx_packets++;
  1082 + dev->stats.collisions++;
  1083 + dev->stats.tx_packets++;
1082 1084 }
1083 1085  
1084 1086 /* We must free the original skb if it's not a data-only copy
... ... @@ -1108,8 +1110,10 @@
1108 1110 }
1109 1111  
1110 1112 /* Log misc errors. */
1111   - if (csr0 & 0x4000) lp->stats.tx_errors++; /* Tx babble. */
1112   - if (csr0 & 0x1000) lp->stats.rx_errors++; /* Missed a Rx frame. */
  1113 + if (csr0 & 0x4000)
  1114 + dev->stats.tx_errors++; /* Tx babble. */
  1115 + if (csr0 & 0x1000)
  1116 + dev->stats.rx_errors++; /* Missed a Rx frame. */
1113 1117 if (csr0 & 0x0800) {
1114 1118 printk("%s: Bus master arbitration failure, status %4.4x.\n",
1115 1119 dev->name, csr0);
... ... @@ -1155,11 +1159,15 @@
1155 1159 buffers it's possible for a jabber packet to use two
1156 1160 buffers, with only the last correctly noting the error. */
1157 1161 if (status & 0x01) /* Only count a general error at the */
1158   - lp->stats.rx_errors++; /* end of a packet.*/
1159   - if (status & 0x20) lp->stats.rx_frame_errors++;
1160   - if (status & 0x10) lp->stats.rx_over_errors++;
1161   - if (status & 0x08) lp->stats.rx_crc_errors++;
1162   - if (status & 0x04) lp->stats.rx_fifo_errors++;
  1162 + dev->stats.rx_errors++; /* end of a packet.*/
  1163 + if (status & 0x20)
  1164 + dev->stats.rx_frame_errors++;
  1165 + if (status & 0x10)
  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 1171 lp->rx_ring[entry].base &= 0x03ffffff;
1164 1172 }
1165 1173 else
... ... @@ -1171,7 +1179,7 @@
1171 1179 if(pkt_len<60)
1172 1180 {
1173 1181 printk("%s: Runt packet!\n",dev->name);
1174   - lp->stats.rx_errors++;
  1182 + dev->stats.rx_errors++;
1175 1183 }
1176 1184 else
1177 1185 {
... ... @@ -1185,7 +1193,7 @@
1185 1193  
1186 1194 if (i > RX_RING_SIZE -2)
1187 1195 {
1188   - lp->stats.rx_dropped++;
  1196 + dev->stats.rx_dropped++;
1189 1197 lp->rx_ring[entry].base |= 0x80000000;
1190 1198 lp->cur_rx++;
1191 1199 }
... ... @@ -1198,8 +1206,8 @@
1198 1206 pkt_len);
1199 1207 skb->protocol=eth_type_trans(skb,dev);
1200 1208 netif_rx(skb);
1201   - lp->stats.rx_packets++;
1202   - lp->stats.rx_bytes+=pkt_len;
  1209 + dev->stats.rx_packets++;
  1210 + dev->stats.rx_bytes += pkt_len;
1203 1211 }
1204 1212 }
1205 1213 /* The docs say that the buffer length isn't touched, but Andrew Boyd
... ... @@ -1225,7 +1233,7 @@
1225 1233  
1226 1234 if (chip_table[lp->chip_version].flags & LANCE_HAS_MISSED_FRAME) {
1227 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 1238 outw(0, ioaddr+LANCE_ADDR);
1231 1239  
1232 1240  
... ... @@ -1262,12 +1270,12 @@
1262 1270 spin_lock_irqsave(&lp->devlock, flags);
1263 1271 saved_addr = inw(ioaddr+LANCE_ADDR);
1264 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 1274 outw(saved_addr, ioaddr+LANCE_ADDR);
1267 1275 spin_unlock_irqrestore(&lp->devlock, flags);
1268 1276 }
1269 1277  
1270   - return &lp->stats;
  1278 + return &dev->stats;
1271 1279 }
1272 1280  
1273 1281 /* Set or clear the multicast filter for this adaptor.