epic100: 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>
This commit is contained in:
Kulikov Vasiliy 2010-07-05 02:13:20 +00:00 committed by David S. Miller
parent 57616ee440
commit 275defc958

View file

@ -278,7 +278,6 @@ struct epic_private {
struct pci_dev *pci_dev; /* PCI bus location. */ struct pci_dev *pci_dev; /* PCI bus location. */
int chip_id, chip_flags; int chip_id, chip_flags;
struct net_device_stats stats;
struct timer_list timer; /* Media selection timer. */ struct timer_list timer; /* Media selection timer. */
int tx_threshold; int tx_threshold;
unsigned char mc_filter[8]; unsigned char mc_filter[8];
@ -770,7 +769,6 @@ static int epic_open(struct net_device *dev)
static void epic_pause(struct net_device *dev) static void epic_pause(struct net_device *dev)
{ {
long ioaddr = dev->base_addr; long ioaddr = dev->base_addr;
struct epic_private *ep = netdev_priv(dev);
netif_stop_queue (dev); netif_stop_queue (dev);
@ -781,9 +779,9 @@ static void epic_pause(struct net_device *dev)
/* Update the error counts. */ /* Update the error counts. */
if (inw(ioaddr + COMMAND) != 0xffff) { if (inw(ioaddr + COMMAND) != 0xffff) {
ep->stats.rx_missed_errors += inb(ioaddr + MPCNT); dev->stats.rx_missed_errors += inb(ioaddr + MPCNT);
ep->stats.rx_frame_errors += inb(ioaddr + ALICNT); dev->stats.rx_frame_errors += inb(ioaddr + ALICNT);
ep->stats.rx_crc_errors += inb(ioaddr + CRCCNT); dev->stats.rx_crc_errors += inb(ioaddr + CRCCNT);
} }
/* Remove the packets on the Rx queue. */ /* Remove the packets on the Rx queue. */
@ -900,7 +898,7 @@ static void epic_tx_timeout(struct net_device *dev)
} }
} }
if (inw(ioaddr + TxSTAT) & 0x10) { /* Tx FIFO underflow. */ if (inw(ioaddr + TxSTAT) & 0x10) { /* Tx FIFO underflow. */
ep->stats.tx_fifo_errors++; dev->stats.tx_fifo_errors++;
outl(RestartTx, ioaddr + COMMAND); outl(RestartTx, ioaddr + COMMAND);
} else { } else {
epic_restart(dev); epic_restart(dev);
@ -908,7 +906,7 @@ static void epic_tx_timeout(struct net_device *dev)
} }
dev->trans_start = jiffies; /* prevent tx timeout */ dev->trans_start = jiffies; /* prevent tx timeout */
ep->stats.tx_errors++; dev->stats.tx_errors++;
if (!ep->tx_full) if (!ep->tx_full)
netif_wake_queue(dev); netif_wake_queue(dev);
} }
@ -1016,7 +1014,7 @@ static netdev_tx_t epic_start_xmit(struct sk_buff *skb, struct net_device *dev)
static void epic_tx_error(struct net_device *dev, struct epic_private *ep, static void epic_tx_error(struct net_device *dev, struct epic_private *ep,
int status) int status)
{ {
struct net_device_stats *stats = &ep->stats; struct net_device_stats *stats = &dev->stats;
#ifndef final_version #ifndef final_version
/* There was an major error, log it. */ /* There was an major error, log it. */
@ -1053,9 +1051,9 @@ static void epic_tx(struct net_device *dev, struct epic_private *ep)
break; /* It still hasn't been Txed */ break; /* It still hasn't been Txed */
if (likely(txstatus & 0x0001)) { if (likely(txstatus & 0x0001)) {
ep->stats.collisions += (txstatus >> 8) & 15; dev->stats.collisions += (txstatus >> 8) & 15;
ep->stats.tx_packets++; dev->stats.tx_packets++;
ep->stats.tx_bytes += ep->tx_skbuff[entry]->len; dev->stats.tx_bytes += ep->tx_skbuff[entry]->len;
} else } else
epic_tx_error(dev, ep, txstatus); epic_tx_error(dev, ep, txstatus);
@ -1125,12 +1123,12 @@ static irqreturn_t epic_interrupt(int irq, void *dev_instance)
goto out; goto out;
/* Always update the error counts to avoid overhead later. */ /* Always update the error counts to avoid overhead later. */
ep->stats.rx_missed_errors += inb(ioaddr + MPCNT); dev->stats.rx_missed_errors += inb(ioaddr + MPCNT);
ep->stats.rx_frame_errors += inb(ioaddr + ALICNT); dev->stats.rx_frame_errors += inb(ioaddr + ALICNT);
ep->stats.rx_crc_errors += inb(ioaddr + CRCCNT); dev->stats.rx_crc_errors += inb(ioaddr + CRCCNT);
if (status & TxUnderrun) { /* Tx FIFO underflow. */ if (status & TxUnderrun) { /* Tx FIFO underflow. */
ep->stats.tx_fifo_errors++; dev->stats.tx_fifo_errors++;
outl(ep->tx_threshold += 128, ioaddr + TxThresh); outl(ep->tx_threshold += 128, ioaddr + TxThresh);
/* Restart the transmit process. */ /* Restart the transmit process. */
outl(RestartTx, ioaddr + COMMAND); outl(RestartTx, ioaddr + COMMAND);
@ -1183,10 +1181,10 @@ static int epic_rx(struct net_device *dev, int budget)
if (status & 0x2000) { if (status & 0x2000) {
printk(KERN_WARNING "%s: Oversized Ethernet frame spanned " printk(KERN_WARNING "%s: Oversized Ethernet frame spanned "
"multiple buffers, status %4.4x!\n", dev->name, status); "multiple buffers, status %4.4x!\n", dev->name, status);
ep->stats.rx_length_errors++; dev->stats.rx_length_errors++;
} else if (status & 0x0006) } else if (status & 0x0006)
/* Rx Frame errors are counted in hardware. */ /* Rx Frame errors are counted in hardware. */
ep->stats.rx_errors++; dev->stats.rx_errors++;
} else { } else {
/* Malloc up new buffer, compatible with net-2e. */ /* Malloc up new buffer, compatible with net-2e. */
/* Omit the four octet CRC from the length. */ /* Omit the four octet CRC from the length. */
@ -1223,8 +1221,8 @@ static int epic_rx(struct net_device *dev, int budget)
} }
skb->protocol = eth_type_trans(skb, dev); skb->protocol = eth_type_trans(skb, dev);
netif_receive_skb(skb); netif_receive_skb(skb);
ep->stats.rx_packets++; dev->stats.rx_packets++;
ep->stats.rx_bytes += pkt_len; dev->stats.rx_bytes += pkt_len;
} }
work_done++; work_done++;
entry = (++ep->cur_rx) % RX_RING_SIZE; entry = (++ep->cur_rx) % RX_RING_SIZE;
@ -1259,7 +1257,7 @@ static void epic_rx_err(struct net_device *dev, struct epic_private *ep)
if (status == EpicRemoved) if (status == EpicRemoved)
return; return;
if (status & RxOverflow) /* Missed a Rx frame. */ if (status & RxOverflow) /* Missed a Rx frame. */
ep->stats.rx_errors++; dev->stats.rx_errors++;
if (status & (RxOverflow | RxFull)) if (status & (RxOverflow | RxFull))
outw(RxQueued, ioaddr + COMMAND); outw(RxQueued, ioaddr + COMMAND);
} }
@ -1357,17 +1355,16 @@ static int epic_close(struct net_device *dev)
static struct net_device_stats *epic_get_stats(struct net_device *dev) static struct net_device_stats *epic_get_stats(struct net_device *dev)
{ {
struct epic_private *ep = netdev_priv(dev);
long ioaddr = dev->base_addr; long ioaddr = dev->base_addr;
if (netif_running(dev)) { if (netif_running(dev)) {
/* Update the error counts. */ /* Update the error counts. */
ep->stats.rx_missed_errors += inb(ioaddr + MPCNT); dev->stats.rx_missed_errors += inb(ioaddr + MPCNT);
ep->stats.rx_frame_errors += inb(ioaddr + ALICNT); dev->stats.rx_frame_errors += inb(ioaddr + ALICNT);
ep->stats.rx_crc_errors += inb(ioaddr + CRCCNT); dev->stats.rx_crc_errors += inb(ioaddr + CRCCNT);
} }
return &ep->stats; return &dev->stats;
} }
/* Set or clear the multicast filter for this adaptor. /* Set or clear the multicast filter for this adaptor.