aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorPaulius Zaleckas <paulius.zaleckas@teltonika.lt>2008-04-29 05:09:38 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-05-13 01:35:25 -0400
commit4711c841e4547a41f596bcf6c97473bc6a15126d (patch)
tree14ae2df9859d1b43eed9002ffea5434bfe13a32e /drivers/net
parentaa50911ade012470f3c6fe8f7f7868bfd328a4c2 (diff)
3c527: use netstats in net_device structure
Use net_device_stats from net_device structure instead of local. Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/3c527.c45
1 files changed, 21 insertions, 24 deletions
diff --git a/drivers/net/3c527.c b/drivers/net/3c527.c
index fae295b6809c..6aca0c640f13 100644
--- a/drivers/net/3c527.c
+++ b/drivers/net/3c527.c
@@ -158,7 +158,6 @@ struct mc32_local
158 int slot; 158 int slot;
159 159
160 u32 base; 160 u32 base;
161 struct net_device_stats net_stats;
162 volatile struct mc32_mailbox *rx_box; 161 volatile struct mc32_mailbox *rx_box;
163 volatile struct mc32_mailbox *tx_box; 162 volatile struct mc32_mailbox *tx_box;
164 volatile struct mc32_mailbox *exec_box; 163 volatile struct mc32_mailbox *exec_box;
@@ -1093,24 +1092,24 @@ static void mc32_update_stats(struct net_device *dev)
1093 1092
1094 u32 rx_errors=0; 1093 u32 rx_errors=0;
1095 1094
1096 rx_errors+=lp->net_stats.rx_crc_errors +=st->rx_crc_errors; 1095 rx_errors+=dev->stats.rx_crc_errors +=st->rx_crc_errors;
1097 st->rx_crc_errors=0; 1096 st->rx_crc_errors=0;
1098 rx_errors+=lp->net_stats.rx_fifo_errors +=st->rx_overrun_errors; 1097 rx_errors+=dev->stats.rx_fifo_errors +=st->rx_overrun_errors;
1099 st->rx_overrun_errors=0; 1098 st->rx_overrun_errors=0;
1100 rx_errors+=lp->net_stats.rx_frame_errors +=st->rx_alignment_errors; 1099 rx_errors+=dev->stats.rx_frame_errors +=st->rx_alignment_errors;
1101 st->rx_alignment_errors=0; 1100 st->rx_alignment_errors=0;
1102 rx_errors+=lp->net_stats.rx_length_errors+=st->rx_tooshort_errors; 1101 rx_errors+=dev->stats.rx_length_errors+=st->rx_tooshort_errors;
1103 st->rx_tooshort_errors=0; 1102 st->rx_tooshort_errors=0;
1104 rx_errors+=lp->net_stats.rx_missed_errors+=st->rx_outofresource_errors; 1103 rx_errors+=dev->stats.rx_missed_errors+=st->rx_outofresource_errors;
1105 st->rx_outofresource_errors=0; 1104 st->rx_outofresource_errors=0;
1106 lp->net_stats.rx_errors=rx_errors; 1105 dev->stats.rx_errors=rx_errors;
1107 1106
1108 /* Number of packets which saw one collision */ 1107 /* Number of packets which saw one collision */
1109 lp->net_stats.collisions+=st->dataC[10]; 1108 dev->stats.collisions+=st->dataC[10];
1110 st->dataC[10]=0; 1109 st->dataC[10]=0;
1111 1110
1112 /* Number of packets which saw 2--15 collisions */ 1111 /* Number of packets which saw 2--15 collisions */
1113 lp->net_stats.collisions+=st->dataC[11]; 1112 dev->stats.collisions+=st->dataC[11];
1114 st->dataC[11]=0; 1113 st->dataC[11]=0;
1115} 1114}
1116 1115
@@ -1178,7 +1177,7 @@ static void mc32_rx_ring(struct net_device *dev)
1178 skb=dev_alloc_skb(length+2); 1177 skb=dev_alloc_skb(length+2);
1179 1178
1180 if(skb==NULL) { 1179 if(skb==NULL) {
1181 lp->net_stats.rx_dropped++; 1180 dev->stats.rx_dropped++;
1182 goto dropped; 1181 goto dropped;
1183 } 1182 }
1184 1183
@@ -1189,8 +1188,8 @@ static void mc32_rx_ring(struct net_device *dev)
1189 1188
1190 skb->protocol=eth_type_trans(skb,dev); 1189 skb->protocol=eth_type_trans(skb,dev);
1191 dev->last_rx = jiffies; 1190 dev->last_rx = jiffies;
1192 lp->net_stats.rx_packets++; 1191 dev->stats.rx_packets++;
1193 lp->net_stats.rx_bytes += length; 1192 dev->stats.rx_bytes += length;
1194 netif_rx(skb); 1193 netif_rx(skb);
1195 } 1194 }
1196 1195
@@ -1253,34 +1252,34 @@ static void mc32_tx_ring(struct net_device *dev)
1253 /* Not COMPLETED */ 1252 /* Not COMPLETED */
1254 break; 1253 break;
1255 } 1254 }
1256 lp->net_stats.tx_packets++; 1255 dev->stats.tx_packets++;
1257 if(!(np->status & (1<<6))) /* Not COMPLETED_OK */ 1256 if(!(np->status & (1<<6))) /* Not COMPLETED_OK */
1258 { 1257 {
1259 lp->net_stats.tx_errors++; 1258 dev->stats.tx_errors++;
1260 1259
1261 switch(np->status&0x0F) 1260 switch(np->status&0x0F)
1262 { 1261 {
1263 case 1: 1262 case 1:
1264 lp->net_stats.tx_aborted_errors++; 1263 dev->stats.tx_aborted_errors++;
1265 break; /* Max collisions */ 1264 break; /* Max collisions */
1266 case 2: 1265 case 2:
1267 lp->net_stats.tx_fifo_errors++; 1266 dev->stats.tx_fifo_errors++;
1268 break; 1267 break;
1269 case 3: 1268 case 3:
1270 lp->net_stats.tx_carrier_errors++; 1269 dev->stats.tx_carrier_errors++;
1271 break; 1270 break;
1272 case 4: 1271 case 4:
1273 lp->net_stats.tx_window_errors++; 1272 dev->stats.tx_window_errors++;
1274 break; /* CTS Lost */ 1273 break; /* CTS Lost */
1275 case 5: 1274 case 5:
1276 lp->net_stats.tx_aborted_errors++; 1275 dev->stats.tx_aborted_errors++;
1277 break; /* Transmit timeout */ 1276 break; /* Transmit timeout */
1278 } 1277 }
1279 } 1278 }
1280 /* Packets are sent in order - this is 1279 /* Packets are sent in order - this is
1281 basically a FIFO queue of buffers matching 1280 basically a FIFO queue of buffers matching
1282 the card ring */ 1281 the card ring */
1283 lp->net_stats.tx_bytes+=lp->tx_ring[t].skb->len; 1282 dev->stats.tx_bytes+=lp->tx_ring[t].skb->len;
1284 dev_kfree_skb_irq(lp->tx_ring[t].skb); 1283 dev_kfree_skb_irq(lp->tx_ring[t].skb);
1285 lp->tx_ring[t].skb=NULL; 1284 lp->tx_ring[t].skb=NULL;
1286 atomic_inc(&lp->tx_count); 1285 atomic_inc(&lp->tx_count);
@@ -1367,7 +1366,7 @@ static irqreturn_t mc32_interrupt(int irq, void *dev_id)
1367 case 6: 1366 case 6:
1368 /* Out of RX buffers stat */ 1367 /* Out of RX buffers stat */
1369 /* Must restart rx */ 1368 /* Must restart rx */
1370 lp->net_stats.rx_dropped++; 1369 dev->stats.rx_dropped++;
1371 mc32_rx_ring(dev); 1370 mc32_rx_ring(dev);
1372 mc32_start_transceiver(dev); 1371 mc32_start_transceiver(dev);
1373 break; 1372 break;
@@ -1489,10 +1488,8 @@ static int mc32_close(struct net_device *dev)
1489 1488
1490static struct net_device_stats *mc32_get_stats(struct net_device *dev) 1489static struct net_device_stats *mc32_get_stats(struct net_device *dev)
1491{ 1490{
1492 struct mc32_local *lp = netdev_priv(dev);
1493
1494 mc32_update_stats(dev); 1491 mc32_update_stats(dev);
1495 return &lp->net_stats; 1492 return &dev->stats;
1496} 1493}
1497 1494
1498 1495