From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE6C5C54E8D for ; Tue, 12 May 2020 14:00:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B7F4820752 for ; Tue, 12 May 2020 14:00:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="Em3hcfUw" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730123AbgELOAX (ORCPT ); Tue, 12 May 2020 10:00:23 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:55756 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727859AbgELOAX (ORCPT ); Tue, 12 May 2020 10:00:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=aG8W5Jf1V02pUS4e7tl1sPpoUwpC/b0viIniB50OTZQ=; b=Em3hcfUwgMSn2+fIn+oBTWeCPK DRffGV1KPhq+8QYubH7oLB0fb9yZCY9+C3/zHbzexC9nb7SqRPbEd6O1e1MpQVrRnjlBR1RGUrykC SfHq7DIhjq2shpwKk82xHcZM8vpMY6100g7ZS8dKF/NScKsyEf2yEs3hMPPxbo9AAgYY=; Received: from andrew by vps0.lunn.ch with local (Exim 4.93) (envelope-from ) id 1jYVSD-001zW5-8Z; Tue, 12 May 2020 16:00:17 +0200 Date: Tue, 12 May 2020 16:00:17 +0200 From: Andrew Lunn To: Yonglong Liu Cc: Heiner Kallweit , "David S. Miller" , netdev@vger.kernel.org, "linux-kernel@vger.kernel.org" , linuxarm@huawei.com, Salil Mehta Subject: Re: [question] net: phy: rtl8211f: link speed shows 1000Mb/s but actual link speed in phy is 100Mb/s Message-ID: <20200512140017.GK409897@lunn.ch> References: <478f871a-583d-01f1-9cc5-2eea56d8c2a7@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <478f871a-583d-01f1-9cc5-2eea56d8c2a7@huawei.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, May 12, 2020 at 08:48:21PM +0800, Yonglong Liu wrote: > 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. This sounds like downshift, but not correctly working. 1Gbps requires that 4 pairs in the cable work. If a 1Gbps link is negotiated, but then does not establish because one of the pairs is broken, some PHYs will try to 'downshift'. They drop down to 100Mbps, which only requires two pairs of the cable to work. To do this, the PHY should change what it is advertising, to no longer advertise 1G, just 100M and 10M. The link partner should then try to use 100Mbps and hopefully, a link is established. Looking at the ethtool, you can see device A is reporting device B is only advertising upto 100Mbps. Yet it is locally using 1G. That is broken. So i would say device A has the problem. Are both PHYs rtl8211f? > I think this is the bug of the rtl8211f itself, any one have an idea > to avoid this bug? Are you 100% sure your cable and board layout is good? Is it trying downshift because something is broken? Fix the cable/connector and the reason to downshift goes away. But it does not solve the problem if a customer has a broken cable. So you might want to deliberately cut a pair in the cable so it becomes 100% reproducable and try to debug it further. See if you can find out why auto-neg is not working correctly. Andrew