netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>
Cc: Heiner Kallweit <hkallweit1@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, Marek Beh__n <kabel@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>
Subject: Re: [PATCH net-next] net: phy: marvell10g: add downshift tunable support
Date: Thu, 23 Sep 2021 01:56:22 +0200	[thread overview]
Message-ID: <YUvCpjql8V4FGB2s@lunn.ch> (raw)
In-Reply-To: <YUsa3z8KsuqS64k8@shell.armlinux.org.uk>

On Wed, Sep 22, 2021 at 01:00:31PM +0100, Russell King (Oracle) wrote:
> On Fri, Sep 17, 2021 at 03:58:01PM +0100, Russell King (Oracle) wrote:
> > On Fri, Sep 17, 2021 at 04:45:03PM +0200, Andrew Lunn wrote:
> > > > +static int mv3310_set_downshift(struct phy_device *phydev, u8 ds)
> > > > +{
> > > > +	struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev);
> > > > +	u16 val;
> > > > +	int err;
> > > > +
> > > > +	if (!priv->has_downshift)
> > > > +		return -EOPNOTSUPP;
> > > > +
> > > > +	if (ds == DOWNSHIFT_DEV_DISABLE)
> > > > +		return phy_clear_bits_mmd(phydev, MDIO_MMD_PCS, MV_PCS_DSC1,
> > > > +					  MV_PCS_DSC1_ENABLE);
> > > > +
> > > > +	/* FIXME: The default is disabled, so should we disable? */
> > > > +	if (ds == DOWNSHIFT_DEV_DEFAULT_COUNT)
> > > > +		ds = 2;
> > > 
> > > Hi Russell
> > > 
> > > Rather than a FIXME, maybe just document that the hardware default is
> > > disabled, which does not make too much sense, so default to 2 attempts?
> > 
> > Sadly, the downshift parameters aren't documented at all in the kernel,
> > and one has to dig into the ethtool source to find out what they mean:
> > 
> > DOWNSHIFT_DEV_DEFAULT_COUNT -
> > 	ethtool --set-phy-tunable ethN downshift on
> > DOWNSHIFT_DEV_DISABLE -
> > 	ethtool --set-phy-tunable ethN downshift off
> > otherwise:
> > 	ethtool --set-phy-tunable ethN downshift count N
> > 
> > This really needs to be documented somewhere in the kernel.
> 
> I was hoping that this would cause further discussion on what the
> exact meaning of "DOWNSHIFT_DEV_DEFAULT_COUNT" is. Clearly, it's
> meant to turn downshift on, but what does "default" actually mean?

I guess this comes from the fact every other PHY has a bit to enable
downshift, and a counter from saying how many attempts to make. And
the counter has a documented default value.

> If we define "default" as "whatever the hardware defaults to" then
> for this phy, that would be turning off downshift.

Which does not make sense.

> So, should we rename "DOWNSHIFT_DEV_DEFAULT_COUNT" to be
> "DOWNSHIFT_DEV_ENABLE" rather than trying to imply that it's
> some kind of default that may need to be made up?

The value is made up anyway. Normally the silicon vendor picks a
value, and that is what you get after a reset. Does it make that much
difference if in this case if you pick the value, rather than Marvell?
None of this is standardised as far as i know, there is no correct
value.

	Andrew

  reply	other threads:[~2021-09-22 23:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-17 13:48 [PATCH net-next] net: phy: marvell10g: add downshift tunable support Russell King
2021-09-17 14:45 ` Andrew Lunn
2021-09-17 14:58   ` Russell King (Oracle)
2021-09-22 12:00     ` Russell King (Oracle)
2021-09-22 23:56       ` Andrew Lunn [this message]
2021-09-23 10:15         ` Russell King (Oracle)
2021-09-26 15:24           ` Andrew Lunn

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=YUvCpjql8V4FGB2s@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=hkallweit1@gmail.com \
    --cc=kabel@kernel.org \
    --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).