aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorPaulius Zaleckas <paulius.zaleckas@teltonika.lt>2008-05-05 09:24:21 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-05-13 01:35:24 -0400
commite1eac92e4cea32b5254d0b835de16d11e589502c (patch)
treeb65a531933318e21a6600a5a3744fce4b1fdf3a6 /drivers/net
parent237225f70f159b607382b5ffcd86f36fc8915cfd (diff)
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>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/8139too.c53
1 files changed, 26 insertions, 27 deletions
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index 53bd903d2321..b23a00c5b84f 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -574,7 +574,6 @@ struct rtl8139_private {
574 u32 msg_enable; 574 u32 msg_enable;
575 struct napi_struct napi; 575 struct napi_struct napi;
576 struct net_device *dev; 576 struct net_device *dev;
577 struct net_device_stats stats;
578 577
579 unsigned char *rx_ring; 578 unsigned char *rx_ring;
580 unsigned int cur_rx; /* RX buf index of next pkt */ 579 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)
1711 dev_kfree_skb(skb); 1710 dev_kfree_skb(skb);
1712 } else { 1711 } else {
1713 dev_kfree_skb(skb); 1712 dev_kfree_skb(skb);
1714 tp->stats.tx_dropped++; 1713 dev->stats.tx_dropped++;
1715 return 0; 1714 return 0;
1716 } 1715 }
1717 1716
@@ -1762,27 +1761,27 @@ static void rtl8139_tx_interrupt (struct net_device *dev,
1762 if (netif_msg_tx_err(tp)) 1761 if (netif_msg_tx_err(tp))
1763 printk(KERN_DEBUG "%s: Transmit error, Tx status %8.8x.\n", 1762 printk(KERN_DEBUG "%s: Transmit error, Tx status %8.8x.\n",
1764 dev->name, txstatus); 1763 dev->name, txstatus);
1765 tp->stats.tx_errors++; 1764 dev->stats.tx_errors++;
1766 if (txstatus & TxAborted) { 1765 if (txstatus & TxAborted) {
1767 tp->stats.tx_aborted_errors++; 1766 dev->stats.tx_aborted_errors++;
1768 RTL_W32 (TxConfig, TxClearAbt); 1767 RTL_W32 (TxConfig, TxClearAbt);
1769 RTL_W16 (IntrStatus, TxErr); 1768 RTL_W16 (IntrStatus, TxErr);
1770 wmb(); 1769 wmb();
1771 } 1770 }
1772 if (txstatus & TxCarrierLost) 1771 if (txstatus & TxCarrierLost)
1773 tp->stats.tx_carrier_errors++; 1772 dev->stats.tx_carrier_errors++;
1774 if (txstatus & TxOutOfWindow) 1773 if (txstatus & TxOutOfWindow)
1775 tp->stats.tx_window_errors++; 1774 dev->stats.tx_window_errors++;
1776 } else { 1775 } else {
1777 if (txstatus & TxUnderrun) { 1776 if (txstatus & TxUnderrun) {
1778 /* Add 64 to the Tx FIFO threshold. */ 1777 /* Add 64 to the Tx FIFO threshold. */
1779 if (tp->tx_flag < 0x00300000) 1778 if (tp->tx_flag < 0x00300000)
1780 tp->tx_flag += 0x00020000; 1779 tp->tx_flag += 0x00020000;
1781 tp->stats.tx_fifo_errors++; 1780 dev->stats.tx_fifo_errors++;
1782 } 1781 }
1783 tp->stats.collisions += (txstatus >> 24) & 15; 1782 dev->stats.collisions += (txstatus >> 24) & 15;
1784 tp->stats.tx_bytes += txstatus & 0x7ff; 1783 dev->stats.tx_bytes += txstatus & 0x7ff;
1785 tp->stats.tx_packets++; 1784 dev->stats.tx_packets++;
1786 } 1785 }
1787 1786
1788 dirty_tx++; 1787 dirty_tx++;
@@ -1818,7 +1817,7 @@ static void rtl8139_rx_err (u32 rx_status, struct net_device *dev,
1818 if (netif_msg_rx_err (tp)) 1817 if (netif_msg_rx_err (tp))
1819 printk(KERN_DEBUG "%s: Ethernet frame had errors, status %8.8x.\n", 1818 printk(KERN_DEBUG "%s: Ethernet frame had errors, status %8.8x.\n",
1820 dev->name, rx_status); 1819 dev->name, rx_status);
1821 tp->stats.rx_errors++; 1820 dev->stats.rx_errors++;
1822 if (!(rx_status & RxStatusOK)) { 1821 if (!(rx_status & RxStatusOK)) {
1823 if (rx_status & RxTooLong) { 1822 if (rx_status & RxTooLong) {
1824 DPRINTK ("%s: Oversized Ethernet frame, status %4.4x!\n", 1823 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,
1826 /* A.C.: The chip hangs here. */ 1825 /* A.C.: The chip hangs here. */
1827 } 1826 }
1828 if (rx_status & (RxBadSymbol | RxBadAlign)) 1827 if (rx_status & (RxBadSymbol | RxBadAlign))
1829 tp->stats.rx_frame_errors++; 1828 dev->stats.rx_frame_errors++;
1830 if (rx_status & (RxRunt | RxTooLong)) 1829 if (rx_status & (RxRunt | RxTooLong))
1831 tp->stats.rx_length_errors++; 1830 dev->stats.rx_length_errors++;
1832 if (rx_status & RxCRCErr) 1831 if (rx_status & RxCRCErr)
1833 tp->stats.rx_crc_errors++; 1832 dev->stats.rx_crc_errors++;
1834 } else { 1833 } else {
1835 tp->xstats.rx_lost_in_ring++; 1834 tp->xstats.rx_lost_in_ring++;
1836 } 1835 }
@@ -1913,9 +1912,9 @@ static void rtl8139_isr_ack(struct rtl8139_private *tp)
1913 /* Clear out errors and receive interrupts */ 1912 /* Clear out errors and receive interrupts */
1914 if (likely(status != 0)) { 1913 if (likely(status != 0)) {
1915 if (unlikely(status & (RxFIFOOver | RxOverflow))) { 1914 if (unlikely(status & (RxFIFOOver | RxOverflow))) {
1916 tp->stats.rx_errors++; 1915 tp->dev->stats.rx_errors++;
1917 if (status & RxFIFOOver) 1916 if (status & RxFIFOOver)
1918 tp->stats.rx_fifo_errors++; 1917 tp->dev->stats.rx_fifo_errors++;
1919 } 1918 }
1920 RTL_W16_F (IntrStatus, RxAckBits); 1919 RTL_W16_F (IntrStatus, RxAckBits);
1921 } 1920 }
@@ -2016,8 +2015,8 @@ no_early_rx:
2016 skb->protocol = eth_type_trans (skb, dev); 2015 skb->protocol = eth_type_trans (skb, dev);
2017 2016
2018 dev->last_rx = jiffies; 2017 dev->last_rx = jiffies;
2019 tp->stats.rx_bytes += pkt_size; 2018 dev->stats.rx_bytes += pkt_size;
2020 tp->stats.rx_packets++; 2019 dev->stats.rx_packets++;
2021 2020
2022 netif_receive_skb (skb); 2021 netif_receive_skb (skb);
2023 } else { 2022 } else {
@@ -2025,7 +2024,7 @@ no_early_rx:
2025 printk (KERN_WARNING 2024 printk (KERN_WARNING
2026 "%s: Memory squeeze, dropping packet.\n", 2025 "%s: Memory squeeze, dropping packet.\n",
2027 dev->name); 2026 dev->name);
2028 tp->stats.rx_dropped++; 2027 dev->stats.rx_dropped++;
2029 } 2028 }
2030 received++; 2029 received++;
2031 2030
@@ -2072,7 +2071,7 @@ static void rtl8139_weird_interrupt (struct net_device *dev,
2072 assert (ioaddr != NULL); 2071 assert (ioaddr != NULL);
2073 2072
2074 /* Update the error count. */ 2073 /* Update the error count. */
2075 tp->stats.rx_missed_errors += RTL_R32 (RxMissed); 2074 dev->stats.rx_missed_errors += RTL_R32 (RxMissed);
2076 RTL_W32 (RxMissed, 0); 2075 RTL_W32 (RxMissed, 0);
2077 2076
2078 if ((status & RxUnderrun) && link_changed && 2077 if ((status & RxUnderrun) && link_changed &&
@@ -2082,12 +2081,12 @@ static void rtl8139_weird_interrupt (struct net_device *dev,
2082 } 2081 }
2083 2082
2084 if (status & (RxUnderrun | RxErr)) 2083 if (status & (RxUnderrun | RxErr))
2085 tp->stats.rx_errors++; 2084 dev->stats.rx_errors++;
2086 2085
2087 if (status & PCSTimeout) 2086 if (status & PCSTimeout)
2088 tp->stats.rx_length_errors++; 2087 dev->stats.rx_length_errors++;
2089 if (status & RxUnderrun) 2088 if (status & RxUnderrun)
2090 tp->stats.rx_fifo_errors++; 2089 dev->stats.rx_fifo_errors++;
2091 if (status & PCIErr) { 2090 if (status & PCIErr) {
2092 u16 pci_cmd_status; 2091 u16 pci_cmd_status;
2093 pci_read_config_word (tp->pci_dev, PCI_STATUS, &pci_cmd_status); 2092 pci_read_config_word (tp->pci_dev, PCI_STATUS, &pci_cmd_status);
@@ -2227,7 +2226,7 @@ static int rtl8139_close (struct net_device *dev)
2227 RTL_W16 (IntrMask, 0); 2226 RTL_W16 (IntrMask, 0);
2228 2227
2229 /* Update the error counts. */ 2228 /* Update the error counts. */
2230 tp->stats.rx_missed_errors += RTL_R32 (RxMissed); 2229 dev->stats.rx_missed_errors += RTL_R32 (RxMissed);
2231 RTL_W32 (RxMissed, 0); 2230 RTL_W32 (RxMissed, 0);
2232 2231
2233 spin_unlock_irqrestore (&tp->lock, flags); 2232 spin_unlock_irqrestore (&tp->lock, flags);
@@ -2472,12 +2471,12 @@ static struct net_device_stats *rtl8139_get_stats (struct net_device *dev)
2472 2471
2473 if (netif_running(dev)) { 2472 if (netif_running(dev)) {
2474 spin_lock_irqsave (&tp->lock, flags); 2473 spin_lock_irqsave (&tp->lock, flags);
2475 tp->stats.rx_missed_errors += RTL_R32 (RxMissed); 2474 dev->stats.rx_missed_errors += RTL_R32 (RxMissed);
2476 RTL_W32 (RxMissed, 0); 2475 RTL_W32 (RxMissed, 0);
2477 spin_unlock_irqrestore (&tp->lock, flags); 2476 spin_unlock_irqrestore (&tp->lock, flags);
2478 } 2477 }
2479 2478
2480 return &tp->stats; 2479 return &dev->stats;
2481} 2480}
2482 2481
2483/* Set or clear the multicast filter for this adaptor. 2482/* 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)
2561 RTL_W8 (ChipCmd, 0); 2560 RTL_W8 (ChipCmd, 0);
2562 2561
2563 /* Update the error counts. */ 2562 /* Update the error counts. */
2564 tp->stats.rx_missed_errors += RTL_R32 (RxMissed); 2563 dev->stats.rx_missed_errors += RTL_R32 (RxMissed);
2565 RTL_W32 (RxMissed, 0); 2564 RTL_W32 (RxMissed, 0);
2566 2565
2567 spin_unlock_irqrestore (&tp->lock, flags); 2566 spin_unlock_irqrestore (&tp->lock, flags);