Netdev List
 help / color / mirror / Atom feed
From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Antoine Tenart <atenart@kernel.org>,
	Michael Walle <michael@walle.cc>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Ioana Ciornei <ioana.ciornei@nxp.com>,
	Maxim Kochetkov <fido_max@inbox.ru>,
	Bjarni Jonasson <bjarni.jonasson@microchip.com>,
	Steen Hegelund <steen.hegelund@microchip.com>,
	"UNGLinuxDriver@microchip.com" <UNGLinuxDriver@microchip.com>,
	"bcm-kernel-feedback-list@broadcom.com" 
	<bcm-kernel-feedback-list@broadcom.com>,
	Nicolas Ferre <nicolas.ferre@microchip.com>,
	Claudiu Beznea <claudiu.beznea@microchip.com>
Subject: Re: [RFC PATCH v3 net-next 2/6] net: phylink: introduce a generic method for querying PHY in-band autoneg capability
Date: Wed, 22 Sep 2021 21:48:28 +0000	[thread overview]
Message-ID: <20210922214827.wczsgk3yw3vjsv5w@skbuf> (raw)
In-Reply-To: <20210922213116.7wlvnjfeqjltiecs@skbuf>

On Thu, Sep 23, 2021 at 12:31:16AM +0300, Vladimir Oltean wrote:
> On Wed, Sep 22, 2021 at 10:22:19PM +0100, Russell King (Oracle) wrote:
> > On Wed, Sep 22, 2021 at 09:14:42PM +0300, Vladimir Oltean wrote:
> > > +static unsigned int phylink_fixup_inband_aneg(struct phylink *pl,
> > > +					      struct phy_device *phy,
> > > +					      unsigned int mode)
> > > +{
> > > +	int ret;
> > > +
> > > +	ret = phy_validate_inband_aneg(phy, pl->link_interface);
> > > +	if (ret == PHY_INBAND_ANEG_UNKNOWN) {
> > > +		phylink_dbg(pl,
> > > +			    "PHY driver does not report in-band autoneg capability, assuming %s\n",
> > > +			    phylink_autoneg_inband(mode) ? "true" : "false");
> > > +
> > > +		return mode;
> > > +	}
> > > +
> > > +	if (phylink_autoneg_inband(mode) && !(ret & PHY_INBAND_ANEG_ON)) {
> > > +		phylink_err(pl,
> > > +			    "Requested in-band autoneg but driver does not support this, disabling it.\n");
> > 
> > If we add support to the BCM84881 driver to work with
> > phy_validate_inband_aneg(), then this will always return
> > PHY_INBAND_ANEG_OFF and never PHY_INBAND_ANEG_ON. Consequently,
> > this will always produce this "error". It is not an error in the
> > SFP case, but it is if firmware is misconfigured.
> > 
> > So, this needs better handling - we should not be issuing an error-
> > level kernel message for something that is "normal".
> 
> Is this better?
> 
> 		phylink_printk(phy_on_sfp(phy) ? KERN_DEBUG : KERN_ERR, pl,
> 			       "Requested in-band autoneg but driver does not support this, disabling it.\n");

Ah, not sure whether that was a trick question or not, but
phylink_fixup_inband_aneg function does not get called for the SFP code
path, I even noted this in the commit message but forgot:

|   So if the 3 code paths:
|   - phylink_sfp_config
|   - phylink_connect_phy
|   - phylink_fwnode_phy_connect
|
|   do more or less the same thing (adapt pl->cur_link_an_mode based on the
|   capability reported by the PHY), the intention is different. With SFP
|   modules this behavior is absolutely to be expected, and pl->cfg_link_an_mode
|   only denotes the initial operating mode. On the other hand, when the PHY
|   is on-board, the initial link AN mode should ideally also be the final
|   one. So the implementations for the three are different.

That's why phy_validate_inband_aneg is called twice, once in
phylink_sfp_config and once for the on-board case.

  reply	other threads:[~2021-09-22 21:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-22 18:14 [RFC PATCH v3 net-next 0/6] Let phylink manage in-band AN for the PHY Vladimir Oltean
2021-09-22 18:14 ` [RFC PATCH v3 net-next 1/6] net: phylink: pass the phy argument to phylink_sfp_config Vladimir Oltean
2021-09-22 18:14 ` [RFC PATCH v3 net-next 2/6] net: phylink: introduce a generic method for querying PHY in-band autoneg capability Vladimir Oltean
2021-09-22 21:22   ` Russell King (Oracle)
2021-09-22 21:31     ` Vladimir Oltean
2021-09-22 21:48       ` Vladimir Oltean [this message]
2021-09-22 23:03         ` Russell King (Oracle)
2021-09-22 23:50           ` Vladimir Oltean
2021-09-23  8:19             ` Russell King (Oracle)
2021-09-23  9:58               ` Vladimir Oltean
2021-09-23 10:20                 ` Russell King (Oracle)
2021-09-22 18:14 ` [RFC PATCH v3 net-next 3/6] net: phy: bcm84881: move the in-band capability check where it belongs Vladimir Oltean
2021-09-22 18:14 ` [RFC PATCH v3 net-next 4/6] net: phylink: explicitly configure in-band autoneg for PHYs that support it Vladimir Oltean
2021-09-22 18:14 ` [RFC PATCH v3 net-next 5/6] net: phy: mscc: configure in-band auto-negotiation for VSC8514 Vladimir Oltean
2021-09-22 18:14 ` [RFC PATCH v3 net-next 6/6] net: phy: at803x: configure in-band auto-negotiation for AR8031/AR8033 Vladimir Oltean

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=20210922214827.wczsgk3yw3vjsv5w@skbuf \
    --to=vladimir.oltean@nxp.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=atenart@kernel.org \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=bjarni.jonasson@microchip.com \
    --cc=claudiu.beznea@microchip.com \
    --cc=f.fainelli@gmail.com \
    --cc=fido_max@inbox.ru \
    --cc=hkallweit1@gmail.com \
    --cc=ioana.ciornei@nxp.com \
    --cc=linux@armlinux.org.uk \
    --cc=michael@walle.cc \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=steen.hegelund@microchip.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