aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000e
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-16 19:29:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-16 19:29:25 -0400
commit7a6362800cb7d1d618a697a650c7aaed3eb39320 (patch)
tree087f9bc6c13ef1fad4b392c5cf9325cd28fa8523 /drivers/net/e1000e
parent6445ced8670f37cfc2c5e24a9de9b413dbfc788d (diff)
parentceda86a108671294052cbf51660097b6534672f5 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1480 commits) bonding: enable netpoll without checking link status xfrm: Refcount destination entry on xfrm_lookup net: introduce rx_handler results and logic around that bonding: get rid of IFF_SLAVE_INACTIVE netdev->priv_flag bonding: wrap slave state work net: get rid of multiple bond-related netdevice->priv_flags bonding: register slave pointer for rx_handler be2net: Bump up the version number be2net: Copyright notice change. Update to Emulex instead of ServerEngines e1000e: fix kconfig for crc32 dependency netfilter ebtables: fix xt_AUDIT to work with ebtables xen network backend driver bonding: Improve syslog message at device creation time bonding: Call netif_carrier_off after register_netdevice bonding: Incorrect TX queue offset net_sched: fix ip_tos2prio xfrm: fix __xfrm_route_forward() be2net: Fix UDP packet detected status in RX compl Phonet: fix aligned-mode pipe socket buffer header reserve netxen: support for GbE port settings ... Fix up conflicts in drivers/staging/brcm80211/brcmsmac/wl_mac80211.c with the staging updates.
Diffstat (limited to 'drivers/net/e1000e')
-rw-r--r--drivers/net/e1000e/defines.h1
-rw-r--r--drivers/net/e1000e/e1000.h5
-rw-r--r--drivers/net/e1000e/ethtool.c92
-rw-r--r--drivers/net/e1000e/hw.h5
-rw-r--r--drivers/net/e1000e/ich8lan.c48
-rw-r--r--drivers/net/e1000e/lib.c4
-rw-r--r--drivers/net/e1000e/netdev.c129
-rw-r--r--drivers/net/e1000e/phy.c8
8 files changed, 180 insertions, 112 deletions
diff --git a/drivers/net/e1000e/defines.h b/drivers/net/e1000e/defines.h
index 13149983d07e..c516a7440bec 100644
--- a/drivers/net/e1000e/defines.h
+++ b/drivers/net/e1000e/defines.h
@@ -86,6 +86,7 @@
86#define E1000_CTRL_EXT_IAME 0x08000000 /* Interrupt acknowledge Auto-mask */ 86#define E1000_CTRL_EXT_IAME 0x08000000 /* Interrupt acknowledge Auto-mask */
87#define E1000_CTRL_EXT_INT_TIMER_CLR 0x20000000 /* Clear Interrupt timers after IMS clear */ 87#define E1000_CTRL_EXT_INT_TIMER_CLR 0x20000000 /* Clear Interrupt timers after IMS clear */
88#define E1000_CTRL_EXT_PBA_CLR 0x80000000 /* PBA Clear */ 88#define E1000_CTRL_EXT_PBA_CLR 0x80000000 /* PBA Clear */
89#define E1000_CTRL_EXT_LSECCK 0x00001000
89#define E1000_CTRL_EXT_PHYPDEN 0x00100000 90#define E1000_CTRL_EXT_PHYPDEN 0x00100000
90 91
91/* Receive Descriptor bit definitions */ 92/* Receive Descriptor bit definitions */
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h
index e610e1369053..00bf595ebd67 100644
--- a/drivers/net/e1000e/e1000.h
+++ b/drivers/net/e1000e/e1000.h
@@ -364,6 +364,7 @@ struct e1000_adapter {
364 /* structs defined in e1000_hw.h */ 364 /* structs defined in e1000_hw.h */
365 struct e1000_hw hw; 365 struct e1000_hw hw;
366 366
367 spinlock_t stats64_lock;
367 struct e1000_hw_stats stats; 368 struct e1000_hw_stats stats;
368 struct e1000_phy_info phy_info; 369 struct e1000_phy_info phy_info;
369 struct e1000_phy_stats phy_stats; 370 struct e1000_phy_stats phy_stats;
@@ -494,7 +495,9 @@ extern int e1000e_setup_rx_resources(struct e1000_adapter *adapter);
494extern int e1000e_setup_tx_resources(struct e1000_adapter *adapter); 495extern int e1000e_setup_tx_resources(struct e1000_adapter *adapter);
495extern void e1000e_free_rx_resources(struct e1000_adapter *adapter); 496extern void e1000e_free_rx_resources(struct e1000_adapter *adapter);
496extern void e1000e_free_tx_resources(struct e1000_adapter *adapter); 497extern void e1000e_free_tx_resources(struct e1000_adapter *adapter);
497extern void e1000e_update_stats(struct e1000_adapter *adapter); 498extern struct rtnl_link_stats64 *e1000e_get_stats64(struct net_device *netdev,
499 struct rtnl_link_stats64
500 *stats);
498extern void e1000e_set_interrupt_capability(struct e1000_adapter *adapter); 501extern void e1000e_set_interrupt_capability(struct e1000_adapter *adapter);
499extern void e1000e_reset_interrupt_capability(struct e1000_adapter *adapter); 502extern void e1000e_reset_interrupt_capability(struct e1000_adapter *adapter);
500extern void e1000e_get_hw_control(struct e1000_adapter *adapter); 503extern void e1000e_get_hw_control(struct e1000_adapter *adapter);
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index fa08b6336cfb..07f09e96e453 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -46,15 +46,15 @@ struct e1000_stats {
46}; 46};
47 47
48#define E1000_STAT(str, m) { \ 48#define E1000_STAT(str, m) { \
49 .stat_string = str, \ 49 .stat_string = str, \
50 .type = E1000_STATS, \ 50 .type = E1000_STATS, \
51 .sizeof_stat = sizeof(((struct e1000_adapter *)0)->m), \ 51 .sizeof_stat = sizeof(((struct e1000_adapter *)0)->m), \
52 .stat_offset = offsetof(struct e1000_adapter, m) } 52 .stat_offset = offsetof(struct e1000_adapter, m) }
53#define E1000_NETDEV_STAT(str, m) { \ 53#define E1000_NETDEV_STAT(str, m) { \
54 .stat_string = str, \ 54 .stat_string = str, \
55 .type = NETDEV_STATS, \ 55 .type = NETDEV_STATS, \
56 .sizeof_stat = sizeof(((struct net_device *)0)->m), \ 56 .sizeof_stat = sizeof(((struct rtnl_link_stats64 *)0)->m), \
57 .stat_offset = offsetof(struct net_device, m) } 57 .stat_offset = offsetof(struct rtnl_link_stats64, m) }
58 58
59static const struct e1000_stats e1000_gstrings_stats[] = { 59static const struct e1000_stats e1000_gstrings_stats[] = {
60 E1000_STAT("rx_packets", stats.gprc), 60 E1000_STAT("rx_packets", stats.gprc),
@@ -65,21 +65,21 @@ static const struct e1000_stats e1000_gstrings_stats[] = {
65 E1000_STAT("tx_broadcast", stats.bptc), 65 E1000_STAT("tx_broadcast", stats.bptc),
66 E1000_STAT("rx_multicast", stats.mprc), 66 E1000_STAT("rx_multicast", stats.mprc),
67 E1000_STAT("tx_multicast", stats.mptc), 67 E1000_STAT("tx_multicast", stats.mptc),
68 E1000_NETDEV_STAT("rx_errors", stats.rx_errors), 68 E1000_NETDEV_STAT("rx_errors", rx_errors),
69 E1000_NETDEV_STAT("tx_errors", stats.tx_errors), 69 E1000_NETDEV_STAT("tx_errors", tx_errors),
70 E1000_NETDEV_STAT("tx_dropped", stats.tx_dropped), 70 E1000_NETDEV_STAT("tx_dropped", tx_dropped),
71 E1000_STAT("multicast", stats.mprc), 71 E1000_STAT("multicast", stats.mprc),
72 E1000_STAT("collisions", stats.colc), 72 E1000_STAT("collisions", stats.colc),
73 E1000_NETDEV_STAT("rx_length_errors", stats.rx_length_errors), 73 E1000_NETDEV_STAT("rx_length_errors", rx_length_errors),
74 E1000_NETDEV_STAT("rx_over_errors", stats.rx_over_errors), 74 E1000_NETDEV_STAT("rx_over_errors", rx_over_errors),
75 E1000_STAT("rx_crc_errors", stats.crcerrs), 75 E1000_STAT("rx_crc_errors", stats.crcerrs),
76 E1000_NETDEV_STAT("rx_frame_errors", stats.rx_frame_errors), 76 E1000_NETDEV_STAT("rx_frame_errors", rx_frame_errors),
77 E1000_STAT("rx_no_buffer_count", stats.rnbc), 77 E1000_STAT("rx_no_buffer_count", stats.rnbc),
78 E1000_STAT("rx_missed_errors", stats.mpc), 78 E1000_STAT("rx_missed_errors", stats.mpc),
79 E1000_STAT("tx_aborted_errors", stats.ecol), 79 E1000_STAT("tx_aborted_errors", stats.ecol),
80 E1000_STAT("tx_carrier_errors", stats.tncrs), 80 E1000_STAT("tx_carrier_errors", stats.tncrs),
81 E1000_NETDEV_STAT("tx_fifo_errors", stats.tx_fifo_errors), 81 E1000_NETDEV_STAT("tx_fifo_errors", tx_fifo_errors),
82 E1000_NETDEV_STAT("tx_heartbeat_errors", stats.tx_heartbeat_errors), 82 E1000_NETDEV_STAT("tx_heartbeat_errors", tx_heartbeat_errors),
83 E1000_STAT("tx_window_errors", stats.latecol), 83 E1000_STAT("tx_window_errors", stats.latecol),
84 E1000_STAT("tx_abort_late_coll", stats.latecol), 84 E1000_STAT("tx_abort_late_coll", stats.latecol),
85 E1000_STAT("tx_deferred_ok", stats.dc), 85 E1000_STAT("tx_deferred_ok", stats.dc),
@@ -433,13 +433,11 @@ static void e1000_get_regs(struct net_device *netdev,
433 struct e1000_hw *hw = &adapter->hw; 433 struct e1000_hw *hw = &adapter->hw;
434 u32 *regs_buff = p; 434 u32 *regs_buff = p;
435 u16 phy_data; 435 u16 phy_data;
436 u8 revision_id;
437 436
438 memset(p, 0, E1000_REGS_LEN * sizeof(u32)); 437 memset(p, 0, E1000_REGS_LEN * sizeof(u32));
439 438
440 pci_read_config_byte(adapter->pdev, PCI_REVISION_ID, &revision_id); 439 regs->version = (1 << 24) | (adapter->pdev->revision << 16) |
441 440 adapter->pdev->device;
442 regs->version = (1 << 24) | (revision_id << 16) | adapter->pdev->device;
443 441
444 regs_buff[0] = er32(CTRL); 442 regs_buff[0] = er32(CTRL);
445 regs_buff[1] = er32(STATUS); 443 regs_buff[1] = er32(STATUS);
@@ -684,20 +682,13 @@ static int e1000_set_ringparam(struct net_device *netdev,
684 rx_old = adapter->rx_ring; 682 rx_old = adapter->rx_ring;
685 683
686 err = -ENOMEM; 684 err = -ENOMEM;
687 tx_ring = kzalloc(sizeof(struct e1000_ring), GFP_KERNEL); 685 tx_ring = kmemdup(tx_old, sizeof(struct e1000_ring), GFP_KERNEL);
688 if (!tx_ring) 686 if (!tx_ring)
689 goto err_alloc_tx; 687 goto err_alloc_tx;
690 /*
691 * use a memcpy to save any previously configured
692 * items like napi structs from having to be
693 * reinitialized
694 */
695 memcpy(tx_ring, tx_old, sizeof(struct e1000_ring));
696 688
697 rx_ring = kzalloc(sizeof(struct e1000_ring), GFP_KERNEL); 689 rx_ring = kmemdup(rx_old, sizeof(struct e1000_ring), GFP_KERNEL);
698 if (!rx_ring) 690 if (!rx_ring)
699 goto err_alloc_rx; 691 goto err_alloc_rx;
700 memcpy(rx_ring, rx_old, sizeof(struct e1000_ring));
701 692
702 adapter->tx_ring = tx_ring; 693 adapter->tx_ring = tx_ring;
703 adapter->rx_ring = rx_ring; 694 adapter->rx_ring = rx_ring;
@@ -1255,7 +1246,6 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
1255{ 1246{
1256 struct e1000_hw *hw = &adapter->hw; 1247 struct e1000_hw *hw = &adapter->hw;
1257 u32 ctrl_reg = 0; 1248 u32 ctrl_reg = 0;
1258 u32 stat_reg = 0;
1259 u16 phy_reg = 0; 1249 u16 phy_reg = 0;
1260 s32 ret_val = 0; 1250 s32 ret_val = 0;
1261 1251
@@ -1363,8 +1353,7 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
1363 * Set the ILOS bit on the fiber Nic if half duplex link is 1353 * Set the ILOS bit on the fiber Nic if half duplex link is
1364 * detected. 1354 * detected.
1365 */ 1355 */
1366 stat_reg = er32(STATUS); 1356 if ((er32(STATUS) & E1000_STATUS_FD) == 0)
1367 if ((stat_reg & E1000_STATUS_FD) == 0)
1368 ctrl_reg |= (E1000_CTRL_ILOS | E1000_CTRL_SLU); 1357 ctrl_reg |= (E1000_CTRL_ILOS | E1000_CTRL_SLU);
1369 } 1358 }
1370 1359
@@ -1677,10 +1666,13 @@ static int e1000_link_test(struct e1000_adapter *adapter, u64 *data)
1677 } else { 1666 } else {
1678 hw->mac.ops.check_for_link(hw); 1667 hw->mac.ops.check_for_link(hw);
1679 if (hw->mac.autoneg) 1668 if (hw->mac.autoneg)
1680 msleep(4000); 1669 /*
1670 * On some Phy/switch combinations, link establishment
1671 * can take a few seconds more than expected.
1672 */
1673 msleep(5000);
1681 1674
1682 if (!(er32(STATUS) & 1675 if (!(er32(STATUS) & E1000_STATUS_LU))
1683 E1000_STATUS_LU))
1684 *data = 1; 1676 *data = 1;
1685 } 1677 }
1686 return *data; 1678 return *data;
@@ -1807,8 +1799,7 @@ static void e1000_get_wol(struct net_device *netdev,
1807 return; 1799 return;
1808 1800
1809 wol->supported = WAKE_UCAST | WAKE_MCAST | 1801 wol->supported = WAKE_UCAST | WAKE_MCAST |
1810 WAKE_BCAST | WAKE_MAGIC | 1802 WAKE_BCAST | WAKE_MAGIC | WAKE_PHY;
1811 WAKE_PHY | WAKE_ARP;
1812 1803
1813 /* apply any specific unsupported masks here */ 1804 /* apply any specific unsupported masks here */
1814 if (adapter->flags & FLAG_NO_WAKE_UCAST) { 1805 if (adapter->flags & FLAG_NO_WAKE_UCAST) {
@@ -1829,19 +1820,16 @@ static void e1000_get_wol(struct net_device *netdev,
1829 wol->wolopts |= WAKE_MAGIC; 1820 wol->wolopts |= WAKE_MAGIC;
1830 if (adapter->wol & E1000_WUFC_LNKC) 1821 if (adapter->wol & E1000_WUFC_LNKC)
1831 wol->wolopts |= WAKE_PHY; 1822 wol->wolopts |= WAKE_PHY;
1832 if (adapter->wol & E1000_WUFC_ARP)
1833 wol->wolopts |= WAKE_ARP;
1834} 1823}
1835 1824
1836static int e1000_set_wol(struct net_device *netdev, 1825static int e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
1837 struct ethtool_wolinfo *wol)
1838{ 1826{
1839 struct e1000_adapter *adapter = netdev_priv(netdev); 1827 struct e1000_adapter *adapter = netdev_priv(netdev);
1840 1828
1841 if (!(adapter->flags & FLAG_HAS_WOL) || 1829 if (!(adapter->flags & FLAG_HAS_WOL) ||
1842 !device_can_wakeup(&adapter->pdev->dev) || 1830 !device_can_wakeup(&adapter->pdev->dev) ||
1843 (wol->wolopts & ~(WAKE_UCAST | WAKE_MCAST | WAKE_BCAST | 1831 (wol->wolopts & ~(WAKE_UCAST | WAKE_MCAST | WAKE_BCAST |
1844 WAKE_MAGIC | WAKE_PHY | WAKE_ARP))) 1832 WAKE_MAGIC | WAKE_PHY)))
1845 return -EOPNOTSUPP; 1833 return -EOPNOTSUPP;
1846 1834
1847 /* these settings will always override what we currently have */ 1835 /* these settings will always override what we currently have */
@@ -1857,8 +1845,6 @@ static int e1000_set_wol(struct net_device *netdev,
1857 adapter->wol |= E1000_WUFC_MAG; 1845 adapter->wol |= E1000_WUFC_MAG;
1858 if (wol->wolopts & WAKE_PHY) 1846 if (wol->wolopts & WAKE_PHY)
1859 adapter->wol |= E1000_WUFC_LNKC; 1847 adapter->wol |= E1000_WUFC_LNKC;
1860 if (wol->wolopts & WAKE_ARP)
1861 adapter->wol |= E1000_WUFC_ARP;
1862 1848
1863 device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); 1849 device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol);
1864 1850
@@ -1972,8 +1958,15 @@ static int e1000_set_coalesce(struct net_device *netdev,
1972static int e1000_nway_reset(struct net_device *netdev) 1958static int e1000_nway_reset(struct net_device *netdev)
1973{ 1959{
1974 struct e1000_adapter *adapter = netdev_priv(netdev); 1960 struct e1000_adapter *adapter = netdev_priv(netdev);
1975 if (netif_running(netdev)) 1961
1976 e1000e_reinit_locked(adapter); 1962 if (!netif_running(netdev))
1963 return -EAGAIN;
1964
1965 if (!adapter->hw.mac.autoneg)
1966 return -EINVAL;
1967
1968 e1000e_reinit_locked(adapter);
1969
1977 return 0; 1970 return 0;
1978} 1971}
1979 1972
@@ -1982,14 +1975,15 @@ static void e1000_get_ethtool_stats(struct net_device *netdev,
1982 u64 *data) 1975 u64 *data)
1983{ 1976{
1984 struct e1000_adapter *adapter = netdev_priv(netdev); 1977 struct e1000_adapter *adapter = netdev_priv(netdev);
1978 struct rtnl_link_stats64 net_stats;
1985 int i; 1979 int i;
1986 char *p = NULL; 1980 char *p = NULL;
1987 1981
1988 e1000e_update_stats(adapter); 1982 e1000e_get_stats64(netdev, &net_stats);
1989 for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { 1983 for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) {
1990 switch (e1000_gstrings_stats[i].type) { 1984 switch (e1000_gstrings_stats[i].type) {
1991 case NETDEV_STATS: 1985 case NETDEV_STATS:
1992 p = (char *) netdev + 1986 p = (char *) &net_stats +
1993 e1000_gstrings_stats[i].stat_offset; 1987 e1000_gstrings_stats[i].stat_offset;
1994 break; 1988 break;
1995 case E1000_STATS: 1989 case E1000_STATS:
@@ -2014,7 +2008,7 @@ static void e1000_get_strings(struct net_device *netdev, u32 stringset,
2014 2008
2015 switch (stringset) { 2009 switch (stringset) {
2016 case ETH_SS_TEST: 2010 case ETH_SS_TEST:
2017 memcpy(data, *e1000_gstrings_test, sizeof(e1000_gstrings_test)); 2011 memcpy(data, e1000_gstrings_test, sizeof(e1000_gstrings_test));
2018 break; 2012 break;
2019 case ETH_SS_STATS: 2013 case ETH_SS_STATS:
2020 for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { 2014 for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) {
diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h
index bc0860a598c9..307e1ec22417 100644
--- a/drivers/net/e1000e/hw.h
+++ b/drivers/net/e1000e/hw.h
@@ -812,9 +812,8 @@ struct e1000_nvm_operations {
812 812
813struct e1000_mac_info { 813struct e1000_mac_info {
814 struct e1000_mac_operations ops; 814 struct e1000_mac_operations ops;
815 815 u8 addr[ETH_ALEN];
816 u8 addr[6]; 816 u8 perm_addr[ETH_ALEN];
817 u8 perm_addr[6];
818 817
819 enum e1000_mac_type type; 818 enum e1000_mac_type type;
820 819
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index fb46974cfec1..ce1dbfdca112 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -140,6 +140,11 @@
140#define I82579_LPI_CTRL PHY_REG(772, 20) 140#define I82579_LPI_CTRL PHY_REG(772, 20)
141#define I82579_LPI_CTRL_ENABLE_MASK 0x6000 141#define I82579_LPI_CTRL_ENABLE_MASK 0x6000
142 142
143/* EMI Registers */
144#define I82579_EMI_ADDR 0x10
145#define I82579_EMI_DATA 0x11
146#define I82579_LPI_UPDATE_TIMER 0x4805 /* in 40ns units + 40 ns base value */
147
143/* Strapping Option Register - RO */ 148/* Strapping Option Register - RO */
144#define E1000_STRAP 0x0000C 149#define E1000_STRAP 0x0000C
145#define E1000_STRAP_SMBUS_ADDRESS_MASK 0x00FE0000 150#define E1000_STRAP_SMBUS_ADDRESS_MASK 0x00FE0000
@@ -302,9 +307,9 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw)
302 * the interconnect to PCIe mode. 307 * the interconnect to PCIe mode.
303 */ 308 */
304 fwsm = er32(FWSM); 309 fwsm = er32(FWSM);
305 if (!(fwsm & E1000_ICH_FWSM_FW_VALID)) { 310 if (!(fwsm & E1000_ICH_FWSM_FW_VALID) && !e1000_check_reset_block(hw)) {
306 ctrl = er32(CTRL); 311 ctrl = er32(CTRL);
307 ctrl |= E1000_CTRL_LANPHYPC_OVERRIDE; 312 ctrl |= E1000_CTRL_LANPHYPC_OVERRIDE;
308 ctrl &= ~E1000_CTRL_LANPHYPC_VALUE; 313 ctrl &= ~E1000_CTRL_LANPHYPC_VALUE;
309 ew32(CTRL, ctrl); 314 ew32(CTRL, ctrl);
310 udelay(10); 315 udelay(10);
@@ -331,7 +336,7 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw)
331 goto out; 336 goto out;
332 337
333 /* Ungate automatic PHY configuration on non-managed 82579 */ 338 /* Ungate automatic PHY configuration on non-managed 82579 */
334 if ((hw->mac.type == e1000_pch2lan) && 339 if ((hw->mac.type == e1000_pch2lan) &&
335 !(fwsm & E1000_ICH_FWSM_FW_VALID)) { 340 !(fwsm & E1000_ICH_FWSM_FW_VALID)) {
336 msleep(10); 341 msleep(10);
337 e1000_gate_hw_phy_config_ich8lan(hw, false); 342 e1000_gate_hw_phy_config_ich8lan(hw, false);
@@ -366,7 +371,7 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw)
366 case e1000_phy_82579: 371 case e1000_phy_82579:
367 phy->ops.check_polarity = e1000_check_polarity_82577; 372 phy->ops.check_polarity = e1000_check_polarity_82577;
368 phy->ops.force_speed_duplex = 373 phy->ops.force_speed_duplex =
369 e1000_phy_force_speed_duplex_82577; 374 e1000_phy_force_speed_duplex_82577;
370 phy->ops.get_cable_length = e1000_get_cable_length_82577; 375 phy->ops.get_cable_length = e1000_get_cable_length_82577;
371 phy->ops.get_info = e1000_get_phy_info_82577; 376 phy->ops.get_info = e1000_get_phy_info_82577;
372 phy->ops.commit = e1000e_phy_sw_reset; 377 phy->ops.commit = e1000e_phy_sw_reset;
@@ -753,7 +758,13 @@ static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter)
753 if (rc) 758 if (rc)
754 return rc; 759 return rc;
755 760
756 if (adapter->hw.phy.type == e1000_phy_ife) { 761 /*
762 * Disable Jumbo Frame support on parts with Intel 10/100 PHY or
763 * on parts with MACsec enabled in NVM (reflected in CTRL_EXT).
764 */
765 if ((adapter->hw.phy.type == e1000_phy_ife) ||
766 ((adapter->hw.mac.type >= e1000_pch2lan) &&
767 (!(er32(CTRL_EXT) & E1000_CTRL_EXT_LSECCK)))) {
757 adapter->flags &= ~FLAG_HAS_JUMBO_FRAMES; 768 adapter->flags &= ~FLAG_HAS_JUMBO_FRAMES;
758 adapter->max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN; 769 adapter->max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN;
759 } 770 }
@@ -1723,11 +1734,25 @@ static s32 e1000_post_phy_reset_ich8lan(struct e1000_hw *hw)
1723 /* Configure the LCD with the OEM bits in NVM */ 1734 /* Configure the LCD with the OEM bits in NVM */
1724 ret_val = e1000_oem_bits_config_ich8lan(hw, true); 1735 ret_val = e1000_oem_bits_config_ich8lan(hw, true);
1725 1736
1726 /* Ungate automatic PHY configuration on non-managed 82579 */ 1737 if (hw->mac.type == e1000_pch2lan) {
1727 if ((hw->mac.type == e1000_pch2lan) && 1738 /* Ungate automatic PHY configuration on non-managed 82579 */
1728 !(er32(FWSM) & E1000_ICH_FWSM_FW_VALID)) { 1739 if (!(er32(FWSM) & E1000_ICH_FWSM_FW_VALID)) {
1729 msleep(10); 1740 msleep(10);
1730 e1000_gate_hw_phy_config_ich8lan(hw, false); 1741 e1000_gate_hw_phy_config_ich8lan(hw, false);
1742 }
1743
1744 /* Set EEE LPI Update Timer to 200usec */
1745 ret_val = hw->phy.ops.acquire(hw);
1746 if (ret_val)
1747 goto out;
1748 ret_val = hw->phy.ops.write_reg_locked(hw, I82579_EMI_ADDR,
1749 I82579_LPI_UPDATE_TIMER);
1750 if (ret_val)
1751 goto release;
1752 ret_val = hw->phy.ops.write_reg_locked(hw, I82579_EMI_DATA,
1753 0x1387);
1754release:
1755 hw->phy.ops.release(hw);
1731 } 1756 }
1732 1757
1733out: 1758out:
@@ -2104,7 +2129,6 @@ static s32 e1000_flash_cycle_init_ich8lan(struct e1000_hw *hw)
2104{ 2129{
2105 union ich8_hws_flash_status hsfsts; 2130 union ich8_hws_flash_status hsfsts;
2106 s32 ret_val = -E1000_ERR_NVM; 2131 s32 ret_val = -E1000_ERR_NVM;
2107 s32 i = 0;
2108 2132
2109 hsfsts.regval = er16flash(ICH_FLASH_HSFSTS); 2133 hsfsts.regval = er16flash(ICH_FLASH_HSFSTS);
2110 2134
@@ -2140,6 +2164,8 @@ static s32 e1000_flash_cycle_init_ich8lan(struct e1000_hw *hw)
2140 ew16flash(ICH_FLASH_HSFSTS, hsfsts.regval); 2164 ew16flash(ICH_FLASH_HSFSTS, hsfsts.regval);
2141 ret_val = 0; 2165 ret_val = 0;
2142 } else { 2166 } else {
2167 s32 i = 0;
2168
2143 /* 2169 /*
2144 * Otherwise poll for sometime so the current 2170 * Otherwise poll for sometime so the current
2145 * cycle has a chance to end before giving up. 2171 * cycle has a chance to end before giving up.
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c
index 68aa1749bf66..96921de5df2e 100644
--- a/drivers/net/e1000e/lib.c
+++ b/drivers/net/e1000e/lib.c
@@ -1978,15 +1978,15 @@ static s32 e1000_ready_nvm_eeprom(struct e1000_hw *hw)
1978{ 1978{
1979 struct e1000_nvm_info *nvm = &hw->nvm; 1979 struct e1000_nvm_info *nvm = &hw->nvm;
1980 u32 eecd = er32(EECD); 1980 u32 eecd = er32(EECD);
1981 u16 timeout = 0;
1982 u8 spi_stat_reg; 1981 u8 spi_stat_reg;
1983 1982
1984 if (nvm->type == e1000_nvm_eeprom_spi) { 1983 if (nvm->type == e1000_nvm_eeprom_spi) {
1984 u16 timeout = NVM_MAX_RETRY_SPI;
1985
1985 /* Clear SK and CS */ 1986 /* Clear SK and CS */
1986 eecd &= ~(E1000_EECD_CS | E1000_EECD_SK); 1987 eecd &= ~(E1000_EECD_CS | E1000_EECD_SK);
1987 ew32(EECD, eecd); 1988 ew32(EECD, eecd);
1988 udelay(1); 1989 udelay(1);
1989 timeout = NVM_MAX_RETRY_SPI;
1990 1990
1991 /* 1991 /*
1992 * Read "Status Register" repeatedly until the LSB is cleared. 1992 * Read "Status Register" repeatedly until the LSB is cleared.
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 6d513a383340..a39d4a4d871c 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -54,7 +54,7 @@
54 54
55#define DRV_EXTRAVERSION "-k2" 55#define DRV_EXTRAVERSION "-k2"
56 56
57#define DRV_VERSION "1.2.20" DRV_EXTRAVERSION 57#define DRV_VERSION "1.3.10" DRV_EXTRAVERSION
58char e1000e_driver_name[] = "e1000e"; 58char e1000e_driver_name[] = "e1000e";
59const char e1000e_driver_version[] = DRV_VERSION; 59const char e1000e_driver_version[] = DRV_VERSION;
60 60
@@ -900,8 +900,6 @@ next_desc:
900 900
901 adapter->total_rx_bytes += total_rx_bytes; 901 adapter->total_rx_bytes += total_rx_bytes;
902 adapter->total_rx_packets += total_rx_packets; 902 adapter->total_rx_packets += total_rx_packets;
903 netdev->stats.rx_bytes += total_rx_bytes;
904 netdev->stats.rx_packets += total_rx_packets;
905 return cleaned; 903 return cleaned;
906} 904}
907 905
@@ -1060,8 +1058,6 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter)
1060 } 1058 }
1061 adapter->total_tx_bytes += total_tx_bytes; 1059 adapter->total_tx_bytes += total_tx_bytes;
1062 adapter->total_tx_packets += total_tx_packets; 1060 adapter->total_tx_packets += total_tx_packets;
1063 netdev->stats.tx_bytes += total_tx_bytes;
1064 netdev->stats.tx_packets += total_tx_packets;
1065 return count < tx_ring->count; 1061 return count < tx_ring->count;
1066} 1062}
1067 1063
@@ -1248,8 +1244,6 @@ next_desc:
1248 1244
1249 adapter->total_rx_bytes += total_rx_bytes; 1245 adapter->total_rx_bytes += total_rx_bytes;
1250 adapter->total_rx_packets += total_rx_packets; 1246 adapter->total_rx_packets += total_rx_packets;
1251 netdev->stats.rx_bytes += total_rx_bytes;
1252 netdev->stats.rx_packets += total_rx_packets;
1253 return cleaned; 1247 return cleaned;
1254} 1248}
1255 1249
@@ -1328,7 +1322,7 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter,
1328 /* an error means any chain goes out the window 1322 /* an error means any chain goes out the window
1329 * too */ 1323 * too */
1330 if (rx_ring->rx_skb_top) 1324 if (rx_ring->rx_skb_top)
1331 dev_kfree_skb(rx_ring->rx_skb_top); 1325 dev_kfree_skb_irq(rx_ring->rx_skb_top);
1332 rx_ring->rx_skb_top = NULL; 1326 rx_ring->rx_skb_top = NULL;
1333 goto next_desc; 1327 goto next_desc;
1334 } 1328 }
@@ -1401,7 +1395,7 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter,
1401 /* eth type trans needs skb->data to point to something */ 1395 /* eth type trans needs skb->data to point to something */
1402 if (!pskb_may_pull(skb, ETH_HLEN)) { 1396 if (!pskb_may_pull(skb, ETH_HLEN)) {
1403 e_err("pskb_may_pull failed.\n"); 1397 e_err("pskb_may_pull failed.\n");
1404 dev_kfree_skb(skb); 1398 dev_kfree_skb_irq(skb);
1405 goto next_desc; 1399 goto next_desc;
1406 } 1400 }
1407 1401
@@ -1429,8 +1423,6 @@ next_desc:
1429 1423
1430 adapter->total_rx_bytes += total_rx_bytes; 1424 adapter->total_rx_bytes += total_rx_bytes;
1431 adapter->total_rx_packets += total_rx_packets; 1425 adapter->total_rx_packets += total_rx_packets;
1432 netdev->stats.rx_bytes += total_rx_bytes;
1433 netdev->stats.rx_packets += total_rx_packets;
1434 return cleaned; 1426 return cleaned;
1435} 1427}
1436 1428
@@ -1857,7 +1849,9 @@ static int e1000_request_msix(struct e1000_adapter *adapter)
1857 int err = 0, vector = 0; 1849 int err = 0, vector = 0;
1858 1850
1859 if (strlen(netdev->name) < (IFNAMSIZ - 5)) 1851 if (strlen(netdev->name) < (IFNAMSIZ - 5))
1860 sprintf(adapter->rx_ring->name, "%s-rx-0", netdev->name); 1852 snprintf(adapter->rx_ring->name,
1853 sizeof(adapter->rx_ring->name) - 1,
1854 "%s-rx-0", netdev->name);
1861 else 1855 else
1862 memcpy(adapter->rx_ring->name, netdev->name, IFNAMSIZ); 1856 memcpy(adapter->rx_ring->name, netdev->name, IFNAMSIZ);
1863 err = request_irq(adapter->msix_entries[vector].vector, 1857 err = request_irq(adapter->msix_entries[vector].vector,
@@ -1870,7 +1864,9 @@ static int e1000_request_msix(struct e1000_adapter *adapter)
1870 vector++; 1864 vector++;
1871 1865
1872 if (strlen(netdev->name) < (IFNAMSIZ - 5)) 1866 if (strlen(netdev->name) < (IFNAMSIZ - 5))
1873 sprintf(adapter->tx_ring->name, "%s-tx-0", netdev->name); 1867 snprintf(adapter->tx_ring->name,
1868 sizeof(adapter->tx_ring->name) - 1,
1869 "%s-tx-0", netdev->name);
1874 else 1870 else
1875 memcpy(adapter->tx_ring->name, netdev->name, IFNAMSIZ); 1871 memcpy(adapter->tx_ring->name, netdev->name, IFNAMSIZ);
1876 err = request_irq(adapter->msix_entries[vector].vector, 1872 err = request_irq(adapter->msix_entries[vector].vector,
@@ -2734,7 +2730,6 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
2734{ 2730{
2735 struct e1000_hw *hw = &adapter->hw; 2731 struct e1000_hw *hw = &adapter->hw;
2736 u32 rctl, rfctl; 2732 u32 rctl, rfctl;
2737 u32 psrctl = 0;
2738 u32 pages = 0; 2733 u32 pages = 0;
2739 2734
2740 /* Workaround Si errata on 82579 - configure jumbo frame flow */ 2735 /* Workaround Si errata on 82579 - configure jumbo frame flow */
@@ -2833,6 +2828,8 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
2833 adapter->rx_ps_pages = 0; 2828 adapter->rx_ps_pages = 0;
2834 2829
2835 if (adapter->rx_ps_pages) { 2830 if (adapter->rx_ps_pages) {
2831 u32 psrctl = 0;
2832
2836 /* Configure extra packet-split registers */ 2833 /* Configure extra packet-split registers */
2837 rfctl = er32(RFCTL); 2834 rfctl = er32(RFCTL);
2838 rfctl |= E1000_RFCTL_EXTEN; 2835 rfctl |= E1000_RFCTL_EXTEN;
@@ -3034,7 +3031,6 @@ static void e1000_set_multi(struct net_device *netdev)
3034 struct netdev_hw_addr *ha; 3031 struct netdev_hw_addr *ha;
3035 u8 *mta_list; 3032 u8 *mta_list;
3036 u32 rctl; 3033 u32 rctl;
3037 int i;
3038 3034
3039 /* Check for Promiscuous and All Multicast modes */ 3035 /* Check for Promiscuous and All Multicast modes */
3040 3036
@@ -3057,12 +3053,13 @@ static void e1000_set_multi(struct net_device *netdev)
3057 ew32(RCTL, rctl); 3053 ew32(RCTL, rctl);
3058 3054
3059 if (!netdev_mc_empty(netdev)) { 3055 if (!netdev_mc_empty(netdev)) {
3056 int i = 0;
3057
3060 mta_list = kmalloc(netdev_mc_count(netdev) * 6, GFP_ATOMIC); 3058 mta_list = kmalloc(netdev_mc_count(netdev) * 6, GFP_ATOMIC);
3061 if (!mta_list) 3059 if (!mta_list)
3062 return; 3060 return;
3063 3061
3064 /* prepare a packed array of only addresses. */ 3062 /* prepare a packed array of only addresses. */
3065 i = 0;
3066 netdev_for_each_mc_addr(ha, netdev) 3063 netdev_for_each_mc_addr(ha, netdev)
3067 memcpy(mta_list + (i++ * ETH_ALEN), ha->addr, ETH_ALEN); 3064 memcpy(mta_list + (i++ * ETH_ALEN), ha->addr, ETH_ALEN);
3068 3065
@@ -3359,6 +3356,8 @@ static void e1000e_flush_descriptors(struct e1000_adapter *adapter)
3359 e1e_flush(); 3356 e1e_flush();
3360} 3357}
3361 3358
3359static void e1000e_update_stats(struct e1000_adapter *adapter);
3360
3362void e1000e_down(struct e1000_adapter *adapter) 3361void e1000e_down(struct e1000_adapter *adapter)
3363{ 3362{
3364 struct net_device *netdev = adapter->netdev; 3363 struct net_device *netdev = adapter->netdev;
@@ -3393,6 +3392,11 @@ void e1000e_down(struct e1000_adapter *adapter)
3393 del_timer_sync(&adapter->phy_info_timer); 3392 del_timer_sync(&adapter->phy_info_timer);
3394 3393
3395 netif_carrier_off(netdev); 3394 netif_carrier_off(netdev);
3395
3396 spin_lock(&adapter->stats64_lock);
3397 e1000e_update_stats(adapter);
3398 spin_unlock(&adapter->stats64_lock);
3399
3396 adapter->link_speed = 0; 3400 adapter->link_speed = 0;
3397 adapter->link_duplex = 0; 3401 adapter->link_duplex = 0;
3398 3402
@@ -3437,6 +3441,8 @@ static int __devinit e1000_sw_init(struct e1000_adapter *adapter)
3437 adapter->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; 3441 adapter->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN;
3438 adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN; 3442 adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN;
3439 3443
3444 spin_lock_init(&adapter->stats64_lock);
3445
3440 e1000e_set_interrupt_capability(adapter); 3446 e1000e_set_interrupt_capability(adapter);
3441 3447
3442 if (e1000_alloc_queues(adapter)) 3448 if (e1000_alloc_queues(adapter))
@@ -3918,7 +3924,7 @@ release:
3918 * e1000e_update_stats - Update the board statistics counters 3924 * e1000e_update_stats - Update the board statistics counters
3919 * @adapter: board private structure 3925 * @adapter: board private structure
3920 **/ 3926 **/
3921void e1000e_update_stats(struct e1000_adapter *adapter) 3927static void e1000e_update_stats(struct e1000_adapter *adapter)
3922{ 3928{
3923 struct net_device *netdev = adapter->netdev; 3929 struct net_device *netdev = adapter->netdev;
3924 struct e1000_hw *hw = &adapter->hw; 3930 struct e1000_hw *hw = &adapter->hw;
@@ -4030,10 +4036,11 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter)
4030{ 4036{
4031 struct e1000_hw *hw = &adapter->hw; 4037 struct e1000_hw *hw = &adapter->hw;
4032 struct e1000_phy_regs *phy = &adapter->phy_regs; 4038 struct e1000_phy_regs *phy = &adapter->phy_regs;
4033 int ret_val;
4034 4039
4035 if ((er32(STATUS) & E1000_STATUS_LU) && 4040 if ((er32(STATUS) & E1000_STATUS_LU) &&
4036 (adapter->hw.phy.media_type == e1000_media_type_copper)) { 4041 (adapter->hw.phy.media_type == e1000_media_type_copper)) {
4042 int ret_val;
4043
4037 ret_val = e1e_rphy(hw, PHY_CONTROL, &phy->bmcr); 4044 ret_val = e1e_rphy(hw, PHY_CONTROL, &phy->bmcr);
4038 ret_val |= e1e_rphy(hw, PHY_STATUS, &phy->bmsr); 4045 ret_val |= e1e_rphy(hw, PHY_STATUS, &phy->bmsr);
4039 ret_val |= e1e_rphy(hw, PHY_AUTONEG_ADV, &phy->advertise); 4046 ret_val |= e1e_rphy(hw, PHY_AUTONEG_ADV, &phy->advertise);
@@ -4179,7 +4186,6 @@ static void e1000_watchdog_task(struct work_struct *work)
4179 struct e1000_ring *tx_ring = adapter->tx_ring; 4186 struct e1000_ring *tx_ring = adapter->tx_ring;
4180 struct e1000_hw *hw = &adapter->hw; 4187 struct e1000_hw *hw = &adapter->hw;
4181 u32 link, tctl; 4188 u32 link, tctl;
4182 int tx_pending = 0;
4183 4189
4184 if (test_bit(__E1000_DOWN, &adapter->state)) 4190 if (test_bit(__E1000_DOWN, &adapter->state))
4185 return; 4191 return;
@@ -4320,7 +4326,9 @@ static void e1000_watchdog_task(struct work_struct *work)
4320 } 4326 }
4321 4327
4322link_up: 4328link_up:
4329 spin_lock(&adapter->stats64_lock);
4323 e1000e_update_stats(adapter); 4330 e1000e_update_stats(adapter);
4331 spin_unlock(&adapter->stats64_lock);
4324 4332
4325 mac->tx_packet_delta = adapter->stats.tpt - adapter->tpt_old; 4333 mac->tx_packet_delta = adapter->stats.tpt - adapter->tpt_old;
4326 adapter->tpt_old = adapter->stats.tpt; 4334 adapter->tpt_old = adapter->stats.tpt;
@@ -4334,20 +4342,17 @@ link_up:
4334 4342
4335 e1000e_update_adaptive(&adapter->hw); 4343 e1000e_update_adaptive(&adapter->hw);
4336 4344
4337 if (!netif_carrier_ok(netdev)) { 4345 if (!netif_carrier_ok(netdev) &&
4338 tx_pending = (e1000_desc_unused(tx_ring) + 1 < 4346 (e1000_desc_unused(tx_ring) + 1 < tx_ring->count)) {
4339 tx_ring->count); 4347 /*
4340 if (tx_pending) { 4348 * We've lost link, so the controller stops DMA,
4341 /* 4349 * but we've got queued Tx work that's never going
4342 * We've lost link, so the controller stops DMA, 4350 * to get done, so reset controller to flush Tx.
4343 * but we've got queued Tx work that's never going 4351 * (Do the reset outside of interrupt context).
4344 * to get done, so reset controller to flush Tx. 4352 */
4345 * (Do the reset outside of interrupt context). 4353 schedule_work(&adapter->reset_task);
4346 */ 4354 /* return immediately since reset is imminent */
4347 schedule_work(&adapter->reset_task); 4355 return;
4348 /* return immediately since reset is imminent */
4349 return;
4350 }
4351 } 4356 }
4352 4357
4353 /* Simple mode for Interrupt Throttle Rate (ITR) */ 4358 /* Simple mode for Interrupt Throttle Rate (ITR) */
@@ -4411,13 +4416,13 @@ static int e1000_tso(struct e1000_adapter *adapter,
4411 u32 cmd_length = 0; 4416 u32 cmd_length = 0;
4412 u16 ipcse = 0, tucse, mss; 4417 u16 ipcse = 0, tucse, mss;
4413 u8 ipcss, ipcso, tucss, tucso, hdr_len; 4418 u8 ipcss, ipcso, tucss, tucso, hdr_len;
4414 int err;
4415 4419
4416 if (!skb_is_gso(skb)) 4420 if (!skb_is_gso(skb))
4417 return 0; 4421 return 0;
4418 4422
4419 if (skb_header_cloned(skb)) { 4423 if (skb_header_cloned(skb)) {
4420 err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC); 4424 int err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
4425
4421 if (err) 4426 if (err)
4422 return err; 4427 return err;
4423 } 4428 }
@@ -4928,16 +4933,55 @@ static void e1000_reset_task(struct work_struct *work)
4928} 4933}
4929 4934
4930/** 4935/**
4931 * e1000_get_stats - Get System Network Statistics 4936 * e1000_get_stats64 - Get System Network Statistics
4932 * @netdev: network interface device structure 4937 * @netdev: network interface device structure
4938 * @stats: rtnl_link_stats64 pointer
4933 * 4939 *
4934 * Returns the address of the device statistics structure. 4940 * Returns the address of the device statistics structure.
4935 * The statistics are actually updated from the timer callback.
4936 **/ 4941 **/
4937static struct net_device_stats *e1000_get_stats(struct net_device *netdev) 4942struct rtnl_link_stats64 *e1000e_get_stats64(struct net_device *netdev,
4943 struct rtnl_link_stats64 *stats)
4938{ 4944{
4939 /* only return the current stats */ 4945 struct e1000_adapter *adapter = netdev_priv(netdev);
4940 return &netdev->stats; 4946
4947 memset(stats, 0, sizeof(struct rtnl_link_stats64));
4948 spin_lock(&adapter->stats64_lock);
4949 e1000e_update_stats(adapter);
4950 /* Fill out the OS statistics structure */
4951 stats->rx_bytes = adapter->stats.gorc;
4952 stats->rx_packets = adapter->stats.gprc;
4953 stats->tx_bytes = adapter->stats.gotc;
4954 stats->tx_packets = adapter->stats.gptc;
4955 stats->multicast = adapter->stats.mprc;
4956 stats->collisions = adapter->stats.colc;
4957
4958 /* Rx Errors */
4959
4960 /*
4961 * RLEC on some newer hardware can be incorrect so build
4962 * our own version based on RUC and ROC
4963 */
4964 stats->rx_errors = adapter->stats.rxerrc +
4965 adapter->stats.crcerrs + adapter->stats.algnerrc +
4966 adapter->stats.ruc + adapter->stats.roc +
4967 adapter->stats.cexterr;
4968 stats->rx_length_errors = adapter->stats.ruc +
4969 adapter->stats.roc;
4970 stats->rx_crc_errors = adapter->stats.crcerrs;
4971 stats->rx_frame_errors = adapter->stats.algnerrc;
4972 stats->rx_missed_errors = adapter->stats.mpc;
4973
4974 /* Tx Errors */
4975 stats->tx_errors = adapter->stats.ecol +
4976 adapter->stats.latecol;
4977 stats->tx_aborted_errors = adapter->stats.ecol;
4978 stats->tx_window_errors = adapter->stats.latecol;
4979 stats->tx_carrier_errors = adapter->stats.tncrs;
4980
4981 /* Tx Dropped needs to be maintained elsewhere */
4982
4983 spin_unlock(&adapter->stats64_lock);
4984 return stats;
4941} 4985}
4942 4986
4943/** 4987/**
@@ -5507,9 +5551,10 @@ static irqreturn_t e1000_intr_msix(int irq, void *data)
5507{ 5551{
5508 struct net_device *netdev = data; 5552 struct net_device *netdev = data;
5509 struct e1000_adapter *adapter = netdev_priv(netdev); 5553 struct e1000_adapter *adapter = netdev_priv(netdev);
5510 int vector, msix_irq;
5511 5554
5512 if (adapter->msix_entries) { 5555 if (adapter->msix_entries) {
5556 int vector, msix_irq;
5557
5513 vector = 0; 5558 vector = 0;
5514 msix_irq = adapter->msix_entries[vector].vector; 5559 msix_irq = adapter->msix_entries[vector].vector;
5515 disable_irq(msix_irq); 5560 disable_irq(msix_irq);
@@ -5706,7 +5751,7 @@ static const struct net_device_ops e1000e_netdev_ops = {
5706 .ndo_open = e1000_open, 5751 .ndo_open = e1000_open,
5707 .ndo_stop = e1000_close, 5752 .ndo_stop = e1000_close,
5708 .ndo_start_xmit = e1000_xmit_frame, 5753 .ndo_start_xmit = e1000_xmit_frame,
5709 .ndo_get_stats = e1000_get_stats, 5754 .ndo_get_stats64 = e1000e_get_stats64,
5710 .ndo_set_multicast_list = e1000_set_multi, 5755 .ndo_set_multicast_list = e1000_set_multi,
5711 .ndo_set_mac_address = e1000_set_mac, 5756 .ndo_set_mac_address = e1000_set_mac,
5712 .ndo_change_mtu = e1000_change_mtu, 5757 .ndo_change_mtu = e1000_change_mtu,
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c
index 6bea051b134b..6ae31fcfb629 100644
--- a/drivers/net/e1000e/phy.c
+++ b/drivers/net/e1000e/phy.c
@@ -2409,9 +2409,7 @@ static u32 e1000_get_phy_addr_for_bm_page(u32 page, u32 reg)
2409s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data) 2409s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data)
2410{ 2410{
2411 s32 ret_val; 2411 s32 ret_val;
2412 u32 page_select = 0;
2413 u32 page = offset >> IGP_PAGE_SHIFT; 2412 u32 page = offset >> IGP_PAGE_SHIFT;
2414 u32 page_shift = 0;
2415 2413
2416 ret_val = hw->phy.ops.acquire(hw); 2414 ret_val = hw->phy.ops.acquire(hw);
2417 if (ret_val) 2415 if (ret_val)
@@ -2427,6 +2425,8 @@ s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data)
2427 hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); 2425 hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset);
2428 2426
2429 if (offset > MAX_PHY_MULTI_PAGE_REG) { 2427 if (offset > MAX_PHY_MULTI_PAGE_REG) {
2428 u32 page_shift, page_select;
2429
2430 /* 2430 /*
2431 * Page select is register 31 for phy address 1 and 22 for 2431 * Page select is register 31 for phy address 1 and 22 for
2432 * phy address 2 and 3. Page select is shifted only for 2432 * phy address 2 and 3. Page select is shifted only for
@@ -2468,9 +2468,7 @@ out:
2468s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data) 2468s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data)
2469{ 2469{
2470 s32 ret_val; 2470 s32 ret_val;
2471 u32 page_select = 0;
2472 u32 page = offset >> IGP_PAGE_SHIFT; 2471 u32 page = offset >> IGP_PAGE_SHIFT;
2473 u32 page_shift = 0;
2474 2472
2475 ret_val = hw->phy.ops.acquire(hw); 2473 ret_val = hw->phy.ops.acquire(hw);
2476 if (ret_val) 2474 if (ret_val)
@@ -2486,6 +2484,8 @@ s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data)
2486 hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); 2484 hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset);
2487 2485
2488 if (offset > MAX_PHY_MULTI_PAGE_REG) { 2486 if (offset > MAX_PHY_MULTI_PAGE_REG) {
2487 u32 page_shift, page_select;
2488
2489 /* 2489 /*
2490 * Page select is register 31 for phy address 1 and 22 for 2490 * Page select is register 31 for phy address 1 and 22 for
2491 * phy address 2 and 3. Page select is shifted only for 2491 * phy address 2 and 3. Page select is shifted only for