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>
This commit is contained in:
Don Fry 2007-10-17 17:06:19 -07:00 committed by Jeff Garzik
parent 0280f9f90b
commit 4f1e5ba097

View file

@ -282,7 +282,6 @@ struct pcnet32_private {
struct net_device *dev; struct net_device *dev;
struct napi_struct napi; struct napi_struct napi;
struct net_device_stats stats;
char tx_full; char tx_full;
char phycount; /* number of phys found */ char phycount; /* number of phys found */
int options; int options;
@ -1182,15 +1181,15 @@ static void pcnet32_rx_entry(struct net_device *dev,
* buffers, with only the last correctly noting the error. * buffers, with only the last correctly noting the error.
*/ */
if (status & 0x01) /* Only count a general error at the */ if (status & 0x01) /* Only count a general error at the */
lp->stats.rx_errors++; /* end of a packet. */ dev->stats.rx_errors++; /* end of a packet. */
if (status & 0x20) if (status & 0x20)
lp->stats.rx_frame_errors++; dev->stats.rx_frame_errors++;
if (status & 0x10) if (status & 0x10)
lp->stats.rx_over_errors++; dev->stats.rx_over_errors++;
if (status & 0x08) if (status & 0x08)
lp->stats.rx_crc_errors++; dev->stats.rx_crc_errors++;
if (status & 0x04) if (status & 0x04)
lp->stats.rx_fifo_errors++; dev->stats.rx_fifo_errors++;
return; return;
} }
@ -1201,13 +1200,13 @@ static void pcnet32_rx_entry(struct net_device *dev,
if (netif_msg_drv(lp)) if (netif_msg_drv(lp))
printk(KERN_ERR "%s: Impossible packet size %d!\n", printk(KERN_ERR "%s: Impossible packet size %d!\n",
dev->name, pkt_len); dev->name, pkt_len);
lp->stats.rx_errors++; dev->stats.rx_errors++;
return; return;
} }
if (pkt_len < 60) { if (pkt_len < 60) {
if (netif_msg_rx_err(lp)) if (netif_msg_rx_err(lp))
printk(KERN_ERR "%s: Runt packet!\n", dev->name); printk(KERN_ERR "%s: Runt packet!\n", dev->name);
lp->stats.rx_errors++; dev->stats.rx_errors++;
return; return;
} }
@ -1241,7 +1240,7 @@ static void pcnet32_rx_entry(struct net_device *dev,
printk(KERN_ERR printk(KERN_ERR
"%s: Memory squeeze, dropping packet.\n", "%s: Memory squeeze, dropping packet.\n",
dev->name); dev->name);
lp->stats.rx_dropped++; dev->stats.rx_dropped++;
return; return;
} }
skb->dev = dev; skb->dev = dev;
@ -1260,7 +1259,7 @@ static void pcnet32_rx_entry(struct net_device *dev,
pkt_len, pkt_len,
PCI_DMA_FROMDEVICE); PCI_DMA_FROMDEVICE);
} }
lp->stats.rx_bytes += skb->len; dev->stats.rx_bytes += skb->len;
skb->protocol = eth_type_trans(skb, dev); skb->protocol = eth_type_trans(skb, dev);
#ifdef CONFIG_PCNET32_NAPI #ifdef CONFIG_PCNET32_NAPI
netif_receive_skb(skb); netif_receive_skb(skb);
@ -1268,7 +1267,7 @@ static void pcnet32_rx_entry(struct net_device *dev,
netif_rx(skb); netif_rx(skb);
#endif #endif
dev->last_rx = jiffies; dev->last_rx = jiffies;
lp->stats.rx_packets++; dev->stats.rx_packets++;
return; return;
} }
@ -1316,21 +1315,21 @@ static int pcnet32_tx(struct net_device *dev)
if (status & 0x4000) { if (status & 0x4000) {
/* There was a major error, log it. */ /* There was a major error, log it. */
int err_status = le32_to_cpu(lp->tx_ring[entry].misc); int err_status = le32_to_cpu(lp->tx_ring[entry].misc);
lp->stats.tx_errors++; dev->stats.tx_errors++;
if (netif_msg_tx_err(lp)) if (netif_msg_tx_err(lp))
printk(KERN_ERR printk(KERN_ERR
"%s: Tx error status=%04x err_status=%08x\n", "%s: Tx error status=%04x err_status=%08x\n",
dev->name, status, dev->name, status,
err_status); err_status);
if (err_status & 0x04000000) if (err_status & 0x04000000)
lp->stats.tx_aborted_errors++; dev->stats.tx_aborted_errors++;
if (err_status & 0x08000000) if (err_status & 0x08000000)
lp->stats.tx_carrier_errors++; dev->stats.tx_carrier_errors++;
if (err_status & 0x10000000) if (err_status & 0x10000000)
lp->stats.tx_window_errors++; dev->stats.tx_window_errors++;
#ifndef DO_DXSUFLO #ifndef DO_DXSUFLO
if (err_status & 0x40000000) { if (err_status & 0x40000000) {
lp->stats.tx_fifo_errors++; dev->stats.tx_fifo_errors++;
/* Ackk! On FIFO errors the Tx unit is turned off! */ /* Ackk! On FIFO errors the Tx unit is turned off! */
/* Remove this verbosity later! */ /* Remove this verbosity later! */
if (netif_msg_tx_err(lp)) if (netif_msg_tx_err(lp))
@ -1341,7 +1340,7 @@ static int pcnet32_tx(struct net_device *dev)
} }
#else #else
if (err_status & 0x40000000) { if (err_status & 0x40000000) {
lp->stats.tx_fifo_errors++; dev->stats.tx_fifo_errors++;
if (!lp->dxsuflo) { /* If controller doesn't recover ... */ if (!lp->dxsuflo) { /* If controller doesn't recover ... */
/* Ackk! On FIFO errors the Tx unit is turned off! */ /* Ackk! On FIFO errors the Tx unit is turned off! */
/* Remove this verbosity later! */ /* Remove this verbosity later! */
@ -1355,8 +1354,8 @@ static int pcnet32_tx(struct net_device *dev)
#endif #endif
} else { } else {
if (status & 0x1800) if (status & 0x1800)
lp->stats.collisions++; dev->stats.collisions++;
lp->stats.tx_packets++; dev->stats.tx_packets++;
} }
/* We must free the original skb */ /* We must free the original skb */
@ -2478,7 +2477,7 @@ static void pcnet32_tx_timeout(struct net_device *dev)
"%s: transmit timed out, status %4.4x, resetting.\n", "%s: transmit timed out, status %4.4x, resetting.\n",
dev->name, lp->a.read_csr(ioaddr, CSR0)); dev->name, lp->a.read_csr(ioaddr, CSR0));
lp->a.write_csr(ioaddr, CSR0, CSR0_STOP); lp->a.write_csr(ioaddr, CSR0, CSR0_STOP);
lp->stats.tx_errors++; dev->stats.tx_errors++;
if (netif_msg_tx_err(lp)) { if (netif_msg_tx_err(lp)) {
int i; int i;
printk(KERN_DEBUG printk(KERN_DEBUG
@ -2548,7 +2547,7 @@ static int pcnet32_start_xmit(struct sk_buff *skb, struct net_device *dev)
lp->tx_ring[entry].status = cpu_to_le16(status); lp->tx_ring[entry].status = cpu_to_le16(status);
lp->cur_tx++; lp->cur_tx++;
lp->stats.tx_bytes += skb->len; dev->stats.tx_bytes += skb->len;
/* Trigger an immediate send poll. */ /* Trigger an immediate send poll. */
lp->a.write_csr(ioaddr, CSR0, CSR0_INTEN | CSR0_TXPOLL); lp->a.write_csr(ioaddr, CSR0, CSR0_INTEN | CSR0_TXPOLL);
@ -2593,7 +2592,7 @@ pcnet32_interrupt(int irq, void *dev_id)
/* Log misc errors. */ /* Log misc errors. */
if (csr0 & 0x4000) if (csr0 & 0x4000)
lp->stats.tx_errors++; /* Tx babble. */ dev->stats.tx_errors++; /* Tx babble. */
if (csr0 & 0x1000) { if (csr0 & 0x1000) {
/* /*
* This happens when our receive ring is full. This * This happens when our receive ring is full. This
@ -2606,7 +2605,7 @@ pcnet32_interrupt(int irq, void *dev_id)
* don't get a rx interrupt, but a missed frame * don't get a rx interrupt, but a missed frame
* interrupt sooner or later. * interrupt sooner or later.
*/ */
lp->stats.rx_errors++; /* Missed a Rx frame. */ dev->stats.rx_errors++; /* Missed a Rx frame. */
} }
if (csr0 & 0x0800) { if (csr0 & 0x0800) {
if (netif_msg_drv(lp)) if (netif_msg_drv(lp))
@ -2668,7 +2667,7 @@ static int pcnet32_close(struct net_device *dev)
spin_lock_irqsave(&lp->lock, flags); spin_lock_irqsave(&lp->lock, flags);
lp->stats.rx_missed_errors = lp->a.read_csr(ioaddr, 112); dev->stats.rx_missed_errors = lp->a.read_csr(ioaddr, 112);
if (netif_msg_ifdown(lp)) if (netif_msg_ifdown(lp))
printk(KERN_DEBUG printk(KERN_DEBUG
@ -2705,10 +2704,10 @@ static struct net_device_stats *pcnet32_get_stats(struct net_device *dev)
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&lp->lock, flags); spin_lock_irqsave(&lp->lock, flags);
lp->stats.rx_missed_errors = lp->a.read_csr(ioaddr, 112); dev->stats.rx_missed_errors = lp->a.read_csr(ioaddr, 112);
spin_unlock_irqrestore(&lp->lock, flags); spin_unlock_irqrestore(&lp->lock, flags);
return &lp->stats; return &dev->stats;
} }
/* taken from the sunlance driver, which it took from the depca driver */ /* taken from the sunlance driver, which it took from the depca driver */