From: "Marek Behún" <kabel@kernel.org>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>
Cc: netdev@vger.kernel.org, Andrew Lunn <andrew@lunn.ch>,
Jakub Kicinski <kuba@kernel.org>,
davem@davemloft.net
Subject: Re: [PATCH net 6/6] net: dsa: mv88e6xxx: Link in pcs_get_state() if AN is bypassed
Date: Tue, 30 Nov 2021 17:09:11 +0100 [thread overview]
Message-ID: <20211130170911.6355db44@thinkpad> (raw)
In-Reply-To: <20211130011812.08baccdc@thinkpad>
On Tue, 30 Nov 2021 01:18:12 +0100
Marek Behún <kabel@kernel.org> wrote:
> On Mon, 29 Nov 2021 23:14:17 +0000
> "Russell King (Oracle)" <linux@armlinux.org.uk> wrote:
>
> > On Mon, Nov 29, 2021 at 08:58:23PM +0100, Marek Behún wrote:
> > > static int mv88e6xxx_serdes_pcs_get_state(struct mv88e6xxx_chip *chip,
> > > - u16 status, u16 lpa,
> > > + u16 ctrl, u16 status, u16 lpa,
> > > struct phylink_link_state *state)
> > > {
> > > + state->link = !!(status & MV88E6390_SGMII_PHY_STATUS_LINK);
> > > +
> > > if (status & MV88E6390_SGMII_PHY_STATUS_SPD_DPL_VALID) {
> > > - state->link = !!(status & MV88E6390_SGMII_PHY_STATUS_LINK);
> > > + state->an_complete = !!(ctrl & BMCR_ANENABLE);
> >
> > I think I'd much rather report the value of BMSR_ANEGCAPABLE - since
> > an_complete controls the BMSR_ANEGCAPABLE bit in the emulated PHY
> > that userspace sees. Otherwise, an_complete is not used.
> >
> > state->link is the key that phylink uses to know whether it can
> > trust the status being reported.
>
> Isn't BMSR_ANEGCAPABLE set to 1 even if aneg is disabled in BMCR?
> I will test tomorrow.
>
> The reason why I used BMCR_ANENABLE is that if we don't enable AN, the
> PHY will report SPD_DPL_VALID if link is up. But clearly AN is not
> completed in that case, because it was never enabled in the first place.
Seems that BMSR_ANEGCAPABLE is set even if AN is disabled in BMCR.
If phylink_autoneg_inband() is not true mv88e6*_serdes_pcs_config(),
then we aren't enabling AN. But in this case SPD_DPL_VALID is always 1,
so if we use, as you say, an_complete=BMSR_ANEGCAPABLE in
mv88e6xxx_serdes_pcs_get_state(), we will always set an_complete=true, even
if AN wasn't enabled.
I was under the impression that
state->an_complete
should only be set to true if AN is enabled.
Marek
next prev parent reply other threads:[~2021-11-30 16:10 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-29 19:58 [PATCH net 0/6] mv88e6xxx fixes (mainly 88E6393X family) Marek Behún
2021-11-29 19:58 ` [PATCH net 1/6] net: dsa: mv88e6xxx: Fix application of erratum 4.8 for 88E6393X Marek Behún
2021-11-29 19:58 ` [PATCH net 2/6] net: dsa: mv88e6xxx: Drop unnecessary check in mv88e6393x_serdes_erratum_4_6() Marek Behún
2021-11-29 19:58 ` [PATCH net 3/6] net: dsa: mv88e6xxx: Save power by disabling SerDes trasmitter and receiver Marek Behún
2021-11-29 23:06 ` Russell King (Oracle)
2021-11-30 0:13 ` Marek Behún
2021-11-29 19:58 ` [PATCH net 4/6] net: dsa: mv88e6xxx: Add fix for erratum 5.2 of 88E6393X family Marek Behún
2021-11-29 19:58 ` [PATCH net 5/6] net: dsa: mv88e6xxx: Fix inband AN for 2500base-x on " Marek Behún
2021-11-29 19:58 ` [PATCH net 6/6] net: dsa: mv88e6xxx: Link in pcs_get_state() if AN is bypassed Marek Behún
2021-11-29 23:14 ` Russell King (Oracle)
2021-11-30 0:18 ` Marek Behún
2021-11-30 16:09 ` Marek Behún [this message]
2021-11-30 16:15 ` Russell King (Oracle)
2021-11-30 16:18 ` Marek Behún
2021-11-30 16:22 ` Russell King (Oracle)
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=20211130170911.6355db44@thinkpad \
--to=kabel@kernel.org \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
/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).