8139too: 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>
This commit is contained in:
Paulius Zaleckas 2008-05-05 16:24:21 +03:00 committed by Jeff Garzik
parent 237225f70f
commit e1eac92e4c

View File

@ -574,7 +574,6 @@ struct rtl8139_private {
u32 msg_enable; u32 msg_enable;
struct napi_struct napi; struct napi_struct napi;
struct net_device *dev; struct net_device *dev;
struct net_device_stats stats;
unsigned char *rx_ring; unsigned char *rx_ring;
unsigned int cur_rx; /* RX buf index of next pkt */ unsigned int cur_rx; /* RX buf index of next pkt */
@ -1711,7 +1710,7 @@ static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev)
dev_kfree_skb(skb); dev_kfree_skb(skb);
} else { } else {
dev_kfree_skb(skb); dev_kfree_skb(skb);
tp->stats.tx_dropped++; dev->stats.tx_dropped++;
return 0; return 0;
} }
@ -1762,27 +1761,27 @@ static void rtl8139_tx_interrupt (struct net_device *dev,
if (netif_msg_tx_err(tp)) if (netif_msg_tx_err(tp))
printk(KERN_DEBUG "%s: Transmit error, Tx status %8.8x.\n", printk(KERN_DEBUG "%s: Transmit error, Tx status %8.8x.\n",
dev->name, txstatus); dev->name, txstatus);
tp->stats.tx_errors++; dev->stats.tx_errors++;
if (txstatus & TxAborted) { if (txstatus & TxAborted) {
tp->stats.tx_aborted_errors++; dev->stats.tx_aborted_errors++;
RTL_W32 (TxConfig, TxClearAbt); RTL_W32 (TxConfig, TxClearAbt);
RTL_W16 (IntrStatus, TxErr); RTL_W16 (IntrStatus, TxErr);
wmb(); wmb();
} }
if (txstatus & TxCarrierLost) if (txstatus & TxCarrierLost)
tp->stats.tx_carrier_errors++; dev->stats.tx_carrier_errors++;
if (txstatus & TxOutOfWindow) if (txstatus & TxOutOfWindow)
tp->stats.tx_window_errors++; dev->stats.tx_window_errors++;
} else { } else {
if (txstatus & TxUnderrun) { if (txstatus & TxUnderrun) {
/* Add 64 to the Tx FIFO threshold. */ /* Add 64 to the Tx FIFO threshold. */
if (tp->tx_flag < 0x00300000) if (tp->tx_flag < 0x00300000)
tp->tx_flag += 0x00020000; tp->tx_flag += 0x00020000;
tp->stats.tx_fifo_errors++; dev->stats.tx_fifo_errors++;
} }
tp->stats.collisions += (txstatus >> 24) & 15; dev->stats.collisions += (txstatus >> 24) & 15;
tp->stats.tx_bytes += txstatus & 0x7ff; dev->stats.tx_bytes += txstatus & 0x7ff;
tp->stats.tx_packets++; dev->stats.tx_packets++;
} }
dirty_tx++; dirty_tx++;
@ -1818,7 +1817,7 @@ static void rtl8139_rx_err (u32 rx_status, struct net_device *dev,
if (netif_msg_rx_err (tp)) if (netif_msg_rx_err (tp))
printk(KERN_DEBUG "%s: Ethernet frame had errors, status %8.8x.\n", printk(KERN_DEBUG "%s: Ethernet frame had errors, status %8.8x.\n",
dev->name, rx_status); dev->name, rx_status);
tp->stats.rx_errors++; dev->stats.rx_errors++;
if (!(rx_status & RxStatusOK)) { if (!(rx_status & RxStatusOK)) {
if (rx_status & RxTooLong) { if (rx_status & RxTooLong) {
DPRINTK ("%s: Oversized Ethernet frame, status %4.4x!\n", DPRINTK ("%s: Oversized Ethernet frame, status %4.4x!\n",
@ -1826,11 +1825,11 @@ static void rtl8139_rx_err (u32 rx_status, struct net_device *dev,
/* A.C.: The chip hangs here. */ /* A.C.: The chip hangs here. */
} }
if (rx_status & (RxBadSymbol | RxBadAlign)) if (rx_status & (RxBadSymbol | RxBadAlign))
tp->stats.rx_frame_errors++; dev->stats.rx_frame_errors++;
if (rx_status & (RxRunt | RxTooLong)) if (rx_status & (RxRunt | RxTooLong))
tp->stats.rx_length_errors++; dev->stats.rx_length_errors++;
if (rx_status & RxCRCErr) if (rx_status & RxCRCErr)
tp->stats.rx_crc_errors++; dev->stats.rx_crc_errors++;
} else { } else {
tp->xstats.rx_lost_in_ring++; tp->xstats.rx_lost_in_ring++;
} }
@ -1913,9 +1912,9 @@ static void rtl8139_isr_ack(struct rtl8139_private *tp)
/* Clear out errors and receive interrupts */ /* Clear out errors and receive interrupts */
if (likely(status != 0)) { if (likely(status != 0)) {
if (unlikely(status & (RxFIFOOver | RxOverflow))) { if (unlikely(status & (RxFIFOOver | RxOverflow))) {
tp->stats.rx_errors++; tp->dev->stats.rx_errors++;
if (status & RxFIFOOver) if (status & RxFIFOOver)
tp->stats.rx_fifo_errors++; tp->dev->stats.rx_fifo_errors++;
} }
RTL_W16_F (IntrStatus, RxAckBits); RTL_W16_F (IntrStatus, RxAckBits);
} }
@ -2016,8 +2015,8 @@ no_early_rx:
skb->protocol = eth_type_trans (skb, dev); skb->protocol = eth_type_trans (skb, dev);
dev->last_rx = jiffies; dev->last_rx = jiffies;
tp->stats.rx_bytes += pkt_size; dev->stats.rx_bytes += pkt_size;
tp->stats.rx_packets++; dev->stats.rx_packets++;
netif_receive_skb (skb); netif_receive_skb (skb);
} else { } else {
@ -2025,7 +2024,7 @@ no_early_rx:
printk (KERN_WARNING printk (KERN_WARNING
"%s: Memory squeeze, dropping packet.\n", "%s: Memory squeeze, dropping packet.\n",
dev->name); dev->name);
tp->stats.rx_dropped++; dev->stats.rx_dropped++;
} }
received++; received++;
@ -2072,7 +2071,7 @@ static void rtl8139_weird_interrupt (struct net_device *dev,
assert (ioaddr != NULL); assert (ioaddr != NULL);
/* Update the error count. */ /* Update the error count. */
tp->stats.rx_missed_errors += RTL_R32 (RxMissed); dev->stats.rx_missed_errors += RTL_R32 (RxMissed);
RTL_W32 (RxMissed, 0); RTL_W32 (RxMissed, 0);
if ((status & RxUnderrun) && link_changed && if ((status & RxUnderrun) && link_changed &&
@ -2082,12 +2081,12 @@ static void rtl8139_weird_interrupt (struct net_device *dev,
} }
if (status & (RxUnderrun | RxErr)) if (status & (RxUnderrun | RxErr))
tp->stats.rx_errors++; dev->stats.rx_errors++;
if (status & PCSTimeout) if (status & PCSTimeout)
tp->stats.rx_length_errors++; dev->stats.rx_length_errors++;
if (status & RxUnderrun) if (status & RxUnderrun)
tp->stats.rx_fifo_errors++; dev->stats.rx_fifo_errors++;
if (status & PCIErr) { if (status & PCIErr) {
u16 pci_cmd_status; u16 pci_cmd_status;
pci_read_config_word (tp->pci_dev, PCI_STATUS, &pci_cmd_status); pci_read_config_word (tp->pci_dev, PCI_STATUS, &pci_cmd_status);
@ -2227,7 +2226,7 @@ static int rtl8139_close (struct net_device *dev)
RTL_W16 (IntrMask, 0); RTL_W16 (IntrMask, 0);
/* Update the error counts. */ /* Update the error counts. */
tp->stats.rx_missed_errors += RTL_R32 (RxMissed); dev->stats.rx_missed_errors += RTL_R32 (RxMissed);
RTL_W32 (RxMissed, 0); RTL_W32 (RxMissed, 0);
spin_unlock_irqrestore (&tp->lock, flags); spin_unlock_irqrestore (&tp->lock, flags);
@ -2472,12 +2471,12 @@ static struct net_device_stats *rtl8139_get_stats (struct net_device *dev)
if (netif_running(dev)) { if (netif_running(dev)) {
spin_lock_irqsave (&tp->lock, flags); spin_lock_irqsave (&tp->lock, flags);
tp->stats.rx_missed_errors += RTL_R32 (RxMissed); dev->stats.rx_missed_errors += RTL_R32 (RxMissed);
RTL_W32 (RxMissed, 0); RTL_W32 (RxMissed, 0);
spin_unlock_irqrestore (&tp->lock, flags); spin_unlock_irqrestore (&tp->lock, flags);
} }
return &tp->stats; return &dev->stats;
} }
/* Set or clear the multicast filter for this adaptor. /* Set or clear the multicast filter for this adaptor.
@ -2561,7 +2560,7 @@ static int rtl8139_suspend (struct pci_dev *pdev, pm_message_t state)
RTL_W8 (ChipCmd, 0); RTL_W8 (ChipCmd, 0);
/* Update the error counts. */ /* Update the error counts. */
tp->stats.rx_missed_errors += RTL_R32 (RxMissed); dev->stats.rx_missed_errors += RTL_R32 (RxMissed);
RTL_W32 (RxMissed, 0); RTL_W32 (RxMissed, 0);
spin_unlock_irqrestore (&tp->lock, flags); spin_unlock_irqrestore (&tp->lock, flags);