diff options
Diffstat (limited to 'drivers/net/8139too.c')
| -rw-r--r-- | drivers/net/8139too.c | 66 |
1 files changed, 32 insertions, 34 deletions
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c index 53bd903d2321..75317a14ad1c 100644 --- a/drivers/net/8139too.c +++ b/drivers/net/8139too.c | |||
| @@ -107,8 +107,8 @@ | |||
| 107 | #include <linux/mii.h> | 107 | #include <linux/mii.h> |
| 108 | #include <linux/completion.h> | 108 | #include <linux/completion.h> |
| 109 | #include <linux/crc32.h> | 109 | #include <linux/crc32.h> |
| 110 | #include <asm/io.h> | 110 | #include <linux/io.h> |
| 111 | #include <asm/uaccess.h> | 111 | #include <linux/uaccess.h> |
| 112 | #include <asm/irq.h> | 112 | #include <asm/irq.h> |
| 113 | 113 | ||
| 114 | #define RTL8139_DRIVER_NAME DRV_NAME " Fast Ethernet driver " DRV_VERSION | 114 | #define RTL8139_DRIVER_NAME DRV_NAME " Fast Ethernet driver " DRV_VERSION |
| @@ -134,7 +134,7 @@ | |||
| 134 | 134 | ||
| 135 | #if RTL8139_DEBUG | 135 | #if RTL8139_DEBUG |
| 136 | /* note: prints function name for you */ | 136 | /* note: prints function name for you */ |
| 137 | # define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args) | 137 | # define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __func__ , ## args) |
| 138 | #else | 138 | #else |
| 139 | # define DPRINTK(fmt, args...) | 139 | # define DPRINTK(fmt, args...) |
| 140 | #endif | 140 | #endif |
| @@ -145,7 +145,7 @@ | |||
| 145 | # define assert(expr) \ | 145 | # define assert(expr) \ |
| 146 | if(unlikely(!(expr))) { \ | 146 | if(unlikely(!(expr))) { \ |
| 147 | printk(KERN_ERR "Assertion failed! %s,%s,%s,line=%d\n", \ | 147 | printk(KERN_ERR "Assertion failed! %s,%s,%s,line=%d\n", \ |
| 148 | #expr,__FILE__,__FUNCTION__,__LINE__); \ | 148 | #expr, __FILE__, __func__, __LINE__); \ |
| 149 | } | 149 | } |
| 150 | #endif | 150 | #endif |
| 151 | 151 | ||
| @@ -219,7 +219,7 @@ enum { | |||
| 219 | #define RTL8139B_IO_SIZE 256 | 219 | #define RTL8139B_IO_SIZE 256 |
| 220 | 220 | ||
| 221 | #define RTL8129_CAPS HAS_MII_XCVR | 221 | #define RTL8129_CAPS HAS_MII_XCVR |
| 222 | #define RTL8139_CAPS HAS_CHIP_XCVR|HAS_LNK_CHNG | 222 | #define RTL8139_CAPS (HAS_CHIP_XCVR|HAS_LNK_CHNG) |
| 223 | 223 | ||
| 224 | typedef enum { | 224 | typedef enum { |
| 225 | RTL8139 = 0, | 225 | RTL8139 = 0, |
| @@ -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 | } |
| @@ -1890,7 +1889,7 @@ static void rtl8139_rx_err (u32 rx_status, struct net_device *dev, | |||
| 1890 | } | 1889 | } |
| 1891 | 1890 | ||
| 1892 | #if RX_BUF_IDX == 3 | 1891 | #if RX_BUF_IDX == 3 |
| 1893 | static __inline__ void wrap_copy(struct sk_buff *skb, const unsigned char *ring, | 1892 | static inline void wrap_copy(struct sk_buff *skb, const unsigned char *ring, |
| 1894 | u32 offset, unsigned int size) | 1893 | u32 offset, unsigned int size) |
| 1895 | { | 1894 | { |
| 1896 | u32 left = RX_BUF_LEN - offset; | 1895 | u32 left = RX_BUF_LEN - offset; |
| @@ -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,12 +2226,11 @@ 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); |
| 2234 | 2233 | ||
| 2235 | synchronize_irq (dev->irq); /* racy, but that's ok here */ | ||
| 2236 | free_irq (dev->irq, dev); | 2234 | free_irq (dev->irq, dev); |
| 2237 | 2235 | ||
| 2238 | rtl8139_tx_clear (tp); | 2236 | rtl8139_tx_clear (tp); |
| @@ -2472,12 +2470,12 @@ static struct net_device_stats *rtl8139_get_stats (struct net_device *dev) | |||
| 2472 | 2470 | ||
| 2473 | if (netif_running(dev)) { | 2471 | if (netif_running(dev)) { |
| 2474 | spin_lock_irqsave (&tp->lock, flags); | 2472 | spin_lock_irqsave (&tp->lock, flags); |
| 2475 | tp->stats.rx_missed_errors += RTL_R32 (RxMissed); | 2473 | dev->stats.rx_missed_errors += RTL_R32 (RxMissed); |
| 2476 | RTL_W32 (RxMissed, 0); | 2474 | RTL_W32 (RxMissed, 0); |
| 2477 | spin_unlock_irqrestore (&tp->lock, flags); | 2475 | spin_unlock_irqrestore (&tp->lock, flags); |
| 2478 | } | 2476 | } |
| 2479 | 2477 | ||
| 2480 | return &tp->stats; | 2478 | return &dev->stats; |
| 2481 | } | 2479 | } |
| 2482 | 2480 | ||
| 2483 | /* Set or clear the multicast filter for this adaptor. | 2481 | /* Set or clear the multicast filter for this adaptor. |
| @@ -2561,7 +2559,7 @@ static int rtl8139_suspend (struct pci_dev *pdev, pm_message_t state) | |||
| 2561 | RTL_W8 (ChipCmd, 0); | 2559 | RTL_W8 (ChipCmd, 0); |
| 2562 | 2560 | ||
| 2563 | /* Update the error counts. */ | 2561 | /* Update the error counts. */ |
| 2564 | tp->stats.rx_missed_errors += RTL_R32 (RxMissed); | 2562 | dev->stats.rx_missed_errors += RTL_R32 (RxMissed); |
| 2565 | RTL_W32 (RxMissed, 0); | 2563 | RTL_W32 (RxMissed, 0); |
| 2566 | 2564 | ||
| 2567 | spin_unlock_irqrestore (&tp->lock, flags); | 2565 | spin_unlock_irqrestore (&tp->lock, flags); |
