aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000e/ethtool.c
diff options
context:
space:
mode:
authorBruce Allan <bruce.w.allan@intel.com>2008-03-28 12:15:03 -0400
committerJeff Garzik <jeff@garzik.org>2008-03-28 22:14:56 -0400
commitad68076e07fa01bd0c98278a959d0fd2bb26f1ac (patch)
treef0b664ecdb38478f9b995aff10dcb39a09221fb6 /drivers/net/e1000e/ethtool.c
parent652f093fdf14c7ca1e13c052da429ae385e4dc21 (diff)
e1000e: reformat comment blocks, cosmetic changes only
Adjusting the comment blocks here to be code-style compliant. no code changes. Changed some copyright dates to 2008. Indentation fixes. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/e1000e/ethtool.c')
-rw-r--r--drivers/net/e1000e/ethtool.c97
1 files changed, 62 insertions, 35 deletions
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index f77a7427d3a0..3b94a87b5272 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel PRO/1000 Linux driver 3 Intel PRO/1000 Linux driver
4 Copyright(c) 1999 - 2007 Intel Corporation. 4 Copyright(c) 1999 - 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,
@@ -102,7 +102,7 @@ static const char e1000_gstrings_test[][ETH_GSTRING_LEN] = {
102 "Interrupt test (offline)", "Loopback test (offline)", 102 "Interrupt test (offline)", "Loopback test (offline)",
103 "Link test (on/offline)" 103 "Link test (on/offline)"
104}; 104};
105#define E1000_TEST_LEN ARRAY_SIZE(e1000_gstrings_test) 105#define E1000_TEST_LEN ARRAY_SIZE(e1000_gstrings_test)
106 106
107static int e1000_get_settings(struct net_device *netdev, 107static int e1000_get_settings(struct net_device *netdev,
108 struct ethtool_cmd *ecmd) 108 struct ethtool_cmd *ecmd)
@@ -226,8 +226,10 @@ static int e1000_set_settings(struct net_device *netdev,
226 struct e1000_adapter *adapter = netdev_priv(netdev); 226 struct e1000_adapter *adapter = netdev_priv(netdev);
227 struct e1000_hw *hw = &adapter->hw; 227 struct e1000_hw *hw = &adapter->hw;
228 228
229 /* When SoL/IDER sessions are active, autoneg/speed/duplex 229 /*
230 * cannot be changed */ 230 * When SoL/IDER sessions are active, autoneg/speed/duplex
231 * cannot be changed
232 */
231 if (e1000_check_reset_block(hw)) { 233 if (e1000_check_reset_block(hw)) {
232 ndev_err(netdev, "Cannot change link " 234 ndev_err(netdev, "Cannot change link "
233 "characteristics when SoL/IDER is active.\n"); 235 "characteristics when SoL/IDER is active.\n");
@@ -558,8 +560,10 @@ static int e1000_set_eeprom(struct net_device *netdev,
558 ret_val = e1000_write_nvm(hw, first_word, 560 ret_val = e1000_write_nvm(hw, first_word,
559 last_word - first_word + 1, eeprom_buff); 561 last_word - first_word + 1, eeprom_buff);
560 562
561 /* Update the checksum over the first part of the EEPROM if needed 563 /*
562 * and flush shadow RAM for 82573 controllers */ 564 * Update the checksum over the first part of the EEPROM if needed
565 * and flush shadow RAM for 82573 controllers
566 */
563 if ((ret_val == 0) && ((first_word <= NVM_CHECKSUM_REG) || 567 if ((ret_val == 0) && ((first_word <= NVM_CHECKSUM_REG) ||
564 (hw->mac.type == e1000_82573))) 568 (hw->mac.type == e1000_82573)))
565 e1000e_update_nvm_checksum(hw); 569 e1000e_update_nvm_checksum(hw);
@@ -578,8 +582,10 @@ static void e1000_get_drvinfo(struct net_device *netdev,
578 strncpy(drvinfo->driver, e1000e_driver_name, 32); 582 strncpy(drvinfo->driver, e1000e_driver_name, 32);
579 strncpy(drvinfo->version, e1000e_driver_version, 32); 583 strncpy(drvinfo->version, e1000e_driver_version, 32);
580 584
581 /* EEPROM image version # is reported as firmware version # for 585 /*
582 * PCI-E controllers */ 586 * EEPROM image version # is reported as firmware version # for
587 * PCI-E controllers
588 */
583 e1000_read_nvm(&adapter->hw, 5, 1, &eeprom_data); 589 e1000_read_nvm(&adapter->hw, 5, 1, &eeprom_data);
584 sprintf(firmware_version, "%d.%d-%d", 590 sprintf(firmware_version, "%d.%d-%d",
585 (eeprom_data & 0xF000) >> 12, 591 (eeprom_data & 0xF000) >> 12,
@@ -658,8 +664,10 @@ static int e1000_set_ringparam(struct net_device *netdev,
658 if (err) 664 if (err)
659 goto err_setup_tx; 665 goto err_setup_tx;
660 666
661 /* save the new, restore the old in order to free it, 667 /*
662 * then restore the new back again */ 668 * restore the old in order to free it,
669 * then add in the new
670 */
663 adapter->rx_ring = rx_old; 671 adapter->rx_ring = rx_old;
664 adapter->tx_ring = tx_old; 672 adapter->tx_ring = tx_old;
665 e1000e_free_rx_resources(adapter); 673 e1000e_free_rx_resources(adapter);
@@ -758,7 +766,8 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data)
758 u32 i; 766 u32 i;
759 u32 toggle; 767 u32 toggle;
760 768
761 /* The status register is Read Only, so a write should fail. 769 /*
770 * The status register is Read Only, so a write should fail.
762 * Some bits that get toggled are ignored. 771 * Some bits that get toggled are ignored.
763 */ 772 */
764 switch (mac->type) { 773 switch (mac->type) {
@@ -908,7 +917,8 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
908 mask = 1 << i; 917 mask = 1 << i;
909 918
910 if (!shared_int) { 919 if (!shared_int) {
911 /* Disable the interrupt to be reported in 920 /*
921 * Disable the interrupt to be reported in
912 * the cause register and then force the same 922 * the cause register and then force the same
913 * interrupt and see if one gets posted. If 923 * interrupt and see if one gets posted. If
914 * an interrupt was posted to the bus, the 924 * an interrupt was posted to the bus, the
@@ -925,7 +935,8 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
925 } 935 }
926 } 936 }
927 937
928 /* Enable the interrupt to be reported in 938 /*
939 * Enable the interrupt to be reported in
929 * the cause register and then force the same 940 * the cause register and then force the same
930 * interrupt and see if one gets posted. If 941 * interrupt and see if one gets posted. If
931 * an interrupt was not posted to the bus, the 942 * an interrupt was not posted to the bus, the
@@ -942,7 +953,8 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
942 } 953 }
943 954
944 if (!shared_int) { 955 if (!shared_int) {
945 /* Disable the other interrupts to be reported in 956 /*
957 * Disable the other interrupts to be reported in
946 * the cause register and then force the other 958 * the cause register and then force the other
947 * interrupts and see if any get posted. If 959 * interrupts and see if any get posted. If
948 * an interrupt was posted to the bus, the 960 * an interrupt was posted to the bus, the
@@ -1216,8 +1228,10 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
1216 adapter->hw.phy.type == e1000_phy_m88) { 1228 adapter->hw.phy.type == e1000_phy_m88) {
1217 ctrl_reg |= E1000_CTRL_ILOS; /* Invert Loss of Signal */ 1229 ctrl_reg |= E1000_CTRL_ILOS; /* Invert Loss of Signal */
1218 } else { 1230 } else {
1219 /* Set the ILOS bit on the fiber Nic if half duplex link is 1231 /*
1220 * detected. */ 1232 * Set the ILOS bit on the fiber Nic if half duplex link is
1233 * detected.
1234 */
1221 stat_reg = er32(STATUS); 1235 stat_reg = er32(STATUS);
1222 if ((stat_reg & E1000_STATUS_FD) == 0) 1236 if ((stat_reg & E1000_STATUS_FD) == 0)
1223 ctrl_reg |= (E1000_CTRL_ILOS | E1000_CTRL_SLU); 1237 ctrl_reg |= (E1000_CTRL_ILOS | E1000_CTRL_SLU);
@@ -1225,7 +1239,8 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
1225 1239
1226 ew32(CTRL, ctrl_reg); 1240 ew32(CTRL, ctrl_reg);
1227 1241
1228 /* Disable the receiver on the PHY so when a cable is plugged in, the 1242 /*
1243 * Disable the receiver on the PHY so when a cable is plugged in, the
1229 * PHY does not begin to autoneg when a cable is reconnected to the NIC. 1244 * PHY does not begin to autoneg when a cable is reconnected to the NIC.
1230 */ 1245 */
1231 if (adapter->hw.phy.type == e1000_phy_m88) 1246 if (adapter->hw.phy.type == e1000_phy_m88)
@@ -1244,8 +1259,10 @@ static int e1000_set_82571_fiber_loopback(struct e1000_adapter *adapter)
1244 1259
1245 /* special requirements for 82571/82572 fiber adapters */ 1260 /* special requirements for 82571/82572 fiber adapters */
1246 1261
1247 /* jump through hoops to make sure link is up because serdes 1262 /*
1248 * link is hardwired up */ 1263 * jump through hoops to make sure link is up because serdes
1264 * link is hardwired up
1265 */
1249 ctrl |= E1000_CTRL_SLU; 1266 ctrl |= E1000_CTRL_SLU;
1250 ew32(CTRL, ctrl); 1267 ew32(CTRL, ctrl);
1251 1268
@@ -1263,8 +1280,10 @@ static int e1000_set_82571_fiber_loopback(struct e1000_adapter *adapter)
1263 ew32(CTRL, ctrl); 1280 ew32(CTRL, ctrl);
1264 } 1281 }
1265 1282
1266 /* special write to serdes control register to enable SerDes analog 1283 /*
1267 * loopback */ 1284 * special write to serdes control register to enable SerDes analog
1285 * loopback
1286 */
1268#define E1000_SERDES_LB_ON 0x410 1287#define E1000_SERDES_LB_ON 0x410
1269 ew32(SCTL, E1000_SERDES_LB_ON); 1288 ew32(SCTL, E1000_SERDES_LB_ON);
1270 msleep(10); 1289 msleep(10);
@@ -1279,8 +1298,10 @@ static int e1000_set_es2lan_mac_loopback(struct e1000_adapter *adapter)
1279 u32 ctrlext = er32(CTRL_EXT); 1298 u32 ctrlext = er32(CTRL_EXT);
1280 u32 ctrl = er32(CTRL); 1299 u32 ctrl = er32(CTRL);
1281 1300
1282 /* save CTRL_EXT to restore later, reuse an empty variable (unused 1301 /*
1283 on mac_type 80003es2lan) */ 1302 * save CTRL_EXT to restore later, reuse an empty variable (unused
1303 * on mac_type 80003es2lan)
1304 */
1284 adapter->tx_fifo_head = ctrlext; 1305 adapter->tx_fifo_head = ctrlext;
1285 1306
1286 /* clear the serdes mode bits, putting the device into mac loopback */ 1307 /* clear the serdes mode bits, putting the device into mac loopback */
@@ -1350,8 +1371,7 @@ static void e1000_loopback_cleanup(struct e1000_adapter *adapter)
1350 if (hw->media_type == e1000_media_type_fiber || 1371 if (hw->media_type == e1000_media_type_fiber ||
1351 hw->media_type == e1000_media_type_internal_serdes) { 1372 hw->media_type == e1000_media_type_internal_serdes) {
1352 /* restore CTRL_EXT, stealing space from tx_fifo_head */ 1373 /* restore CTRL_EXT, stealing space from tx_fifo_head */
1353 ew32(CTRL_EXT, 1374 ew32(CTRL_EXT, adapter->tx_fifo_head);
1354 adapter->tx_fifo_head);
1355 adapter->tx_fifo_head = 0; 1375 adapter->tx_fifo_head = 0;
1356 } 1376 }
1357 /* fall through */ 1377 /* fall through */
@@ -1414,7 +1434,8 @@ static int e1000_run_loopback_test(struct e1000_adapter *adapter)
1414 1434
1415 ew32(RDT, rx_ring->count - 1); 1435 ew32(RDT, rx_ring->count - 1);
1416 1436
1417 /* Calculate the loop count based on the largest descriptor ring 1437 /*
1438 * Calculate the loop count based on the largest descriptor ring
1418 * The idea is to wrap the largest ring a number of times using 64 1439 * The idea is to wrap the largest ring a number of times using 64
1419 * send/receive pairs during each loop 1440 * send/receive pairs during each loop
1420 */ 1441 */
@@ -1454,7 +1475,8 @@ static int e1000_run_loopback_test(struct e1000_adapter *adapter)
1454 l++; 1475 l++;
1455 if (l == rx_ring->count) 1476 if (l == rx_ring->count)
1456 l = 0; 1477 l = 0;
1457 /* time + 20 msecs (200 msecs on 2.4) is more than 1478 /*
1479 * time + 20 msecs (200 msecs on 2.4) is more than
1458 * enough time to complete the receives, if it's 1480 * enough time to complete the receives, if it's
1459 * exceeded, break and error off 1481 * exceeded, break and error off
1460 */ 1482 */
@@ -1473,8 +1495,10 @@ static int e1000_run_loopback_test(struct e1000_adapter *adapter)
1473 1495
1474static int e1000_loopback_test(struct e1000_adapter *adapter, u64 *data) 1496static int e1000_loopback_test(struct e1000_adapter *adapter, u64 *data)
1475{ 1497{
1476 /* PHY loopback cannot be performed if SoL/IDER 1498 /*
1477 * sessions are active */ 1499 * PHY loopback cannot be performed if SoL/IDER
1500 * sessions are active
1501 */
1478 if (e1000_check_reset_block(&adapter->hw)) { 1502 if (e1000_check_reset_block(&adapter->hw)) {
1479 ndev_err(adapter->netdev, "Cannot do PHY loopback test " 1503 ndev_err(adapter->netdev, "Cannot do PHY loopback test "
1480 "when SoL/IDER is active.\n"); 1504 "when SoL/IDER is active.\n");
@@ -1508,8 +1532,10 @@ static int e1000_link_test(struct e1000_adapter *adapter, u64 *data)
1508 int i = 0; 1532 int i = 0;
1509 hw->mac.serdes_has_link = 0; 1533 hw->mac.serdes_has_link = 0;
1510 1534
1511 /* On some blade server designs, link establishment 1535 /*
1512 * could take as long as 2-3 minutes */ 1536 * On some blade server designs, link establishment
1537 * could take as long as 2-3 minutes
1538 */
1513 do { 1539 do {
1514 hw->mac.ops.check_for_link(hw); 1540 hw->mac.ops.check_for_link(hw);
1515 if (hw->mac.serdes_has_link) 1541 if (hw->mac.serdes_has_link)
@@ -1562,8 +1588,10 @@ static void e1000_diag_test(struct net_device *netdev,
1562 1588
1563 ndev_info(netdev, "offline testing starting\n"); 1589 ndev_info(netdev, "offline testing starting\n");
1564 1590
1565 /* Link test performed before hardware reset so autoneg doesn't 1591 /*
1566 * interfere with test result */ 1592 * Link test performed before hardware reset so autoneg doesn't
1593 * interfere with test result
1594 */
1567 if (e1000_link_test(adapter, &data[4])) 1595 if (e1000_link_test(adapter, &data[4]))
1568 eth_test->flags |= ETH_TEST_FL_FAILED; 1596 eth_test->flags |= ETH_TEST_FL_FAILED;
1569 1597
@@ -1768,8 +1796,7 @@ static void e1000_get_strings(struct net_device *netdev, u32 stringset,
1768 1796
1769 switch (stringset) { 1797 switch (stringset) {
1770 case ETH_SS_TEST: 1798 case ETH_SS_TEST:
1771 memcpy(data, *e1000_gstrings_test, 1799 memcpy(data, *e1000_gstrings_test, sizeof(e1000_gstrings_test));
1772 sizeof(e1000_gstrings_test));
1773 break; 1800 break;
1774 case ETH_SS_STATS: 1801 case ETH_SS_STATS:
1775 for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { 1802 for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) {