29 janvier 2015 14:30 "Jonathan Gray" <j...@jsg.id.au> a écrit: 
> On Thu, Jan 29, 2015 at 12:54:34PM +0000, Comète wrote:
> 
>> Hi,
>> 
>> I use OpenBSD 5.6 GENERIC.MP (amd64) on a Thinkpad T440. I often use the
>> suspend state and i've noticed that after each suspend, in the next 5 minutes
>> after resuming, my network interface (em0) looses connection during about 1 
>> or
>> 2 minutes and then reconnect and so on, many times...
>> As you can see, the
>> dmesg shows many em0 watchdog timeouts.
>> I've tried to suspend when the laptop
>> is on the dock and without it, but the problem is the same. No problem with
>> the NIC when i don't suspend.
>> 
>> I use apmd_flags="-C" in /etc/rc.conf.local
>> Any idea ?
> 
> This may be solved by the following commit in -current:
> 
> revision 1.81
> date: 2014/11/05 15:30:17; author: claudio; state: Exp; lines: +90 -1; 
> commitid: qjAWexfO9LNS8Qo2;
> Implement yet another workaround for the k1 em(4)'s. This time for
> the i218 which is used in many modern laptops like the X240. This
> seems to stop the watchdog timeouts triggered by heavy traffic on
> such systems.
> Tested by myself, phessler, blambert and Donovan Watteau
> OK deraadt, brad
> 
> Index: if_em_hw.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/if_em_hw.c,v
> retrieving revision 1.80
> diff -u -p -r1.80 if_em_hw.c
> --- if_em_hw.c 22 Jul 2014 13:12:11 -0000 1.80
> +++ if_em_hw.c 29 Jan 2015 13:19:11 -0000
> @@ -163,6 +163,7 @@ int32_t em_lv_phy_workarounds_ich8lan(s
> int32_t em_link_stall_workaround_hv(struct em_hw *);
> int32_t em_k1_gig_workaround_hv(struct em_hw *, boolean_t);
> int32_t em_k1_workaround_lv(struct em_hw *);
> +int32_t em_k1_workaround_lpt_lp(struct em_hw *, boolean_t);
> int32_t em_configure_k1_ich8lan(struct em_hw *, boolean_t);
> void em_gate_hw_phy_config_ich8lan(struct em_hw *, boolean_t);
> int32_t em_access_phy_wakeup_reg_bm(struct em_hw *, uint32_t,
> @@ -3709,6 +3710,16 @@ em_check_for_link(struct em_hw *hw)
> if (ret_val)
> return ret_val;
> }
> + /* Work-around I218 hang issue */
> + if ((hw->device_id == E1000_DEV_ID_PCH_LPTLP_I218_LM) ||
> + (hw->device_id == E1000_DEV_ID_PCH_LPTLP_I218_V) ||
> + (hw->device_id == E1000_DEV_ID_PCH_I218_LM3) ||
> + (hw->device_id == E1000_DEV_ID_PCH_I218_V3)) {
> + ret_val = em_k1_workaround_lpt_lp(hw,
> + hw->icp_xxxx_is_link_up);
> + if (ret_val)
> + return ret_val;
> + }
> 
> /*
> * Check if there was DownShift, must be checked
> @@ -10185,6 +10196,84 @@ em_k1_workaround_lv(struct em_hw *hw)
> 
> return E1000_SUCCESS;
> }
> +
> +/**
> + * em_k1_workaround_lpt_lp - K1 workaround on Lynxpoint-LP
> + *
> + * When K1 is enabled for 1Gbps, the MAC can miss 2 DMA completion 
> indications
> + * preventing further DMA write requests. Workaround the issue by disabling
> + * the de-assertion of the clock request when in 1Gbps mode.
> + * Also, set appropriate Tx re-transmission timeouts for 10 and 100Half link
> + * speeds in order to avoid Tx hangs.
> + **/
> +int32_t
> +em_k1_workaround_lpt_lp(struct em_hw *hw, boolean_t link)
> +{
> + uint32_t fextnvm6 = E1000_READ_REG(hw, FEXTNVM6);
> + uint32_t status = E1000_READ_REG(hw, STATUS);
> + int32_t ret_val = E1000_SUCCESS;
> + uint16_t reg;
> +
> + if (link && (status & E1000_STATUS_SPEED_1000)) {
> + ret_val = em_read_kmrn_reg(hw, E1000_KMRNCTRLSTA_K1_CONFIG,
> + &reg);
> + if (ret_val)
> + return ret_val;
> +
> + ret_val = em_write_kmrn_reg(hw, E1000_KMRNCTRLSTA_K1_CONFIG,
> + reg & ~E1000_KMRNCTRLSTA_K1_ENABLE);
> + if (ret_val)
> + return ret_val;
> +
> + usec_delay(10);
> +
> + E1000_WRITE_REG(hw, FEXTNVM6,
> + fextnvm6 | E1000_FEXTNVM6_REQ_PLL_CLK);
> +
> + ret_val = em_write_kmrn_reg(hw, E1000_KMRNCTRLSTA_K1_CONFIG,
> + reg);
> + } else {
> + /* clear FEXTNVM6 bit 8 on link down or 10/100 */
> + fextnvm6 &= ~E1000_FEXTNVM6_REQ_PLL_CLK;
> +
> + if (!link || ((status & E1000_STATUS_SPEED_100) &&
> + (status & E1000_STATUS_FD)))
> + goto update_fextnvm6;
> +
> + ret_val = em_read_phy_reg(hw, I217_INBAND_CTRL, &reg);
> + if (ret_val)
> + return ret_val;
> +
> + /* Clear link status transmit timeout */
> + reg &= ~I217_INBAND_CTRL_LINK_STAT_TX_TIMEOUT_MASK;
> +
> + if (status & E1000_STATUS_SPEED_100) {
> + /* Set inband Tx timeout to 5x10us for 100Half */
> + reg |= 5 << I217_INBAND_CTRL_LINK_STAT_TX_TIMEOUT_SHIFT;
> +
> + /* Do not extend the K1 entry latency for 100Half */
> + fextnvm6 &= ~E1000_FEXTNVM6_ENABLE_K1_ENTRY_CONDITION;
> + } else {
> + /* Set inband Tx timeout to 50x10us for 10Full/Half */
> + reg |= 50 <<
> + I217_INBAND_CTRL_LINK_STAT_TX_TIMEOUT_SHIFT;
> +
> + /* Extend the K1 entry latency for 10 Mbps */
> + fextnvm6 |= E1000_FEXTNVM6_ENABLE_K1_ENTRY_CONDITION;
> + }
> +
> + ret_val = em_write_phy_reg(hw, I217_INBAND_CTRL, reg);
> + if (ret_val)
> + return ret_val;
> +
> +update_fextnvm6:
> + E1000_WRITE_REG(hw, FEXTNVM6, fextnvm6);
> + }
> +
> + return ret_val;
> +
> +}
> +
> 
> /***************************************************************************
> * e1000_gate_hw_phy_config_ich8lan - disable PHY config via hardware
> Index: if_em_hw.h
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/if_em_hw.h,v
> retrieving revision 1.60
> diff -u -p -r1.60 if_em_hw.h
> --- if_em_hw.h 10 Mar 2014 04:09:53 -0000 1.60
> +++ if_em_hw.h 29 Jan 2015 13:19:11 -0000
> @@ -987,8 +987,9 @@ struct em_ffvt_entry {
> #define E1000_MDIC 0x00020 /* MDI Control - RW */
> #define E1000_MDICNFG 0x00E04 /* MDI Config - RW */
> #define E1000_SCTL 0x00024 /* SerDes Control - RW */
> -#define E1000_FEXTNVM4 0x00024 /* Future Extended NVM 4 - RW */
> #define E1000_FEXTNVM 0x00028 /* Future Extended NVM register */
> +#define E1000_FEXTNVM4 0x00024 /* Future Extended NVM 4 - RW */
> +#define E1000_FEXTNVM6 0x00010 /* Future Extended NVM 6 - RW */
> #define E1000_FCAL 0x00028 /* Flow Control Address Low - RW */
> #define E1000_FCAH 0x0002C /* Flow Control Address High -RW */
> #define E1000_FCT 0x00030 /* Flow Control Type - RW */
> @@ -1215,8 +1216,9 @@ struct em_ffvt_entry {
> #define E1000_82542_FLA E1000_FLA
> #define E1000_82542_MDIC E1000_MDIC
> #define E1000_82542_SCTL E1000_SCTL
> -#define E1000_82542_FEXTNVM4 E1000_FEXTNVM4
> #define E1000_82542_FEXTNVM E1000_FEXTNVM
> +#define E1000_82542_FEXTNVM4 E1000_FEXTNVM4
> +#define E1000_82542_FEXTNVM6 E1000_FEXTNVM6
> #define E1000_82542_FCAL E1000_FCAL
> #define E1000_82542_FCAH E1000_FCAH
> #define E1000_82542_FCT E1000_FCT
> @@ -1430,6 +1432,9 @@ struct em_ffvt_entry {
> #define E1000_FEXTNVM4_BEACON_DURATION_8USEC 0x7
> #define E1000_FEXTNVM4_BEACON_DURATION_16USEC 0x3
> 
> +#define E1000_FEXTNVM6_REQ_PLL_CLK 0x00000100
> +#define E1000_FEXTNVM6_ENABLE_K1_ENTRY_CONDITION 0x00000200
> +
> /* Statistics counters collected by the MAC */
> struct em_hw_stats {
> uint64_t crcerrs;
> @@ -3719,6 +3724,11 @@ union ich8_hws_flash_regacc {
> #define HV_M_STATUS_SPEED_MASK 0x0300
> #define HV_M_STATUS_SPEED_1000 0x0200
> #define HV_M_STATUS_LINK_UP 0x0040
> +
> +/* Inband Control */
> +#define I217_INBAND_CTRL PHY_REG(770, 18)
> +#define I217_INBAND_CTRL_LINK_STAT_TX_TIMEOUT_MASK 0x3F00
> +#define I217_INBAND_CTRL_LINK_STAT_TX_TIMEOUT_SHIFT 8
> 
> /* PHY Low Power Idle Control */
> #define I82579_LPI_CTRL PHY_REG(772, 20)

Nice, i will try current and report if it's fixed or not.

Thanks a lot !

Morgan

Reply via email to