aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/e1000e/82571.c13
-rw-r--r--drivers/net/e1000e/defines.h1
-rw-r--r--drivers/net/e1000e/e1000.h2
-rw-r--r--drivers/net/e1000e/es2lan.c192
-rw-r--r--drivers/net/e1000e/ethtool.c82
-rw-r--r--drivers/net/e1000e/hw.h7
-rw-r--r--drivers/net/e1000e/ich8lan.c151
-rw-r--r--drivers/net/e1000e/lib.c80
-rw-r--r--drivers/net/e1000e/netdev.c59
-rw-r--r--drivers/net/e1000e/phy.c12
-rw-r--r--drivers/net/wan/Kconfig2
-rw-r--r--drivers/net/wan/hdlc_fr.c10
-rw-r--r--drivers/net/wan/pc300_drv.c17
-rw-r--r--include/linux/hdlc.h2
-rw-r--r--include/net/inet_hashtables.h8
-rw-r--r--net/ipv4/inet_diag.c10
-rw-r--r--net/sched/sch_drr.c1
17 files changed, 446 insertions, 203 deletions
diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c
index 3027ad53fa65..cf43ee743b3c 100644
--- a/drivers/net/e1000e/82571.c
+++ b/drivers/net/e1000e/82571.c
@@ -28,6 +28,7 @@
28 28
29/* 29/*
30 * 82571EB Gigabit Ethernet Controller 30 * 82571EB Gigabit Ethernet Controller
31 * 82571EB Gigabit Ethernet Controller (Copper)
31 * 82571EB Gigabit Ethernet Controller (Fiber) 32 * 82571EB Gigabit Ethernet Controller (Fiber)
32 * 82571EB Dual Port Gigabit Mezzanine Adapter 33 * 82571EB Dual Port Gigabit Mezzanine Adapter
33 * 82571EB Quad Port Gigabit Mezzanine Adapter 34 * 82571EB Quad Port Gigabit Mezzanine Adapter
@@ -331,8 +332,9 @@ static s32 e1000_get_variants_82571(struct e1000_adapter *adapter)
331 332
332 case e1000_82573: 333 case e1000_82573:
333 if (pdev->device == E1000_DEV_ID_82573L) { 334 if (pdev->device == E1000_DEV_ID_82573L) {
334 e1000_read_nvm(&adapter->hw, NVM_INIT_3GIO_3, 1, 335 if (e1000_read_nvm(&adapter->hw, NVM_INIT_3GIO_3, 1,
335 &eeprom_data); 336 &eeprom_data) < 0)
337 break;
336 if (eeprom_data & NVM_WORD1A_ASPM_MASK) 338 if (eeprom_data & NVM_WORD1A_ASPM_MASK)
337 adapter->flags &= ~FLAG_HAS_JUMBO_FRAMES; 339 adapter->flags &= ~FLAG_HAS_JUMBO_FRAMES;
338 } 340 }
@@ -1117,8 +1119,8 @@ static s32 e1000_setup_link_82571(struct e1000_hw *hw)
1117 * set it to full. 1119 * set it to full.
1118 */ 1120 */
1119 if ((hw->mac.type == e1000_82573 || hw->mac.type == e1000_82574) && 1121 if ((hw->mac.type == e1000_82573 || hw->mac.type == e1000_82574) &&
1120 hw->fc.type == e1000_fc_default) 1122 hw->fc.requested_mode == e1000_fc_default)
1121 hw->fc.type = e1000_fc_full; 1123 hw->fc.requested_mode = e1000_fc_full;
1122 1124
1123 return e1000e_setup_link(hw); 1125 return e1000e_setup_link(hw);
1124} 1126}
@@ -1393,6 +1395,7 @@ static struct e1000_phy_operations e82_phy_ops_igp = {
1393 .set_d0_lplu_state = e1000_set_d0_lplu_state_82571, 1395 .set_d0_lplu_state = e1000_set_d0_lplu_state_82571,
1394 .set_d3_lplu_state = e1000e_set_d3_lplu_state, 1396 .set_d3_lplu_state = e1000e_set_d3_lplu_state,
1395 .write_phy_reg = e1000e_write_phy_reg_igp, 1397 .write_phy_reg = e1000e_write_phy_reg_igp,
1398 .cfg_on_link_up = NULL,
1396}; 1399};
1397 1400
1398static struct e1000_phy_operations e82_phy_ops_m88 = { 1401static struct e1000_phy_operations e82_phy_ops_m88 = {
@@ -1409,6 +1412,7 @@ static struct e1000_phy_operations e82_phy_ops_m88 = {
1409 .set_d0_lplu_state = e1000_set_d0_lplu_state_82571, 1412 .set_d0_lplu_state = e1000_set_d0_lplu_state_82571,
1410 .set_d3_lplu_state = e1000e_set_d3_lplu_state, 1413 .set_d3_lplu_state = e1000e_set_d3_lplu_state,
1411 .write_phy_reg = e1000e_write_phy_reg_m88, 1414 .write_phy_reg = e1000e_write_phy_reg_m88,
1415 .cfg_on_link_up = NULL,
1412}; 1416};
1413 1417
1414static struct e1000_phy_operations e82_phy_ops_bm = { 1418static struct e1000_phy_operations e82_phy_ops_bm = {
@@ -1425,6 +1429,7 @@ static struct e1000_phy_operations e82_phy_ops_bm = {
1425 .set_d0_lplu_state = e1000_set_d0_lplu_state_82571, 1429 .set_d0_lplu_state = e1000_set_d0_lplu_state_82571,
1426 .set_d3_lplu_state = e1000e_set_d3_lplu_state, 1430 .set_d3_lplu_state = e1000e_set_d3_lplu_state,
1427 .write_phy_reg = e1000e_write_phy_reg_bm2, 1431 .write_phy_reg = e1000e_write_phy_reg_bm2,
1432 .cfg_on_link_up = NULL,
1428}; 1433};
1429 1434
1430static struct e1000_nvm_operations e82571_nvm_ops = { 1435static struct e1000_nvm_operations e82571_nvm_ops = {
diff --git a/drivers/net/e1000e/defines.h b/drivers/net/e1000e/defines.h
index 34a68fcab5a9..e6caf29d4252 100644
--- a/drivers/net/e1000e/defines.h
+++ b/drivers/net/e1000e/defines.h
@@ -572,6 +572,7 @@
572#define E1000_EECD_FLUPD 0x00080000 /* Update FLASH */ 572#define E1000_EECD_FLUPD 0x00080000 /* Update FLASH */
573#define E1000_EECD_AUPDEN 0x00100000 /* Enable Autonomous FLASH update */ 573#define E1000_EECD_AUPDEN 0x00100000 /* Enable Autonomous FLASH update */
574#define E1000_EECD_SEC1VAL 0x00400000 /* Sector One Valid */ 574#define E1000_EECD_SEC1VAL 0x00400000 /* Sector One Valid */
575#define E1000_EECD_SEC1VAL_VALID_MASK (E1000_EECD_AUTO_RD | E1000_EECD_PRES)
575 576
576#define E1000_NVM_RW_REG_DATA 16 /* Offset to data in NVM read/write registers */ 577#define E1000_NVM_RW_REG_DATA 16 /* Offset to data in NVM read/write registers */
577#define E1000_NVM_RW_REG_DONE 2 /* Offset to READ/WRITE done bit */ 578#define E1000_NVM_RW_REG_DONE 2 /* Offset to READ/WRITE done bit */
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h
index c55fd6fdb91c..37bcb190eef8 100644
--- a/drivers/net/e1000e/e1000.h
+++ b/drivers/net/e1000e/e1000.h
@@ -193,6 +193,7 @@ struct e1000_adapter {
193 u16 mng_vlan_id; 193 u16 mng_vlan_id;
194 u16 link_speed; 194 u16 link_speed;
195 u16 link_duplex; 195 u16 link_duplex;
196 u16 eeprom_vers;
196 197
197 spinlock_t tx_queue_lock; /* prevent concurrent tail updates */ 198 spinlock_t tx_queue_lock; /* prevent concurrent tail updates */
198 199
@@ -388,6 +389,7 @@ extern int e1000e_setup_tx_resources(struct e1000_adapter *adapter);
388extern void e1000e_free_rx_resources(struct e1000_adapter *adapter); 389extern void e1000e_free_rx_resources(struct e1000_adapter *adapter);
389extern void e1000e_free_tx_resources(struct e1000_adapter *adapter); 390extern void e1000e_free_tx_resources(struct e1000_adapter *adapter);
390extern void e1000e_update_stats(struct e1000_adapter *adapter); 391extern void e1000e_update_stats(struct e1000_adapter *adapter);
392extern bool e1000_has_link(struct e1000_adapter *adapter);
391extern void e1000e_set_interrupt_capability(struct e1000_adapter *adapter); 393extern void e1000e_set_interrupt_capability(struct e1000_adapter *adapter);
392extern void e1000e_reset_interrupt_capability(struct e1000_adapter *adapter); 394extern void e1000e_reset_interrupt_capability(struct e1000_adapter *adapter);
393 395
diff --git a/drivers/net/e1000e/es2lan.c b/drivers/net/e1000e/es2lan.c
index da9c09c248ed..db51114ebfde 100644
--- a/drivers/net/e1000e/es2lan.c
+++ b/drivers/net/e1000e/es2lan.c
@@ -112,6 +112,11 @@ static void e1000_initialize_hw_bits_80003es2lan(struct e1000_hw *hw);
112static void e1000_clear_hw_cntrs_80003es2lan(struct e1000_hw *hw); 112static void e1000_clear_hw_cntrs_80003es2lan(struct e1000_hw *hw);
113static s32 e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw); 113static s32 e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw);
114static s32 e1000_cfg_kmrn_10_100_80003es2lan(struct e1000_hw *hw, u16 duplex); 114static s32 e1000_cfg_kmrn_10_100_80003es2lan(struct e1000_hw *hw, u16 duplex);
115static s32 e1000_cfg_on_link_up_80003es2lan(struct e1000_hw *hw);
116static s32 e1000_read_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset,
117 u16 *data);
118static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset,
119 u16 data);
115 120
116/** 121/**
117 * e1000_init_phy_params_80003es2lan - Init ESB2 PHY func ptrs. 122 * e1000_init_phy_params_80003es2lan - Init ESB2 PHY func ptrs.
@@ -275,8 +280,6 @@ static s32 e1000_acquire_phy_80003es2lan(struct e1000_hw *hw)
275 u16 mask; 280 u16 mask;
276 281
277 mask = hw->bus.func ? E1000_SWFW_PHY1_SM : E1000_SWFW_PHY0_SM; 282 mask = hw->bus.func ? E1000_SWFW_PHY1_SM : E1000_SWFW_PHY0_SM;
278 mask |= E1000_SWFW_CSR_SM;
279
280 return e1000_acquire_swfw_sync_80003es2lan(hw, mask); 283 return e1000_acquire_swfw_sync_80003es2lan(hw, mask);
281} 284}
282 285
@@ -292,7 +295,36 @@ static void e1000_release_phy_80003es2lan(struct e1000_hw *hw)
292 u16 mask; 295 u16 mask;
293 296
294 mask = hw->bus.func ? E1000_SWFW_PHY1_SM : E1000_SWFW_PHY0_SM; 297 mask = hw->bus.func ? E1000_SWFW_PHY1_SM : E1000_SWFW_PHY0_SM;
295 mask |= E1000_SWFW_CSR_SM; 298 e1000_release_swfw_sync_80003es2lan(hw, mask);
299}
300
301/**
302 * e1000_acquire_mac_csr_80003es2lan - Acquire rights to access Kumeran register
303 * @hw: pointer to the HW structure
304 *
305 * Acquire the semaphore to access the Kumeran interface.
306 *
307 **/
308static s32 e1000_acquire_mac_csr_80003es2lan(struct e1000_hw *hw)
309{
310 u16 mask;
311
312 mask = E1000_SWFW_CSR_SM;
313
314 return e1000_acquire_swfw_sync_80003es2lan(hw, mask);
315}
316
317/**
318 * e1000_release_mac_csr_80003es2lan - Release rights to access Kumeran Register
319 * @hw: pointer to the HW structure
320 *
321 * Release the semaphore used to access the Kumeran interface
322 **/
323static void e1000_release_mac_csr_80003es2lan(struct e1000_hw *hw)
324{
325 u16 mask;
326
327 mask = E1000_SWFW_CSR_SM;
296 328
297 e1000_release_swfw_sync_80003es2lan(hw, mask); 329 e1000_release_swfw_sync_80003es2lan(hw, mask);
298} 330}
@@ -347,7 +379,7 @@ static s32 e1000_acquire_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask)
347 u32 swmask = mask; 379 u32 swmask = mask;
348 u32 fwmask = mask << 16; 380 u32 fwmask = mask << 16;
349 s32 i = 0; 381 s32 i = 0;
350 s32 timeout = 200; 382 s32 timeout = 50;
351 383
352 while (i < timeout) { 384 while (i < timeout) {
353 if (e1000e_get_hw_semaphore(hw)) 385 if (e1000e_get_hw_semaphore(hw))
@@ -715,13 +747,7 @@ static s32 e1000_get_link_up_info_80003es2lan(struct e1000_hw *hw, u16 *speed,
715 ret_val = e1000e_get_speed_and_duplex_copper(hw, 747 ret_val = e1000e_get_speed_and_duplex_copper(hw,
716 speed, 748 speed,
717 duplex); 749 duplex);
718 if (ret_val) 750 hw->phy.ops.cfg_on_link_up(hw);
719 return ret_val;
720 if (*speed == SPEED_1000)
721 ret_val = e1000_cfg_kmrn_1000_80003es2lan(hw);
722 else
723 ret_val = e1000_cfg_kmrn_10_100_80003es2lan(hw,
724 *duplex);
725 } else { 751 } else {
726 ret_val = e1000e_get_speed_and_duplex_fiber_serdes(hw, 752 ret_val = e1000e_get_speed_and_duplex_fiber_serdes(hw,
727 speed, 753 speed,
@@ -763,8 +789,10 @@ static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw)
763 789
764 ctrl = er32(CTRL); 790 ctrl = er32(CTRL);
765 791
792 ret_val = e1000_acquire_phy_80003es2lan(hw);
766 hw_dbg(hw, "Issuing a global reset to MAC\n"); 793 hw_dbg(hw, "Issuing a global reset to MAC\n");
767 ew32(CTRL, ctrl | E1000_CTRL_RST); 794 ew32(CTRL, ctrl | E1000_CTRL_RST);
795 e1000_release_phy_80003es2lan(hw);
768 796
769 ret_val = e1000e_get_auto_rd_done(hw); 797 ret_val = e1000e_get_auto_rd_done(hw);
770 if (ret_val) 798 if (ret_val)
@@ -907,8 +935,7 @@ static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw)
907 struct e1000_phy_info *phy = &hw->phy; 935 struct e1000_phy_info *phy = &hw->phy;
908 s32 ret_val; 936 s32 ret_val;
909 u32 ctrl_ext; 937 u32 ctrl_ext;
910 u32 i = 0; 938 u16 data;
911 u16 data, data2;
912 939
913 ret_val = e1e_rphy(hw, GG82563_PHY_MAC_SPEC_CTRL, &data); 940 ret_val = e1e_rphy(hw, GG82563_PHY_MAC_SPEC_CTRL, &data);
914 if (ret_val) 941 if (ret_val)
@@ -972,19 +999,20 @@ static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw)
972 } 999 }
973 1000
974 /* Bypass Rx and Tx FIFO's */ 1001 /* Bypass Rx and Tx FIFO's */
975 ret_val = e1000e_write_kmrn_reg(hw, E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL, 1002 ret_val = e1000_write_kmrn_reg_80003es2lan(hw,
1003 E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL,
976 E1000_KMRNCTRLSTA_FIFO_CTRL_RX_BYPASS | 1004 E1000_KMRNCTRLSTA_FIFO_CTRL_RX_BYPASS |
977 E1000_KMRNCTRLSTA_FIFO_CTRL_TX_BYPASS); 1005 E1000_KMRNCTRLSTA_FIFO_CTRL_TX_BYPASS);
978 if (ret_val) 1006 if (ret_val)
979 return ret_val; 1007 return ret_val;
980 1008
981 ret_val = e1000e_read_kmrn_reg(hw, 1009 ret_val = e1000_read_kmrn_reg_80003es2lan(hw,
982 E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE, 1010 E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE,
983 &data); 1011 &data);
984 if (ret_val) 1012 if (ret_val)
985 return ret_val; 1013 return ret_val;
986 data |= E1000_KMRNCTRLSTA_OPMODE_E_IDLE; 1014 data |= E1000_KMRNCTRLSTA_OPMODE_E_IDLE;
987 ret_val = e1000e_write_kmrn_reg(hw, 1015 ret_val = e1000_write_kmrn_reg_80003es2lan(hw,
988 E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE, 1016 E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE,
989 data); 1017 data);
990 if (ret_val) 1018 if (ret_val)
@@ -1019,18 +1047,9 @@ static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw)
1019 if (ret_val) 1047 if (ret_val)
1020 return ret_val; 1048 return ret_val;
1021 1049
1022 do { 1050 ret_val = e1e_rphy(hw, GG82563_PHY_KMRN_MODE_CTRL, &data);
1023 ret_val = e1e_rphy(hw, GG82563_PHY_KMRN_MODE_CTRL, 1051 if (ret_val)
1024 &data); 1052 return ret_val;
1025 if (ret_val)
1026 return ret_val;
1027
1028 ret_val = e1e_rphy(hw, GG82563_PHY_KMRN_MODE_CTRL,
1029 &data2);
1030 if (ret_val)
1031 return ret_val;
1032 i++;
1033 } while ((data != data2) && (i < GG82563_MAX_KMRN_RETRY));
1034 1053
1035 data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; 1054 data &= ~GG82563_KMCR_PASS_FALSE_CARRIER;
1036 ret_val = e1e_wphy(hw, GG82563_PHY_KMRN_MODE_CTRL, data); 1055 ret_val = e1e_wphy(hw, GG82563_PHY_KMRN_MODE_CTRL, data);
@@ -1077,23 +1096,27 @@ static s32 e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw)
1077 * iteration and increase the max iterations when 1096 * iteration and increase the max iterations when
1078 * polling the phy; this fixes erroneous timeouts at 10Mbps. 1097 * polling the phy; this fixes erroneous timeouts at 10Mbps.
1079 */ 1098 */
1080 ret_val = e1000e_write_kmrn_reg(hw, GG82563_REG(0x34, 4), 0xFFFF); 1099 ret_val = e1000_write_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 4),
1100 0xFFFF);
1081 if (ret_val) 1101 if (ret_val)
1082 return ret_val; 1102 return ret_val;
1083 ret_val = e1000e_read_kmrn_reg(hw, GG82563_REG(0x34, 9), &reg_data); 1103 ret_val = e1000_read_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 9),
1104 &reg_data);
1084 if (ret_val) 1105 if (ret_val)
1085 return ret_val; 1106 return ret_val;
1086 reg_data |= 0x3F; 1107 reg_data |= 0x3F;
1087 ret_val = e1000e_write_kmrn_reg(hw, GG82563_REG(0x34, 9), reg_data); 1108 ret_val = e1000_write_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 9),
1109 reg_data);
1088 if (ret_val) 1110 if (ret_val)
1089 return ret_val; 1111 return ret_val;
1090 ret_val = e1000e_read_kmrn_reg(hw, 1112 ret_val = e1000_read_kmrn_reg_80003es2lan(hw,
1091 E1000_KMRNCTRLSTA_OFFSET_INB_CTRL, 1113 E1000_KMRNCTRLSTA_OFFSET_INB_CTRL,
1092 &reg_data); 1114 &reg_data);
1093 if (ret_val) 1115 if (ret_val)
1094 return ret_val; 1116 return ret_val;
1095 reg_data |= E1000_KMRNCTRLSTA_INB_CTRL_DIS_PADDING; 1117 reg_data |= E1000_KMRNCTRLSTA_INB_CTRL_DIS_PADDING;
1096 ret_val = e1000e_write_kmrn_reg(hw, E1000_KMRNCTRLSTA_OFFSET_INB_CTRL, 1118 ret_val = e1000_write_kmrn_reg_80003es2lan(hw,
1119 E1000_KMRNCTRLSTA_OFFSET_INB_CTRL,
1097 reg_data); 1120 reg_data);
1098 if (ret_val) 1121 if (ret_val)
1099 return ret_val; 1122 return ret_val;
@@ -1108,6 +1131,35 @@ static s32 e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw)
1108} 1131}
1109 1132
1110/** 1133/**
1134 * e1000_cfg_on_link_up_80003es2lan - es2 link configuration after link-up
1135 * @hw: pointer to the HW structure
1136 * @duplex: current duplex setting
1137 *
1138 * Configure the KMRN interface by applying last minute quirks for
1139 * 10/100 operation.
1140 **/
1141static s32 e1000_cfg_on_link_up_80003es2lan(struct e1000_hw *hw)
1142{
1143 s32 ret_val = 0;
1144 u16 speed;
1145 u16 duplex;
1146
1147 if (hw->phy.media_type == e1000_media_type_copper) {
1148 ret_val = e1000e_get_speed_and_duplex_copper(hw, &speed,
1149 &duplex);
1150 if (ret_val)
1151 return ret_val;
1152
1153 if (speed == SPEED_1000)
1154 ret_val = e1000_cfg_kmrn_1000_80003es2lan(hw);
1155 else
1156 ret_val = e1000_cfg_kmrn_10_100_80003es2lan(hw, duplex);
1157 }
1158
1159 return ret_val;
1160}
1161
1162/**
1111 * e1000_cfg_kmrn_10_100_80003es2lan - Apply "quirks" for 10/100 operation 1163 * e1000_cfg_kmrn_10_100_80003es2lan - Apply "quirks" for 10/100 operation
1112 * @hw: pointer to the HW structure 1164 * @hw: pointer to the HW structure
1113 * @duplex: current duplex setting 1165 * @duplex: current duplex setting
@@ -1123,8 +1175,9 @@ static s32 e1000_cfg_kmrn_10_100_80003es2lan(struct e1000_hw *hw, u16 duplex)
1123 u16 reg_data, reg_data2; 1175 u16 reg_data, reg_data2;
1124 1176
1125 reg_data = E1000_KMRNCTRLSTA_HD_CTRL_10_100_DEFAULT; 1177 reg_data = E1000_KMRNCTRLSTA_HD_CTRL_10_100_DEFAULT;
1126 ret_val = e1000e_write_kmrn_reg(hw, E1000_KMRNCTRLSTA_OFFSET_HD_CTRL, 1178 ret_val = e1000_write_kmrn_reg_80003es2lan(hw,
1127 reg_data); 1179 E1000_KMRNCTRLSTA_OFFSET_HD_CTRL,
1180 reg_data);
1128 if (ret_val) 1181 if (ret_val)
1129 return ret_val; 1182 return ret_val;
1130 1183
@@ -1170,8 +1223,9 @@ static s32 e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw)
1170 u32 i = 0; 1223 u32 i = 0;
1171 1224
1172 reg_data = E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT; 1225 reg_data = E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT;
1173 ret_val = e1000e_write_kmrn_reg(hw, E1000_KMRNCTRLSTA_OFFSET_HD_CTRL, 1226 ret_val = e1000_write_kmrn_reg_80003es2lan(hw,
1174 reg_data); 1227 E1000_KMRNCTRLSTA_OFFSET_HD_CTRL,
1228 reg_data);
1175 if (ret_val) 1229 if (ret_val)
1176 return ret_val; 1230 return ret_val;
1177 1231
@@ -1199,6 +1253,69 @@ static s32 e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw)
1199} 1253}
1200 1254
1201/** 1255/**
1256 * e1000_read_kmrn_reg_80003es2lan - Read kumeran register
1257 * @hw: pointer to the HW structure
1258 * @offset: register offset to be read
1259 * @data: pointer to the read data
1260 *
1261 * Acquire semaphore, then read the PHY register at offset
1262 * using the kumeran interface. The information retrieved is stored in data.
1263 * Release the semaphore before exiting.
1264 **/
1265s32 e1000_read_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, u16 *data)
1266{
1267 u32 kmrnctrlsta;
1268 s32 ret_val = 0;
1269
1270 ret_val = e1000_acquire_mac_csr_80003es2lan(hw);
1271 if (ret_val)
1272 return ret_val;
1273
1274 kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) &
1275 E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN;
1276 ew32(KMRNCTRLSTA, kmrnctrlsta);
1277
1278 udelay(2);
1279
1280 kmrnctrlsta = er32(KMRNCTRLSTA);
1281 *data = (u16)kmrnctrlsta;
1282
1283 e1000_release_mac_csr_80003es2lan(hw);
1284
1285 return ret_val;
1286}
1287
1288/**
1289 * e1000_write_kmrn_reg_80003es2lan - Write kumeran register
1290 * @hw: pointer to the HW structure
1291 * @offset: register offset to write to
1292 * @data: data to write at register offset
1293 *
1294 * Acquire semaphore, then write the data to PHY register
1295 * at the offset using the kumeran interface. Release semaphore
1296 * before exiting.
1297 **/
1298s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, u16 data)
1299{
1300 u32 kmrnctrlsta;
1301 s32 ret_val = 0;
1302
1303 ret_val = e1000_acquire_mac_csr_80003es2lan(hw);
1304 if (ret_val)
1305 return ret_val;
1306
1307 kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) &
1308 E1000_KMRNCTRLSTA_OFFSET) | data;
1309 ew32(KMRNCTRLSTA, kmrnctrlsta);
1310
1311 udelay(2);
1312
1313 e1000_release_mac_csr_80003es2lan(hw);
1314
1315 return ret_val;
1316}
1317
1318/**
1202 * e1000_clear_hw_cntrs_80003es2lan - Clear device specific hardware counters 1319 * e1000_clear_hw_cntrs_80003es2lan - Clear device specific hardware counters
1203 * @hw: pointer to the HW structure 1320 * @hw: pointer to the HW structure
1204 * 1321 *
@@ -1276,6 +1393,7 @@ static struct e1000_phy_operations es2_phy_ops = {
1276 .set_d0_lplu_state = NULL, 1393 .set_d0_lplu_state = NULL,
1277 .set_d3_lplu_state = e1000e_set_d3_lplu_state, 1394 .set_d3_lplu_state = e1000e_set_d3_lplu_state,
1278 .write_phy_reg = e1000_write_phy_reg_gg82563_80003es2lan, 1395 .write_phy_reg = e1000_write_phy_reg_gg82563_80003es2lan,
1396 .cfg_on_link_up = e1000_cfg_on_link_up_80003es2lan,
1279}; 1397};
1280 1398
1281static struct e1000_nvm_operations es2_nvm_ops = { 1399static struct e1000_nvm_operations es2_nvm_ops = {
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index 62421ce96311..e48956d924b0 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -173,11 +173,8 @@ static int e1000_get_settings(struct net_device *netdev,
173static u32 e1000_get_link(struct net_device *netdev) 173static u32 e1000_get_link(struct net_device *netdev)
174{ 174{
175 struct e1000_adapter *adapter = netdev_priv(netdev); 175 struct e1000_adapter *adapter = netdev_priv(netdev);
176 struct e1000_hw *hw = &adapter->hw; 176
177 u32 status; 177 return e1000_has_link(adapter);
178
179 status = er32(STATUS);
180 return (status & E1000_STATUS_LU) ? 1 : 0;
181} 178}
182 179
183static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx) 180static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx)
@@ -249,7 +246,7 @@ static int e1000_set_settings(struct net_device *netdev,
249 ADVERTISED_Autoneg; 246 ADVERTISED_Autoneg;
250 ecmd->advertising = hw->phy.autoneg_advertised; 247 ecmd->advertising = hw->phy.autoneg_advertised;
251 if (adapter->fc_autoneg) 248 if (adapter->fc_autoneg)
252 hw->fc.original_type = e1000_fc_default; 249 hw->fc.requested_mode = e1000_fc_default;
253 } else { 250 } else {
254 if (e1000_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex)) { 251 if (e1000_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex)) {
255 clear_bit(__E1000_RESETTING, &adapter->state); 252 clear_bit(__E1000_RESETTING, &adapter->state);
@@ -279,11 +276,11 @@ static void e1000_get_pauseparam(struct net_device *netdev,
279 pause->autoneg = 276 pause->autoneg =
280 (adapter->fc_autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE); 277 (adapter->fc_autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE);
281 278
282 if (hw->fc.type == e1000_fc_rx_pause) { 279 if (hw->fc.current_mode == e1000_fc_rx_pause) {
283 pause->rx_pause = 1; 280 pause->rx_pause = 1;
284 } else if (hw->fc.type == e1000_fc_tx_pause) { 281 } else if (hw->fc.current_mode == e1000_fc_tx_pause) {
285 pause->tx_pause = 1; 282 pause->tx_pause = 1;
286 } else if (hw->fc.type == e1000_fc_full) { 283 } else if (hw->fc.current_mode == e1000_fc_full) {
287 pause->rx_pause = 1; 284 pause->rx_pause = 1;
288 pause->tx_pause = 1; 285 pause->tx_pause = 1;
289 } 286 }
@@ -301,19 +298,8 @@ static int e1000_set_pauseparam(struct net_device *netdev,
301 while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) 298 while (test_and_set_bit(__E1000_RESETTING, &adapter->state))
302 msleep(1); 299 msleep(1);
303 300
304 if (pause->rx_pause && pause->tx_pause)
305 hw->fc.type = e1000_fc_full;
306 else if (pause->rx_pause && !pause->tx_pause)
307 hw->fc.type = e1000_fc_rx_pause;
308 else if (!pause->rx_pause && pause->tx_pause)
309 hw->fc.type = e1000_fc_tx_pause;
310 else if (!pause->rx_pause && !pause->tx_pause)
311 hw->fc.type = e1000_fc_none;
312
313 hw->fc.original_type = hw->fc.type;
314
315 if (adapter->fc_autoneg == AUTONEG_ENABLE) { 301 if (adapter->fc_autoneg == AUTONEG_ENABLE) {
316 hw->fc.type = e1000_fc_default; 302 hw->fc.requested_mode = e1000_fc_default;
317 if (netif_running(adapter->netdev)) { 303 if (netif_running(adapter->netdev)) {
318 e1000e_down(adapter); 304 e1000e_down(adapter);
319 e1000e_up(adapter); 305 e1000e_up(adapter);
@@ -321,6 +307,17 @@ static int e1000_set_pauseparam(struct net_device *netdev,
321 e1000e_reset(adapter); 307 e1000e_reset(adapter);
322 } 308 }
323 } else { 309 } else {
310 if (pause->rx_pause && pause->tx_pause)
311 hw->fc.requested_mode = e1000_fc_full;
312 else if (pause->rx_pause && !pause->tx_pause)
313 hw->fc.requested_mode = e1000_fc_rx_pause;
314 else if (!pause->rx_pause && pause->tx_pause)
315 hw->fc.requested_mode = e1000_fc_tx_pause;
316 else if (!pause->rx_pause && !pause->tx_pause)
317 hw->fc.requested_mode = e1000_fc_none;
318
319 hw->fc.current_mode = hw->fc.requested_mode;
320
324 retval = ((hw->phy.media_type == e1000_media_type_fiber) ? 321 retval = ((hw->phy.media_type == e1000_media_type_fiber) ?
325 hw->mac.ops.setup_link(hw) : e1000e_force_mac_fc(hw)); 322 hw->mac.ops.setup_link(hw) : e1000e_force_mac_fc(hw));
326 } 323 }
@@ -495,18 +492,19 @@ static int e1000_get_eeprom(struct net_device *netdev,
495 for (i = 0; i < last_word - first_word + 1; i++) { 492 for (i = 0; i < last_word - first_word + 1; i++) {
496 ret_val = e1000_read_nvm(hw, first_word + i, 1, 493 ret_val = e1000_read_nvm(hw, first_word + i, 1,
497 &eeprom_buff[i]); 494 &eeprom_buff[i]);
498 if (ret_val) { 495 if (ret_val)
499 /* a read error occurred, throw away the
500 * result */
501 memset(eeprom_buff, 0xff, sizeof(eeprom_buff));
502 break; 496 break;
503 }
504 } 497 }
505 } 498 }
506 499
507 /* Device's eeprom is always little-endian, word addressable */ 500 if (ret_val) {
508 for (i = 0; i < last_word - first_word + 1; i++) 501 /* a read error occurred, throw away the result */
509 le16_to_cpus(&eeprom_buff[i]); 502 memset(eeprom_buff, 0xff, sizeof(eeprom_buff));
503 } else {
504 /* Device's eeprom is always little-endian, word addressable */
505 for (i = 0; i < last_word - first_word + 1; i++)
506 le16_to_cpus(&eeprom_buff[i]);
507 }
510 508
511 memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 1), eeprom->len); 509 memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 1), eeprom->len);
512 kfree(eeprom_buff); 510 kfree(eeprom_buff);
@@ -558,6 +556,9 @@ static int e1000_set_eeprom(struct net_device *netdev,
558 ret_val = e1000_read_nvm(hw, last_word, 1, 556 ret_val = e1000_read_nvm(hw, last_word, 1,
559 &eeprom_buff[last_word - first_word]); 557 &eeprom_buff[last_word - first_word]);
560 558
559 if (ret_val)
560 goto out;
561
561 /* Device's eeprom is always little-endian, word addressable */ 562 /* Device's eeprom is always little-endian, word addressable */
562 for (i = 0; i < last_word - first_word + 1; i++) 563 for (i = 0; i < last_word - first_word + 1; i++)
563 le16_to_cpus(&eeprom_buff[i]); 564 le16_to_cpus(&eeprom_buff[i]);
@@ -570,15 +571,18 @@ static int e1000_set_eeprom(struct net_device *netdev,
570 ret_val = e1000_write_nvm(hw, first_word, 571 ret_val = e1000_write_nvm(hw, first_word,
571 last_word - first_word + 1, eeprom_buff); 572 last_word - first_word + 1, eeprom_buff);
572 573
574 if (ret_val)
575 goto out;
576
573 /* 577 /*
574 * Update the checksum over the first part of the EEPROM if needed 578 * Update the checksum over the first part of the EEPROM if needed
575 * and flush shadow RAM for 82573 controllers 579 * and flush shadow RAM for applicable controllers
576 */ 580 */
577 if ((ret_val == 0) && ((first_word <= NVM_CHECKSUM_REG) || 581 if ((first_word <= NVM_CHECKSUM_REG) ||
578 (hw->mac.type == e1000_82574) || 582 (hw->mac.type == e1000_82574) || (hw->mac.type == e1000_82573))
579 (hw->mac.type == e1000_82573))) 583 ret_val = e1000e_update_nvm_checksum(hw);
580 e1000e_update_nvm_checksum(hw);
581 584
585out:
582 kfree(eeprom_buff); 586 kfree(eeprom_buff);
583 return ret_val; 587 return ret_val;
584} 588}
@@ -588,7 +592,6 @@ static void e1000_get_drvinfo(struct net_device *netdev,
588{ 592{
589 struct e1000_adapter *adapter = netdev_priv(netdev); 593 struct e1000_adapter *adapter = netdev_priv(netdev);
590 char firmware_version[32]; 594 char firmware_version[32];
591 u16 eeprom_data;
592 595
593 strncpy(drvinfo->driver, e1000e_driver_name, 32); 596 strncpy(drvinfo->driver, e1000e_driver_name, 32);
594 strncpy(drvinfo->version, e1000e_driver_version, 32); 597 strncpy(drvinfo->version, e1000e_driver_version, 32);
@@ -597,11 +600,10 @@ static void e1000_get_drvinfo(struct net_device *netdev,
597 * EEPROM image version # is reported as firmware version # for 600 * EEPROM image version # is reported as firmware version # for
598 * PCI-E controllers 601 * PCI-E controllers
599 */ 602 */
600 e1000_read_nvm(&adapter->hw, 5, 1, &eeprom_data);
601 sprintf(firmware_version, "%d.%d-%d", 603 sprintf(firmware_version, "%d.%d-%d",
602 (eeprom_data & 0xF000) >> 12, 604 (adapter->eeprom_vers & 0xF000) >> 12,
603 (eeprom_data & 0x0FF0) >> 4, 605 (adapter->eeprom_vers & 0x0FF0) >> 4,
604 eeprom_data & 0x000F); 606 (adapter->eeprom_vers & 0x000F));
605 607
606 strncpy(drvinfo->fw_version, firmware_version, 32); 608 strncpy(drvinfo->fw_version, firmware_version, 32);
607 strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32); 609 strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32);
@@ -865,7 +867,7 @@ static int e1000_eeprom_test(struct e1000_adapter *adapter, u64 *data)
865 for (i = 0; i < (NVM_CHECKSUM_REG + 1); i++) { 867 for (i = 0; i < (NVM_CHECKSUM_REG + 1); i++) {
866 if ((e1000_read_nvm(&adapter->hw, i, 1, &temp)) < 0) { 868 if ((e1000_read_nvm(&adapter->hw, i, 1, &temp)) < 0) {
867 *data = 1; 869 *data = 1;
868 break; 870 return *data;
869 } 871 }
870 checksum += temp; 872 checksum += temp;
871 } 873 }
diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h
index c4ffd4b70517..f25e961c6b3b 100644
--- a/drivers/net/e1000e/hw.h
+++ b/drivers/net/e1000e/hw.h
@@ -437,7 +437,7 @@ enum e1000_rev_polarity{
437 e1000_rev_polarity_undefined = 0xFF 437 e1000_rev_polarity_undefined = 0xFF
438}; 438};
439 439
440enum e1000_fc_type { 440enum e1000_fc_mode {
441 e1000_fc_none = 0, 441 e1000_fc_none = 0,
442 e1000_fc_rx_pause, 442 e1000_fc_rx_pause,
443 e1000_fc_tx_pause, 443 e1000_fc_tx_pause,
@@ -739,6 +739,7 @@ struct e1000_phy_operations {
739 s32 (*set_d0_lplu_state)(struct e1000_hw *, bool); 739 s32 (*set_d0_lplu_state)(struct e1000_hw *, bool);
740 s32 (*set_d3_lplu_state)(struct e1000_hw *, bool); 740 s32 (*set_d3_lplu_state)(struct e1000_hw *, bool);
741 s32 (*write_phy_reg)(struct e1000_hw *, u32, u16); 741 s32 (*write_phy_reg)(struct e1000_hw *, u32, u16);
742 s32 (*cfg_on_link_up)(struct e1000_hw *);
742}; 743};
743 744
744/* Function pointers for the NVM. */ 745/* Function pointers for the NVM. */
@@ -849,8 +850,8 @@ struct e1000_fc_info {
849 u16 pause_time; /* Flow control pause timer */ 850 u16 pause_time; /* Flow control pause timer */
850 bool send_xon; /* Flow control send XON */ 851 bool send_xon; /* Flow control send XON */
851 bool strict_ieee; /* Strict IEEE mode */ 852 bool strict_ieee; /* Strict IEEE mode */
852 enum e1000_fc_type type; /* Type of flow control */ 853 enum e1000_fc_mode current_mode; /* FC mode in effect */
853 enum e1000_fc_type original_type; 854 enum e1000_fc_mode requested_mode; /* FC mode requested by caller */
854}; 855};
855 856
856struct e1000_dev_spec_82571 { 857struct e1000_dev_spec_82571 {
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index 523b9716a543..92f2ace7ca68 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -27,6 +27,7 @@
27*******************************************************************************/ 27*******************************************************************************/
28 28
29/* 29/*
30 * 82562G 10/100 Network Connection
30 * 82562G-2 10/100 Network Connection 31 * 82562G-2 10/100 Network Connection
31 * 82562GT 10/100 Network Connection 32 * 82562GT 10/100 Network Connection
32 * 82562GT-2 10/100 Network Connection 33 * 82562GT-2 10/100 Network Connection
@@ -40,6 +41,7 @@
40 * 82566MM Gigabit Network Connection 41 * 82566MM Gigabit Network Connection
41 * 82567LM Gigabit Network Connection 42 * 82567LM Gigabit Network Connection
42 * 82567LF Gigabit Network Connection 43 * 82567LF Gigabit Network Connection
44 * 82567V Gigabit Network Connection
43 * 82567LM-2 Gigabit Network Connection 45 * 82567LM-2 Gigabit Network Connection
44 * 82567LF-2 Gigabit Network Connection 46 * 82567LF-2 Gigabit Network Connection
45 * 82567V-2 Gigabit Network Connection 47 * 82567V-2 Gigabit Network Connection
@@ -92,6 +94,8 @@
92 94
93#define E1000_ICH_NVM_SIG_WORD 0x13 95#define E1000_ICH_NVM_SIG_WORD 0x13
94#define E1000_ICH_NVM_SIG_MASK 0xC000 96#define E1000_ICH_NVM_SIG_MASK 0xC000
97#define E1000_ICH_NVM_VALID_SIG_MASK 0xC0
98#define E1000_ICH_NVM_SIG_VALUE 0x80
95 99
96#define E1000_ICH8_LAN_INIT_TIMEOUT 1500 100#define E1000_ICH8_LAN_INIT_TIMEOUT 1500
97 101
@@ -956,45 +960,62 @@ static s32 e1000_set_d3_lplu_state_ich8lan(struct e1000_hw *hw, bool active)
956 * @bank: pointer to the variable that returns the active bank 960 * @bank: pointer to the variable that returns the active bank
957 * 961 *
958 * Reads signature byte from the NVM using the flash access registers. 962 * Reads signature byte from the NVM using the flash access registers.
963 * Word 0x13 bits 15:14 = 10b indicate a valid signature for that bank.
959 **/ 964 **/
960static s32 e1000_valid_nvm_bank_detect_ich8lan(struct e1000_hw *hw, u32 *bank) 965static s32 e1000_valid_nvm_bank_detect_ich8lan(struct e1000_hw *hw, u32 *bank)
961{ 966{
967 u32 eecd;
962 struct e1000_nvm_info *nvm = &hw->nvm; 968 struct e1000_nvm_info *nvm = &hw->nvm;
963 /* flash bank size is in words */
964 u32 bank1_offset = nvm->flash_bank_size * sizeof(u16); 969 u32 bank1_offset = nvm->flash_bank_size * sizeof(u16);
965 u32 act_offset = E1000_ICH_NVM_SIG_WORD * 2 + 1; 970 u32 act_offset = E1000_ICH_NVM_SIG_WORD * 2 + 1;
966 u8 bank_high_byte = 0; 971 u8 sig_byte = 0;
972 s32 ret_val = 0;
967 973
968 if (hw->mac.type != e1000_ich10lan) { 974 switch (hw->mac.type) {
969 if (er32(EECD) & E1000_EECD_SEC1VAL) 975 case e1000_ich8lan:
970 *bank = 1; 976 case e1000_ich9lan:
971 else 977 eecd = er32(EECD);
972 *bank = 0; 978 if ((eecd & E1000_EECD_SEC1VAL_VALID_MASK) ==
973 } else { 979 E1000_EECD_SEC1VAL_VALID_MASK) {
974 /* 980 if (eecd & E1000_EECD_SEC1VAL)
975 * Make sure the signature for bank 0 is valid, 981 *bank = 1;
976 * if not check for bank1 982 else
977 */ 983 *bank = 0;
978 e1000_read_flash_byte_ich8lan(hw, act_offset, &bank_high_byte); 984
979 if ((bank_high_byte & 0xC0) == 0x80) { 985 return 0;
986 }
987 hw_dbg(hw, "Unable to determine valid NVM bank via EEC - "
988 "reading flash signature\n");
989 /* fall-thru */
990 default:
991 /* set bank to 0 in case flash read fails */
992 *bank = 0;
993
994 /* Check bank 0 */
995 ret_val = e1000_read_flash_byte_ich8lan(hw, act_offset,
996 &sig_byte);
997 if (ret_val)
998 return ret_val;
999 if ((sig_byte & E1000_ICH_NVM_VALID_SIG_MASK) ==
1000 E1000_ICH_NVM_SIG_VALUE) {
980 *bank = 0; 1001 *bank = 0;
981 } else { 1002 return 0;
982 /* 1003 }
983 * find if segment 1 is valid by verifying
984 * bit 15:14 = 10b in word 0x13
985 */
986 e1000_read_flash_byte_ich8lan(hw,
987 act_offset + bank1_offset,
988 &bank_high_byte);
989 1004
990 /* bank1 has a valid signature equivalent to SEC1V */ 1005 /* Check bank 1 */
991 if ((bank_high_byte & 0xC0) == 0x80) { 1006 ret_val = e1000_read_flash_byte_ich8lan(hw, act_offset +
992 *bank = 1; 1007 bank1_offset,
993 } else { 1008 &sig_byte);
994 hw_dbg(hw, "ERROR: EEPROM not present\n"); 1009 if (ret_val)
995 return -E1000_ERR_NVM; 1010 return ret_val;
996 } 1011 if ((sig_byte & E1000_ICH_NVM_VALID_SIG_MASK) ==
1012 E1000_ICH_NVM_SIG_VALUE) {
1013 *bank = 1;
1014 return 0;
997 } 1015 }
1016
1017 hw_dbg(hw, "ERROR: No valid NVM bank present\n");
1018 return -E1000_ERR_NVM;
998 } 1019 }
999 1020
1000 return 0; 1021 return 0;
@@ -1027,11 +1048,11 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
1027 1048
1028 ret_val = e1000_acquire_swflag_ich8lan(hw); 1049 ret_val = e1000_acquire_swflag_ich8lan(hw);
1029 if (ret_val) 1050 if (ret_val)
1030 return ret_val; 1051 goto out;
1031 1052
1032 ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank); 1053 ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank);
1033 if (ret_val) 1054 if (ret_val)
1034 return ret_val; 1055 goto release;
1035 1056
1036 act_offset = (bank) ? nvm->flash_bank_size : 0; 1057 act_offset = (bank) ? nvm->flash_bank_size : 0;
1037 act_offset += offset; 1058 act_offset += offset;
@@ -1050,8 +1071,13 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
1050 } 1071 }
1051 } 1072 }
1052 1073
1074release:
1053 e1000_release_swflag_ich8lan(hw); 1075 e1000_release_swflag_ich8lan(hw);
1054 1076
1077out:
1078 if (ret_val)
1079 hw_dbg(hw, "NVM read error: %d\n", ret_val);
1080
1055 return ret_val; 1081 return ret_val;
1056} 1082}
1057 1083
@@ -1340,14 +1366,14 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
1340 1366
1341 ret_val = e1000e_update_nvm_checksum_generic(hw); 1367 ret_val = e1000e_update_nvm_checksum_generic(hw);
1342 if (ret_val) 1368 if (ret_val)
1343 return ret_val; 1369 goto out;
1344 1370
1345 if (nvm->type != e1000_nvm_flash_sw) 1371 if (nvm->type != e1000_nvm_flash_sw)
1346 return ret_val; 1372 goto out;
1347 1373
1348 ret_val = e1000_acquire_swflag_ich8lan(hw); 1374 ret_val = e1000_acquire_swflag_ich8lan(hw);
1349 if (ret_val) 1375 if (ret_val)
1350 return ret_val; 1376 goto out;
1351 1377
1352 /* 1378 /*
1353 * We're writing to the opposite bank so if we're on bank 1, 1379 * We're writing to the opposite bank so if we're on bank 1,
@@ -1355,17 +1381,27 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
1355 * is going to be written 1381 * is going to be written
1356 */ 1382 */
1357 ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank); 1383 ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank);
1358 if (ret_val) 1384 if (ret_val) {
1359 return ret_val; 1385 e1000_release_swflag_ich8lan(hw);
1386 goto out;
1387 }
1360 1388
1361 if (bank == 0) { 1389 if (bank == 0) {
1362 new_bank_offset = nvm->flash_bank_size; 1390 new_bank_offset = nvm->flash_bank_size;
1363 old_bank_offset = 0; 1391 old_bank_offset = 0;
1364 e1000_erase_flash_bank_ich8lan(hw, 1); 1392 ret_val = e1000_erase_flash_bank_ich8lan(hw, 1);
1393 if (ret_val) {
1394 e1000_release_swflag_ich8lan(hw);
1395 goto out;
1396 }
1365 } else { 1397 } else {
1366 old_bank_offset = nvm->flash_bank_size; 1398 old_bank_offset = nvm->flash_bank_size;
1367 new_bank_offset = 0; 1399 new_bank_offset = 0;
1368 e1000_erase_flash_bank_ich8lan(hw, 0); 1400 ret_val = e1000_erase_flash_bank_ich8lan(hw, 0);
1401 if (ret_val) {
1402 e1000_release_swflag_ich8lan(hw);
1403 goto out;
1404 }
1369 } 1405 }
1370 1406
1371 for (i = 0; i < E1000_ICH8_SHADOW_RAM_WORDS; i++) { 1407 for (i = 0; i < E1000_ICH8_SHADOW_RAM_WORDS; i++) {
@@ -1377,9 +1413,11 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
1377 if (dev_spec->shadow_ram[i].modified) { 1413 if (dev_spec->shadow_ram[i].modified) {
1378 data = dev_spec->shadow_ram[i].value; 1414 data = dev_spec->shadow_ram[i].value;
1379 } else { 1415 } else {
1380 e1000_read_flash_word_ich8lan(hw, 1416 ret_val = e1000_read_flash_word_ich8lan(hw, i +
1381 i + old_bank_offset, 1417 old_bank_offset,
1382 &data); 1418 &data);
1419 if (ret_val)
1420 break;
1383 } 1421 }
1384 1422
1385 /* 1423 /*
@@ -1420,7 +1458,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
1420 /* Possibly read-only, see e1000e_write_protect_nvm_ich8lan() */ 1458 /* Possibly read-only, see e1000e_write_protect_nvm_ich8lan() */
1421 hw_dbg(hw, "Flash commit failed.\n"); 1459 hw_dbg(hw, "Flash commit failed.\n");
1422 e1000_release_swflag_ich8lan(hw); 1460 e1000_release_swflag_ich8lan(hw);
1423 return ret_val; 1461 goto out;
1424 } 1462 }
1425 1463
1426 /* 1464 /*
@@ -1430,14 +1468,18 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
1430 * and we need to change bit 14 to 0b 1468 * and we need to change bit 14 to 0b
1431 */ 1469 */
1432 act_offset = new_bank_offset + E1000_ICH_NVM_SIG_WORD; 1470 act_offset = new_bank_offset + E1000_ICH_NVM_SIG_WORD;
1433 e1000_read_flash_word_ich8lan(hw, act_offset, &data); 1471 ret_val = e1000_read_flash_word_ich8lan(hw, act_offset, &data);
1472 if (ret_val) {
1473 e1000_release_swflag_ich8lan(hw);
1474 goto out;
1475 }
1434 data &= 0xBFFF; 1476 data &= 0xBFFF;
1435 ret_val = e1000_retry_write_flash_byte_ich8lan(hw, 1477 ret_val = e1000_retry_write_flash_byte_ich8lan(hw,
1436 act_offset * 2 + 1, 1478 act_offset * 2 + 1,
1437 (u8)(data >> 8)); 1479 (u8)(data >> 8));
1438 if (ret_val) { 1480 if (ret_val) {
1439 e1000_release_swflag_ich8lan(hw); 1481 e1000_release_swflag_ich8lan(hw);
1440 return ret_val; 1482 goto out;
1441 } 1483 }
1442 1484
1443 /* 1485 /*
@@ -1450,7 +1492,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
1450 ret_val = e1000_retry_write_flash_byte_ich8lan(hw, act_offset, 0); 1492 ret_val = e1000_retry_write_flash_byte_ich8lan(hw, act_offset, 0);
1451 if (ret_val) { 1493 if (ret_val) {
1452 e1000_release_swflag_ich8lan(hw); 1494 e1000_release_swflag_ich8lan(hw);
1453 return ret_val; 1495 goto out;
1454 } 1496 }
1455 1497
1456 /* Great! Everything worked, we can now clear the cached entries. */ 1498 /* Great! Everything worked, we can now clear the cached entries. */
@@ -1468,6 +1510,10 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
1468 e1000e_reload_nvm(hw); 1510 e1000e_reload_nvm(hw);
1469 msleep(10); 1511 msleep(10);
1470 1512
1513out:
1514 if (ret_val)
1515 hw_dbg(hw, "NVM update error: %d\n", ret_val);
1516
1471 return ret_val; 1517 return ret_val;
1472} 1518}
1473 1519
@@ -1893,7 +1939,7 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
1893 ctrl |= E1000_CTRL_PHY_RST; 1939 ctrl |= E1000_CTRL_PHY_RST;
1894 } 1940 }
1895 ret_val = e1000_acquire_swflag_ich8lan(hw); 1941 ret_val = e1000_acquire_swflag_ich8lan(hw);
1896 hw_dbg(hw, "Issuing a global reset to ich8lan"); 1942 hw_dbg(hw, "Issuing a global reset to ich8lan\n");
1897 ew32(CTRL, (ctrl | E1000_CTRL_RST)); 1943 ew32(CTRL, (ctrl | E1000_CTRL_RST));
1898 msleep(20); 1944 msleep(20);
1899 1945
@@ -2069,12 +2115,17 @@ static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw)
2069 * the default flow control setting, so we explicitly 2115 * the default flow control setting, so we explicitly
2070 * set it to full. 2116 * set it to full.
2071 */ 2117 */
2072 if (hw->fc.type == e1000_fc_default) 2118 if (hw->fc.requested_mode == e1000_fc_default)
2073 hw->fc.type = e1000_fc_full; 2119 hw->fc.requested_mode = e1000_fc_full;
2074 2120
2075 hw->fc.original_type = hw->fc.type; 2121 /*
2122 * Save off the requested flow control mode for use later. Depending
2123 * on the link partner's capabilities, we may or may not use this mode.
2124 */
2125 hw->fc.current_mode = hw->fc.requested_mode;
2076 2126
2077 hw_dbg(hw, "After fix-ups FlowControl is now = %x\n", hw->fc.type); 2127 hw_dbg(hw, "After fix-ups FlowControl is now = %x\n",
2128 hw->fc.current_mode);
2078 2129
2079 /* Continue to configure the copper link. */ 2130 /* Continue to configure the copper link. */
2080 ret_val = e1000_setup_copper_link_ich8lan(hw); 2131 ret_val = e1000_setup_copper_link_ich8lan(hw);
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c
index 089578f6855a..66741104ffd1 100644
--- a/drivers/net/e1000e/lib.c
+++ b/drivers/net/e1000e/lib.c
@@ -575,20 +575,42 @@ s32 e1000e_check_for_serdes_link(struct e1000_hw *hw)
575 */ 575 */
576 /* SYNCH bit and IV bit are sticky. */ 576 /* SYNCH bit and IV bit are sticky. */
577 udelay(10); 577 udelay(10);
578 if (E1000_RXCW_SYNCH & er32(RXCW)) { 578 rxcw = er32(RXCW);
579 if (rxcw & E1000_RXCW_SYNCH) {
579 if (!(rxcw & E1000_RXCW_IV)) { 580 if (!(rxcw & E1000_RXCW_IV)) {
580 mac->serdes_has_link = 1; 581 mac->serdes_has_link = true;
581 hw_dbg(hw, "SERDES: Link is up.\n"); 582 hw_dbg(hw, "SERDES: Link up - forced.\n");
582 } 583 }
583 } else { 584 } else {
584 mac->serdes_has_link = 0; 585 mac->serdes_has_link = false;
585 hw_dbg(hw, "SERDES: Link is down.\n"); 586 hw_dbg(hw, "SERDES: Link down - force failed.\n");
586 } 587 }
587 } 588 }
588 589
589 if (E1000_TXCW_ANE & er32(TXCW)) { 590 if (E1000_TXCW_ANE & er32(TXCW)) {
590 status = er32(STATUS); 591 status = er32(STATUS);
591 mac->serdes_has_link = (status & E1000_STATUS_LU); 592 if (status & E1000_STATUS_LU) {
593 /* SYNCH bit and IV bit are sticky, so reread rxcw. */
594 udelay(10);
595 rxcw = er32(RXCW);
596 if (rxcw & E1000_RXCW_SYNCH) {
597 if (!(rxcw & E1000_RXCW_IV)) {
598 mac->serdes_has_link = true;
599 hw_dbg(hw, "SERDES: Link up - autoneg "
600 "completed sucessfully.\n");
601 } else {
602 mac->serdes_has_link = false;
603 hw_dbg(hw, "SERDES: Link down - invalid"
604 "codewords detected in autoneg.\n");
605 }
606 } else {
607 mac->serdes_has_link = false;
608 hw_dbg(hw, "SERDES: Link down - no sync.\n");
609 }
610 } else {
611 mac->serdes_has_link = false;
612 hw_dbg(hw, "SERDES: Link down - autoneg failed\n");
613 }
592 } 614 }
593 615
594 return 0; 616 return 0;
@@ -623,12 +645,12 @@ static s32 e1000_set_default_fc_generic(struct e1000_hw *hw)
623 } 645 }
624 646
625 if ((nvm_data & NVM_WORD0F_PAUSE_MASK) == 0) 647 if ((nvm_data & NVM_WORD0F_PAUSE_MASK) == 0)
626 hw->fc.type = e1000_fc_none; 648 hw->fc.requested_mode = e1000_fc_none;
627 else if ((nvm_data & NVM_WORD0F_PAUSE_MASK) == 649 else if ((nvm_data & NVM_WORD0F_PAUSE_MASK) ==
628 NVM_WORD0F_ASM_DIR) 650 NVM_WORD0F_ASM_DIR)
629 hw->fc.type = e1000_fc_tx_pause; 651 hw->fc.requested_mode = e1000_fc_tx_pause;
630 else 652 else
631 hw->fc.type = e1000_fc_full; 653 hw->fc.requested_mode = e1000_fc_full;
632 654
633 return 0; 655 return 0;
634} 656}
@@ -656,23 +678,23 @@ s32 e1000e_setup_link(struct e1000_hw *hw)
656 return 0; 678 return 0;
657 679
658 /* 680 /*
659 * If flow control is set to default, set flow control based on 681 * If requested flow control is set to default, set flow control
660 * the EEPROM flow control settings. 682 * based on the EEPROM flow control settings.
661 */ 683 */
662 if (hw->fc.type == e1000_fc_default) { 684 if (hw->fc.requested_mode == e1000_fc_default) {
663 ret_val = e1000_set_default_fc_generic(hw); 685 ret_val = e1000_set_default_fc_generic(hw);
664 if (ret_val) 686 if (ret_val)
665 return ret_val; 687 return ret_val;
666 } 688 }
667 689
668 /* 690 /*
669 * We want to save off the original Flow Control configuration just 691 * Save off the requested flow control mode for use later. Depending
670 * in case we get disconnected and then reconnected into a different 692 * on the link partner's capabilities, we may or may not use this mode.
671 * hub or switch with different Flow Control capabilities.
672 */ 693 */
673 hw->fc.original_type = hw->fc.type; 694 hw->fc.current_mode = hw->fc.requested_mode;
674 695
675 hw_dbg(hw, "After fix-ups FlowControl is now = %x\n", hw->fc.type); 696 hw_dbg(hw, "After fix-ups FlowControl is now = %x\n",
697 hw->fc.current_mode);
676 698
677 /* Call the necessary media_type subroutine to configure the link. */ 699 /* Call the necessary media_type subroutine to configure the link. */
678 ret_val = mac->ops.setup_physical_interface(hw); 700 ret_val = mac->ops.setup_physical_interface(hw);
@@ -724,7 +746,7 @@ static s32 e1000_commit_fc_settings_generic(struct e1000_hw *hw)
724 * do not support receiving pause frames). 746 * do not support receiving pause frames).
725 * 3: Both Rx and Tx flow control (symmetric) are enabled. 747 * 3: Both Rx and Tx flow control (symmetric) are enabled.
726 */ 748 */
727 switch (hw->fc.type) { 749 switch (hw->fc.current_mode) {
728 case e1000_fc_none: 750 case e1000_fc_none:
729 /* Flow control completely disabled by a software over-ride. */ 751 /* Flow control completely disabled by a software over-ride. */
730 txcw = (E1000_TXCW_ANE | E1000_TXCW_FD); 752 txcw = (E1000_TXCW_ANE | E1000_TXCW_FD);
@@ -906,7 +928,7 @@ s32 e1000e_set_fc_watermarks(struct e1000_hw *hw)
906 * ability to transmit pause frames is not enabled, then these 928 * ability to transmit pause frames is not enabled, then these
907 * registers will be set to 0. 929 * registers will be set to 0.
908 */ 930 */
909 if (hw->fc.type & e1000_fc_tx_pause) { 931 if (hw->fc.current_mode & e1000_fc_tx_pause) {
910 /* 932 /*
911 * We need to set up the Receive Threshold high and low water 933 * We need to set up the Receive Threshold high and low water
912 * marks as well as (optionally) enabling the transmission of 934 * marks as well as (optionally) enabling the transmission of
@@ -945,7 +967,7 @@ s32 e1000e_force_mac_fc(struct e1000_hw *hw)
945 * receive flow control. 967 * receive flow control.
946 * 968 *
947 * The "Case" statement below enables/disable flow control 969 * The "Case" statement below enables/disable flow control
948 * according to the "hw->fc.type" parameter. 970 * according to the "hw->fc.current_mode" parameter.
949 * 971 *
950 * The possible values of the "fc" parameter are: 972 * The possible values of the "fc" parameter are:
951 * 0: Flow control is completely disabled 973 * 0: Flow control is completely disabled
@@ -956,9 +978,9 @@ s32 e1000e_force_mac_fc(struct e1000_hw *hw)
956 * 3: Both Rx and Tx flow control (symmetric) is enabled. 978 * 3: Both Rx and Tx flow control (symmetric) is enabled.
957 * other: No other values should be possible at this point. 979 * other: No other values should be possible at this point.
958 */ 980 */
959 hw_dbg(hw, "hw->fc.type = %u\n", hw->fc.type); 981 hw_dbg(hw, "hw->fc.current_mode = %u\n", hw->fc.current_mode);
960 982
961 switch (hw->fc.type) { 983 switch (hw->fc.current_mode) {
962 case e1000_fc_none: 984 case e1000_fc_none:
963 ctrl &= (~(E1000_CTRL_TFCE | E1000_CTRL_RFCE)); 985 ctrl &= (~(E1000_CTRL_TFCE | E1000_CTRL_RFCE));
964 break; 986 break;
@@ -1102,11 +1124,11 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw)
1102 * ONLY. Hence, we must now check to see if we need to 1124 * ONLY. Hence, we must now check to see if we need to
1103 * turn OFF the TRANSMISSION of PAUSE frames. 1125 * turn OFF the TRANSMISSION of PAUSE frames.
1104 */ 1126 */
1105 if (hw->fc.original_type == e1000_fc_full) { 1127 if (hw->fc.requested_mode == e1000_fc_full) {
1106 hw->fc.type = e1000_fc_full; 1128 hw->fc.current_mode = e1000_fc_full;
1107 hw_dbg(hw, "Flow Control = FULL.\r\n"); 1129 hw_dbg(hw, "Flow Control = FULL.\r\n");
1108 } else { 1130 } else {
1109 hw->fc.type = e1000_fc_rx_pause; 1131 hw->fc.current_mode = e1000_fc_rx_pause;
1110 hw_dbg(hw, "Flow Control = " 1132 hw_dbg(hw, "Flow Control = "
1111 "RX PAUSE frames only.\r\n"); 1133 "RX PAUSE frames only.\r\n");
1112 } 1134 }
@@ -1124,7 +1146,7 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw)
1124 (mii_nway_adv_reg & NWAY_AR_ASM_DIR) && 1146 (mii_nway_adv_reg & NWAY_AR_ASM_DIR) &&
1125 (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && 1147 (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) &&
1126 (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { 1148 (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) {
1127 hw->fc.type = e1000_fc_tx_pause; 1149 hw->fc.current_mode = e1000_fc_tx_pause;
1128 hw_dbg(hw, "Flow Control = Tx PAUSE frames only.\r\n"); 1150 hw_dbg(hw, "Flow Control = Tx PAUSE frames only.\r\n");
1129 } 1151 }
1130 /* 1152 /*
@@ -1140,14 +1162,14 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw)
1140 (mii_nway_adv_reg & NWAY_AR_ASM_DIR) && 1162 (mii_nway_adv_reg & NWAY_AR_ASM_DIR) &&
1141 !(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && 1163 !(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) &&
1142 (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { 1164 (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) {
1143 hw->fc.type = e1000_fc_rx_pause; 1165 hw->fc.current_mode = e1000_fc_rx_pause;
1144 hw_dbg(hw, "Flow Control = Rx PAUSE frames only.\r\n"); 1166 hw_dbg(hw, "Flow Control = Rx PAUSE frames only.\r\n");
1145 } else { 1167 } else {
1146 /* 1168 /*
1147 * Per the IEEE spec, at this point flow control 1169 * Per the IEEE spec, at this point flow control
1148 * should be disabled. 1170 * should be disabled.
1149 */ 1171 */
1150 hw->fc.type = e1000_fc_none; 1172 hw->fc.current_mode = e1000_fc_none;
1151 hw_dbg(hw, "Flow Control = NONE.\r\n"); 1173 hw_dbg(hw, "Flow Control = NONE.\r\n");
1152 } 1174 }
1153 1175
@@ -1163,7 +1185,7 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw)
1163 } 1185 }
1164 1186
1165 if (duplex == HALF_DUPLEX) 1187 if (duplex == HALF_DUPLEX)
1166 hw->fc.type = e1000_fc_none; 1188 hw->fc.current_mode = e1000_fc_none;
1167 1189
1168 /* 1190 /*
1169 * Now we call a subroutine to actually force the MAC 1191 * Now we call a subroutine to actually force the MAC
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index cc0502bbb9ff..ca5d3f58329d 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -2785,7 +2785,7 @@ void e1000e_reset(struct e1000_adapter *adapter)
2785 else 2785 else
2786 fc->pause_time = E1000_FC_PAUSE_TIME; 2786 fc->pause_time = E1000_FC_PAUSE_TIME;
2787 fc->send_xon = 1; 2787 fc->send_xon = 1;
2788 fc->type = fc->original_type; 2788 fc->current_mode = fc->requested_mode;
2789 2789
2790 /* Allow time for pending master requests to run */ 2790 /* Allow time for pending master requests to run */
2791 mac->ops.reset_hw(hw); 2791 mac->ops.reset_hw(hw);
@@ -3408,7 +3408,10 @@ static void e1000_print_link_info(struct e1000_adapter *adapter)
3408 struct e1000_hw *hw = &adapter->hw; 3408 struct e1000_hw *hw = &adapter->hw;
3409 u32 ctrl = er32(CTRL); 3409 u32 ctrl = er32(CTRL);
3410 3410
3411 e_info("Link is Up %d Mbps %s, Flow Control: %s\n", 3411 /* Link status message must follow this format for user tools */
3412 printk(KERN_INFO "e1000e: %s NIC Link is Up %d Mbps %s, "
3413 "Flow Control: %s\n",
3414 adapter->netdev->name,
3412 adapter->link_speed, 3415 adapter->link_speed,
3413 (adapter->link_duplex == FULL_DUPLEX) ? 3416 (adapter->link_duplex == FULL_DUPLEX) ?
3414 "Full Duplex" : "Half Duplex", 3417 "Full Duplex" : "Half Duplex",
@@ -3418,7 +3421,7 @@ static void e1000_print_link_info(struct e1000_adapter *adapter)
3418 ((ctrl & E1000_CTRL_TFCE) ? "TX" : "None" ))); 3421 ((ctrl & E1000_CTRL_TFCE) ? "TX" : "None" )));
3419} 3422}
3420 3423
3421static bool e1000_has_link(struct e1000_adapter *adapter) 3424bool e1000_has_link(struct e1000_adapter *adapter)
3422{ 3425{
3423 struct e1000_hw *hw = &adapter->hw; 3426 struct e1000_hw *hw = &adapter->hw;
3424 bool link_active = 0; 3427 bool link_active = 0;
@@ -3493,6 +3496,7 @@ static void e1000_watchdog_task(struct work_struct *work)
3493 struct e1000_adapter, watchdog_task); 3496 struct e1000_adapter, watchdog_task);
3494 struct net_device *netdev = adapter->netdev; 3497 struct net_device *netdev = adapter->netdev;
3495 struct e1000_mac_info *mac = &adapter->hw.mac; 3498 struct e1000_mac_info *mac = &adapter->hw.mac;
3499 struct e1000_phy_info *phy = &adapter->hw.phy;
3496 struct e1000_ring *tx_ring = adapter->tx_ring; 3500 struct e1000_ring *tx_ring = adapter->tx_ring;
3497 struct e1000_hw *hw = &adapter->hw; 3501 struct e1000_hw *hw = &adapter->hw;
3498 u32 link, tctl; 3502 u32 link, tctl;
@@ -3599,6 +3603,13 @@ static void e1000_watchdog_task(struct work_struct *work)
3599 tctl |= E1000_TCTL_EN; 3603 tctl |= E1000_TCTL_EN;
3600 ew32(TCTL, tctl); 3604 ew32(TCTL, tctl);
3601 3605
3606 /*
3607 * Perform any post-link-up configuration before
3608 * reporting link up.
3609 */
3610 if (phy->ops.cfg_on_link_up)
3611 phy->ops.cfg_on_link_up(hw);
3612
3602 netif_carrier_on(netdev); 3613 netif_carrier_on(netdev);
3603 netif_tx_wake_all_queues(netdev); 3614 netif_tx_wake_all_queues(netdev);
3604 3615
@@ -3610,7 +3621,9 @@ static void e1000_watchdog_task(struct work_struct *work)
3610 if (netif_carrier_ok(netdev)) { 3621 if (netif_carrier_ok(netdev)) {
3611 adapter->link_speed = 0; 3622 adapter->link_speed = 0;
3612 adapter->link_duplex = 0; 3623 adapter->link_duplex = 0;
3613 e_info("Link is Down\n"); 3624 /* Link status message must follow this format */
3625 printk(KERN_INFO "e1000e: %s NIC Link is Down\n",
3626 adapter->netdev->name);
3614 netif_carrier_off(netdev); 3627 netif_carrier_off(netdev);
3615 netif_tx_stop_all_queues(netdev); 3628 netif_tx_stop_all_queues(netdev);
3616 if (!test_bit(__E1000_DOWN, &adapter->state)) 3629 if (!test_bit(__E1000_DOWN, &adapter->state))
@@ -4462,7 +4475,27 @@ static int e1000_suspend(struct pci_dev *pdev, pm_message_t state)
4462 4475
4463 pci_disable_device(pdev); 4476 pci_disable_device(pdev);
4464 4477
4465 pci_set_power_state(pdev, pci_choose_state(pdev, state)); 4478 /*
4479 * The pci-e switch on some quad port adapters will report a
4480 * correctable error when the MAC transitions from D0 to D3. To
4481 * prevent this we need to mask off the correctable errors on the
4482 * downstream port of the pci-e switch.
4483 */
4484 if (adapter->flags & FLAG_IS_QUAD_PORT) {
4485 struct pci_dev *us_dev = pdev->bus->self;
4486 int pos = pci_find_capability(us_dev, PCI_CAP_ID_EXP);
4487 u16 devctl;
4488
4489 pci_read_config_word(us_dev, pos + PCI_EXP_DEVCTL, &devctl);
4490 pci_write_config_word(us_dev, pos + PCI_EXP_DEVCTL,
4491 (devctl & ~PCI_EXP_DEVCTL_CERE));
4492
4493 pci_set_power_state(pdev, pci_choose_state(pdev, state));
4494
4495 pci_write_config_word(us_dev, pos + PCI_EXP_DEVCTL, devctl);
4496 } else {
4497 pci_set_power_state(pdev, pci_choose_state(pdev, state));
4498 }
4466 4499
4467 return 0; 4500 return 0;
4468} 4501}
@@ -4690,14 +4723,14 @@ static void e1000_eeprom_checks(struct e1000_adapter *adapter)
4690 return; 4723 return;
4691 4724
4692 ret_val = e1000_read_nvm(hw, NVM_INIT_CONTROL2_REG, 1, &buf); 4725 ret_val = e1000_read_nvm(hw, NVM_INIT_CONTROL2_REG, 1, &buf);
4693 if (!(le16_to_cpu(buf) & (1 << 0))) { 4726 if (!ret_val && (!(le16_to_cpu(buf) & (1 << 0)))) {
4694 /* Deep Smart Power Down (DSPD) */ 4727 /* Deep Smart Power Down (DSPD) */
4695 dev_warn(&adapter->pdev->dev, 4728 dev_warn(&adapter->pdev->dev,
4696 "Warning: detected DSPD enabled in EEPROM\n"); 4729 "Warning: detected DSPD enabled in EEPROM\n");
4697 } 4730 }
4698 4731
4699 ret_val = e1000_read_nvm(hw, NVM_INIT_3GIO_3, 1, &buf); 4732 ret_val = e1000_read_nvm(hw, NVM_INIT_3GIO_3, 1, &buf);
4700 if (le16_to_cpu(buf) & (3 << 2)) { 4733 if (!ret_val && (le16_to_cpu(buf) & (3 << 2))) {
4701 /* ASPM enable */ 4734 /* ASPM enable */
4702 dev_warn(&adapter->pdev->dev, 4735 dev_warn(&adapter->pdev->dev,
4703 "Warning: detected ASPM enabled in EEPROM\n"); 4736 "Warning: detected ASPM enabled in EEPROM\n");
@@ -4782,7 +4815,10 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
4782 goto err_pci_reg; 4815 goto err_pci_reg;
4783 4816
4784 pci_set_master(pdev); 4817 pci_set_master(pdev);
4785 pci_save_state(pdev); 4818 /* PCI config space info */
4819 err = pci_save_state(pdev);
4820 if (err)
4821 goto err_alloc_etherdev;
4786 4822
4787 err = -ENOMEM; 4823 err = -ENOMEM;
4788 netdev = alloc_etherdev(sizeof(struct e1000_adapter)); 4824 netdev = alloc_etherdev(sizeof(struct e1000_adapter));
@@ -4947,8 +4983,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
4947 /* Initialize link parameters. User can change them with ethtool */ 4983 /* Initialize link parameters. User can change them with ethtool */
4948 adapter->hw.mac.autoneg = 1; 4984 adapter->hw.mac.autoneg = 1;
4949 adapter->fc_autoneg = 1; 4985 adapter->fc_autoneg = 1;
4950 adapter->hw.fc.original_type = e1000_fc_default; 4986 adapter->hw.fc.requested_mode = e1000_fc_default;
4951 adapter->hw.fc.type = e1000_fc_default; 4987 adapter->hw.fc.current_mode = e1000_fc_default;
4952 adapter->hw.phy.autoneg_advertised = 0x2f; 4988 adapter->hw.phy.autoneg_advertised = 0x2f;
4953 4989
4954 /* ring size defaults */ 4990 /* ring size defaults */
@@ -4989,6 +5025,9 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
4989 adapter->wol = adapter->eeprom_wol; 5025 adapter->wol = adapter->eeprom_wol;
4990 device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); 5026 device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol);
4991 5027
5028 /* save off EEPROM version number */
5029 e1000_read_nvm(&adapter->hw, 5, 1, &adapter->eeprom_vers);
5030
4992 /* reset the hardware with the new settings */ 5031 /* reset the hardware with the new settings */
4993 e1000e_reset(adapter); 5032 e1000e_reset(adapter);
4994 5033
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c
index 6cd333ae61d0..dc4a9cba6a73 100644
--- a/drivers/net/e1000e/phy.c
+++ b/drivers/net/e1000e/phy.c
@@ -744,7 +744,7 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
744 * other: No software override. The flow control configuration 744 * other: No software override. The flow control configuration
745 * in the EEPROM is used. 745 * in the EEPROM is used.
746 */ 746 */
747 switch (hw->fc.type) { 747 switch (hw->fc.current_mode) {
748 case e1000_fc_none: 748 case e1000_fc_none:
749 /* 749 /*
750 * Flow control (Rx & Tx) is completely disabled by a 750 * Flow control (Rx & Tx) is completely disabled by a
@@ -1030,14 +1030,14 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw)
1030 1030
1031 e1000e_phy_force_speed_duplex_setup(hw, &phy_data); 1031 e1000e_phy_force_speed_duplex_setup(hw, &phy_data);
1032 1032
1033 /* Reset the phy to commit changes. */
1034 phy_data |= MII_CR_RESET;
1035
1036 ret_val = e1e_wphy(hw, PHY_CONTROL, phy_data); 1033 ret_val = e1e_wphy(hw, PHY_CONTROL, phy_data);
1037 if (ret_val) 1034 if (ret_val)
1038 return ret_val; 1035 return ret_val;
1039 1036
1040 udelay(1); 1037 /* Reset the phy to commit changes. */
1038 ret_val = e1000e_commit_phy(hw);
1039 if (ret_val)
1040 return ret_val;
1041 1041
1042 if (phy->autoneg_wait_to_complete) { 1042 if (phy->autoneg_wait_to_complete) {
1043 hw_dbg(hw, "Waiting for forced speed/duplex link on M88 phy.\n"); 1043 hw_dbg(hw, "Waiting for forced speed/duplex link on M88 phy.\n");
@@ -1114,7 +1114,7 @@ void e1000e_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl)
1114 u32 ctrl; 1114 u32 ctrl;
1115 1115
1116 /* Turn off flow control when forcing speed/duplex */ 1116 /* Turn off flow control when forcing speed/duplex */
1117 hw->fc.type = e1000_fc_none; 1117 hw->fc.current_mode = e1000_fc_none;
1118 1118
1119 /* Force speed/duplex on the mac */ 1119 /* Force speed/duplex on the mac */
1120 ctrl = er32(CTRL); 1120 ctrl = er32(CTRL);
diff --git a/drivers/net/wan/Kconfig b/drivers/net/wan/Kconfig
index 21efd99b9294..0725161aa27c 100644
--- a/drivers/net/wan/Kconfig
+++ b/drivers/net/wan/Kconfig
@@ -207,6 +207,8 @@ config PC300
207 tristate "Cyclades-PC300 support (RS-232/V.35, X.21, T1/E1 boards)" 207 tristate "Cyclades-PC300 support (RS-232/V.35, X.21, T1/E1 boards)"
208 depends on HDLC && PCI && BROKEN 208 depends on HDLC && PCI && BROKEN
209 ---help--- 209 ---help---
210 This driver is broken because of struct tty_driver change.
211
210 Driver for the Cyclades-PC300 synchronous communication boards. 212 Driver for the Cyclades-PC300 synchronous communication boards.
211 213
212 These boards provide synchronous serial interfaces to your 214 These boards provide synchronous serial interfaces to your
diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c
index d3d5055741ad..f1ddd7c3459c 100644
--- a/drivers/net/wan/hdlc_fr.c
+++ b/drivers/net/wan/hdlc_fr.c
@@ -342,7 +342,7 @@ static int fr_hard_header(struct sk_buff **skb_p, u16 dlci)
342 342
343static int pvc_open(struct net_device *dev) 343static int pvc_open(struct net_device *dev)
344{ 344{
345 pvc_device *pvc = dev->priv; 345 pvc_device *pvc = dev->ml_priv;
346 346
347 if ((pvc->frad->flags & IFF_UP) == 0) 347 if ((pvc->frad->flags & IFF_UP) == 0)
348 return -EIO; /* Frad must be UP in order to activate PVC */ 348 return -EIO; /* Frad must be UP in order to activate PVC */
@@ -362,7 +362,7 @@ static int pvc_open(struct net_device *dev)
362 362
363static int pvc_close(struct net_device *dev) 363static int pvc_close(struct net_device *dev)
364{ 364{
365 pvc_device *pvc = dev->priv; 365 pvc_device *pvc = dev->ml_priv;
366 366
367 if (--pvc->open_count == 0) { 367 if (--pvc->open_count == 0) {
368 hdlc_device *hdlc = dev_to_hdlc(pvc->frad); 368 hdlc_device *hdlc = dev_to_hdlc(pvc->frad);
@@ -381,7 +381,7 @@ static int pvc_close(struct net_device *dev)
381 381
382static int pvc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) 382static int pvc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
383{ 383{
384 pvc_device *pvc = dev->priv; 384 pvc_device *pvc = dev->ml_priv;
385 fr_proto_pvc_info info; 385 fr_proto_pvc_info info;
386 386
387 if (ifr->ifr_settings.type == IF_GET_PROTO) { 387 if (ifr->ifr_settings.type == IF_GET_PROTO) {
@@ -409,7 +409,7 @@ static int pvc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
409 409
410static int pvc_xmit(struct sk_buff *skb, struct net_device *dev) 410static int pvc_xmit(struct sk_buff *skb, struct net_device *dev)
411{ 411{
412 pvc_device *pvc = dev->priv; 412 pvc_device *pvc = dev->ml_priv;
413 413
414 if (pvc->state.active) { 414 if (pvc->state.active) {
415 if (dev->type == ARPHRD_ETHER) { 415 if (dev->type == ARPHRD_ETHER) {
@@ -1111,7 +1111,7 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type)
1111 dev->change_mtu = pvc_change_mtu; 1111 dev->change_mtu = pvc_change_mtu;
1112 dev->mtu = HDLC_MAX_MTU; 1112 dev->mtu = HDLC_MAX_MTU;
1113 dev->tx_queue_len = 0; 1113 dev->tx_queue_len = 0;
1114 dev->priv = pvc; 1114 dev->ml_priv = pvc;
1115 1115
1116 result = dev_alloc_name(dev, dev->name); 1116 result = dev_alloc_name(dev, dev->name);
1117 if (result < 0) { 1117 if (result < 0) {
diff --git a/drivers/net/wan/pc300_drv.c b/drivers/net/wan/pc300_drv.c
index d0a8d1e352ac..d67957af589c 100644
--- a/drivers/net/wan/pc300_drv.c
+++ b/drivers/net/wan/pc300_drv.c
@@ -1769,7 +1769,7 @@ cpc_trace(struct net_device *dev, struct sk_buff *skb_main, char rx_tx)
1769 1769
1770static void cpc_tx_timeout(struct net_device *dev) 1770static void cpc_tx_timeout(struct net_device *dev)
1771{ 1771{
1772 pc300dev_t *d = (pc300dev_t *) dev->priv; 1772 pc300dev_t *d = (pc300dev_t *) dev_to_hdlc(dev)->priv;
1773 pc300ch_t *chan = (pc300ch_t *) d->chan; 1773 pc300ch_t *chan = (pc300ch_t *) d->chan;
1774 pc300_t *card = (pc300_t *) chan->card; 1774 pc300_t *card = (pc300_t *) chan->card;
1775 int ch = chan->channel; 1775 int ch = chan->channel;
@@ -1796,7 +1796,7 @@ static void cpc_tx_timeout(struct net_device *dev)
1796 1796
1797static int cpc_queue_xmit(struct sk_buff *skb, struct net_device *dev) 1797static int cpc_queue_xmit(struct sk_buff *skb, struct net_device *dev)
1798{ 1798{
1799 pc300dev_t *d = (pc300dev_t *) dev->priv; 1799 pc300dev_t *d = (pc300dev_t *) dev_to_hdlc(dev)->priv;
1800 pc300ch_t *chan = (pc300ch_t *) d->chan; 1800 pc300ch_t *chan = (pc300ch_t *) d->chan;
1801 pc300_t *card = (pc300_t *) chan->card; 1801 pc300_t *card = (pc300_t *) chan->card;
1802 int ch = chan->channel; 1802 int ch = chan->channel;
@@ -1874,7 +1874,7 @@ static int cpc_queue_xmit(struct sk_buff *skb, struct net_device *dev)
1874 1874
1875static void cpc_net_rx(struct net_device *dev) 1875static void cpc_net_rx(struct net_device *dev)
1876{ 1876{
1877 pc300dev_t *d = (pc300dev_t *) dev->priv; 1877 pc300dev_t *d = (pc300dev_t *) dev_to_hdlc(dev)->priv;
1878 pc300ch_t *chan = (pc300ch_t *) d->chan; 1878 pc300ch_t *chan = (pc300ch_t *) d->chan;
1879 pc300_t *card = (pc300_t *) chan->card; 1879 pc300_t *card = (pc300_t *) chan->card;
1880 int ch = chan->channel; 1880 int ch = chan->channel;
@@ -2522,7 +2522,7 @@ static int cpc_change_mtu(struct net_device *dev, int new_mtu)
2522 2522
2523static int cpc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) 2523static int cpc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
2524{ 2524{
2525 pc300dev_t *d = (pc300dev_t *) dev->priv; 2525 pc300dev_t *d = (pc300dev_t *) dev_to_hdlc(dev)->priv;
2526 pc300ch_t *chan = (pc300ch_t *) d->chan; 2526 pc300ch_t *chan = (pc300ch_t *) d->chan;
2527 pc300_t *card = (pc300_t *) chan->card; 2527 pc300_t *card = (pc300_t *) chan->card;
2528 pc300conf_t conf_aux; 2528 pc300conf_t conf_aux;
@@ -3058,7 +3058,7 @@ static int tx_config(pc300dev_t * d)
3058static int cpc_attach(struct net_device *dev, unsigned short encoding, 3058static int cpc_attach(struct net_device *dev, unsigned short encoding,
3059 unsigned short parity) 3059 unsigned short parity)
3060{ 3060{
3061 pc300dev_t *d = (pc300dev_t *)dev->priv; 3061 pc300dev_t *d = (pc300dev_t *)dev_to_hdlc(dev)->priv;
3062 pc300ch_t *chan = (pc300ch_t *)d->chan; 3062 pc300ch_t *chan = (pc300ch_t *)d->chan;
3063 pc300_t *card = (pc300_t *)chan->card; 3063 pc300_t *card = (pc300_t *)chan->card;
3064 pc300chconf_t *conf = (pc300chconf_t *)&chan->conf; 3064 pc300chconf_t *conf = (pc300chconf_t *)&chan->conf;
@@ -3138,7 +3138,7 @@ static void cpc_closech(pc300dev_t * d)
3138 3138
3139int cpc_open(struct net_device *dev) 3139int cpc_open(struct net_device *dev)
3140{ 3140{
3141 pc300dev_t *d = (pc300dev_t *) dev->priv; 3141 pc300dev_t *d = (pc300dev_t *) dev_to_hdlc(dev)->priv;
3142 struct ifreq ifr; 3142 struct ifreq ifr;
3143 int result; 3143 int result;
3144 3144
@@ -3166,7 +3166,7 @@ err_out:
3166 3166
3167static int cpc_close(struct net_device *dev) 3167static int cpc_close(struct net_device *dev)
3168{ 3168{
3169 pc300dev_t *d = (pc300dev_t *) dev->priv; 3169 pc300dev_t *d = (pc300dev_t *) dev_to_hdlc(dev)->priv;
3170 pc300ch_t *chan = (pc300ch_t *) d->chan; 3170 pc300ch_t *chan = (pc300ch_t *) d->chan;
3171 pc300_t *card = (pc300_t *) chan->card; 3171 pc300_t *card = (pc300_t *) chan->card;
3172 unsigned long flags; 3172 unsigned long flags;
@@ -3347,7 +3347,7 @@ static void cpc_init_card(pc300_t * card)
3347 d->line_on = 0; 3347 d->line_on = 0;
3348 d->line_off = 0; 3348 d->line_off = 0;
3349 3349
3350 dev = alloc_hdlcdev(NULL); 3350 dev = alloc_hdlcdev(d);
3351 if (dev == NULL) 3351 if (dev == NULL)
3352 continue; 3352 continue;
3353 3353
@@ -3372,7 +3372,6 @@ static void cpc_init_card(pc300_t * card)
3372 dev->do_ioctl = cpc_ioctl; 3372 dev->do_ioctl = cpc_ioctl;
3373 3373
3374 if (register_hdlc_device(dev) == 0) { 3374 if (register_hdlc_device(dev) == 0) {
3375 dev->priv = d; /* We need 'priv', hdlc doesn't */
3376 printk("%s: Cyclades-PC300/", dev->name); 3375 printk("%s: Cyclades-PC300/", dev->name);
3377 switch (card->hw.type) { 3376 switch (card->hw.type) {
3378 case PC300_TE: 3377 case PC300_TE:
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h
index c59769693bee..e960faac609d 100644
--- a/include/linux/hdlc.h
+++ b/include/linux/hdlc.h
@@ -80,7 +80,7 @@ struct net_device *alloc_hdlcdev(void *priv);
80 80
81static inline struct hdlc_device* dev_to_hdlc(struct net_device *dev) 81static inline struct hdlc_device* dev_to_hdlc(struct net_device *dev)
82{ 82{
83 return dev->priv; 83 return netdev_priv(dev);
84} 84}
85 85
86static __inline__ void debug_frame(const struct sk_buff *skb) 86static __inline__ void debug_frame(const struct sk_buff *skb)
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 28b3ee3e8d6d..ec7ee2e46d8c 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -291,25 +291,25 @@ typedef __u64 __bitwise __addrpair;
291 ((__force __u64)(__be32)(__saddr))); 291 ((__force __u64)(__be32)(__saddr)));
292#endif /* __BIG_ENDIAN */ 292#endif /* __BIG_ENDIAN */
293#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ 293#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
294 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ 294 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \
295 ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \ 295 ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \
296 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 296 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
297 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 297 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
298#define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ 298#define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
299 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ 299 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \
300 ((*((__addrpair *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \ 300 ((*((__addrpair *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \
301 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ 301 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \
302 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 302 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
303#else /* 32-bit arch */ 303#else /* 32-bit arch */
304#define INET_ADDR_COOKIE(__name, __saddr, __daddr) 304#define INET_ADDR_COOKIE(__name, __saddr, __daddr)
305#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif) \ 305#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif) \
306 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ 306 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \
307 (inet_sk(__sk)->daddr == (__saddr)) && \ 307 (inet_sk(__sk)->daddr == (__saddr)) && \
308 (inet_sk(__sk)->rcv_saddr == (__daddr)) && \ 308 (inet_sk(__sk)->rcv_saddr == (__daddr)) && \
309 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 309 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
310 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 310 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
311#define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif) \ 311#define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif) \
312 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ 312 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \
313 (inet_twsk(__sk)->tw_daddr == (__saddr)) && \ 313 (inet_twsk(__sk)->tw_daddr == (__saddr)) && \
314 (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \ 314 (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \
315 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ 315 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 1cb154ed75ad..998a78f169ff 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -778,7 +778,7 @@ skip_listen_ht:
778 778
779 for (i = s_i; i < hashinfo->ehash_size; i++) { 779 for (i = s_i; i < hashinfo->ehash_size; i++) {
780 struct inet_ehash_bucket *head = &hashinfo->ehash[i]; 780 struct inet_ehash_bucket *head = &hashinfo->ehash[i];
781 rwlock_t *lock = inet_ehash_lockp(hashinfo, i); 781 spinlock_t *lock = inet_ehash_lockp(hashinfo, i);
782 struct sock *sk; 782 struct sock *sk;
783 struct hlist_nulls_node *node; 783 struct hlist_nulls_node *node;
784 784
@@ -791,7 +791,7 @@ skip_listen_ht:
791 if (i > s_i) 791 if (i > s_i)
792 s_num = 0; 792 s_num = 0;
793 793
794 read_lock_bh(lock); 794 spin_lock_bh(lock);
795 sk_nulls_for_each(sk, node, &head->chain) { 795 sk_nulls_for_each(sk, node, &head->chain) {
796 struct inet_sock *inet = inet_sk(sk); 796 struct inet_sock *inet = inet_sk(sk);
797 797
@@ -806,7 +806,7 @@ skip_listen_ht:
806 r->id.idiag_dport) 806 r->id.idiag_dport)
807 goto next_normal; 807 goto next_normal;
808 if (inet_csk_diag_dump(sk, skb, cb) < 0) { 808 if (inet_csk_diag_dump(sk, skb, cb) < 0) {
809 read_unlock_bh(lock); 809 spin_unlock_bh(lock);
810 goto done; 810 goto done;
811 } 811 }
812next_normal: 812next_normal:
@@ -828,14 +828,14 @@ next_normal:
828 r->id.idiag_dport) 828 r->id.idiag_dport)
829 goto next_dying; 829 goto next_dying;
830 if (inet_twsk_diag_dump(tw, skb, cb) < 0) { 830 if (inet_twsk_diag_dump(tw, skb, cb) < 0) {
831 read_unlock_bh(lock); 831 spin_unlock_bh(lock);
832 goto done; 832 goto done;
833 } 833 }
834next_dying: 834next_dying:
835 ++num; 835 ++num;
836 } 836 }
837 } 837 }
838 read_unlock_bh(lock); 838 spin_unlock_bh(lock);
839 } 839 }
840 840
841done: 841done:
diff --git a/net/sched/sch_drr.c b/net/sched/sch_drr.c
index 8d523d9b636c..37e6ab99bbea 100644
--- a/net/sched/sch_drr.c
+++ b/net/sched/sch_drr.c
@@ -406,6 +406,7 @@ static unsigned int drr_drop(struct Qdisc *sch)
406 if (cl->qdisc->ops->drop) { 406 if (cl->qdisc->ops->drop) {
407 len = cl->qdisc->ops->drop(cl->qdisc); 407 len = cl->qdisc->ops->drop(cl->qdisc);
408 if (len > 0) { 408 if (len > 0) {
409 sch->q.qlen--;
409 if (cl->qdisc->q.qlen == 0) 410 if (cl->qdisc->q.qlen == 0)
410 list_del(&cl->alist); 411 list_del(&cl->alist);
411 return len; 412 return len;