Commit e29447db authored by Scott Feldman's avatar Scott Feldman Committed by Stephen Hemminger

[e1000] flow control updates

* handle ethtool force flow control
* correctly set flow control hi/low watermarks based on size of Rx FIFO
  area.  The size can change if doing Jumbo Frames or, in the case of
  82547, is smaller to start with.
* was not properly forcing flow control settings to fc_none if using
  strict IEEE flow control override.
parent defce4ed
...@@ -107,11 +107,11 @@ struct e1000_adapter; ...@@ -107,11 +107,11 @@ struct e1000_adapter;
#define E1000_TX_HEAD_ADDR_SHIFT 7 #define E1000_TX_HEAD_ADDR_SHIFT 7
#define E1000_PBA_TX_MASK 0xFFFF0000 #define E1000_PBA_TX_MASK 0xFFFF0000
/* Flow Control High-Watermark: 43464 bytes */ /* Flow Control High-Watermark: 5688 bytes below Rx FIFO size */
#define E1000_FC_HIGH_THRESH 0xA9C8 #define E1000_FC_HIGH_DIFF 0x1638
/* Flow Control Low-Watermark: 43456 bytes */ /* Flow Control Low-Watermark: 5696 bytes below Rx FIFO size */
#define E1000_FC_LOW_THRESH 0xA9C0 #define E1000_FC_LOW_DIFF 0x1640
/* Flow Control Pause Time: 858 usec */ /* Flow Control Pause Time: 858 usec */
#define E1000_FC_PAUSE_TIME 0x0680 #define E1000_FC_PAUSE_TIME 0x0680
......
...@@ -230,11 +230,15 @@ e1000_ethtool_spause(struct e1000_adapter *adapter, ...@@ -230,11 +230,15 @@ e1000_ethtool_spause(struct e1000_adapter *adapter,
hw->original_fc = hw->fc; hw->original_fc = hw->fc;
if(adapter->fc_autoneg == AUTONEG_ENABLE) {
if(netif_running(adapter->netdev)) { if(netif_running(adapter->netdev)) {
e1000_down(adapter); e1000_down(adapter);
e1000_up(adapter); e1000_up(adapter);
} else } else
e1000_reset(adapter); e1000_reset(adapter);
}
else
return e1000_force_mac_fc(hw);
return 0; return 0;
} }
......
...@@ -1865,11 +1865,12 @@ e1000_config_fc_after_link_up(struct e1000_hw *hw) ...@@ -1865,11 +1865,12 @@ e1000_config_fc_after_link_up(struct e1000_hw *hw)
* be asked to delay transmission of packets than asking * be asked to delay transmission of packets than asking
* our link partner to pause transmission of frames. * our link partner to pause transmission of frames.
*/ */
else if(hw->original_fc == e1000_fc_none || else if((hw->original_fc == e1000_fc_none ||
hw->original_fc == e1000_fc_tx_pause) { hw->original_fc == e1000_fc_tx_pause) ||
hw->fc_strict_ieee) {
hw->fc = e1000_fc_none; hw->fc = e1000_fc_none;
DEBUGOUT("Flow Control = NONE.\r\n"); DEBUGOUT("Flow Control = NONE.\r\n");
} else if(!hw->fc_strict_ieee) { } else {
hw->fc = e1000_fc_rx_pause; hw->fc = e1000_fc_rx_pause;
DEBUGOUT("Flow Control = RX PAUSE frames only.\r\n"); DEBUGOUT("Flow Control = RX PAUSE frames only.\r\n");
} }
......
...@@ -318,7 +318,13 @@ e1000_reset(struct e1000_adapter *adapter) ...@@ -318,7 +318,13 @@ e1000_reset(struct e1000_adapter *adapter)
} }
E1000_WRITE_REG(&adapter->hw, PBA, pba); E1000_WRITE_REG(&adapter->hw, PBA, pba);
/* flow control settings */
adapter->hw.fc_high_water = pba - E1000_FC_HIGH_DIFF;
adapter->hw.fc_low_water = pba - E1000_FC_LOW_DIFF;
adapter->hw.fc_pause_time = E1000_FC_PAUSE_TIME;
adapter->hw.fc_send_xon = 1;
adapter->hw.fc = adapter->hw.original_fc; adapter->hw.fc = adapter->hw.original_fc;
e1000_reset_hw(&adapter->hw); e1000_reset_hw(&adapter->hw);
if(adapter->hw.mac_type >= e1000_82544) if(adapter->hw.mac_type >= e1000_82544)
E1000_WRITE_REG(&adapter->hw, WUC, 0); E1000_WRITE_REG(&adapter->hw, WUC, 0);
...@@ -621,13 +627,6 @@ e1000_sw_init(struct e1000_adapter *adapter) ...@@ -621,13 +627,6 @@ e1000_sw_init(struct e1000_adapter *adapter)
e1000_init_eeprom_params(hw); e1000_init_eeprom_params(hw);
/* flow control settings */
hw->fc_high_water = E1000_FC_HIGH_THRESH;
hw->fc_low_water = E1000_FC_LOW_THRESH;
hw->fc_pause_time = E1000_FC_PAUSE_TIME;
hw->fc_send_xon = 1;
if((hw->mac_type == e1000_82541) || if((hw->mac_type == e1000_82541) ||
(hw->mac_type == e1000_82547) || (hw->mac_type == e1000_82547) ||
(hw->mac_type == e1000_82541_rev_2) || (hw->mac_type == e1000_82541_rev_2) ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment