e1000e: ensure the link state is correct for serdes links
Subsystems (2)
PATCH 4/9 e1000e: ensure the link state is correct for serdes links
From: Bruce Allan <[email protected]>
This patch ensures that the link state (as reported in mac->serdes_has_link) will transition to false when autoneg fails to complete but valid codewords were detected.
---
drivers/net/e1000e/82571.c | 76 ++++++++++++++++++++++++++++---------------- 1 files changed, 48 insertions(+), 28 deletions(-)
drivers/net/e1000e/82571.c +48 -28
@@ -1356,8 +1356,20 @@ static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw)* e1000_check_for_serdes_link_82571 - Check for link (Serdes) * @hw: pointer to the HW structure * -* Checks for link up on the hardware. If link is not up and we have -* a signal, then we need to force link up. +* Reports the link state as up or down. +* +* If autonegotiation is supported by the link partner, the link state is +* determined by the result of autonegotiation. This is the most likely case. +* If autonegotiation is not supported by the link partner, and the link +* has a valid signal, force the link up. +* +* The link state is represented internally here by 4 states: +* +* 1) down +* 2) autoneg_progress +* 3) autoneg_complete (the link sucessfully autonegotiated) +* 4) forced_up (the link has been forced up, it did not autonegotiate) +* **/ static s32 e1000_check_for_serdes_link_82571 (struct e1000_hw *hw) {
@@ -1383,6 +1395,7 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw)*/ mac->serdes_link_state = e1000_serdes_link_autoneg_progress; + mac->serdes_has_link = false;e_dbg ("AN_UP -> AN_PROG\n" ); }break ;
@@ -1397,57 +1410,64 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw)if (rxcw &E1000_RXCW_C ) {/* Enable autoneg, and unforce link up */ ew32 (TXCW , mac->txcw); -ew32 (CTRL , - (ctrl & ~E1000_CTRL_SLU )); +ew32 (CTRL , (ctrl & ~E1000_CTRL_SLU )); mac->serdes_link_state = e1000_serdes_link_autoneg_progress; + mac->serdes_has_link = false;e_dbg ("FORCED_UP -> AN_PROG\n" ); }break ;case e1000_serdes_link_autoneg_progress: -/* -* If the LU bit is set in the STATUS register, -* autoneg has completed sucessfully. If not, -* try foring the link because the far end may be -* available but not capable of autonegotiation. -*/ -if (status &E1000_STATUS_LU ) { - mac->serdes_link_state = - e1000_serdes_link_autoneg_complete; -e_dbg ("AN_PROG -> AN_UP\n" ); +if (rxcw &E1000_RXCW_C ) { +/* +* We received /C/ ordered sets, meaning the +* link partner has autonegotiated, and we can +* trust the Link Up (LU) status bit. +*/ +if (status &E1000_STATUS_LU ) { + mac->serdes_link_state = + e1000_serdes_link_autoneg_complete; +e_dbg ("AN_PROG -> AN_UP\n" ); + mac->serdes_has_link = true; + }else { +/* Autoneg completed, but failed. */ + mac->serdes_link_state = + e1000_serdes_link_down; +e_dbg ("AN_PROG -> DOWN\n" ); + } }else {/* -* Disable autoneg, force link up and -* full duplex, and change state to forced +* The link partner did not autoneg. +* Force link up and full duplex, and change +* state to forced. */ -ew32 (TXCW , - (mac->txcw & ~E1000_TXCW_ANE )); +ew32 (TXCW , (mac->txcw & ~E1000_TXCW_ANE )); ctrl |= (E1000_CTRL_SLU |E1000_CTRL_FD );ew32 (CTRL , ctrl);/* Configure Flow Control after link up. */ - ret_val = -e1000e_config_fc_after_link_up (hw); + ret_val =e1000e_config_fc_after_link_up (hw);if (ret_val) {e_dbg ("Error config flow control\n" );break ; } mac->serdes_link_state = e1000_serdes_link_forced_up; + mac->serdes_has_link = true;e_dbg ("AN_PROG -> FORCED_UP\n" ); } - mac->serdes_has_link = true;break ;case e1000_serdes_link_down:default : -/* The link was down but the receiver has now gained +/* +* The link was down but the receiver has now gained * valid sync, so lets see if we can bring the link -* up. */ +* up. +*/ ew32 (TXCW , mac->txcw); -ew32 (CTRL , - (ctrl & ~E1000_CTRL_SLU )); +ew32 (CTRL , (ctrl & ~E1000_CTRL_SLU )); mac->serdes_link_state = e1000_serdes_link_autoneg_progress;e_dbg ("DOWN -> AN_PROG\n" );
@@ -1460,9 +1480,9 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw)e_dbg ("ANYSTATE -> DOWN\n" ); }else {/* -* We have sync, and can tolerate one -* invalid (IV) codeword before declaring -* link down, so reread to look again +* We have sync, and can tolerate one invalid (IV) +* codeword before declaring link down, so reread +* to look again. */ udelay (10 ); rxcw =er32 (RXCW );
PATCH 5/9 e1000e: enable new 82567V-3 device
From: Bruce Allan <[email protected]>
This new PCI device ID is for a new combination of MAC and PHY both of which already have supporting code in the driver, just not yet in this combination. During validation of the device, an intermittent issue was discovered with waking it from a suspended state which can be resolved with the pre-existing workaround to disable gigabit speed prior to suspending.
---
drivers/net/e1000e/hw.h | 1 + drivers/net/e1000e/ich8lan.c | 1 + drivers/net/e1000e/netdev.c | 1 + 3 files changed, 3 insertions(+), 0 deletions(-)
drivers/net/e1000e/hw.h +1 -0
@@ -356,6 +356,7 @@ enum e1e_registers {#define E1000_DEV_ID_80003ES2LAN_COPPER_SPT 0x10BA#define E1000_DEV_ID_80003ES2LAN_SERDES_SPT 0x10BB +#define E1000_DEV_ID_ICH8_82567V_3 0x1501#define E1000_DEV_ID_ICH8_IGP_M_AMT 0x1049#define E1000_DEV_ID_ICH8_IGP_AMT 0x104A#define E1000_DEV_ID_ICH8_IGP_C 0x104B
drivers/net/e1000e/ich8lan.c +1 -0
@@ -3204,6 +3204,7 @@ void e1000e_disable_gig_wol_ich8lan(struct e1000_hw *hw)u32 phy_ctrl;switch (hw->mac.type) { +case e1000_ich8lan:case e1000_ich9lan:case e1000_ich10lan:case e1000_pchlan:
drivers/net/e1000e/netdev.c +1 -0
@@ -5342,6 +5342,7 @@ static struct pci_device_id e1000_pci_tbl[] = { { PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH8_IGP_C), board_ich8lan }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH8_IGP_M), board_ich8lan }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH8_IGP_M_AMT), board_ich8lan }, + { PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH8_82567V_3), board_ich8lan }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH9_IFE), board_ich9lan }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH9_IFE_G), board_ich9lan },
Re: [net-next-2.6 PATCH 5/9] e1000e: enable new 82567V-3 device
From: Jeff Kirsher <[email protected]>
Date: Tue, 01 Dec 2009 17:50:31 -0800
Quoted 10 lines
From: Bruce Allan <[email protected]>
This new PCI device ID is for a new combination of MAC and PHY both of which already have supporting code in the driver, just not yet in this combination. During validation of the device, an intermittent issue was discovered with waking it from a suspended state which can be resolved with the pre-existing workaround to disable gigabit speed prior to suspending.
Signed-off-by Bruce Allan <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
Applied.
PATCH 6/9 e1000e: comment corrections
In reply to Jeff KirsherFrom: Bruce Allan <[email protected]>
---
drivers/net/e1000e/82571.c | 2 +- drivers/net/e1000e/ich8lan.c | 5 ++--- drivers/net/e1000e/lib.c | 5 +---- drivers/net/e1000e/phy.c | 14 +++++++------- 4 files changed, 11 insertions(+), 15 deletions(-)
drivers/net/e1000e/82571.c +1 -1
@@ -1551,7 +1551,7 @@ bool e1000e_get_laa_state_82571(struct e1000_hw *hw)* @hw: pointer to the HW structure * @state: enable/disable locally administered address * -* Enable/Disable the current locally administers address state. +* Enable/Disable the current locally administered address state. **/ void e1000e_set_laa_state_82571 (struct e1000_hw *hw,bool state) {
drivers/net/e1000e/ich8lan.c +2 -3
@@ -1747,7 +1747,7 @@ static s32 e1000_flash_cycle_init_ich8lan(struct e1000_hw *hw)if (hsfsts.hsf_status.flcinprog ==0 ) {/* * There is no cycle running at present, -* so we can start a cycle +* so we can start a cycle. * Begin by setting Flash Cycle Done. */ hsfsts.hsf_status.flcdone =1 ;
@@ -1755,7 +1755,7 @@ static s32 e1000_flash_cycle_init_ich8lan(struct e1000_hw *hw) ret_val =0 ; }else {/* -* otherwise poll for sometime so the current +* Otherwise poll for sometime so the current * cycle has a chance to end before giving up. */ for (i =0 ; i <ICH_FLASH_READ_COMMAND_TIMEOUT ; i++) {
@@ -2645,7 +2645,6 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) ctrl |=E1000_CTRL_PHY_RST ; } ret_val =e1000_acquire_swflag_ich8lan (hw); -/* Whether or not the swflag was acquired, we need to reset the part */ e_dbg ("Issuing a global reset to ich8lan\n" );ew32 (CTRL , (ctrl |E1000_CTRL_RST ));msleep (20 );
drivers/net/e1000e/lib.c +1 -4
@@ -1086,7 +1086,6 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw)* 1 | 1 | 0 | 0 | e1000_fc_none * 1 | 1 | 0 | 1 | e1000_fc_rx_pause * -* * Are both PAUSE bits set to 1? If so, this implies * Symmetric Flow Control is enabled at both ends. The * ASM_DIR bits are irrelevant per the spec.
@@ -1124,7 +1123,6 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw)* PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result *-------|---------|-------|---------|-------------------- * 0 | 1 | 1 | 1 | e1000_fc_tx_pause -* */ else if (!(mii_nway_adv_reg & NWAY_AR_PAUSE) && (mii_nway_adv_reg & NWAY_AR_ASM_DIR) &&
@@ -1140,7 +1138,6 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw)* PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result *-------|---------|-------|---------|-------------------- * 1 | 1 | 0 | 1 | e1000_fc_rx_pause -* */ else if ((mii_nway_adv_reg & NWAY_AR_PAUSE) && (mii_nway_adv_reg & NWAY_AR_ASM_DIR) &&
@@ -2363,7 +2360,7 @@ static s32 e1000_mng_write_cmd_header(struct e1000_hw *hw, }/** -* e1000_mng_host_if_write - Writes to the manageability host interface +* e1000_mng_host_if_write - Write to the manageability host interface * @hw: pointer to the HW structure * @buffer: pointer to the host interface buffer * @length: size of the buffer
drivers/net/e1000e/phy.c +7 -7
@@ -153,10 +153,10 @@ s32 e1000e_get_phy_id(struct e1000_hw *hw) goto out;/* -* If the PHY ID is still unknown, we may have an 82577i -* without link. We will try again after setting Slow -* MDIC mode. No harm in trying again in this case since -* the PHY ID is unknown at this point anyway +* If the PHY ID is still unknown, we may have an 82577 +* without link. We will try again after setting Slow MDIC +* mode. No harm in trying again in this case since the PHY +* ID is unknown at this point anyway. */ ret_val = phy->ops.acquire (hw);if (ret_val)
@@ -1744,7 +1744,7 @@ out:* The automatic gain control (agc) normalizes the amplitude of the * received signal, adjusting for the attenuation produced by the * cable. By reading the AGC registers, which represent the -* combination of course and fine gain value, the value can be put +* combination of coarse and fine gain value, the value can be put * into a lookup table to obtain the approximate cable length * for each channel. **/
@@ -1769,7 +1769,7 @@ s32 e1000e_get_cable_length_igp_2(struct e1000_hw *hw)/* * Getting bits 15:9, which represent the combination of -* course and fine gain values. The result is a number +* coarse and fine gain values. The result is a number * that can be put into the lookup table to obtain the * approximate cable length. */
@@ -2511,7 +2511,7 @@ static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset, ret_val =e1000e_read_phy_reg_mdic (hw,BM_WUC_DATA_OPCODE , data); }else { -/* Read the page 800 value using opcode 0x12 */ +/* Write the page 800 value using opcode 0x12 */ ret_val =e1000e_write_phy_reg_mdic (hw,BM_WUC_DATA_OPCODE , *data); }
Re: [net-next-2.6 PATCH 6/9] e1000e: comment corrections
From: Jeff Kirsher <[email protected]>
Date: Tue, 01 Dec 2009 17:51:11 -0800
Quoted 4 lines
From: Bruce Allan <[email protected]>
Signed-off-by Bruce Allan <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
Applied.
From: Jeff Kirsher <[email protected]>
Date: Tue, 01 Dec 2009 17:49:51 -0800
Quoted 8 lines
From: Bruce Allan <[email protected]>
This patch ensures that the link state (as reported in
mac->serdes_has_link) will transition to false when autoneg fails to complete but valid codewords were detected.Signed-off-by Bruce Allan <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
Applied.