aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000e
diff options
context:
space:
mode:
authorBruce Allan <bruce.w.allan@intel.com>2008-11-21 19:57:36 -0500
committerDavid S. Miller <davem@davemloft.net>2008-11-21 19:57:36 -0500
commit5c48ef3e2028677a890d46d9a38b19174274f2e9 (patch)
tree1ef4a75e9054eafa127609bd31f7999dc1fe085f /drivers/net/e1000e
parent8f12fe8653eb699a6bc4f88f1a80312466ea2b0e (diff)
e1000e: sync change flow control variables with ixgbe
Sync flow control variables and usage model with that found in the ixgbe driver. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/e1000e')
-rw-r--r--drivers/net/e1000e/82571.c4
-rw-r--r--drivers/net/e1000e/ethtool.c32
-rw-r--r--drivers/net/e1000e/hw.h6
-rw-r--r--drivers/net/e1000e/ich8lan.c13
-rw-r--r--drivers/net/e1000e/lib.c46
-rw-r--r--drivers/net/e1000e/netdev.c6
-rw-r--r--drivers/net/e1000e/phy.c4
7 files changed, 58 insertions, 53 deletions
diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c
index 11e72b64e87d..60c15cbbc401 100644
--- a/drivers/net/e1000e/82571.c
+++ b/drivers/net/e1000e/82571.c
@@ -1118,8 +1118,8 @@ static s32 e1000_setup_link_82571(struct e1000_hw *hw)
1118 * set it to full. 1118 * set it to full.
1119 */ 1119 */
1120 if ((hw->mac.type == e1000_82573 || hw->mac.type == e1000_82574) && 1120 if ((hw->mac.type == e1000_82573 || hw->mac.type == e1000_82574) &&
1121 hw->fc.type == e1000_fc_default) 1121 hw->fc.requested_mode == e1000_fc_default)
1122 hw->fc.type = e1000_fc_full; 1122 hw->fc.requested_mode = e1000_fc_full;
1123 1123
1124 return e1000e_setup_link(hw); 1124 return e1000e_setup_link(hw);
1125} 1125}
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index 62421ce96311..875d769531fd 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -249,7 +249,7 @@ static int e1000_set_settings(struct net_device *netdev,
249 ADVERTISED_Autoneg; 249 ADVERTISED_Autoneg;
250 ecmd->advertising = hw->phy.autoneg_advertised; 250 ecmd->advertising = hw->phy.autoneg_advertised;
251 if (adapter->fc_autoneg) 251 if (adapter->fc_autoneg)
252 hw->fc.original_type = e1000_fc_default; 252 hw->fc.requested_mode = e1000_fc_default;
253 } else { 253 } else {
254 if (e1000_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex)) { 254 if (e1000_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex)) {
255 clear_bit(__E1000_RESETTING, &adapter->state); 255 clear_bit(__E1000_RESETTING, &adapter->state);
@@ -279,11 +279,11 @@ static void e1000_get_pauseparam(struct net_device *netdev,
279 pause->autoneg = 279 pause->autoneg =
280 (adapter->fc_autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE); 280 (adapter->fc_autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE);
281 281
282 if (hw->fc.type == e1000_fc_rx_pause) { 282 if (hw->fc.current_mode == e1000_fc_rx_pause) {
283 pause->rx_pause = 1; 283 pause->rx_pause = 1;
284 } else if (hw->fc.type == e1000_fc_tx_pause) { 284 } else if (hw->fc.current_mode == e1000_fc_tx_pause) {
285 pause->tx_pause = 1; 285 pause->tx_pause = 1;
286 } else if (hw->fc.type == e1000_fc_full) { 286 } else if (hw->fc.current_mode == e1000_fc_full) {
287 pause->rx_pause = 1; 287 pause->rx_pause = 1;
288 pause->tx_pause = 1; 288 pause->tx_pause = 1;
289 } 289 }
@@ -301,19 +301,8 @@ static int e1000_set_pauseparam(struct net_device *netdev,
301 while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) 301 while (test_and_set_bit(__E1000_RESETTING, &adapter->state))
302 msleep(1); 302 msleep(1);
303 303
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) { 304 if (adapter->fc_autoneg == AUTONEG_ENABLE) {
316 hw->fc.type = e1000_fc_default; 305 hw->fc.requested_mode = e1000_fc_default;
317 if (netif_running(adapter->netdev)) { 306 if (netif_running(adapter->netdev)) {
318 e1000e_down(adapter); 307 e1000e_down(adapter);
319 e1000e_up(adapter); 308 e1000e_up(adapter);
@@ -321,6 +310,17 @@ static int e1000_set_pauseparam(struct net_device *netdev,
321 e1000e_reset(adapter); 310 e1000e_reset(adapter);
322 } 311 }
323 } else { 312 } else {
313 if (pause->rx_pause && pause->tx_pause)
314 hw->fc.requested_mode = e1000_fc_full;
315 else if (pause->rx_pause && !pause->tx_pause)
316 hw->fc.requested_mode = e1000_fc_rx_pause;
317 else if (!pause->rx_pause && pause->tx_pause)
318 hw->fc.requested_mode = e1000_fc_tx_pause;
319 else if (!pause->rx_pause && !pause->tx_pause)
320 hw->fc.requested_mode = e1000_fc_none;
321
322 hw->fc.current_mode = hw->fc.requested_mode;
323
324 retval = ((hw->phy.media_type == e1000_media_type_fiber) ? 324 retval = ((hw->phy.media_type == e1000_media_type_fiber) ?
325 hw->mac.ops.setup_link(hw) : e1000e_force_mac_fc(hw)); 325 hw->mac.ops.setup_link(hw) : e1000e_force_mac_fc(hw));
326 } 326 }
diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h
index ac1efb9ac58b..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,
@@ -850,8 +850,8 @@ struct e1000_fc_info {
850 u16 pause_time; /* Flow control pause timer */ 850 u16 pause_time; /* Flow control pause timer */
851 bool send_xon; /* Flow control send XON */ 851 bool send_xon; /* Flow control send XON */
852 bool strict_ieee; /* Strict IEEE mode */ 852 bool strict_ieee; /* Strict IEEE mode */
853 enum e1000_fc_type type; /* Type of flow control */ 853 enum e1000_fc_mode current_mode; /* FC mode in effect */
854 enum e1000_fc_type original_type; 854 enum e1000_fc_mode requested_mode; /* FC mode requested by caller */
855}; 855};
856 856
857struct e1000_dev_spec_82571 { 857struct e1000_dev_spec_82571 {
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index 11f0dd35c927..5d85f5b5a071 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -2071,12 +2071,17 @@ static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw)
2071 * the default flow control setting, so we explicitly 2071 * the default flow control setting, so we explicitly
2072 * set it to full. 2072 * set it to full.
2073 */ 2073 */
2074 if (hw->fc.type == e1000_fc_default) 2074 if (hw->fc.requested_mode == e1000_fc_default)
2075 hw->fc.type = e1000_fc_full; 2075 hw->fc.requested_mode = e1000_fc_full;
2076 2076
2077 hw->fc.original_type = hw->fc.type; 2077 /*
2078 * Save off the requested flow control mode for use later. Depending
2079 * on the link partner's capabilities, we may or may not use this mode.
2080 */
2081 hw->fc.current_mode = hw->fc.requested_mode;
2078 2082
2079 hw_dbg(hw, "After fix-ups FlowControl is now = %x\n", hw->fc.type); 2083 hw_dbg(hw, "After fix-ups FlowControl is now = %x\n",
2084 hw->fc.current_mode);
2080 2085
2081 /* Continue to configure the copper link. */ 2086 /* Continue to configure the copper link. */
2082 ret_val = e1000_setup_copper_link_ich8lan(hw); 2087 ret_val = e1000_setup_copper_link_ich8lan(hw);
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c
index 37753d13cd22..66741104ffd1 100644
--- a/drivers/net/e1000e/lib.c
+++ b/drivers/net/e1000e/lib.c
@@ -645,12 +645,12 @@ static s32 e1000_set_default_fc_generic(struct e1000_hw *hw)
645 } 645 }
646 646
647 if ((nvm_data & NVM_WORD0F_PAUSE_MASK) == 0) 647 if ((nvm_data & NVM_WORD0F_PAUSE_MASK) == 0)
648 hw->fc.type = e1000_fc_none; 648 hw->fc.requested_mode = e1000_fc_none;
649 else if ((nvm_data & NVM_WORD0F_PAUSE_MASK) == 649 else if ((nvm_data & NVM_WORD0F_PAUSE_MASK) ==
650 NVM_WORD0F_ASM_DIR) 650 NVM_WORD0F_ASM_DIR)
651 hw->fc.type = e1000_fc_tx_pause; 651 hw->fc.requested_mode = e1000_fc_tx_pause;
652 else 652 else
653 hw->fc.type = e1000_fc_full; 653 hw->fc.requested_mode = e1000_fc_full;
654 654
655 return 0; 655 return 0;
656} 656}
@@ -678,23 +678,23 @@ s32 e1000e_setup_link(struct e1000_hw *hw)
678 return 0; 678 return 0;
679 679
680 /* 680 /*
681 * If flow control is set to default, set flow control based on 681 * If requested flow control is set to default, set flow control
682 * the EEPROM flow control settings. 682 * based on the EEPROM flow control settings.
683 */ 683 */
684 if (hw->fc.type == e1000_fc_default) { 684 if (hw->fc.requested_mode == e1000_fc_default) {
685 ret_val = e1000_set_default_fc_generic(hw); 685 ret_val = e1000_set_default_fc_generic(hw);
686 if (ret_val) 686 if (ret_val)
687 return ret_val; 687 return ret_val;
688 } 688 }
689 689
690 /* 690 /*
691 * We want to save off the original Flow Control configuration just 691 * Save off the requested flow control mode for use later. Depending
692 * 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.
693 * hub or switch with different Flow Control capabilities.
694 */ 693 */
695 hw->fc.original_type = hw->fc.type; 694 hw->fc.current_mode = hw->fc.requested_mode;
696 695
697 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);
698 698
699 /* Call the necessary media_type subroutine to configure the link. */ 699 /* Call the necessary media_type subroutine to configure the link. */
700 ret_val = mac->ops.setup_physical_interface(hw); 700 ret_val = mac->ops.setup_physical_interface(hw);
@@ -746,7 +746,7 @@ static s32 e1000_commit_fc_settings_generic(struct e1000_hw *hw)
746 * do not support receiving pause frames). 746 * do not support receiving pause frames).
747 * 3: Both Rx and Tx flow control (symmetric) are enabled. 747 * 3: Both Rx and Tx flow control (symmetric) are enabled.
748 */ 748 */
749 switch (hw->fc.type) { 749 switch (hw->fc.current_mode) {
750 case e1000_fc_none: 750 case e1000_fc_none:
751 /* Flow control completely disabled by a software over-ride. */ 751 /* Flow control completely disabled by a software over-ride. */
752 txcw = (E1000_TXCW_ANE | E1000_TXCW_FD); 752 txcw = (E1000_TXCW_ANE | E1000_TXCW_FD);
@@ -928,7 +928,7 @@ s32 e1000e_set_fc_watermarks(struct e1000_hw *hw)
928 * ability to transmit pause frames is not enabled, then these 928 * ability to transmit pause frames is not enabled, then these
929 * registers will be set to 0. 929 * registers will be set to 0.
930 */ 930 */
931 if (hw->fc.type & e1000_fc_tx_pause) { 931 if (hw->fc.current_mode & e1000_fc_tx_pause) {
932 /* 932 /*
933 * 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
934 * marks as well as (optionally) enabling the transmission of 934 * marks as well as (optionally) enabling the transmission of
@@ -967,7 +967,7 @@ s32 e1000e_force_mac_fc(struct e1000_hw *hw)
967 * receive flow control. 967 * receive flow control.
968 * 968 *
969 * The "Case" statement below enables/disable flow control 969 * The "Case" statement below enables/disable flow control
970 * according to the "hw->fc.type" parameter. 970 * according to the "hw->fc.current_mode" parameter.
971 * 971 *
972 * The possible values of the "fc" parameter are: 972 * The possible values of the "fc" parameter are:
973 * 0: Flow control is completely disabled 973 * 0: Flow control is completely disabled
@@ -978,9 +978,9 @@ s32 e1000e_force_mac_fc(struct e1000_hw *hw)
978 * 3: Both Rx and Tx flow control (symmetric) is enabled. 978 * 3: Both Rx and Tx flow control (symmetric) is enabled.
979 * other: No other values should be possible at this point. 979 * other: No other values should be possible at this point.
980 */ 980 */
981 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);
982 982
983 switch (hw->fc.type) { 983 switch (hw->fc.current_mode) {
984 case e1000_fc_none: 984 case e1000_fc_none:
985 ctrl &= (~(E1000_CTRL_TFCE | E1000_CTRL_RFCE)); 985 ctrl &= (~(E1000_CTRL_TFCE | E1000_CTRL_RFCE));
986 break; 986 break;
@@ -1124,11 +1124,11 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw)
1124 * 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
1125 * turn OFF the TRANSMISSION of PAUSE frames. 1125 * turn OFF the TRANSMISSION of PAUSE frames.
1126 */ 1126 */
1127 if (hw->fc.original_type == e1000_fc_full) { 1127 if (hw->fc.requested_mode == e1000_fc_full) {
1128 hw->fc.type = e1000_fc_full; 1128 hw->fc.current_mode = e1000_fc_full;
1129 hw_dbg(hw, "Flow Control = FULL.\r\n"); 1129 hw_dbg(hw, "Flow Control = FULL.\r\n");
1130 } else { 1130 } else {
1131 hw->fc.type = e1000_fc_rx_pause; 1131 hw->fc.current_mode = e1000_fc_rx_pause;
1132 hw_dbg(hw, "Flow Control = " 1132 hw_dbg(hw, "Flow Control = "
1133 "RX PAUSE frames only.\r\n"); 1133 "RX PAUSE frames only.\r\n");
1134 } 1134 }
@@ -1146,7 +1146,7 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw)
1146 (mii_nway_adv_reg & NWAY_AR_ASM_DIR) && 1146 (mii_nway_adv_reg & NWAY_AR_ASM_DIR) &&
1147 (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && 1147 (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) &&
1148 (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { 1148 (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) {
1149 hw->fc.type = e1000_fc_tx_pause; 1149 hw->fc.current_mode = e1000_fc_tx_pause;
1150 hw_dbg(hw, "Flow Control = Tx PAUSE frames only.\r\n"); 1150 hw_dbg(hw, "Flow Control = Tx PAUSE frames only.\r\n");
1151 } 1151 }
1152 /* 1152 /*
@@ -1162,14 +1162,14 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw)
1162 (mii_nway_adv_reg & NWAY_AR_ASM_DIR) && 1162 (mii_nway_adv_reg & NWAY_AR_ASM_DIR) &&
1163 !(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && 1163 !(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) &&
1164 (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { 1164 (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) {
1165 hw->fc.type = e1000_fc_rx_pause; 1165 hw->fc.current_mode = e1000_fc_rx_pause;
1166 hw_dbg(hw, "Flow Control = Rx PAUSE frames only.\r\n"); 1166 hw_dbg(hw, "Flow Control = Rx PAUSE frames only.\r\n");
1167 } else { 1167 } else {
1168 /* 1168 /*
1169 * Per the IEEE spec, at this point flow control 1169 * Per the IEEE spec, at this point flow control
1170 * should be disabled. 1170 * should be disabled.
1171 */ 1171 */
1172 hw->fc.type = e1000_fc_none; 1172 hw->fc.current_mode = e1000_fc_none;
1173 hw_dbg(hw, "Flow Control = NONE.\r\n"); 1173 hw_dbg(hw, "Flow Control = NONE.\r\n");
1174 } 1174 }
1175 1175
@@ -1185,7 +1185,7 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw)
1185 } 1185 }
1186 1186
1187 if (duplex == HALF_DUPLEX) 1187 if (duplex == HALF_DUPLEX)
1188 hw->fc.type = e1000_fc_none; 1188 hw->fc.current_mode = e1000_fc_none;
1189 1189
1190 /* 1190 /*
1191 * 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 cd6d132160c0..f10252b055d4 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);
@@ -4983,8 +4983,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
4983 /* Initialize link parameters. User can change them with ethtool */ 4983 /* Initialize link parameters. User can change them with ethtool */
4984 adapter->hw.mac.autoneg = 1; 4984 adapter->hw.mac.autoneg = 1;
4985 adapter->fc_autoneg = 1; 4985 adapter->fc_autoneg = 1;
4986 adapter->hw.fc.original_type = e1000_fc_default; 4986 adapter->hw.fc.requested_mode = e1000_fc_default;
4987 adapter->hw.fc.type = e1000_fc_default; 4987 adapter->hw.fc.current_mode = e1000_fc_default;
4988 adapter->hw.phy.autoneg_advertised = 0x2f; 4988 adapter->hw.phy.autoneg_advertised = 0x2f;
4989 4989
4990 /* ring size defaults */ 4990 /* ring size defaults */
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c
index cb7d71e458e4..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
@@ -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);