Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2688056ybk; Tue, 12 May 2020 05:50:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyN3ab0gr4DsNhSV3ode9Mx/eU7Ka4pl5965fnxL9TB8APRwe8JKj5PaEladeyaWdn45fY3 X-Received: by 2002:aa7:dd16:: with SMTP id i22mr9414348edv.366.1589287839049; Tue, 12 May 2020 05:50:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589287839; cv=none; d=google.com; s=arc-20160816; b=jJLIKuUuUgJ33fTI/yeVkpwLAx+1PC+H4DUyms0iBxugN8skIeiB0pAQBoDm41kWfB 3vuk3SMhwEL8osDyTK6VuPQWplTIWJsIH6rmiXhkzYWEoH5zjWwlgpaqpMUeHRCQAOrj Q7EwE/wTtgRqAIs0h6RxWAuPmPT1bzwD56xxblqaLgSZjAju9c45U6fsuJB7NUBUbQlt +q2iz4NA+SPq3HRGTJG94bSZUjLza0IG4nVJqPJJhqbqZSYWgSWaTOPu4MNMAF093lhB mTkQyU6RLp2c+rKv5/UQqzwP6idIeLROzjEb+RrrvtJl9gUFNYMXgxWdIngf/hgSFNT9 JscA== 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:mime-version:user-agent:date:message-id:cc:to :subject:from; bh=dkXxvYg0FClPaDb18mS2cCEw9kOkEyjlJdZHJ3zue7Q=; b=KMwNqN1YEs7bYugRD5X3g9O+9z7Ug1/AKWdoX5pKXcbfjzDp+0ijRKkPzZ4p52zny3 baw/2BcWl3r7iGoYbL58SEsWU/0iT6jvrVB06c2CBiiNjmZRvrfgSohvoiVEVmDDLSTf qNTpuNVWUIBgDi7j9nf8JYIEro21o2A2SSBzkyGex0nPIg1NZ4lXnzTza10AWIIEPcoM Q0StDcbZVsNomNMBO6X10ksysrMy2JcppDTLFV7XmDX81AYKuAQT3ZuPzZaX1yDLQGDo +d58Nwj46Tsn9CRdjGuVuq60gNns82k+E5+qp0uAJJmhSAuFLuTFclxQ5Dz+RDqWXJ6Q lOug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gz16si3606326ejb.384.2020.05.12.05.50.15; Tue, 12 May 2020 05:50:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729950AbgELMs1 (ORCPT + 99 others); Tue, 12 May 2020 08:48:27 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:2133 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729461AbgELMs0 (ORCPT ); Tue, 12 May 2020 08:48:26 -0400 Received: from DGGEMM404-HUB.china.huawei.com (unknown [172.30.72.54]) by Forcepoint Email with ESMTP id 94D2ED6F91ACD733E9D7; Tue, 12 May 2020 20:48:22 +0800 (CST) Received: from dggeme760-chm.china.huawei.com (10.3.19.106) by DGGEMM404-HUB.china.huawei.com (10.3.20.212) with Microsoft SMTP Server (TLS) id 14.3.487.0; Tue, 12 May 2020 20:48:21 +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.1913.5; Tue, 12 May 2020 20:48:22 +0800 From: Yonglong Liu Subject: [question] net: phy: rtl8211f: link speed shows 1000Mb/s but actual link speed in phy is 100Mb/s To: Andrew Lunn , Heiner Kallweit , "David S. Miller" CC: , "linux-kernel@vger.kernel.org" , , Salil Mehta Message-ID: <478f871a-583d-01f1-9cc5-2eea56d8c2a7@huawei.com> Date: Tue, 12 May 2020 20:48:21 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.57.37.248] X-ClientProxiedBy: dggeme712-chm.china.huawei.com (10.1.199.108) 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 I use two devices, both support 1000M speed, they are directly connected with a network cable. Two devices enable autoneg, and then do the following test repeatedly: ifconfig eth5 down ifconfig eth5 up sleep $((RANDOM%6)) ifconfig eth5 down ifconfig eth5 up sleep 10 With low probability, one device A link up with 100Mb/s, the other B link up with 1000Mb/s(the actual link speed read from phy is 100Mb/s), and the network can not work. device A: Settings for eth5: Supported ports: [ TP ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Supported pause frame use: Symmetric Receive-only Supports auto-negotiation: Yes Supported FEC modes: Not reported Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Advertised pause frame use: Symmetric Advertised auto-negotiation: Yes Advertised FEC modes: Not reported Link partner advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full Link partner advertised pause frame use: Symmetric Link partner advertised auto-negotiation: Yes Link partner advertised FEC modes: Not reported Speed: 100Mb/s Duplex: Full Port: MII PHYAD: 3 Transceiver: internal Auto-negotiation: on Current message level: 0x00000036 (54) probe link ifdown ifup Link detected: yes The regs value read from mdio are: reg 9 = 0x200 reg a = 0 device B: Settings for eth5: Supported ports: [ TP ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Supported pause frame use: Symmetric Receive-only Supports auto-negotiation: Yes Supported FEC modes: Not reported Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Advertised pause frame use: Symmetric Advertised auto-negotiation: Yes Advertised FEC modes: Not reported Link partner advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Link partner advertised pause frame use: Symmetric Link partner advertised auto-negotiation: Yes Link partner advertised FEC modes: Not reported Speed: 1000Mb/s Duplex: Full Port: MII PHYAD: 3 Transceiver: internal Auto-negotiation: on Current message level: 0x00000036 (54) probe link ifdown ifup Link detected: yes The regs value read from mdio are: reg 9 = 0 reg a = 0x800 I had talk to the FAE of rtl8211f, they said if negotiation failed with 1000Mb/s, rtl8211f will change reg 9 to 0, than try to negotiation with 100Mb/s. The problem happened as: ifconfig eth5 up -> phy_start -> phy_start_aneg -> phy_modify_changed(MII_CTRL1000) (this time both A and B, reg 9 = 0x200) -> wait for link up -> (B: reg 9 changed to 0) -> link up. I think this is the bug of the rtl8211f itself, any one have an idea to avoid this bug? When link up, update phydev->advertising before notify the eth driver, is this method suitable? (phydev->advertising is config from user, if user just set one speed 1000M, it's hard to )