Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp6417077ybh; Wed, 7 Aug 2019 23:42:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqxNDs2PdghwsE2MUj7jzqOyDpf02haOj9DDZt9cT5Qbq+ht9Z/eqjmTk7OXffGLgp1R3Ai5 X-Received: by 2002:a63:6947:: with SMTP id e68mr11483175pgc.60.1565246541338; Wed, 07 Aug 2019 23:42:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565246541; cv=none; d=google.com; s=arc-20160816; b=xt+Mg5ejA6KSEdtcPQj5fkOtHuKrm7lPaJr7D2HUwvFbNwCQjBfDEVIvVMM5LxrOUK Fx0iL9tSRq8R/I8FRXsmw260hD4q7C0WCX8NIwXG6KtSYiPyK0nIqWgIc4bPHdUAX0Xb YdL6XrUBqkKH/dRNUIIL0du5Y7y7gNIiBz15ncbPBuqp4ATxRmg2OzCiVf2Kw7FMbT+5 Mg3UjPeoDfHP+V4QM5lKxAb5Ns8kEX3iCU5eNNc9HFCrRO7nClN0M4mHsLoRDB5sf3Ql BUg7GmTh8bSqF1nxR/PUqPgBpnJngTX/V98NdZWHASjLAboz+sN/r8242iZLmLWY7z1L 4hbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=11Bcf9qN4p3fP4gEJXsc1rhqjougLutISlzxvB1DVvE=; b=PWtJiLYTIngeIfIc0J2+WPJsue7hbw9UaztUT2dmV/1hxPwPbVQv/JvoSgdKBRz1pe BVXAo44UylF3P+rDNdfvh+kx8BjcMmZe60M9PVWxdYbKgTNDPPai/7k+UdHeE8HVtbUs BVt3ecMysIFrV5sR2/ClEPAcCzAVwle44IdCevNyq0pvL9ob6g02WIYrSAIqV6GVo8US Mq8WPqpKwWEhDnfsOZyqD0p5dvW6ZnM+EMVMDj0HRoR8nE5nIsDt6bhxDT8T2P7OUbFE wbeDhiZAFZhtCsjuowiCgBszyMYheh4fAqnBj4N990SG9mC5lJPLwvz8hDQfxk5Gd5uo sxxA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a187si9723568pgc.524.2019.08.07.23.42.05; Wed, 07 Aug 2019 23:42:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731038AbfHHGVV (ORCPT + 99 others); Thu, 8 Aug 2019 02:21:21 -0400 Received: from szxga03-in.huawei.com ([45.249.212.189]:3082 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725796AbfHHGVU (ORCPT ); Thu, 8 Aug 2019 02:21:20 -0400 Received: from DGGEMM401-HUB.china.huawei.com (unknown [172.30.72.54]) by Forcepoint Email with ESMTP id A0F7187DA62FA65D40F2; Thu, 8 Aug 2019 14:21:15 +0800 (CST) Received: from dggeme760-chm.china.huawei.com (10.3.19.106) by DGGEMM401-HUB.china.huawei.com (10.3.20.209) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 8 Aug 2019 14:21:15 +0800 Received: from [127.0.0.1] (10.57.37.248) by dggeme760-chm.china.huawei.com (10.3.19.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Thu, 8 Aug 2019 14:21:15 +0800 Subject: Re: [PATCH net] net: phy: rtl8211f: do a double read to get real time link status To: Heiner Kallweit , , CC: , , , , , References: <1565183772-44268-1-git-send-email-liuyonglong@huawei.com> <080b68c7-abe6-d142-da4b-26e8a7d4dc19@gmail.com> From: Yonglong Liu Message-ID: Date: Thu, 8 Aug 2019 14:21:14 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <080b68c7-abe6-d142-da4b-26e8a7d4dc19@gmail.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.57.37.248] X-ClientProxiedBy: dggeme718-chm.china.huawei.com (10.1.199.114) To dggeme760-chm.china.huawei.com (10.3.19.106) X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/8/8 14:11, Heiner Kallweit wrote: > On 08.08.2019 03:15, Yonglong Liu wrote: >> >> >> On 2019/8/8 0:47, Heiner Kallweit wrote: >>> On 07.08.2019 15:16, Yonglong Liu wrote: >>>> [ 27.232781] hns3 0000:bd:00.3 eth7: net open >>>> [ 27.237303] 8021q: adding VLAN 0 to HW filter on device eth7 >>>> [ 27.242972] IPv6: ADDRCONF(NETDEV_CHANGE): eth7: link becomes ready >>>> [ 27.244449] hns3 0000:bd:00.3: invalid speed (-1) >>>> [ 27.253904] hns3 0000:bd:00.3 eth7: failed to adjust link. >>>> [ 27.259379] RTL8211F Gigabit Ethernet mii-0000:bd:00.3:07: PHY state change UP -> RUNNING >>>> [ 27.924903] hns3 0000:bd:00.3 eth7: link up >>>> [ 28.280479] RTL8211F Gigabit Ethernet mii-0000:bd:00.3:07: PHY state change RUNNING -> NOLINK >>>> [ 29.208452] hns3 0000:bd:00.3 eth7: link down >>>> [ 32.376745] RTL8211F Gigabit Ethernet mii-0000:bd:00.3:07: PHY state change NOLINK -> RUNNING >>>> [ 33.208448] hns3 0000:bd:00.3 eth7: link up >>>> [ 35.253821] hns3 0000:bd:00.3 eth7: net stop >>>> [ 35.258270] hns3 0000:bd:00.3 eth7: link down >>>> >>>> When using rtl8211f in polling mode, may get a invalid speed, >>>> because of reading a fake link up and autoneg complete status >>>> immediately after starting autoneg: >>>> >>>> ifconfig-1176 [007] .... 27.232763: mdio_access: mii-0000:bd:00.3 read phy:0x07 reg:0x00 val:0x1040 >>>> kworker/u257:1-670 [015] .... 27.232805: mdio_access: mii-0000:bd:00.3 read phy:0x07 reg:0x04 val:0x01e1 >>>> kworker/u257:1-670 [015] .... 27.232815: mdio_access: mii-0000:bd:00.3 write phy:0x07 reg:0x04 val:0x05e1 >>>> kworker/u257:1-670 [015] .... 27.232869: mdio_access: mii-0000:bd:00.3 read phy:0x07 reg:0x01 val:0x79ad >>>> kworker/u257:1-670 [015] .... 27.232904: mdio_access: mii-0000:bd:00.3 read phy:0x07 reg:0x09 val:0x0200 >>>> kworker/u257:1-670 [015] .... 27.232940: mdio_access: mii-0000:bd:00.3 read phy:0x07 reg:0x00 val:0x1040 >>>> kworker/u257:1-670 [015] .... 27.232949: mdio_access: mii-0000:bd:00.3 write phy:0x07 reg:0x00 val:0x1240 >>>> kworker/u257:1-670 [015] .... 27.233003: mdio_access: mii-0000:bd:00.3 read phy:0x07 reg:0x01 val:0x79ad >>>> kworker/u257:1-670 [015] .... 27.233039: mdio_access: mii-0000:bd:00.3 read phy:0x07 reg:0x0a val:0x3002 >>>> kworker/u257:1-670 [015] .... 27.233074: mdio_access: mii-0000:bd:00.3 read phy:0x07 reg:0x09 val:0x0200 >>>> kworker/u257:1-670 [015] .... 27.233110: mdio_access: mii-0000:bd:00.3 read phy:0x07 reg:0x05 val:0x0000 >>>> kworker/u257:1-670 [000] .... 28.280475: mdio_access: mii-0000:bd:00.3 read phy:0x07 reg:0x01 val:0x7989 >>>> kworker/u257:1-670 [000] .... 29.304471: mdio_access: mii-0000:bd:00.3 read phy:0x07 reg:0x01 val:0x7989 >>>> >>>> According to the datasheet of rtl8211f, to get the real time >>>> link status, need to read MII_BMSR twice. >>>> >>>> This patch add a read_status hook for rtl8211f, and do a fake >>>> phy_read before genphy_read_status(), so that can get real link >>>> status in genphy_read_status(). >>>> >>>> Signed-off-by: Yonglong Liu >>>> --- >>>> drivers/net/phy/realtek.c | 13 +++++++++++++ >>>> 1 file changed, 13 insertions(+) >>>> >>> Is this an accidental resubmit? Because we discussed this in >>> https://marc.info/?t=156413509900003&r=1&w=2 and a fix has >>> been applied already. >>> >>> Heiner >>> >>> . >>> >> >> In https://marc.info/?t=156413509900003&r=1&w=2 , the invalid speed >> recurrence rate is almost 100%, and I had test the solution about >> 5 times and it works. But yesterday it happen again suddenly, and than >> I fount that the recurrence rate reduce to 10%. This time we get 0x79ad >> after autoneg started which is not 0x798d from last discussion. >> >> >> > OK, I'll have a look. > However the approach is wrong. The double read is related to the latching > of link-down events. This is done by all PHY's and not specific to RT8211F. > Also it's not related to the problem. I assume any sufficient delay would > do instead of the read. > > . > So you will send a new patch to fix this problem? I am waiting for it, and can do a full test this time.