From: Andrew Lunn <andrew@lunn.ch>
To: Marek Behun <marek.behun@nic.cz>
Cc: Heiner Kallweit <hkallweit1@gmail.com>,
netdev@vger.kernel.org,
Sebastian Reichel <sebastian.reichel@collabora.co.uk>,
Vivien Didelot <vivien.didelot@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
"David S . Miller" <davem@davemloft.net>
Subject: Re: [PATCH net-next v2 1/1] net: dsa: fix fixed-link port registration
Date: Sun, 11 Aug 2019 17:18:30 +0200 [thread overview]
Message-ID: <20190811151830.GA14290@lunn.ch> (raw)
In-Reply-To: <20190811160404.06450685@nic.cz>
On Sun, Aug 11, 2019 at 04:04:04PM +0200, Marek Behun wrote:
> OK guys, something is terribly wrong here.
>
> I bisected to the commit mentioned (88d6272acaaa), looked around at the
> genphy functions, tried adding the link=0 workaround and it did work,
> so I though this was the issue.
>
> What I realized now is that before the commit 88d6272acaaa things
> worked because of two bugs, which negated each other. This commit caused
> one of this bugs not to fire, and thus the second bug was not negated.
>
> What actually happened before the commit that broke it is this:
> - after the fixed_phy is created, the parameters are corrent
> - genphy_read_status breaks the parameters:
> - first it sets the parameters to unknown (SPEED_UNKNOWN,
> DUPLEX_UNKNOWN)
> - then read the registers, which are simulated for fixed_phy
> - then it uses phy-core.c:phy_resolve_aneg_linkmode function, which
> looks for correct settings by bit-anding the ->advertising and
> ->lp_advertigins bit arrays. But in fixed_phy, ->lp_advertising
> is set to zero, so the parameters are left at SPEED_UNKNOWN, ...
> (this is the first bug)
> - then adjust_link is called, which then goes to
> mv88e6xxx_port_setup_mac, where there is a test if it should change
> something:
> if (state.link == link && state.speed == speed &&
> state.duplex == duplex)
> return 0;
> - since current speed on the switch port (state.speed) is SPEED_1000,
> and new speed is SPEED_UNKNOWN, this test fails, and so the rest of
> this function is called, which makes the port work
> (the if test is the second bug)
>
> After the commit that broke things:
> - after the fixed_phy is created, the parameters are corrent
> - genphy_read_status doesn't change them
> - mv88e6xxx_port_setup_mac does nothing, since the if condition above
> is true
>
> So, there are two things that are broken:
> - the test in mv88e6xxx_port_setup_mac whether there is to be a change
> should be more sophisticated
> - fixed_phy should also simulate the lp_advertising register
>
> What do you think of this?
Marek
This is the sort of information i like. I was having trouble
understanding what was really wrong and how it was fixed by your
previous patch.
So setting the emulated lp_advertise to advertise makes a lot of sense
for fixed phy. And it is something worthy of stable.
As for mv88e6xxx_port_setup_mac(), which parameter is actually
important here? My assumption was, if one of the other parameters
changes, it would not happen alone. The link would also go down, and
later come up again, etc. But it seems that assumption is wrong.
At a guess, it is the RGMII delays. That would explain CRC errors in
frames received by the master interface.
Andrew
next prev parent reply other threads:[~2019-08-11 15:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-11 3:18 [PATCH net-next v2 1/1] net: dsa: fix fixed-link port registration Marek Behún
2019-08-11 3:39 ` Andrew Lunn
2019-08-11 11:35 ` Heiner Kallweit
2019-08-11 14:04 ` Marek Behun
2019-08-11 15:08 ` Marek Behun
2019-08-11 15:16 ` Vladimir Oltean
2019-08-11 16:21 ` Marek Behun
2019-08-11 15:18 ` Andrew Lunn [this message]
2019-08-11 9:54 ` Sergei Shtylyov
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=20190811151830.GA14290@lunn.ch \
--to=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=marek.behun@nic.cz \
--cc=netdev@vger.kernel.org \
--cc=sebastian.reichel@collabora.co.uk \
--cc=vivien.didelot@gmail.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;
as well as URLs for NNTP newsgroup(s).