e1000e: partial revert of 3ec2a2b8 plus FC workraround for 82577/8
Subsystems (2)
PATCH 1/6 e1000e: partial revert of 3ec2a2b8 plus FC workraround for 82577/8
From: Bruce Allan <[email protected]>
Commit 3ec2a2b80f3eb53851fe4cef9e65b5d33376ef89 broke Tx/Rx when using jumbo frames on certain parts (i.e. only PAUSE frames could be exchanged once the high water mark was reached preventing normal packet traffic). This patch reverts the breakage and sets appropriate high and low water marks of the Rx FIFO for 82577/82578 which require a workaround due to a flow control issue in hardware.
---
drivers/net/e1000e/e1000.h | 2 ++ drivers/net/e1000e/ich8lan.c | 1 + drivers/net/e1000e/netdev.c | 41 +++++++++++++++++++++++++++++------------ 3 files changed, 32 insertions(+), 12 deletions(-)
drivers/net/e1000e/e1000.h +2 -0
@@ -141,6 +141,8 @@ struct e1000_info;#define HV_TNCRS_UPPER PHY_REG(778, 29)/* Transmit with no CRS */ #define HV_TNCRS_LOWER PHY_REG(778, 30) +#define E1000_FCRTV_PCH 0x05F40/* PCH Flow Control Refresh Timer Value */ +/* BM PHY Copper Specific Status */ #define BM_CS_STATUS 17#define BM_CS_STATUS_LINK_UP 0x0400
drivers/net/e1000e/ich8lan.c +1 -0
@@ -3558,6 +3558,7 @@ struct e1000_info e1000_pch_info = { | FLAG_HAS_AMT |FLAG_HAS_FLASH |FLAG_HAS_JUMBO_FRAMES + |FLAG_DISABLE_FC_PAUSE_TIME /* errata */ | FLAG_APME_IN_WUC, .pba = 26, .max_hw_frame_size = 4096,
drivers/net/e1000e/netdev.c +29 -12
60 lines not on this page · raw message
PATCH 2/6 e1000e: read of PHY register may access wrong page on 82578
From: Bruce Allan <[email protected]>
Remove unnecessary workaround that mistakenly does not perform a page select operation for PHY registers 29 and 30 (assuming these are the PHY debug port address and data registers) on 82578 which can cause reads of the Transmit with No Carrier Sense statistics register on page 778 to be read from an incorrect page. Also error out if the page select operation fails.
---
drivers/net/e1000e/phy.c | 46 ++++++++++++++++++++++------------------------ 1 files changed, 22 insertions(+), 24 deletions(-)
drivers/net/e1000e/phy.c +22 -24
@@ -2658,19 +2658,18 @@ static s32 __e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data, page =0 ;if (reg >MAX_PHY_MULTI_PAGE_REG ) { -if ((hw->phy.type != e1000_phy_82578) || - ((reg !=I82578_ADDR_REG ) && - (reg !=I82578_ADDR_REG +1 ))) { -u32 phy_addr = hw->phy.addr; +u32 phy_addr = hw->phy.addr; - hw->phy.addr =1 ; + hw->phy.addr =1 ; -/* Page is shifted left, PHY expects (page x 32) */ - ret_val =e1000e_write_phy_reg_mdic (hw, -IGP01E1000_PHY_PAGE_SELECT , - (page <<IGP_PAGE_SHIFT )); - hw->phy.addr = phy_addr; - } +/* Page is shifted left, PHY expects (page x 32) */ + ret_val =e1000e_write_phy_reg_mdic (hw, +IGP01E1000_PHY_PAGE_SELECT , + (page <<IGP_PAGE_SHIFT )); + hw->phy.addr = phy_addr; + +if (ret_val) + goto out; } ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg,
@@ -2678,7 +2677,7 @@ static s32 __e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data, out:/* Revert to MDIO fast mode, if applicable */ if ((hw->phy.type == e1000_phy_82577) && in_slow_mode) - ret_val =e1000_set_mdio_slow_mode_hv (hw, false); + ret_val |=e1000_set_mdio_slow_mode_hv (hw, false);if (!locked) hw->phy.ops.release_phy (hw);
@@ -2784,19 +2783,18 @@ static s32 __e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data, }if (reg >MAX_PHY_MULTI_PAGE_REG ) { -if ((hw->phy.type != e1000_phy_82578) || - ((reg !=I82578_ADDR_REG ) && - (reg !=I82578_ADDR_REG +1 ))) { -u32 phy_addr = hw->phy.addr; +u32 phy_addr = hw->phy.addr; - hw->phy.addr =1 ; + hw->phy.addr =1 ; -/* Page is shifted left, PHY expects (page x 32) */ - ret_val =e1000e_write_phy_reg_mdic (hw, -IGP01E1000_PHY_PAGE_SELECT , - (page <<IGP_PAGE_SHIFT )); - hw->phy.addr = phy_addr; - } +/* Page is shifted left, PHY expects (page x 32) */ + ret_val =e1000e_write_phy_reg_mdic (hw, +IGP01E1000_PHY_PAGE_SELECT , + (page <<IGP_PAGE_SHIFT )); + hw->phy.addr = phy_addr; + +if (ret_val) + goto out; } ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg,
@@ -2805,7 +2803,7 @@ static s32 __e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data, out:/* Revert to MDIO fast mode, if applicable */ if ((hw->phy.type == e1000_phy_82577) && in_slow_mode) - ret_val =e1000_set_mdio_slow_mode_hv (hw, false); + ret_val |=e1000_set_mdio_slow_mode_hv (hw, false);if (!locked) hw->phy.ops.release_phy (hw);
PATCH 3/6 e1000e: set flow control thresholds properly after enabling/disabling pause
In reply to Jeff KirsherFrom: Bruce Allan <[email protected]>
When flow control (pause) parameters were changed via ethtool (i.e. enabled or disabled), the newly calculated thresholds were not being written to the device for non-fiber media.
---
drivers/net/e1000e/ethtool.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-)
drivers/net/e1000e/ethtool.c +10 -2
@@ -327,10 +327,18 @@ static int e1000_set_pauseparam(struct net_device *netdev, hw->fc.current_mode = hw->fc.requested_mode; - retval = ((hw->phy.media_type == e1000_media_type_fiber) ? - hw->mac.ops.setup_link (hw) :e1000e_force_mac_fc (hw)); +if (hw->phy.media_type == e1000_media_type_fiber) { + retval = hw->mac.ops.setup_link (hw); +/* implicit goto out */ + }else { + retval =e1000e_force_mac_fc (hw); +if (retval) + goto out; +e1000e_set_fc_watermarks (hw); + } } +out:clear_bit (__E1000_RESETTING, &adapter->state);return retval; }
PATCH 4/6 e1000e: add Tx timeout factor for 100Mbps
In reply to Jeff KirsherFrom: Bruce Allan <[email protected]>
On some devices (e.g. 82578) not having a Tx timeout factor when linked at 100Mbps can cause false reports of hardware hangs on busy hubs.
---
drivers/net/e1000e/netdev.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/e1000e/netdev.c +1 -1
@@ -3627,7 +3627,7 @@ static void e1000_watchdog_task(struct work_struct *work)case SPEED_100 : txb2b =0 ; netdev->tx_queue_len =100 ; -/* maybe add some timeout factor ? */ + adapter->tx_timeout_factor =10 ;break ; }
PATCH 5/6 e1000e: flow control thresholds not correct when changing mtu
In reply to Jeff KirsherFrom: Bruce Allan <[email protected]>
When changing MTU, save it off prior to resetting otherwise the flow control thresholds may be miscalculated.
---
drivers/net/e1000e/netdev.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
drivers/net/e1000e/netdev.c +3 -4
@@ -4305,8 +4305,10 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)while (test_and_set_bit (__E1000_RESETTING, &adapter->state))msleep (1 ); -/* e1000e_down has a dependency on max_frame_size */ +/* e1000e_down -> e1000e_reset dependent on max_frame_size & mtu */ adapter->max_frame_size = max_frame; +e_info ("changing MTU from %d to %d\n" , netdev->mtu, new_mtu); + netdev->mtu = new_mtu;if (netif_running (netdev))e1000e_down (adapter);
@@ -4336,9 +4338,6 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu) adapter->rx_buffer_len =ETH_FRAME_LEN +VLAN_HLEN +ETH_FCS_LEN ; -e_info ("changing MTU from %d to %d\n" , netdev->mtu, new_mtu); - netdev->mtu = new_mtu; -if (netif_running (netdev))e1000e_up (adapter);else
PATCH 6/6 e1000e: remove unnecessary 82577 workaround causing link issues
In reply to Jeff KirsherFrom: Bruce Allan <[email protected]>
A workaround for pre-release versions of 82577 is causing link issues on some switches. The workaround is no longer needed on production parts so remove it.
---
drivers/net/e1000e/phy.c | 10 ---------- 1 files changed, 0 insertions(+), 10 deletions(-)
drivers/net/e1000e/phy.c +0 -10
@@ -71,7 +71,6 @@ static const u16 e1000_igp_2_cable_length_table[] =#define I82577_CFG_ASSERT_CRS_ON_TX (1 << 15)#define I82577_CFG_ENABLE_DOWNSHIFT (3 << 10)/* auto downshift 100/10 */ #define I82577_CTRL_REG 23 -#define I82577_CTRL_DOWNSHIFT_MASK (7 << 10)/* 82577 specific PHY registers */ #define I82577_PHY_CTRL_2 18
@@ -660,15 +659,6 @@ s32 e1000_copper_link_setup_82577(struct e1000_hw *hw) phy_data |=I82577_CFG_ENABLE_DOWNSHIFT ; ret_val = phy->ops.write_phy_reg (hw,I82577_CFG_REG , phy_data); -if (ret_val) - goto out; - -/* Set number of link attempts before downshift */ - ret_val = phy->ops.read_phy_reg (hw,I82577_CTRL_REG , &phy_data); -if (ret_val) - goto out; - phy_data &= ~I82577_CTRL_DOWNSHIFT_MASK ; - ret_val = phy->ops.write_phy_reg (hw,I82577_CTRL_REG , phy_data); out:return ret_val;
David Miller
maintainerAll 6 patches applied, but this is way too much to change this late in the -rcX series. I know you were not feeling well last week and therefore you have some things to catch up with, but that doesn't change the situation.
You've been warned :-)