mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yonglong Liu <liuyonglong@huawei.com>
To: Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	"David S. Miller" <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	<linuxarm@huawei.com>, Salil Mehta <salil.mehta@huawei.com>
Subject: [question] net: phy: rtl8211f: link speed shows 1000Mb/s but actual link speed in phy is 100Mb/s
Date: Tue, 12 May 2020 20:48:21 +0800	[thread overview]
Message-ID: <478f871a-583d-01f1-9cc5-2eea56d8c2a7@huawei.com> (raw)

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 )


             reply	other threads:[~2020-05-12 12:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-12 12:48 Yonglong Liu [this message]
2020-05-12 14:00 ` Andrew Lunn
2020-05-13  1:34   ` Yonglong Liu
2020-05-13  1:59     ` Andrew Lunn
2020-05-13  3:04       ` Yonglong Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=478f871a-583d-01f1-9cc5-2eea56d8c2a7@huawei.com \
    --to=liuyonglong@huawei.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=hkallweit1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=salil.mehta@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®