From patchwork Thu Jan 3 21:28:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan-Marek Glogowski X-Patchwork-Id: 1020517 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=osuosl.org (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=fbihome.de Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43W1X5556Xz9s3l for ; Fri, 4 Jan 2019 08:39:17 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id BBF188143E; Thu, 3 Jan 2019 21:39:15 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1waTehs743VD; Thu, 3 Jan 2019 21:39:12 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 9D6A381FD8; Thu, 3 Jan 2019 21:39:12 +0000 (UTC) X-Original-To: intel-wired-lan@osuosl.org Delivered-To: intel-wired-lan@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 0BEF11BF46F for ; Thu, 3 Jan 2019 21:39:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 0796D81FD8 for ; Thu, 3 Jan 2019 21:39:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pxvzcinFduZC for ; Thu, 3 Jan 2019 21:39:10 +0000 (UTC) X-Greylist: delayed 00:10:05 by SQLgrey-1.7.6 Received: from ironboyv.h-da.de (ironboyv.h-da.de [141.100.10.230]) by whitealder.osuosl.org (Postfix) with ESMTPS id 7BC0981135 for ; Thu, 3 Jan 2019 21:39:08 +0000 (UTC) IronPort-SDR: yokBBXHPFpGibiLFFiDB/UgC0olZH+SezebtWKHtGu9vOtytiYghw9OeTgBpQAUc7NflxWRt2K 8dR8BRvpI1E6HiY/e7SQi0CwUAGeTgvLRGtPg3LBUEGiNt09QKgPRC0lm/R7wyqu757VrBKzLQ Z+Wsa0Tc1sJch8Z/vlBe2Ae+L2wehoo3jCKrfEOON5wRRapHQ/c7auIP/N8cKkoGFgxf0dzAC5 2pMifFo9XxyMytJPUX9rDqu5OgOy3fO6n82eawIrK428EqzCWLkNvRYQAy48St6w9WDWq6AR6J UeU= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2GEDQCyfS5c/2soZI1jHAEBAQQBAQcEAQGBZYIEZgNtEieDf5QBUgaBCAiDfpYGJQ0Jhj4iOBIBAwEBAgEBAgICaRwMgnhNawEBAQEBASMCDWMBByIEegQDAQIDAiYCKicbBgIBAYMeAYF0EQuYRI50fDMaAoQRAQMHhW0FgQuLJQ8XeIEHgREnDIV9AwEBgTcLgySCVwKJQwqGKTaBCZAWCYEWhXyGNIQdHooHBRQDh0OOWo0sIiiBLk0kFIMngicXiF6FQD4zAYdhB4JGAQE X-IPAS-Result: A2GEDQCyfS5c/2soZI1jHAEBAQQBAQcEAQGBZYIEZgNtEieDf5QBUgaBCAiDfpYGJQ0Jhj4iOBIBAwEBAgEBAgICaRwMgnhNawEBAQEBASMCDWMBByIEegQDAQIDAiYCKicbBgIBAYMeAYF0EQuYRI50fDMaAoQRAQMHhW0FgQuLJQ8XeIEHgREnDIV9AwEBgTcLgySCVwKJQwqGKTaBCZAWCYEWhXyGNIQdHooHBRQDh0OOWo0sIiiBLk0kFIMngicXiF6FQD4zAYdhB4JGAQE Received: from unknown (HELO mail.fbihome.de) ([141.100.40.107]) by ironboyv.h-da.de with ESMTP; 03 Jan 2019 22:29:01 +0100 Received: from [172.16.2.202] (unknown [194.113.41.246]) by mail.fbihome.de (Postfix) with ESMTPSA id 17828421AC for ; Thu, 3 Jan 2019 22:28:19 +0100 (CET) From: Jan-Marek Glogowski Openpgp: preference=signencrypt Autocrypt: addr=glogow@fbihome.de; prefer-encrypt=mutual; keydata= mQGiBEDrcVsRBACdQcj/8k2CSP+5frReJ2y7AAs4+3nBKPg08yOAsdcyQJAPbRGO8r1wJ6lb fnJI8+y8uvmsdQ83P4262EqpShHCpI7ioPUopkAKW5dWp/NM+YjYK0m3kMI03HlHeHKAMjyc pUmFu0sHktbDwrDUxTksgkcRHU1bbcyVuR7yaPbpdwCgoUn/Fthp7RItKuCLktKop6BcQbsE AIXM5gjo5C6l7I2tXFuO1+4boEwmL2WnGFEawFB4gBaBBJ6zUHzikdZW/5WHCUalSKRd38Bi PW2buoftYwIjuoRj30+YEVZ/2/oZsREcIazUeZzXaP2Emr/2rRNugj5KDPfgh6v6F9+Ravkw z6Bixv1lti7DoP32c7oDwggJEH6LA/0UVRt4RL3gO5Dcz+KIwOVrviZCKYB6/XSMfoAUDwne KhnYeQCB2ylV4O/bMrHz3dkNKHfgZ6SbMFJdAmCD1Vey0819jsh/CLCz9vp2wr5IzpTanL7y XYjj9R/qpDaW00LZF3+Maqavi3JKAi7K0CjnbcVfV65Rm/Qs1cfrsKQTf7QnSmFuLU1hcmVr IEdsb2dvd3NraSA8Z2xvZ293QGZiaWhvbWUuZGU+iFsEExECABsFAkDrcVsGCwkIBwMCAxUC AwMWAgECHgECF4AACgkQj6MK58wZA3cK/gCfb8IUFtgcxPSuAH1w8hn4C5WuSsUAn1P1Amys nLextO0t3xDDrFWO3PFhuQENBEDrcV0QBADpsD+yR9/1FEKKDGq7Q+jyz7or/SEwuCG/kHk3 G+ynZYQzFEQ0cWBw0QFzNUNnwVAvG22M0UDjBn8v7BBH0ZtlrqVRUx++6uVv5dlj1uuBp1gp cpAHSQgmcXxN4xYSwdJ7fPbMeAkf+8IZc99xG2geF3uZNwzPxVFBHhP7zIZqIwADBQP8D5PU ZfoGLr3lDFqhoj6Z6sz9wrqWBC0+zjFcCBaoK4C9x7wxIyBJVRe+yhucLlxQt+LrrU9uQjlT YeHqkIL96Xp3KN4y2pr98bzMEF6uIifTEpZs+D+Jq1VvUiJiVUnw0EuCTzmds7tm9CMkOXcH hs7GRsJSHXRSWqsXZUec3muIRgQYEQIABgUCQOtxXQAKCRCPowrnzBkDd02+AJ0caVX6EEut 2yzgPx9/lndIHGYlhgCfXy/f9ENFxfAxMlLXjTvDUe9qye8= To: intel-wired-lan@osuosl.org Message-ID: Date: Thu, 3 Jan 2019 22:28:57 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 Content-Language: en-US Subject: [Intel-wired-lan] e1000e driver stuck at 10Mbps after reconnection X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" Hi I'm seeing the same problem as Camille Bordignon in August https://lists.osuosl.org/pipermail/intel-wired-lan/Week-of-Mon-20180806/013606.html I'm on Ubuntu 18.04 (Kernel 4.15) and Ubuntu 12.04 + 14.04 HWE (Kernel 4.4). My hardware is a Fujitsu laptop, u757 series, Skylake based. 00:1f.6 Ethernet controller: Intel Corporation Ethernet Connection I219-LM (rev 21) Subsystem: Fujitsu Limited. Ethernet Connection I219-LM Flags: bus master, fast devsel, latency 0, IRQ 128 Memory at c1200000 (32-bit, non-prefetchable) [size=128K] Capabilities: [c8] Power Management version 3 Capabilities: [d0] MSI: Enable+ Count=1/1 Maskable- 64bit+ Capabilities: [e0] PCI Advanced Features Kernel driver in use: e1000e Kernel modules: e1000e Almost always a reconnect brings the connection down to 10M. It seems to work correctly from an initramfs, if no traffic is send (almost always). Starting the dhclient for the interface brings it down on reconnect. All the following stuff is from running the Ubuntu 4.20 vanilla kernel build and an extra patched e1000e module. I've not yet compiled current master. I put the following debug output into the module: diff --git a/mac.c b/mac.c index 4abd55d..7eae7ae 100644 --- a/mac.c +++ b/mac.c @@ -1308,6 +1308,7 @@ s32 e1000e_get_speed_and_duplex_copper(struct e1000_hw *hw, u16 *speed, u32 status; status = er32(STATUS); + pr_info("e1000e_get_speed_and_duplex_copper::status %x\n", status); if (status & E1000_STATUS_SPEED_1000) *speed = SPEED_1000; else if (status & E1000_STATUS_SPEED_100) diff --git a/netdev.c b/netdev.c index 16a73bd..3016ac1 100644 --- a/netdev.c +++ b/netdev.c @@ -5070,6 +5070,7 @@ static bool e1000e_has_link(struct e1000_adapter *adapter) if (hw->mac.get_link_status) { ret_val = hw->mac.ops.check_for_link(hw); link_active = !hw->mac.get_link_status; + pr_info("e1000e_has_link::check_for_link %i\n", ret_val); } else { link_active = true; } Some "evidence" I discovered: * Link state is always correct when I have a link before module load (on boot or with rmmod + modprobe) * It doesn't matter if I connect to a switch or simply cross-connect two U7x7 * Booting just the initramfs and re-connecting seems to work (very often) until data is transmitted. From the debug info I took the following: * The check_for_link is always 0 / ok. * The working status is always 0x80083 and the broken most time 0x40080003. Once out of 50 I had a 0x80003 following the 0x40080003. I also have some older Skylake HW (Fujitsu e737) 00:1f.6 Ethernet controller: Intel Corporation Ethernet Connection I219-V (rev 21) Subsystem: Fujitsu Limited. Ethernet Connection I219-V Flags: bus master, fast devsel, latency 0, IRQ 125 Memory at a1200000 (32-bit, non-prefetchable) [size=128K] Capabilities: [c8] Power Management version 3 Capabilities: [d0] MSI: Enable+ Count=1/1 Maskable- 64bit+ Capabilities: [e0] PCI Advanced Features Kernel driver in use: e1000e Kernel modules: e1000e where I couldn't reproduce with the problem with Ubuntu 12.04 + 14.04 HWE (Kernel 4.4). If I remember correctly my colleague could reproduce the problem with the u727 hardware (should be the same then u757, just smaller) and the 12.04 based installation (kernel 4.4). I will test this tomorrow again with my u757 hardware. There was some discussion about putting some sleep somewhere, which was later dropped again. Is a status matching 0x40000000 valid? At least there isn't a definition for a match. And I noticed the "PHYAD" value from ethtool changes. The rule of thumb it 1 with link and 2 without. It instantly changes to 2 on lost link, but it takes some time after a link to change back to 1 after the auto-negotiation. Jan-Marek P.S. I also tired the following patch, after I found the duplicate code. Didn't change anything for me and I don't know if the new check in e1000e_get_speed_and_duplex_copper is always correct. From bcd0ec30383698f0da14a9f675ae7475175f979a Mon Sep 17 00:00:00 2001 From: Jan-Marek Glogowski Date: Thu, 3 Jan 2019 22:11:25 +0100 Subject: [PATCH] e1000e: drop duplicate speed + duplex decoding code Signed-off-by: Jan-Marek Glogowski --- 80003es2lan.c | 4 ++-- e1000.h | 2 +- ethtool.c | 21 +++++---------------- hw.h | 2 +- ich8lan.c | 8 +++++--- mac.c | 11 ++++++++--- mac.h | 4 ++-- 7 files changed, 24 insertions(+), 28 deletions(-) diff --git a/80003es2lan.c b/80003es2lan.c index 257bd59..7779346 100644 --- a/80003es2lan.c +++ b/80003es2lan.c @@ -638,7 +638,7 @@ static s32 e1000_get_cable_length_80003es2lan(struct e1000_hw *hw) * Retrieve the current speed and duplex configuration. **/ static s32 e1000_get_link_up_info_80003es2lan(struct e1000_hw *hw, u16 *speed, - u16 *duplex) + u8 *duplex) { s32 ret_val; @@ -1068,7 +1068,7 @@ static s32 e1000_cfg_on_link_up_80003es2lan(struct e1000_hw *hw) { s32 ret_val = 0; u16 speed; - u16 duplex; + u8 duplex; if (hw->phy.media_type == e1000_media_type_copper) { ret_val = e1000e_get_speed_and_duplex_copper(hw, &speed, diff --git a/e1000.h b/e1000.h index c760dc7..190a4cd 100644 --- a/e1000.h +++ b/e1000.h @@ -200,7 +200,7 @@ struct e1000_adapter { u32 rx_buffer_len; u16 mng_vlan_id; u16 link_speed; - u16 link_duplex; + u8 link_duplex; u16 eeprom_vers; /* track device up/down/testing state */ diff --git a/ethtool.c b/ethtool.c index 02ebf20..dafdeed 100644 --- a/ethtool.c +++ b/ethtool.c @@ -105,7 +105,8 @@ static int e1000_get_link_ksettings(struct net_device *netdev, { struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_hw *hw = &adapter->hw; - u32 speed, supported, advertising; + u32 supported, advertising; + u16 speed; if (hw->phy.media_type == e1000_media_type_copper) { supported = (SUPPORTED_10baseT_Half | @@ -148,21 +149,9 @@ static int e1000_get_link_ksettings(struct net_device *netdev, cmd->base.duplex = adapter->link_duplex - 1; } } else if (!pm_runtime_suspended(netdev->dev.parent)) { - u32 status = er32(STATUS); - - if (status & E1000_STATUS_LU) { - if (status & E1000_STATUS_SPEED_1000) - speed = SPEED_1000; - else if (status & E1000_STATUS_SPEED_100) - speed = SPEED_100; - else - speed = SPEED_10; - - if (status & E1000_STATUS_FD) - cmd->base.duplex = DUPLEX_FULL; - else - cmd->base.duplex = DUPLEX_HALF; - } + if (!e1000e_get_speed_and_duplex_copper(hw, &speed, + &cmd->base.duplex)) + cmd->base.speed = SPEED_UNKNOWN; } cmd->base.speed = speed; diff --git a/hw.h b/hw.h index eff75bd..d3c18ce 100644 --- a/hw.h +++ b/hw.h @@ -460,7 +460,7 @@ struct e1000_mac_operations { void (*clear_vfta)(struct e1000_hw *); s32 (*get_bus_info)(struct e1000_hw *); void (*set_lan_id)(struct e1000_hw *); - s32 (*get_link_up_info)(struct e1000_hw *, u16 *, u16 *); + s32 (*get_link_up_info)(struct e1000_hw *, u16 *, u8 *); s32 (*led_on)(struct e1000_hw *); s32 (*led_off)(struct e1000_hw *); void (*update_mc_addr_list)(struct e1000_hw *, u8 *, u32); diff --git a/ich8lan.c b/ich8lan.c index cdae0ef..fd59970 100644 --- a/ich8lan.c +++ b/ich8lan.c @@ -998,7 +998,8 @@ static s32 e1000_platform_pm_pch_lpt(struct e1000_hw *hw, bool link) u16 lat_enc = 0; /* latency encoded */ if (link) { - u16 speed, duplex, scale = 0; + u16 speed, scale = 0; + u8 duplex; u16 max_snoop, max_nosnoop; u16 max_ltr_enc; /* max LTR latency encoded */ u64 value; @@ -1386,7 +1387,8 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) * the IPG and reduce Rx latency in the PHY. */ if ((hw->mac.type >= e1000_pch2lan) && link) { - u16 speed, duplex; + u16 speed; + u8 duplex; e1000e_get_speed_and_duplex_copper(hw, &speed, &duplex); tipg_reg = er32(TIPG); @@ -5074,7 +5076,7 @@ static s32 e1000_setup_copper_link_pch_lpt(struct e1000_hw *hw) * gigabit speeds. **/ static s32 e1000_get_link_up_info_ich8lan(struct e1000_hw *hw, u16 *speed, - u16 *duplex) + u8 *duplex) { s32 ret_val; diff --git a/mac.c b/mac.c index 4abd55d..19c816c 100644 --- a/mac.c +++ b/mac.c @@ -1004,7 +1004,8 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw) s32 ret_val = 0; u32 pcs_status_reg, pcs_adv_reg, pcs_lp_ability_reg, pcs_ctrl_reg; u16 mii_status_reg, mii_nway_adv_reg, mii_nway_lp_ability_reg; - u16 speed, duplex; + u16 speed; + u8 duplex; /* Check for the case where we have fiber media and auto-neg failed * so we had to force link. In this case, we need to force the @@ -1303,11 +1304,15 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw) * speed and duplex for copper connections. **/ s32 e1000e_get_speed_and_duplex_copper(struct e1000_hw *hw, u16 *speed, - u16 *duplex) + u8 *duplex) { u32 status; status = er32(STATUS); + + if (!(status & E1000_STATUS_LU)) + return 1; + if (status & E1000_STATUS_SPEED_1000) *speed = SPEED_1000; else if (status & E1000_STATUS_SPEED_100) @@ -1337,7 +1342,7 @@ s32 e1000e_get_speed_and_duplex_copper(struct e1000_hw *hw, u16 *speed, * for fiber/serdes links. **/ s32 e1000e_get_speed_and_duplex_fiber_serdes(struct e1000_hw __always_unused - *hw, u16 *speed, u16 *duplex) + *hw, u16 *speed, u8 *duplex) { *speed = SPEED_1000; *duplex = FULL_DUPLEX; diff --git a/mac.h b/mac.h index 6ab2611..c4416e8 100644 --- a/mac.h +++ b/mac.h @@ -17,9 +17,9 @@ s32 e1000e_get_bus_info_pcie(struct e1000_hw *hw); void e1000_set_lan_id_single_port(struct e1000_hw *hw); s32 e1000e_get_hw_semaphore(struct e1000_hw *hw); s32 e1000e_get_speed_and_duplex_copper(struct e1000_hw *hw, u16 *speed, - u16 *duplex); + u8 *duplex); s32 e1000e_get_speed_and_duplex_fiber_serdes(struct e1000_hw *hw, - u16 *speed, u16 *duplex); + u16 *speed, u8 *duplex); s32 e1000e_id_led_init_generic(struct e1000_hw *hw); s32 e1000e_led_on_generic(struct e1000_hw *hw); s32 e1000e_led_off_generic(struct e1000_hw *hw); From patchwork Fri Jan 4 13:31:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan-Marek Glogowski X-Patchwork-Id: 1020733 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=osuosl.org (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=fbihome.de Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43WQfz293sz9rxp for ; Sat, 5 Jan 2019 00:31:38 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 2FE2E85DF2; Fri, 4 Jan 2019 13:31:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4aQUPLTPE4wv; Fri, 4 Jan 2019 13:31:34 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id D0F8085DEC; Fri, 4 Jan 2019 13:31:34 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 41EBF1C0C36 for ; Fri, 4 Jan 2019 13:31:33 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 3C573864EA for ; Fri, 4 Jan 2019 13:31:33 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2Wik81dyQ5BL for ; Fri, 4 Jan 2019 13:31:31 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from ironboyv.h-da.de (ironboyv.h-da.de [141.100.10.230]) by whitealder.osuosl.org (Postfix) with ESMTPS id F078C864B8 for ; Fri, 4 Jan 2019 13:31:30 +0000 (UTC) IronPort-SDR: i9gxr1ct5mNaBr/9ll1GwCQaVR94Q+VQF4Crip6OiNyyFzTduifsky6scsb0ppaVXkslX9bLf7 kKrOhYK9vd65pDE68XRYgZTTE2vIAy2g6f18X4uf51TazmhN/z6UzjEV70aQvwCrfBTWHn734j IAK1XTWKUniQCb52cacgWX/69yuTRbIWmFvzSIYffL9jvWhZ62f9UFJXiflO5yrIKN1cgE51zj MdYJGoGE3IbgCgxIPyh+kqy8rxsv3/SXtdELbsLaz8ZWsxsu6iHRVeN72aphfs+vRDHjxslUT8 12o= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2E3AQCGXy9c/2soZI1jHQEBBQEHBQGBUgcBCwEBggKBVhInmABSBQGBMZdsFIFnOYRAAoIAIjUIDQEDAQECAQECAgJpKEIBDgGEegaBCRg5VxmDIoF1EaguGgKFJYRlh36EQRd4gQeBEYdcIGSFEgKhVwmBFpBYFooKGQOHRJt9AjWBVk0kFIMnkFw+M4EfgTiFRYJNAQE X-IPAS-Result: A2E3AQCGXy9c/2soZI1jHQEBBQEHBQGBUgcBCwEBggKBVhInmABSBQGBMZdsFIFnOYRAAoIAIjUIDQEDAQECAQECAgJpKEIBDgGEegaBCRg5VxmDIoF1EaguGgKFJYRlh36EQRd4gQeBEYdcIGSFEgKhVwmBFpBYFooKGQOHRJt9AjWBVk0kFIMnkFw+M4EfgTiFRYJNAQE Received: from unknown (HELO mail.fbihome.de) ([141.100.40.107]) by ironboyv.h-da.de with ESMTP; 04 Jan 2019 14:31:28 +0100 Received: from kvm-sbuild2.tvc.muenchen.de. (unknown [194.113.41.246]) by mail.fbihome.de (Postfix) with ESMTPSA id CD29E42D37 for ; Fri, 4 Jan 2019 14:30:45 +0100 (CET) From: Jan-Marek Glogowski To: intel-wired-lan@lists.osuosl.org Date: Fri, 4 Jan 2019 14:31:06 +0100 Message-Id: <1546608667-25498-3-git-send-email-glogow@fbihome.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1546608667-25498-1-git-send-email-glogow@fbihome.de> References: <1546608667-25498-1-git-send-email-glogow@fbihome.de> Subject: [Intel-wired-lan] [PATCH 2/3] e1000e: ignore status during auto-negotiation X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" My problem is the fallback of the hardware to 10 Mbps after a re-connect, which happens almost all times. In the broken case the status field has always the 0x40000000 bit set. Still the naming for the status flag is just a guess. Ignoring the status, when this bit is set, solves my problem. But I just have one notebook hardware (I219-LM, rev 21), which exhibits the problem. It doesn't happen for my other notebook with I219-V (rev 21) hardware (or it's just much more unlikely). Signed-off-by: Jan-Marek Glogowski --- drivers/net/ethernet/intel/e1000e/defines.h | 1 + drivers/net/ethernet/intel/e1000e/ich8lan.c | 3 ++- drivers/net/ethernet/intel/e1000e/mac.c | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/e1000e/defines.h b/drivers/net/ethernet/intel/e1000e/defines.h index fd550de..3cd9f99 100644 --- a/drivers/net/ethernet/intel/e1000e/defines.h +++ b/drivers/net/ethernet/intel/e1000e/defines.h @@ -221,6 +221,7 @@ #define E1000_STATUS_LAN_INIT_DONE 0x00000200 /* Lan Init Completion by NVM */ #define E1000_STATUS_PHYRA 0x00000400 /* PHY Reset Asserted */ #define E1000_STATUS_GIO_MASTER_ENABLE 0x00080000 /* Master Req status */ +#define E1000_STATUS_AUTONEG 0x40000000 /* in auto-negotiation */ #define HALF_DUPLEX 1 #define FULL_DUPLEX 2 diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c index fd59970..8588eb7 100644 --- a/drivers/net/ethernet/intel/e1000e/ich8lan.c +++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c @@ -1390,7 +1390,8 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) u16 speed; u8 duplex; - e1000e_get_speed_and_duplex_copper(hw, &speed, &duplex); + if (e1000e_get_speed_and_duplex_copper(hw, &speed, &duplex)) + goto out; tipg_reg = er32(TIPG); tipg_reg &= ~E1000_TIPG_IPGT_MASK; diff --git a/drivers/net/ethernet/intel/e1000e/mac.c b/drivers/net/ethernet/intel/e1000e/mac.c index 19c816c..ada8fbb 100644 --- a/drivers/net/ethernet/intel/e1000e/mac.c +++ b/drivers/net/ethernet/intel/e1000e/mac.c @@ -1310,6 +1310,8 @@ s32 e1000e_get_speed_and_duplex_copper(struct e1000_hw *hw, u16 *speed, status = er32(STATUS); + if (status & E1000_STATUS_AUTONEG) + return 1; if (!(status & E1000_STATUS_LU)) return 1; From patchwork Fri Jan 4 13:31:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan-Marek Glogowski X-Patchwork-Id: 1020734 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=osuosl.org (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=fbihome.de Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43WQg14BHnz9s9G for ; Sat, 5 Jan 2019 00:31:41 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 3BE6685E03; Fri, 4 Jan 2019 13:31:40 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KieheGk7avKB; Fri, 4 Jan 2019 13:31:39 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 1DC2C85DEC; Fri, 4 Jan 2019 13:31:39 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id ADDFF1C0C36 for ; Fri, 4 Jan 2019 13:31:33 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id A9C2E864B8 for ; Fri, 4 Jan 2019 13:31:33 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zU-NjpakBNOY for ; Fri, 4 Jan 2019 13:31:33 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from ironchief.h-da.de (ironchief.h-da.de [141.100.10.235]) by whitealder.osuosl.org (Postfix) with ESMTPS id A82AC865C4 for ; Fri, 4 Jan 2019 13:31:32 +0000 (UTC) IronPort-SDR: FuH7UfvaM/56jMJFMEDREngu814EIi+C99ZmnGVN6mmTmVZIaKYj6OBNgOcwtO11iGqqCfc9Fo LWhXvKAtuqsA== X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2EqAgBEXy9c/2soZI1jHgEGBwaBUwcLAQGCAoFWEieYAFIFAYExl2yBezmBS4J1AoIAIjYHDQEDAQECAQECAgJpKEIBDgGEegYnYhg5VxmDIoF1Ead6MxoChSWEZYd+hEEXeIEHjwMCoVcJgRaQWBaKChkDh0ScAQEygVZNJBSDJ5BcPjOBH4E4iBIBAQ X-IPAS-Result: A2EqAgBEXy9c/2soZI1jHgEGBwaBUwcLAQGCAoFWEieYAFIFAYExl2yBezmBS4J1AoIAIjYHDQEDAQECAQECAgJpKEIBDgGEegYnYhg5VxmDIoF1Ead6MxoChSWEZYd+hEEXeIEHjwMCoVcJgRaQWBaKChkDh0ScAQEygVZNJBSDJ5BcPjOBH4E4iBIBAQ Received: from unknown (HELO mail.fbihome.de) ([141.100.40.107]) by ironchief.h-da.de with ESMTP; 04 Jan 2019 14:31:28 +0100 Received: from kvm-sbuild2.tvc.muenchen.de. (unknown [194.113.41.246]) by mail.fbihome.de (Postfix) with ESMTPSA id DD74442D6F for ; Fri, 4 Jan 2019 14:30:45 +0100 (CET) From: Jan-Marek Glogowski To: intel-wired-lan@lists.osuosl.org Date: Fri, 4 Jan 2019 14:31:07 +0100 Message-Id: <1546608667-25498-4-git-send-email-glogow@fbihome.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1546608667-25498-1-git-send-email-glogow@fbihome.de> References: <1546608667-25498-1-git-send-email-glogow@fbihome.de> Subject: [Intel-wired-lan] [PATCH 3/3] e1000e: add some status debug output X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" Add dynamic debug info for flow control advertising and dump the status when extracting speed and duplex from it. Signed-off-by: Jan-Marek Glogowski --- drivers/net/ethernet/intel/e1000e/mac.c | 10 +++++++--- drivers/net/ethernet/intel/e1000e/phy.c | 6 +++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/intel/e1000e/mac.c b/drivers/net/ethernet/intel/e1000e/mac.c index ada8fbb..daa7be8 100644 --- a/drivers/net/ethernet/intel/e1000e/mac.c +++ b/drivers/net/ethernet/intel/e1000e/mac.c @@ -1310,10 +1310,14 @@ s32 e1000e_get_speed_and_duplex_copper(struct e1000_hw *hw, u16 *speed, status = er32(STATUS); - if (status & E1000_STATUS_AUTONEG) + if (status & E1000_STATUS_AUTONEG) { + e_dbg("status 0x%x => in auto-neg, no valid config\n", status); return 1; - if (!(status & E1000_STATUS_LU)) + } + if (!(status & E1000_STATUS_LU)) { + e_dbg("status 0x%x => no link, no valid config\n", status); return 1; + } if (status & E1000_STATUS_SPEED_1000) *speed = SPEED_1000; @@ -1327,7 +1331,7 @@ s32 e1000e_get_speed_and_duplex_copper(struct e1000_hw *hw, u16 *speed, else *duplex = HALF_DUPLEX; - e_dbg("%u Mbps, %s Duplex\n", + e_dbg("status 0x%x => %u Mbps, %s Duplex\n", status, *speed == SPEED_1000 ? 1000 : *speed == SPEED_100 ? 100 : 10, *duplex == FULL_DUPLEX ? "Full" : "Half"); diff --git a/drivers/net/ethernet/intel/e1000e/phy.c b/drivers/net/ethernet/intel/e1000e/phy.c index 4223301..91da35c 100644 --- a/drivers/net/ethernet/intel/e1000e/phy.c +++ b/drivers/net/ethernet/intel/e1000e/phy.c @@ -1011,6 +1011,7 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw) */ mii_autoneg_adv_reg &= ~(ADVERTISE_PAUSE_ASYM | ADVERTISE_PAUSE_CAP); + e_dbg("Advertise no flow control\n"); break; case e1000_fc_rx_pause: /* Rx Flow control is enabled, and Tx Flow control is @@ -1024,6 +1025,7 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw) */ mii_autoneg_adv_reg |= (ADVERTISE_PAUSE_ASYM | ADVERTISE_PAUSE_CAP); + e_dbg("Advertise no flow control\n"); break; case e1000_fc_tx_pause: /* Tx Flow control is enabled, and Rx Flow control is @@ -1031,6 +1033,7 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw) */ mii_autoneg_adv_reg |= ADVERTISE_PAUSE_ASYM; mii_autoneg_adv_reg &= ~ADVERTISE_PAUSE_CAP; + e_dbg("Advertise Tx flow control\n"); break; case e1000_fc_full: /* Flow control (both Rx and Tx) is enabled by a software @@ -1038,6 +1041,7 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw) */ mii_autoneg_adv_reg |= (ADVERTISE_PAUSE_ASYM | ADVERTISE_PAUSE_CAP); + e_dbg("Advertise Tx and Rx flow control\n"); break; default: e_dbg("Flow control param set incorrectly\n"); @@ -1048,7 +1052,7 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw) if (ret_val) return ret_val; - e_dbg("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg); + e_dbg("Auto-Neg Advertising 0x%x\n", mii_autoneg_adv_reg); if (phy->autoneg_mask & ADVERTISE_1000_FULL) ret_val = e1e_wphy(hw, MII_CTRL1000, mii_1000t_ctrl_reg);