diff options
author | Don Fry <pcnet32@verizon.net> | 2007-10-17 20:06:19 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-10-17 20:23:30 -0400 |
commit | 4f1e5ba0977570b7a198bb3ac110ccc5f532821b (patch) | |
tree | 2cb8c233daea0544213ec50d7dba74648713c896 | |
parent | 0280f9f90b4c53e23f8ca98e581eb02f1a598a1a (diff) |
pcnet32: remove private net_device_stats structure
Remove the statistics from the private structure.
Use the net_device_stats in netn_device structure.
Following Jeff Garzik's massive cleanup Sep 01.
pcnet32 was not "low-hanging fruit".
Tested x86_64.
Signed-off-by: Don Fry <pcnet32@verizon.net>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r-- | drivers/net/pcnet32.c | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c index 7f7feaaf53d3..ff92aca0a7b3 100644 --- a/drivers/net/pcnet32.c +++ b/drivers/net/pcnet32.c | |||
@@ -282,7 +282,6 @@ struct pcnet32_private { | |||
282 | 282 | ||
283 | struct net_device *dev; | 283 | struct net_device *dev; |
284 | struct napi_struct napi; | 284 | struct napi_struct napi; |
285 | struct net_device_stats stats; | ||
286 | char tx_full; | 285 | char tx_full; |
287 | char phycount; /* number of phys found */ | 286 | char phycount; /* number of phys found */ |
288 | int options; | 287 | int options; |
@@ -1182,15 +1181,15 @@ static void pcnet32_rx_entry(struct net_device *dev, | |||
1182 | * buffers, with only the last correctly noting the error. | 1181 | * buffers, with only the last correctly noting the error. |
1183 | */ | 1182 | */ |
1184 | if (status & 0x01) /* Only count a general error at the */ | 1183 | if (status & 0x01) /* Only count a general error at the */ |
1185 | lp->stats.rx_errors++; /* end of a packet. */ | 1184 | dev->stats.rx_errors++; /* end of a packet. */ |
1186 | if (status & 0x20) | 1185 | if (status & 0x20) |
1187 | lp->stats.rx_frame_errors++; | 1186 | dev->stats.rx_frame_errors++; |
1188 | if (status & 0x10) | 1187 | if (status & 0x10) |
1189 | lp->stats.rx_over_errors++; | 1188 | dev->stats.rx_over_errors++; |
1190 | if (status & 0x08) | 1189 | if (status & 0x08) |
1191 | lp->stats.rx_crc_errors++; | 1190 | dev->stats.rx_crc_errors++; |
1192 | if (status & 0x04) | 1191 | if (status & 0x04) |
1193 | lp->stats.rx_fifo_errors++; | 1192 | dev->stats.rx_fifo_errors++; |
1194 | return; | 1193 | return; |
1195 | } | 1194 | } |
1196 | 1195 | ||
@@ -1201,13 +1200,13 @@ static void pcnet32_rx_entry(struct net_device *dev, | |||
1201 | if (netif_msg_drv(lp)) | 1200 | if (netif_msg_drv(lp)) |
1202 | printk(KERN_ERR "%s: Impossible packet size %d!\n", | 1201 | printk(KERN_ERR "%s: Impossible packet size %d!\n", |
1203 | dev->name, pkt_len); | 1202 | dev->name, pkt_len); |
1204 | lp->stats.rx_errors++; | 1203 | dev->stats.rx_errors++; |
1205 | return; | 1204 | return; |
1206 | } | 1205 | } |
1207 | if (pkt_len < 60) { | 1206 | if (pkt_len < 60) { |
1208 | if (netif_msg_rx_err(lp)) | 1207 | if (netif_msg_rx_err(lp)) |
1209 | printk(KERN_ERR "%s: Runt packet!\n", dev->name); | 1208 | printk(KERN_ERR "%s: Runt packet!\n", dev->name); |
1210 | lp->stats.rx_errors++; | 1209 | dev->stats.rx_errors++; |
1211 | return; | 1210 | return; |
1212 | } | 1211 | } |
1213 | 1212 | ||
@@ -1241,7 +1240,7 @@ static void pcnet32_rx_entry(struct net_device *dev, | |||
1241 | printk(KERN_ERR | 1240 | printk(KERN_ERR |
1242 | "%s: Memory squeeze, dropping packet.\n", | 1241 | "%s: Memory squeeze, dropping packet.\n", |
1243 | dev->name); | 1242 | dev->name); |
1244 | lp->stats.rx_dropped++; | 1243 | dev->stats.rx_dropped++; |
1245 | return; | 1244 | return; |
1246 | } | 1245 | } |
1247 | skb->dev = dev; | 1246 | skb->dev = dev; |
@@ -1260,7 +1259,7 @@ static void pcnet32_rx_entry(struct net_device *dev, | |||
1260 | pkt_len, | 1259 | pkt_len, |
1261 | PCI_DMA_FROMDEVICE); | 1260 | PCI_DMA_FROMDEVICE); |
1262 | } | 1261 | } |
1263 | lp->stats.rx_bytes += skb->len; | 1262 | dev->stats.rx_bytes += skb->len; |
1264 | skb->protocol = eth_type_trans(skb, dev); | 1263 | skb->protocol = eth_type_trans(skb, dev); |
1265 | #ifdef CONFIG_PCNET32_NAPI | 1264 | #ifdef CONFIG_PCNET32_NAPI |
1266 | netif_receive_skb(skb); | 1265 | netif_receive_skb(skb); |
@@ -1268,7 +1267,7 @@ static void pcnet32_rx_entry(struct net_device *dev, | |||
1268 | netif_rx(skb); | 1267 | netif_rx(skb); |
1269 | #endif | 1268 | #endif |
1270 | dev->last_rx = jiffies; | 1269 | dev->last_rx = jiffies; |
1271 | lp->stats.rx_packets++; | 1270 | dev->stats.rx_packets++; |
1272 | return; | 1271 | return; |
1273 | } | 1272 | } |
1274 | 1273 | ||
@@ -1316,21 +1315,21 @@ static int pcnet32_tx(struct net_device *dev) | |||
1316 | if (status & 0x4000) { | 1315 | if (status & 0x4000) { |
1317 | /* There was a major error, log it. */ | 1316 | /* There was a major error, log it. */ |
1318 | int err_status = le32_to_cpu(lp->tx_ring[entry].misc); | 1317 | int err_status = le32_to_cpu(lp->tx_ring[entry].misc); |
1319 | lp->stats.tx_errors++; | 1318 | dev->stats.tx_errors++; |
1320 | if (netif_msg_tx_err(lp)) | 1319 | if (netif_msg_tx_err(lp)) |
1321 | printk(KERN_ERR | 1320 | printk(KERN_ERR |
1322 | "%s: Tx error status=%04x err_status=%08x\n", | 1321 | "%s: Tx error status=%04x err_status=%08x\n", |
1323 | dev->name, status, | 1322 | dev->name, status, |
1324 | err_status); | 1323 | err_status); |
1325 | if (err_status & 0x04000000) | 1324 | if (err_status & 0x04000000) |
1326 | lp->stats.tx_aborted_errors++; | 1325 | dev->stats.tx_aborted_errors++; |
1327 | if (err_status & 0x08000000) | 1326 | if (err_status & 0x08000000) |
1328 | lp->stats.tx_carrier_errors++; | 1327 | dev->stats.tx_carrier_errors++; |
1329 | if (err_status & 0x10000000) | 1328 | if (err_status & 0x10000000) |
1330 | lp->stats.tx_window_errors++; | 1329 | dev->stats.tx_window_errors++; |
1331 | #ifndef DO_DXSUFLO | 1330 | #ifndef DO_DXSUFLO |
1332 | if (err_status & 0x40000000) { | 1331 | if (err_status & 0x40000000) { |
1333 | lp->stats.tx_fifo_errors++; | 1332 | dev->stats.tx_fifo_errors++; |
1334 | /* Ackk! On FIFO errors the Tx unit is turned off! */ | 1333 | /* Ackk! On FIFO errors the Tx unit is turned off! */ |
1335 | /* Remove this verbosity later! */ | 1334 | /* Remove this verbosity later! */ |
1336 | if (netif_msg_tx_err(lp)) | 1335 | if (netif_msg_tx_err(lp)) |
@@ -1341,7 +1340,7 @@ static int pcnet32_tx(struct net_device *dev) | |||
1341 | } | 1340 | } |
1342 | #else | 1341 | #else |
1343 | if (err_status & 0x40000000) { | 1342 | if (err_status & 0x40000000) { |
1344 | lp->stats.tx_fifo_errors++; | 1343 | dev->stats.tx_fifo_errors++; |
1345 | if (!lp->dxsuflo) { /* If controller doesn't recover ... */ | 1344 | if (!lp->dxsuflo) { /* If controller doesn't recover ... */ |
1346 | /* Ackk! On FIFO errors the Tx unit is turned off! */ | 1345 | /* Ackk! On FIFO errors the Tx unit is turned off! */ |
1347 | /* Remove this verbosity later! */ | 1346 | /* Remove this verbosity later! */ |
@@ -1355,8 +1354,8 @@ static int pcnet32_tx(struct net_device *dev) | |||
1355 | #endif | 1354 | #endif |
1356 | } else { | 1355 | } else { |
1357 | if (status & 0x1800) | 1356 | if (status & 0x1800) |
1358 | lp->stats.collisions++; | 1357 | dev->stats.collisions++; |
1359 | lp->stats.tx_packets++; | 1358 | dev->stats.tx_packets++; |
1360 | } | 1359 | } |
1361 | 1360 | ||
1362 | /* We must free the original skb */ | 1361 | /* We must free the original skb */ |
@@ -2478,7 +2477,7 @@ static void pcnet32_tx_timeout(struct net_device *dev) | |||
2478 | "%s: transmit timed out, status %4.4x, resetting.\n", | 2477 | "%s: transmit timed out, status %4.4x, resetting.\n", |
2479 | dev->name, lp->a.read_csr(ioaddr, CSR0)); | 2478 | dev->name, lp->a.read_csr(ioaddr, CSR0)); |
2480 | lp->a.write_csr(ioaddr, CSR0, CSR0_STOP); | 2479 | lp->a.write_csr(ioaddr, CSR0, CSR0_STOP); |
2481 | lp->stats.tx_errors++; | 2480 | dev->stats.tx_errors++; |
2482 | if (netif_msg_tx_err(lp)) { | 2481 | if (netif_msg_tx_err(lp)) { |
2483 | int i; | 2482 | int i; |
2484 | printk(KERN_DEBUG | 2483 | printk(KERN_DEBUG |
@@ -2548,7 +2547,7 @@ static int pcnet32_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2548 | lp->tx_ring[entry].status = cpu_to_le16(status); | 2547 | lp->tx_ring[entry].status = cpu_to_le16(status); |
2549 | 2548 | ||
2550 | lp->cur_tx++; | 2549 | lp->cur_tx++; |
2551 | lp->stats.tx_bytes += skb->len; | 2550 | dev->stats.tx_bytes += skb->len; |
2552 | 2551 | ||
2553 | /* Trigger an immediate send poll. */ | 2552 | /* Trigger an immediate send poll. */ |
2554 | lp->a.write_csr(ioaddr, CSR0, CSR0_INTEN | CSR0_TXPOLL); | 2553 | lp->a.write_csr(ioaddr, CSR0, CSR0_INTEN | CSR0_TXPOLL); |
@@ -2593,7 +2592,7 @@ pcnet32_interrupt(int irq, void *dev_id) | |||
2593 | 2592 | ||
2594 | /* Log misc errors. */ | 2593 | /* Log misc errors. */ |
2595 | if (csr0 & 0x4000) | 2594 | if (csr0 & 0x4000) |
2596 | lp->stats.tx_errors++; /* Tx babble. */ | 2595 | dev->stats.tx_errors++; /* Tx babble. */ |
2597 | if (csr0 & 0x1000) { | 2596 | if (csr0 & 0x1000) { |
2598 | /* | 2597 | /* |
2599 | * This happens when our receive ring is full. This | 2598 | * This happens when our receive ring is full. This |
@@ -2606,7 +2605,7 @@ pcnet32_interrupt(int irq, void *dev_id) | |||
2606 | * don't get a rx interrupt, but a missed frame | 2605 | * don't get a rx interrupt, but a missed frame |
2607 | * interrupt sooner or later. | 2606 | * interrupt sooner or later. |
2608 | */ | 2607 | */ |
2609 | lp->stats.rx_errors++; /* Missed a Rx frame. */ | 2608 | dev->stats.rx_errors++; /* Missed a Rx frame. */ |
2610 | } | 2609 | } |
2611 | if (csr0 & 0x0800) { | 2610 | if (csr0 & 0x0800) { |
2612 | if (netif_msg_drv(lp)) | 2611 | if (netif_msg_drv(lp)) |
@@ -2668,7 +2667,7 @@ static int pcnet32_close(struct net_device *dev) | |||
2668 | 2667 | ||
2669 | spin_lock_irqsave(&lp->lock, flags); | 2668 | spin_lock_irqsave(&lp->lock, flags); |
2670 | 2669 | ||
2671 | lp->stats.rx_missed_errors = lp->a.read_csr(ioaddr, 112); | 2670 | dev->stats.rx_missed_errors = lp->a.read_csr(ioaddr, 112); |
2672 | 2671 | ||
2673 | if (netif_msg_ifdown(lp)) | 2672 | if (netif_msg_ifdown(lp)) |
2674 | printk(KERN_DEBUG | 2673 | printk(KERN_DEBUG |
@@ -2705,10 +2704,10 @@ static struct net_device_stats *pcnet32_get_stats(struct net_device *dev) | |||
2705 | unsigned long flags; | 2704 | unsigned long flags; |
2706 | 2705 | ||
2707 | spin_lock_irqsave(&lp->lock, flags); | 2706 | spin_lock_irqsave(&lp->lock, flags); |
2708 | lp->stats.rx_missed_errors = lp->a.read_csr(ioaddr, 112); | 2707 | dev->stats.rx_missed_errors = lp->a.read_csr(ioaddr, 112); |
2709 | spin_unlock_irqrestore(&lp->lock, flags); | 2708 | spin_unlock_irqrestore(&lp->lock, flags); |
2710 | 2709 | ||
2711 | return &lp->stats; | 2710 | return &dev->stats; |
2712 | } | 2711 | } |
2713 | 2712 | ||
2714 | /* taken from the sunlance driver, which it took from the depca driver */ | 2713 | /* taken from the sunlance driver, which it took from the depca driver */ |