From: Heiner Kallweit <hkallweit1@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
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 2/2] net: phy: add phy_speed_down and phy_speed_up
Date: Wed, 11 Jul 2018 23:08:52 +0200 [thread overview]
Message-ID: <7dfcb4d5-2a0c-9244-53e4-564014b16b58@gmail.com> (raw)
In-Reply-To: <20180711205518.GJ21430@lunn.ch>
On 11.07.2018 22:55, Andrew Lunn wrote:
>> +/**
>> + * phy_speed_down - set speed to lowest speed supported by both link partners
>> + * @phydev: the phy_device struct
>> + * @sync: perform action synchronously
>> + *
>> + * Description: Typically used to save energy when waiting for a WoL packet
>> + */
>> +int phy_speed_down(struct phy_device *phydev, bool sync)
>
> This sync parameter needs some more thought. I'm not sure it is safe.
>
> How does a PHY trigger a WoL wake up? I guess some use the interrupt
> pin. How does a PHY indicate auto-neg has completed? It triggers an
> interrupt. So it seems like there is a danger here we suspend, and
> then wake up 2 seconds later when auto-neg has completed.
>
> I'm not sure we can safely suspend until auto-neg has completed.
>
>> +/**
>> + * phy_speed_up - (re)set advertised speeds to all supported speeds
>> + * @phydev: the phy_device struct
>> + * @sync: perform action synchronously
>> + *
>> + * Description: Used to revert the effect of phy_speed_down
>> + */
>> +int phy_speed_up(struct phy_device *phydev, bool sync)
>
> And here, i'm thinking the opposite. A MAC driver needs to be ready
> for the PHY state to change at any time. So why do we need to wait?
> Just let the normal mechanisms inform the MAC when the link is up.
>
I see your points, thanks for the feedback. In my case WoL triggers
a PCI PME and the code works as expected, but I agree this may be
different in other setups (external PHY).
The sync parameter was inspired by following comment from Florian:
"One thing that bothers me a bit is that this should ideally be
offered as both blocking and non-blocking options"
So let's see which comments he may have before preparing a v2.
> Andrew
>
Heiner
next prev parent reply other threads:[~2018-07-11 21:15 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-11 20:29 [PATCH net-next 0/2] net: phy: add functionality to speed down PHY when waiting for WoL packet Heiner Kallweit
2018-07-11 20:30 ` [PATCH net-next 1/2] net: phy: add helper phy_config_aneg Heiner Kallweit
2018-07-11 20:38 ` Andrew Lunn
2018-07-11 21:04 ` Florian Fainelli
2018-07-11 20:31 ` [PATCH net-next 2/2] net: phy: add phy_speed_down and phy_speed_up Heiner Kallweit
2018-07-11 20:55 ` Andrew Lunn
2018-07-11 21:08 ` Heiner Kallweit [this message]
2018-07-11 21:33 ` Florian Fainelli
2018-07-11 21:59 ` Heiner Kallweit
2018-07-12 19:00 ` Heiner Kallweit
2018-07-12 19:09 ` Andrew Lunn
2018-07-12 19:10 ` Heiner Kallweit
2018-07-12 19:25 ` Florian Fainelli
2018-07-12 19:53 ` Florian Fainelli
2018-07-12 20:01 ` Heiner Kallweit
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=7dfcb4d5-2a0c-9244-53e4-564014b16b58@gmail.com \
--to=hkallweit1@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@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).