aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/char/pcmcia/synclink_cs.c28
-rw-r--r--drivers/char/synclink.c33
-rw-r--r--drivers/char/synclink_gt.c28
-rw-r--r--drivers/char/synclinkmp.c31
-rw-r--r--drivers/net/3c503.c14
-rw-r--r--drivers/net/8390.h18
-rw-r--r--drivers/net/8390p.c66
-rw-r--r--drivers/net/Kconfig16
-rw-r--r--drivers/net/Makefile10
-rw-r--r--drivers/net/hp.c14
-rw-r--r--drivers/net/igb/e1000_82575.c240
-rw-r--r--drivers/net/igb/e1000_82575.h8
-rw-r--r--drivers/net/igb/e1000_defines.h28
-rw-r--r--drivers/net/igb/e1000_hw.h8
-rw-r--r--drivers/net/igb/e1000_mac.c141
-rw-r--r--drivers/net/igb/e1000_nvm.c52
-rw-r--r--drivers/net/igb/e1000_phy.c138
-rw-r--r--drivers/net/igb/igb.h2
-rw-r--r--drivers/net/igb/igb_main.c243
-rw-r--r--drivers/net/ipg.c105
-rw-r--r--drivers/net/ipg.h83
-rw-r--r--drivers/net/ne.c14
-rw-r--r--drivers/net/ne2.c16
-rw-r--r--drivers/net/r8169.c145
-rw-r--r--drivers/net/wan/c101.c6
-rw-r--r--drivers/net/wan/dscc4.c22
-rw-r--r--drivers/net/wan/farsync.c70
-rw-r--r--drivers/net/wan/hd6457x.c33
-rw-r--r--drivers/net/wan/hdlc.c2
-rw-r--r--drivers/net/wan/hdlc_cisco.c4
-rw-r--r--drivers/net/wan/hdlc_fr.c54
-rw-r--r--drivers/net/wan/hdlc_raw_eth.c2
-rw-r--r--drivers/net/wan/hdlc_x25.c6
-rw-r--r--drivers/net/wan/pc300_drv.c71
-rw-r--r--drivers/net/wan/pc300_tty.c6
-rw-r--r--drivers/net/wan/wanxl.c26
-rw-r--r--include/linux/hdlc.h7
37 files changed, 846 insertions, 944 deletions
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index 1dd0e992c83d..fb2fb159faa3 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -3886,9 +3886,8 @@ static bool rx_get_frame(MGSLPC_INFO *info)
3886 framesize = 0; 3886 framesize = 0;
3887#if SYNCLINK_GENERIC_HDLC 3887#if SYNCLINK_GENERIC_HDLC
3888 { 3888 {
3889 struct net_device_stats *stats = hdlc_stats(info->netdev); 3889 info->netdev->stats.rx_errors++;
3890 stats->rx_errors++; 3890 info->netdev->stats.rx_frame_errors++;
3891 stats->rx_frame_errors++;
3892 } 3891 }
3893#endif 3892#endif
3894 } else 3893 } else
@@ -4144,7 +4143,6 @@ static int hdlcdev_attach(struct net_device *dev, unsigned short encoding,
4144static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev) 4143static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev)
4145{ 4144{
4146 MGSLPC_INFO *info = dev_to_port(dev); 4145 MGSLPC_INFO *info = dev_to_port(dev);
4147 struct net_device_stats *stats = hdlc_stats(dev);
4148 unsigned long flags; 4146 unsigned long flags;
4149 4147
4150 if (debug_level >= DEBUG_LEVEL_INFO) 4148 if (debug_level >= DEBUG_LEVEL_INFO)
@@ -4159,8 +4157,8 @@ static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev)
4159 info->tx_put = info->tx_count = skb->len; 4157 info->tx_put = info->tx_count = skb->len;
4160 4158
4161 /* update network statistics */ 4159 /* update network statistics */
4162 stats->tx_packets++; 4160 dev->stats.tx_packets++;
4163 stats->tx_bytes += skb->len; 4161 dev->stats.tx_bytes += skb->len;
4164 4162
4165 /* done with socket buffer, so free it */ 4163 /* done with socket buffer, so free it */
4166 dev_kfree_skb(skb); 4164 dev_kfree_skb(skb);
@@ -4376,14 +4374,13 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
4376static void hdlcdev_tx_timeout(struct net_device *dev) 4374static void hdlcdev_tx_timeout(struct net_device *dev)
4377{ 4375{
4378 MGSLPC_INFO *info = dev_to_port(dev); 4376 MGSLPC_INFO *info = dev_to_port(dev);
4379 struct net_device_stats *stats = hdlc_stats(dev);
4380 unsigned long flags; 4377 unsigned long flags;
4381 4378
4382 if (debug_level >= DEBUG_LEVEL_INFO) 4379 if (debug_level >= DEBUG_LEVEL_INFO)
4383 printk("hdlcdev_tx_timeout(%s)\n",dev->name); 4380 printk("hdlcdev_tx_timeout(%s)\n",dev->name);
4384 4381
4385 stats->tx_errors++; 4382 dev->stats.tx_errors++;
4386 stats->tx_aborted_errors++; 4383 dev->stats.tx_aborted_errors++;
4387 4384
4388 spin_lock_irqsave(&info->lock,flags); 4385 spin_lock_irqsave(&info->lock,flags);
4389 tx_stop(info); 4386 tx_stop(info);
@@ -4416,27 +4413,26 @@ static void hdlcdev_rx(MGSLPC_INFO *info, char *buf, int size)
4416{ 4413{
4417 struct sk_buff *skb = dev_alloc_skb(size); 4414 struct sk_buff *skb = dev_alloc_skb(size);
4418 struct net_device *dev = info->netdev; 4415 struct net_device *dev = info->netdev;
4419 struct net_device_stats *stats = hdlc_stats(dev);
4420 4416
4421 if (debug_level >= DEBUG_LEVEL_INFO) 4417 if (debug_level >= DEBUG_LEVEL_INFO)
4422 printk("hdlcdev_rx(%s)\n",dev->name); 4418 printk("hdlcdev_rx(%s)\n",dev->name);
4423 4419
4424 if (skb == NULL) { 4420 if (skb == NULL) {
4425 printk(KERN_NOTICE "%s: can't alloc skb, dropping packet\n", dev->name); 4421 printk(KERN_NOTICE "%s: can't alloc skb, dropping packet\n", dev->name);
4426 stats->rx_dropped++; 4422 dev->stats.rx_dropped++;
4427 return; 4423 return;
4428 } 4424 }
4429 4425
4430 memcpy(skb_put(skb, size),buf,size); 4426 memcpy(skb_put(skb, size), buf, size);
4431 4427
4432 skb->protocol = hdlc_type_trans(skb, info->netdev); 4428 skb->protocol = hdlc_type_trans(skb, dev);
4433 4429
4434 stats->rx_packets++; 4430 dev->stats.rx_packets++;
4435 stats->rx_bytes += size; 4431 dev->stats.rx_bytes += size;
4436 4432
4437 netif_rx(skb); 4433 netif_rx(skb);
4438 4434
4439 info->netdev->last_rx = jiffies; 4435 dev->last_rx = jiffies;
4440} 4436}
4441 4437
4442/** 4438/**
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index ac5080df2565..9d247d8a87a3 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -6640,9 +6640,8 @@ static bool mgsl_get_rx_frame(struct mgsl_struct *info)
6640 framesize = 0; 6640 framesize = 0;
6641#if SYNCLINK_GENERIC_HDLC 6641#if SYNCLINK_GENERIC_HDLC
6642 { 6642 {
6643 struct net_device_stats *stats = hdlc_stats(info->netdev); 6643 info->netdev->stats.rx_errors++;
6644 stats->rx_errors++; 6644 info->netdev->stats.rx_frame_errors++;
6645 stats->rx_frame_errors++;
6646 } 6645 }
6647#endif 6646#endif
6648 } else 6647 } else
@@ -7753,7 +7752,6 @@ static int hdlcdev_attach(struct net_device *dev, unsigned short encoding,
7753static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev) 7752static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev)
7754{ 7753{
7755 struct mgsl_struct *info = dev_to_port(dev); 7754 struct mgsl_struct *info = dev_to_port(dev);
7756 struct net_device_stats *stats = hdlc_stats(dev);
7757 unsigned long flags; 7755 unsigned long flags;
7758 7756
7759 if (debug_level >= DEBUG_LEVEL_INFO) 7757 if (debug_level >= DEBUG_LEVEL_INFO)
@@ -7767,8 +7765,8 @@ static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev)
7767 mgsl_load_tx_dma_buffer(info, skb->data, skb->len); 7765 mgsl_load_tx_dma_buffer(info, skb->data, skb->len);
7768 7766
7769 /* update network statistics */ 7767 /* update network statistics */
7770 stats->tx_packets++; 7768 dev->stats.tx_packets++;
7771 stats->tx_bytes += skb->len; 7769 dev->stats.tx_bytes += skb->len;
7772 7770
7773 /* done with socket buffer, so free it */ 7771 /* done with socket buffer, so free it */
7774 dev_kfree_skb(skb); 7772 dev_kfree_skb(skb);
@@ -7984,14 +7982,13 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
7984static void hdlcdev_tx_timeout(struct net_device *dev) 7982static void hdlcdev_tx_timeout(struct net_device *dev)
7985{ 7983{
7986 struct mgsl_struct *info = dev_to_port(dev); 7984 struct mgsl_struct *info = dev_to_port(dev);
7987 struct net_device_stats *stats = hdlc_stats(dev);
7988 unsigned long flags; 7985 unsigned long flags;
7989 7986
7990 if (debug_level >= DEBUG_LEVEL_INFO) 7987 if (debug_level >= DEBUG_LEVEL_INFO)
7991 printk("hdlcdev_tx_timeout(%s)\n",dev->name); 7988 printk("hdlcdev_tx_timeout(%s)\n",dev->name);
7992 7989
7993 stats->tx_errors++; 7990 dev->stats.tx_errors++;
7994 stats->tx_aborted_errors++; 7991 dev->stats.tx_aborted_errors++;
7995 7992
7996 spin_lock_irqsave(&info->irq_spinlock,flags); 7993 spin_lock_irqsave(&info->irq_spinlock,flags);
7997 usc_stop_transmitter(info); 7994 usc_stop_transmitter(info);
@@ -8024,27 +8021,27 @@ static void hdlcdev_rx(struct mgsl_struct *info, char *buf, int size)
8024{ 8021{
8025 struct sk_buff *skb = dev_alloc_skb(size); 8022 struct sk_buff *skb = dev_alloc_skb(size);
8026 struct net_device *dev = info->netdev; 8023 struct net_device *dev = info->netdev;
8027 struct net_device_stats *stats = hdlc_stats(dev);
8028 8024
8029 if (debug_level >= DEBUG_LEVEL_INFO) 8025 if (debug_level >= DEBUG_LEVEL_INFO)
8030 printk("hdlcdev_rx(%s)\n",dev->name); 8026 printk("hdlcdev_rx(%s)\n", dev->name);
8031 8027
8032 if (skb == NULL) { 8028 if (skb == NULL) {
8033 printk(KERN_NOTICE "%s: can't alloc skb, dropping packet\n", dev->name); 8029 printk(KERN_NOTICE "%s: can't alloc skb, dropping packet\n",
8034 stats->rx_dropped++; 8030 dev->name);
8031 dev->stats.rx_dropped++;
8035 return; 8032 return;
8036 } 8033 }
8037 8034
8038 memcpy(skb_put(skb, size),buf,size); 8035 memcpy(skb_put(skb, size), buf, size);
8039 8036
8040 skb->protocol = hdlc_type_trans(skb, info->netdev); 8037 skb->protocol = hdlc_type_trans(skb, dev);
8041 8038
8042 stats->rx_packets++; 8039 dev->stats.rx_packets++;
8043 stats->rx_bytes += size; 8040 dev->stats.rx_bytes += size;
8044 8041
8045 netif_rx(skb); 8042 netif_rx(skb);
8046 8043
8047 info->netdev->last_rx = jiffies; 8044 dev->last_rx = jiffies;
8048} 8045}
8049 8046
8050/** 8047/**
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
index 55c1653be00c..d88a607e34b7 100644
--- a/drivers/char/synclink_gt.c
+++ b/drivers/char/synclink_gt.c
@@ -1544,7 +1544,6 @@ static int hdlcdev_attach(struct net_device *dev, unsigned short encoding,
1544static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev) 1544static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev)
1545{ 1545{
1546 struct slgt_info *info = dev_to_port(dev); 1546 struct slgt_info *info = dev_to_port(dev);
1547 struct net_device_stats *stats = hdlc_stats(dev);
1548 unsigned long flags; 1547 unsigned long flags;
1549 1548
1550 DBGINFO(("%s hdlc_xmit\n", dev->name)); 1549 DBGINFO(("%s hdlc_xmit\n", dev->name));
@@ -1557,8 +1556,8 @@ static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev)
1557 tx_load(info, skb->data, skb->len); 1556 tx_load(info, skb->data, skb->len);
1558 1557
1559 /* update network statistics */ 1558 /* update network statistics */
1560 stats->tx_packets++; 1559 dev->stats.tx_packets++;
1561 stats->tx_bytes += skb->len; 1560 dev->stats.tx_bytes += skb->len;
1562 1561
1563 /* done with socket buffer, so free it */ 1562 /* done with socket buffer, so free it */
1564 dev_kfree_skb(skb); 1563 dev_kfree_skb(skb);
@@ -1775,13 +1774,12 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1775static void hdlcdev_tx_timeout(struct net_device *dev) 1774static void hdlcdev_tx_timeout(struct net_device *dev)
1776{ 1775{
1777 struct slgt_info *info = dev_to_port(dev); 1776 struct slgt_info *info = dev_to_port(dev);
1778 struct net_device_stats *stats = hdlc_stats(dev);
1779 unsigned long flags; 1777 unsigned long flags;
1780 1778
1781 DBGINFO(("%s hdlcdev_tx_timeout\n", dev->name)); 1779 DBGINFO(("%s hdlcdev_tx_timeout\n", dev->name));
1782 1780
1783 stats->tx_errors++; 1781 dev->stats.tx_errors++;
1784 stats->tx_aborted_errors++; 1782 dev->stats.tx_aborted_errors++;
1785 1783
1786 spin_lock_irqsave(&info->lock,flags); 1784 spin_lock_irqsave(&info->lock,flags);
1787 tx_stop(info); 1785 tx_stop(info);
@@ -1814,26 +1812,25 @@ static void hdlcdev_rx(struct slgt_info *info, char *buf, int size)
1814{ 1812{
1815 struct sk_buff *skb = dev_alloc_skb(size); 1813 struct sk_buff *skb = dev_alloc_skb(size);
1816 struct net_device *dev = info->netdev; 1814 struct net_device *dev = info->netdev;
1817 struct net_device_stats *stats = hdlc_stats(dev);
1818 1815
1819 DBGINFO(("%s hdlcdev_rx\n", dev->name)); 1816 DBGINFO(("%s hdlcdev_rx\n", dev->name));
1820 1817
1821 if (skb == NULL) { 1818 if (skb == NULL) {
1822 DBGERR(("%s: can't alloc skb, drop packet\n", dev->name)); 1819 DBGERR(("%s: can't alloc skb, drop packet\n", dev->name));
1823 stats->rx_dropped++; 1820 dev->stats.rx_dropped++;
1824 return; 1821 return;
1825 } 1822 }
1826 1823
1827 memcpy(skb_put(skb, size),buf,size); 1824 memcpy(skb_put(skb, size), buf, size);
1828 1825
1829 skb->protocol = hdlc_type_trans(skb, info->netdev); 1826 skb->protocol = hdlc_type_trans(skb, dev);
1830 1827
1831 stats->rx_packets++; 1828 dev->stats.rx_packets++;
1832 stats->rx_bytes += size; 1829 dev->stats.rx_bytes += size;
1833 1830
1834 netif_rx(skb); 1831 netif_rx(skb);
1835 1832
1836 info->netdev->last_rx = jiffies; 1833 dev->last_rx = jiffies;
1837} 1834}
1838 1835
1839/** 1836/**
@@ -4577,9 +4574,8 @@ check_again:
4577 4574
4578#if SYNCLINK_GENERIC_HDLC 4575#if SYNCLINK_GENERIC_HDLC
4579 if (framesize == 0) { 4576 if (framesize == 0) {
4580 struct net_device_stats *stats = hdlc_stats(info->netdev); 4577 info->netdev->stats.rx_errors++;
4581 stats->rx_errors++; 4578 info->netdev->stats.rx_frame_errors++;
4582 stats->rx_frame_errors++;
4583 } 4579 }
4584#endif 4580#endif
4585 4581
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c
index bec54866e0bb..10241ed86100 100644
--- a/drivers/char/synclinkmp.c
+++ b/drivers/char/synclinkmp.c
@@ -1678,7 +1678,6 @@ static int hdlcdev_attach(struct net_device *dev, unsigned short encoding,
1678static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev) 1678static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev)
1679{ 1679{
1680 SLMP_INFO *info = dev_to_port(dev); 1680 SLMP_INFO *info = dev_to_port(dev);
1681 struct net_device_stats *stats = hdlc_stats(dev);
1682 unsigned long flags; 1681 unsigned long flags;
1683 1682
1684 if (debug_level >= DEBUG_LEVEL_INFO) 1683 if (debug_level >= DEBUG_LEVEL_INFO)
@@ -1692,8 +1691,8 @@ static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev)
1692 tx_load_dma_buffer(info, skb->data, skb->len); 1691 tx_load_dma_buffer(info, skb->data, skb->len);
1693 1692
1694 /* update network statistics */ 1693 /* update network statistics */
1695 stats->tx_packets++; 1694 dev->stats.tx_packets++;
1696 stats->tx_bytes += skb->len; 1695 dev->stats.tx_bytes += skb->len;
1697 1696
1698 /* done with socket buffer, so free it */ 1697 /* done with socket buffer, so free it */
1699 dev_kfree_skb(skb); 1698 dev_kfree_skb(skb);
@@ -1909,14 +1908,13 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1909static void hdlcdev_tx_timeout(struct net_device *dev) 1908static void hdlcdev_tx_timeout(struct net_device *dev)
1910{ 1909{
1911 SLMP_INFO *info = dev_to_port(dev); 1910 SLMP_INFO *info = dev_to_port(dev);
1912 struct net_device_stats *stats = hdlc_stats(dev);
1913 unsigned long flags; 1911 unsigned long flags;
1914 1912
1915 if (debug_level >= DEBUG_LEVEL_INFO) 1913 if (debug_level >= DEBUG_LEVEL_INFO)
1916 printk("hdlcdev_tx_timeout(%s)\n",dev->name); 1914 printk("hdlcdev_tx_timeout(%s)\n",dev->name);
1917 1915
1918 stats->tx_errors++; 1916 dev->stats.tx_errors++;
1919 stats->tx_aborted_errors++; 1917 dev->stats.tx_aborted_errors++;
1920 1918
1921 spin_lock_irqsave(&info->lock,flags); 1919 spin_lock_irqsave(&info->lock,flags);
1922 tx_stop(info); 1920 tx_stop(info);
@@ -1949,27 +1947,27 @@ static void hdlcdev_rx(SLMP_INFO *info, char *buf, int size)
1949{ 1947{
1950 struct sk_buff *skb = dev_alloc_skb(size); 1948 struct sk_buff *skb = dev_alloc_skb(size);
1951 struct net_device *dev = info->netdev; 1949 struct net_device *dev = info->netdev;
1952 struct net_device_stats *stats = hdlc_stats(dev);
1953 1950
1954 if (debug_level >= DEBUG_LEVEL_INFO) 1951 if (debug_level >= DEBUG_LEVEL_INFO)
1955 printk("hdlcdev_rx(%s)\n",dev->name); 1952 printk("hdlcdev_rx(%s)\n",dev->name);
1956 1953
1957 if (skb == NULL) { 1954 if (skb == NULL) {
1958 printk(KERN_NOTICE "%s: can't alloc skb, dropping packet\n", dev->name); 1955 printk(KERN_NOTICE "%s: can't alloc skb, dropping packet\n",
1959 stats->rx_dropped++; 1956 dev->name);
1957 dev->stats.rx_dropped++;
1960 return; 1958 return;
1961 } 1959 }
1962 1960
1963 memcpy(skb_put(skb, size),buf,size); 1961 memcpy(skb_put(skb, size), buf, size);
1964 1962
1965 skb->protocol = hdlc_type_trans(skb, info->netdev); 1963 skb->protocol = hdlc_type_trans(skb, dev);
1966 1964
1967 stats->rx_packets++; 1965 dev->stats.rx_packets++;
1968 stats->rx_bytes += size; 1966 dev->stats.rx_bytes += size;
1969 1967
1970 netif_rx(skb); 1968 netif_rx(skb);
1971 1969
1972 info->netdev->last_rx = jiffies; 1970 dev->last_rx = jiffies;
1973} 1971}
1974 1972
1975/** 1973/**
@@ -4983,9 +4981,8 @@ CheckAgain:
4983 framesize = 0; 4981 framesize = 0;
4984#if SYNCLINK_GENERIC_HDLC 4982#if SYNCLINK_GENERIC_HDLC
4985 { 4983 {
4986 struct net_device_stats *stats = hdlc_stats(info->netdev); 4984 info->netdev->stats.rx_errors++;
4987 stats->rx_errors++; 4985 info->netdev->stats.rx_frame_errors++;
4988 stats->rx_frame_errors++;
4989 } 4986 }
4990#endif 4987#endif
4991 } 4988 }
diff --git a/drivers/net/3c503.c b/drivers/net/3c503.c
index 9c23336750e2..900b0ffdcc68 100644
--- a/drivers/net/3c503.c
+++ b/drivers/net/3c503.c
@@ -149,7 +149,7 @@ el2_pio_probe(struct net_device *dev)
149#ifndef MODULE 149#ifndef MODULE
150struct net_device * __init el2_probe(int unit) 150struct net_device * __init el2_probe(int unit)
151{ 151{
152 struct net_device *dev = alloc_ei_netdev(); 152 struct net_device *dev = alloc_eip_netdev();
153 int err; 153 int err;
154 154
155 if (!dev) 155 if (!dev)
@@ -340,7 +340,7 @@ el2_probe1(struct net_device *dev, int ioaddr)
340 dev->stop = &el2_close; 340 dev->stop = &el2_close;
341 dev->ethtool_ops = &netdev_ethtool_ops; 341 dev->ethtool_ops = &netdev_ethtool_ops;
342#ifdef CONFIG_NET_POLL_CONTROLLER 342#ifdef CONFIG_NET_POLL_CONTROLLER
343 dev->poll_controller = ei_poll; 343 dev->poll_controller = eip_poll;
344#endif 344#endif
345 345
346 retval = register_netdev(dev); 346 retval = register_netdev(dev);
@@ -386,7 +386,7 @@ el2_open(struct net_device *dev)
386 outb_p(0x00, E33G_IDCFR); 386 outb_p(0x00, E33G_IDCFR);
387 if (*irqp == probe_irq_off(cookie) /* It's a good IRQ line! */ 387 if (*irqp == probe_irq_off(cookie) /* It's a good IRQ line! */
388 && ((retval = request_irq(dev->irq = *irqp, 388 && ((retval = request_irq(dev->irq = *irqp,
389 ei_interrupt, 0, dev->name, dev)) == 0)) 389 eip_interrupt, 0, dev->name, dev)) == 0))
390 break; 390 break;
391 } 391 }
392 } while (*++irqp); 392 } while (*++irqp);
@@ -395,13 +395,13 @@ el2_open(struct net_device *dev)
395 return retval; 395 return retval;
396 } 396 }
397 } else { 397 } else {
398 if ((retval = request_irq(dev->irq, ei_interrupt, 0, dev->name, dev))) { 398 if ((retval = request_irq(dev->irq, eip_interrupt, 0, dev->name, dev))) {
399 return retval; 399 return retval;
400 } 400 }
401 } 401 }
402 402
403 el2_init_card(dev); 403 el2_init_card(dev);
404 ei_open(dev); 404 eip_open(dev);
405 return 0; 405 return 0;
406} 406}
407 407
@@ -412,7 +412,7 @@ el2_close(struct net_device *dev)
412 dev->irq = ei_status.saved_irq; 412 dev->irq = ei_status.saved_irq;
413 outb(EGACFR_IRQOFF, E33G_GACFR); /* disable interrupts. */ 413 outb(EGACFR_IRQOFF, E33G_GACFR); /* disable interrupts. */
414 414
415 ei_close(dev); 415 eip_close(dev);
416 return 0; 416 return 0;
417} 417}
418 418
@@ -698,7 +698,7 @@ init_module(void)
698 if (this_dev != 0) break; /* only autoprobe 1st one */ 698 if (this_dev != 0) break; /* only autoprobe 1st one */
699 printk(KERN_NOTICE "3c503.c: Presently autoprobing (not recommended) for a single card.\n"); 699 printk(KERN_NOTICE "3c503.c: Presently autoprobing (not recommended) for a single card.\n");
700 } 700 }
701 dev = alloc_ei_netdev(); 701 dev = alloc_eip_netdev();
702 if (!dev) 702 if (!dev)
703 break; 703 break;
704 dev->irq = irq[this_dev]; 704 dev->irq = irq[this_dev];
diff --git a/drivers/net/8390.h b/drivers/net/8390.h
index cf020d45aea6..8e209f5e7c11 100644
--- a/drivers/net/8390.h
+++ b/drivers/net/8390.h
@@ -30,8 +30,10 @@ extern int ei_debug;
30 30
31#ifdef CONFIG_NET_POLL_CONTROLLER 31#ifdef CONFIG_NET_POLL_CONTROLLER
32extern void ei_poll(struct net_device *dev); 32extern void ei_poll(struct net_device *dev);
33extern void eip_poll(struct net_device *dev);
33#endif 34#endif
34 35
36/* Without I/O delay - non ISA or later chips */
35extern void NS8390_init(struct net_device *dev, int startp); 37extern void NS8390_init(struct net_device *dev, int startp);
36extern int ei_open(struct net_device *dev); 38extern int ei_open(struct net_device *dev);
37extern int ei_close(struct net_device *dev); 39extern int ei_close(struct net_device *dev);
@@ -42,6 +44,17 @@ static inline struct net_device *alloc_ei_netdev(void)
42 return __alloc_ei_netdev(0); 44 return __alloc_ei_netdev(0);
43} 45}
44 46
47/* With I/O delay form */
48extern void NS8390p_init(struct net_device *dev, int startp);
49extern int eip_open(struct net_device *dev);
50extern int eip_close(struct net_device *dev);
51extern irqreturn_t eip_interrupt(int irq, void *dev_id);
52extern struct net_device *__alloc_eip_netdev(int size);
53static inline struct net_device *alloc_eip_netdev(void)
54{
55 return __alloc_eip_netdev(0);
56}
57
45/* You have one of these per-board */ 58/* You have one of these per-board */
46struct ei_device { 59struct ei_device {
47 const char *name; 60 const char *name;
@@ -115,13 +128,14 @@ struct ei_device {
115/* 128/*
116 * Only generate indirect loads given a machine that needs them. 129 * Only generate indirect loads given a machine that needs them.
117 * - removed AMIGA_PCMCIA from this list, handled as ISA io now 130 * - removed AMIGA_PCMCIA from this list, handled as ISA io now
131 * - the _p for generates no delay by default 8390p.c overrides this.
118 */ 132 */
119 133
120#ifndef ei_inb 134#ifndef ei_inb
121#define ei_inb(_p) inb(_p) 135#define ei_inb(_p) inb(_p)
122#define ei_outb(_v,_p) outb(_v,_p) 136#define ei_outb(_v,_p) outb(_v,_p)
123#define ei_inb_p(_p) inb_p(_p) 137#define ei_inb_p(_p) inb(_p)
124#define ei_outb_p(_v,_p) outb_p(_v,_p) 138#define ei_outb_p(_v,_p) outb(_v,_p)
125#endif 139#endif
126 140
127#ifndef EI_SHIFT 141#ifndef EI_SHIFT
diff --git a/drivers/net/8390p.c b/drivers/net/8390p.c
new file mode 100644
index 000000000000..71f19884c4b1
--- /dev/null
+++ b/drivers/net/8390p.c
@@ -0,0 +1,66 @@
1/* 8390 core for ISA devices needing bus delays */
2
3static const char version[] =
4 "8390p.c:v1.10cvs 9/23/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n";
5
6#define ei_inb(_p) inb(_p)
7#define ei_outb(_v,_p) outb(_v,_p)
8#define ei_inb_p(_p) inb_p(_p)
9#define ei_outb_p(_v,_p) outb_p(_v,_p)
10
11#include "lib8390.c"
12
13int eip_open(struct net_device *dev)
14{
15 return __ei_open(dev);
16}
17
18int eip_close(struct net_device *dev)
19{
20 return __ei_close(dev);
21}
22
23irqreturn_t eip_interrupt(int irq, void *dev_id)
24{
25 return __ei_interrupt(irq, dev_id);
26}
27
28#ifdef CONFIG_NET_POLL_CONTROLLER
29void eip_poll(struct net_device *dev)
30{
31 __ei_poll(dev);
32}
33#endif
34
35struct net_device *__alloc_eip_netdev(int size)
36{
37 return ____alloc_ei_netdev(size);
38}
39
40void NS8390p_init(struct net_device *dev, int startp)
41{
42 return __NS8390_init(dev, startp);
43}
44
45EXPORT_SYMBOL(eip_open);
46EXPORT_SYMBOL(eip_close);
47EXPORT_SYMBOL(eip_interrupt);
48#ifdef CONFIG_NET_POLL_CONTROLLER
49EXPORT_SYMBOL(eip_poll);
50#endif
51EXPORT_SYMBOL(NS8390p_init);
52EXPORT_SYMBOL(__alloc_eip_netdev);
53
54#if defined(MODULE)
55
56int init_module(void)
57{
58 return 0;
59}
60
61void cleanup_module(void)
62{
63}
64
65#endif /* MODULE */
66MODULE_LICENSE("GPL");
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index d85b9d067597..84925915dce4 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2122,27 +2122,13 @@ config R8169
2122 To compile this driver as a module, choose M here: the module 2122 To compile this driver as a module, choose M here: the module
2123 will be called r8169. This is recommended. 2123 will be called r8169. This is recommended.
2124 2124
2125config R8169_NAPI
2126 bool "Use Rx Polling (NAPI) (EXPERIMENTAL)"
2127 depends on R8169 && EXPERIMENTAL
2128 help
2129 NAPI is a new driver API designed to reduce CPU and interrupt load
2130 when the driver is receiving lots of packets from the card. It is
2131 still somewhat experimental and thus not yet enabled by default.
2132
2133 If your estimated Rx load is 10kpps or more, or if the card will be
2134 deployed on potentially unfriendly networks (e.g. in a firewall),
2135 then say Y here.
2136
2137 If in doubt, say N.
2138
2139config R8169_VLAN 2125config R8169_VLAN
2140 bool "VLAN support" 2126 bool "VLAN support"
2141 depends on R8169 && VLAN_8021Q 2127 depends on R8169 && VLAN_8021Q
2142 ---help--- 2128 ---help---
2143 Say Y here for the r8169 driver to support the functions required 2129 Say Y here for the r8169 driver to support the functions required
2144 by the kernel 802.1Q code. 2130 by the kernel 802.1Q code.
2145 2131
2146 If in doubt, say Y. 2132 If in doubt, say Y.
2147 2133
2148config SB1250_MAC 2134config SB1250_MAC
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 87703ffd4c1e..4beb043e09e6 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -106,11 +106,11 @@ ifeq ($(CONFIG_FEC_MPC52xx_MDIO),y)
106endif 106endif
107obj-$(CONFIG_68360_ENET) += 68360enet.o 107obj-$(CONFIG_68360_ENET) += 68360enet.o
108obj-$(CONFIG_WD80x3) += wd.o 8390.o 108obj-$(CONFIG_WD80x3) += wd.o 8390.o
109obj-$(CONFIG_EL2) += 3c503.o 8390.o 109obj-$(CONFIG_EL2) += 3c503.o 8390p.o
110obj-$(CONFIG_NE2000) += ne.o 8390.o 110obj-$(CONFIG_NE2000) += ne.o 8390p.o
111obj-$(CONFIG_NE2_MCA) += ne2.o 8390.o 111obj-$(CONFIG_NE2_MCA) += ne2.o 8390p.o
112obj-$(CONFIG_HPLAN) += hp.o 8390.o 112obj-$(CONFIG_HPLAN) += hp.o 8390p.o
113obj-$(CONFIG_HPLAN_PLUS) += hp-plus.o 8390.o 113obj-$(CONFIG_HPLAN_PLUS) += hp-plus.o 8390p.o
114obj-$(CONFIG_ULTRA) += smc-ultra.o 8390.o 114obj-$(CONFIG_ULTRA) += smc-ultra.o 8390.o
115obj-$(CONFIG_ULTRAMCA) += smc-mca.o 8390.o 115obj-$(CONFIG_ULTRAMCA) += smc-mca.o 8390.o
116obj-$(CONFIG_ULTRA32) += smc-ultra32.o 8390.o 116obj-$(CONFIG_ULTRA32) += smc-ultra32.o 8390.o
diff --git a/drivers/net/hp.c b/drivers/net/hp.c
index c649a8019beb..8281209ededf 100644
--- a/drivers/net/hp.c
+++ b/drivers/net/hp.c
@@ -103,7 +103,7 @@ static int __init do_hp_probe(struct net_device *dev)
103#ifndef MODULE 103#ifndef MODULE
104struct net_device * __init hp_probe(int unit) 104struct net_device * __init hp_probe(int unit)
105{ 105{
106 struct net_device *dev = alloc_ei_netdev(); 106 struct net_device *dev = alloc_eip_netdev();
107 int err; 107 int err;
108 108
109 if (!dev) 109 if (!dev)
@@ -176,7 +176,7 @@ static int __init hp_probe1(struct net_device *dev, int ioaddr)
176 outb_p(irqmap[irq] | HP_RUN, ioaddr + HP_CONFIGURE); 176 outb_p(irqmap[irq] | HP_RUN, ioaddr + HP_CONFIGURE);
177 outb_p( 0x00 | HP_RUN, ioaddr + HP_CONFIGURE); 177 outb_p( 0x00 | HP_RUN, ioaddr + HP_CONFIGURE);
178 if (irq == probe_irq_off(cookie) /* It's a good IRQ line! */ 178 if (irq == probe_irq_off(cookie) /* It's a good IRQ line! */
179 && request_irq (irq, ei_interrupt, 0, DRV_NAME, dev) == 0) { 179 && request_irq (irq, eip_interrupt, 0, DRV_NAME, dev) == 0) {
180 printk(" selecting IRQ %d.\n", irq); 180 printk(" selecting IRQ %d.\n", irq);
181 dev->irq = *irqp; 181 dev->irq = *irqp;
182 break; 182 break;
@@ -191,7 +191,7 @@ static int __init hp_probe1(struct net_device *dev, int ioaddr)
191 } else { 191 } else {
192 if (dev->irq == 2) 192 if (dev->irq == 2)
193 dev->irq = 9; 193 dev->irq = 9;
194 if ((retval = request_irq(dev->irq, ei_interrupt, 0, DRV_NAME, dev))) { 194 if ((retval = request_irq(dev->irq, eip_interrupt, 0, DRV_NAME, dev))) {
195 printk (" unable to get IRQ %d.\n", dev->irq); 195 printk (" unable to get IRQ %d.\n", dev->irq);
196 goto out; 196 goto out;
197 } 197 }
@@ -202,7 +202,7 @@ static int __init hp_probe1(struct net_device *dev, int ioaddr)
202 dev->open = &hp_open; 202 dev->open = &hp_open;
203 dev->stop = &hp_close; 203 dev->stop = &hp_close;
204#ifdef CONFIG_NET_POLL_CONTROLLER 204#ifdef CONFIG_NET_POLL_CONTROLLER
205 dev->poll_controller = ei_poll; 205 dev->poll_controller = eip_poll;
206#endif 206#endif
207 207
208 ei_status.name = name; 208 ei_status.name = name;
@@ -231,14 +231,14 @@ out:
231static int 231static int
232hp_open(struct net_device *dev) 232hp_open(struct net_device *dev)
233{ 233{
234 ei_open(dev); 234 eip_open(dev);
235 return 0; 235 return 0;
236} 236}
237 237
238static int 238static int
239hp_close(struct net_device *dev) 239hp_close(struct net_device *dev)
240{ 240{
241 ei_close(dev); 241 eip_close(dev);
242 return 0; 242 return 0;
243} 243}
244 244
@@ -421,7 +421,7 @@ init_module(void)
421 if (this_dev != 0) break; /* only autoprobe 1st one */ 421 if (this_dev != 0) break; /* only autoprobe 1st one */
422 printk(KERN_NOTICE "hp.c: Presently autoprobing (not recommended) for a single card.\n"); 422 printk(KERN_NOTICE "hp.c: Presently autoprobing (not recommended) for a single card.\n");
423 } 423 }
424 dev = alloc_ei_netdev(); 424 dev = alloc_eip_netdev();
425 if (!dev) 425 if (!dev)
426 break; 426 break;
427 dev->irq = irq[this_dev]; 427 dev->irq = irq[this_dev];
diff --git a/drivers/net/igb/e1000_82575.c b/drivers/net/igb/e1000_82575.c
index cda3ec879090..2c8b91060d98 100644
--- a/drivers/net/igb/e1000_82575.c
+++ b/drivers/net/igb/e1000_82575.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel(R) Gigabit Ethernet Linux driver 3 Intel(R) Gigabit Ethernet Linux driver
4 Copyright(c) 2007 Intel Corporation. 4 Copyright(c) 2007 - 2008 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -171,6 +171,10 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw)
171 * for setting word_size. 171 * for setting word_size.
172 */ 172 */
173 size += NVM_WORD_SIZE_BASE_SHIFT; 173 size += NVM_WORD_SIZE_BASE_SHIFT;
174
175 /* EEPROM access above 16k is unsupported */
176 if (size > 14)
177 size = 14;
174 nvm->word_size = 1 << size; 178 nvm->word_size = 1 << size;
175 179
176 /* setup PHY parameters */ 180 /* setup PHY parameters */
@@ -222,7 +226,7 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw)
222} 226}
223 227
224/** 228/**
225 * e1000_acquire_phy_82575 - Acquire rights to access PHY 229 * igb_acquire_phy_82575 - Acquire rights to access PHY
226 * @hw: pointer to the HW structure 230 * @hw: pointer to the HW structure
227 * 231 *
228 * Acquire access rights to the correct PHY. This is a 232 * Acquire access rights to the correct PHY. This is a
@@ -238,7 +242,7 @@ static s32 igb_acquire_phy_82575(struct e1000_hw *hw)
238} 242}
239 243
240/** 244/**
241 * e1000_release_phy_82575 - Release rights to access PHY 245 * igb_release_phy_82575 - Release rights to access PHY
242 * @hw: pointer to the HW structure 246 * @hw: pointer to the HW structure
243 * 247 *
244 * A wrapper to release access rights to the correct PHY. This is a 248 * A wrapper to release access rights to the correct PHY. This is a
@@ -253,7 +257,7 @@ static void igb_release_phy_82575(struct e1000_hw *hw)
253} 257}
254 258
255/** 259/**
256 * e1000_read_phy_reg_sgmii_82575 - Read PHY register using sgmii 260 * igb_read_phy_reg_sgmii_82575 - Read PHY register using sgmii
257 * @hw: pointer to the HW structure 261 * @hw: pointer to the HW structure
258 * @offset: register offset to be read 262 * @offset: register offset to be read
259 * @data: pointer to the read data 263 * @data: pointer to the read data
@@ -268,7 +272,7 @@ static s32 igb_read_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset,
268 u32 i, i2ccmd = 0; 272 u32 i, i2ccmd = 0;
269 273
270 if (offset > E1000_MAX_SGMII_PHY_REG_ADDR) { 274 if (offset > E1000_MAX_SGMII_PHY_REG_ADDR) {
271 hw_dbg(hw, "PHY Address %u is out of range\n", offset); 275 hw_dbg("PHY Address %u is out of range\n", offset);
272 return -E1000_ERR_PARAM; 276 return -E1000_ERR_PARAM;
273 } 277 }
274 278
@@ -291,11 +295,11 @@ static s32 igb_read_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset,
291 break; 295 break;
292 } 296 }
293 if (!(i2ccmd & E1000_I2CCMD_READY)) { 297 if (!(i2ccmd & E1000_I2CCMD_READY)) {
294 hw_dbg(hw, "I2CCMD Read did not complete\n"); 298 hw_dbg("I2CCMD Read did not complete\n");
295 return -E1000_ERR_PHY; 299 return -E1000_ERR_PHY;
296 } 300 }
297 if (i2ccmd & E1000_I2CCMD_ERROR) { 301 if (i2ccmd & E1000_I2CCMD_ERROR) {
298 hw_dbg(hw, "I2CCMD Error bit set\n"); 302 hw_dbg("I2CCMD Error bit set\n");
299 return -E1000_ERR_PHY; 303 return -E1000_ERR_PHY;
300 } 304 }
301 305
@@ -306,7 +310,7 @@ static s32 igb_read_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset,
306} 310}
307 311
308/** 312/**
309 * e1000_write_phy_reg_sgmii_82575 - Write PHY register using sgmii 313 * igb_write_phy_reg_sgmii_82575 - Write PHY register using sgmii
310 * @hw: pointer to the HW structure 314 * @hw: pointer to the HW structure
311 * @offset: register offset to write to 315 * @offset: register offset to write to
312 * @data: data to write at register offset 316 * @data: data to write at register offset
@@ -322,7 +326,7 @@ static s32 igb_write_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset,
322 u16 phy_data_swapped; 326 u16 phy_data_swapped;
323 327
324 if (offset > E1000_MAX_SGMII_PHY_REG_ADDR) { 328 if (offset > E1000_MAX_SGMII_PHY_REG_ADDR) {
325 hw_dbg(hw, "PHY Address %d is out of range\n", offset); 329 hw_dbg("PHY Address %d is out of range\n", offset);
326 return -E1000_ERR_PARAM; 330 return -E1000_ERR_PARAM;
327 } 331 }
328 332
@@ -349,11 +353,11 @@ static s32 igb_write_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset,
349 break; 353 break;
350 } 354 }
351 if (!(i2ccmd & E1000_I2CCMD_READY)) { 355 if (!(i2ccmd & E1000_I2CCMD_READY)) {
352 hw_dbg(hw, "I2CCMD Write did not complete\n"); 356 hw_dbg("I2CCMD Write did not complete\n");
353 return -E1000_ERR_PHY; 357 return -E1000_ERR_PHY;
354 } 358 }
355 if (i2ccmd & E1000_I2CCMD_ERROR) { 359 if (i2ccmd & E1000_I2CCMD_ERROR) {
356 hw_dbg(hw, "I2CCMD Error bit set\n"); 360 hw_dbg("I2CCMD Error bit set\n");
357 return -E1000_ERR_PHY; 361 return -E1000_ERR_PHY;
358 } 362 }
359 363
@@ -361,10 +365,10 @@ static s32 igb_write_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset,
361} 365}
362 366
363/** 367/**
364 * e1000_get_phy_id_82575 - Retreive PHY addr and id 368 * igb_get_phy_id_82575 - Retrieve PHY addr and id
365 * @hw: pointer to the HW structure 369 * @hw: pointer to the HW structure
366 * 370 *
367 * Retreives the PHY address and ID for both PHY's which do and do not use 371 * Retrieves the PHY address and ID for both PHY's which do and do not use
368 * sgmi interface. 372 * sgmi interface.
369 **/ 373 **/
370static s32 igb_get_phy_id_82575(struct e1000_hw *hw) 374static s32 igb_get_phy_id_82575(struct e1000_hw *hw)
@@ -393,9 +397,8 @@ static s32 igb_get_phy_id_82575(struct e1000_hw *hw)
393 for (phy->addr = 1; phy->addr < 8; phy->addr++) { 397 for (phy->addr = 1; phy->addr < 8; phy->addr++) {
394 ret_val = igb_read_phy_reg_sgmii_82575(hw, PHY_ID1, &phy_id); 398 ret_val = igb_read_phy_reg_sgmii_82575(hw, PHY_ID1, &phy_id);
395 if (ret_val == 0) { 399 if (ret_val == 0) {
396 hw_dbg(hw, "Vendor ID 0x%08X read at address %u\n", 400 hw_dbg("Vendor ID 0x%08X read at address %u\n",
397 phy_id, 401 phy_id, phy->addr);
398 phy->addr);
399 /* 402 /*
400 * At the time of this writing, The M88 part is 403 * At the time of this writing, The M88 part is
401 * the only supported SGMII PHY product. 404 * the only supported SGMII PHY product.
@@ -403,8 +406,7 @@ static s32 igb_get_phy_id_82575(struct e1000_hw *hw)
403 if (phy_id == M88_VENDOR) 406 if (phy_id == M88_VENDOR)
404 break; 407 break;
405 } else { 408 } else {
406 hw_dbg(hw, "PHY address %u was unreadable\n", 409 hw_dbg("PHY address %u was unreadable\n", phy->addr);
407 phy->addr);
408 } 410 }
409 } 411 }
410 412
@@ -422,7 +424,7 @@ out:
422} 424}
423 425
424/** 426/**
425 * e1000_phy_hw_reset_sgmii_82575 - Performs a PHY reset 427 * igb_phy_hw_reset_sgmii_82575 - Performs a PHY reset
426 * @hw: pointer to the HW structure 428 * @hw: pointer to the HW structure
427 * 429 *
428 * Resets the PHY using the serial gigabit media independent interface. 430 * Resets the PHY using the serial gigabit media independent interface.
@@ -436,7 +438,7 @@ static s32 igb_phy_hw_reset_sgmii_82575(struct e1000_hw *hw)
436 * available to us at this time. 438 * available to us at this time.
437 */ 439 */
438 440
439 hw_dbg(hw, "Soft resetting SGMII attached PHY...\n"); 441 hw_dbg("Soft resetting SGMII attached PHY...\n");
440 442
441 /* 443 /*
442 * SFP documentation requires the following to configure the SPF module 444 * SFP documentation requires the following to configure the SPF module
@@ -453,7 +455,7 @@ out:
453} 455}
454 456
455/** 457/**
456 * e1000_set_d0_lplu_state_82575 - Set Low Power Linkup D0 state 458 * igb_set_d0_lplu_state_82575 - Set Low Power Linkup D0 state
457 * @hw: pointer to the HW structure 459 * @hw: pointer to the HW structure
458 * @active: true to enable LPLU, false to disable 460 * @active: true to enable LPLU, false to disable
459 * 461 *
@@ -471,34 +473,29 @@ static s32 igb_set_d0_lplu_state_82575(struct e1000_hw *hw, bool active)
471 s32 ret_val; 473 s32 ret_val;
472 u16 data; 474 u16 data;
473 475
474 ret_val = hw->phy.ops.read_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, 476 ret_val = phy->ops.read_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, &data);
475 &data);
476 if (ret_val) 477 if (ret_val)
477 goto out; 478 goto out;
478 479
479 if (active) { 480 if (active) {
480 data |= IGP02E1000_PM_D0_LPLU; 481 data |= IGP02E1000_PM_D0_LPLU;
481 ret_val = hw->phy.ops.write_phy_reg(hw, 482 ret_val = phy->ops.write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT,
482 IGP02E1000_PHY_POWER_MGMT, 483 data);
483 data);
484 if (ret_val) 484 if (ret_val)
485 goto out; 485 goto out;
486 486
487 /* When LPLU is enabled, we should disable SmartSpeed */ 487 /* When LPLU is enabled, we should disable SmartSpeed */
488 ret_val = hw->phy.ops.read_phy_reg(hw, 488 ret_val = phy->ops.read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
489 IGP01E1000_PHY_PORT_CONFIG, 489 &data);
490 &data);
491 data &= ~IGP01E1000_PSCFR_SMART_SPEED; 490 data &= ~IGP01E1000_PSCFR_SMART_SPEED;
492 ret_val = hw->phy.ops.write_phy_reg(hw, 491 ret_val = phy->ops.write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
493 IGP01E1000_PHY_PORT_CONFIG, 492 data);
494 data);
495 if (ret_val) 493 if (ret_val)
496 goto out; 494 goto out;
497 } else { 495 } else {
498 data &= ~IGP02E1000_PM_D0_LPLU; 496 data &= ~IGP02E1000_PM_D0_LPLU;
499 ret_val = hw->phy.ops.write_phy_reg(hw, 497 ret_val = phy->ops.write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT,
500 IGP02E1000_PHY_POWER_MGMT, 498 data);
501 data);
502 /* 499 /*
503 * LPLU and SmartSpeed are mutually exclusive. LPLU is used 500 * LPLU and SmartSpeed are mutually exclusive. LPLU is used
504 * during Dx states where the power conservation is most 501 * during Dx states where the power conservation is most
@@ -506,29 +503,25 @@ static s32 igb_set_d0_lplu_state_82575(struct e1000_hw *hw, bool active)
506 * SmartSpeed, so performance is maintained. 503 * SmartSpeed, so performance is maintained.
507 */ 504 */
508 if (phy->smart_speed == e1000_smart_speed_on) { 505 if (phy->smart_speed == e1000_smart_speed_on) {
509 ret_val = hw->phy.ops.read_phy_reg(hw, 506 ret_val = phy->ops.read_phy_reg(hw,
510 IGP01E1000_PHY_PORT_CONFIG, 507 IGP01E1000_PHY_PORT_CONFIG, &data);
511 &data);
512 if (ret_val) 508 if (ret_val)
513 goto out; 509 goto out;
514 510
515 data |= IGP01E1000_PSCFR_SMART_SPEED; 511 data |= IGP01E1000_PSCFR_SMART_SPEED;
516 ret_val = hw->phy.ops.write_phy_reg(hw, 512 ret_val = phy->ops.write_phy_reg(hw,
517 IGP01E1000_PHY_PORT_CONFIG, 513 IGP01E1000_PHY_PORT_CONFIG, data);
518 data);
519 if (ret_val) 514 if (ret_val)
520 goto out; 515 goto out;
521 } else if (phy->smart_speed == e1000_smart_speed_off) { 516 } else if (phy->smart_speed == e1000_smart_speed_off) {
522 ret_val = hw->phy.ops.read_phy_reg(hw, 517 ret_val = phy->ops.read_phy_reg(hw,
523 IGP01E1000_PHY_PORT_CONFIG, 518 IGP01E1000_PHY_PORT_CONFIG, &data);
524 &data);
525 if (ret_val) 519 if (ret_val)
526 goto out; 520 goto out;
527 521
528 data &= ~IGP01E1000_PSCFR_SMART_SPEED; 522 data &= ~IGP01E1000_PSCFR_SMART_SPEED;
529 ret_val = hw->phy.ops.write_phy_reg(hw, 523 ret_val = phy->ops.write_phy_reg(hw,
530 IGP01E1000_PHY_PORT_CONFIG, 524 IGP01E1000_PHY_PORT_CONFIG, data);
531 data);
532 if (ret_val) 525 if (ret_val)
533 goto out; 526 goto out;
534 } 527 }
@@ -539,10 +532,10 @@ out:
539} 532}
540 533
541/** 534/**
542 * e1000_acquire_nvm_82575 - Request for access to EEPROM 535 * igb_acquire_nvm_82575 - Request for access to EEPROM
543 * @hw: pointer to the HW structure 536 * @hw: pointer to the HW structure
544 * 537 *
545 * Acquire the necessary semaphores for exclussive access to the EEPROM. 538 * Acquire the necessary semaphores for exclusive access to the EEPROM.
546 * Set the EEPROM access request bit and wait for EEPROM access grant bit. 539 * Set the EEPROM access request bit and wait for EEPROM access grant bit.
547 * Return successful if access grant bit set, else clear the request for 540 * Return successful if access grant bit set, else clear the request for
548 * EEPROM access and return -E1000_ERR_NVM (-1). 541 * EEPROM access and return -E1000_ERR_NVM (-1).
@@ -565,7 +558,7 @@ out:
565} 558}
566 559
567/** 560/**
568 * e1000_release_nvm_82575 - Release exclusive access to EEPROM 561 * igb_release_nvm_82575 - Release exclusive access to EEPROM
569 * @hw: pointer to the HW structure 562 * @hw: pointer to the HW structure
570 * 563 *
571 * Stop any current commands to the EEPROM and clear the EEPROM request bit, 564 * Stop any current commands to the EEPROM and clear the EEPROM request bit,
@@ -578,7 +571,7 @@ static void igb_release_nvm_82575(struct e1000_hw *hw)
578} 571}
579 572
580/** 573/**
581 * e1000_acquire_swfw_sync_82575 - Acquire SW/FW semaphore 574 * igb_acquire_swfw_sync_82575 - Acquire SW/FW semaphore
582 * @hw: pointer to the HW structure 575 * @hw: pointer to the HW structure
583 * @mask: specifies which semaphore to acquire 576 * @mask: specifies which semaphore to acquire
584 * 577 *
@@ -613,7 +606,7 @@ static s32 igb_acquire_swfw_sync_82575(struct e1000_hw *hw, u16 mask)
613 } 606 }
614 607
615 if (i == timeout) { 608 if (i == timeout) {
616 hw_dbg(hw, "Can't access resource, SW_FW_SYNC timeout.\n"); 609 hw_dbg("Driver can't access resource, SW_FW_SYNC timeout.\n");
617 ret_val = -E1000_ERR_SWFW_SYNC; 610 ret_val = -E1000_ERR_SWFW_SYNC;
618 goto out; 611 goto out;
619 } 612 }
@@ -628,7 +621,7 @@ out:
628} 621}
629 622
630/** 623/**
631 * e1000_release_swfw_sync_82575 - Release SW/FW semaphore 624 * igb_release_swfw_sync_82575 - Release SW/FW semaphore
632 * @hw: pointer to the HW structure 625 * @hw: pointer to the HW structure
633 * @mask: specifies which semaphore to acquire 626 * @mask: specifies which semaphore to acquire
634 * 627 *
@@ -650,7 +643,7 @@ static void igb_release_swfw_sync_82575(struct e1000_hw *hw, u16 mask)
650} 643}
651 644
652/** 645/**
653 * e1000_get_cfg_done_82575 - Read config done bit 646 * igb_get_cfg_done_82575 - Read config done bit
654 * @hw: pointer to the HW structure 647 * @hw: pointer to the HW structure
655 * 648 *
656 * Read the management control register for the config done bit for 649 * Read the management control register for the config done bit for
@@ -675,7 +668,7 @@ static s32 igb_get_cfg_done_82575(struct e1000_hw *hw)
675 timeout--; 668 timeout--;
676 } 669 }
677 if (!timeout) 670 if (!timeout)
678 hw_dbg(hw, "MNG configuration cycle has not completed.\n"); 671 hw_dbg("MNG configuration cycle has not completed.\n");
679 672
680 /* If EEPROM is not marked present, init the PHY manually */ 673 /* If EEPROM is not marked present, init the PHY manually */
681 if (((rd32(E1000_EECD) & E1000_EECD_PRES) == 0) && 674 if (((rd32(E1000_EECD) & E1000_EECD_PRES) == 0) &&
@@ -686,7 +679,7 @@ static s32 igb_get_cfg_done_82575(struct e1000_hw *hw)
686} 679}
687 680
688/** 681/**
689 * e1000_check_for_link_82575 - Check for link 682 * igb_check_for_link_82575 - Check for link
690 * @hw: pointer to the HW structure 683 * @hw: pointer to the HW structure
691 * 684 *
692 * If sgmii is enabled, then use the pcs register to determine link, otherwise 685 * If sgmii is enabled, then use the pcs register to determine link, otherwise
@@ -709,12 +702,12 @@ static s32 igb_check_for_link_82575(struct e1000_hw *hw)
709} 702}
710 703
711/** 704/**
712 * e1000_get_pcs_speed_and_duplex_82575 - Retrieve current speed/duplex 705 * igb_get_pcs_speed_and_duplex_82575 - Retrieve current speed/duplex
713 * @hw: pointer to the HW structure 706 * @hw: pointer to the HW structure
714 * @speed: stores the current speed 707 * @speed: stores the current speed
715 * @duplex: stores the current duplex 708 * @duplex: stores the current duplex
716 * 709 *
717 * Using the physical coding sub-layer (PCS), retreive the current speed and 710 * Using the physical coding sub-layer (PCS), retrieve the current speed and
718 * duplex, then store the values in the pointers provided. 711 * duplex, then store the values in the pointers provided.
719 **/ 712 **/
720static s32 igb_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw, u16 *speed, 713static s32 igb_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw, u16 *speed,
@@ -764,7 +757,7 @@ static s32 igb_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw, u16 *speed,
764} 757}
765 758
766/** 759/**
767 * e1000_rar_set_82575 - Set receive address register 760 * igb_rar_set_82575 - Set receive address register
768 * @hw: pointer to the HW structure 761 * @hw: pointer to the HW structure
769 * @addr: pointer to the receive address 762 * @addr: pointer to the receive address
770 * @index: receive address array register 763 * @index: receive address array register
@@ -781,7 +774,7 @@ static void igb_rar_set_82575(struct e1000_hw *hw, u8 *addr, u32 index)
781} 774}
782 775
783/** 776/**
784 * e1000_reset_hw_82575 - Reset hardware 777 * igb_reset_hw_82575 - Reset hardware
785 * @hw: pointer to the HW structure 778 * @hw: pointer to the HW structure
786 * 779 *
787 * This resets the hardware into a known state. This is a 780 * This resets the hardware into a known state. This is a
@@ -798,9 +791,9 @@ static s32 igb_reset_hw_82575(struct e1000_hw *hw)
798 */ 791 */
799 ret_val = igb_disable_pcie_master(hw); 792 ret_val = igb_disable_pcie_master(hw);
800 if (ret_val) 793 if (ret_val)
801 hw_dbg(hw, "PCI-E Master disable polling has failed.\n"); 794 hw_dbg("PCI-E Master disable polling has failed.\n");
802 795
803 hw_dbg(hw, "Masking off all interrupts\n"); 796 hw_dbg("Masking off all interrupts\n");
804 wr32(E1000_IMC, 0xffffffff); 797 wr32(E1000_IMC, 0xffffffff);
805 798
806 wr32(E1000_RCTL, 0); 799 wr32(E1000_RCTL, 0);
@@ -811,7 +804,7 @@ static s32 igb_reset_hw_82575(struct e1000_hw *hw)
811 804
812 ctrl = rd32(E1000_CTRL); 805 ctrl = rd32(E1000_CTRL);
813 806
814 hw_dbg(hw, "Issuing a global reset to MAC\n"); 807 hw_dbg("Issuing a global reset to MAC\n");
815 wr32(E1000_CTRL, ctrl | E1000_CTRL_RST); 808 wr32(E1000_CTRL, ctrl | E1000_CTRL_RST);
816 809
817 ret_val = igb_get_auto_rd_done(hw); 810 ret_val = igb_get_auto_rd_done(hw);
@@ -821,7 +814,7 @@ static s32 igb_reset_hw_82575(struct e1000_hw *hw)
821 * return with an error. This can happen in situations 814 * return with an error. This can happen in situations
822 * where there is no eeprom and prevents getting link. 815 * where there is no eeprom and prevents getting link.
823 */ 816 */
824 hw_dbg(hw, "Auto Read Done did not complete\n"); 817 hw_dbg("Auto Read Done did not complete\n");
825 } 818 }
826 819
827 /* If EEPROM is not present, run manual init scripts */ 820 /* If EEPROM is not present, run manual init scripts */
@@ -838,7 +831,7 @@ static s32 igb_reset_hw_82575(struct e1000_hw *hw)
838} 831}
839 832
840/** 833/**
841 * e1000_init_hw_82575 - Initialize hardware 834 * igb_init_hw_82575 - Initialize hardware
842 * @hw: pointer to the HW structure 835 * @hw: pointer to the HW structure
843 * 836 *
844 * This inits the hardware readying it for operation. 837 * This inits the hardware readying it for operation.
@@ -852,18 +845,18 @@ static s32 igb_init_hw_82575(struct e1000_hw *hw)
852 /* Initialize identification LED */ 845 /* Initialize identification LED */
853 ret_val = igb_id_led_init(hw); 846 ret_val = igb_id_led_init(hw);
854 if (ret_val) { 847 if (ret_val) {
855 hw_dbg(hw, "Error initializing identification LED\n"); 848 hw_dbg("Error initializing identification LED\n");
856 /* This is not fatal and we should not stop init due to this */ 849 /* This is not fatal and we should not stop init due to this */
857 } 850 }
858 851
859 /* Disabling VLAN filtering */ 852 /* Disabling VLAN filtering */
860 hw_dbg(hw, "Initializing the IEEE VLAN\n"); 853 hw_dbg("Initializing the IEEE VLAN\n");
861 igb_clear_vfta(hw); 854 igb_clear_vfta(hw);
862 855
863 /* Setup the receive address */ 856 /* Setup the receive address */
864 igb_init_rx_addrs(hw, rar_count); 857 igb_init_rx_addrs(hw, rar_count);
865 /* Zero out the Multicast HASH table */ 858 /* Zero out the Multicast HASH table */
866 hw_dbg(hw, "Zeroing the MTA\n"); 859 hw_dbg("Zeroing the MTA\n");
867 for (i = 0; i < mac->mta_reg_count; i++) 860 for (i = 0; i < mac->mta_reg_count; i++)
868 array_wr32(E1000_MTA, i, 0); 861 array_wr32(E1000_MTA, i, 0);
869 862
@@ -882,7 +875,7 @@ static s32 igb_init_hw_82575(struct e1000_hw *hw)
882} 875}
883 876
884/** 877/**
885 * e1000_setup_copper_link_82575 - Configure copper link settings 878 * igb_setup_copper_link_82575 - Configure copper link settings
886 * @hw: pointer to the HW structure 879 * @hw: pointer to the HW structure
887 * 880 *
888 * Configures the link for auto-neg or forced speed and duplex. Then we check 881 * Configures the link for auto-neg or forced speed and duplex. Then we check
@@ -933,10 +926,10 @@ static s32 igb_setup_copper_link_82575(struct e1000_hw *hw)
933 * PHY will be set to 10H, 10F, 100H or 100F 926 * PHY will be set to 10H, 10F, 100H or 100F
934 * depending on user settings. 927 * depending on user settings.
935 */ 928 */
936 hw_dbg(hw, "Forcing Speed and Duplex\n"); 929 hw_dbg("Forcing Speed and Duplex\n");
937 ret_val = igb_phy_force_speed_duplex(hw); 930 ret_val = igb_phy_force_speed_duplex(hw);
938 if (ret_val) { 931 if (ret_val) {
939 hw_dbg(hw, "Error Forcing Speed and Duplex\n"); 932 hw_dbg("Error Forcing Speed and Duplex\n");
940 goto out; 933 goto out;
941 } 934 }
942 } 935 }
@@ -949,20 +942,17 @@ static s32 igb_setup_copper_link_82575(struct e1000_hw *hw)
949 * Check link status. Wait up to 100 microseconds for link to become 942 * Check link status. Wait up to 100 microseconds for link to become
950 * valid. 943 * valid.
951 */ 944 */
952 ret_val = igb_phy_has_link(hw, 945 ret_val = igb_phy_has_link(hw, COPPER_LINK_UP_LIMIT, 10, &link);
953 COPPER_LINK_UP_LIMIT,
954 10,
955 &link);
956 if (ret_val) 946 if (ret_val)
957 goto out; 947 goto out;
958 948
959 if (link) { 949 if (link) {
960 hw_dbg(hw, "Valid link established!!!\n"); 950 hw_dbg("Valid link established!!!\n");
961 /* Config the MAC and PHY after link is up */ 951 /* Config the MAC and PHY after link is up */
962 igb_config_collision_dist(hw); 952 igb_config_collision_dist(hw);
963 ret_val = igb_config_fc_after_link_up(hw); 953 ret_val = igb_config_fc_after_link_up(hw);
964 } else { 954 } else {
965 hw_dbg(hw, "Unable to establish link!!!\n"); 955 hw_dbg("Unable to establish link!!!\n");
966 } 956 }
967 957
968out: 958out:
@@ -970,7 +960,7 @@ out:
970} 960}
971 961
972/** 962/**
973 * e1000_setup_fiber_serdes_link_82575 - Setup link for fiber/serdes 963 * igb_setup_fiber_serdes_link_82575 - Setup link for fiber/serdes
974 * @hw: pointer to the HW structure 964 * @hw: pointer to the HW structure
975 * 965 *
976 * Configures speed and duplex for fiber and serdes links. 966 * Configures speed and duplex for fiber and serdes links.
@@ -1018,7 +1008,7 @@ static s32 igb_setup_fiber_serdes_link_82575(struct e1000_hw *hw)
1018 E1000_PCS_LCTL_FDV_FULL | /* SerDes Full duplex */ 1008 E1000_PCS_LCTL_FDV_FULL | /* SerDes Full duplex */
1019 E1000_PCS_LCTL_AN_ENABLE | /* Enable Autoneg */ 1009 E1000_PCS_LCTL_AN_ENABLE | /* Enable Autoneg */
1020 E1000_PCS_LCTL_AN_RESTART; /* Restart autoneg */ 1010 E1000_PCS_LCTL_AN_RESTART; /* Restart autoneg */
1021 hw_dbg(hw, "Configuring Autoneg; PCS_LCTL = 0x%08X\n", reg); 1011 hw_dbg("Configuring Autoneg; PCS_LCTL = 0x%08X\n", reg);
1022 } else { 1012 } else {
1023 /* Set PCS register for forced speed */ 1013 /* Set PCS register for forced speed */
1024 reg |= E1000_PCS_LCTL_FLV_LINK_UP | /* Force link up */ 1014 reg |= E1000_PCS_LCTL_FLV_LINK_UP | /* Force link up */
@@ -1026,7 +1016,7 @@ static s32 igb_setup_fiber_serdes_link_82575(struct e1000_hw *hw)
1026 E1000_PCS_LCTL_FDV_FULL | /* SerDes Full duplex */ 1016 E1000_PCS_LCTL_FDV_FULL | /* SerDes Full duplex */
1027 E1000_PCS_LCTL_FSD | /* Force Speed */ 1017 E1000_PCS_LCTL_FSD | /* Force Speed */
1028 E1000_PCS_LCTL_FORCE_LINK; /* Force Link */ 1018 E1000_PCS_LCTL_FORCE_LINK; /* Force Link */
1029 hw_dbg(hw, "Configuring Forced Link; PCS_LCTL = 0x%08X\n", reg); 1019 hw_dbg("Configuring Forced Link; PCS_LCTL = 0x%08X\n", reg);
1030 } 1020 }
1031 wr32(E1000_PCS_LCTL, reg); 1021 wr32(E1000_PCS_LCTL, reg);
1032 1022
@@ -1034,7 +1024,7 @@ static s32 igb_setup_fiber_serdes_link_82575(struct e1000_hw *hw)
1034} 1024}
1035 1025
1036/** 1026/**
1037 * e1000_configure_pcs_link_82575 - Configure PCS link 1027 * igb_configure_pcs_link_82575 - Configure PCS link
1038 * @hw: pointer to the HW structure 1028 * @hw: pointer to the HW structure
1039 * 1029 *
1040 * Configure the physical coding sub-layer (PCS) link. The PCS link is 1030 * Configure the physical coding sub-layer (PCS) link. The PCS link is
@@ -1067,7 +1057,7 @@ static s32 igb_configure_pcs_link_82575(struct e1000_hw *hw)
1067 */ 1057 */
1068 reg |= E1000_PCS_LCTL_AN_RESTART | E1000_PCS_LCTL_AN_ENABLE; 1058 reg |= E1000_PCS_LCTL_AN_RESTART | E1000_PCS_LCTL_AN_ENABLE;
1069 } else { 1059 } else {
1070 /* Set PCS regiseter for forced speed */ 1060 /* Set PCS register for forced speed */
1071 1061
1072 /* Turn off bits for full duplex, speed, and autoneg */ 1062 /* Turn off bits for full duplex, speed, and autoneg */
1073 reg &= ~(E1000_PCS_LCTL_FSV_1000 | 1063 reg &= ~(E1000_PCS_LCTL_FSV_1000 |
@@ -1088,8 +1078,7 @@ static s32 igb_configure_pcs_link_82575(struct e1000_hw *hw)
1088 E1000_PCS_LCTL_FORCE_LINK | 1078 E1000_PCS_LCTL_FORCE_LINK |
1089 E1000_PCS_LCTL_FLV_LINK_UP; 1079 E1000_PCS_LCTL_FLV_LINK_UP;
1090 1080
1091 hw_dbg(hw, 1081 hw_dbg("Wrote 0x%08X to PCS_LCTL to configure forced link\n",
1092 "Wrote 0x%08X to PCS_LCTL to configure forced link\n",
1093 reg); 1082 reg);
1094 } 1083 }
1095 wr32(E1000_PCS_LCTL, reg); 1084 wr32(E1000_PCS_LCTL, reg);
@@ -1099,7 +1088,7 @@ out:
1099} 1088}
1100 1089
1101/** 1090/**
1102 * e1000_sgmii_active_82575 - Return sgmii state 1091 * igb_sgmii_active_82575 - Return sgmii state
1103 * @hw: pointer to the HW structure 1092 * @hw: pointer to the HW structure
1104 * 1093 *
1105 * 82575 silicon has a serialized gigabit media independent interface (sgmii) 1094 * 82575 silicon has a serialized gigabit media independent interface (sgmii)
@@ -1125,7 +1114,7 @@ out:
1125} 1114}
1126 1115
1127/** 1116/**
1128 * e1000_reset_init_script_82575 - Inits HW defaults after reset 1117 * igb_reset_init_script_82575 - Inits HW defaults after reset
1129 * @hw: pointer to the HW structure 1118 * @hw: pointer to the HW structure
1130 * 1119 *
1131 * Inits recommended HW defaults after a reset when there is no EEPROM 1120 * Inits recommended HW defaults after a reset when there is no EEPROM
@@ -1134,7 +1123,7 @@ out:
1134static s32 igb_reset_init_script_82575(struct e1000_hw *hw) 1123static s32 igb_reset_init_script_82575(struct e1000_hw *hw)
1135{ 1124{
1136 if (hw->mac.type == e1000_82575) { 1125 if (hw->mac.type == e1000_82575) {
1137 hw_dbg(hw, "Running reset init script for 82575\n"); 1126 hw_dbg("Running reset init script for 82575\n");
1138 /* SerDes configuration via SERDESCTRL */ 1127 /* SerDes configuration via SERDESCTRL */
1139 igb_write_8bit_ctrl_reg(hw, E1000_SCTL, 0x00, 0x0C); 1128 igb_write_8bit_ctrl_reg(hw, E1000_SCTL, 0x00, 0x0C);
1140 igb_write_8bit_ctrl_reg(hw, E1000_SCTL, 0x01, 0x78); 1129 igb_write_8bit_ctrl_reg(hw, E1000_SCTL, 0x01, 0x78);
@@ -1161,7 +1150,7 @@ static s32 igb_reset_init_script_82575(struct e1000_hw *hw)
1161} 1150}
1162 1151
1163/** 1152/**
1164 * e1000_read_mac_addr_82575 - Read device MAC address 1153 * igb_read_mac_addr_82575 - Read device MAC address
1165 * @hw: pointer to the HW structure 1154 * @hw: pointer to the HW structure
1166 **/ 1155 **/
1167static s32 igb_read_mac_addr_82575(struct e1000_hw *hw) 1156static s32 igb_read_mac_addr_82575(struct e1000_hw *hw)
@@ -1175,7 +1164,7 @@ static s32 igb_read_mac_addr_82575(struct e1000_hw *hw)
1175} 1164}
1176 1165
1177/** 1166/**
1178 * e1000_clear_hw_cntrs_82575 - Clear device specific hardware counters 1167 * igb_clear_hw_cntrs_82575 - Clear device specific hardware counters
1179 * @hw: pointer to the HW structure 1168 * @hw: pointer to the HW structure
1180 * 1169 *
1181 * Clears the hardware counters by reading the counter registers. 1170 * Clears the hardware counters by reading the counter registers.
@@ -1238,6 +1227,79 @@ static void igb_clear_hw_cntrs_82575(struct e1000_hw *hw)
1238 temp = rd32(E1000_SCVPC); 1227 temp = rd32(E1000_SCVPC);
1239} 1228}
1240 1229
1230/**
1231 * igb_rx_fifo_flush_82575 - Clean rx fifo after RX enable
1232 * @hw: pointer to the HW structure
1233 *
1234 * After rx enable if managability is enabled then there is likely some
1235 * bad data at the start of the fifo and possibly in the DMA fifo. This
1236 * function clears the fifos and flushes any packets that came in as rx was
1237 * being enabled.
1238 **/
1239void igb_rx_fifo_flush_82575(struct e1000_hw *hw)
1240{
1241 u32 rctl, rlpml, rxdctl[4], rfctl, temp_rctl, rx_enabled;
1242 int i, ms_wait;
1243
1244 if (hw->mac.type != e1000_82575 ||
1245 !(rd32(E1000_MANC) & E1000_MANC_RCV_TCO_EN))
1246 return;
1247
1248 /* Disable all RX queues */
1249 for (i = 0; i < 4; i++) {
1250 rxdctl[i] = rd32(E1000_RXDCTL(i));
1251 wr32(E1000_RXDCTL(i),
1252 rxdctl[i] & ~E1000_RXDCTL_QUEUE_ENABLE);
1253 }
1254 /* Poll all queues to verify they have shut down */
1255 for (ms_wait = 0; ms_wait < 10; ms_wait++) {
1256 msleep(1);
1257 rx_enabled = 0;
1258 for (i = 0; i < 4; i++)
1259 rx_enabled |= rd32(E1000_RXDCTL(i));
1260 if (!(rx_enabled & E1000_RXDCTL_QUEUE_ENABLE))
1261 break;
1262 }
1263
1264 if (ms_wait == 10)
1265 hw_dbg("Queue disable timed out after 10ms\n");
1266
1267 /* Clear RLPML, RCTL.SBP, RFCTL.LEF, and set RCTL.LPE so that all
1268 * incoming packets are rejected. Set enable and wait 2ms so that
1269 * any packet that was coming in as RCTL.EN was set is flushed
1270 */
1271 rfctl = rd32(E1000_RFCTL);
1272 wr32(E1000_RFCTL, rfctl & ~E1000_RFCTL_LEF);
1273
1274 rlpml = rd32(E1000_RLPML);
1275 wr32(E1000_RLPML, 0);
1276
1277 rctl = rd32(E1000_RCTL);
1278 temp_rctl = rctl & ~(E1000_RCTL_EN | E1000_RCTL_SBP);
1279 temp_rctl |= E1000_RCTL_LPE;
1280
1281 wr32(E1000_RCTL, temp_rctl);
1282 wr32(E1000_RCTL, temp_rctl | E1000_RCTL_EN);
1283 wrfl();
1284 msleep(2);
1285
1286 /* Enable RX queues that were previously enabled and restore our
1287 * previous state
1288 */
1289 for (i = 0; i < 4; i++)
1290 wr32(E1000_RXDCTL(i), rxdctl[i]);
1291 wr32(E1000_RCTL, rctl);
1292 wrfl();
1293
1294 wr32(E1000_RLPML, rlpml);
1295 wr32(E1000_RFCTL, rfctl);
1296
1297 /* Flush receive errors generated by workaround */
1298 rd32(E1000_ROC);
1299 rd32(E1000_RNBC);
1300 rd32(E1000_MPC);
1301}
1302
1241static struct e1000_mac_operations e1000_mac_ops_82575 = { 1303static struct e1000_mac_operations e1000_mac_ops_82575 = {
1242 .reset_hw = igb_reset_hw_82575, 1304 .reset_hw = igb_reset_hw_82575,
1243 .init_hw = igb_init_hw_82575, 1305 .init_hw = igb_init_hw_82575,
diff --git a/drivers/net/igb/e1000_82575.h b/drivers/net/igb/e1000_82575.h
index 76ea846663db..d78ad33d32bf 100644
--- a/drivers/net/igb/e1000_82575.h
+++ b/drivers/net/igb/e1000_82575.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel(R) Gigabit Ethernet Linux driver 3 Intel(R) Gigabit Ethernet Linux driver
4 Copyright(c) 2007 Intel Corporation. 4 Copyright(c) 2007 - 2008 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -28,6 +28,8 @@
28#ifndef _E1000_82575_H_ 28#ifndef _E1000_82575_H_
29#define _E1000_82575_H_ 29#define _E1000_82575_H_
30 30
31extern void igb_rx_fifo_flush_82575(struct e1000_hw *hw);
32
31#define E1000_RAR_ENTRIES_82575 16 33#define E1000_RAR_ENTRIES_82575 16
32 34
33/* SRRCTL bit definitions */ 35/* SRRCTL bit definitions */
@@ -56,7 +58,7 @@
56#define E1000_EIMS_RX_QUEUE E1000_EICR_RX_QUEUE 58#define E1000_EIMS_RX_QUEUE E1000_EICR_RX_QUEUE
57#define E1000_EIMS_TX_QUEUE E1000_EICR_TX_QUEUE 59#define E1000_EIMS_TX_QUEUE E1000_EICR_TX_QUEUE
58 60
59/* Immediate Interrupt RX (A.K.A. Low Latency Interrupt) */ 61/* Immediate Interrupt Rx (A.K.A. Low Latency Interrupt) */
60 62
61/* Receive Descriptor - Advanced */ 63/* Receive Descriptor - Advanced */
62union e1000_adv_rx_desc { 64union e1000_adv_rx_desc {
@@ -145,6 +147,6 @@ struct e1000_adv_tx_context_desc {
145 147
146 148
147 149
148#define E1000_DCA_TXCTRL_TX_WB_RO_EN (1 << 11) /* TX Desc writeback RO bit */ 150#define E1000_DCA_TXCTRL_TX_WB_RO_EN (1 << 11) /* Tx Desc writeback RO bit */
149 151
150#endif 152#endif
diff --git a/drivers/net/igb/e1000_defines.h b/drivers/net/igb/e1000_defines.h
index 8da9ffedc425..ed748dcfb7a4 100644
--- a/drivers/net/igb/e1000_defines.h
+++ b/drivers/net/igb/e1000_defines.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel(R) Gigabit Ethernet Linux driver 3 Intel(R) Gigabit Ethernet Linux driver
4 Copyright(c) 2007 Intel Corporation. 4 Copyright(c) 2007 - 2008 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -91,12 +91,12 @@
91#define E1000_MAX_SGMII_PHY_REG_ADDR 255 91#define E1000_MAX_SGMII_PHY_REG_ADDR 255
92#define E1000_I2CCMD_PHY_TIMEOUT 200 92#define E1000_I2CCMD_PHY_TIMEOUT 200
93 93
94/* Receive Decriptor bit definitions */ 94/* Receive Descriptor bit definitions */
95#define E1000_RXD_STAT_DD 0x01 /* Descriptor Done */ 95#define E1000_RXD_STAT_DD 0x01 /* Descriptor Done */
96#define E1000_RXD_STAT_EOP 0x02 /* End of Packet */ 96#define E1000_RXD_STAT_EOP 0x02 /* End of Packet */
97#define E1000_RXD_STAT_IXSM 0x04 /* Ignore checksum */ 97#define E1000_RXD_STAT_IXSM 0x04 /* Ignore checksum */
98#define E1000_RXD_STAT_VP 0x08 /* IEEE VLAN Packet */ 98#define E1000_RXD_STAT_VP 0x08 /* IEEE VLAN Packet */
99#define E1000_RXD_STAT_UDPCS 0x10 /* UDP xsum caculated */ 99#define E1000_RXD_STAT_UDPCS 0x10 /* UDP xsum calculated */
100#define E1000_RXD_STAT_TCPCS 0x20 /* TCP xsum calculated */ 100#define E1000_RXD_STAT_TCPCS 0x20 /* TCP xsum calculated */
101#define E1000_RXD_STAT_DYNINT 0x800 /* Pkt caused INT via DYNINT */ 101#define E1000_RXD_STAT_DYNINT 0x800 /* Pkt caused INT via DYNINT */
102#define E1000_RXD_ERR_CE 0x01 /* CRC Error */ 102#define E1000_RXD_ERR_CE 0x01 /* CRC Error */
@@ -340,6 +340,7 @@
340#define E1000_RXCSUM_PCSD 0x00002000 /* packet checksum disabled */ 340#define E1000_RXCSUM_PCSD 0x00002000 /* packet checksum disabled */
341 341
342/* Header split receive */ 342/* Header split receive */
343#define E1000_RFCTL_LEF 0x00040000
343 344
344/* Collision related configuration parameters */ 345/* Collision related configuration parameters */
345#define E1000_COLLISION_THRESHOLD 15 346#define E1000_COLLISION_THRESHOLD 15
@@ -379,7 +380,7 @@
379#define E1000_ICR_RXO 0x00000040 /* rx overrun */ 380#define E1000_ICR_RXO 0x00000040 /* rx overrun */
380#define E1000_ICR_RXT0 0x00000080 /* rx timer intr (ring 0) */ 381#define E1000_ICR_RXT0 0x00000080 /* rx timer intr (ring 0) */
381#define E1000_ICR_MDAC 0x00000200 /* MDIO access complete */ 382#define E1000_ICR_MDAC 0x00000200 /* MDIO access complete */
382#define E1000_ICR_RXCFG 0x00000400 /* RX /c/ ordered set */ 383#define E1000_ICR_RXCFG 0x00000400 /* Rx /c/ ordered set */
383#define E1000_ICR_GPI_EN0 0x00000800 /* GP Int 0 */ 384#define E1000_ICR_GPI_EN0 0x00000800 /* GP Int 0 */
384#define E1000_ICR_GPI_EN1 0x00001000 /* GP Int 1 */ 385#define E1000_ICR_GPI_EN1 0x00001000 /* GP Int 1 */
385#define E1000_ICR_GPI_EN2 0x00002000 /* GP Int 2 */ 386#define E1000_ICR_GPI_EN2 0x00002000 /* GP Int 2 */
@@ -443,12 +444,6 @@
443#define E1000_IMS_RXSEQ E1000_ICR_RXSEQ /* rx sequence error */ 444#define E1000_IMS_RXSEQ E1000_ICR_RXSEQ /* rx sequence error */
444#define E1000_IMS_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */ 445#define E1000_IMS_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */
445#define E1000_IMS_RXT0 E1000_ICR_RXT0 /* rx timer intr */ 446#define E1000_IMS_RXT0 E1000_ICR_RXT0 /* rx timer intr */
446/* queue 0 Rx descriptor FIFO parity error */
447/* queue 0 Tx descriptor FIFO parity error */
448/* host arb read buffer parity error */
449/* packet buffer parity error */
450/* queue 1 Rx descriptor FIFO parity error */
451/* queue 1 Tx descriptor FIFO parity error */
452 447
453/* Extended Interrupt Mask Set */ 448/* Extended Interrupt Mask Set */
454#define E1000_EIMS_TCP_TIMER E1000_EICR_TCP_TIMER /* TCP Timer */ 449#define E1000_EIMS_TCP_TIMER E1000_EICR_TCP_TIMER /* TCP Timer */
@@ -457,12 +452,6 @@
457/* Interrupt Cause Set */ 452/* Interrupt Cause Set */
458#define E1000_ICS_LSC E1000_ICR_LSC /* Link Status Change */ 453#define E1000_ICS_LSC E1000_ICR_LSC /* Link Status Change */
459#define E1000_ICS_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */ 454#define E1000_ICS_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */
460/* queue 0 Rx descriptor FIFO parity error */
461/* queue 0 Tx descriptor FIFO parity error */
462/* host arb read buffer parity error */
463/* packet buffer parity error */
464/* queue 1 Rx descriptor FIFO parity error */
465/* queue 1 Tx descriptor FIFO parity error */
466 455
467/* Extended Interrupt Cause Set */ 456/* Extended Interrupt Cause Set */
468 457
@@ -567,7 +556,6 @@
567/* 1000BASE-T Control Register */ 556/* 1000BASE-T Control Register */
568#define CR_1000T_HD_CAPS 0x0100 /* Advertise 1000T HD capability */ 557#define CR_1000T_HD_CAPS 0x0100 /* Advertise 1000T HD capability */
569#define CR_1000T_FD_CAPS 0x0200 /* Advertise 1000T FD capability */ 558#define CR_1000T_FD_CAPS 0x0200 /* Advertise 1000T FD capability */
570 /* 0=DTE device */
571#define CR_1000T_MS_VALUE 0x0800 /* 1=Configure PHY as Master */ 559#define CR_1000T_MS_VALUE 0x0800 /* 1=Configure PHY as Master */
572 /* 0=Configure PHY as Slave */ 560 /* 0=Configure PHY as Slave */
573#define CR_1000T_MS_ENABLE 0x1000 /* 1=Master/Slave manual config value */ 561#define CR_1000T_MS_ENABLE 0x1000 /* 1=Master/Slave manual config value */
@@ -581,7 +569,7 @@
581/* PHY 1000 MII Register/Bit Definitions */ 569/* PHY 1000 MII Register/Bit Definitions */
582/* PHY Registers defined by IEEE */ 570/* PHY Registers defined by IEEE */
583#define PHY_CONTROL 0x00 /* Control Register */ 571#define PHY_CONTROL 0x00 /* Control Register */
584#define PHY_STATUS 0x01 /* Status Regiser */ 572#define PHY_STATUS 0x01 /* Status Register */
585#define PHY_ID1 0x02 /* Phy Id Reg (word 1) */ 573#define PHY_ID1 0x02 /* Phy Id Reg (word 1) */
586#define PHY_ID2 0x03 /* Phy Id Reg (word 2) */ 574#define PHY_ID2 0x03 /* Phy Id Reg (word 2) */
587#define PHY_AUTONEG_ADV 0x04 /* Autoneg Advertisement */ 575#define PHY_AUTONEG_ADV 0x04 /* Autoneg Advertisement */
@@ -708,8 +696,8 @@
708/* Auto crossover enabled all speeds */ 696/* Auto crossover enabled all speeds */
709#define M88E1000_PSCR_AUTO_X_MODE 0x0060 697#define M88E1000_PSCR_AUTO_X_MODE 0x0060
710/* 698/*
711 * 1=Enable Extended 10BASE-T distance (Lower 10BASE-T RX Threshold 699 * 1=Enable Extended 10BASE-T distance (Lower 10BASE-T Rx Threshold
712 * 0=Normal 10BASE-T RX Threshold 700 * 0=Normal 10BASE-T Rx Threshold
713 */ 701 */
714/* 1=5-bit interface in 100BASE-TX, 0=MII interface in 100BASE-TX */ 702/* 1=5-bit interface in 100BASE-TX, 0=MII interface in 100BASE-TX */
715#define M88E1000_PSCR_ASSERT_CRS_ON_TX 0x0800 /* 1=Assert CRS on Transmit */ 703#define M88E1000_PSCR_ASSERT_CRS_ON_TX 0x0800 /* 1=Assert CRS on Transmit */
diff --git a/drivers/net/igb/e1000_hw.h b/drivers/net/igb/e1000_hw.h
index 7b2c70a3b8cc..746c3ea09e27 100644
--- a/drivers/net/igb/e1000_hw.h
+++ b/drivers/net/igb/e1000_hw.h
@@ -586,14 +586,10 @@ struct e1000_hw {
586 586
587#ifdef DEBUG 587#ifdef DEBUG
588extern char *igb_get_hw_dev_name(struct e1000_hw *hw); 588extern char *igb_get_hw_dev_name(struct e1000_hw *hw);
589#define hw_dbg(hw, format, arg...) \ 589#define hw_dbg(format, arg...) \
590 printk(KERN_DEBUG "%s: " format, igb_get_hw_dev_name(hw), ##arg) 590 printk(KERN_DEBUG "%s: " format, igb_get_hw_dev_name(hw), ##arg)
591#else 591#else
592static inline int __attribute__ ((format (printf, 2, 3))) 592#define hw_dbg(format, arg...)
593hw_dbg(struct e1000_hw *hw, const char *format, ...)
594{
595 return 0;
596}
597#endif 593#endif
598 594
599#endif 595#endif
diff --git a/drivers/net/igb/e1000_mac.c b/drivers/net/igb/e1000_mac.c
index 3e84a3f0c1d8..47ad2c4277c3 100644
--- a/drivers/net/igb/e1000_mac.c
+++ b/drivers/net/igb/e1000_mac.c
@@ -39,7 +39,7 @@ static s32 igb_set_fc_watermarks(struct e1000_hw *hw);
39static u32 igb_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr); 39static u32 igb_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr);
40 40
41/** 41/**
42 * e1000_remove_device - Free device specific structure 42 * igb_remove_device - Free device specific structure
43 * @hw: pointer to the HW structure 43 * @hw: pointer to the HW structure
44 * 44 *
45 * If a device specific structure was allocated, this function will 45 * If a device specific structure was allocated, this function will
@@ -73,7 +73,7 @@ static s32 igb_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value)
73} 73}
74 74
75/** 75/**
76 * e1000_get_bus_info_pcie - Get PCIe bus information 76 * igb_get_bus_info_pcie - Get PCIe bus information
77 * @hw: pointer to the HW structure 77 * @hw: pointer to the HW structure
78 * 78 *
79 * Determines and stores the system bus information for a particular 79 * Determines and stores the system bus information for a particular
@@ -113,7 +113,7 @@ s32 igb_get_bus_info_pcie(struct e1000_hw *hw)
113} 113}
114 114
115/** 115/**
116 * e1000_clear_vfta - Clear VLAN filter table 116 * igb_clear_vfta - Clear VLAN filter table
117 * @hw: pointer to the HW structure 117 * @hw: pointer to the HW structure
118 * 118 *
119 * Clears the register array which contains the VLAN filter table by 119 * Clears the register array which contains the VLAN filter table by
@@ -130,7 +130,7 @@ void igb_clear_vfta(struct e1000_hw *hw)
130} 130}
131 131
132/** 132/**
133 * e1000_write_vfta - Write value to VLAN filter table 133 * igb_write_vfta - Write value to VLAN filter table
134 * @hw: pointer to the HW structure 134 * @hw: pointer to the HW structure
135 * @offset: register offset in VLAN filter table 135 * @offset: register offset in VLAN filter table
136 * @value: register value written to VLAN filter table 136 * @value: register value written to VLAN filter table
@@ -145,7 +145,7 @@ void igb_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
145} 145}
146 146
147/** 147/**
148 * e1000_init_rx_addrs - Initialize receive address's 148 * igb_init_rx_addrs - Initialize receive address's
149 * @hw: pointer to the HW structure 149 * @hw: pointer to the HW structure
150 * @rar_count: receive address registers 150 * @rar_count: receive address registers
151 * 151 *
@@ -158,12 +158,12 @@ void igb_init_rx_addrs(struct e1000_hw *hw, u16 rar_count)
158 u32 i; 158 u32 i;
159 159
160 /* Setup the receive address */ 160 /* Setup the receive address */
161 hw_dbg(hw, "Programming MAC Address into RAR[0]\n"); 161 hw_dbg("Programming MAC Address into RAR[0]\n");
162 162
163 hw->mac.ops.rar_set(hw, hw->mac.addr, 0); 163 hw->mac.ops.rar_set(hw, hw->mac.addr, 0);
164 164
165 /* Zero out the other (rar_entry_count - 1) receive addresses */ 165 /* Zero out the other (rar_entry_count - 1) receive addresses */
166 hw_dbg(hw, "Clearing RAR[1-%u]\n", rar_count-1); 166 hw_dbg("Clearing RAR[1-%u]\n", rar_count-1);
167 for (i = 1; i < rar_count; i++) { 167 for (i = 1; i < rar_count; i++) {
168 array_wr32(E1000_RA, (i << 1), 0); 168 array_wr32(E1000_RA, (i << 1), 0);
169 wrfl(); 169 wrfl();
@@ -173,7 +173,7 @@ void igb_init_rx_addrs(struct e1000_hw *hw, u16 rar_count)
173} 173}
174 174
175/** 175/**
176 * e1000_check_alt_mac_addr - Check for alternate MAC addr 176 * igb_check_alt_mac_addr - Check for alternate MAC addr
177 * @hw: pointer to the HW structure 177 * @hw: pointer to the HW structure
178 * 178 *
179 * Checks the nvm for an alternate MAC address. An alternate MAC address 179 * Checks the nvm for an alternate MAC address. An alternate MAC address
@@ -193,7 +193,7 @@ s32 igb_check_alt_mac_addr(struct e1000_hw *hw)
193 ret_val = hw->nvm.ops.read_nvm(hw, NVM_ALT_MAC_ADDR_PTR, 1, 193 ret_val = hw->nvm.ops.read_nvm(hw, NVM_ALT_MAC_ADDR_PTR, 1,
194 &nvm_alt_mac_addr_offset); 194 &nvm_alt_mac_addr_offset);
195 if (ret_val) { 195 if (ret_val) {
196 hw_dbg(hw, "NVM Read Error\n"); 196 hw_dbg("NVM Read Error\n");
197 goto out; 197 goto out;
198 } 198 }
199 199
@@ -209,7 +209,7 @@ s32 igb_check_alt_mac_addr(struct e1000_hw *hw)
209 offset = nvm_alt_mac_addr_offset + (i >> 1); 209 offset = nvm_alt_mac_addr_offset + (i >> 1);
210 ret_val = hw->nvm.ops.read_nvm(hw, offset, 1, &nvm_data); 210 ret_val = hw->nvm.ops.read_nvm(hw, offset, 1, &nvm_data);
211 if (ret_val) { 211 if (ret_val) {
212 hw_dbg(hw, "NVM Read Error\n"); 212 hw_dbg("NVM Read Error\n");
213 goto out; 213 goto out;
214 } 214 }
215 215
@@ -233,7 +233,7 @@ out:
233} 233}
234 234
235/** 235/**
236 * e1000_rar_set - Set receive address register 236 * igb_rar_set - Set receive address register
237 * @hw: pointer to the HW structure 237 * @hw: pointer to the HW structure
238 * @addr: pointer to the receive address 238 * @addr: pointer to the receive address
239 * @index: receive address array register 239 * @index: receive address array register
@@ -263,7 +263,7 @@ void igb_rar_set(struct e1000_hw *hw, u8 *addr, u32 index)
263} 263}
264 264
265/** 265/**
266 * e1000_mta_set - Set multicast filter table address 266 * igb_mta_set - Set multicast filter table address
267 * @hw: pointer to the HW structure 267 * @hw: pointer to the HW structure
268 * @hash_value: determines the MTA register and bit to set 268 * @hash_value: determines the MTA register and bit to set
269 * 269 *
@@ -298,7 +298,7 @@ static void igb_mta_set(struct e1000_hw *hw, u32 hash_value)
298} 298}
299 299
300/** 300/**
301 * e1000_update_mc_addr_list - Update Multicast addresses 301 * igb_update_mc_addr_list - Update Multicast addresses
302 * @hw: pointer to the HW structure 302 * @hw: pointer to the HW structure
303 * @mc_addr_list: array of multicast addresses to program 303 * @mc_addr_list: array of multicast addresses to program
304 * @mc_addr_count: number of multicast addresses to program 304 * @mc_addr_count: number of multicast addresses to program
@@ -336,7 +336,7 @@ void igb_update_mc_addr_list(struct e1000_hw *hw,
336 } 336 }
337 337
338 /* Clear the old settings from the MTA */ 338 /* Clear the old settings from the MTA */
339 hw_dbg(hw, "Clearing MTA\n"); 339 hw_dbg("Clearing MTA\n");
340 for (i = 0; i < hw->mac.mta_reg_count; i++) { 340 for (i = 0; i < hw->mac.mta_reg_count; i++) {
341 array_wr32(E1000_MTA, i, 0); 341 array_wr32(E1000_MTA, i, 0);
342 wrfl(); 342 wrfl();
@@ -345,14 +345,14 @@ void igb_update_mc_addr_list(struct e1000_hw *hw,
345 /* Load any remaining multicast addresses into the hash table. */ 345 /* Load any remaining multicast addresses into the hash table. */
346 for (; mc_addr_count > 0; mc_addr_count--) { 346 for (; mc_addr_count > 0; mc_addr_count--) {
347 hash_value = igb_hash_mc_addr(hw, mc_addr_list); 347 hash_value = igb_hash_mc_addr(hw, mc_addr_list);
348 hw_dbg(hw, "Hash value = 0x%03X\n", hash_value); 348 hw_dbg("Hash value = 0x%03X\n", hash_value);
349 igb_mta_set(hw, hash_value); 349 igb_mta_set(hw, hash_value);
350 mc_addr_list += ETH_ALEN; 350 mc_addr_list += ETH_ALEN;
351 } 351 }
352} 352}
353 353
354/** 354/**
355 * e1000_hash_mc_addr - Generate a multicast hash value 355 * igb_hash_mc_addr - Generate a multicast hash value
356 * @hw: pointer to the HW structure 356 * @hw: pointer to the HW structure
357 * @mc_addr: pointer to a multicast address 357 * @mc_addr: pointer to a multicast address
358 * 358 *
@@ -423,7 +423,7 @@ static u32 igb_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr)
423} 423}
424 424
425/** 425/**
426 * e1000_clear_hw_cntrs_base - Clear base hardware counters 426 * igb_clear_hw_cntrs_base - Clear base hardware counters
427 * @hw: pointer to the HW structure 427 * @hw: pointer to the HW structure
428 * 428 *
429 * Clears the base hardware counters by reading the counter registers. 429 * Clears the base hardware counters by reading the counter registers.
@@ -472,7 +472,7 @@ void igb_clear_hw_cntrs_base(struct e1000_hw *hw)
472} 472}
473 473
474/** 474/**
475 * e1000_check_for_copper_link - Check for link (Copper) 475 * igb_check_for_copper_link - Check for link (Copper)
476 * @hw: pointer to the HW structure 476 * @hw: pointer to the HW structure
477 * 477 *
478 * Checks to see of the link status of the hardware has changed. If a 478 * Checks to see of the link status of the hardware has changed. If a
@@ -540,14 +540,14 @@ s32 igb_check_for_copper_link(struct e1000_hw *hw)
540 */ 540 */
541 ret_val = igb_config_fc_after_link_up(hw); 541 ret_val = igb_config_fc_after_link_up(hw);
542 if (ret_val) 542 if (ret_val)
543 hw_dbg(hw, "Error configuring flow control\n"); 543 hw_dbg("Error configuring flow control\n");
544 544
545out: 545out:
546 return ret_val; 546 return ret_val;
547} 547}
548 548
549/** 549/**
550 * e1000_setup_link - Setup flow control and link settings 550 * igb_setup_link - Setup flow control and link settings
551 * @hw: pointer to the HW structure 551 * @hw: pointer to the HW structure
552 * 552 *
553 * Determines which flow control settings to use, then configures flow 553 * Determines which flow control settings to use, then configures flow
@@ -578,7 +578,7 @@ s32 igb_setup_link(struct e1000_hw *hw)
578 */ 578 */
579 hw->fc.original_type = hw->fc.type; 579 hw->fc.original_type = hw->fc.type;
580 580
581 hw_dbg(hw, "After fix-ups FlowControl is now = %x\n", hw->fc.type); 581 hw_dbg("After fix-ups FlowControl is now = %x\n", hw->fc.type);
582 582
583 /* Call the necessary media_type subroutine to configure the link. */ 583 /* Call the necessary media_type subroutine to configure the link. */
584 ret_val = hw->mac.ops.setup_physical_interface(hw); 584 ret_val = hw->mac.ops.setup_physical_interface(hw);
@@ -591,8 +591,7 @@ s32 igb_setup_link(struct e1000_hw *hw)
591 * control is disabled, because it does not hurt anything to 591 * control is disabled, because it does not hurt anything to
592 * initialize these registers. 592 * initialize these registers.
593 */ 593 */
594 hw_dbg(hw, 594 hw_dbg("Initializing the Flow Control address, type and timer regs\n");
595 "Initializing the Flow Control address, type and timer regs\n");
596 wr32(E1000_FCT, FLOW_CONTROL_TYPE); 595 wr32(E1000_FCT, FLOW_CONTROL_TYPE);
597 wr32(E1000_FCAH, FLOW_CONTROL_ADDRESS_HIGH); 596 wr32(E1000_FCAH, FLOW_CONTROL_ADDRESS_HIGH);
598 wr32(E1000_FCAL, FLOW_CONTROL_ADDRESS_LOW); 597 wr32(E1000_FCAL, FLOW_CONTROL_ADDRESS_LOW);
@@ -606,7 +605,7 @@ out:
606} 605}
607 606
608/** 607/**
609 * e1000_config_collision_dist - Configure collision distance 608 * igb_config_collision_dist - Configure collision distance
610 * @hw: pointer to the HW structure 609 * @hw: pointer to the HW structure
611 * 610 *
612 * Configures the collision distance to the default value and is used 611 * Configures the collision distance to the default value and is used
@@ -627,7 +626,7 @@ void igb_config_collision_dist(struct e1000_hw *hw)
627} 626}
628 627
629/** 628/**
630 * e1000_set_fc_watermarks - Set flow control high/low watermarks 629 * igb_set_fc_watermarks - Set flow control high/low watermarks
631 * @hw: pointer to the HW structure 630 * @hw: pointer to the HW structure
632 * 631 *
633 * Sets the flow control high/low threshold (watermark) registers. If 632 * Sets the flow control high/low threshold (watermark) registers. If
@@ -665,7 +664,7 @@ static s32 igb_set_fc_watermarks(struct e1000_hw *hw)
665} 664}
666 665
667/** 666/**
668 * e1000_set_default_fc - Set flow control default values 667 * igb_set_default_fc - Set flow control default values
669 * @hw: pointer to the HW structure 668 * @hw: pointer to the HW structure
670 * 669 *
671 * Read the EEPROM for the default values for flow control and store the 670 * Read the EEPROM for the default values for flow control and store the
@@ -689,7 +688,7 @@ static s32 igb_set_default_fc(struct e1000_hw *hw)
689 &nvm_data); 688 &nvm_data);
690 689
691 if (ret_val) { 690 if (ret_val) {
692 hw_dbg(hw, "NVM Read Error\n"); 691 hw_dbg("NVM Read Error\n");
693 goto out; 692 goto out;
694 } 693 }
695 694
@@ -706,7 +705,7 @@ out:
706} 705}
707 706
708/** 707/**
709 * e1000_force_mac_fc - Force the MAC's flow control settings 708 * igb_force_mac_fc - Force the MAC's flow control settings
710 * @hw: pointer to the HW structure 709 * @hw: pointer to the HW structure
711 * 710 *
712 * Force the MAC's flow control settings. Sets the TFCE and RFCE bits in the 711 * Force the MAC's flow control settings. Sets the TFCE and RFCE bits in the
@@ -740,7 +739,7 @@ s32 igb_force_mac_fc(struct e1000_hw *hw)
740 * 3: Both Rx and TX flow control (symmetric) is enabled. 739 * 3: Both Rx and TX flow control (symmetric) is enabled.
741 * other: No other values should be possible at this point. 740 * other: No other values should be possible at this point.
742 */ 741 */
743 hw_dbg(hw, "hw->fc.type = %u\n", hw->fc.type); 742 hw_dbg("hw->fc.type = %u\n", hw->fc.type);
744 743
745 switch (hw->fc.type) { 744 switch (hw->fc.type) {
746 case e1000_fc_none: 745 case e1000_fc_none:
@@ -758,7 +757,7 @@ s32 igb_force_mac_fc(struct e1000_hw *hw)
758 ctrl |= (E1000_CTRL_TFCE | E1000_CTRL_RFCE); 757 ctrl |= (E1000_CTRL_TFCE | E1000_CTRL_RFCE);
759 break; 758 break;
760 default: 759 default:
761 hw_dbg(hw, "Flow control param set incorrectly\n"); 760 hw_dbg("Flow control param set incorrectly\n");
762 ret_val = -E1000_ERR_CONFIG; 761 ret_val = -E1000_ERR_CONFIG;
763 goto out; 762 goto out;
764 } 763 }
@@ -770,7 +769,7 @@ out:
770} 769}
771 770
772/** 771/**
773 * e1000_config_fc_after_link_up - Configures flow control after link 772 * igb_config_fc_after_link_up - Configures flow control after link
774 * @hw: pointer to the HW structure 773 * @hw: pointer to the HW structure
775 * 774 *
776 * Checks the status of auto-negotiation after link up to ensure that the 775 * Checks the status of auto-negotiation after link up to ensure that the
@@ -801,7 +800,7 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)
801 } 800 }
802 801
803 if (ret_val) { 802 if (ret_val) {
804 hw_dbg(hw, "Error forcing flow control settings\n"); 803 hw_dbg("Error forcing flow control settings\n");
805 goto out; 804 goto out;
806 } 805 }
807 806
@@ -827,7 +826,7 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)
827 goto out; 826 goto out;
828 827
829 if (!(mii_status_reg & MII_SR_AUTONEG_COMPLETE)) { 828 if (!(mii_status_reg & MII_SR_AUTONEG_COMPLETE)) {
830 hw_dbg(hw, "Copper PHY and Auto Neg " 829 hw_dbg("Copper PHY and Auto Neg "
831 "has not completed.\n"); 830 "has not completed.\n");
832 goto out; 831 goto out;
833 } 832 }
@@ -893,11 +892,11 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)
893 */ 892 */
894 if (hw->fc.original_type == e1000_fc_full) { 893 if (hw->fc.original_type == e1000_fc_full) {
895 hw->fc.type = e1000_fc_full; 894 hw->fc.type = e1000_fc_full;
896 hw_dbg(hw, "Flow Control = FULL.\r\n"); 895 hw_dbg("Flow Control = FULL.\r\n");
897 } else { 896 } else {
898 hw->fc.type = e1000_fc_rx_pause; 897 hw->fc.type = e1000_fc_rx_pause;
899 hw_dbg(hw, "Flow Control = " 898 hw_dbg("Flow Control = "
900 "RX PAUSE frames only.\r\n"); 899 "RX PAUSE frames only.\r\n");
901 } 900 }
902 } 901 }
903 /* 902 /*
@@ -913,7 +912,7 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)
913 (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && 912 (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) &&
914 (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { 913 (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) {
915 hw->fc.type = e1000_fc_tx_pause; 914 hw->fc.type = e1000_fc_tx_pause;
916 hw_dbg(hw, "Flow Control = TX PAUSE frames only.\r\n"); 915 hw_dbg("Flow Control = TX PAUSE frames only.\r\n");
917 } 916 }
918 /* 917 /*
919 * For transmitting PAUSE frames ONLY. 918 * For transmitting PAUSE frames ONLY.
@@ -928,7 +927,7 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)
928 !(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && 927 !(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) &&
929 (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { 928 (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) {
930 hw->fc.type = e1000_fc_rx_pause; 929 hw->fc.type = e1000_fc_rx_pause;
931 hw_dbg(hw, "Flow Control = RX PAUSE frames only.\r\n"); 930 hw_dbg("Flow Control = RX PAUSE frames only.\r\n");
932 } 931 }
933 /* 932 /*
934 * Per the IEEE spec, at this point flow control should be 933 * Per the IEEE spec, at this point flow control should be
@@ -955,10 +954,10 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)
955 hw->fc.original_type == e1000_fc_tx_pause) || 954 hw->fc.original_type == e1000_fc_tx_pause) ||
956 hw->fc.strict_ieee) { 955 hw->fc.strict_ieee) {
957 hw->fc.type = e1000_fc_none; 956 hw->fc.type = e1000_fc_none;
958 hw_dbg(hw, "Flow Control = NONE.\r\n"); 957 hw_dbg("Flow Control = NONE.\r\n");
959 } else { 958 } else {
960 hw->fc.type = e1000_fc_rx_pause; 959 hw->fc.type = e1000_fc_rx_pause;
961 hw_dbg(hw, "Flow Control = RX PAUSE frames only.\r\n"); 960 hw_dbg("Flow Control = RX PAUSE frames only.\r\n");
962 } 961 }
963 962
964 /* 963 /*
@@ -968,7 +967,7 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)
968 */ 967 */
969 ret_val = hw->mac.ops.get_speed_and_duplex(hw, &speed, &duplex); 968 ret_val = hw->mac.ops.get_speed_and_duplex(hw, &speed, &duplex);
970 if (ret_val) { 969 if (ret_val) {
971 hw_dbg(hw, "Error getting link speed and duplex\n"); 970 hw_dbg("Error getting link speed and duplex\n");
972 goto out; 971 goto out;
973 } 972 }
974 973
@@ -981,7 +980,7 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)
981 */ 980 */
982 ret_val = igb_force_mac_fc(hw); 981 ret_val = igb_force_mac_fc(hw);
983 if (ret_val) { 982 if (ret_val) {
984 hw_dbg(hw, "Error forcing flow control settings\n"); 983 hw_dbg("Error forcing flow control settings\n");
985 goto out; 984 goto out;
986 } 985 }
987 } 986 }
@@ -991,7 +990,7 @@ out:
991} 990}
992 991
993/** 992/**
994 * e1000_get_speed_and_duplex_copper - Retreive current speed/duplex 993 * igb_get_speed_and_duplex_copper - Retreive current speed/duplex
995 * @hw: pointer to the HW structure 994 * @hw: pointer to the HW structure
996 * @speed: stores the current speed 995 * @speed: stores the current speed
997 * @duplex: stores the current duplex 996 * @duplex: stores the current duplex
@@ -1007,28 +1006,28 @@ s32 igb_get_speed_and_duplex_copper(struct e1000_hw *hw, u16 *speed,
1007 status = rd32(E1000_STATUS); 1006 status = rd32(E1000_STATUS);
1008 if (status & E1000_STATUS_SPEED_1000) { 1007 if (status & E1000_STATUS_SPEED_1000) {
1009 *speed = SPEED_1000; 1008 *speed = SPEED_1000;
1010 hw_dbg(hw, "1000 Mbs, "); 1009 hw_dbg("1000 Mbs, ");
1011 } else if (status & E1000_STATUS_SPEED_100) { 1010 } else if (status & E1000_STATUS_SPEED_100) {
1012 *speed = SPEED_100; 1011 *speed = SPEED_100;
1013 hw_dbg(hw, "100 Mbs, "); 1012 hw_dbg("100 Mbs, ");
1014 } else { 1013 } else {
1015 *speed = SPEED_10; 1014 *speed = SPEED_10;
1016 hw_dbg(hw, "10 Mbs, "); 1015 hw_dbg("10 Mbs, ");
1017 } 1016 }
1018 1017
1019 if (status & E1000_STATUS_FD) { 1018 if (status & E1000_STATUS_FD) {
1020 *duplex = FULL_DUPLEX; 1019 *duplex = FULL_DUPLEX;
1021 hw_dbg(hw, "Full Duplex\n"); 1020 hw_dbg("Full Duplex\n");
1022 } else { 1021 } else {
1023 *duplex = HALF_DUPLEX; 1022 *duplex = HALF_DUPLEX;
1024 hw_dbg(hw, "Half Duplex\n"); 1023 hw_dbg("Half Duplex\n");
1025 } 1024 }
1026 1025
1027 return 0; 1026 return 0;
1028} 1027}
1029 1028
1030/** 1029/**
1031 * e1000_get_hw_semaphore - Acquire hardware semaphore 1030 * igb_get_hw_semaphore - Acquire hardware semaphore
1032 * @hw: pointer to the HW structure 1031 * @hw: pointer to the HW structure
1033 * 1032 *
1034 * Acquire the HW semaphore to access the PHY or NVM 1033 * Acquire the HW semaphore to access the PHY or NVM
@@ -1051,7 +1050,7 @@ s32 igb_get_hw_semaphore(struct e1000_hw *hw)
1051 } 1050 }
1052 1051
1053 if (i == timeout) { 1052 if (i == timeout) {
1054 hw_dbg(hw, "Driver can't access device - SMBI bit is set.\n"); 1053 hw_dbg("Driver can't access device - SMBI bit is set.\n");
1055 ret_val = -E1000_ERR_NVM; 1054 ret_val = -E1000_ERR_NVM;
1056 goto out; 1055 goto out;
1057 } 1056 }
@@ -1071,7 +1070,7 @@ s32 igb_get_hw_semaphore(struct e1000_hw *hw)
1071 if (i == timeout) { 1070 if (i == timeout) {
1072 /* Release semaphores */ 1071 /* Release semaphores */
1073 igb_put_hw_semaphore(hw); 1072 igb_put_hw_semaphore(hw);
1074 hw_dbg(hw, "Driver can't access the NVM\n"); 1073 hw_dbg("Driver can't access the NVM\n");
1075 ret_val = -E1000_ERR_NVM; 1074 ret_val = -E1000_ERR_NVM;
1076 goto out; 1075 goto out;
1077 } 1076 }
@@ -1081,7 +1080,7 @@ out:
1081} 1080}
1082 1081
1083/** 1082/**
1084 * e1000_put_hw_semaphore - Release hardware semaphore 1083 * igb_put_hw_semaphore - Release hardware semaphore
1085 * @hw: pointer to the HW structure 1084 * @hw: pointer to the HW structure
1086 * 1085 *
1087 * Release hardware semaphore used to access the PHY or NVM 1086 * Release hardware semaphore used to access the PHY or NVM
@@ -1098,7 +1097,7 @@ void igb_put_hw_semaphore(struct e1000_hw *hw)
1098} 1097}
1099 1098
1100/** 1099/**
1101 * e1000_get_auto_rd_done - Check for auto read completion 1100 * igb_get_auto_rd_done - Check for auto read completion
1102 * @hw: pointer to the HW structure 1101 * @hw: pointer to the HW structure
1103 * 1102 *
1104 * Check EEPROM for Auto Read done bit. 1103 * Check EEPROM for Auto Read done bit.
@@ -1117,7 +1116,7 @@ s32 igb_get_auto_rd_done(struct e1000_hw *hw)
1117 } 1116 }
1118 1117
1119 if (i == AUTO_READ_DONE_TIMEOUT) { 1118 if (i == AUTO_READ_DONE_TIMEOUT) {
1120 hw_dbg(hw, "Auto read by HW from NVM has not completed.\n"); 1119 hw_dbg("Auto read by HW from NVM has not completed.\n");
1121 ret_val = -E1000_ERR_RESET; 1120 ret_val = -E1000_ERR_RESET;
1122 goto out; 1121 goto out;
1123 } 1122 }
@@ -1127,7 +1126,7 @@ out:
1127} 1126}
1128 1127
1129/** 1128/**
1130 * e1000_valid_led_default - Verify a valid default LED config 1129 * igb_valid_led_default - Verify a valid default LED config
1131 * @hw: pointer to the HW structure 1130 * @hw: pointer to the HW structure
1132 * @data: pointer to the NVM (EEPROM) 1131 * @data: pointer to the NVM (EEPROM)
1133 * 1132 *
@@ -1140,7 +1139,7 @@ static s32 igb_valid_led_default(struct e1000_hw *hw, u16 *data)
1140 1139
1141 ret_val = hw->nvm.ops.read_nvm(hw, NVM_ID_LED_SETTINGS, 1, data); 1140 ret_val = hw->nvm.ops.read_nvm(hw, NVM_ID_LED_SETTINGS, 1, data);
1142 if (ret_val) { 1141 if (ret_val) {
1143 hw_dbg(hw, "NVM Read Error\n"); 1142 hw_dbg("NVM Read Error\n");
1144 goto out; 1143 goto out;
1145 } 1144 }
1146 1145
@@ -1152,7 +1151,7 @@ out:
1152} 1151}
1153 1152
1154/** 1153/**
1155 * e1000_id_led_init - 1154 * igb_id_led_init -
1156 * @hw: pointer to the HW structure 1155 * @hw: pointer to the HW structure
1157 * 1156 *
1158 **/ 1157 **/
@@ -1217,7 +1216,7 @@ out:
1217} 1216}
1218 1217
1219/** 1218/**
1220 * e1000_cleanup_led - Set LED config to default operation 1219 * igb_cleanup_led - Set LED config to default operation
1221 * @hw: pointer to the HW structure 1220 * @hw: pointer to the HW structure
1222 * 1221 *
1223 * Remove the current LED configuration and set the LED configuration 1222 * Remove the current LED configuration and set the LED configuration
@@ -1230,7 +1229,7 @@ s32 igb_cleanup_led(struct e1000_hw *hw)
1230} 1229}
1231 1230
1232/** 1231/**
1233 * e1000_blink_led - Blink LED 1232 * igb_blink_led - Blink LED
1234 * @hw: pointer to the HW structure 1233 * @hw: pointer to the HW structure
1235 * 1234 *
1236 * Blink the led's which are set to be on. 1235 * Blink the led's which are set to be on.
@@ -1263,7 +1262,7 @@ s32 igb_blink_led(struct e1000_hw *hw)
1263} 1262}
1264 1263
1265/** 1264/**
1266 * e1000_led_off - Turn LED off 1265 * igb_led_off - Turn LED off
1267 * @hw: pointer to the HW structure 1266 * @hw: pointer to the HW structure
1268 * 1267 *
1269 * Turn LED off. 1268 * Turn LED off.
@@ -1290,7 +1289,7 @@ s32 igb_led_off(struct e1000_hw *hw)
1290} 1289}
1291 1290
1292/** 1291/**
1293 * e1000_disable_pcie_master - Disables PCI-express master access 1292 * igb_disable_pcie_master - Disables PCI-express master access
1294 * @hw: pointer to the HW structure 1293 * @hw: pointer to the HW structure
1295 * 1294 *
1296 * Returns 0 (0) if successful, else returns -10 1295 * Returns 0 (0) if successful, else returns -10
@@ -1322,7 +1321,7 @@ s32 igb_disable_pcie_master(struct e1000_hw *hw)
1322 } 1321 }
1323 1322
1324 if (!timeout) { 1323 if (!timeout) {
1325 hw_dbg(hw, "Master requests are pending.\n"); 1324 hw_dbg("Master requests are pending.\n");
1326 ret_val = -E1000_ERR_MASTER_REQUESTS_PENDING; 1325 ret_val = -E1000_ERR_MASTER_REQUESTS_PENDING;
1327 goto out; 1326 goto out;
1328 } 1327 }
@@ -1332,7 +1331,7 @@ out:
1332} 1331}
1333 1332
1334/** 1333/**
1335 * e1000_reset_adaptive - Reset Adaptive Interframe Spacing 1334 * igb_reset_adaptive - Reset Adaptive Interframe Spacing
1336 * @hw: pointer to the HW structure 1335 * @hw: pointer to the HW structure
1337 * 1336 *
1338 * Reset the Adaptive Interframe Spacing throttle to default values. 1337 * Reset the Adaptive Interframe Spacing throttle to default values.
@@ -1342,7 +1341,7 @@ void igb_reset_adaptive(struct e1000_hw *hw)
1342 struct e1000_mac_info *mac = &hw->mac; 1341 struct e1000_mac_info *mac = &hw->mac;
1343 1342
1344 if (!mac->adaptive_ifs) { 1343 if (!mac->adaptive_ifs) {
1345 hw_dbg(hw, "Not in Adaptive IFS mode!\n"); 1344 hw_dbg("Not in Adaptive IFS mode!\n");
1346 goto out; 1345 goto out;
1347 } 1346 }
1348 1347
@@ -1361,7 +1360,7 @@ out:
1361} 1360}
1362 1361
1363/** 1362/**
1364 * e1000_update_adaptive - Update Adaptive Interframe Spacing 1363 * igb_update_adaptive - Update Adaptive Interframe Spacing
1365 * @hw: pointer to the HW structure 1364 * @hw: pointer to the HW structure
1366 * 1365 *
1367 * Update the Adaptive Interframe Spacing Throttle value based on the 1366 * Update the Adaptive Interframe Spacing Throttle value based on the
@@ -1372,7 +1371,7 @@ void igb_update_adaptive(struct e1000_hw *hw)
1372 struct e1000_mac_info *mac = &hw->mac; 1371 struct e1000_mac_info *mac = &hw->mac;
1373 1372
1374 if (!mac->adaptive_ifs) { 1373 if (!mac->adaptive_ifs) {
1375 hw_dbg(hw, "Not in Adaptive IFS mode!\n"); 1374 hw_dbg("Not in Adaptive IFS mode!\n");
1376 goto out; 1375 goto out;
1377 } 1376 }
1378 1377
@@ -1402,7 +1401,7 @@ out:
1402} 1401}
1403 1402
1404/** 1403/**
1405 * e1000_validate_mdi_setting - Verify MDI/MDIx settings 1404 * igb_validate_mdi_setting - Verify MDI/MDIx settings
1406 * @hw: pointer to the HW structure 1405 * @hw: pointer to the HW structure
1407 * 1406 *
1408 * Verify that when not using auto-negotitation that MDI/MDIx is correctly 1407 * Verify that when not using auto-negotitation that MDI/MDIx is correctly
@@ -1413,7 +1412,7 @@ s32 igb_validate_mdi_setting(struct e1000_hw *hw)
1413 s32 ret_val = 0; 1412 s32 ret_val = 0;
1414 1413
1415 if (!hw->mac.autoneg && (hw->phy.mdix == 0 || hw->phy.mdix == 3)) { 1414 if (!hw->mac.autoneg && (hw->phy.mdix == 0 || hw->phy.mdix == 3)) {
1416 hw_dbg(hw, "Invalid MDI setting detected\n"); 1415 hw_dbg("Invalid MDI setting detected\n");
1417 hw->phy.mdix = 1; 1416 hw->phy.mdix = 1;
1418 ret_val = -E1000_ERR_CONFIG; 1417 ret_val = -E1000_ERR_CONFIG;
1419 goto out; 1418 goto out;
@@ -1424,7 +1423,7 @@ out:
1424} 1423}
1425 1424
1426/** 1425/**
1427 * e1000_write_8bit_ctrl_reg - Write a 8bit CTRL register 1426 * igb_write_8bit_ctrl_reg - Write a 8bit CTRL register
1428 * @hw: pointer to the HW structure 1427 * @hw: pointer to the HW structure
1429 * @reg: 32bit register offset such as E1000_SCTL 1428 * @reg: 32bit register offset such as E1000_SCTL
1430 * @offset: register offset to write to 1429 * @offset: register offset to write to
@@ -1452,7 +1451,7 @@ s32 igb_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg,
1452 break; 1451 break;
1453 } 1452 }
1454 if (!(regvalue & E1000_GEN_CTL_READY)) { 1453 if (!(regvalue & E1000_GEN_CTL_READY)) {
1455 hw_dbg(hw, "Reg %08x did not indicate ready\n", reg); 1454 hw_dbg("Reg %08x did not indicate ready\n", reg);
1456 ret_val = -E1000_ERR_PHY; 1455 ret_val = -E1000_ERR_PHY;
1457 goto out; 1456 goto out;
1458 } 1457 }
@@ -1462,7 +1461,7 @@ out:
1462} 1461}
1463 1462
1464/** 1463/**
1465 * e1000_enable_mng_pass_thru - Enable processing of ARP's 1464 * igb_enable_mng_pass_thru - Enable processing of ARP's
1466 * @hw: pointer to the HW structure 1465 * @hw: pointer to the HW structure
1467 * 1466 *
1468 * Verifies the hardware needs to allow ARPs to be processed by the host. 1467 * Verifies the hardware needs to allow ARPs to be processed by the host.
diff --git a/drivers/net/igb/e1000_nvm.c b/drivers/net/igb/e1000_nvm.c
index 2897106fee92..a84e4e429fa7 100644
--- a/drivers/net/igb/e1000_nvm.c
+++ b/drivers/net/igb/e1000_nvm.c
@@ -32,7 +32,7 @@
32#include "e1000_nvm.h" 32#include "e1000_nvm.h"
33 33
34/** 34/**
35 * e1000_raise_eec_clk - Raise EEPROM clock 35 * igb_raise_eec_clk - Raise EEPROM clock
36 * @hw: pointer to the HW structure 36 * @hw: pointer to the HW structure
37 * @eecd: pointer to the EEPROM 37 * @eecd: pointer to the EEPROM
38 * 38 *
@@ -47,7 +47,7 @@ static void igb_raise_eec_clk(struct e1000_hw *hw, u32 *eecd)
47} 47}
48 48
49/** 49/**
50 * e1000_lower_eec_clk - Lower EEPROM clock 50 * igb_lower_eec_clk - Lower EEPROM clock
51 * @hw: pointer to the HW structure 51 * @hw: pointer to the HW structure
52 * @eecd: pointer to the EEPROM 52 * @eecd: pointer to the EEPROM
53 * 53 *
@@ -62,7 +62,7 @@ static void igb_lower_eec_clk(struct e1000_hw *hw, u32 *eecd)
62} 62}
63 63
64/** 64/**
65 * e1000_shift_out_eec_bits - Shift data bits our to the EEPROM 65 * igb_shift_out_eec_bits - Shift data bits our to the EEPROM
66 * @hw: pointer to the HW structure 66 * @hw: pointer to the HW structure
67 * @data: data to send to the EEPROM 67 * @data: data to send to the EEPROM
68 * @count: number of bits to shift out 68 * @count: number of bits to shift out
@@ -105,7 +105,7 @@ static void igb_shift_out_eec_bits(struct e1000_hw *hw, u16 data, u16 count)
105} 105}
106 106
107/** 107/**
108 * e1000_shift_in_eec_bits - Shift data bits in from the EEPROM 108 * igb_shift_in_eec_bits - Shift data bits in from the EEPROM
109 * @hw: pointer to the HW structure 109 * @hw: pointer to the HW structure
110 * @count: number of bits to shift in 110 * @count: number of bits to shift in
111 * 111 *
@@ -143,7 +143,7 @@ static u16 igb_shift_in_eec_bits(struct e1000_hw *hw, u16 count)
143} 143}
144 144
145/** 145/**
146 * e1000_poll_eerd_eewr_done - Poll for EEPROM read/write completion 146 * igb_poll_eerd_eewr_done - Poll for EEPROM read/write completion
147 * @hw: pointer to the HW structure 147 * @hw: pointer to the HW structure
148 * @ee_reg: EEPROM flag for polling 148 * @ee_reg: EEPROM flag for polling
149 * 149 *
@@ -174,7 +174,7 @@ static s32 igb_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg)
174} 174}
175 175
176/** 176/**
177 * e1000_acquire_nvm - Generic request for access to EEPROM 177 * igb_acquire_nvm - Generic request for access to EEPROM
178 * @hw: pointer to the HW structure 178 * @hw: pointer to the HW structure
179 * 179 *
180 * Set the EEPROM access request bit and wait for EEPROM access grant bit. 180 * Set the EEPROM access request bit and wait for EEPROM access grant bit.
@@ -202,7 +202,7 @@ s32 igb_acquire_nvm(struct e1000_hw *hw)
202 if (!timeout) { 202 if (!timeout) {
203 eecd &= ~E1000_EECD_REQ; 203 eecd &= ~E1000_EECD_REQ;
204 wr32(E1000_EECD, eecd); 204 wr32(E1000_EECD, eecd);
205 hw_dbg(hw, "Could not acquire NVM grant\n"); 205 hw_dbg("Could not acquire NVM grant\n");
206 ret_val = -E1000_ERR_NVM; 206 ret_val = -E1000_ERR_NVM;
207 } 207 }
208 208
@@ -210,7 +210,7 @@ s32 igb_acquire_nvm(struct e1000_hw *hw)
210} 210}
211 211
212/** 212/**
213 * e1000_standby_nvm - Return EEPROM to standby state 213 * igb_standby_nvm - Return EEPROM to standby state
214 * @hw: pointer to the HW structure 214 * @hw: pointer to the HW structure
215 * 215 *
216 * Return the EEPROM to a standby state. 216 * Return the EEPROM to a standby state.
@@ -273,7 +273,7 @@ static void e1000_stop_nvm(struct e1000_hw *hw)
273} 273}
274 274
275/** 275/**
276 * e1000_release_nvm - Release exclusive access to EEPROM 276 * igb_release_nvm - Release exclusive access to EEPROM
277 * @hw: pointer to the HW structure 277 * @hw: pointer to the HW structure
278 * 278 *
279 * Stop any current commands to the EEPROM and clear the EEPROM request bit. 279 * Stop any current commands to the EEPROM and clear the EEPROM request bit.
@@ -290,7 +290,7 @@ void igb_release_nvm(struct e1000_hw *hw)
290} 290}
291 291
292/** 292/**
293 * e1000_ready_nvm_eeprom - Prepares EEPROM for read/write 293 * igb_ready_nvm_eeprom - Prepares EEPROM for read/write
294 * @hw: pointer to the HW structure 294 * @hw: pointer to the HW structure
295 * 295 *
296 * Setups the EEPROM for reading and writing. 296 * Setups the EEPROM for reading and writing.
@@ -337,7 +337,7 @@ static s32 igb_ready_nvm_eeprom(struct e1000_hw *hw)
337 } 337 }
338 338
339 if (!timeout) { 339 if (!timeout) {
340 hw_dbg(hw, "SPI NVM Status error\n"); 340 hw_dbg("SPI NVM Status error\n");
341 ret_val = -E1000_ERR_NVM; 341 ret_val = -E1000_ERR_NVM;
342 goto out; 342 goto out;
343 } 343 }
@@ -348,7 +348,7 @@ out:
348} 348}
349 349
350/** 350/**
351 * e1000_read_nvm_eerd - Reads EEPROM using EERD register 351 * igb_read_nvm_eerd - Reads EEPROM using EERD register
352 * @hw: pointer to the HW structure 352 * @hw: pointer to the HW structure
353 * @offset: offset of word in the EEPROM to read 353 * @offset: offset of word in the EEPROM to read
354 * @words: number of words to read 354 * @words: number of words to read
@@ -368,7 +368,7 @@ s32 igb_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
368 */ 368 */
369 if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) || 369 if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) ||
370 (words == 0)) { 370 (words == 0)) {
371 hw_dbg(hw, "nvm parameter(s) out of bounds\n"); 371 hw_dbg("nvm parameter(s) out of bounds\n");
372 ret_val = -E1000_ERR_NVM; 372 ret_val = -E1000_ERR_NVM;
373 goto out; 373 goto out;
374 } 374 }
@@ -391,7 +391,7 @@ out:
391} 391}
392 392
393/** 393/**
394 * e1000_write_nvm_spi - Write to EEPROM using SPI 394 * igb_write_nvm_spi - Write to EEPROM using SPI
395 * @hw: pointer to the HW structure 395 * @hw: pointer to the HW structure
396 * @offset: offset within the EEPROM to be written to 396 * @offset: offset within the EEPROM to be written to
397 * @words: number of words to write 397 * @words: number of words to write
@@ -414,7 +414,7 @@ s32 igb_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
414 */ 414 */
415 if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) || 415 if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) ||
416 (words == 0)) { 416 (words == 0)) {
417 hw_dbg(hw, "nvm parameter(s) out of bounds\n"); 417 hw_dbg("nvm parameter(s) out of bounds\n");
418 ret_val = -E1000_ERR_NVM; 418 ret_val = -E1000_ERR_NVM;
419 goto out; 419 goto out;
420 } 420 }
@@ -475,7 +475,7 @@ out:
475} 475}
476 476
477/** 477/**
478 * e1000_read_part_num - Read device part number 478 * igb_read_part_num - Read device part number
479 * @hw: pointer to the HW structure 479 * @hw: pointer to the HW structure
480 * @part_num: pointer to device part number 480 * @part_num: pointer to device part number
481 * 481 *
@@ -489,14 +489,14 @@ s32 igb_read_part_num(struct e1000_hw *hw, u32 *part_num)
489 489
490 ret_val = hw->nvm.ops.read_nvm(hw, NVM_PBA_OFFSET_0, 1, &nvm_data); 490 ret_val = hw->nvm.ops.read_nvm(hw, NVM_PBA_OFFSET_0, 1, &nvm_data);
491 if (ret_val) { 491 if (ret_val) {
492 hw_dbg(hw, "NVM Read Error\n"); 492 hw_dbg("NVM Read Error\n");
493 goto out; 493 goto out;
494 } 494 }
495 *part_num = (u32)(nvm_data << 16); 495 *part_num = (u32)(nvm_data << 16);
496 496
497 ret_val = hw->nvm.ops.read_nvm(hw, NVM_PBA_OFFSET_1, 1, &nvm_data); 497 ret_val = hw->nvm.ops.read_nvm(hw, NVM_PBA_OFFSET_1, 1, &nvm_data);
498 if (ret_val) { 498 if (ret_val) {
499 hw_dbg(hw, "NVM Read Error\n"); 499 hw_dbg("NVM Read Error\n");
500 goto out; 500 goto out;
501 } 501 }
502 *part_num |= nvm_data; 502 *part_num |= nvm_data;
@@ -506,7 +506,7 @@ out:
506} 506}
507 507
508/** 508/**
509 * e1000_read_mac_addr - Read device MAC address 509 * igb_read_mac_addr - Read device MAC address
510 * @hw: pointer to the HW structure 510 * @hw: pointer to the HW structure
511 * 511 *
512 * Reads the device MAC address from the EEPROM and stores the value. 512 * Reads the device MAC address from the EEPROM and stores the value.
@@ -522,7 +522,7 @@ s32 igb_read_mac_addr(struct e1000_hw *hw)
522 offset = i >> 1; 522 offset = i >> 1;
523 ret_val = hw->nvm.ops.read_nvm(hw, offset, 1, &nvm_data); 523 ret_val = hw->nvm.ops.read_nvm(hw, offset, 1, &nvm_data);
524 if (ret_val) { 524 if (ret_val) {
525 hw_dbg(hw, "NVM Read Error\n"); 525 hw_dbg("NVM Read Error\n");
526 goto out; 526 goto out;
527 } 527 }
528 hw->mac.perm_addr[i] = (u8)(nvm_data & 0xFF); 528 hw->mac.perm_addr[i] = (u8)(nvm_data & 0xFF);
@@ -541,7 +541,7 @@ out:
541} 541}
542 542
543/** 543/**
544 * e1000_validate_nvm_checksum - Validate EEPROM checksum 544 * igb_validate_nvm_checksum - Validate EEPROM checksum
545 * @hw: pointer to the HW structure 545 * @hw: pointer to the HW structure
546 * 546 *
547 * Calculates the EEPROM checksum by reading/adding each word of the EEPROM 547 * Calculates the EEPROM checksum by reading/adding each word of the EEPROM
@@ -556,14 +556,14 @@ s32 igb_validate_nvm_checksum(struct e1000_hw *hw)
556 for (i = 0; i < (NVM_CHECKSUM_REG + 1); i++) { 556 for (i = 0; i < (NVM_CHECKSUM_REG + 1); i++) {
557 ret_val = hw->nvm.ops.read_nvm(hw, i, 1, &nvm_data); 557 ret_val = hw->nvm.ops.read_nvm(hw, i, 1, &nvm_data);
558 if (ret_val) { 558 if (ret_val) {
559 hw_dbg(hw, "NVM Read Error\n"); 559 hw_dbg("NVM Read Error\n");
560 goto out; 560 goto out;
561 } 561 }
562 checksum += nvm_data; 562 checksum += nvm_data;
563 } 563 }
564 564
565 if (checksum != (u16) NVM_SUM) { 565 if (checksum != (u16) NVM_SUM) {
566 hw_dbg(hw, "NVM Checksum Invalid\n"); 566 hw_dbg("NVM Checksum Invalid\n");
567 ret_val = -E1000_ERR_NVM; 567 ret_val = -E1000_ERR_NVM;
568 goto out; 568 goto out;
569 } 569 }
@@ -573,7 +573,7 @@ out:
573} 573}
574 574
575/** 575/**
576 * e1000_update_nvm_checksum - Update EEPROM checksum 576 * igb_update_nvm_checksum - Update EEPROM checksum
577 * @hw: pointer to the HW structure 577 * @hw: pointer to the HW structure
578 * 578 *
579 * Updates the EEPROM checksum by reading/adding each word of the EEPROM 579 * Updates the EEPROM checksum by reading/adding each word of the EEPROM
@@ -589,7 +589,7 @@ s32 igb_update_nvm_checksum(struct e1000_hw *hw)
589 for (i = 0; i < NVM_CHECKSUM_REG; i++) { 589 for (i = 0; i < NVM_CHECKSUM_REG; i++) {
590 ret_val = hw->nvm.ops.read_nvm(hw, i, 1, &nvm_data); 590 ret_val = hw->nvm.ops.read_nvm(hw, i, 1, &nvm_data);
591 if (ret_val) { 591 if (ret_val) {
592 hw_dbg(hw, "NVM Read Error while updating checksum.\n"); 592 hw_dbg("NVM Read Error while updating checksum.\n");
593 goto out; 593 goto out;
594 } 594 }
595 checksum += nvm_data; 595 checksum += nvm_data;
@@ -597,7 +597,7 @@ s32 igb_update_nvm_checksum(struct e1000_hw *hw)
597 checksum = (u16) NVM_SUM - checksum; 597 checksum = (u16) NVM_SUM - checksum;
598 ret_val = hw->nvm.ops.write_nvm(hw, NVM_CHECKSUM_REG, 1, &checksum); 598 ret_val = hw->nvm.ops.write_nvm(hw, NVM_CHECKSUM_REG, 1, &checksum);
599 if (ret_val) 599 if (ret_val)
600 hw_dbg(hw, "NVM Write Error while updating checksum.\n"); 600 hw_dbg("NVM Write Error while updating checksum.\n");
601 601
602out: 602out:
603 return ret_val; 603 return ret_val;
diff --git a/drivers/net/igb/e1000_phy.c b/drivers/net/igb/e1000_phy.c
index 08a86b107229..17fddb91c9f5 100644
--- a/drivers/net/igb/e1000_phy.c
+++ b/drivers/net/igb/e1000_phy.c
@@ -61,7 +61,7 @@ static const u16 e1000_igp_2_cable_length_table[] =
61 sizeof(e1000_igp_2_cable_length_table[0])) 61 sizeof(e1000_igp_2_cable_length_table[0]))
62 62
63/** 63/**
64 * e1000_check_reset_block - Check if PHY reset is blocked 64 * igb_check_reset_block - Check if PHY reset is blocked
65 * @hw: pointer to the HW structure 65 * @hw: pointer to the HW structure
66 * 66 *
67 * Read the PHY management control register and check whether a PHY reset 67 * Read the PHY management control register and check whether a PHY reset
@@ -79,7 +79,7 @@ s32 igb_check_reset_block(struct e1000_hw *hw)
79} 79}
80 80
81/** 81/**
82 * e1000_get_phy_id - Retrieve the PHY ID and revision 82 * igb_get_phy_id - Retrieve the PHY ID and revision
83 * @hw: pointer to the HW structure 83 * @hw: pointer to the HW structure
84 * 84 *
85 * Reads the PHY registers and stores the PHY ID and possibly the PHY 85 * Reads the PHY registers and stores the PHY ID and possibly the PHY
@@ -109,7 +109,7 @@ out:
109} 109}
110 110
111/** 111/**
112 * e1000_phy_reset_dsp - Reset PHY DSP 112 * igb_phy_reset_dsp - Reset PHY DSP
113 * @hw: pointer to the HW structure 113 * @hw: pointer to the HW structure
114 * 114 *
115 * Reset the digital signal processor. 115 * Reset the digital signal processor.
@@ -129,7 +129,7 @@ out:
129} 129}
130 130
131/** 131/**
132 * e1000_read_phy_reg_mdic - Read MDI control register 132 * igb_read_phy_reg_mdic - Read MDI control register
133 * @hw: pointer to the HW structure 133 * @hw: pointer to the HW structure
134 * @offset: register offset to be read 134 * @offset: register offset to be read
135 * @data: pointer to the read data 135 * @data: pointer to the read data
@@ -144,7 +144,7 @@ static s32 igb_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data)
144 s32 ret_val = 0; 144 s32 ret_val = 0;
145 145
146 if (offset > MAX_PHY_REG_ADDRESS) { 146 if (offset > MAX_PHY_REG_ADDRESS) {
147 hw_dbg(hw, "PHY Address %d is out of range\n", offset); 147 hw_dbg("PHY Address %d is out of range\n", offset);
148 ret_val = -E1000_ERR_PARAM; 148 ret_val = -E1000_ERR_PARAM;
149 goto out; 149 goto out;
150 } 150 }
@@ -172,12 +172,12 @@ static s32 igb_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data)
172 break; 172 break;
173 } 173 }
174 if (!(mdic & E1000_MDIC_READY)) { 174 if (!(mdic & E1000_MDIC_READY)) {
175 hw_dbg(hw, "MDI Read did not complete\n"); 175 hw_dbg("MDI Read did not complete\n");
176 ret_val = -E1000_ERR_PHY; 176 ret_val = -E1000_ERR_PHY;
177 goto out; 177 goto out;
178 } 178 }
179 if (mdic & E1000_MDIC_ERROR) { 179 if (mdic & E1000_MDIC_ERROR) {
180 hw_dbg(hw, "MDI Error\n"); 180 hw_dbg("MDI Error\n");
181 ret_val = -E1000_ERR_PHY; 181 ret_val = -E1000_ERR_PHY;
182 goto out; 182 goto out;
183 } 183 }
@@ -188,7 +188,7 @@ out:
188} 188}
189 189
190/** 190/**
191 * e1000_write_phy_reg_mdic - Write MDI control register 191 * igb_write_phy_reg_mdic - Write MDI control register
192 * @hw: pointer to the HW structure 192 * @hw: pointer to the HW structure
193 * @offset: register offset to write to 193 * @offset: register offset to write to
194 * @data: data to write to register at offset 194 * @data: data to write to register at offset
@@ -202,7 +202,7 @@ static s32 igb_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data)
202 s32 ret_val = 0; 202 s32 ret_val = 0;
203 203
204 if (offset > MAX_PHY_REG_ADDRESS) { 204 if (offset > MAX_PHY_REG_ADDRESS) {
205 hw_dbg(hw, "PHY Address %d is out of range\n", offset); 205 hw_dbg("PHY Address %d is out of range\n", offset);
206 ret_val = -E1000_ERR_PARAM; 206 ret_val = -E1000_ERR_PARAM;
207 goto out; 207 goto out;
208 } 208 }
@@ -231,12 +231,12 @@ static s32 igb_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data)
231 break; 231 break;
232 } 232 }
233 if (!(mdic & E1000_MDIC_READY)) { 233 if (!(mdic & E1000_MDIC_READY)) {
234 hw_dbg(hw, "MDI Write did not complete\n"); 234 hw_dbg("MDI Write did not complete\n");
235 ret_val = -E1000_ERR_PHY; 235 ret_val = -E1000_ERR_PHY;
236 goto out; 236 goto out;
237 } 237 }
238 if (mdic & E1000_MDIC_ERROR) { 238 if (mdic & E1000_MDIC_ERROR) {
239 hw_dbg(hw, "MDI Error\n"); 239 hw_dbg("MDI Error\n");
240 ret_val = -E1000_ERR_PHY; 240 ret_val = -E1000_ERR_PHY;
241 goto out; 241 goto out;
242 } 242 }
@@ -246,7 +246,7 @@ out:
246} 246}
247 247
248/** 248/**
249 * e1000_read_phy_reg_igp - Read igp PHY register 249 * igb_read_phy_reg_igp - Read igp PHY register
250 * @hw: pointer to the HW structure 250 * @hw: pointer to the HW structure
251 * @offset: register offset to be read 251 * @offset: register offset to be read
252 * @data: pointer to the read data 252 * @data: pointer to the read data
@@ -284,7 +284,7 @@ out:
284} 284}
285 285
286/** 286/**
287 * e1000_write_phy_reg_igp - Write igp PHY register 287 * igb_write_phy_reg_igp - Write igp PHY register
288 * @hw: pointer to the HW structure 288 * @hw: pointer to the HW structure
289 * @offset: register offset to write to 289 * @offset: register offset to write to
290 * @data: data to write at register offset 290 * @data: data to write at register offset
@@ -321,7 +321,7 @@ out:
321} 321}
322 322
323/** 323/**
324 * e1000_copper_link_setup_m88 - Setup m88 PHY's for copper link 324 * igb_copper_link_setup_m88 - Setup m88 PHY's for copper link
325 * @hw: pointer to the HW structure 325 * @hw: pointer to the HW structure
326 * 326 *
327 * Sets up MDI/MDI-X and polarity for m88 PHY's. If necessary, transmit clock 327 * Sets up MDI/MDI-X and polarity for m88 PHY's. If necessary, transmit clock
@@ -423,7 +423,7 @@ s32 igb_copper_link_setup_m88(struct e1000_hw *hw)
423 /* Commit the changes. */ 423 /* Commit the changes. */
424 ret_val = igb_phy_sw_reset(hw); 424 ret_val = igb_phy_sw_reset(hw);
425 if (ret_val) { 425 if (ret_val) {
426 hw_dbg(hw, "Error committing the PHY changes\n"); 426 hw_dbg("Error committing the PHY changes\n");
427 goto out; 427 goto out;
428 } 428 }
429 429
@@ -432,7 +432,7 @@ out:
432} 432}
433 433
434/** 434/**
435 * e1000_copper_link_setup_igp - Setup igp PHY's for copper link 435 * igb_copper_link_setup_igp - Setup igp PHY's for copper link
436 * @hw: pointer to the HW structure 436 * @hw: pointer to the HW structure
437 * 437 *
438 * Sets up LPLU, MDI/MDI-X, polarity, Smartspeed and Master/Slave config for 438 * Sets up LPLU, MDI/MDI-X, polarity, Smartspeed and Master/Slave config for
@@ -451,7 +451,7 @@ s32 igb_copper_link_setup_igp(struct e1000_hw *hw)
451 451
452 ret_val = hw->phy.ops.reset_phy(hw); 452 ret_val = hw->phy.ops.reset_phy(hw);
453 if (ret_val) { 453 if (ret_val) {
454 hw_dbg(hw, "Error resetting the PHY.\n"); 454 hw_dbg("Error resetting the PHY.\n");
455 goto out; 455 goto out;
456 } 456 }
457 457
@@ -467,7 +467,7 @@ s32 igb_copper_link_setup_igp(struct e1000_hw *hw)
467 if (hw->phy.ops.set_d3_lplu_state) 467 if (hw->phy.ops.set_d3_lplu_state)
468 ret_val = hw->phy.ops.set_d3_lplu_state(hw, false); 468 ret_val = hw->phy.ops.set_d3_lplu_state(hw, false);
469 if (ret_val) { 469 if (ret_val) {
470 hw_dbg(hw, "Error Disabling LPLU D3\n"); 470 hw_dbg("Error Disabling LPLU D3\n");
471 goto out; 471 goto out;
472 } 472 }
473 } 473 }
@@ -475,7 +475,7 @@ s32 igb_copper_link_setup_igp(struct e1000_hw *hw)
475 /* disable lplu d0 during driver init */ 475 /* disable lplu d0 during driver init */
476 ret_val = hw->phy.ops.set_d0_lplu_state(hw, false); 476 ret_val = hw->phy.ops.set_d0_lplu_state(hw, false);
477 if (ret_val) { 477 if (ret_val) {
478 hw_dbg(hw, "Error Disabling LPLU D0\n"); 478 hw_dbg("Error Disabling LPLU D0\n");
479 goto out; 479 goto out;
480 } 480 }
481 /* Configure mdi-mdix settings */ 481 /* Configure mdi-mdix settings */
@@ -570,7 +570,7 @@ out:
570} 570}
571 571
572/** 572/**
573 * e1000_copper_link_autoneg - Setup/Enable autoneg for copper link 573 * igb_copper_link_autoneg - Setup/Enable autoneg for copper link
574 * @hw: pointer to the HW structure 574 * @hw: pointer to the HW structure
575 * 575 *
576 * Performs initial bounds checking on autoneg advertisement parameter, then 576 * Performs initial bounds checking on autoneg advertisement parameter, then
@@ -597,13 +597,13 @@ s32 igb_copper_link_autoneg(struct e1000_hw *hw)
597 if (phy->autoneg_advertised == 0) 597 if (phy->autoneg_advertised == 0)
598 phy->autoneg_advertised = phy->autoneg_mask; 598 phy->autoneg_advertised = phy->autoneg_mask;
599 599
600 hw_dbg(hw, "Reconfiguring auto-neg advertisement params\n"); 600 hw_dbg("Reconfiguring auto-neg advertisement params\n");
601 ret_val = igb_phy_setup_autoneg(hw); 601 ret_val = igb_phy_setup_autoneg(hw);
602 if (ret_val) { 602 if (ret_val) {
603 hw_dbg(hw, "Error Setting up Auto-Negotiation\n"); 603 hw_dbg("Error Setting up Auto-Negotiation\n");
604 goto out; 604 goto out;
605 } 605 }
606 hw_dbg(hw, "Restarting Auto-Neg\n"); 606 hw_dbg("Restarting Auto-Neg\n");
607 607
608 /* 608 /*
609 * Restart auto-negotiation by setting the Auto Neg Enable bit and 609 * Restart auto-negotiation by setting the Auto Neg Enable bit and
@@ -625,8 +625,8 @@ s32 igb_copper_link_autoneg(struct e1000_hw *hw)
625 if (phy->autoneg_wait_to_complete) { 625 if (phy->autoneg_wait_to_complete) {
626 ret_val = igb_wait_autoneg(hw); 626 ret_val = igb_wait_autoneg(hw);
627 if (ret_val) { 627 if (ret_val) {
628 hw_dbg(hw, "Error while waiting for " 628 hw_dbg("Error while waiting for "
629 "autoneg to complete\n"); 629 "autoneg to complete\n");
630 goto out; 630 goto out;
631 } 631 }
632 } 632 }
@@ -638,7 +638,7 @@ out:
638} 638}
639 639
640/** 640/**
641 * e1000_phy_setup_autoneg - Configure PHY for auto-negotiation 641 * igb_phy_setup_autoneg - Configure PHY for auto-negotiation
642 * @hw: pointer to the HW structure 642 * @hw: pointer to the HW structure
643 * 643 *
644 * Reads the MII auto-neg advertisement register and/or the 1000T control 644 * Reads the MII auto-neg advertisement register and/or the 1000T control
@@ -689,39 +689,39 @@ static s32 igb_phy_setup_autoneg(struct e1000_hw *hw)
689 NWAY_AR_10T_HD_CAPS); 689 NWAY_AR_10T_HD_CAPS);
690 mii_1000t_ctrl_reg &= ~(CR_1000T_HD_CAPS | CR_1000T_FD_CAPS); 690 mii_1000t_ctrl_reg &= ~(CR_1000T_HD_CAPS | CR_1000T_FD_CAPS);
691 691
692 hw_dbg(hw, "autoneg_advertised %x\n", phy->autoneg_advertised); 692 hw_dbg("autoneg_advertised %x\n", phy->autoneg_advertised);
693 693
694 /* Do we want to advertise 10 Mb Half Duplex? */ 694 /* Do we want to advertise 10 Mb Half Duplex? */
695 if (phy->autoneg_advertised & ADVERTISE_10_HALF) { 695 if (phy->autoneg_advertised & ADVERTISE_10_HALF) {
696 hw_dbg(hw, "Advertise 10mb Half duplex\n"); 696 hw_dbg("Advertise 10mb Half duplex\n");
697 mii_autoneg_adv_reg |= NWAY_AR_10T_HD_CAPS; 697 mii_autoneg_adv_reg |= NWAY_AR_10T_HD_CAPS;
698 } 698 }
699 699
700 /* Do we want to advertise 10 Mb Full Duplex? */ 700 /* Do we want to advertise 10 Mb Full Duplex? */
701 if (phy->autoneg_advertised & ADVERTISE_10_FULL) { 701 if (phy->autoneg_advertised & ADVERTISE_10_FULL) {
702 hw_dbg(hw, "Advertise 10mb Full duplex\n"); 702 hw_dbg("Advertise 10mb Full duplex\n");
703 mii_autoneg_adv_reg |= NWAY_AR_10T_FD_CAPS; 703 mii_autoneg_adv_reg |= NWAY_AR_10T_FD_CAPS;
704 } 704 }
705 705
706 /* Do we want to advertise 100 Mb Half Duplex? */ 706 /* Do we want to advertise 100 Mb Half Duplex? */
707 if (phy->autoneg_advertised & ADVERTISE_100_HALF) { 707 if (phy->autoneg_advertised & ADVERTISE_100_HALF) {
708 hw_dbg(hw, "Advertise 100mb Half duplex\n"); 708 hw_dbg("Advertise 100mb Half duplex\n");
709 mii_autoneg_adv_reg |= NWAY_AR_100TX_HD_CAPS; 709 mii_autoneg_adv_reg |= NWAY_AR_100TX_HD_CAPS;
710 } 710 }
711 711
712 /* Do we want to advertise 100 Mb Full Duplex? */ 712 /* Do we want to advertise 100 Mb Full Duplex? */
713 if (phy->autoneg_advertised & ADVERTISE_100_FULL) { 713 if (phy->autoneg_advertised & ADVERTISE_100_FULL) {
714 hw_dbg(hw, "Advertise 100mb Full duplex\n"); 714 hw_dbg("Advertise 100mb Full duplex\n");
715 mii_autoneg_adv_reg |= NWAY_AR_100TX_FD_CAPS; 715 mii_autoneg_adv_reg |= NWAY_AR_100TX_FD_CAPS;
716 } 716 }
717 717
718 /* We do not allow the Phy to advertise 1000 Mb Half Duplex */ 718 /* We do not allow the Phy to advertise 1000 Mb Half Duplex */
719 if (phy->autoneg_advertised & ADVERTISE_1000_HALF) 719 if (phy->autoneg_advertised & ADVERTISE_1000_HALF)
720 hw_dbg(hw, "Advertise 1000mb Half duplex request denied!\n"); 720 hw_dbg("Advertise 1000mb Half duplex request denied!\n");
721 721
722 /* Do we want to advertise 1000 Mb Full Duplex? */ 722 /* Do we want to advertise 1000 Mb Full Duplex? */
723 if (phy->autoneg_advertised & ADVERTISE_1000_FULL) { 723 if (phy->autoneg_advertised & ADVERTISE_1000_FULL) {
724 hw_dbg(hw, "Advertise 1000mb Full duplex\n"); 724 hw_dbg("Advertise 1000mb Full duplex\n");
725 mii_1000t_ctrl_reg |= CR_1000T_FD_CAPS; 725 mii_1000t_ctrl_reg |= CR_1000T_FD_CAPS;
726 } 726 }
727 727
@@ -780,7 +780,7 @@ static s32 igb_phy_setup_autoneg(struct e1000_hw *hw)
780 mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE); 780 mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE);
781 break; 781 break;
782 default: 782 default:
783 hw_dbg(hw, "Flow control param set incorrectly\n"); 783 hw_dbg("Flow control param set incorrectly\n");
784 ret_val = -E1000_ERR_CONFIG; 784 ret_val = -E1000_ERR_CONFIG;
785 goto out; 785 goto out;
786 } 786 }
@@ -790,7 +790,7 @@ static s32 igb_phy_setup_autoneg(struct e1000_hw *hw)
790 if (ret_val) 790 if (ret_val)
791 goto out; 791 goto out;
792 792
793 hw_dbg(hw, "Auto-Neg Advertising %x\n", mii_autoneg_adv_reg); 793 hw_dbg("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg);
794 794
795 if (phy->autoneg_mask & ADVERTISE_1000_FULL) { 795 if (phy->autoneg_mask & ADVERTISE_1000_FULL) {
796 ret_val = hw->phy.ops.write_phy_reg(hw, 796 ret_val = hw->phy.ops.write_phy_reg(hw,
@@ -805,7 +805,7 @@ out:
805} 805}
806 806
807/** 807/**
808 * e1000_phy_force_speed_duplex_igp - Force speed/duplex for igp PHY 808 * igb_phy_force_speed_duplex_igp - Force speed/duplex for igp PHY
809 * @hw: pointer to the HW structure 809 * @hw: pointer to the HW structure
810 * 810 *
811 * Calls the PHY setup function to force speed and duplex. Clears the 811 * Calls the PHY setup function to force speed and duplex. Clears the
@@ -846,13 +846,12 @@ s32 igb_phy_force_speed_duplex_igp(struct e1000_hw *hw)
846 if (ret_val) 846 if (ret_val)
847 goto out; 847 goto out;
848 848
849 hw_dbg(hw, "IGP PSCR: %X\n", phy_data); 849 hw_dbg("IGP PSCR: %X\n", phy_data);
850 850
851 udelay(1); 851 udelay(1);
852 852
853 if (phy->autoneg_wait_to_complete) { 853 if (phy->autoneg_wait_to_complete) {
854 hw_dbg(hw, 854 hw_dbg("Waiting for forced speed/duplex link on IGP phy.\n");
855 "Waiting for forced speed/duplex link on IGP phy.\n");
856 855
857 ret_val = igb_phy_has_link(hw, 856 ret_val = igb_phy_has_link(hw,
858 PHY_FORCE_LIMIT, 857 PHY_FORCE_LIMIT,
@@ -862,7 +861,7 @@ s32 igb_phy_force_speed_duplex_igp(struct e1000_hw *hw)
862 goto out; 861 goto out;
863 862
864 if (!link) 863 if (!link)
865 hw_dbg(hw, "Link taking longer than expected.\n"); 864 hw_dbg("Link taking longer than expected.\n");
866 865
867 /* Try once more */ 866 /* Try once more */
868 ret_val = igb_phy_has_link(hw, 867 ret_val = igb_phy_has_link(hw,
@@ -878,7 +877,7 @@ out:
878} 877}
879 878
880/** 879/**
881 * e1000_phy_force_speed_duplex_m88 - Force speed/duplex for m88 PHY 880 * igb_phy_force_speed_duplex_m88 - Force speed/duplex for m88 PHY
882 * @hw: pointer to the HW structure 881 * @hw: pointer to the HW structure
883 * 882 *
884 * Calls the PHY setup function to force speed and duplex. Clears the 883 * Calls the PHY setup function to force speed and duplex. Clears the
@@ -909,7 +908,7 @@ s32 igb_phy_force_speed_duplex_m88(struct e1000_hw *hw)
909 if (ret_val) 908 if (ret_val)
910 goto out; 909 goto out;
911 910
912 hw_dbg(hw, "M88E1000 PSCR: %X\n", phy_data); 911 hw_dbg("M88E1000 PSCR: %X\n", phy_data);
913 912
914 ret_val = hw->phy.ops.read_phy_reg(hw, PHY_CONTROL, &phy_data); 913 ret_val = hw->phy.ops.read_phy_reg(hw, PHY_CONTROL, &phy_data);
915 if (ret_val) 914 if (ret_val)
@@ -927,8 +926,7 @@ s32 igb_phy_force_speed_duplex_m88(struct e1000_hw *hw)
927 udelay(1); 926 udelay(1);
928 927
929 if (phy->autoneg_wait_to_complete) { 928 if (phy->autoneg_wait_to_complete) {
930 hw_dbg(hw, 929 hw_dbg("Waiting for forced speed/duplex link on M88 phy.\n");
931 "Waiting for forced speed/duplex link on M88 phy.\n");
932 930
933 ret_val = igb_phy_has_link(hw, 931 ret_val = igb_phy_has_link(hw,
934 PHY_FORCE_LIMIT, 932 PHY_FORCE_LIMIT,
@@ -993,7 +991,7 @@ out:
993} 991}
994 992
995/** 993/**
996 * e1000_phy_force_speed_duplex_setup - Configure forced PHY speed/duplex 994 * igb_phy_force_speed_duplex_setup - Configure forced PHY speed/duplex
997 * @hw: pointer to the HW structure 995 * @hw: pointer to the HW structure
998 * @phy_ctrl: pointer to current value of PHY_CONTROL 996 * @phy_ctrl: pointer to current value of PHY_CONTROL
999 * 997 *
@@ -1028,11 +1026,11 @@ static void igb_phy_force_speed_duplex_setup(struct e1000_hw *hw,
1028 if (mac->forced_speed_duplex & E1000_ALL_HALF_DUPLEX) { 1026 if (mac->forced_speed_duplex & E1000_ALL_HALF_DUPLEX) {
1029 ctrl &= ~E1000_CTRL_FD; 1027 ctrl &= ~E1000_CTRL_FD;
1030 *phy_ctrl &= ~MII_CR_FULL_DUPLEX; 1028 *phy_ctrl &= ~MII_CR_FULL_DUPLEX;
1031 hw_dbg(hw, "Half Duplex\n"); 1029 hw_dbg("Half Duplex\n");
1032 } else { 1030 } else {
1033 ctrl |= E1000_CTRL_FD; 1031 ctrl |= E1000_CTRL_FD;
1034 *phy_ctrl |= MII_CR_FULL_DUPLEX; 1032 *phy_ctrl |= MII_CR_FULL_DUPLEX;
1035 hw_dbg(hw, "Full Duplex\n"); 1033 hw_dbg("Full Duplex\n");
1036 } 1034 }
1037 1035
1038 /* Forcing 10mb or 100mb? */ 1036 /* Forcing 10mb or 100mb? */
@@ -1040,12 +1038,12 @@ static void igb_phy_force_speed_duplex_setup(struct e1000_hw *hw,
1040 ctrl |= E1000_CTRL_SPD_100; 1038 ctrl |= E1000_CTRL_SPD_100;
1041 *phy_ctrl |= MII_CR_SPEED_100; 1039 *phy_ctrl |= MII_CR_SPEED_100;
1042 *phy_ctrl &= ~(MII_CR_SPEED_1000 | MII_CR_SPEED_10); 1040 *phy_ctrl &= ~(MII_CR_SPEED_1000 | MII_CR_SPEED_10);
1043 hw_dbg(hw, "Forcing 100mb\n"); 1041 hw_dbg("Forcing 100mb\n");
1044 } else { 1042 } else {
1045 ctrl &= ~(E1000_CTRL_SPD_1000 | E1000_CTRL_SPD_100); 1043 ctrl &= ~(E1000_CTRL_SPD_1000 | E1000_CTRL_SPD_100);
1046 *phy_ctrl |= MII_CR_SPEED_10; 1044 *phy_ctrl |= MII_CR_SPEED_10;
1047 *phy_ctrl &= ~(MII_CR_SPEED_1000 | MII_CR_SPEED_100); 1045 *phy_ctrl &= ~(MII_CR_SPEED_1000 | MII_CR_SPEED_100);
1048 hw_dbg(hw, "Forcing 10mb\n"); 1046 hw_dbg("Forcing 10mb\n");
1049 } 1047 }
1050 1048
1051 igb_config_collision_dist(hw); 1049 igb_config_collision_dist(hw);
@@ -1054,7 +1052,7 @@ static void igb_phy_force_speed_duplex_setup(struct e1000_hw *hw,
1054} 1052}
1055 1053
1056/** 1054/**
1057 * e1000_set_d3_lplu_state - Sets low power link up state for D3 1055 * igb_set_d3_lplu_state - Sets low power link up state for D3
1058 * @hw: pointer to the HW structure 1056 * @hw: pointer to the HW structure
1059 * @active: boolean used to enable/disable lplu 1057 * @active: boolean used to enable/disable lplu
1060 * 1058 *
@@ -1146,7 +1144,7 @@ out:
1146} 1144}
1147 1145
1148/** 1146/**
1149 * e1000_check_downshift - Checks whether a downshift in speed occured 1147 * igb_check_downshift - Checks whether a downshift in speed occured
1150 * @hw: pointer to the HW structure 1148 * @hw: pointer to the HW structure
1151 * 1149 *
1152 * Success returns 0, Failure returns 1 1150 * Success returns 0, Failure returns 1
@@ -1188,7 +1186,7 @@ out:
1188} 1186}
1189 1187
1190/** 1188/**
1191 * e1000_check_polarity_m88 - Checks the polarity. 1189 * igb_check_polarity_m88 - Checks the polarity.
1192 * @hw: pointer to the HW structure 1190 * @hw: pointer to the HW structure
1193 * 1191 *
1194 * Success returns 0, Failure returns -E1000_ERR_PHY (-2) 1192 * Success returns 0, Failure returns -E1000_ERR_PHY (-2)
@@ -1212,7 +1210,7 @@ static s32 igb_check_polarity_m88(struct e1000_hw *hw)
1212} 1210}
1213 1211
1214/** 1212/**
1215 * e1000_check_polarity_igp - Checks the polarity. 1213 * igb_check_polarity_igp - Checks the polarity.
1216 * @hw: pointer to the HW structure 1214 * @hw: pointer to the HW structure
1217 * 1215 *
1218 * Success returns 0, Failure returns -E1000_ERR_PHY (-2) 1216 * Success returns 0, Failure returns -E1000_ERR_PHY (-2)
@@ -1260,7 +1258,7 @@ out:
1260} 1258}
1261 1259
1262/** 1260/**
1263 * e1000_wait_autoneg - Wait for auto-neg compeletion 1261 * igb_wait_autoneg - Wait for auto-neg compeletion
1264 * @hw: pointer to the HW structure 1262 * @hw: pointer to the HW structure
1265 * 1263 *
1266 * Waits for auto-negotiation to complete or for the auto-negotiation time 1264 * Waits for auto-negotiation to complete or for the auto-negotiation time
@@ -1292,7 +1290,7 @@ static s32 igb_wait_autoneg(struct e1000_hw *hw)
1292} 1290}
1293 1291
1294/** 1292/**
1295 * e1000_phy_has_link - Polls PHY for link 1293 * igb_phy_has_link - Polls PHY for link
1296 * @hw: pointer to the HW structure 1294 * @hw: pointer to the HW structure
1297 * @iterations: number of times to poll for link 1295 * @iterations: number of times to poll for link
1298 * @usec_interval: delay between polling attempts 1296 * @usec_interval: delay between polling attempts
@@ -1332,7 +1330,7 @@ s32 igb_phy_has_link(struct e1000_hw *hw, u32 iterations,
1332} 1330}
1333 1331
1334/** 1332/**
1335 * e1000_get_cable_length_m88 - Determine cable length for m88 PHY 1333 * igb_get_cable_length_m88 - Determine cable length for m88 PHY
1336 * @hw: pointer to the HW structure 1334 * @hw: pointer to the HW structure
1337 * 1335 *
1338 * Reads the PHY specific status register to retrieve the cable length 1336 * Reads the PHY specific status register to retrieve the cable length
@@ -1369,7 +1367,7 @@ out:
1369} 1367}
1370 1368
1371/** 1369/**
1372 * e1000_get_cable_length_igp_2 - Determine cable length for igp2 PHY 1370 * igb_get_cable_length_igp_2 - Determine cable length for igp2 PHY
1373 * @hw: pointer to the HW structure 1371 * @hw: pointer to the HW structure
1374 * 1372 *
1375 * The automatic gain control (agc) normalizes the amplitude of the 1373 * The automatic gain control (agc) normalizes the amplitude of the
@@ -1442,7 +1440,7 @@ out:
1442} 1440}
1443 1441
1444/** 1442/**
1445 * e1000_get_phy_info_m88 - Retrieve PHY information 1443 * igb_get_phy_info_m88 - Retrieve PHY information
1446 * @hw: pointer to the HW structure 1444 * @hw: pointer to the HW structure
1447 * 1445 *
1448 * Valid for only copper links. Read the PHY status register (sticky read) 1446 * Valid for only copper links. Read the PHY status register (sticky read)
@@ -1459,7 +1457,7 @@ s32 igb_get_phy_info_m88(struct e1000_hw *hw)
1459 bool link; 1457 bool link;
1460 1458
1461 if (hw->phy.media_type != e1000_media_type_copper) { 1459 if (hw->phy.media_type != e1000_media_type_copper) {
1462 hw_dbg(hw, "Phy info is only valid for copper media\n"); 1460 hw_dbg("Phy info is only valid for copper media\n");
1463 ret_val = -E1000_ERR_CONFIG; 1461 ret_val = -E1000_ERR_CONFIG;
1464 goto out; 1462 goto out;
1465 } 1463 }
@@ -1469,7 +1467,7 @@ s32 igb_get_phy_info_m88(struct e1000_hw *hw)
1469 goto out; 1467 goto out;
1470 1468
1471 if (!link) { 1469 if (!link) {
1472 hw_dbg(hw, "Phy info is only valid if link is up\n"); 1470 hw_dbg("Phy info is only valid if link is up\n");
1473 ret_val = -E1000_ERR_CONFIG; 1471 ret_val = -E1000_ERR_CONFIG;
1474 goto out; 1472 goto out;
1475 } 1473 }
@@ -1523,7 +1521,7 @@ out:
1523} 1521}
1524 1522
1525/** 1523/**
1526 * e1000_get_phy_info_igp - Retrieve igp PHY information 1524 * igb_get_phy_info_igp - Retrieve igp PHY information
1527 * @hw: pointer to the HW structure 1525 * @hw: pointer to the HW structure
1528 * 1526 *
1529 * Read PHY status to determine if link is up. If link is up, then 1527 * Read PHY status to determine if link is up. If link is up, then
@@ -1543,7 +1541,7 @@ s32 igb_get_phy_info_igp(struct e1000_hw *hw)
1543 goto out; 1541 goto out;
1544 1542
1545 if (!link) { 1543 if (!link) {
1546 hw_dbg(hw, "Phy info is only valid if link is up\n"); 1544 hw_dbg("Phy info is only valid if link is up\n");
1547 ret_val = -E1000_ERR_CONFIG; 1545 ret_val = -E1000_ERR_CONFIG;
1548 goto out; 1546 goto out;
1549 } 1547 }
@@ -1590,7 +1588,7 @@ out:
1590} 1588}
1591 1589
1592/** 1590/**
1593 * e1000_phy_sw_reset - PHY software reset 1591 * igb_phy_sw_reset - PHY software reset
1594 * @hw: pointer to the HW structure 1592 * @hw: pointer to the HW structure
1595 * 1593 *
1596 * Does a software reset of the PHY by reading the PHY control register and 1594 * Does a software reset of the PHY by reading the PHY control register and
@@ -1617,7 +1615,7 @@ out:
1617} 1615}
1618 1616
1619/** 1617/**
1620 * e1000_phy_hw_reset - PHY hardware reset 1618 * igb_phy_hw_reset - PHY hardware reset
1621 * @hw: pointer to the HW structure 1619 * @hw: pointer to the HW structure
1622 * 1620 *
1623 * Verify the reset block is not blocking us from resetting. Acquire 1621 * Verify the reset block is not blocking us from resetting. Acquire
@@ -1663,7 +1661,7 @@ out:
1663/* Internal function pointers */ 1661/* Internal function pointers */
1664 1662
1665/** 1663/**
1666 * e1000_get_phy_cfg_done - Generic PHY configuration done 1664 * igb_get_phy_cfg_done - Generic PHY configuration done
1667 * @hw: pointer to the HW structure 1665 * @hw: pointer to the HW structure
1668 * 1666 *
1669 * Return success if silicon family did not implement a family specific 1667 * Return success if silicon family did not implement a family specific
@@ -1678,7 +1676,7 @@ static s32 igb_get_phy_cfg_done(struct e1000_hw *hw)
1678} 1676}
1679 1677
1680/** 1678/**
1681 * e1000_release_phy - Generic release PHY 1679 * igb_release_phy - Generic release PHY
1682 * @hw: pointer to the HW structure 1680 * @hw: pointer to the HW structure
1683 * 1681 *
1684 * Return if silicon family does not require a semaphore when accessing the 1682 * Return if silicon family does not require a semaphore when accessing the
@@ -1691,7 +1689,7 @@ static void igb_release_phy(struct e1000_hw *hw)
1691} 1689}
1692 1690
1693/** 1691/**
1694 * e1000_acquire_phy - Generic acquire PHY 1692 * igb_acquire_phy - Generic acquire PHY
1695 * @hw: pointer to the HW structure 1693 * @hw: pointer to the HW structure
1696 * 1694 *
1697 * Return success if silicon family does not require a semaphore when 1695 * Return success if silicon family does not require a semaphore when
@@ -1706,7 +1704,7 @@ static s32 igb_acquire_phy(struct e1000_hw *hw)
1706} 1704}
1707 1705
1708/** 1706/**
1709 * e1000_phy_force_speed_duplex - Generic force PHY speed/duplex 1707 * igb_phy_force_speed_duplex - Generic force PHY speed/duplex
1710 * @hw: pointer to the HW structure 1708 * @hw: pointer to the HW structure
1711 * 1709 *
1712 * When the silicon family has not implemented a forced speed/duplex 1710 * When the silicon family has not implemented a forced speed/duplex
@@ -1721,14 +1719,14 @@ s32 igb_phy_force_speed_duplex(struct e1000_hw *hw)
1721} 1719}
1722 1720
1723/** 1721/**
1724 * e1000_phy_init_script_igp3 - Inits the IGP3 PHY 1722 * igb_phy_init_script_igp3 - Inits the IGP3 PHY
1725 * @hw: pointer to the HW structure 1723 * @hw: pointer to the HW structure
1726 * 1724 *
1727 * Initializes a Intel Gigabit PHY3 when an EEPROM is not present. 1725 * Initializes a Intel Gigabit PHY3 when an EEPROM is not present.
1728 **/ 1726 **/
1729s32 igb_phy_init_script_igp3(struct e1000_hw *hw) 1727s32 igb_phy_init_script_igp3(struct e1000_hw *hw)
1730{ 1728{
1731 hw_dbg(hw, "Running IGP 3 PHY init script\n"); 1729 hw_dbg("Running IGP 3 PHY init script\n");
1732 1730
1733 /* PHY init IGP 3 */ 1731 /* PHY init IGP 3 */
1734 /* Enable rise/fall, 10-mode work in class-A */ 1732 /* Enable rise/fall, 10-mode work in class-A */
diff --git a/drivers/net/igb/igb.h b/drivers/net/igb/igb.h
index 0eecb8b2abd2..2c48eec17660 100644
--- a/drivers/net/igb/igb.h
+++ b/drivers/net/igb/igb.h
@@ -150,6 +150,7 @@ struct igb_ring {
150 u16 itr_register; 150 u16 itr_register;
151 u16 cpu; 151 u16 cpu;
152 152
153 int queue_index;
153 unsigned int total_bytes; 154 unsigned int total_bytes;
154 unsigned int total_packets; 155 unsigned int total_packets;
155 156
@@ -265,6 +266,7 @@ struct igb_adapter {
265 int msg_enable; 266 int msg_enable;
266 struct msix_entry *msix_entries; 267 struct msix_entry *msix_entries;
267 u32 eims_enable_mask; 268 u32 eims_enable_mask;
269 u32 eims_other;
268 270
269 /* to not mess up cache alignment, always add to the bottom */ 271 /* to not mess up cache alignment, always add to the bottom */
270 unsigned long state; 272 unsigned long state;
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 171d1fc1fbf8..7bc6fae182a7 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -71,8 +71,8 @@ static int igb_setup_all_tx_resources(struct igb_adapter *);
71static int igb_setup_all_rx_resources(struct igb_adapter *); 71static int igb_setup_all_rx_resources(struct igb_adapter *);
72static void igb_free_all_tx_resources(struct igb_adapter *); 72static void igb_free_all_tx_resources(struct igb_adapter *);
73static void igb_free_all_rx_resources(struct igb_adapter *); 73static void igb_free_all_rx_resources(struct igb_adapter *);
74static void igb_free_tx_resources(struct igb_adapter *, struct igb_ring *); 74static void igb_free_tx_resources(struct igb_ring *);
75static void igb_free_rx_resources(struct igb_adapter *, struct igb_ring *); 75static void igb_free_rx_resources(struct igb_ring *);
76void igb_update_stats(struct igb_adapter *); 76void igb_update_stats(struct igb_adapter *);
77static int igb_probe(struct pci_dev *, const struct pci_device_id *); 77static int igb_probe(struct pci_dev *, const struct pci_device_id *);
78static void __devexit igb_remove(struct pci_dev *pdev); 78static void __devexit igb_remove(struct pci_dev *pdev);
@@ -84,8 +84,8 @@ static void igb_configure_rx(struct igb_adapter *);
84static void igb_setup_rctl(struct igb_adapter *); 84static void igb_setup_rctl(struct igb_adapter *);
85static void igb_clean_all_tx_rings(struct igb_adapter *); 85static void igb_clean_all_tx_rings(struct igb_adapter *);
86static void igb_clean_all_rx_rings(struct igb_adapter *); 86static void igb_clean_all_rx_rings(struct igb_adapter *);
87static void igb_clean_tx_ring(struct igb_adapter *, struct igb_ring *); 87static void igb_clean_tx_ring(struct igb_ring *);
88static void igb_clean_rx_ring(struct igb_adapter *, struct igb_ring *); 88static void igb_clean_rx_ring(struct igb_ring *);
89static void igb_set_multi(struct net_device *); 89static void igb_set_multi(struct net_device *);
90static void igb_update_phy_info(unsigned long); 90static void igb_update_phy_info(unsigned long);
91static void igb_watchdog(unsigned long); 91static void igb_watchdog(unsigned long);
@@ -102,12 +102,10 @@ static irqreturn_t igb_msix_other(int irq, void *);
102static irqreturn_t igb_msix_rx(int irq, void *); 102static irqreturn_t igb_msix_rx(int irq, void *);
103static irqreturn_t igb_msix_tx(int irq, void *); 103static irqreturn_t igb_msix_tx(int irq, void *);
104static int igb_clean_rx_ring_msix(struct napi_struct *, int); 104static int igb_clean_rx_ring_msix(struct napi_struct *, int);
105static bool igb_clean_tx_irq(struct igb_adapter *, struct igb_ring *); 105static bool igb_clean_tx_irq(struct igb_ring *);
106static int igb_clean(struct napi_struct *, int); 106static int igb_clean(struct napi_struct *, int);
107static bool igb_clean_rx_irq_adv(struct igb_adapter *, 107static bool igb_clean_rx_irq_adv(struct igb_ring *, int *, int);
108 struct igb_ring *, int *, int); 108static void igb_alloc_rx_buffers_adv(struct igb_ring *, int);
109static void igb_alloc_rx_buffers_adv(struct igb_adapter *,
110 struct igb_ring *, int);
111static int igb_ioctl(struct net_device *, struct ifreq *, int cmd); 109static int igb_ioctl(struct net_device *, struct ifreq *, int cmd);
112static void igb_tx_timeout(struct net_device *); 110static void igb_tx_timeout(struct net_device *);
113static void igb_reset_task(struct work_struct *); 111static void igb_reset_task(struct work_struct *);
@@ -229,12 +227,11 @@ static int igb_alloc_queues(struct igb_adapter *adapter)
229 for (i = 0; i < adapter->num_rx_queues; i++) { 227 for (i = 0; i < adapter->num_rx_queues; i++) {
230 struct igb_ring *ring = &(adapter->rx_ring[i]); 228 struct igb_ring *ring = &(adapter->rx_ring[i]);
231 ring->adapter = adapter; 229 ring->adapter = adapter;
230 ring->queue_index = i;
232 ring->itr_register = E1000_ITR; 231 ring->itr_register = E1000_ITR;
233 232
234 if (!ring->napi.poll) 233 /* set a default napi handler for each rx_ring */
235 netif_napi_add(adapter->netdev, &ring->napi, igb_clean, 234 netif_napi_add(adapter->netdev, &ring->napi, igb_clean, 64);
236 adapter->napi.weight /
237 adapter->num_rx_queues);
238 } 235 }
239 return 0; 236 return 0;
240} 237}
@@ -302,9 +299,6 @@ static void igb_configure_msix(struct igb_adapter *adapter)
302 array_wr32(E1000_MSIXBM(0), vector++, 299 array_wr32(E1000_MSIXBM(0), vector++,
303 E1000_EIMS_OTHER); 300 E1000_EIMS_OTHER);
304 301
305 /* disable IAM for ICR interrupt bits */
306 wr32(E1000_IAM, 0);
307
308 tmp = rd32(E1000_CTRL_EXT); 302 tmp = rd32(E1000_CTRL_EXT);
309 /* enable MSI-X PBA support*/ 303 /* enable MSI-X PBA support*/
310 tmp |= E1000_CTRL_EXT_PBA_CLR; 304 tmp |= E1000_CTRL_EXT_PBA_CLR;
@@ -315,6 +309,7 @@ static void igb_configure_msix(struct igb_adapter *adapter)
315 309
316 wr32(E1000_CTRL_EXT, tmp); 310 wr32(E1000_CTRL_EXT, tmp);
317 adapter->eims_enable_mask |= E1000_EIMS_OTHER; 311 adapter->eims_enable_mask |= E1000_EIMS_OTHER;
312 adapter->eims_other = E1000_EIMS_OTHER;
318 313
319 wrfl(); 314 wrfl();
320} 315}
@@ -357,6 +352,9 @@ static int igb_request_msix(struct igb_adapter *adapter)
357 goto out; 352 goto out;
358 ring->itr_register = E1000_EITR(0) + (vector << 2); 353 ring->itr_register = E1000_EITR(0) + (vector << 2);
359 ring->itr_val = adapter->itr; 354 ring->itr_val = adapter->itr;
355 /* overwrite the poll routine for MSIX, we've already done
356 * netif_napi_add */
357 ring->napi.poll = &igb_clean_rx_ring_msix;
360 vector++; 358 vector++;
361 } 359 }
362 360
@@ -365,9 +363,6 @@ static int igb_request_msix(struct igb_adapter *adapter)
365 if (err) 363 if (err)
366 goto out; 364 goto out;
367 365
368 adapter->napi.poll = igb_clean_rx_ring_msix;
369 for (i = 0; i < adapter->num_rx_queues; i++)
370 adapter->rx_ring[i].napi.poll = adapter->napi.poll;
371 igb_configure_msix(adapter); 366 igb_configure_msix(adapter);
372 return 0; 367 return 0;
373out: 368out:
@@ -436,12 +431,8 @@ static int igb_request_irq(struct igb_adapter *adapter)
436 431
437 if (adapter->msix_entries) { 432 if (adapter->msix_entries) {
438 err = igb_request_msix(adapter); 433 err = igb_request_msix(adapter);
439 if (!err) { 434 if (!err)
440 /* enable IAM, auto-mask,
441 * DO NOT USE EIAM or IAM in legacy mode */
442 wr32(E1000_IAM, IMS_ENABLE_MASK);
443 goto request_done; 435 goto request_done;
444 }
445 /* fall back to MSI */ 436 /* fall back to MSI */
446 igb_reset_interrupt_capability(adapter); 437 igb_reset_interrupt_capability(adapter);
447 if (!pci_enable_msi(adapter->pdev)) 438 if (!pci_enable_msi(adapter->pdev))
@@ -450,7 +441,11 @@ static int igb_request_irq(struct igb_adapter *adapter)
450 igb_free_all_rx_resources(adapter); 441 igb_free_all_rx_resources(adapter);
451 adapter->num_rx_queues = 1; 442 adapter->num_rx_queues = 1;
452 igb_alloc_queues(adapter); 443 igb_alloc_queues(adapter);
444 } else {
445 wr32(E1000_MSIXBM(0), (E1000_EICR_RX_QUEUE0 |
446 E1000_EIMS_OTHER));
453 } 447 }
448
454 if (adapter->msi_enabled) { 449 if (adapter->msi_enabled) {
455 err = request_irq(adapter->pdev->irq, &igb_intr_msi, 0, 450 err = request_irq(adapter->pdev->irq, &igb_intr_msi, 0,
456 netdev->name, netdev); 451 netdev->name, netdev);
@@ -502,9 +497,12 @@ static void igb_irq_disable(struct igb_adapter *adapter)
502 struct e1000_hw *hw = &adapter->hw; 497 struct e1000_hw *hw = &adapter->hw;
503 498
504 if (adapter->msix_entries) { 499 if (adapter->msix_entries) {
500 wr32(E1000_EIAM, 0);
505 wr32(E1000_EIMC, ~0); 501 wr32(E1000_EIMC, ~0);
506 wr32(E1000_EIAC, 0); 502 wr32(E1000_EIAC, 0);
507 } 503 }
504
505 wr32(E1000_IAM, 0);
508 wr32(E1000_IMC, ~0); 506 wr32(E1000_IMC, ~0);
509 wrfl(); 507 wrfl();
510 synchronize_irq(adapter->pdev->irq); 508 synchronize_irq(adapter->pdev->irq);
@@ -519,13 +517,14 @@ static void igb_irq_enable(struct igb_adapter *adapter)
519 struct e1000_hw *hw = &adapter->hw; 517 struct e1000_hw *hw = &adapter->hw;
520 518
521 if (adapter->msix_entries) { 519 if (adapter->msix_entries) {
522 wr32(E1000_EIMS, 520 wr32(E1000_EIAC, adapter->eims_enable_mask);
523 adapter->eims_enable_mask); 521 wr32(E1000_EIAM, adapter->eims_enable_mask);
524 wr32(E1000_EIAC, 522 wr32(E1000_EIMS, adapter->eims_enable_mask);
525 adapter->eims_enable_mask);
526 wr32(E1000_IMS, E1000_IMS_LSC); 523 wr32(E1000_IMS, E1000_IMS_LSC);
527 } else 524 } else {
528 wr32(E1000_IMS, IMS_ENABLE_MASK); 525 wr32(E1000_IMS, IMS_ENABLE_MASK);
526 wr32(E1000_IAM, IMS_ENABLE_MASK);
527 }
529} 528}
530 529
531static void igb_update_mng_vlan(struct igb_adapter *adapter) 530static void igb_update_mng_vlan(struct igb_adapter *adapter)
@@ -632,12 +631,15 @@ static void igb_configure(struct igb_adapter *adapter)
632 igb_configure_tx(adapter); 631 igb_configure_tx(adapter);
633 igb_setup_rctl(adapter); 632 igb_setup_rctl(adapter);
634 igb_configure_rx(adapter); 633 igb_configure_rx(adapter);
634
635 igb_rx_fifo_flush_82575(&adapter->hw);
636
635 /* call IGB_DESC_UNUSED which always leaves 637 /* call IGB_DESC_UNUSED which always leaves
636 * at least 1 descriptor unused to make sure 638 * at least 1 descriptor unused to make sure
637 * next_to_use != next_to_clean */ 639 * next_to_use != next_to_clean */
638 for (i = 0; i < adapter->num_rx_queues; i++) { 640 for (i = 0; i < adapter->num_rx_queues; i++) {
639 struct igb_ring *ring = &adapter->rx_ring[i]; 641 struct igb_ring *ring = &adapter->rx_ring[i];
640 igb_alloc_rx_buffers_adv(adapter, ring, IGB_DESC_UNUSED(ring)); 642 igb_alloc_rx_buffers_adv(ring, IGB_DESC_UNUSED(ring));
641 } 643 }
642 644
643 645
@@ -660,13 +662,10 @@ int igb_up(struct igb_adapter *adapter)
660 662
661 clear_bit(__IGB_DOWN, &adapter->state); 663 clear_bit(__IGB_DOWN, &adapter->state);
662 664
663 napi_enable(&adapter->napi); 665 for (i = 0; i < adapter->num_rx_queues; i++)
664 666 napi_enable(&adapter->rx_ring[i].napi);
665 if (adapter->msix_entries) { 667 if (adapter->msix_entries)
666 for (i = 0; i < adapter->num_rx_queues; i++)
667 napi_enable(&adapter->rx_ring[i].napi);
668 igb_configure_msix(adapter); 668 igb_configure_msix(adapter);
669 }
670 669
671 /* Clear any pending interrupts. */ 670 /* Clear any pending interrupts. */
672 rd32(E1000_ICR); 671 rd32(E1000_ICR);
@@ -703,11 +702,9 @@ void igb_down(struct igb_adapter *adapter)
703 wrfl(); 702 wrfl();
704 msleep(10); 703 msleep(10);
705 704
706 napi_disable(&adapter->napi); 705 for (i = 0; i < adapter->num_rx_queues; i++)
706 napi_disable(&adapter->rx_ring[i].napi);
707 707
708 if (adapter->msix_entries)
709 for (i = 0; i < adapter->num_rx_queues; i++)
710 napi_disable(&adapter->rx_ring[i].napi);
711 igb_irq_disable(adapter); 708 igb_irq_disable(adapter);
712 709
713 del_timer_sync(&adapter->watchdog_timer); 710 del_timer_sync(&adapter->watchdog_timer);
@@ -854,7 +851,6 @@ static int __devinit igb_probe(struct pci_dev *pdev,
854 struct e1000_hw *hw; 851 struct e1000_hw *hw;
855 const struct e1000_info *ei = igb_info_tbl[ent->driver_data]; 852 const struct e1000_info *ei = igb_info_tbl[ent->driver_data];
856 unsigned long mmio_start, mmio_len; 853 unsigned long mmio_start, mmio_len;
857 static int cards_found;
858 int i, err, pci_using_dac; 854 int i, err, pci_using_dac;
859 u16 eeprom_data = 0; 855 u16 eeprom_data = 0;
860 u16 eeprom_apme_mask = IGB_EEPROM_APME; 856 u16 eeprom_apme_mask = IGB_EEPROM_APME;
@@ -933,7 +929,6 @@ static int __devinit igb_probe(struct pci_dev *pdev,
933 igb_set_ethtool_ops(netdev); 929 igb_set_ethtool_ops(netdev);
934 netdev->tx_timeout = &igb_tx_timeout; 930 netdev->tx_timeout = &igb_tx_timeout;
935 netdev->watchdog_timeo = 5 * HZ; 931 netdev->watchdog_timeo = 5 * HZ;
936 netif_napi_add(netdev, &adapter->napi, igb_clean, 64);
937 netdev->vlan_rx_register = igb_vlan_rx_register; 932 netdev->vlan_rx_register = igb_vlan_rx_register;
938 netdev->vlan_rx_add_vid = igb_vlan_rx_add_vid; 933 netdev->vlan_rx_add_vid = igb_vlan_rx_add_vid;
939 netdev->vlan_rx_kill_vid = igb_vlan_rx_kill_vid; 934 netdev->vlan_rx_kill_vid = igb_vlan_rx_kill_vid;
@@ -947,8 +942,6 @@ static int __devinit igb_probe(struct pci_dev *pdev,
947 netdev->mem_start = mmio_start; 942 netdev->mem_start = mmio_start;
948 netdev->mem_end = mmio_start + mmio_len; 943 netdev->mem_end = mmio_start + mmio_len;
949 944
950 adapter->bd_number = cards_found;
951
952 /* PCI config space info */ 945 /* PCI config space info */
953 hw->vendor_id = pdev->vendor; 946 hw->vendor_id = pdev->vendor;
954 hw->device_id = pdev->device; 947 hw->device_id = pdev->device;
@@ -1133,7 +1126,6 @@ static int __devinit igb_probe(struct pci_dev *pdev,
1133 adapter->msi_enabled ? "MSI" : "legacy", 1126 adapter->msi_enabled ? "MSI" : "legacy",
1134 adapter->num_rx_queues, adapter->num_tx_queues); 1127 adapter->num_rx_queues, adapter->num_tx_queues);
1135 1128
1136 cards_found++;
1137 return 0; 1129 return 0;
1138 1130
1139err_register: 1131err_register:
@@ -1301,15 +1293,14 @@ static int igb_open(struct net_device *netdev)
1301 /* From here on the code is the same as igb_up() */ 1293 /* From here on the code is the same as igb_up() */
1302 clear_bit(__IGB_DOWN, &adapter->state); 1294 clear_bit(__IGB_DOWN, &adapter->state);
1303 1295
1304 napi_enable(&adapter->napi); 1296 for (i = 0; i < adapter->num_rx_queues; i++)
1305 if (adapter->msix_entries) 1297 napi_enable(&adapter->rx_ring[i].napi);
1306 for (i = 0; i < adapter->num_rx_queues; i++)
1307 napi_enable(&adapter->rx_ring[i].napi);
1308
1309 igb_irq_enable(adapter);
1310 1298
1311 /* Clear any pending interrupts. */ 1299 /* Clear any pending interrupts. */
1312 rd32(E1000_ICR); 1300 rd32(E1000_ICR);
1301
1302 igb_irq_enable(adapter);
1303
1313 /* Fire a link status change interrupt to start the watchdog. */ 1304 /* Fire a link status change interrupt to start the watchdog. */
1314 wr32(E1000_ICS, E1000_ICS_LSC); 1305 wr32(E1000_ICS, E1000_ICS_LSC);
1315 1306
@@ -1423,8 +1414,7 @@ static int igb_setup_all_tx_resources(struct igb_adapter *adapter)
1423 dev_err(&adapter->pdev->dev, 1414 dev_err(&adapter->pdev->dev,
1424 "Allocation for Tx Queue %u failed\n", i); 1415 "Allocation for Tx Queue %u failed\n", i);
1425 for (i--; i >= 0; i--) 1416 for (i--; i >= 0; i--)
1426 igb_free_tx_resources(adapter, 1417 igb_free_tx_resources(&adapter->tx_ring[i]);
1427 &adapter->tx_ring[i]);
1428 break; 1418 break;
1429 } 1419 }
1430 } 1420 }
@@ -1538,8 +1528,6 @@ int igb_setup_rx_resources(struct igb_adapter *adapter,
1538 rx_ring->pending_skb = NULL; 1528 rx_ring->pending_skb = NULL;
1539 1529
1540 rx_ring->adapter = adapter; 1530 rx_ring->adapter = adapter;
1541 /* FIXME: do we want to setup ring->napi->poll here? */
1542 rx_ring->napi.poll = adapter->napi.poll;
1543 1531
1544 return 0; 1532 return 0;
1545 1533
@@ -1567,8 +1555,7 @@ static int igb_setup_all_rx_resources(struct igb_adapter *adapter)
1567 dev_err(&adapter->pdev->dev, 1555 dev_err(&adapter->pdev->dev,
1568 "Allocation for Rx Queue %u failed\n", i); 1556 "Allocation for Rx Queue %u failed\n", i);
1569 for (i--; i >= 0; i--) 1557 for (i--; i >= 0; i--)
1570 igb_free_rx_resources(adapter, 1558 igb_free_rx_resources(&adapter->rx_ring[i]);
1571 &adapter->rx_ring[i]);
1572 break; 1559 break;
1573 } 1560 }
1574 } 1561 }
@@ -1796,12 +1783,11 @@ static void igb_configure_rx(struct igb_adapter *adapter)
1796 * 1783 *
1797 * Free all transmit software resources 1784 * Free all transmit software resources
1798 **/ 1785 **/
1799static void igb_free_tx_resources(struct igb_adapter *adapter, 1786static void igb_free_tx_resources(struct igb_ring *tx_ring)
1800 struct igb_ring *tx_ring)
1801{ 1787{
1802 struct pci_dev *pdev = adapter->pdev; 1788 struct pci_dev *pdev = tx_ring->adapter->pdev;
1803 1789
1804 igb_clean_tx_ring(adapter, tx_ring); 1790 igb_clean_tx_ring(tx_ring);
1805 1791
1806 vfree(tx_ring->buffer_info); 1792 vfree(tx_ring->buffer_info);
1807 tx_ring->buffer_info = NULL; 1793 tx_ring->buffer_info = NULL;
@@ -1822,7 +1808,7 @@ static void igb_free_all_tx_resources(struct igb_adapter *adapter)
1822 int i; 1808 int i;
1823 1809
1824 for (i = 0; i < adapter->num_tx_queues; i++) 1810 for (i = 0; i < adapter->num_tx_queues; i++)
1825 igb_free_tx_resources(adapter, &adapter->tx_ring[i]); 1811 igb_free_tx_resources(&adapter->tx_ring[i]);
1826} 1812}
1827 1813
1828static void igb_unmap_and_free_tx_resource(struct igb_adapter *adapter, 1814static void igb_unmap_and_free_tx_resource(struct igb_adapter *adapter,
@@ -1848,9 +1834,9 @@ static void igb_unmap_and_free_tx_resource(struct igb_adapter *adapter,
1848 * @adapter: board private structure 1834 * @adapter: board private structure
1849 * @tx_ring: ring to be cleaned 1835 * @tx_ring: ring to be cleaned
1850 **/ 1836 **/
1851static void igb_clean_tx_ring(struct igb_adapter *adapter, 1837static void igb_clean_tx_ring(struct igb_ring *tx_ring)
1852 struct igb_ring *tx_ring)
1853{ 1838{
1839 struct igb_adapter *adapter = tx_ring->adapter;
1854 struct igb_buffer *buffer_info; 1840 struct igb_buffer *buffer_info;
1855 unsigned long size; 1841 unsigned long size;
1856 unsigned int i; 1842 unsigned int i;
@@ -1887,7 +1873,7 @@ static void igb_clean_all_tx_rings(struct igb_adapter *adapter)
1887 int i; 1873 int i;
1888 1874
1889 for (i = 0; i < adapter->num_tx_queues; i++) 1875 for (i = 0; i < adapter->num_tx_queues; i++)
1890 igb_clean_tx_ring(adapter, &adapter->tx_ring[i]); 1876 igb_clean_tx_ring(&adapter->tx_ring[i]);
1891} 1877}
1892 1878
1893/** 1879/**
@@ -1897,12 +1883,11 @@ static void igb_clean_all_tx_rings(struct igb_adapter *adapter)
1897 * 1883 *
1898 * Free all receive software resources 1884 * Free all receive software resources
1899 **/ 1885 **/
1900static void igb_free_rx_resources(struct igb_adapter *adapter, 1886static void igb_free_rx_resources(struct igb_ring *rx_ring)
1901 struct igb_ring *rx_ring)
1902{ 1887{
1903 struct pci_dev *pdev = adapter->pdev; 1888 struct pci_dev *pdev = rx_ring->adapter->pdev;
1904 1889
1905 igb_clean_rx_ring(adapter, rx_ring); 1890 igb_clean_rx_ring(rx_ring);
1906 1891
1907 vfree(rx_ring->buffer_info); 1892 vfree(rx_ring->buffer_info);
1908 rx_ring->buffer_info = NULL; 1893 rx_ring->buffer_info = NULL;
@@ -1923,7 +1908,7 @@ static void igb_free_all_rx_resources(struct igb_adapter *adapter)
1923 int i; 1908 int i;
1924 1909
1925 for (i = 0; i < adapter->num_rx_queues; i++) 1910 for (i = 0; i < adapter->num_rx_queues; i++)
1926 igb_free_rx_resources(adapter, &adapter->rx_ring[i]); 1911 igb_free_rx_resources(&adapter->rx_ring[i]);
1927} 1912}
1928 1913
1929/** 1914/**
@@ -1931,9 +1916,9 @@ static void igb_free_all_rx_resources(struct igb_adapter *adapter)
1931 * @adapter: board private structure 1916 * @adapter: board private structure
1932 * @rx_ring: ring to free buffers from 1917 * @rx_ring: ring to free buffers from
1933 **/ 1918 **/
1934static void igb_clean_rx_ring(struct igb_adapter *adapter, 1919static void igb_clean_rx_ring(struct igb_ring *rx_ring)
1935 struct igb_ring *rx_ring)
1936{ 1920{
1921 struct igb_adapter *adapter = rx_ring->adapter;
1937 struct igb_buffer *buffer_info; 1922 struct igb_buffer *buffer_info;
1938 struct pci_dev *pdev = adapter->pdev; 1923 struct pci_dev *pdev = adapter->pdev;
1939 unsigned long size; 1924 unsigned long size;
@@ -1997,7 +1982,7 @@ static void igb_clean_all_rx_rings(struct igb_adapter *adapter)
1997 int i; 1982 int i;
1998 1983
1999 for (i = 0; i < adapter->num_rx_queues; i++) 1984 for (i = 0; i < adapter->num_rx_queues; i++)
2000 igb_clean_rx_ring(adapter, &adapter->rx_ring[i]); 1985 igb_clean_rx_ring(&adapter->rx_ring[i]);
2001} 1986}
2002 1987
2003/** 1988/**
@@ -3041,26 +3026,19 @@ static irqreturn_t igb_msix_other(int irq, void *data)
3041 struct net_device *netdev = data; 3026 struct net_device *netdev = data;
3042 struct igb_adapter *adapter = netdev_priv(netdev); 3027 struct igb_adapter *adapter = netdev_priv(netdev);
3043 struct e1000_hw *hw = &adapter->hw; 3028 struct e1000_hw *hw = &adapter->hw;
3044 u32 eicr; 3029 u32 icr = rd32(E1000_ICR);
3045 /* disable interrupts from the "other" bit, avoid re-entry */
3046 wr32(E1000_EIMC, E1000_EIMS_OTHER);
3047
3048 eicr = rd32(E1000_EICR);
3049 3030
3050 if (eicr & E1000_EIMS_OTHER) { 3031 /* reading ICR causes bit 31 of EICR to be cleared */
3051 u32 icr = rd32(E1000_ICR); 3032 if (!(icr & E1000_ICR_LSC))
3052 /* reading ICR causes bit 31 of EICR to be cleared */ 3033 goto no_link_interrupt;
3053 if (!(icr & E1000_ICR_LSC)) 3034 hw->mac.get_link_status = 1;
3054 goto no_link_interrupt; 3035 /* guard against interrupt when we're going down */
3055 hw->mac.get_link_status = 1; 3036 if (!test_bit(__IGB_DOWN, &adapter->state))
3056 /* guard against interrupt when we're going down */ 3037 mod_timer(&adapter->watchdog_timer, jiffies + 1);
3057 if (!test_bit(__IGB_DOWN, &adapter->state))
3058 mod_timer(&adapter->watchdog_timer, jiffies + 1);
3059 }
3060 3038
3061no_link_interrupt: 3039no_link_interrupt:
3062 wr32(E1000_IMS, E1000_IMS_LSC); 3040 wr32(E1000_IMS, E1000_IMS_LSC);
3063 wr32(E1000_EIMS, E1000_EIMS_OTHER); 3041 wr32(E1000_EIMS, adapter->eims_other);
3064 3042
3065 return IRQ_HANDLED; 3043 return IRQ_HANDLED;
3066} 3044}
@@ -3076,7 +3054,7 @@ static irqreturn_t igb_msix_tx(int irq, void *data)
3076 3054
3077 tx_ring->total_bytes = 0; 3055 tx_ring->total_bytes = 0;
3078 tx_ring->total_packets = 0; 3056 tx_ring->total_packets = 0;
3079 if (!igb_clean_tx_irq(adapter, tx_ring)) 3057 if (!igb_clean_tx_irq(tx_ring))
3080 /* Ring was not completely cleaned, so fire another interrupt */ 3058 /* Ring was not completely cleaned, so fire another interrupt */
3081 wr32(E1000_EICS, tx_ring->eims_value); 3059 wr32(E1000_EICS, tx_ring->eims_value);
3082 3060
@@ -3091,21 +3069,19 @@ static irqreturn_t igb_msix_rx(int irq, void *data)
3091 struct igb_adapter *adapter = rx_ring->adapter; 3069 struct igb_adapter *adapter = rx_ring->adapter;
3092 struct e1000_hw *hw = &adapter->hw; 3070 struct e1000_hw *hw = &adapter->hw;
3093 3071
3094 if (!rx_ring->itr_val) 3072 /* Write the ITR value calculated at the end of the
3095 wr32(E1000_EIMC, rx_ring->eims_value); 3073 * previous interrupt.
3074 */
3096 3075
3097 if (netif_rx_schedule_prep(adapter->netdev, &rx_ring->napi)) { 3076 if (adapter->set_itr) {
3098 rx_ring->total_bytes = 0; 3077 wr32(rx_ring->itr_register,
3099 rx_ring->total_packets = 0; 3078 1000000000 / (rx_ring->itr_val * 256));
3100 rx_ring->no_itr_adjust = 0; 3079 adapter->set_itr = 0;
3101 __netif_rx_schedule(adapter->netdev, &rx_ring->napi);
3102 } else {
3103 if (!rx_ring->no_itr_adjust) {
3104 igb_lower_rx_eitr(adapter, rx_ring);
3105 rx_ring->no_itr_adjust = 1;
3106 }
3107 } 3080 }
3108 3081
3082 if (netif_rx_schedule_prep(adapter->netdev, &rx_ring->napi))
3083 __netif_rx_schedule(adapter->netdev, &rx_ring->napi);
3084
3109 return IRQ_HANDLED; 3085 return IRQ_HANDLED;
3110} 3086}
3111 3087
@@ -3119,7 +3095,6 @@ static irqreturn_t igb_intr_msi(int irq, void *data)
3119{ 3095{
3120 struct net_device *netdev = data; 3096 struct net_device *netdev = data;
3121 struct igb_adapter *adapter = netdev_priv(netdev); 3097 struct igb_adapter *adapter = netdev_priv(netdev);
3122 struct napi_struct *napi = &adapter->napi;
3123 struct e1000_hw *hw = &adapter->hw; 3098 struct e1000_hw *hw = &adapter->hw;
3124 /* read ICR disables interrupts using IAM */ 3099 /* read ICR disables interrupts using IAM */
3125 u32 icr = rd32(E1000_ICR); 3100 u32 icr = rd32(E1000_ICR);
@@ -3128,25 +3103,17 @@ static irqreturn_t igb_intr_msi(int irq, void *data)
3128 * previous interrupt. 3103 * previous interrupt.
3129 */ 3104 */
3130 if (adapter->set_itr) { 3105 if (adapter->set_itr) {
3131 wr32(E1000_ITR, 3106 wr32(E1000_ITR, 1000000000 / (adapter->itr * 256));
3132 1000000000 / (adapter->itr * 256));
3133 adapter->set_itr = 0; 3107 adapter->set_itr = 0;
3134 } 3108 }
3135 3109
3136 /* read ICR disables interrupts using IAM */
3137 if (icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { 3110 if (icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) {
3138 hw->mac.get_link_status = 1; 3111 hw->mac.get_link_status = 1;
3139 if (!test_bit(__IGB_DOWN, &adapter->state)) 3112 if (!test_bit(__IGB_DOWN, &adapter->state))
3140 mod_timer(&adapter->watchdog_timer, jiffies + 1); 3113 mod_timer(&adapter->watchdog_timer, jiffies + 1);
3141 } 3114 }
3142 3115
3143 if (netif_rx_schedule_prep(netdev, napi)) { 3116 netif_rx_schedule(netdev, &adapter->rx_ring[0].napi);
3144 adapter->tx_ring->total_bytes = 0;
3145 adapter->tx_ring->total_packets = 0;
3146 adapter->rx_ring->total_bytes = 0;
3147 adapter->rx_ring->total_packets = 0;
3148 __netif_rx_schedule(netdev, napi);
3149 }
3150 3117
3151 return IRQ_HANDLED; 3118 return IRQ_HANDLED;
3152} 3119}
@@ -3160,7 +3127,6 @@ static irqreturn_t igb_intr(int irq, void *data)
3160{ 3127{
3161 struct net_device *netdev = data; 3128 struct net_device *netdev = data;
3162 struct igb_adapter *adapter = netdev_priv(netdev); 3129 struct igb_adapter *adapter = netdev_priv(netdev);
3163 struct napi_struct *napi = &adapter->napi;
3164 struct e1000_hw *hw = &adapter->hw; 3130 struct e1000_hw *hw = &adapter->hw;
3165 /* Interrupt Auto-Mask...upon reading ICR, interrupts are masked. No 3131 /* Interrupt Auto-Mask...upon reading ICR, interrupts are masked. No
3166 * need for the IMC write */ 3132 * need for the IMC write */
@@ -3173,8 +3139,7 @@ static irqreturn_t igb_intr(int irq, void *data)
3173 * previous interrupt. 3139 * previous interrupt.
3174 */ 3140 */
3175 if (adapter->set_itr) { 3141 if (adapter->set_itr) {
3176 wr32(E1000_ITR, 3142 wr32(E1000_ITR, 1000000000 / (adapter->itr * 256));
3177 1000000000 / (adapter->itr * 256));
3178 adapter->set_itr = 0; 3143 adapter->set_itr = 0;
3179 } 3144 }
3180 3145
@@ -3192,13 +3157,7 @@ static irqreturn_t igb_intr(int irq, void *data)
3192 mod_timer(&adapter->watchdog_timer, jiffies + 1); 3157 mod_timer(&adapter->watchdog_timer, jiffies + 1);
3193 } 3158 }
3194 3159
3195 if (netif_rx_schedule_prep(netdev, napi)) { 3160 netif_rx_schedule(netdev, &adapter->rx_ring[0].napi);
3196 adapter->tx_ring->total_bytes = 0;
3197 adapter->rx_ring->total_bytes = 0;
3198 adapter->tx_ring->total_packets = 0;
3199 adapter->rx_ring->total_packets = 0;
3200 __netif_rx_schedule(netdev, napi);
3201 }
3202 3161
3203 return IRQ_HANDLED; 3162 return IRQ_HANDLED;
3204} 3163}
@@ -3227,14 +3186,13 @@ static int igb_clean(struct napi_struct *napi, int budget)
3227 * the lock means tx_ring[i] is currently being cleaned anyway. */ 3186 * the lock means tx_ring[i] is currently being cleaned anyway. */
3228 for (i = 0; i < adapter->num_tx_queues; i++) { 3187 for (i = 0; i < adapter->num_tx_queues; i++) {
3229 if (spin_trylock(&adapter->tx_ring[i].tx_clean_lock)) { 3188 if (spin_trylock(&adapter->tx_ring[i].tx_clean_lock)) {
3230 tx_clean_complete &= igb_clean_tx_irq(adapter, 3189 tx_clean_complete &= igb_clean_tx_irq(&adapter->tx_ring[i]);
3231 &adapter->tx_ring[i]);
3232 spin_unlock(&adapter->tx_ring[i].tx_clean_lock); 3190 spin_unlock(&adapter->tx_ring[i].tx_clean_lock);
3233 } 3191 }
3234 } 3192 }
3235 3193
3236 for (i = 0; i < adapter->num_rx_queues; i++) 3194 for (i = 0; i < adapter->num_rx_queues; i++)
3237 igb_clean_rx_irq_adv(adapter, &adapter->rx_ring[i], &work_done, 3195 igb_clean_rx_irq_adv(&adapter->rx_ring[i], &work_done,
3238 adapter->rx_ring[i].napi.weight); 3196 adapter->rx_ring[i].napi.weight);
3239 3197
3240 /* If no Tx and not enough Rx work done, exit the polling mode */ 3198 /* If no Tx and not enough Rx work done, exit the polling mode */
@@ -3264,7 +3222,7 @@ static int igb_clean_rx_ring_msix(struct napi_struct *napi, int budget)
3264 if (!netif_carrier_ok(netdev)) 3222 if (!netif_carrier_ok(netdev))
3265 goto quit_polling; 3223 goto quit_polling;
3266 3224
3267 igb_clean_rx_irq_adv(adapter, rx_ring, &work_done, budget); 3225 igb_clean_rx_irq_adv(rx_ring, &work_done, budget);
3268 3226
3269 3227
3270 /* If not enough Rx work done, exit the polling mode */ 3228 /* If not enough Rx work done, exit the polling mode */
@@ -3282,6 +3240,10 @@ quit_polling:
3282 else if (mean_size > IGB_DYN_ITR_LENGTH_HIGH) 3240 else if (mean_size > IGB_DYN_ITR_LENGTH_HIGH)
3283 igb_lower_rx_eitr(adapter, rx_ring); 3241 igb_lower_rx_eitr(adapter, rx_ring);
3284 } 3242 }
3243
3244 if (!test_bit(__IGB_DOWN, &adapter->state))
3245 wr32(E1000_EIMS, rx_ring->eims_value);
3246
3285 return 0; 3247 return 0;
3286 } 3248 }
3287 3249
@@ -3299,11 +3261,11 @@ static inline u32 get_head(struct igb_ring *tx_ring)
3299 * @adapter: board private structure 3261 * @adapter: board private structure
3300 * returns true if ring is completely cleaned 3262 * returns true if ring is completely cleaned
3301 **/ 3263 **/
3302static bool igb_clean_tx_irq(struct igb_adapter *adapter, 3264static bool igb_clean_tx_irq(struct igb_ring *tx_ring)
3303 struct igb_ring *tx_ring)
3304{ 3265{
3305 struct net_device *netdev = adapter->netdev; 3266 struct igb_adapter *adapter = tx_ring->adapter;
3306 struct e1000_hw *hw = &adapter->hw; 3267 struct e1000_hw *hw = &adapter->hw;
3268 struct net_device *netdev = adapter->netdev;
3307 struct e1000_tx_desc *tx_desc; 3269 struct e1000_tx_desc *tx_desc;
3308 struct igb_buffer *buffer_info; 3270 struct igb_buffer *buffer_info;
3309 struct sk_buff *skb; 3271 struct sk_buff *skb;
@@ -3458,10 +3420,10 @@ static inline void igb_rx_checksum_adv(struct igb_adapter *adapter,
3458 adapter->hw_csum_good++; 3420 adapter->hw_csum_good++;
3459} 3421}
3460 3422
3461static bool igb_clean_rx_irq_adv(struct igb_adapter *adapter, 3423static bool igb_clean_rx_irq_adv(struct igb_ring *rx_ring,
3462 struct igb_ring *rx_ring, 3424 int *work_done, int budget)
3463 int *work_done, int budget)
3464{ 3425{
3426 struct igb_adapter *adapter = rx_ring->adapter;
3465 struct net_device *netdev = adapter->netdev; 3427 struct net_device *netdev = adapter->netdev;
3466 struct pci_dev *pdev = adapter->pdev; 3428 struct pci_dev *pdev = adapter->pdev;
3467 union e1000_adv_rx_desc *rx_desc , *next_rxd; 3429 union e1000_adv_rx_desc *rx_desc , *next_rxd;
@@ -3584,8 +3546,7 @@ next_desc:
3584 3546
3585 /* return some buffers to hardware, one at a time is too slow */ 3547 /* return some buffers to hardware, one at a time is too slow */
3586 if (cleaned_count >= IGB_RX_BUFFER_WRITE) { 3548 if (cleaned_count >= IGB_RX_BUFFER_WRITE) {
3587 igb_alloc_rx_buffers_adv(adapter, rx_ring, 3549 igb_alloc_rx_buffers_adv(rx_ring, cleaned_count);
3588 cleaned_count);
3589 cleaned_count = 0; 3550 cleaned_count = 0;
3590 } 3551 }
3591 3552
@@ -3600,7 +3561,7 @@ out:
3600 cleaned_count = IGB_DESC_UNUSED(rx_ring); 3561 cleaned_count = IGB_DESC_UNUSED(rx_ring);
3601 3562
3602 if (cleaned_count) 3563 if (cleaned_count)
3603 igb_alloc_rx_buffers_adv(adapter, rx_ring, cleaned_count); 3564 igb_alloc_rx_buffers_adv(rx_ring, cleaned_count);
3604 3565
3605 rx_ring->total_packets += total_packets; 3566 rx_ring->total_packets += total_packets;
3606 rx_ring->total_bytes += total_bytes; 3567 rx_ring->total_bytes += total_bytes;
@@ -3616,10 +3577,10 @@ out:
3616 * igb_alloc_rx_buffers_adv - Replace used receive buffers; packet split 3577 * igb_alloc_rx_buffers_adv - Replace used receive buffers; packet split
3617 * @adapter: address of board private structure 3578 * @adapter: address of board private structure
3618 **/ 3579 **/
3619static void igb_alloc_rx_buffers_adv(struct igb_adapter *adapter, 3580static void igb_alloc_rx_buffers_adv(struct igb_ring *rx_ring,
3620 struct igb_ring *rx_ring,
3621 int cleaned_count) 3581 int cleaned_count)
3622{ 3582{
3583 struct igb_adapter *adapter = rx_ring->adapter;
3623 struct net_device *netdev = adapter->netdev; 3584 struct net_device *netdev = adapter->netdev;
3624 struct pci_dev *pdev = adapter->pdev; 3585 struct pci_dev *pdev = adapter->pdev;
3625 union e1000_adv_rx_desc *rx_desc; 3586 union e1000_adv_rx_desc *rx_desc;
@@ -4062,10 +4023,10 @@ static void igb_netpoll(struct net_device *netdev)
4062 4023
4063 igb_irq_disable(adapter); 4024 igb_irq_disable(adapter);
4064 for (i = 0; i < adapter->num_tx_queues; i++) 4025 for (i = 0; i < adapter->num_tx_queues; i++)
4065 igb_clean_tx_irq(adapter, &adapter->tx_ring[i]); 4026 igb_clean_tx_irq(&adapter->tx_ring[i]);
4066 4027
4067 for (i = 0; i < adapter->num_rx_queues; i++) 4028 for (i = 0; i < adapter->num_rx_queues; i++)
4068 igb_clean_rx_irq_adv(adapter, &adapter->rx_ring[i], 4029 igb_clean_rx_irq_adv(&adapter->rx_ring[i],
4069 &work_done, 4030 &work_done,
4070 adapter->rx_ring[i].napi.weight); 4031 adapter->rx_ring[i].napi.weight);
4071 4032
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index 2c03f4e2ccc4..7373dafbb3f7 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -42,7 +42,6 @@
42#define ipg_r16(reg) ioread16(ioaddr + (reg)) 42#define ipg_r16(reg) ioread16(ioaddr + (reg))
43#define ipg_r8(reg) ioread8(ioaddr + (reg)) 43#define ipg_r8(reg) ioread8(ioaddr + (reg))
44 44
45#define JUMBO_FRAME_4k_ONLY
46enum { 45enum {
47 netdev_io_size = 128 46 netdev_io_size = 128
48}; 47};
@@ -55,6 +54,14 @@ MODULE_DESCRIPTION("IC Plus IP1000 Gigabit Ethernet Adapter Linux Driver");
55MODULE_LICENSE("GPL"); 54MODULE_LICENSE("GPL");
56 55
57/* 56/*
57 * Defaults
58 */
59#define IPG_MAX_RXFRAME_SIZE 0x0600
60#define IPG_RXFRAG_SIZE 0x0600
61#define IPG_RXSUPPORT_SIZE 0x0600
62#define IPG_IS_JUMBO false
63
64/*
58 * Variable record -- index by leading revision/length 65 * Variable record -- index by leading revision/length
59 * Revision/Length(=N*4), Address1, Data1, Address2, Data2,...,AddressN,DataN 66 * Revision/Length(=N*4), Address1, Data1, Address2, Data2,...,AddressN,DataN
60 */ 67 */
@@ -631,6 +638,7 @@ static void ipg_nic_set_multicast_list(struct net_device *dev)
631 638
632static int ipg_io_config(struct net_device *dev) 639static int ipg_io_config(struct net_device *dev)
633{ 640{
641 struct ipg_nic_private *sp = netdev_priv(dev);
634 void __iomem *ioaddr = ipg_ioaddr(dev); 642 void __iomem *ioaddr = ipg_ioaddr(dev);
635 u32 origmacctrl; 643 u32 origmacctrl;
636 u32 restoremacctrl; 644 u32 restoremacctrl;
@@ -670,7 +678,7 @@ static int ipg_io_config(struct net_device *dev)
670 /* Set RECEIVEMODE register. */ 678 /* Set RECEIVEMODE register. */
671 ipg_nic_set_multicast_list(dev); 679 ipg_nic_set_multicast_list(dev);
672 680
673 ipg_w16(IPG_MAX_RXFRAME_SIZE, MAX_FRAME_SIZE); 681 ipg_w16(sp->max_rxframe_size, MAX_FRAME_SIZE);
674 682
675 ipg_w8(IPG_RXDMAPOLLPERIOD_VALUE, RX_DMA_POLL_PERIOD); 683 ipg_w8(IPG_RXDMAPOLLPERIOD_VALUE, RX_DMA_POLL_PERIOD);
676 ipg_w8(IPG_RXDMAURGENTTHRESH_VALUE, RX_DMA_URGENT_THRESH); 684 ipg_w8(IPG_RXDMAURGENTTHRESH_VALUE, RX_DMA_URGENT_THRESH);
@@ -730,7 +738,7 @@ static int ipg_get_rxbuff(struct net_device *dev, int entry)
730 738
731 IPG_DEBUG_MSG("_get_rxbuff\n"); 739 IPG_DEBUG_MSG("_get_rxbuff\n");
732 740
733 skb = netdev_alloc_skb(dev, IPG_RXSUPPORT_SIZE + NET_IP_ALIGN); 741 skb = netdev_alloc_skb(dev, sp->rxsupport_size + NET_IP_ALIGN);
734 if (!skb) { 742 if (!skb) {
735 sp->rx_buff[entry] = NULL; 743 sp->rx_buff[entry] = NULL;
736 return -ENOMEM; 744 return -ENOMEM;
@@ -751,7 +759,7 @@ static int ipg_get_rxbuff(struct net_device *dev, int entry)
751 sp->rx_buf_sz, PCI_DMA_FROMDEVICE)); 759 sp->rx_buf_sz, PCI_DMA_FROMDEVICE));
752 760
753 /* Set the RFD fragment length. */ 761 /* Set the RFD fragment length. */
754 rxfragsize = IPG_RXFRAG_SIZE; 762 rxfragsize = sp->rxfrag_size;
755 rxfd->frag_info |= cpu_to_le64((rxfragsize << 48) & IPG_RFI_FRAGLEN); 763 rxfd->frag_info |= cpu_to_le64((rxfragsize << 48) & IPG_RFI_FRAGLEN);
756 764
757 return 0; 765 return 0;
@@ -1076,8 +1084,6 @@ static int ipg_nic_rxrestore(struct net_device *dev)
1076 return 0; 1084 return 0;
1077} 1085}
1078 1086
1079#ifdef JUMBO_FRAME
1080
1081/* use jumboindex and jumbosize to control jumbo frame status 1087/* use jumboindex and jumbosize to control jumbo frame status
1082 * initial status is jumboindex=-1 and jumbosize=0 1088 * initial status is jumboindex=-1 and jumbosize=0
1083 * 1. jumboindex = -1 and jumbosize=0 : previous jumbo frame has been done. 1089 * 1. jumboindex = -1 and jumbosize=0 : previous jumbo frame has been done.
@@ -1097,7 +1103,7 @@ enum {
1097 FRAME_WITH_START_WITH_END = 11 1103 FRAME_WITH_START_WITH_END = 11
1098}; 1104};
1099 1105
1100inline void ipg_nic_rx_free_skb(struct net_device *dev) 1106static void ipg_nic_rx_free_skb(struct net_device *dev)
1101{ 1107{
1102 struct ipg_nic_private *sp = netdev_priv(dev); 1108 struct ipg_nic_private *sp = netdev_priv(dev);
1103 unsigned int entry = sp->rx_current % IPG_RFDLIST_LENGTH; 1109 unsigned int entry = sp->rx_current % IPG_RFDLIST_LENGTH;
@@ -1113,7 +1119,7 @@ inline void ipg_nic_rx_free_skb(struct net_device *dev)
1113 } 1119 }
1114} 1120}
1115 1121
1116inline int ipg_nic_rx_check_frame_type(struct net_device *dev) 1122static int ipg_nic_rx_check_frame_type(struct net_device *dev)
1117{ 1123{
1118 struct ipg_nic_private *sp = netdev_priv(dev); 1124 struct ipg_nic_private *sp = netdev_priv(dev);
1119 struct ipg_rx *rxfd = sp->rxd + (sp->rx_current % IPG_RFDLIST_LENGTH); 1125 struct ipg_rx *rxfd = sp->rxd + (sp->rx_current % IPG_RFDLIST_LENGTH);
@@ -1126,7 +1132,7 @@ inline int ipg_nic_rx_check_frame_type(struct net_device *dev)
1126 return type; 1132 return type;
1127} 1133}
1128 1134
1129inline int ipg_nic_rx_check_error(struct net_device *dev) 1135static int ipg_nic_rx_check_error(struct net_device *dev)
1130{ 1136{
1131 struct ipg_nic_private *sp = netdev_priv(dev); 1137 struct ipg_nic_private *sp = netdev_priv(dev);
1132 unsigned int entry = sp->rx_current % IPG_RFDLIST_LENGTH; 1138 unsigned int entry = sp->rx_current % IPG_RFDLIST_LENGTH;
@@ -1209,8 +1215,8 @@ static void ipg_nic_rx_with_start_and_end(struct net_device *dev,
1209 1215
1210 /* accept this frame and send to upper layer */ 1216 /* accept this frame and send to upper layer */
1211 framelen = le64_to_cpu(rxfd->rfs) & IPG_RFS_RXFRAMELEN; 1217 framelen = le64_to_cpu(rxfd->rfs) & IPG_RFS_RXFRAMELEN;
1212 if (framelen > IPG_RXFRAG_SIZE) 1218 if (framelen > sp->rxfrag_size)
1213 framelen = IPG_RXFRAG_SIZE; 1219 framelen = sp->rxfrag_size;
1214 1220
1215 skb_put(skb, framelen); 1221 skb_put(skb, framelen);
1216 skb->protocol = eth_type_trans(skb, dev); 1222 skb->protocol = eth_type_trans(skb, dev);
@@ -1243,10 +1249,10 @@ static void ipg_nic_rx_with_start(struct net_device *dev,
1243 pci_unmap_single(pdev, le64_to_cpu(rxfd->frag_info & ~IPG_RFI_FRAGLEN), 1249 pci_unmap_single(pdev, le64_to_cpu(rxfd->frag_info & ~IPG_RFI_FRAGLEN),
1244 sp->rx_buf_sz, PCI_DMA_FROMDEVICE); 1250 sp->rx_buf_sz, PCI_DMA_FROMDEVICE);
1245 1251
1246 skb_put(skb, IPG_RXFRAG_SIZE); 1252 skb_put(skb, sp->rxfrag_size);
1247 1253
1248 jumbo->found_start = 1; 1254 jumbo->found_start = 1;
1249 jumbo->current_size = IPG_RXFRAG_SIZE; 1255 jumbo->current_size = sp->rxfrag_size;
1250 jumbo->skb = skb; 1256 jumbo->skb = skb;
1251 1257
1252 sp->rx_buff[entry] = NULL; 1258 sp->rx_buff[entry] = NULL;
@@ -1272,11 +1278,7 @@ static void ipg_nic_rx_with_end(struct net_device *dev,
1272 framelen = le64_to_cpu(rxfd->rfs) & IPG_RFS_RXFRAMELEN; 1278 framelen = le64_to_cpu(rxfd->rfs) & IPG_RFS_RXFRAMELEN;
1273 1279
1274 endframelen = framelen - jumbo->current_size; 1280 endframelen = framelen - jumbo->current_size;
1275 /* 1281 if (framelen > sp->rxsupport_size)
1276 if (framelen > IPG_RXFRAG_SIZE)
1277 framelen=IPG_RXFRAG_SIZE;
1278 */
1279 if (framelen > IPG_RXSUPPORT_SIZE)
1280 dev_kfree_skb_irq(jumbo->skb); 1282 dev_kfree_skb_irq(jumbo->skb);
1281 else { 1283 else {
1282 memcpy(skb_put(jumbo->skb, endframelen), 1284 memcpy(skb_put(jumbo->skb, endframelen),
@@ -1316,11 +1318,11 @@ static void ipg_nic_rx_no_start_no_end(struct net_device *dev,
1316 1318
1317 if (skb) { 1319 if (skb) {
1318 if (jumbo->found_start) { 1320 if (jumbo->found_start) {
1319 jumbo->current_size += IPG_RXFRAG_SIZE; 1321 jumbo->current_size += sp->rxfrag_size;
1320 if (jumbo->current_size <= IPG_RXSUPPORT_SIZE) { 1322 if (jumbo->current_size <= sp->rxsupport_size) {
1321 memcpy(skb_put(jumbo->skb, 1323 memcpy(skb_put(jumbo->skb,
1322 IPG_RXFRAG_SIZE), 1324 sp->rxfrag_size),
1323 skb->data, IPG_RXFRAG_SIZE); 1325 skb->data, sp->rxfrag_size);
1324 } 1326 }
1325 } 1327 }
1326 dev->last_rx = jiffies; 1328 dev->last_rx = jiffies;
@@ -1334,7 +1336,7 @@ static void ipg_nic_rx_no_start_no_end(struct net_device *dev,
1334 } 1336 }
1335} 1337}
1336 1338
1337static int ipg_nic_rx(struct net_device *dev) 1339static int ipg_nic_rx_jumbo(struct net_device *dev)
1338{ 1340{
1339 struct ipg_nic_private *sp = netdev_priv(dev); 1341 struct ipg_nic_private *sp = netdev_priv(dev);
1340 unsigned int curr = sp->rx_current; 1342 unsigned int curr = sp->rx_current;
@@ -1382,7 +1384,6 @@ static int ipg_nic_rx(struct net_device *dev)
1382 return 0; 1384 return 0;
1383} 1385}
1384 1386
1385#else
1386static int ipg_nic_rx(struct net_device *dev) 1387static int ipg_nic_rx(struct net_device *dev)
1387{ 1388{
1388 /* Transfer received Ethernet frames to higher network layers. */ 1389 /* Transfer received Ethernet frames to higher network layers. */
@@ -1413,11 +1414,11 @@ static int ipg_nic_rx(struct net_device *dev)
1413 /* Check for jumbo frame arrival with too small 1414 /* Check for jumbo frame arrival with too small
1414 * RXFRAG_SIZE. 1415 * RXFRAG_SIZE.
1415 */ 1416 */
1416 if (framelen > IPG_RXFRAG_SIZE) { 1417 if (framelen > sp->rxfrag_size) {
1417 IPG_DEBUG_MSG 1418 IPG_DEBUG_MSG
1418 ("RFS FrameLen > allocated fragment size.\n"); 1419 ("RFS FrameLen > allocated fragment size.\n");
1419 1420
1420 framelen = IPG_RXFRAG_SIZE; 1421 framelen = sp->rxfrag_size;
1421 } 1422 }
1422 1423
1423 if ((IPG_DROP_ON_RX_ETH_ERRORS && (le64_to_cpu(rxfd->rfs) & 1424 if ((IPG_DROP_ON_RX_ETH_ERRORS && (le64_to_cpu(rxfd->rfs) &
@@ -1556,7 +1557,6 @@ static int ipg_nic_rx(struct net_device *dev)
1556 1557
1557 return 0; 1558 return 0;
1558} 1559}
1559#endif
1560 1560
1561static void ipg_reset_after_host_error(struct work_struct *work) 1561static void ipg_reset_after_host_error(struct work_struct *work)
1562{ 1562{
@@ -1592,9 +1592,9 @@ static irqreturn_t ipg_interrupt_handler(int irq, void *dev_inst)
1592 1592
1593 IPG_DEBUG_MSG("_interrupt_handler\n"); 1593 IPG_DEBUG_MSG("_interrupt_handler\n");
1594 1594
1595#ifdef JUMBO_FRAME 1595 if (sp->is_jumbo)
1596 ipg_nic_rxrestore(dev); 1596 ipg_nic_rxrestore(dev);
1597#endif 1597
1598 spin_lock(&sp->lock); 1598 spin_lock(&sp->lock);
1599 1599
1600 /* Get interrupt source information, and acknowledge 1600 /* Get interrupt source information, and acknowledge
@@ -1650,7 +1650,10 @@ static irqreturn_t ipg_interrupt_handler(int irq, void *dev_inst)
1650 sp->RFDListCheckedCount++; 1650 sp->RFDListCheckedCount++;
1651#endif 1651#endif
1652 1652
1653 ipg_nic_rx(dev); 1653 if (sp->is_jumbo)
1654 ipg_nic_rx_jumbo(dev);
1655 else
1656 ipg_nic_rx(dev);
1654 } 1657 }
1655 1658
1656 /* If TxDMAComplete interrupt, free used TFDs. */ 1659 /* If TxDMAComplete interrupt, free used TFDs. */
@@ -1749,7 +1752,7 @@ static int ipg_nic_open(struct net_device *dev)
1749 1752
1750 IPG_DEBUG_MSG("_nic_open\n"); 1753 IPG_DEBUG_MSG("_nic_open\n");
1751 1754
1752 sp->rx_buf_sz = IPG_RXSUPPORT_SIZE; 1755 sp->rx_buf_sz = sp->rxsupport_size;
1753 1756
1754 /* Check for interrupt line conflicts, and request interrupt 1757 /* Check for interrupt line conflicts, and request interrupt
1755 * line for IPG. 1758 * line for IPG.
@@ -1804,13 +1807,10 @@ static int ipg_nic_open(struct net_device *dev)
1804 if (ipg_config_autoneg(dev) < 0) 1807 if (ipg_config_autoneg(dev) < 0)
1805 printk(KERN_INFO "%s: Auto-negotiation error.\n", dev->name); 1808 printk(KERN_INFO "%s: Auto-negotiation error.\n", dev->name);
1806 1809
1807#ifdef JUMBO_FRAME
1808 /* initialize JUMBO Frame control variable */ 1810 /* initialize JUMBO Frame control variable */
1809 sp->jumbo.found_start = 0; 1811 sp->jumbo.found_start = 0;
1810 sp->jumbo.current_size = 0; 1812 sp->jumbo.current_size = 0;
1811 sp->jumbo.skb = NULL; 1813 sp->jumbo.skb = NULL;
1812 dev->mtu = IPG_TXFRAG_SIZE;
1813#endif
1814 1814
1815 /* Enable transmit and receive operation of the IPG. */ 1815 /* Enable transmit and receive operation of the IPG. */
1816 ipg_w32((ipg_r32(MAC_CTRL) | IPG_MC_RX_ENABLE | IPG_MC_TX_ENABLE) & 1816 ipg_w32((ipg_r32(MAC_CTRL) | IPG_MC_RX_ENABLE | IPG_MC_TX_ENABLE) &
@@ -2119,6 +2119,9 @@ static int ipg_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
2119 2119
2120static int ipg_nic_change_mtu(struct net_device *dev, int new_mtu) 2120static int ipg_nic_change_mtu(struct net_device *dev, int new_mtu)
2121{ 2121{
2122 struct ipg_nic_private *sp = netdev_priv(dev);
2123 int err;
2124
2122 /* Function to accomodate changes to Maximum Transfer Unit 2125 /* Function to accomodate changes to Maximum Transfer Unit
2123 * (or MTU) of IPG NIC. Cannot use default function since 2126 * (or MTU) of IPG NIC. Cannot use default function since
2124 * the default will not allow for MTU > 1500 bytes. 2127 * the default will not allow for MTU > 1500 bytes.
@@ -2126,16 +2129,33 @@ static int ipg_nic_change_mtu(struct net_device *dev, int new_mtu)
2126 2129
2127 IPG_DEBUG_MSG("_nic_change_mtu\n"); 2130 IPG_DEBUG_MSG("_nic_change_mtu\n");
2128 2131
2129 /* Check that the new MTU value is between 68 (14 byte header, 46 2132 /*
2130 * byte payload, 4 byte FCS) and IPG_MAX_RXFRAME_SIZE, which 2133 * Check that the new MTU value is between 68 (14 byte header, 46 byte
2131 * corresponds to the MAXFRAMESIZE register in the IPG. 2134 * payload, 4 byte FCS) and 10 KB, which is the largest supported MTU.
2132 */ 2135 */
2133 if ((new_mtu < 68) || (new_mtu > IPG_MAX_RXFRAME_SIZE)) 2136 if (new_mtu < 68 || new_mtu > 10240)
2134 return -EINVAL; 2137 return -EINVAL;
2135 2138
2139 err = ipg_nic_stop(dev);
2140 if (err)
2141 return err;
2142
2136 dev->mtu = new_mtu; 2143 dev->mtu = new_mtu;
2137 2144
2138 return 0; 2145 sp->max_rxframe_size = new_mtu;
2146
2147 sp->rxfrag_size = new_mtu;
2148 if (sp->rxfrag_size > 4088)
2149 sp->rxfrag_size = 4088;
2150
2151 sp->rxsupport_size = sp->max_rxframe_size;
2152
2153 if (new_mtu > 0x0600)
2154 sp->is_jumbo = true;
2155 else
2156 sp->is_jumbo = false;
2157
2158 return ipg_nic_open(dev);
2139} 2159}
2140 2160
2141static int ipg_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) 2161static int ipg_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
@@ -2240,6 +2260,11 @@ static int __devinit ipg_probe(struct pci_dev *pdev,
2240 spin_lock_init(&sp->lock); 2260 spin_lock_init(&sp->lock);
2241 mutex_init(&sp->mii_mutex); 2261 mutex_init(&sp->mii_mutex);
2242 2262
2263 sp->is_jumbo = IPG_IS_JUMBO;
2264 sp->rxfrag_size = IPG_RXFRAG_SIZE;
2265 sp->rxsupport_size = IPG_RXSUPPORT_SIZE;
2266 sp->max_rxframe_size = IPG_MAX_RXFRAME_SIZE;
2267
2243 /* Declare IPG NIC functions for Ethernet device methods. 2268 /* Declare IPG NIC functions for Ethernet device methods.
2244 */ 2269 */
2245 dev->open = &ipg_nic_open; 2270 dev->open = &ipg_nic_open;
diff --git a/drivers/net/ipg.h b/drivers/net/ipg.h
index cda53887d4db..e0e718ab4c2e 100644
--- a/drivers/net/ipg.h
+++ b/drivers/net/ipg.h
@@ -536,83 +536,6 @@ enum ipg_regs {
536 */ 536 */
537#define IPG_FRAMESBETWEENTXDMACOMPLETES 0x1 537#define IPG_FRAMESBETWEENTXDMACOMPLETES 0x1
538 538
539#ifdef JUMBO_FRAME
540
541# ifdef JUMBO_FRAME_SIZE_2K
542# define JUMBO_FRAME_SIZE 2048
543# define __IPG_RXFRAG_SIZE 2048
544# else
545# ifdef JUMBO_FRAME_SIZE_3K
546# define JUMBO_FRAME_SIZE 3072
547# define __IPG_RXFRAG_SIZE 3072
548# else
549# ifdef JUMBO_FRAME_SIZE_4K
550# define JUMBO_FRAME_SIZE 4096
551# define __IPG_RXFRAG_SIZE 4088
552# else
553# ifdef JUMBO_FRAME_SIZE_5K
554# define JUMBO_FRAME_SIZE 5120
555# define __IPG_RXFRAG_SIZE 4088
556# else
557# ifdef JUMBO_FRAME_SIZE_6K
558# define JUMBO_FRAME_SIZE 6144
559# define __IPG_RXFRAG_SIZE 4088
560# else
561# ifdef JUMBO_FRAME_SIZE_7K
562# define JUMBO_FRAME_SIZE 7168
563# define __IPG_RXFRAG_SIZE 4088
564# else
565# ifdef JUMBO_FRAME_SIZE_8K
566# define JUMBO_FRAME_SIZE 8192
567# define __IPG_RXFRAG_SIZE 4088
568# else
569# ifdef JUMBO_FRAME_SIZE_9K
570# define JUMBO_FRAME_SIZE 9216
571# define __IPG_RXFRAG_SIZE 4088
572# else
573# ifdef JUMBO_FRAME_SIZE_10K
574# define JUMBO_FRAME_SIZE 10240
575# define __IPG_RXFRAG_SIZE 4088
576# else
577# define JUMBO_FRAME_SIZE 4096
578# endif
579# endif
580# endif
581# endif
582# endif
583# endif
584# endif
585# endif
586# endif
587#endif
588
589/* Size of allocated received buffers. Nominally 0x0600.
590 * Define larger if expecting jumbo frames.
591 */
592#ifdef JUMBO_FRAME
593/* IPG_TXFRAG_SIZE must <= 0x2b00, or TX will crash */
594#define IPG_TXFRAG_SIZE JUMBO_FRAME_SIZE
595#endif
596
597/* Size of allocated received buffers. Nominally 0x0600.
598 * Define larger if expecting jumbo frames.
599 */
600#ifdef JUMBO_FRAME
601/* 4088 = 4096 - 8 */
602#define IPG_RXFRAG_SIZE __IPG_RXFRAG_SIZE
603#define IPG_RXSUPPORT_SIZE IPG_MAX_RXFRAME_SIZE
604#else
605#define IPG_RXFRAG_SIZE 0x0600
606#define IPG_RXSUPPORT_SIZE IPG_RXFRAG_SIZE
607#endif
608
609/* IPG_MAX_RXFRAME_SIZE <= IPG_RXFRAG_SIZE */
610#ifdef JUMBO_FRAME
611#define IPG_MAX_RXFRAME_SIZE JUMBO_FRAME_SIZE
612#else
613#define IPG_MAX_RXFRAME_SIZE 0x0600
614#endif
615
616#define IPG_RFDLIST_LENGTH 0x100 539#define IPG_RFDLIST_LENGTH 0x100
617 540
618/* Maximum number of RFDs to process per interrupt. 541/* Maximum number of RFDs to process per interrupt.
@@ -786,9 +709,11 @@ struct ipg_nic_private {
786 unsigned int tx_dirty; 709 unsigned int tx_dirty;
787 unsigned int rx_current; 710 unsigned int rx_current;
788 unsigned int rx_dirty; 711 unsigned int rx_dirty;
789#ifdef JUMBO_FRAME 712 bool is_jumbo;
790 struct ipg_jumbo jumbo; 713 struct ipg_jumbo jumbo;
791#endif 714 unsigned long rxfrag_size;
715 unsigned long rxsupport_size;
716 unsigned long max_rxframe_size;
792 unsigned int rx_buf_sz; 717 unsigned int rx_buf_sz;
793 struct pci_dev *pdev; 718 struct pci_dev *pdev;
794 struct net_device *dev; 719 struct net_device *dev;
diff --git a/drivers/net/ne.c b/drivers/net/ne.c
index 874d291cbaed..14126973bd12 100644
--- a/drivers/net/ne.c
+++ b/drivers/net/ne.c
@@ -217,7 +217,7 @@ static int __init do_ne_probe(struct net_device *dev)
217#ifndef MODULE 217#ifndef MODULE
218struct net_device * __init ne_probe(int unit) 218struct net_device * __init ne_probe(int unit)
219{ 219{
220 struct net_device *dev = alloc_ei_netdev(); 220 struct net_device *dev = alloc_eip_netdev();
221 int err; 221 int err;
222 222
223 if (!dev) 223 if (!dev)
@@ -490,7 +490,7 @@ static int __init ne_probe1(struct net_device *dev, unsigned long ioaddr)
490 490
491 /* Snarf the interrupt now. There's no point in waiting since we cannot 491 /* Snarf the interrupt now. There's no point in waiting since we cannot
492 share and the board will usually be enabled. */ 492 share and the board will usually be enabled. */
493 ret = request_irq(dev->irq, ei_interrupt, 0, name, dev); 493 ret = request_irq(dev->irq, eip_interrupt, 0, name, dev);
494 if (ret) { 494 if (ret) {
495 printk (" unable to get IRQ %d (errno=%d).\n", dev->irq, ret); 495 printk (" unable to get IRQ %d (errno=%d).\n", dev->irq, ret);
496 goto err_out; 496 goto err_out;
@@ -534,7 +534,7 @@ static int __init ne_probe1(struct net_device *dev, unsigned long ioaddr)
534 dev->open = &ne_open; 534 dev->open = &ne_open;
535 dev->stop = &ne_close; 535 dev->stop = &ne_close;
536#ifdef CONFIG_NET_POLL_CONTROLLER 536#ifdef CONFIG_NET_POLL_CONTROLLER
537 dev->poll_controller = ei_poll; 537 dev->poll_controller = eip_poll;
538#endif 538#endif
539 NS8390_init(dev, 0); 539 NS8390_init(dev, 0);
540 540
@@ -554,7 +554,7 @@ err_out:
554 554
555static int ne_open(struct net_device *dev) 555static int ne_open(struct net_device *dev)
556{ 556{
557 ei_open(dev); 557 eip_open(dev);
558 return 0; 558 return 0;
559} 559}
560 560
@@ -562,7 +562,7 @@ static int ne_close(struct net_device *dev)
562{ 562{
563 if (ei_debug > 1) 563 if (ei_debug > 1)
564 printk(KERN_DEBUG "%s: Shutting down ethercard.\n", dev->name); 564 printk(KERN_DEBUG "%s: Shutting down ethercard.\n", dev->name);
565 ei_close(dev); 565 eip_close(dev);
566 return 0; 566 return 0;
567} 567}
568 568
@@ -814,7 +814,7 @@ static int __init ne_drv_probe(struct platform_device *pdev)
814 if (!res || irq < 0) 814 if (!res || irq < 0)
815 return -ENODEV; 815 return -ENODEV;
816 816
817 dev = alloc_ei_netdev(); 817 dev = alloc_eip_netdev();
818 if (!dev) 818 if (!dev)
819 return -ENOMEM; 819 return -ENOMEM;
820 dev->irq = irq; 820 dev->irq = irq;
@@ -912,7 +912,7 @@ int __init init_module(void)
912 int plat_found = !ne_init(); 912 int plat_found = !ne_init();
913 913
914 for (this_dev = 0; this_dev < MAX_NE_CARDS; this_dev++) { 914 for (this_dev = 0; this_dev < MAX_NE_CARDS; this_dev++) {
915 struct net_device *dev = alloc_ei_netdev(); 915 struct net_device *dev = alloc_eip_netdev();
916 if (!dev) 916 if (!dev)
917 break; 917 break;
918 dev->irq = irq[this_dev]; 918 dev->irq = irq[this_dev];
diff --git a/drivers/net/ne2.c b/drivers/net/ne2.c
index f4cd8c7e81ba..8f7256346922 100644
--- a/drivers/net/ne2.c
+++ b/drivers/net/ne2.c
@@ -280,7 +280,7 @@ static int __init do_ne2_probe(struct net_device *dev)
280#ifndef MODULE 280#ifndef MODULE
281struct net_device * __init ne2_probe(int unit) 281struct net_device * __init ne2_probe(int unit)
282{ 282{
283 struct net_device *dev = alloc_ei_netdev(); 283 struct net_device *dev = alloc_eip_netdev();
284 int err; 284 int err;
285 285
286 if (!dev) 286 if (!dev)
@@ -457,7 +457,7 @@ static int __init ne2_probe1(struct net_device *dev, int slot)
457 457
458 /* Snarf the interrupt now. There's no point in waiting since we cannot 458 /* Snarf the interrupt now. There's no point in waiting since we cannot
459 share and the board will usually be enabled. */ 459 share and the board will usually be enabled. */
460 retval = request_irq(dev->irq, ei_interrupt, 0, DRV_NAME, dev); 460 retval = request_irq(dev->irq, eip_interrupt, 0, DRV_NAME, dev);
461 if (retval) { 461 if (retval) {
462 printk (" unable to get IRQ %d (irqval=%d).\n", 462 printk (" unable to get IRQ %d (irqval=%d).\n",
463 dev->irq, retval); 463 dev->irq, retval);
@@ -497,9 +497,9 @@ static int __init ne2_probe1(struct net_device *dev, int slot)
497 dev->open = &ne_open; 497 dev->open = &ne_open;
498 dev->stop = &ne_close; 498 dev->stop = &ne_close;
499#ifdef CONFIG_NET_POLL_CONTROLLER 499#ifdef CONFIG_NET_POLL_CONTROLLER
500 dev->poll_controller = ei_poll; 500 dev->poll_controller = eip_poll;
501#endif 501#endif
502 NS8390_init(dev, 0); 502 NS8390p_init(dev, 0);
503 503
504 retval = register_netdev(dev); 504 retval = register_netdev(dev);
505 if (retval) 505 if (retval)
@@ -515,7 +515,7 @@ out:
515 515
516static int ne_open(struct net_device *dev) 516static int ne_open(struct net_device *dev)
517{ 517{
518 ei_open(dev); 518 eip_open(dev);
519 return 0; 519 return 0;
520} 520}
521 521
@@ -523,7 +523,7 @@ static int ne_close(struct net_device *dev)
523{ 523{
524 if (ei_debug > 1) 524 if (ei_debug > 1)
525 printk("%s: Shutting down ethercard.\n", dev->name); 525 printk("%s: Shutting down ethercard.\n", dev->name);
526 ei_close(dev); 526 eip_close(dev);
527 return 0; 527 return 0;
528} 528}
529 529
@@ -748,7 +748,7 @@ retry:
748 if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */ 748 if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */
749 printk("%s: timeout waiting for Tx RDC.\n", dev->name); 749 printk("%s: timeout waiting for Tx RDC.\n", dev->name);
750 ne_reset_8390(dev); 750 ne_reset_8390(dev);
751 NS8390_init(dev,1); 751 NS8390p_init(dev, 1);
752 break; 752 break;
753 } 753 }
754 754
@@ -781,7 +781,7 @@ int __init init_module(void)
781 int this_dev, found = 0; 781 int this_dev, found = 0;
782 782
783 for (this_dev = 0; this_dev < MAX_NE_CARDS; this_dev++) { 783 for (this_dev = 0; this_dev < MAX_NE_CARDS; this_dev++) {
784 dev = alloc_ei_netdev(); 784 dev = alloc_eip_netdev();
785 if (!dev) 785 if (!dev)
786 break; 786 break;
787 dev->irq = irq[this_dev]; 787 dev->irq = irq[this_dev];
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 657242504621..cfe8829ed31f 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -28,13 +28,7 @@
28#include <asm/io.h> 28#include <asm/io.h>
29#include <asm/irq.h> 29#include <asm/irq.h>
30 30
31#ifdef CONFIG_R8169_NAPI 31#define RTL8169_VERSION "2.3LK-NAPI"
32#define NAPI_SUFFIX "-NAPI"
33#else
34#define NAPI_SUFFIX ""
35#endif
36
37#define RTL8169_VERSION "2.2LK" NAPI_SUFFIX
38#define MODULENAME "r8169" 32#define MODULENAME "r8169"
39#define PFX MODULENAME ": " 33#define PFX MODULENAME ": "
40 34
@@ -57,16 +51,6 @@
57#define TX_BUFFS_AVAIL(tp) \ 51#define TX_BUFFS_AVAIL(tp) \
58 (tp->dirty_tx + NUM_TX_DESC - tp->cur_tx - 1) 52 (tp->dirty_tx + NUM_TX_DESC - tp->cur_tx - 1)
59 53
60#ifdef CONFIG_R8169_NAPI
61#define rtl8169_rx_skb netif_receive_skb
62#define rtl8169_rx_hwaccel_skb vlan_hwaccel_receive_skb
63#define rtl8169_rx_quota(count, quota) min(count, quota)
64#else
65#define rtl8169_rx_skb netif_rx
66#define rtl8169_rx_hwaccel_skb vlan_hwaccel_rx
67#define rtl8169_rx_quota(count, quota) count
68#endif
69
70/* Maximum events (Rx packets, etc.) to handle at each interrupt. */ 54/* Maximum events (Rx packets, etc.) to handle at each interrupt. */
71static const int max_interrupt_work = 20; 55static const int max_interrupt_work = 20;
72 56
@@ -394,9 +378,7 @@ struct rtl8169_private {
394 void __iomem *mmio_addr; /* memory map physical address */ 378 void __iomem *mmio_addr; /* memory map physical address */
395 struct pci_dev *pci_dev; /* Index of PCI device */ 379 struct pci_dev *pci_dev; /* Index of PCI device */
396 struct net_device *dev; 380 struct net_device *dev;
397#ifdef CONFIG_R8169_NAPI
398 struct napi_struct napi; 381 struct napi_struct napi;
399#endif
400 spinlock_t lock; /* spin lock flag */ 382 spinlock_t lock; /* spin lock flag */
401 u32 msg_enable; 383 u32 msg_enable;
402 int chipset; 384 int chipset;
@@ -458,10 +440,7 @@ static int rtl8169_rx_interrupt(struct net_device *, struct rtl8169_private *,
458static int rtl8169_change_mtu(struct net_device *dev, int new_mtu); 440static int rtl8169_change_mtu(struct net_device *dev, int new_mtu);
459static void rtl8169_down(struct net_device *dev); 441static void rtl8169_down(struct net_device *dev);
460static void rtl8169_rx_clear(struct rtl8169_private *tp); 442static void rtl8169_rx_clear(struct rtl8169_private *tp);
461
462#ifdef CONFIG_R8169_NAPI
463static int rtl8169_poll(struct napi_struct *napi, int budget); 443static int rtl8169_poll(struct napi_struct *napi, int budget);
464#endif
465 444
466static const unsigned int rtl8169_rx_config = 445static const unsigned int rtl8169_rx_config =
467 (RX_FIFO_THRESH << RxCfgFIFOShift) | (RX_DMA_BURST << RxCfgDMAShift); 446 (RX_FIFO_THRESH << RxCfgFIFOShift) | (RX_DMA_BURST << RxCfgDMAShift);
@@ -843,10 +822,11 @@ static int rtl8169_rx_vlan_skb(struct rtl8169_private *tp, struct RxDesc *desc,
843 struct sk_buff *skb) 822 struct sk_buff *skb)
844{ 823{
845 u32 opts2 = le32_to_cpu(desc->opts2); 824 u32 opts2 = le32_to_cpu(desc->opts2);
825 struct vlan_group *vlgrp = tp->vlgrp;
846 int ret; 826 int ret;
847 827
848 if (tp->vlgrp && (opts2 & RxVlanTag)) { 828 if (vlgrp && (opts2 & RxVlanTag)) {
849 rtl8169_rx_hwaccel_skb(skb, tp->vlgrp, swab16(opts2 & 0xffff)); 829 vlan_hwaccel_receive_skb(skb, vlgrp, swab16(opts2 & 0xffff));
850 ret = 0; 830 ret = 0;
851 } else 831 } else
852 ret = -1; 832 ret = -1;
@@ -1764,9 +1744,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1764 dev->change_mtu = rtl8169_change_mtu; 1744 dev->change_mtu = rtl8169_change_mtu;
1765 dev->set_mac_address = rtl_set_mac_address; 1745 dev->set_mac_address = rtl_set_mac_address;
1766 1746
1767#ifdef CONFIG_R8169_NAPI
1768 netif_napi_add(dev, &tp->napi, rtl8169_poll, R8169_NAPI_WEIGHT); 1747 netif_napi_add(dev, &tp->napi, rtl8169_poll, R8169_NAPI_WEIGHT);
1769#endif
1770 1748
1771#ifdef CONFIG_R8169_VLAN 1749#ifdef CONFIG_R8169_VLAN
1772 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 1750 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
@@ -1887,9 +1865,7 @@ static int rtl8169_open(struct net_device *dev)
1887 if (retval < 0) 1865 if (retval < 0)
1888 goto err_release_ring_2; 1866 goto err_release_ring_2;
1889 1867
1890#ifdef CONFIG_R8169_NAPI
1891 napi_enable(&tp->napi); 1868 napi_enable(&tp->napi);
1892#endif
1893 1869
1894 rtl_hw_start(dev); 1870 rtl_hw_start(dev);
1895 1871
@@ -2197,9 +2173,7 @@ static int rtl8169_change_mtu(struct net_device *dev, int new_mtu)
2197 if (ret < 0) 2173 if (ret < 0)
2198 goto out; 2174 goto out;
2199 2175
2200#ifdef CONFIG_R8169_NAPI
2201 napi_enable(&tp->napi); 2176 napi_enable(&tp->napi);
2202#endif
2203 2177
2204 rtl_hw_start(dev); 2178 rtl_hw_start(dev);
2205 2179
@@ -2391,17 +2365,13 @@ static void rtl8169_wait_for_quiescence(struct net_device *dev)
2391 synchronize_irq(dev->irq); 2365 synchronize_irq(dev->irq);
2392 2366
2393 /* Wait for any pending NAPI task to complete */ 2367 /* Wait for any pending NAPI task to complete */
2394#ifdef CONFIG_R8169_NAPI
2395 napi_disable(&tp->napi); 2368 napi_disable(&tp->napi);
2396#endif
2397 2369
2398 rtl8169_irq_mask_and_ack(ioaddr); 2370 rtl8169_irq_mask_and_ack(ioaddr);
2399 2371
2400#ifdef CONFIG_R8169_NAPI
2401 tp->intr_mask = 0xffff; 2372 tp->intr_mask = 0xffff;
2402 RTL_W16(IntrMask, tp->intr_event); 2373 RTL_W16(IntrMask, tp->intr_event);
2403 napi_enable(&tp->napi); 2374 napi_enable(&tp->napi);
2404#endif
2405} 2375}
2406 2376
2407static void rtl8169_reinit_task(struct work_struct *work) 2377static void rtl8169_reinit_task(struct work_struct *work)
@@ -2767,7 +2737,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev,
2767 2737
2768 cur_rx = tp->cur_rx; 2738 cur_rx = tp->cur_rx;
2769 rx_left = NUM_RX_DESC + tp->dirty_rx - cur_rx; 2739 rx_left = NUM_RX_DESC + tp->dirty_rx - cur_rx;
2770 rx_left = rtl8169_rx_quota(rx_left, budget); 2740 rx_left = min(rx_left, budget);
2771 2741
2772 for (; rx_left > 0; rx_left--, cur_rx++) { 2742 for (; rx_left > 0; rx_left--, cur_rx++) {
2773 unsigned int entry = cur_rx % NUM_RX_DESC; 2743 unsigned int entry = cur_rx % NUM_RX_DESC;
@@ -2829,7 +2799,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev,
2829 skb->protocol = eth_type_trans(skb, dev); 2799 skb->protocol = eth_type_trans(skb, dev);
2830 2800
2831 if (rtl8169_rx_vlan_skb(tp, desc, skb) < 0) 2801 if (rtl8169_rx_vlan_skb(tp, desc, skb) < 0)
2832 rtl8169_rx_skb(skb); 2802 netif_receive_skb(skb);
2833 2803
2834 dev->last_rx = jiffies; 2804 dev->last_rx = jiffies;
2835 dev->stats.rx_bytes += pkt_size; 2805 dev->stats.rx_bytes += pkt_size;
@@ -2869,87 +2839,61 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance)
2869{ 2839{
2870 struct net_device *dev = dev_instance; 2840 struct net_device *dev = dev_instance;
2871 struct rtl8169_private *tp = netdev_priv(dev); 2841 struct rtl8169_private *tp = netdev_priv(dev);
2872 int boguscnt = max_interrupt_work;
2873 void __iomem *ioaddr = tp->mmio_addr; 2842 void __iomem *ioaddr = tp->mmio_addr;
2874 int status;
2875 int handled = 0; 2843 int handled = 0;
2844 int status;
2876 2845
2877 do { 2846 status = RTL_R16(IntrStatus);
2878 status = RTL_R16(IntrStatus);
2879 2847
2880 /* hotplug/major error/no more work/shared irq */ 2848 /* hotplug/major error/no more work/shared irq */
2881 if ((status == 0xFFFF) || !status) 2849 if ((status == 0xffff) || !status)
2882 break; 2850 goto out;
2883 2851
2884 handled = 1; 2852 handled = 1;
2885 2853
2886 if (unlikely(!netif_running(dev))) { 2854 if (unlikely(!netif_running(dev))) {
2887 rtl8169_asic_down(ioaddr); 2855 rtl8169_asic_down(ioaddr);
2888 goto out; 2856 goto out;
2889 } 2857 }
2890 2858
2891 status &= tp->intr_mask; 2859 status &= tp->intr_mask;
2892 RTL_W16(IntrStatus, 2860 RTL_W16(IntrStatus,
2893 (status & RxFIFOOver) ? (status | RxOverflow) : status); 2861 (status & RxFIFOOver) ? (status | RxOverflow) : status);
2894 2862
2895 if (!(status & tp->intr_event)) 2863 if (!(status & tp->intr_event))
2896 break; 2864 goto out;
2897 2865
2898 /* Work around for rx fifo overflow */ 2866 /* Work around for rx fifo overflow */
2899 if (unlikely(status & RxFIFOOver) && 2867 if (unlikely(status & RxFIFOOver) &&
2900 (tp->mac_version == RTL_GIGA_MAC_VER_11)) { 2868 (tp->mac_version == RTL_GIGA_MAC_VER_11)) {
2901 netif_stop_queue(dev); 2869 netif_stop_queue(dev);
2902 rtl8169_tx_timeout(dev); 2870 rtl8169_tx_timeout(dev);
2903 break; 2871 goto out;
2904 } 2872 }
2905 2873
2906 if (unlikely(status & SYSErr)) { 2874 if (unlikely(status & SYSErr)) {
2907 rtl8169_pcierr_interrupt(dev); 2875 rtl8169_pcierr_interrupt(dev);
2908 break; 2876 goto out;
2909 } 2877 }
2910 2878
2911 if (status & LinkChg) 2879 if (status & LinkChg)
2912 rtl8169_check_link_status(dev, tp, ioaddr); 2880 rtl8169_check_link_status(dev, tp, ioaddr);
2913 2881
2914#ifdef CONFIG_R8169_NAPI 2882 if (status & tp->napi_event) {
2915 if (status & tp->napi_event) { 2883 RTL_W16(IntrMask, tp->intr_event & ~tp->napi_event);
2916 RTL_W16(IntrMask, tp->intr_event & ~tp->napi_event); 2884 tp->intr_mask = ~tp->napi_event;
2917 tp->intr_mask = ~tp->napi_event;
2918 2885
2919 if (likely(netif_rx_schedule_prep(dev, &tp->napi))) 2886 if (likely(netif_rx_schedule_prep(dev, &tp->napi)))
2920 __netif_rx_schedule(dev, &tp->napi); 2887 __netif_rx_schedule(dev, &tp->napi);
2921 else if (netif_msg_intr(tp)) { 2888 else if (netif_msg_intr(tp)) {
2922 printk(KERN_INFO "%s: interrupt %04x in poll\n", 2889 printk(KERN_INFO "%s: interrupt %04x in poll\n",
2923 dev->name, status); 2890 dev->name, status);
2924 }
2925 } 2891 }
2926 break;
2927#else
2928 /* Rx interrupt */
2929 if (status & (RxOK | RxOverflow | RxFIFOOver))
2930 rtl8169_rx_interrupt(dev, tp, ioaddr, ~(u32)0);
2931
2932 /* Tx interrupt */
2933 if (status & (TxOK | TxErr))
2934 rtl8169_tx_interrupt(dev, tp, ioaddr);
2935#endif
2936
2937 boguscnt--;
2938 } while (boguscnt > 0);
2939
2940 if (boguscnt <= 0) {
2941 if (netif_msg_intr(tp) && net_ratelimit() ) {
2942 printk(KERN_WARNING
2943 "%s: Too much work at interrupt!\n", dev->name);
2944 }
2945 /* Clear all interrupt sources. */
2946 RTL_W16(IntrStatus, 0xffff);
2947 } 2892 }
2948out: 2893out:
2949 return IRQ_RETVAL(handled); 2894 return IRQ_RETVAL(handled);
2950} 2895}
2951 2896
2952#ifdef CONFIG_R8169_NAPI
2953static int rtl8169_poll(struct napi_struct *napi, int budget) 2897static int rtl8169_poll(struct napi_struct *napi, int budget)
2954{ 2898{
2955 struct rtl8169_private *tp = container_of(napi, struct rtl8169_private, napi); 2899 struct rtl8169_private *tp = container_of(napi, struct rtl8169_private, napi);
@@ -2975,7 +2919,6 @@ static int rtl8169_poll(struct napi_struct *napi, int budget)
2975 2919
2976 return work_done; 2920 return work_done;
2977} 2921}
2978#endif
2979 2922
2980static void rtl8169_down(struct net_device *dev) 2923static void rtl8169_down(struct net_device *dev)
2981{ 2924{
@@ -2987,9 +2930,7 @@ static void rtl8169_down(struct net_device *dev)
2987 2930
2988 netif_stop_queue(dev); 2931 netif_stop_queue(dev);
2989 2932
2990#ifdef CONFIG_R8169_NAPI
2991 napi_disable(&tp->napi); 2933 napi_disable(&tp->napi);
2992#endif
2993 2934
2994core_down: 2935core_down:
2995 spin_lock_irq(&tp->lock); 2936 spin_lock_irq(&tp->lock);
@@ -3098,8 +3039,10 @@ static void rtl_set_rx_mode(struct net_device *dev)
3098 (tp->mac_version == RTL_GIGA_MAC_VER_15) || 3039 (tp->mac_version == RTL_GIGA_MAC_VER_15) ||
3099 (tp->mac_version == RTL_GIGA_MAC_VER_16) || 3040 (tp->mac_version == RTL_GIGA_MAC_VER_16) ||
3100 (tp->mac_version == RTL_GIGA_MAC_VER_17)) { 3041 (tp->mac_version == RTL_GIGA_MAC_VER_17)) {
3101 mc_filter[0] = 0xffffffff; 3042 u32 data = mc_filter[0];
3102 mc_filter[1] = 0xffffffff; 3043
3044 mc_filter[0] = swab32(mc_filter[1]);
3045 mc_filter[1] = swab32(data);
3103 } 3046 }
3104 3047
3105 RTL_W32(MAR0 + 0, mc_filter[0]); 3048 RTL_W32(MAR0 + 0, mc_filter[0]);
diff --git a/drivers/net/wan/c101.c b/drivers/net/wan/c101.c
index c2cc42f723d5..c8e563106a4a 100644
--- a/drivers/net/wan/c101.c
+++ b/drivers/net/wan/c101.c
@@ -133,9 +133,9 @@ static void sca_msci_intr(port_t *port)
133 sca_out(stat & (ST1_UDRN | ST1_CDCD), MSCI0_OFFSET + ST1, port); 133 sca_out(stat & (ST1_UDRN | ST1_CDCD), MSCI0_OFFSET + ST1, port);
134 134
135 if (stat & ST1_UDRN) { 135 if (stat & ST1_UDRN) {
136 struct net_device_stats *stats = hdlc_stats(port_to_dev(port)); 136 /* TX Underrun error detected */
137 stats->tx_errors++; /* TX Underrun error detected */ 137 port_to_dev(port)->stats.tx_errors++;
138 stats->tx_fifo_errors++; 138 port_to_dev(port)->stats.tx_fifo_errors++;
139 } 139 }
140 140
141 stat = sca_in(MSCI1_OFFSET + ST1, port); /* read MSCI1 ST1 status */ 141 stat = sca_in(MSCI1_OFFSET + ST1, port); /* read MSCI1 ST1 status */
diff --git a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c
index c6f26e28e376..50ef5b4efd6d 100644
--- a/drivers/net/wan/dscc4.c
+++ b/drivers/net/wan/dscc4.c
@@ -642,7 +642,6 @@ static inline void dscc4_rx_skb(struct dscc4_dev_priv *dpriv,
642 struct net_device *dev) 642 struct net_device *dev)
643{ 643{
644 struct RxFD *rx_fd = dpriv->rx_fd + dpriv->rx_current%RX_RING_SIZE; 644 struct RxFD *rx_fd = dpriv->rx_fd + dpriv->rx_current%RX_RING_SIZE;
645 struct net_device_stats *stats = hdlc_stats(dev);
646 struct pci_dev *pdev = dpriv->pci_priv->pdev; 645 struct pci_dev *pdev = dpriv->pci_priv->pdev;
647 struct sk_buff *skb; 646 struct sk_buff *skb;
648 int pkt_len; 647 int pkt_len;
@@ -656,8 +655,8 @@ static inline void dscc4_rx_skb(struct dscc4_dev_priv *dpriv,
656 pci_unmap_single(pdev, le32_to_cpu(rx_fd->data), 655 pci_unmap_single(pdev, le32_to_cpu(rx_fd->data),
657 RX_MAX(HDLC_MAX_MRU), PCI_DMA_FROMDEVICE); 656 RX_MAX(HDLC_MAX_MRU), PCI_DMA_FROMDEVICE);
658 if ((skb->data[--pkt_len] & FrameOk) == FrameOk) { 657 if ((skb->data[--pkt_len] & FrameOk) == FrameOk) {
659 stats->rx_packets++; 658 dev->stats.rx_packets++;
660 stats->rx_bytes += pkt_len; 659 dev->stats.rx_bytes += pkt_len;
661 skb_put(skb, pkt_len); 660 skb_put(skb, pkt_len);
662 if (netif_running(dev)) 661 if (netif_running(dev))
663 skb->protocol = hdlc_type_trans(skb, dev); 662 skb->protocol = hdlc_type_trans(skb, dev);
@@ -665,13 +664,13 @@ static inline void dscc4_rx_skb(struct dscc4_dev_priv *dpriv,
665 netif_rx(skb); 664 netif_rx(skb);
666 } else { 665 } else {
667 if (skb->data[pkt_len] & FrameRdo) 666 if (skb->data[pkt_len] & FrameRdo)
668 stats->rx_fifo_errors++; 667 dev->stats.rx_fifo_errors++;
669 else if (!(skb->data[pkt_len] | ~FrameCrc)) 668 else if (!(skb->data[pkt_len] | ~FrameCrc))
670 stats->rx_crc_errors++; 669 dev->stats.rx_crc_errors++;
671 else if (!(skb->data[pkt_len] | ~(FrameVfr | FrameRab))) 670 else if (!(skb->data[pkt_len] | ~(FrameVfr | FrameRab)))
672 stats->rx_length_errors++; 671 dev->stats.rx_length_errors++;
673 else 672 else
674 stats->rx_errors++; 673 dev->stats.rx_errors++;
675 dev_kfree_skb_irq(skb); 674 dev_kfree_skb_irq(skb);
676 } 675 }
677refill: 676refill:
@@ -1569,7 +1568,6 @@ try:
1569 1568
1570 if (state & SccEvt) { 1569 if (state & SccEvt) {
1571 if (state & Alls) { 1570 if (state & Alls) {
1572 struct net_device_stats *stats = hdlc_stats(dev);
1573 struct sk_buff *skb; 1571 struct sk_buff *skb;
1574 struct TxFD *tx_fd; 1572 struct TxFD *tx_fd;
1575 1573
@@ -1586,8 +1584,8 @@ try:
1586 pci_unmap_single(ppriv->pdev, le32_to_cpu(tx_fd->data), 1584 pci_unmap_single(ppriv->pdev, le32_to_cpu(tx_fd->data),
1587 skb->len, PCI_DMA_TODEVICE); 1585 skb->len, PCI_DMA_TODEVICE);
1588 if (tx_fd->state & FrameEnd) { 1586 if (tx_fd->state & FrameEnd) {
1589 stats->tx_packets++; 1587 dev->stats.tx_packets++;
1590 stats->tx_bytes += skb->len; 1588 dev->stats.tx_bytes += skb->len;
1591 } 1589 }
1592 dev_kfree_skb_irq(skb); 1590 dev_kfree_skb_irq(skb);
1593 dpriv->tx_skbuff[cur] = NULL; 1591 dpriv->tx_skbuff[cur] = NULL;
@@ -1698,7 +1696,7 @@ try:
1698 } 1696 }
1699 if (state & Err) { 1697 if (state & Err) {
1700 printk(KERN_INFO "%s: Tx ERR\n", dev->name); 1698 printk(KERN_INFO "%s: Tx ERR\n", dev->name);
1701 hdlc_stats(dev)->tx_errors++; 1699 dev->stats.tx_errors++;
1702 state &= ~Err; 1700 state &= ~Err;
1703 } 1701 }
1704 } 1702 }
@@ -1834,7 +1832,7 @@ try:
1834 if (!(rx_fd->state2 & DataComplete)) 1832 if (!(rx_fd->state2 & DataComplete))
1835 break; 1833 break;
1836 if (rx_fd->state2 & FrameAborted) { 1834 if (rx_fd->state2 & FrameAborted) {
1837 hdlc_stats(dev)->rx_over_errors++; 1835 dev->stats.rx_over_errors++;
1838 rx_fd->state1 |= Hold; 1836 rx_fd->state1 |= Hold;
1839 rx_fd->state2 = 0x00000000; 1837 rx_fd->state2 = 0x00000000;
1840 rx_fd->end = cpu_to_le32(0xbabeface); 1838 rx_fd->end = cpu_to_le32(0xbabeface);
diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c
index 547368e9633d..754f00809e3e 100644
--- a/drivers/net/wan/farsync.c
+++ b/drivers/net/wan/farsync.c
@@ -845,7 +845,6 @@ fst_tx_dma_complete(struct fst_card_info *card, struct fst_port_info *port,
845 int len, int txpos) 845 int len, int txpos)
846{ 846{
847 struct net_device *dev = port_to_dev(port); 847 struct net_device *dev = port_to_dev(port);
848 struct net_device_stats *stats = hdlc_stats(dev);
849 848
850 /* 849 /*
851 * Everything is now set, just tell the card to go 850 * Everything is now set, just tell the card to go
@@ -853,8 +852,8 @@ fst_tx_dma_complete(struct fst_card_info *card, struct fst_port_info *port,
853 dbg(DBG_TX, "fst_tx_dma_complete\n"); 852 dbg(DBG_TX, "fst_tx_dma_complete\n");
854 FST_WRB(card, txDescrRing[port->index][txpos].bits, 853 FST_WRB(card, txDescrRing[port->index][txpos].bits,
855 DMA_OWN | TX_STP | TX_ENP); 854 DMA_OWN | TX_STP | TX_ENP);
856 stats->tx_packets++; 855 dev->stats.tx_packets++;
857 stats->tx_bytes += len; 856 dev->stats.tx_bytes += len;
858 dev->trans_start = jiffies; 857 dev->trans_start = jiffies;
859} 858}
860 859
@@ -876,7 +875,6 @@ fst_rx_dma_complete(struct fst_card_info *card, struct fst_port_info *port,
876 int len, struct sk_buff *skb, int rxp) 875 int len, struct sk_buff *skb, int rxp)
877{ 876{
878 struct net_device *dev = port_to_dev(port); 877 struct net_device *dev = port_to_dev(port);
879 struct net_device_stats *stats = hdlc_stats(dev);
880 int pi; 878 int pi;
881 int rx_status; 879 int rx_status;
882 880
@@ -888,8 +886,8 @@ fst_rx_dma_complete(struct fst_card_info *card, struct fst_port_info *port,
888 FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN); 886 FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN);
889 887
890 /* Update stats */ 888 /* Update stats */
891 stats->rx_packets++; 889 dev->stats.rx_packets++;
892 stats->rx_bytes += len; 890 dev->stats.rx_bytes += len;
893 891
894 /* Push upstream */ 892 /* Push upstream */
895 dbg(DBG_RX, "Pushing the frame up the stack\n"); 893 dbg(DBG_RX, "Pushing the frame up the stack\n");
@@ -900,7 +898,7 @@ fst_rx_dma_complete(struct fst_card_info *card, struct fst_port_info *port,
900 rx_status = netif_rx(skb); 898 rx_status = netif_rx(skb);
901 fst_process_rx_status(rx_status, port_to_dev(port)->name); 899 fst_process_rx_status(rx_status, port_to_dev(port)->name);
902 if (rx_status == NET_RX_DROP) 900 if (rx_status == NET_RX_DROP)
903 stats->rx_dropped++; 901 dev->stats.rx_dropped++;
904 dev->last_rx = jiffies; 902 dev->last_rx = jiffies;
905} 903}
906 904
@@ -1163,29 +1161,28 @@ fst_log_rx_error(struct fst_card_info *card, struct fst_port_info *port,
1163 unsigned char dmabits, int rxp, unsigned short len) 1161 unsigned char dmabits, int rxp, unsigned short len)
1164{ 1162{
1165 struct net_device *dev = port_to_dev(port); 1163 struct net_device *dev = port_to_dev(port);
1166 struct net_device_stats *stats = hdlc_stats(dev);
1167 1164
1168 /* 1165 /*
1169 * Increment the appropriate error counter 1166 * Increment the appropriate error counter
1170 */ 1167 */
1171 stats->rx_errors++; 1168 dev->stats.rx_errors++;
1172 if (dmabits & RX_OFLO) { 1169 if (dmabits & RX_OFLO) {
1173 stats->rx_fifo_errors++; 1170 dev->stats.rx_fifo_errors++;
1174 dbg(DBG_ASS, "Rx fifo error on card %d port %d buffer %d\n", 1171 dbg(DBG_ASS, "Rx fifo error on card %d port %d buffer %d\n",
1175 card->card_no, port->index, rxp); 1172 card->card_no, port->index, rxp);
1176 } 1173 }
1177 if (dmabits & RX_CRC) { 1174 if (dmabits & RX_CRC) {
1178 stats->rx_crc_errors++; 1175 dev->stats.rx_crc_errors++;
1179 dbg(DBG_ASS, "Rx crc error on card %d port %d\n", 1176 dbg(DBG_ASS, "Rx crc error on card %d port %d\n",
1180 card->card_no, port->index); 1177 card->card_no, port->index);
1181 } 1178 }
1182 if (dmabits & RX_FRAM) { 1179 if (dmabits & RX_FRAM) {
1183 stats->rx_frame_errors++; 1180 dev->stats.rx_frame_errors++;
1184 dbg(DBG_ASS, "Rx frame error on card %d port %d\n", 1181 dbg(DBG_ASS, "Rx frame error on card %d port %d\n",
1185 card->card_no, port->index); 1182 card->card_no, port->index);
1186 } 1183 }
1187 if (dmabits == (RX_STP | RX_ENP)) { 1184 if (dmabits == (RX_STP | RX_ENP)) {
1188 stats->rx_length_errors++; 1185 dev->stats.rx_length_errors++;
1189 dbg(DBG_ASS, "Rx length error (%d) on card %d port %d\n", 1186 dbg(DBG_ASS, "Rx length error (%d) on card %d port %d\n",
1190 len, card->card_no, port->index); 1187 len, card->card_no, port->index);
1191 } 1188 }
@@ -1242,7 +1239,6 @@ fst_intr_rx(struct fst_card_info *card, struct fst_port_info *port)
1242 unsigned short len; 1239 unsigned short len;
1243 struct sk_buff *skb; 1240 struct sk_buff *skb;
1244 struct net_device *dev = port_to_dev(port); 1241 struct net_device *dev = port_to_dev(port);
1245 struct net_device_stats *stats = hdlc_stats(dev);
1246 1242
1247 /* Check we have a buffer to process */ 1243 /* Check we have a buffer to process */
1248 pi = port->index; 1244 pi = port->index;
@@ -1291,7 +1287,7 @@ fst_intr_rx(struct fst_card_info *card, struct fst_port_info *port)
1291 if ((skb = dev_alloc_skb(len)) == NULL) { 1287 if ((skb = dev_alloc_skb(len)) == NULL) {
1292 dbg(DBG_RX, "intr_rx: can't allocate buffer\n"); 1288 dbg(DBG_RX, "intr_rx: can't allocate buffer\n");
1293 1289
1294 stats->rx_dropped++; 1290 dev->stats.rx_dropped++;
1295 1291
1296 /* Return descriptor to card */ 1292 /* Return descriptor to card */
1297 FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN); 1293 FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN);
@@ -1316,8 +1312,8 @@ fst_intr_rx(struct fst_card_info *card, struct fst_port_info *port)
1316 FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN); 1312 FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN);
1317 1313
1318 /* Update stats */ 1314 /* Update stats */
1319 stats->rx_packets++; 1315 dev->stats.rx_packets++;
1320 stats->rx_bytes += len; 1316 dev->stats.rx_bytes += len;
1321 1317
1322 /* Push upstream */ 1318 /* Push upstream */
1323 dbg(DBG_RX, "Pushing frame up the stack\n"); 1319 dbg(DBG_RX, "Pushing frame up the stack\n");
@@ -1327,9 +1323,8 @@ fst_intr_rx(struct fst_card_info *card, struct fst_port_info *port)
1327 skb->protocol = hdlc_type_trans(skb, dev); 1323 skb->protocol = hdlc_type_trans(skb, dev);
1328 rx_status = netif_rx(skb); 1324 rx_status = netif_rx(skb);
1329 fst_process_rx_status(rx_status, port_to_dev(port)->name); 1325 fst_process_rx_status(rx_status, port_to_dev(port)->name);
1330 if (rx_status == NET_RX_DROP) { 1326 if (rx_status == NET_RX_DROP)
1331 stats->rx_dropped++; 1327 dev->stats.rx_dropped++;
1332 }
1333 dev->last_rx = jiffies; 1328 dev->last_rx = jiffies;
1334 } else { 1329 } else {
1335 card->dma_skb_rx = skb; 1330 card->dma_skb_rx = skb;
@@ -1361,7 +1356,6 @@ do_bottom_half_tx(struct fst_card_info *card)
1361 struct sk_buff *skb; 1356 struct sk_buff *skb;
1362 unsigned long flags; 1357 unsigned long flags;
1363 struct net_device *dev; 1358 struct net_device *dev;
1364 struct net_device_stats *stats;
1365 1359
1366 /* 1360 /*
1367 * Find a free buffer for the transmit 1361 * Find a free buffer for the transmit
@@ -1373,12 +1367,10 @@ do_bottom_half_tx(struct fst_card_info *card)
1373 if (!port->run) 1367 if (!port->run)
1374 continue; 1368 continue;
1375 1369
1376 dev = port_to_dev(port); 1370 dev = port_to_dev(port);
1377 stats = hdlc_stats(dev); 1371 while (!(FST_RDB(card, txDescrRing[pi][port->txpos].bits) &
1378 while (! 1372 DMA_OWN)
1379 (FST_RDB(card, txDescrRing[pi][port->txpos].bits) & 1373 && !(card->dmatx_in_progress)) {
1380 DMA_OWN)
1381 && !(card->dmatx_in_progress)) {
1382 /* 1374 /*
1383 * There doesn't seem to be a txdone event per-se 1375 * There doesn't seem to be a txdone event per-se
1384 * We seem to have to deduce it, by checking the DMA_OWN 1376 * We seem to have to deduce it, by checking the DMA_OWN
@@ -1422,8 +1414,8 @@ do_bottom_half_tx(struct fst_card_info *card)
1422 txDescrRing[pi][port->txpos]. 1414 txDescrRing[pi][port->txpos].
1423 bits, 1415 bits,
1424 DMA_OWN | TX_STP | TX_ENP); 1416 DMA_OWN | TX_STP | TX_ENP);
1425 stats->tx_packets++; 1417 dev->stats.tx_packets++;
1426 stats->tx_bytes += skb->len; 1418 dev->stats.tx_bytes += skb->len;
1427 dev->trans_start = jiffies; 1419 dev->trans_start = jiffies;
1428 } else { 1420 } else {
1429 /* Or do it through dma */ 1421 /* Or do it through dma */
@@ -1628,8 +1620,8 @@ fst_intr(int dummy, void *dev_id)
1628 * always load up the entire packet for DMA. 1620 * always load up the entire packet for DMA.
1629 */ 1621 */
1630 dbg(DBG_TX, "Tx underflow port %d\n", port->index); 1622 dbg(DBG_TX, "Tx underflow port %d\n", port->index);
1631 hdlc_stats(port_to_dev(port))->tx_errors++; 1623 port_to_dev(port)->stats.tx_errors++;
1632 hdlc_stats(port_to_dev(port))->tx_fifo_errors++; 1624 port_to_dev(port)->stats.tx_fifo_errors++;
1633 dbg(DBG_ASS, "Tx underflow on card %d port %d\n", 1625 dbg(DBG_ASS, "Tx underflow on card %d port %d\n",
1634 card->card_no, port->index); 1626 card->card_no, port->index);
1635 break; 1627 break;
@@ -2292,12 +2284,11 @@ fst_tx_timeout(struct net_device *dev)
2292{ 2284{
2293 struct fst_port_info *port; 2285 struct fst_port_info *port;
2294 struct fst_card_info *card; 2286 struct fst_card_info *card;
2295 struct net_device_stats *stats = hdlc_stats(dev);
2296 2287
2297 port = dev_to_port(dev); 2288 port = dev_to_port(dev);
2298 card = port->card; 2289 card = port->card;
2299 stats->tx_errors++; 2290 dev->stats.tx_errors++;
2300 stats->tx_aborted_errors++; 2291 dev->stats.tx_aborted_errors++;
2301 dbg(DBG_ASS, "Tx timeout card %d port %d\n", 2292 dbg(DBG_ASS, "Tx timeout card %d port %d\n",
2302 card->card_no, port->index); 2293 card->card_no, port->index);
2303 fst_issue_cmd(port, ABORTTX); 2294 fst_issue_cmd(port, ABORTTX);
@@ -2312,7 +2303,6 @@ fst_start_xmit(struct sk_buff *skb, struct net_device *dev)
2312{ 2303{
2313 struct fst_card_info *card; 2304 struct fst_card_info *card;
2314 struct fst_port_info *port; 2305 struct fst_port_info *port;
2315 struct net_device_stats *stats = hdlc_stats(dev);
2316 unsigned long flags; 2306 unsigned long flags;
2317 int txq_length; 2307 int txq_length;
2318 2308
@@ -2323,8 +2313,8 @@ fst_start_xmit(struct sk_buff *skb, struct net_device *dev)
2323 /* Drop packet with error if we don't have carrier */ 2313 /* Drop packet with error if we don't have carrier */
2324 if (!netif_carrier_ok(dev)) { 2314 if (!netif_carrier_ok(dev)) {
2325 dev_kfree_skb(skb); 2315 dev_kfree_skb(skb);
2326 stats->tx_errors++; 2316 dev->stats.tx_errors++;
2327 stats->tx_carrier_errors++; 2317 dev->stats.tx_carrier_errors++;
2328 dbg(DBG_ASS, 2318 dbg(DBG_ASS,
2329 "Tried to transmit but no carrier on card %d port %d\n", 2319 "Tried to transmit but no carrier on card %d port %d\n",
2330 card->card_no, port->index); 2320 card->card_no, port->index);
@@ -2336,7 +2326,7 @@ fst_start_xmit(struct sk_buff *skb, struct net_device *dev)
2336 dbg(DBG_ASS, "Packet too large %d vs %d\n", skb->len, 2326 dbg(DBG_ASS, "Packet too large %d vs %d\n", skb->len,
2337 LEN_TX_BUFFER); 2327 LEN_TX_BUFFER);
2338 dev_kfree_skb(skb); 2328 dev_kfree_skb(skb);
2339 stats->tx_errors++; 2329 dev->stats.tx_errors++;
2340 return 0; 2330 return 0;
2341 } 2331 }
2342 2332
@@ -2368,7 +2358,7 @@ fst_start_xmit(struct sk_buff *skb, struct net_device *dev)
2368 * This shouldn't have happened but such is life 2358 * This shouldn't have happened but such is life
2369 */ 2359 */
2370 dev_kfree_skb(skb); 2360 dev_kfree_skb(skb);
2371 stats->tx_errors++; 2361 dev->stats.tx_errors++;
2372 dbg(DBG_ASS, "Tx queue overflow card %d port %d\n", 2362 dbg(DBG_ASS, "Tx queue overflow card %d port %d\n",
2373 card->card_no, port->index); 2363 card->card_no, port->index);
2374 return 0; 2364 return 0;
diff --git a/drivers/net/wan/hd6457x.c b/drivers/net/wan/hd6457x.c
index 8d0a1f2f00e5..591fb45a7c68 100644
--- a/drivers/net/wan/hd6457x.c
+++ b/drivers/net/wan/hd6457x.c
@@ -271,9 +271,9 @@ static inline void sca_msci_intr(port_t *port)
271 sca_out(stat & (ST1_UDRN | ST1_CDCD), msci + ST1, card); 271 sca_out(stat & (ST1_UDRN | ST1_CDCD), msci + ST1, card);
272 272
273 if (stat & ST1_UDRN) { 273 if (stat & ST1_UDRN) {
274 struct net_device_stats *stats = hdlc_stats(port_to_dev(port)); 274 /* TX Underrun error detected */
275 stats->tx_errors++; /* TX Underrun error detected */ 275 port_to_dev(port)->stats.tx_errors++;
276 stats->tx_fifo_errors++; 276 port_to_dev(port)->stats.tx_fifo_errors++;
277 } 277 }
278 278
279 if (stat & ST1_CDCD) 279 if (stat & ST1_CDCD)
@@ -286,7 +286,6 @@ static inline void sca_msci_intr(port_t *port)
286static inline void sca_rx(card_t *card, port_t *port, pkt_desc __iomem *desc, u16 rxin) 286static inline void sca_rx(card_t *card, port_t *port, pkt_desc __iomem *desc, u16 rxin)
287{ 287{
288 struct net_device *dev = port_to_dev(port); 288 struct net_device *dev = port_to_dev(port);
289 struct net_device_stats *stats = hdlc_stats(dev);
290 struct sk_buff *skb; 289 struct sk_buff *skb;
291 u16 len; 290 u16 len;
292 u32 buff; 291 u32 buff;
@@ -298,7 +297,7 @@ static inline void sca_rx(card_t *card, port_t *port, pkt_desc __iomem *desc, u1
298 len = readw(&desc->len); 297 len = readw(&desc->len);
299 skb = dev_alloc_skb(len); 298 skb = dev_alloc_skb(len);
300 if (!skb) { 299 if (!skb) {
301 stats->rx_dropped++; 300 dev->stats.rx_dropped++;
302 return; 301 return;
303 } 302 }
304 303
@@ -327,8 +326,8 @@ static inline void sca_rx(card_t *card, port_t *port, pkt_desc __iomem *desc, u1
327 printk(KERN_DEBUG "%s RX(%i):", dev->name, skb->len); 326 printk(KERN_DEBUG "%s RX(%i):", dev->name, skb->len);
328 debug_frame(skb); 327 debug_frame(skb);
329#endif 328#endif
330 stats->rx_packets++; 329 dev->stats.rx_packets++;
331 stats->rx_bytes += skb->len; 330 dev->stats.rx_bytes += skb->len;
332 dev->last_rx = jiffies; 331 dev->last_rx = jiffies;
333 skb->protocol = hdlc_type_trans(skb, dev); 332 skb->protocol = hdlc_type_trans(skb, dev);
334 netif_rx(skb); 333 netif_rx(skb);
@@ -339,17 +338,18 @@ static inline void sca_rx(card_t *card, port_t *port, pkt_desc __iomem *desc, u1
339/* Receive DMA interrupt service */ 338/* Receive DMA interrupt service */
340static inline void sca_rx_intr(port_t *port) 339static inline void sca_rx_intr(port_t *port)
341{ 340{
341 struct net_device *dev = port_to_dev(port);
342 u16 dmac = get_dmac_rx(port); 342 u16 dmac = get_dmac_rx(port);
343 card_t *card = port_to_card(port); 343 card_t *card = port_to_card(port);
344 u8 stat = sca_in(DSR_RX(phy_node(port)), card); /* read DMA Status */ 344 u8 stat = sca_in(DSR_RX(phy_node(port)), card); /* read DMA Status */
345 struct net_device_stats *stats = hdlc_stats(port_to_dev(port));
346 345
347 /* Reset DSR status bits */ 346 /* Reset DSR status bits */
348 sca_out((stat & (DSR_EOT | DSR_EOM | DSR_BOF | DSR_COF)) | DSR_DWE, 347 sca_out((stat & (DSR_EOT | DSR_EOM | DSR_BOF | DSR_COF)) | DSR_DWE,
349 DSR_RX(phy_node(port)), card); 348 DSR_RX(phy_node(port)), card);
350 349
351 if (stat & DSR_BOF) 350 if (stat & DSR_BOF)
352 stats->rx_over_errors++; /* Dropped one or more frames */ 351 /* Dropped one or more frames */
352 dev->stats.rx_over_errors++;
353 353
354 while (1) { 354 while (1) {
355 u32 desc_off = desc_offset(port, port->rxin, 0); 355 u32 desc_off = desc_offset(port, port->rxin, 0);
@@ -364,12 +364,14 @@ static inline void sca_rx_intr(port_t *port)
364 if (!(stat & ST_RX_EOM)) 364 if (!(stat & ST_RX_EOM))
365 port->rxpart = 1; /* partial frame received */ 365 port->rxpart = 1; /* partial frame received */
366 else if ((stat & ST_ERROR_MASK) || port->rxpart) { 366 else if ((stat & ST_ERROR_MASK) || port->rxpart) {
367 stats->rx_errors++; 367 dev->stats.rx_errors++;
368 if (stat & ST_RX_OVERRUN) stats->rx_fifo_errors++; 368 if (stat & ST_RX_OVERRUN)
369 dev->stats.rx_fifo_errors++;
369 else if ((stat & (ST_RX_SHORT | ST_RX_ABORT | 370 else if ((stat & (ST_RX_SHORT | ST_RX_ABORT |
370 ST_RX_RESBIT)) || port->rxpart) 371 ST_RX_RESBIT)) || port->rxpart)
371 stats->rx_frame_errors++; 372 dev->stats.rx_frame_errors++;
372 else if (stat & ST_RX_CRC) stats->rx_crc_errors++; 373 else if (stat & ST_RX_CRC)
374 dev->stats.rx_crc_errors++;
373 if (stat & ST_RX_EOM) 375 if (stat & ST_RX_EOM)
374 port->rxpart = 0; /* received last fragment */ 376 port->rxpart = 0; /* received last fragment */
375 } else 377 } else
@@ -390,7 +392,6 @@ static inline void sca_rx_intr(port_t *port)
390static inline void sca_tx_intr(port_t *port) 392static inline void sca_tx_intr(port_t *port)
391{ 393{
392 struct net_device *dev = port_to_dev(port); 394 struct net_device *dev = port_to_dev(port);
393 struct net_device_stats *stats = hdlc_stats(dev);
394 u16 dmac = get_dmac_tx(port); 395 u16 dmac = get_dmac_tx(port);
395 card_t* card = port_to_card(port); 396 card_t* card = port_to_card(port);
396 u8 stat; 397 u8 stat;
@@ -412,8 +413,8 @@ static inline void sca_tx_intr(port_t *port)
412 break; /* Transmitter is/will_be sending this frame */ 413 break; /* Transmitter is/will_be sending this frame */
413 414
414 desc = desc_address(port, port->txlast, 1); 415 desc = desc_address(port, port->txlast, 1);
415 stats->tx_packets++; 416 dev->stats.tx_packets++;
416 stats->tx_bytes += readw(&desc->len); 417 dev->stats.tx_bytes += readw(&desc->len);
417 writeb(0, &desc->stat); /* Free descriptor */ 418 writeb(0, &desc->stat); /* Free descriptor */
418 port->txlast = next_desc(port, port->txlast, 1); 419 port->txlast = next_desc(port, port->txlast, 1);
419 } 420 }
diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c
index 7f984895b0d5..e3a536477c7e 100644
--- a/drivers/net/wan/hdlc.c
+++ b/drivers/net/wan/hdlc.c
@@ -57,7 +57,7 @@ static int hdlc_change_mtu(struct net_device *dev, int new_mtu)
57 57
58static struct net_device_stats *hdlc_get_stats(struct net_device *dev) 58static struct net_device_stats *hdlc_get_stats(struct net_device *dev)
59{ 59{
60 return hdlc_stats(dev); 60 return &dev->stats;
61} 61}
62 62
63 63
diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c
index 762d21c1c703..849819c2552d 100644
--- a/drivers/net/wan/hdlc_cisco.c
+++ b/drivers/net/wan/hdlc_cisco.c
@@ -252,8 +252,8 @@ static int cisco_rx(struct sk_buff *skb)
252 dev_kfree_skb_any(skb); 252 dev_kfree_skb_any(skb);
253 return NET_RX_DROP; 253 return NET_RX_DROP;
254 254
255 rx_error: 255rx_error:
256 dev_to_hdlc(dev)->stats.rx_errors++; /* Mark error */ 256 dev->stats.rx_errors++; /* Mark error */
257 dev_kfree_skb_any(skb); 257 dev_kfree_skb_any(skb);
258 return NET_RX_DROP; 258 return NET_RX_DROP;
259} 259}
diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c
index 520bb0b1a9a2..109bab34094d 100644
--- a/drivers/net/wan/hdlc_fr.c
+++ b/drivers/net/wan/hdlc_fr.c
@@ -135,11 +135,6 @@ typedef struct pvc_device_struct {
135 }state; 135 }state;
136}pvc_device; 136}pvc_device;
137 137
138struct pvc_desc {
139 struct net_device_stats stats;
140 pvc_device *pvc;
141};
142
143struct frad_state { 138struct frad_state {
144 fr_proto settings; 139 fr_proto settings;
145 pvc_device *first_pvc; 140 pvc_device *first_pvc;
@@ -179,15 +174,6 @@ static inline struct frad_state* state(hdlc_device *hdlc)
179 return(struct frad_state *)(hdlc->state); 174 return(struct frad_state *)(hdlc->state);
180} 175}
181 176
182static inline struct pvc_desc* pvcdev_to_desc(struct net_device *dev)
183{
184 return dev->priv;
185}
186
187static inline struct net_device_stats* pvc_get_stats(struct net_device *dev)
188{
189 return &pvcdev_to_desc(dev)->stats;
190}
191 177
192static inline pvc_device* find_pvc(hdlc_device *hdlc, u16 dlci) 178static inline pvc_device* find_pvc(hdlc_device *hdlc, u16 dlci)
193{ 179{
@@ -357,7 +343,7 @@ static int fr_hard_header(struct sk_buff **skb_p, u16 dlci)
357 343
358static int pvc_open(struct net_device *dev) 344static int pvc_open(struct net_device *dev)
359{ 345{
360 pvc_device *pvc = pvcdev_to_desc(dev)->pvc; 346 pvc_device *pvc = dev->priv;
361 347
362 if ((pvc->frad->flags & IFF_UP) == 0) 348 if ((pvc->frad->flags & IFF_UP) == 0)
363 return -EIO; /* Frad must be UP in order to activate PVC */ 349 return -EIO; /* Frad must be UP in order to activate PVC */
@@ -377,7 +363,7 @@ static int pvc_open(struct net_device *dev)
377 363
378static int pvc_close(struct net_device *dev) 364static int pvc_close(struct net_device *dev)
379{ 365{
380 pvc_device *pvc = pvcdev_to_desc(dev)->pvc; 366 pvc_device *pvc = dev->priv;
381 367
382 if (--pvc->open_count == 0) { 368 if (--pvc->open_count == 0) {
383 hdlc_device *hdlc = dev_to_hdlc(pvc->frad); 369 hdlc_device *hdlc = dev_to_hdlc(pvc->frad);
@@ -396,7 +382,7 @@ static int pvc_close(struct net_device *dev)
396 382
397static int pvc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) 383static int pvc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
398{ 384{
399 pvc_device *pvc = pvcdev_to_desc(dev)->pvc; 385 pvc_device *pvc = dev->priv;
400 fr_proto_pvc_info info; 386 fr_proto_pvc_info info;
401 387
402 if (ifr->ifr_settings.type == IF_GET_PROTO) { 388 if (ifr->ifr_settings.type == IF_GET_PROTO) {
@@ -424,8 +410,7 @@ static int pvc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
424 410
425static int pvc_xmit(struct sk_buff *skb, struct net_device *dev) 411static int pvc_xmit(struct sk_buff *skb, struct net_device *dev)
426{ 412{
427 pvc_device *pvc = pvcdev_to_desc(dev)->pvc; 413 pvc_device *pvc = dev->priv;
428 struct net_device_stats *stats = pvc_get_stats(dev);
429 414
430 if (pvc->state.active) { 415 if (pvc->state.active) {
431 if (dev->type == ARPHRD_ETHER) { 416 if (dev->type == ARPHRD_ETHER) {
@@ -435,7 +420,7 @@ static int pvc_xmit(struct sk_buff *skb, struct net_device *dev)
435 if (skb_tailroom(skb) < pad) 420 if (skb_tailroom(skb) < pad)
436 if (pskb_expand_head(skb, 0, pad, 421 if (pskb_expand_head(skb, 0, pad,
437 GFP_ATOMIC)) { 422 GFP_ATOMIC)) {
438 stats->tx_dropped++; 423 dev->stats.tx_dropped++;
439 dev_kfree_skb(skb); 424 dev_kfree_skb(skb);
440 return 0; 425 return 0;
441 } 426 }
@@ -445,17 +430,17 @@ static int pvc_xmit(struct sk_buff *skb, struct net_device *dev)
445 skb->protocol = __constant_htons(ETH_P_802_3); 430 skb->protocol = __constant_htons(ETH_P_802_3);
446 } 431 }
447 if (!fr_hard_header(&skb, pvc->dlci)) { 432 if (!fr_hard_header(&skb, pvc->dlci)) {
448 stats->tx_bytes += skb->len; 433 dev->stats.tx_bytes += skb->len;
449 stats->tx_packets++; 434 dev->stats.tx_packets++;
450 if (pvc->state.fecn) /* TX Congestion counter */ 435 if (pvc->state.fecn) /* TX Congestion counter */
451 stats->tx_compressed++; 436 dev->stats.tx_compressed++;
452 skb->dev = pvc->frad; 437 skb->dev = pvc->frad;
453 dev_queue_xmit(skb); 438 dev_queue_xmit(skb);
454 return 0; 439 return 0;
455 } 440 }
456 } 441 }
457 442
458 stats->tx_dropped++; 443 dev->stats.tx_dropped++;
459 dev_kfree_skb(skb); 444 dev_kfree_skb(skb);
460 return 0; 445 return 0;
461} 446}
@@ -955,7 +940,7 @@ static int fr_rx(struct sk_buff *skb)
955 940
956 941
957 if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) { 942 if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) {
958 dev_to_hdlc(frad)->stats.rx_dropped++; 943 frad->stats.rx_dropped++;
959 return NET_RX_DROP; 944 return NET_RX_DROP;
960 } 945 }
961 946
@@ -1003,11 +988,10 @@ static int fr_rx(struct sk_buff *skb)
1003 } 988 }
1004 989
1005 if (dev) { 990 if (dev) {
1006 struct net_device_stats *stats = pvc_get_stats(dev); 991 dev->stats.rx_packets++; /* PVC traffic */
1007 stats->rx_packets++; /* PVC traffic */ 992 dev->stats.rx_bytes += skb->len;
1008 stats->rx_bytes += skb->len;
1009 if (pvc->state.becn) 993 if (pvc->state.becn)
1010 stats->rx_compressed++; 994 dev->stats.rx_compressed++;
1011 netif_rx(skb); 995 netif_rx(skb);
1012 return NET_RX_SUCCESS; 996 return NET_RX_SUCCESS;
1013 } else { 997 } else {
@@ -1016,7 +1000,7 @@ static int fr_rx(struct sk_buff *skb)
1016 } 1000 }
1017 1001
1018 rx_error: 1002 rx_error:
1019 dev_to_hdlc(frad)->stats.rx_errors++; /* Mark error */ 1003 frad->stats.rx_errors++; /* Mark error */
1020 dev_kfree_skb_any(skb); 1004 dev_kfree_skb_any(skb);
1021 return NET_RX_DROP; 1005 return NET_RX_DROP;
1022} 1006}
@@ -1087,7 +1071,7 @@ static void pvc_setup(struct net_device *dev)
1087static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) 1071static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type)
1088{ 1072{
1089 hdlc_device *hdlc = dev_to_hdlc(frad); 1073 hdlc_device *hdlc = dev_to_hdlc(frad);
1090 pvc_device *pvc = NULL; 1074 pvc_device *pvc;
1091 struct net_device *dev; 1075 struct net_device *dev;
1092 int result, used; 1076 int result, used;
1093 1077
@@ -1103,10 +1087,9 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type)
1103 used = pvc_is_used(pvc); 1087 used = pvc_is_used(pvc);
1104 1088
1105 if (type == ARPHRD_ETHER) 1089 if (type == ARPHRD_ETHER)
1106 dev = alloc_netdev(sizeof(struct pvc_desc), "pvceth%d", 1090 dev = alloc_netdev(0, "pvceth%d", ether_setup);
1107 ether_setup);
1108 else 1091 else
1109 dev = alloc_netdev(sizeof(struct pvc_desc), "pvc%d", pvc_setup); 1092 dev = alloc_netdev(0, "pvc%d", pvc_setup);
1110 1093
1111 if (!dev) { 1094 if (!dev) {
1112 printk(KERN_WARNING "%s: Memory squeeze on fr_pvc()\n", 1095 printk(KERN_WARNING "%s: Memory squeeze on fr_pvc()\n",
@@ -1122,14 +1105,13 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type)
1122 dlci_to_q922(dev->broadcast, dlci); 1105 dlci_to_q922(dev->broadcast, dlci);
1123 } 1106 }
1124 dev->hard_start_xmit = pvc_xmit; 1107 dev->hard_start_xmit = pvc_xmit;
1125 dev->get_stats = pvc_get_stats;
1126 dev->open = pvc_open; 1108 dev->open = pvc_open;
1127 dev->stop = pvc_close; 1109 dev->stop = pvc_close;
1128 dev->do_ioctl = pvc_ioctl; 1110 dev->do_ioctl = pvc_ioctl;
1129 dev->change_mtu = pvc_change_mtu; 1111 dev->change_mtu = pvc_change_mtu;
1130 dev->mtu = HDLC_MAX_MTU; 1112 dev->mtu = HDLC_MAX_MTU;
1131 dev->tx_queue_len = 0; 1113 dev->tx_queue_len = 0;
1132 pvcdev_to_desc(dev)->pvc = pvc; 1114 dev->priv = pvc;
1133 1115
1134 result = dev_alloc_name(dev, dev->name); 1116 result = dev_alloc_name(dev, dev->name);
1135 if (result < 0) { 1117 if (result < 0) {
diff --git a/drivers/net/wan/hdlc_raw_eth.c b/drivers/net/wan/hdlc_raw_eth.c
index d20c685f6711..26dee600506f 100644
--- a/drivers/net/wan/hdlc_raw_eth.c
+++ b/drivers/net/wan/hdlc_raw_eth.c
@@ -33,7 +33,7 @@ static int eth_tx(struct sk_buff *skb, struct net_device *dev)
33 int len = skb->len; 33 int len = skb->len;
34 if (skb_tailroom(skb) < pad) 34 if (skb_tailroom(skb) < pad)
35 if (pskb_expand_head(skb, 0, pad, GFP_ATOMIC)) { 35 if (pskb_expand_head(skb, 0, pad, GFP_ATOMIC)) {
36 hdlc_stats(dev)->tx_dropped++; 36 dev->stats.tx_dropped++;
37 dev_kfree_skb(skb); 37 dev_kfree_skb(skb);
38 return 0; 38 return 0;
39 } 39 }
diff --git a/drivers/net/wan/hdlc_x25.c b/drivers/net/wan/hdlc_x25.c
index c15cc11e399b..e808720030ef 100644
--- a/drivers/net/wan/hdlc_x25.c
+++ b/drivers/net/wan/hdlc_x25.c
@@ -164,17 +164,15 @@ static void x25_close(struct net_device *dev)
164 164
165static int x25_rx(struct sk_buff *skb) 165static int x25_rx(struct sk_buff *skb)
166{ 166{
167 struct hdlc_device *hdlc = dev_to_hdlc(skb->dev);
168
169 if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) { 167 if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) {
170 hdlc->stats.rx_dropped++; 168 skb->dev->stats.rx_dropped++;
171 return NET_RX_DROP; 169 return NET_RX_DROP;
172 } 170 }
173 171
174 if (lapb_data_received(skb->dev, skb) == LAPB_OK) 172 if (lapb_data_received(skb->dev, skb) == LAPB_OK)
175 return NET_RX_SUCCESS; 173 return NET_RX_SUCCESS;
176 174
177 hdlc->stats.rx_errors++; 175 skb->dev->stats.rx_errors++;
178 dev_kfree_skb_any(skb); 176 dev_kfree_skb_any(skb);
179 return NET_RX_DROP; 177 return NET_RX_DROP;
180} 178}
diff --git a/drivers/net/wan/pc300_drv.c b/drivers/net/wan/pc300_drv.c
index 57914fbd41d3..334170527755 100644
--- a/drivers/net/wan/pc300_drv.c
+++ b/drivers/net/wan/pc300_drv.c
@@ -285,7 +285,6 @@ static void rx_dma_buf_init(pc300_t *, int);
285static void tx_dma_buf_check(pc300_t *, int); 285static void tx_dma_buf_check(pc300_t *, int);
286static void rx_dma_buf_check(pc300_t *, int); 286static void rx_dma_buf_check(pc300_t *, int);
287static irqreturn_t cpc_intr(int, void *); 287static irqreturn_t cpc_intr(int, void *);
288static struct net_device_stats *cpc_get_stats(struct net_device *);
289static int clock_rate_calc(uclong, uclong, int *); 288static int clock_rate_calc(uclong, uclong, int *);
290static uclong detect_ram(pc300_t *); 289static uclong detect_ram(pc300_t *);
291static void plx_init(pc300_t *); 290static void plx_init(pc300_t *);
@@ -1775,13 +1774,12 @@ static void cpc_tx_timeout(struct net_device *dev)
1775 pc300dev_t *d = (pc300dev_t *) dev->priv; 1774 pc300dev_t *d = (pc300dev_t *) dev->priv;
1776 pc300ch_t *chan = (pc300ch_t *) d->chan; 1775 pc300ch_t *chan = (pc300ch_t *) d->chan;
1777 pc300_t *card = (pc300_t *) chan->card; 1776 pc300_t *card = (pc300_t *) chan->card;
1778 struct net_device_stats *stats = hdlc_stats(dev);
1779 int ch = chan->channel; 1777 int ch = chan->channel;
1780 unsigned long flags; 1778 unsigned long flags;
1781 ucchar ilar; 1779 ucchar ilar;
1782 1780
1783 stats->tx_errors++; 1781 dev->stats.tx_errors++;
1784 stats->tx_aborted_errors++; 1782 dev->stats.tx_aborted_errors++;
1785 CPC_LOCK(card, flags); 1783 CPC_LOCK(card, flags);
1786 if ((ilar = cpc_readb(card->hw.scabase + ILAR)) != 0) { 1784 if ((ilar = cpc_readb(card->hw.scabase + ILAR)) != 0) {
1787 printk("%s: ILAR=0x%x\n", dev->name, ilar); 1785 printk("%s: ILAR=0x%x\n", dev->name, ilar);
@@ -1803,7 +1801,6 @@ static int cpc_queue_xmit(struct sk_buff *skb, struct net_device *dev)
1803 pc300dev_t *d = (pc300dev_t *) dev->priv; 1801 pc300dev_t *d = (pc300dev_t *) dev->priv;
1804 pc300ch_t *chan = (pc300ch_t *) d->chan; 1802 pc300ch_t *chan = (pc300ch_t *) d->chan;
1805 pc300_t *card = (pc300_t *) chan->card; 1803 pc300_t *card = (pc300_t *) chan->card;
1806 struct net_device_stats *stats = hdlc_stats(dev);
1807 int ch = chan->channel; 1804 int ch = chan->channel;
1808 unsigned long flags; 1805 unsigned long flags;
1809#ifdef PC300_DEBUG_TX 1806#ifdef PC300_DEBUG_TX
@@ -1817,13 +1814,13 @@ static int cpc_queue_xmit(struct sk_buff *skb, struct net_device *dev)
1817 } else if (!netif_carrier_ok(dev)) { 1814 } else if (!netif_carrier_ok(dev)) {
1818 /* DCD must be OFF: drop packet */ 1815 /* DCD must be OFF: drop packet */
1819 dev_kfree_skb(skb); 1816 dev_kfree_skb(skb);
1820 stats->tx_errors++; 1817 dev->stats.tx_errors++;
1821 stats->tx_carrier_errors++; 1818 dev->stats.tx_carrier_errors++;
1822 return 0; 1819 return 0;
1823 } else if (cpc_readb(card->hw.scabase + M_REG(ST3, ch)) & ST3_DCD) { 1820 } else if (cpc_readb(card->hw.scabase + M_REG(ST3, ch)) & ST3_DCD) {
1824 printk("%s: DCD is OFF. Going administrative down.\n", dev->name); 1821 printk("%s: DCD is OFF. Going administrative down.\n", dev->name);
1825 stats->tx_errors++; 1822 dev->stats.tx_errors++;
1826 stats->tx_carrier_errors++; 1823 dev->stats.tx_carrier_errors++;
1827 dev_kfree_skb(skb); 1824 dev_kfree_skb(skb);
1828 netif_carrier_off(dev); 1825 netif_carrier_off(dev);
1829 CPC_LOCK(card, flags); 1826 CPC_LOCK(card, flags);
@@ -1843,8 +1840,8 @@ static int cpc_queue_xmit(struct sk_buff *skb, struct net_device *dev)
1843// printk("%s: write error. Dropping TX packet.\n", dev->name); 1840// printk("%s: write error. Dropping TX packet.\n", dev->name);
1844 netif_stop_queue(dev); 1841 netif_stop_queue(dev);
1845 dev_kfree_skb(skb); 1842 dev_kfree_skb(skb);
1846 stats->tx_errors++; 1843 dev->stats.tx_errors++;
1847 stats->tx_dropped++; 1844 dev->stats.tx_dropped++;
1848 return 0; 1845 return 0;
1849 } 1846 }
1850#ifdef PC300_DEBUG_TX 1847#ifdef PC300_DEBUG_TX
@@ -1886,7 +1883,6 @@ static void cpc_net_rx(struct net_device *dev)
1886 pc300dev_t *d = (pc300dev_t *) dev->priv; 1883 pc300dev_t *d = (pc300dev_t *) dev->priv;
1887 pc300ch_t *chan = (pc300ch_t *) d->chan; 1884 pc300ch_t *chan = (pc300ch_t *) d->chan;
1888 pc300_t *card = (pc300_t *) chan->card; 1885 pc300_t *card = (pc300_t *) chan->card;
1889 struct net_device_stats *stats = hdlc_stats(dev);
1890 int ch = chan->channel; 1886 int ch = chan->channel;
1891#ifdef PC300_DEBUG_RX 1887#ifdef PC300_DEBUG_RX
1892 int i; 1888 int i;
@@ -1922,24 +1918,24 @@ static void cpc_net_rx(struct net_device *dev)
1922#endif 1918#endif
1923 if ((skb == NULL) && (rxb > 0)) { 1919 if ((skb == NULL) && (rxb > 0)) {
1924 /* rxb > dev->mtu */ 1920 /* rxb > dev->mtu */
1925 stats->rx_errors++; 1921 dev->stats.rx_errors++;
1926 stats->rx_length_errors++; 1922 dev->stats.rx_length_errors++;
1927 continue; 1923 continue;
1928 } 1924 }
1929 1925
1930 if (rxb < 0) { /* Invalid frame */ 1926 if (rxb < 0) { /* Invalid frame */
1931 rxb = -rxb; 1927 rxb = -rxb;
1932 if (rxb & DST_OVR) { 1928 if (rxb & DST_OVR) {
1933 stats->rx_errors++; 1929 dev->stats.rx_errors++;
1934 stats->rx_fifo_errors++; 1930 dev->stats.rx_fifo_errors++;
1935 } 1931 }
1936 if (rxb & DST_CRC) { 1932 if (rxb & DST_CRC) {
1937 stats->rx_errors++; 1933 dev->stats.rx_errors++;
1938 stats->rx_crc_errors++; 1934 dev->stats.rx_crc_errors++;
1939 } 1935 }
1940 if (rxb & (DST_RBIT | DST_SHRT | DST_ABT)) { 1936 if (rxb & (DST_RBIT | DST_SHRT | DST_ABT)) {
1941 stats->rx_errors++; 1937 dev->stats.rx_errors++;
1942 stats->rx_frame_errors++; 1938 dev->stats.rx_frame_errors++;
1943 } 1939 }
1944 } 1940 }
1945 if (skb) { 1941 if (skb) {
@@ -1948,7 +1944,7 @@ static void cpc_net_rx(struct net_device *dev)
1948 continue; 1944 continue;
1949 } 1945 }
1950 1946
1951 stats->rx_bytes += rxb; 1947 dev->stats.rx_bytes += rxb;
1952 1948
1953#ifdef PC300_DEBUG_RX 1949#ifdef PC300_DEBUG_RX
1954 printk("%s R:", dev->name); 1950 printk("%s R:", dev->name);
@@ -1959,7 +1955,7 @@ static void cpc_net_rx(struct net_device *dev)
1959 if (d->trace_on) { 1955 if (d->trace_on) {
1960 cpc_trace(dev, skb, 'R'); 1956 cpc_trace(dev, skb, 'R');
1961 } 1957 }
1962 stats->rx_packets++; 1958 dev->stats.rx_packets++;
1963 skb->protocol = hdlc_type_trans(skb, dev); 1959 skb->protocol = hdlc_type_trans(skb, dev);
1964 netif_rx(skb); 1960 netif_rx(skb);
1965 } 1961 }
@@ -1974,16 +1970,15 @@ static void sca_tx_intr(pc300dev_t *dev)
1974 pc300_t *card = (pc300_t *)chan->card; 1970 pc300_t *card = (pc300_t *)chan->card;
1975 int ch = chan->channel; 1971 int ch = chan->channel;
1976 volatile pcsca_bd_t __iomem * ptdescr; 1972 volatile pcsca_bd_t __iomem * ptdescr;
1977 struct net_device_stats *stats = hdlc_stats(dev->dev);
1978 1973
1979 /* Clean up descriptors from previous transmission */ 1974 /* Clean up descriptors from previous transmission */
1980 ptdescr = (card->hw.rambase + 1975 ptdescr = (card->hw.rambase +
1981 TX_BD_ADDR(ch,chan->tx_first_bd)); 1976 TX_BD_ADDR(ch,chan->tx_first_bd));
1982 while ((cpc_readl(card->hw.scabase + DTX_REG(CDAL,ch)) != 1977 while ((cpc_readl(card->hw.scabase + DTX_REG(CDAL,ch)) !=
1983 TX_BD_ADDR(ch,chan->tx_first_bd)) && 1978 TX_BD_ADDR(ch,chan->tx_first_bd)) &&
1984 (cpc_readb(&ptdescr->status) & DST_OSB)) { 1979 (cpc_readb(&ptdescr->status) & DST_OSB)) {
1985 stats->tx_packets++; 1980 dev->dev->stats.tx_packets++;
1986 stats->tx_bytes += cpc_readw(&ptdescr->len); 1981 dev->dev->stats.tx_bytes += cpc_readw(&ptdescr->len);
1987 cpc_writeb(&ptdescr->status, DST_OSB); 1982 cpc_writeb(&ptdescr->status, DST_OSB);
1988 cpc_writew(&ptdescr->len, 0); 1983 cpc_writew(&ptdescr->len, 0);
1989 chan->nfree_tx_bd++; 1984 chan->nfree_tx_bd++;
@@ -2048,8 +2043,8 @@ static void sca_intr(pc300_t * card)
2048 } 2043 }
2049 cpc_net_rx(dev); 2044 cpc_net_rx(dev);
2050 /* Discard invalid frames */ 2045 /* Discard invalid frames */
2051 hdlc_stats(dev)->rx_errors++; 2046 dev->stats.rx_errors++;
2052 hdlc_stats(dev)->rx_over_errors++; 2047 dev->stats.rx_over_errors++;
2053 chan->rx_first_bd = 0; 2048 chan->rx_first_bd = 0;
2054 chan->rx_last_bd = N_DMA_RX_BUF - 1; 2049 chan->rx_last_bd = N_DMA_RX_BUF - 1;
2055 rx_dma_start(card, ch); 2050 rx_dma_start(card, ch);
@@ -2115,8 +2110,8 @@ static void sca_intr(pc300_t * card)
2115 card->hw.cpld_reg2) & 2110 card->hw.cpld_reg2) &
2116 ~ (CPLD_REG2_FALC_LED1 << (2 * ch))); 2111 ~ (CPLD_REG2_FALC_LED1 << (2 * ch)));
2117 } 2112 }
2118 hdlc_stats(dev)->tx_errors++; 2113 dev->stats.tx_errors++;
2119 hdlc_stats(dev)->tx_fifo_errors++; 2114 dev->stats.tx_fifo_errors++;
2120 sca_tx_intr(d); 2115 sca_tx_intr(d);
2121 } 2116 }
2122 } 2117 }
@@ -2604,7 +2599,7 @@ static int cpc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
2604 case SIOCGPC300UTILSTATS: 2599 case SIOCGPC300UTILSTATS:
2605 { 2600 {
2606 if (!arg) { /* clear statistics */ 2601 if (!arg) { /* clear statistics */
2607 memset(hdlc_stats(dev), 0, sizeof(struct net_device_stats)); 2602 memset(&dev->stats, 0, sizeof(dev->stats));
2608 if (card->hw.type == PC300_TE) { 2603 if (card->hw.type == PC300_TE) {
2609 memset(&chan->falc, 0, sizeof(falc_t)); 2604 memset(&chan->falc, 0, sizeof(falc_t));
2610 } 2605 }
@@ -2615,8 +2610,8 @@ static int cpc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
2615 pc300stats.hw_type = card->hw.type; 2610 pc300stats.hw_type = card->hw.type;
2616 pc300stats.line_on = card->chan[ch].d.line_on; 2611 pc300stats.line_on = card->chan[ch].d.line_on;
2617 pc300stats.line_off = card->chan[ch].d.line_off; 2612 pc300stats.line_off = card->chan[ch].d.line_off;
2618 memcpy(&pc300stats.gen_stats, hdlc_stats(dev), 2613 memcpy(&pc300stats.gen_stats, &dev->stats,
2619 sizeof(struct net_device_stats)); 2614 sizeof(dev->stats));
2620 if (card->hw.type == PC300_TE) 2615 if (card->hw.type == PC300_TE)
2621 memcpy(&pc300stats.te_stats,&chan->falc,sizeof(falc_t)); 2616 memcpy(&pc300stats.te_stats,&chan->falc,sizeof(falc_t));
2622 if (copy_to_user(arg, &pc300stats, sizeof(pc300stats_t))) 2617 if (copy_to_user(arg, &pc300stats, sizeof(pc300stats_t)))
@@ -2823,11 +2818,6 @@ static int cpc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
2823 } 2818 }
2824} 2819}
2825 2820
2826static struct net_device_stats *cpc_get_stats(struct net_device *dev)
2827{
2828 return hdlc_stats(dev);
2829}
2830
2831static int clock_rate_calc(uclong rate, uclong clock, int *br_io) 2821static int clock_rate_calc(uclong rate, uclong clock, int *br_io)
2832{ 2822{
2833 int br, tc; 2823 int br, tc;
@@ -3394,7 +3384,6 @@ static void cpc_init_card(pc300_t * card)
3394 dev->stop = cpc_close; 3384 dev->stop = cpc_close;
3395 dev->tx_timeout = cpc_tx_timeout; 3385 dev->tx_timeout = cpc_tx_timeout;
3396 dev->watchdog_timeo = PC300_TX_TIMEOUT; 3386 dev->watchdog_timeo = PC300_TX_TIMEOUT;
3397 dev->get_stats = cpc_get_stats;
3398 dev->set_multicast_list = NULL; 3387 dev->set_multicast_list = NULL;
3399 dev->set_mac_address = NULL; 3388 dev->set_mac_address = NULL;
3400 dev->change_mtu = cpc_change_mtu; 3389 dev->change_mtu = cpc_change_mtu;
diff --git a/drivers/net/wan/pc300_tty.c b/drivers/net/wan/pc300_tty.c
index e03eef2f2282..eae94ab6b818 100644
--- a/drivers/net/wan/pc300_tty.c
+++ b/drivers/net/wan/pc300_tty.c
@@ -458,7 +458,7 @@ static int cpc_tty_write(struct tty_struct *tty, const unsigned char *buf, int c
458 CPC_TTY_DBG("%s: cpc_tty_write data len=%i\n",cpc_tty->name,count); 458 CPC_TTY_DBG("%s: cpc_tty_write data len=%i\n",cpc_tty->name,count);
459 459
460 pc300chan = (pc300ch_t *)((pc300dev_t*)cpc_tty->pc300dev)->chan; 460 pc300chan = (pc300ch_t *)((pc300dev_t*)cpc_tty->pc300dev)->chan;
461 stats = hdlc_stats(((pc300dev_t*)cpc_tty->pc300dev)->dev); 461 stats = &cpc_tty->pc300dev->dev->stats;
462 card = (pc300_t *) pc300chan->card; 462 card = (pc300_t *) pc300chan->card;
463 ch = pc300chan->channel; 463 ch = pc300chan->channel;
464 464
@@ -743,7 +743,7 @@ void cpc_tty_receive(pc300dev_t *pc300dev)
743 pc300_t *card = (pc300_t *)pc300chan->card; 743 pc300_t *card = (pc300_t *)pc300chan->card;
744 int ch = pc300chan->channel; 744 int ch = pc300chan->channel;
745 volatile pcsca_bd_t __iomem * ptdescr; 745 volatile pcsca_bd_t __iomem * ptdescr;
746 struct net_device_stats *stats = hdlc_stats(pc300dev->dev); 746 struct net_device_stats *stats = &pc300dev->dev->stats;
747 int rx_len, rx_aux; 747 int rx_len, rx_aux;
748 volatile unsigned char status; 748 volatile unsigned char status;
749 unsigned short first_bd = pc300chan->rx_first_bd; 749 unsigned short first_bd = pc300chan->rx_first_bd;
@@ -917,7 +917,7 @@ static int cpc_tty_send_to_card(pc300dev_t *dev,void* buf, int len)
917 pc300ch_t *chan = (pc300ch_t *)dev->chan; 917 pc300ch_t *chan = (pc300ch_t *)dev->chan;
918 pc300_t *card = (pc300_t *)chan->card; 918 pc300_t *card = (pc300_t *)chan->card;
919 int ch = chan->channel; 919 int ch = chan->channel;
920 struct net_device_stats *stats = hdlc_stats(dev->dev); 920 struct net_device_stats *stats = &dev->dev->stats;
921 unsigned long flags; 921 unsigned long flags;
922 volatile pcsca_bd_t __iomem *ptdescr; 922 volatile pcsca_bd_t __iomem *ptdescr;
923 int i, nchar; 923 int i, nchar;
diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c
index d4aab8a28b61..a8a5ca0ee6c2 100644
--- a/drivers/net/wan/wanxl.c
+++ b/drivers/net/wan/wanxl.c
@@ -161,7 +161,6 @@ static inline void wanxl_cable_intr(port_t *port)
161static inline void wanxl_tx_intr(port_t *port) 161static inline void wanxl_tx_intr(port_t *port)
162{ 162{
163 struct net_device *dev = port->dev; 163 struct net_device *dev = port->dev;
164 struct net_device_stats *stats = hdlc_stats(dev);
165 while (1) { 164 while (1) {
166 desc_t *desc = &get_status(port)->tx_descs[port->tx_in]; 165 desc_t *desc = &get_status(port)->tx_descs[port->tx_in];
167 struct sk_buff *skb = port->tx_skbs[port->tx_in]; 166 struct sk_buff *skb = port->tx_skbs[port->tx_in];
@@ -173,13 +172,13 @@ static inline void wanxl_tx_intr(port_t *port)
173 return; 172 return;
174 173
175 case PACKET_UNDERRUN: 174 case PACKET_UNDERRUN:
176 stats->tx_errors++; 175 dev->stats.tx_errors++;
177 stats->tx_fifo_errors++; 176 dev->stats.tx_fifo_errors++;
178 break; 177 break;
179 178
180 default: 179 default:
181 stats->tx_packets++; 180 dev->stats.tx_packets++;
182 stats->tx_bytes += skb->len; 181 dev->stats.tx_bytes += skb->len;
183 } 182 }
184 desc->stat = PACKET_EMPTY; /* Free descriptor */ 183 desc->stat = PACKET_EMPTY; /* Free descriptor */
185 pci_unmap_single(port->card->pdev, desc->address, skb->len, 184 pci_unmap_single(port->card->pdev, desc->address, skb->len,
@@ -205,10 +204,9 @@ static inline void wanxl_rx_intr(card_t *card)
205 port_t *port = &card->ports[desc->stat & 204 port_t *port = &card->ports[desc->stat &
206 PACKET_PORT_MASK]; 205 PACKET_PORT_MASK];
207 struct net_device *dev = port->dev; 206 struct net_device *dev = port->dev;
208 struct net_device_stats *stats = hdlc_stats(dev);
209 207
210 if (!skb) 208 if (!skb)
211 stats->rx_dropped++; 209 dev->stats.rx_dropped++;
212 else { 210 else {
213 pci_unmap_single(card->pdev, desc->address, 211 pci_unmap_single(card->pdev, desc->address,
214 BUFFER_LENGTH, 212 BUFFER_LENGTH,
@@ -220,8 +218,8 @@ static inline void wanxl_rx_intr(card_t *card)
220 skb->len); 218 skb->len);
221 debug_frame(skb); 219 debug_frame(skb);
222#endif 220#endif
223 stats->rx_packets++; 221 dev->stats.rx_packets++;
224 stats->rx_bytes += skb->len; 222 dev->stats.rx_bytes += skb->len;
225 dev->last_rx = jiffies; 223 dev->last_rx = jiffies;
226 skb->protocol = hdlc_type_trans(skb, dev); 224 skb->protocol = hdlc_type_trans(skb, dev);
227 netif_rx(skb); 225 netif_rx(skb);
@@ -468,13 +466,13 @@ static int wanxl_close(struct net_device *dev)
468 466
469static struct net_device_stats *wanxl_get_stats(struct net_device *dev) 467static struct net_device_stats *wanxl_get_stats(struct net_device *dev)
470{ 468{
471 struct net_device_stats *stats = hdlc_stats(dev);
472 port_t *port = dev_to_port(dev); 469 port_t *port = dev_to_port(dev);
473 470
474 stats->rx_over_errors = get_status(port)->rx_overruns; 471 dev->stats.rx_over_errors = get_status(port)->rx_overruns;
475 stats->rx_frame_errors = get_status(port)->rx_frame_errors; 472 dev->stats.rx_frame_errors = get_status(port)->rx_frame_errors;
476 stats->rx_errors = stats->rx_over_errors + stats->rx_frame_errors; 473 dev->stats.rx_errors = dev->stats.rx_over_errors +
477 return stats; 474 dev->stats.rx_frame_errors;
475 return &dev->stats;
478} 476}
479 477
480 478
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h
index 6115545a5b9c..c59769693bee 100644
--- a/include/linux/hdlc.h
+++ b/include/linux/hdlc.h
@@ -45,7 +45,6 @@ struct hdlc_proto {
45 45
46/* Pointed to by dev->priv */ 46/* Pointed to by dev->priv */
47typedef struct hdlc_device { 47typedef struct hdlc_device {
48 struct net_device_stats stats;
49 /* used by HDLC layer to take control over HDLC device from hw driver*/ 48 /* used by HDLC layer to take control over HDLC device from hw driver*/
50 int (*attach)(struct net_device *dev, 49 int (*attach)(struct net_device *dev,
51 unsigned short encoding, unsigned short parity); 50 unsigned short encoding, unsigned short parity);
@@ -109,12 +108,6 @@ int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto,
109/* May be used by hardware driver to gain control over HDLC device */ 108/* May be used by hardware driver to gain control over HDLC device */
110void detach_hdlc_protocol(struct net_device *dev); 109void detach_hdlc_protocol(struct net_device *dev);
111 110
112static __inline__ struct net_device_stats *hdlc_stats(struct net_device *dev)
113{
114 return &dev_to_hdlc(dev)->stats;
115}
116
117
118static __inline__ __be16 hdlc_type_trans(struct sk_buff *skb, 111static __inline__ __be16 hdlc_type_trans(struct sk_buff *skb,
119 struct net_device *dev) 112 struct net_device *dev)
120{ 113{