From: Andrew Lunn <andrew@lunn.ch>
To: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
David Miller <davem@davemloft.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next] net: phy: improve setting advertised modes in phy_probe
Date: Sun, 28 Apr 2019 23:21:13 +0200 [thread overview]
Message-ID: <20190428212113.GA10772@lunn.ch> (raw)
In-Reply-To: <b7ece77b-c7cc-ba54-2caf-c25c19de0724@gmail.com>
On Sun, Apr 28, 2019 at 08:10:43PM +0200, Heiner Kallweit wrote:
> On 28.04.2019 19:04, Andrew Lunn wrote:
> > On Sun, Apr 28, 2019 at 03:03:37PM +0200, Heiner Kallweit wrote:
> >> So far we set the advertising bitmap before setting the pause flags
> >> in the supported bitmap. This may cause pause not being advertised.
> >
> > Hi Heiner
> >
> > Pause requires that the PHY can advertise the pause bits, and that the
> > MAC supports pause. So by default, we don't advertise pause. The MAC
> > needs to say it supports pause, by calling one of
> >
> > void phy_support_sym_pause(struct phy_device *phydev);
> > void phy_support_asym_pause(struct phy_device *phydev);
> >
> > These two then copy supported into advertising.
> >
> Right, missed that. After checking the code a little bit more I think
> we still may have few issues with pause settings.
Hi Heiner
I agree the current state could be improved. We just have to be
careful how we do it. We don't want to introduce regressions. There
are a lot of MAC drivers we have no idea if they support pause or not.
We do get some clues from .set_pauseparam.
> 1.
> We have functions that copy supported -> advertising, e.g.
> phy_set_max_speed(). If such a function is called pause gets advertised
> even w/o the MAC calling one of the two functions.
Yes. I'm not sure supported is the best place to keep this information
about what the PHY can do about pause, because off issues like
this. You also see such copies in a few MAC drivers. So we might want
to move PHY pause capability it into new bits in phydev.
> 2.
> We have PHY's (e.g. KSZ9031) that support sym pause only due to a hw
> erratum. If the MAC now calls phy_support_asym_pause() it sets the
> asym pause flag in phydev->supported even though the PHY intentionally
> disabled it. That's not nice ..
Yes, some validation would be good.
> Maybe we should do it differently:
> Apply my patch, then both pause modes are initially advertised.
> (This also avoids point 3 below)
> - remove phy_support_asym_pause()
> - phy_support_sym_pause() clears the asym pause bit and doesn't touch
> sym pause bit.
> - and we may need something like phy_support_no_pause().
I would prefer to keep with the assumption that the MAC does not
support pause until it tells us it does.
> 3.
> What's with all the existing drivers where the MAC supports pause but
> drivers call neither of the two functions?
Apart from .set_pauseparams, we have no way to identify them.
> 4.
> Calling either of the two functions will be effective after an autoneg
> restart only. Do we have to consider this?
The code i've seen does this before calling phy_start(). So i don't
think it is an issue. But we could add in code to see if the phy has
been started, and if so, restart autoneg.
Andrew
prev parent reply other threads:[~2019-04-28 21:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-28 13:03 [PATCH net-next] net: phy: improve setting advertised modes in phy_probe Heiner Kallweit
2019-04-28 17:04 ` Andrew Lunn
2019-04-28 18:10 ` Heiner Kallweit
2019-04-28 21:21 ` Andrew Lunn [this message]
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=20190428212113.GA10772@lunn.ch \
--to=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--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).