aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/e1000
diff options
context:
space:
mode:
authorKrzysztof Majzerowicz-Jaszcz <cristos@vipserv.org>2014-08-27 03:10:58 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2014-09-06 06:26:30 -0400
commit887a79f4a8cce981bb74bf56e1ee25786f235e66 (patch)
tree6ac570d5d41cc653340e066a36728d2bbb7d2d21 /drivers/net/ethernet/intel/e1000
parentcfecec56ae7c7c40f23fbdac04acee027ca3bd66 (diff)
e1000: e1000_ethertool.c coding style fixes
Fixed many errors/warnings and checks in e1000_ethtool.c reported by checkpatch.pl. Suggestions from Joe Perches and Alexander Duyck applied as well Signed-off-by: Krzysztof Majzerowicz-Jaszcz <cristos@vipserv.org> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/e1000')
-rw-r--r--drivers/net/ethernet/intel/e1000/e1000_ethtool.c155
1 files changed, 79 insertions, 76 deletions
diff --git a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
index cca5bca44e73..9b50272824a1 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
@@ -1,35 +1,30 @@
1/******************************************************************************* 1/*******************************************************************************
2 2 * Intel PRO/1000 Linux driver
3 Intel PRO/1000 Linux driver 3 * Copyright(c) 1999 - 2006 Intel Corporation.
4 Copyright(c) 1999 - 2006 Intel Corporation. 4 *
5 5 * 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 6 * under the terms and conditions of the GNU General Public License,
7 under the terms and conditions of the GNU General Public License, 7 * version 2, as published by the Free Software Foundation.
8 version 2, as published by the Free Software Foundation. 8 *
9 9 * This program is distributed in the hope it will be useful, but WITHOUT
10 This program is distributed in the hope it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 * more details.
13 more details. 13 *
14 14 * The full GNU General Public License is included in this distribution in
15 You should have received a copy of the GNU General Public License along with 15 * the file called "COPYING".
16 this program; if not, write to the Free Software Foundation, Inc., 16 *
17 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 17 * Contact Information:
18 18 * Linux NICS <linux.nics@intel.com>
19 The full GNU General Public License is included in this distribution in 19 * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
20 the file called "COPYING". 20 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
21 21 *
22 Contact Information: 22 ******************************************************************************/
23 Linux NICS <linux.nics@intel.com>
24 e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
25 Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
26
27*******************************************************************************/
28 23
29/* ethtool support for e1000 */ 24/* ethtool support for e1000 */
30 25
31#include "e1000.h" 26#include "e1000.h"
32#include <asm/uaccess.h> 27#include <linux/uaccess.h>
33 28
34enum {NETDEV_STATS, E1000_STATS}; 29enum {NETDEV_STATS, E1000_STATS};
35 30
@@ -42,7 +37,7 @@ struct e1000_stats {
42 37
43#define E1000_STAT(m) E1000_STATS, \ 38#define E1000_STAT(m) E1000_STATS, \
44 sizeof(((struct e1000_adapter *)0)->m), \ 39 sizeof(((struct e1000_adapter *)0)->m), \
45 offsetof(struct e1000_adapter, m) 40 offsetof(struct e1000_adapter, m)
46#define E1000_NETDEV_STAT(m) NETDEV_STATS, \ 41#define E1000_NETDEV_STAT(m) NETDEV_STATS, \
47 sizeof(((struct net_device *)0)->m), \ 42 sizeof(((struct net_device *)0)->m), \
48 offsetof(struct net_device, m) 43 offsetof(struct net_device, m)
@@ -104,6 +99,7 @@ static const char e1000_gstrings_test[][ETH_GSTRING_LEN] = {
104 "Interrupt test (offline)", "Loopback test (offline)", 99 "Interrupt test (offline)", "Loopback test (offline)",
105 "Link test (on/offline)" 100 "Link test (on/offline)"
106}; 101};
102
107#define E1000_TEST_LEN ARRAY_SIZE(e1000_gstrings_test) 103#define E1000_TEST_LEN ARRAY_SIZE(e1000_gstrings_test)
108 104
109static int e1000_get_settings(struct net_device *netdev, 105static int e1000_get_settings(struct net_device *netdev,
@@ -113,7 +109,6 @@ static int e1000_get_settings(struct net_device *netdev,
113 struct e1000_hw *hw = &adapter->hw; 109 struct e1000_hw *hw = &adapter->hw;
114 110
115 if (hw->media_type == e1000_media_type_copper) { 111 if (hw->media_type == e1000_media_type_copper) {
116
117 ecmd->supported = (SUPPORTED_10baseT_Half | 112 ecmd->supported = (SUPPORTED_10baseT_Half |
118 SUPPORTED_10baseT_Full | 113 SUPPORTED_10baseT_Full |
119 SUPPORTED_100baseT_Half | 114 SUPPORTED_100baseT_Half |
@@ -155,9 +150,8 @@ static int e1000_get_settings(struct net_device *netdev,
155 } 150 }
156 151
157 if (er32(STATUS) & E1000_STATUS_LU) { 152 if (er32(STATUS) & E1000_STATUS_LU) {
158
159 e1000_get_speed_and_duplex(hw, &adapter->link_speed, 153 e1000_get_speed_and_duplex(hw, &adapter->link_speed,
160 &adapter->link_duplex); 154 &adapter->link_duplex);
161 ethtool_cmd_speed_set(ecmd, adapter->link_speed); 155 ethtool_cmd_speed_set(ecmd, adapter->link_speed);
162 156
163 /* unfortunately FULL_DUPLEX != DUPLEX_FULL 157 /* unfortunately FULL_DUPLEX != DUPLEX_FULL
@@ -247,9 +241,9 @@ static int e1000_set_settings(struct net_device *netdev,
247 if (netif_running(adapter->netdev)) { 241 if (netif_running(adapter->netdev)) {
248 e1000_down(adapter); 242 e1000_down(adapter);
249 e1000_up(adapter); 243 e1000_up(adapter);
250 } else 244 } else {
251 e1000_reset(adapter); 245 e1000_reset(adapter);
252 246 }
253 clear_bit(__E1000_RESETTING, &adapter->flags); 247 clear_bit(__E1000_RESETTING, &adapter->flags);
254 return 0; 248 return 0;
255} 249}
@@ -279,11 +273,11 @@ static void e1000_get_pauseparam(struct net_device *netdev,
279 pause->autoneg = 273 pause->autoneg =
280 (adapter->fc_autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE); 274 (adapter->fc_autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE);
281 275
282 if (hw->fc == E1000_FC_RX_PAUSE) 276 if (hw->fc == E1000_FC_RX_PAUSE) {
283 pause->rx_pause = 1; 277 pause->rx_pause = 1;
284 else if (hw->fc == E1000_FC_TX_PAUSE) 278 } else if (hw->fc == E1000_FC_TX_PAUSE) {
285 pause->tx_pause = 1; 279 pause->tx_pause = 1;
286 else if (hw->fc == E1000_FC_FULL) { 280 } else if (hw->fc == E1000_FC_FULL) {
287 pause->rx_pause = 1; 281 pause->rx_pause = 1;
288 pause->tx_pause = 1; 282 pause->tx_pause = 1;
289 } 283 }
@@ -316,8 +310,9 @@ static int e1000_set_pauseparam(struct net_device *netdev,
316 if (netif_running(adapter->netdev)) { 310 if (netif_running(adapter->netdev)) {
317 e1000_down(adapter); 311 e1000_down(adapter);
318 e1000_up(adapter); 312 e1000_up(adapter);
319 } else 313 } else {
320 e1000_reset(adapter); 314 e1000_reset(adapter);
315 }
321 } else 316 } else
322 retval = ((hw->media_type == e1000_media_type_fiber) ? 317 retval = ((hw->media_type == e1000_media_type_fiber) ?
323 e1000_setup_link(hw) : e1000_force_mac_fc(hw)); 318 e1000_setup_link(hw) : e1000_force_mac_fc(hw));
@@ -329,12 +324,14 @@ static int e1000_set_pauseparam(struct net_device *netdev,
329static u32 e1000_get_msglevel(struct net_device *netdev) 324static u32 e1000_get_msglevel(struct net_device *netdev)
330{ 325{
331 struct e1000_adapter *adapter = netdev_priv(netdev); 326 struct e1000_adapter *adapter = netdev_priv(netdev);
327
332 return adapter->msg_enable; 328 return adapter->msg_enable;
333} 329}
334 330
335static void e1000_set_msglevel(struct net_device *netdev, u32 data) 331static void e1000_set_msglevel(struct net_device *netdev, u32 data)
336{ 332{
337 struct e1000_adapter *adapter = netdev_priv(netdev); 333 struct e1000_adapter *adapter = netdev_priv(netdev);
334
338 adapter->msg_enable = data; 335 adapter->msg_enable = data;
339} 336}
340 337
@@ -526,7 +523,7 @@ static int e1000_set_eeprom(struct net_device *netdev,
526 * only the first byte of the word is being modified 523 * only the first byte of the word is being modified
527 */ 524 */
528 ret_val = e1000_read_eeprom(hw, last_word, 1, 525 ret_val = e1000_read_eeprom(hw, last_word, 1,
529 &eeprom_buff[last_word - first_word]); 526 &eeprom_buff[last_word - first_word]);
530 } 527 }
531 528
532 /* Device's eeprom is always little-endian, word addressable */ 529 /* Device's eeprom is always little-endian, word addressable */
@@ -618,13 +615,12 @@ static int e1000_set_ringparam(struct net_device *netdev,
618 adapter->tx_ring = txdr; 615 adapter->tx_ring = txdr;
619 adapter->rx_ring = rxdr; 616 adapter->rx_ring = rxdr;
620 617
621 rxdr->count = max(ring->rx_pending,(u32)E1000_MIN_RXD); 618 rxdr->count = max(ring->rx_pending, (u32)E1000_MIN_RXD);
622 rxdr->count = min(rxdr->count,(u32)(mac_type < e1000_82544 ? 619 rxdr->count = min(rxdr->count, (u32)(mac_type < e1000_82544 ?
623 E1000_MAX_RXD : E1000_MAX_82544_RXD)); 620 E1000_MAX_RXD : E1000_MAX_82544_RXD));
624 rxdr->count = ALIGN(rxdr->count, REQ_RX_DESCRIPTOR_MULTIPLE); 621 rxdr->count = ALIGN(rxdr->count, REQ_RX_DESCRIPTOR_MULTIPLE);
625 622 txdr->count = max(ring->tx_pending, (u32)E1000_MIN_TXD);
626 txdr->count = max(ring->tx_pending,(u32)E1000_MIN_TXD); 623 txdr->count = min(txdr->count, (u32)(mac_type < e1000_82544 ?
627 txdr->count = min(txdr->count,(u32)(mac_type < e1000_82544 ?
628 E1000_MAX_TXD : E1000_MAX_82544_TXD)); 624 E1000_MAX_TXD : E1000_MAX_82544_TXD));
629 txdr->count = ALIGN(txdr->count, REQ_TX_DESCRIPTOR_MULTIPLE); 625 txdr->count = ALIGN(txdr->count, REQ_TX_DESCRIPTOR_MULTIPLE);
630 626
@@ -680,8 +676,9 @@ static bool reg_pattern_test(struct e1000_adapter *adapter, u64 *data, int reg,
680 u32 mask, u32 write) 676 u32 mask, u32 write)
681{ 677{
682 struct e1000_hw *hw = &adapter->hw; 678 struct e1000_hw *hw = &adapter->hw;
683 static const u32 test[] = 679 static const u32 test[] = {
684 {0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF}; 680 0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF
681 };
685 u8 __iomem *address = hw->hw_addr + reg; 682 u8 __iomem *address = hw->hw_addr + reg;
686 u32 read; 683 u32 read;
687 int i; 684 int i;
@@ -793,8 +790,8 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data)
793 REG_PATTERN_TEST(TIDV, 0x0000FFFF, 0x0000FFFF); 790 REG_PATTERN_TEST(TIDV, 0x0000FFFF, 0x0000FFFF);
794 value = E1000_RAR_ENTRIES; 791 value = E1000_RAR_ENTRIES;
795 for (i = 0; i < value; i++) { 792 for (i = 0; i < value; i++) {
796 REG_PATTERN_TEST(RA + (((i << 1) + 1) << 2), 0x8003FFFF, 793 REG_PATTERN_TEST(RA + (((i << 1) + 1) << 2),
797 0xFFFFFFFF); 794 0x8003FFFF, 0xFFFFFFFF);
798 } 795 }
799 } else { 796 } else {
800 REG_SET_AND_CHECK(RCTL, 0xFFFFFFFF, 0x01FFFFFF); 797 REG_SET_AND_CHECK(RCTL, 0xFFFFFFFF, 0x01FFFFFF);
@@ -877,7 +874,6 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
877 874
878 /* Test each interrupt */ 875 /* Test each interrupt */
879 for (; i < 10; i++) { 876 for (; i < 10; i++) {
880
881 /* Interrupt to test */ 877 /* Interrupt to test */
882 mask = 1 << i; 878 mask = 1 << i;
883 879
@@ -1149,8 +1145,7 @@ static void e1000_phy_reset_clk_and_crs(struct e1000_adapter *adapter)
1149 */ 1145 */
1150 e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_reg); 1146 e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_reg);
1151 phy_reg |= M88E1000_EPSCR_TX_CLK_25; 1147 phy_reg |= M88E1000_EPSCR_TX_CLK_25;
1152 e1000_write_phy_reg(hw, 1148 e1000_write_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, phy_reg);
1153 M88E1000_EXT_PHY_SPEC_CTRL, phy_reg);
1154 1149
1155 /* In addition, because of the s/w reset above, we need to enable 1150 /* In addition, because of the s/w reset above, we need to enable
1156 * CRS on TX. This must be set for both full and half duplex 1151 * CRS on TX. This must be set for both full and half duplex
@@ -1158,8 +1153,7 @@ static void e1000_phy_reset_clk_and_crs(struct e1000_adapter *adapter)
1158 */ 1153 */
1159 e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_reg); 1154 e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_reg);
1160 phy_reg |= M88E1000_PSCR_ASSERT_CRS_ON_TX; 1155 phy_reg |= M88E1000_PSCR_ASSERT_CRS_ON_TX;
1161 e1000_write_phy_reg(hw, 1156 e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_reg);
1162 M88E1000_PHY_SPEC_CTRL, phy_reg);
1163} 1157}
1164 1158
1165static int e1000_nonintegrated_phy_loopback(struct e1000_adapter *adapter) 1159static int e1000_nonintegrated_phy_loopback(struct e1000_adapter *adapter)
@@ -1216,7 +1210,7 @@ static int e1000_nonintegrated_phy_loopback(struct e1000_adapter *adapter)
1216 /* Check Phy Configuration */ 1210 /* Check Phy Configuration */
1217 e1000_read_phy_reg(hw, PHY_CTRL, &phy_reg); 1211 e1000_read_phy_reg(hw, PHY_CTRL, &phy_reg);
1218 if (phy_reg != 0x4100) 1212 if (phy_reg != 0x4100)
1219 return 9; 1213 return 9;
1220 1214
1221 e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_reg); 1215 e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_reg);
1222 if (phy_reg != 0x0070) 1216 if (phy_reg != 0x0070)
@@ -1261,7 +1255,7 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
1261 E1000_CTRL_FD); /* Force Duplex to FULL */ 1255 E1000_CTRL_FD); /* Force Duplex to FULL */
1262 1256
1263 if (hw->media_type == e1000_media_type_copper && 1257 if (hw->media_type == e1000_media_type_copper &&
1264 hw->phy_type == e1000_phy_m88) 1258 hw->phy_type == e1000_phy_m88)
1265 ctrl_reg |= E1000_CTRL_ILOS; /* Invert Loss of Signal */ 1259 ctrl_reg |= E1000_CTRL_ILOS; /* Invert Loss of Signal */
1266 else { 1260 else {
1267 /* Set the ILOS bit on the fiber Nic is half 1261 /* Set the ILOS bit on the fiber Nic is half
@@ -1299,7 +1293,7 @@ static int e1000_set_phy_loopback(struct e1000_adapter *adapter)
1299 * attempt this 10 times. 1293 * attempt this 10 times.
1300 */ 1294 */
1301 while (e1000_nonintegrated_phy_loopback(adapter) && 1295 while (e1000_nonintegrated_phy_loopback(adapter) &&
1302 count++ < 10); 1296 count++ < 10);
1303 if (count < 11) 1297 if (count < 11)
1304 return 0; 1298 return 0;
1305 } 1299 }
@@ -1348,8 +1342,9 @@ static int e1000_setup_loopback_test(struct e1000_adapter *adapter)
1348 ew32(RCTL, rctl); 1342 ew32(RCTL, rctl);
1349 return 0; 1343 return 0;
1350 } 1344 }
1351 } else if (hw->media_type == e1000_media_type_copper) 1345 } else if (hw->media_type == e1000_media_type_copper) {
1352 return e1000_set_phy_loopback(adapter); 1346 return e1000_set_phy_loopback(adapter);
1347 }
1353 1348
1354 return 7; 1349 return 7;
1355} 1350}
@@ -1395,9 +1390,9 @@ static int e1000_check_lbtest_frame(struct sk_buff *skb,
1395 unsigned int frame_size) 1390 unsigned int frame_size)
1396{ 1391{
1397 frame_size &= ~1; 1392 frame_size &= ~1;
1398 if (*(skb->data + 3) == 0xFF) { 1393 if (skb->data[3] == 0xFF) {
1399 if ((*(skb->data + frame_size / 2 + 10) == 0xBE) && 1394 if (skb->data[frame_size / 2 + 10] == 0xBE &&
1400 (*(skb->data + frame_size / 2 + 12) == 0xAF)) { 1395 skb->data[frame_size / 2 + 12] == 0xAF) {
1401 return 0; 1396 return 0;
1402 } 1397 }
1403 } 1398 }
@@ -1410,7 +1405,7 @@ static int e1000_run_loopback_test(struct e1000_adapter *adapter)
1410 struct e1000_tx_ring *txdr = &adapter->test_tx_ring; 1405 struct e1000_tx_ring *txdr = &adapter->test_tx_ring;
1411 struct e1000_rx_ring *rxdr = &adapter->test_rx_ring; 1406 struct e1000_rx_ring *rxdr = &adapter->test_rx_ring;
1412 struct pci_dev *pdev = adapter->pdev; 1407 struct pci_dev *pdev = adapter->pdev;
1413 int i, j, k, l, lc, good_cnt, ret_val=0; 1408 int i, j, k, l, lc, good_cnt, ret_val = 0;
1414 unsigned long time; 1409 unsigned long time;
1415 1410
1416 ew32(RDT, rxdr->count - 1); 1411 ew32(RDT, rxdr->count - 1);
@@ -1429,12 +1424,13 @@ static int e1000_run_loopback_test(struct e1000_adapter *adapter)
1429 for (j = 0; j <= lc; j++) { /* loop count loop */ 1424 for (j = 0; j <= lc; j++) { /* loop count loop */
1430 for (i = 0; i < 64; i++) { /* send the packets */ 1425 for (i = 0; i < 64; i++) { /* send the packets */
1431 e1000_create_lbtest_frame(txdr->buffer_info[i].skb, 1426 e1000_create_lbtest_frame(txdr->buffer_info[i].skb,
1432 1024); 1427 1024);
1433 dma_sync_single_for_device(&pdev->dev, 1428 dma_sync_single_for_device(&pdev->dev,
1434 txdr->buffer_info[k].dma, 1429 txdr->buffer_info[k].dma,
1435 txdr->buffer_info[k].length, 1430 txdr->buffer_info[k].length,
1436 DMA_TO_DEVICE); 1431 DMA_TO_DEVICE);
1437 if (unlikely(++k == txdr->count)) k = 0; 1432 if (unlikely(++k == txdr->count))
1433 k = 0;
1438 } 1434 }
1439 ew32(TDT, k); 1435 ew32(TDT, k);
1440 E1000_WRITE_FLUSH(); 1436 E1000_WRITE_FLUSH();
@@ -1452,7 +1448,8 @@ static int e1000_run_loopback_test(struct e1000_adapter *adapter)
1452 1024); 1448 1024);
1453 if (!ret_val) 1449 if (!ret_val)
1454 good_cnt++; 1450 good_cnt++;
1455 if (unlikely(++l == rxdr->count)) l = 0; 1451 if (unlikely(++l == rxdr->count))
1452 l = 0;
1456 /* time + 20 msecs (200 msecs on 2.4) is more than 1453 /* time + 20 msecs (200 msecs on 2.4) is more than
1457 * enough time to complete the receives, if it's 1454 * enough time to complete the receives, if it's
1458 * exceeded, break and error off 1455 * exceeded, break and error off
@@ -1494,6 +1491,7 @@ static int e1000_link_test(struct e1000_adapter *adapter, u64 *data)
1494 *data = 0; 1491 *data = 0;
1495 if (hw->media_type == e1000_media_type_internal_serdes) { 1492 if (hw->media_type == e1000_media_type_internal_serdes) {
1496 int i = 0; 1493 int i = 0;
1494
1497 hw->serdes_has_link = false; 1495 hw->serdes_has_link = false;
1498 1496
1499 /* On some blade server designs, link establishment 1497 /* On some blade server designs, link establishment
@@ -1512,9 +1510,8 @@ static int e1000_link_test(struct e1000_adapter *adapter, u64 *data)
1512 if (hw->autoneg) /* if auto_neg is set wait for it */ 1510 if (hw->autoneg) /* if auto_neg is set wait for it */
1513 msleep(4000); 1511 msleep(4000);
1514 1512
1515 if (!(er32(STATUS) & E1000_STATUS_LU)) { 1513 if (!(er32(STATUS) & E1000_STATUS_LU))
1516 *data = 1; 1514 *data = 1;
1517 }
1518 } 1515 }
1519 return *data; 1516 return *data;
1520} 1517}
@@ -1665,8 +1662,7 @@ static void e1000_get_wol(struct net_device *netdev,
1665 struct e1000_adapter *adapter = netdev_priv(netdev); 1662 struct e1000_adapter *adapter = netdev_priv(netdev);
1666 struct e1000_hw *hw = &adapter->hw; 1663 struct e1000_hw *hw = &adapter->hw;
1667 1664
1668 wol->supported = WAKE_UCAST | WAKE_MCAST | 1665 wol->supported = WAKE_UCAST | WAKE_MCAST | WAKE_BCAST | WAKE_MAGIC;
1669 WAKE_BCAST | WAKE_MAGIC;
1670 wol->wolopts = 0; 1666 wol->wolopts = 0;
1671 1667
1672 /* this function will set ->supported = 0 and return 1 if wol is not 1668 /* this function will set ->supported = 0 and return 1 if wol is not
@@ -1819,6 +1815,7 @@ static int e1000_set_coalesce(struct net_device *netdev,
1819static int e1000_nway_reset(struct net_device *netdev) 1815static int e1000_nway_reset(struct net_device *netdev)
1820{ 1816{
1821 struct e1000_adapter *adapter = netdev_priv(netdev); 1817 struct e1000_adapter *adapter = netdev_priv(netdev);
1818
1822 if (netif_running(netdev)) 1819 if (netif_running(netdev))
1823 e1000_reinit_locked(adapter); 1820 e1000_reinit_locked(adapter);
1824 return 0; 1821 return 0;
@@ -1830,22 +1827,29 @@ static void e1000_get_ethtool_stats(struct net_device *netdev,
1830 struct e1000_adapter *adapter = netdev_priv(netdev); 1827 struct e1000_adapter *adapter = netdev_priv(netdev);
1831 int i; 1828 int i;
1832 char *p = NULL; 1829 char *p = NULL;
1830 const struct e1000_stats *stat = e1000_gstrings_stats;
1833 1831
1834 e1000_update_stats(adapter); 1832 e1000_update_stats(adapter);
1835 for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { 1833 for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) {
1836 switch (e1000_gstrings_stats[i].type) { 1834 switch (stat->type) {
1837 case NETDEV_STATS: 1835 case NETDEV_STATS:
1838 p = (char *) netdev + 1836 p = (char *)netdev + stat->stat_offset;
1839 e1000_gstrings_stats[i].stat_offset;
1840 break; 1837 break;
1841 case E1000_STATS: 1838 case E1000_STATS:
1842 p = (char *) adapter + 1839 p = (char *)adapter + stat->stat_offset;
1843 e1000_gstrings_stats[i].stat_offset; 1840 break;
1841 default:
1842 WARN_ONCE(1, "Invalid E1000 stat type: %u index %d\n",
1843 stat->type, i);
1844 break; 1844 break;
1845 } 1845 }
1846 1846
1847 data[i] = (e1000_gstrings_stats[i].sizeof_stat == 1847 if (stat->sizeof_stat == sizeof(u64))
1848 sizeof(u64)) ? *(u64 *)p : *(u32 *)p; 1848 data[i] = *(u64 *)p;
1849 else
1850 data[i] = *(u32 *)p;
1851
1852 stat++;
1849 } 1853 }
1850/* BUG_ON(i != E1000_STATS_LEN); */ 1854/* BUG_ON(i != E1000_STATS_LEN); */
1851} 1855}
@@ -1858,8 +1862,7 @@ static void e1000_get_strings(struct net_device *netdev, u32 stringset,
1858 1862
1859 switch (stringset) { 1863 switch (stringset) {
1860 case ETH_SS_TEST: 1864 case ETH_SS_TEST:
1861 memcpy(data, *e1000_gstrings_test, 1865 memcpy(data, e1000_gstrings_test, sizeof(e1000_gstrings_test));
1862 sizeof(e1000_gstrings_test));
1863 break; 1866 break;
1864 case ETH_SS_STATS: 1867 case ETH_SS_STATS:
1865 for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { 1868 for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) {