All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: Linux Netdev List <netdev@vger.kernel.org>,
	Vladimir Oltean <olteanv@gmail.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Russell King <linux@armlinux.org.uk>,
	Michal Kubecek <mkubecek@suse.cz>,
	Heiner Kallweit <hkallweit1@gmail.com>
Subject: Re: PHY vs. MAC ethtool Wake-on-LAN selection
Date: Sun, 27 Jun 2021 19:06:45 +0200	[thread overview]
Message-ID: <YNiwJTgEZjRG7bha@lunn.ch> (raw)
In-Reply-To: <554fea3f-ba7c-b2fc-5ee6-755015f6dfba@gmail.com>

> - Ethernet MAC (bcmgenet) is capable of doing Wake-on-LAN using Magic
> Packets (g) with password (s) or network filters (f) and is powered on in
> the "standby" (as written in /sys/power/state) suspend state, and completely
> powered off (by hardware) in the "mem" state
> 
> - Ethernet PHY (broadcom.c, no code there to support WoL yet) is capable of
> doing Wake-on-LAN using Magic Packets (g) with password (s) or a 48-bit MAC
> destination address (f) match allowing us to match on say, Broadcom and
> Multicast. That PHY is on during both the "standby" and "mem" suspend states

Marvell systems are similar. The mvneta hardware has support for WOL,
and has quite a capable filter. But there is no driver support. WOL is
simply forwarded to the PHY.

> What I envision we could do is add a ETHTOOL_A_WOL_DEVICE u8 field and have
> it take the values: 0 (default), 1 (MAC), 2 (PHY), 3 (both) and you would do
> the following on the command line:
> 
> ethtool -s eth0 wol g # default/existing mode, leave it to the driver
> ethtool -s eth0 wol g target mac # target the MAC only
> ethtool -s eth0 wol g target phy # target the PHY only
> ethtool -s eth0 wol g target mac+phy # target both MAC and PHY

This API seems like a start, but is it going to be limiting? It does
not appear you can say:

ethtool -s eth0 wol g target phy wol f target mac

So make use of magic packet in the PHY and filtering in the MAC.
ETHTOOL_A_WOL_DEVICE u8 appears to apply to all WoL options, not one
u8 per option.

And does mac+phy mean both will generate an interrupt? I'm assuming
the default of 0 means do whatever undefined behaviour we have now. Do
we need another value, 4 (auto) and the MAC driver will first try to
offload to the PHY, and if that fails, it does it at the MAC, with the
potential for some options to be in the MAC and some in the PHY?

> Is that over engineering or do you see other platforms possibly needing that
> distinction?

The over engineering question is clearly valid. Do we actually need to
support all possible options? I've made little use of WoL, so i don't
think i can answer that question.

Also, when it comes to implementation, i would suggest trying to pull
the interpretation of target and decision for MAC or PHY out into
helpers. The complexity is quite high, and if we want uniform
implementation, we want one implementation of it.

	Andrew

  reply	other threads:[~2021-06-27 17:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-27  3:53 PHY vs. MAC ethtool Wake-on-LAN selection Florian Fainelli
2021-06-27 17:06 ` Andrew Lunn [this message]
2021-06-27 19:09   ` Russell King (Oracle)
2021-06-28  3:29     ` Florian Fainelli
2021-06-28 19:53 ` 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=YNiwJTgEZjRG7bha@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mkubecek@suse.cz \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.