All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: bcmgenet: Don't claim WOL when its not available
@ 2022-03-10  4:55 Jeremy Linton
  2022-03-10 17:30 ` Peter Robinson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jeremy Linton @ 2022-03-10  4:55 UTC (permalink / raw)
  To: netdev
  Cc: opendmb, f.fainelli, davem, kuba, bcm-kernel-feedback-list,
	linux-kernel, pbrobinson, Jeremy Linton

Some of the bcmgenet platforms don't correctly support WOL, yet
ethtool returns:

"Supports Wake-on: gsf"

which is false.

Ideally if there isn't a wol_irq, or there is something else that
keeps the device from being able to wakeup it should display:

"Supports Wake-on: d"

This patch checks whether the device can wakup, before using the
hard-coded supported flags. This corrects the ethtool reporting, as
well as the WOL configuration because ethtool verifies that the mode
is supported before attempting it.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c b/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c
index e31a5a397f11..f55d9d9c01a8 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c
@@ -40,6 +40,13 @@
 void bcmgenet_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
 {
 	struct bcmgenet_priv *priv = netdev_priv(dev);
+	struct device *kdev = &priv->pdev->dev;
+
+	if (!device_can_wakeup(kdev)) {
+		wol->supported = 0;
+		wol->wolopts = 0;
+		return;
+	}
 
 	wol->supported = WAKE_MAGIC | WAKE_MAGICSECURE | WAKE_FILTER;
 	wol->wolopts = priv->wolopts;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: bcmgenet: Don't claim WOL when its not available
  2022-03-10  4:55 [PATCH] net: bcmgenet: Don't claim WOL when its not available Jeremy Linton
@ 2022-03-10 17:30 ` Peter Robinson
  2022-03-10 18:52 ` Florian Fainelli
  2022-03-10 23:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Robinson @ 2022-03-10 17:30 UTC (permalink / raw)
  To: Jeremy Linton
  Cc: netdev, opendmb, f.fainelli, davem, kuba,
	bcm-kernel-feedback-list, linux-kernel

On Thu, Mar 10, 2022 at 4:55 AM Jeremy Linton <jeremy.linton@arm.com> wrote:
>
> Some of the bcmgenet platforms don't correctly support WOL, yet
> ethtool returns:
>
> "Supports Wake-on: gsf"
>
> which is false.
>
> Ideally if there isn't a wol_irq, or there is something else that
> keeps the device from being able to wakeup it should display:
>
> "Supports Wake-on: d"
>
> This patch checks whether the device can wakup, before using the
> hard-coded supported flags. This corrects the ethtool reporting, as
> well as the WOL configuration because ethtool verifies that the mode
> is supported before attempting it.
>
> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com>

This fixes the reporting of the WOL capabilities on the Raspberry Pi 4.

> ---
>  drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c b/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c
> index e31a5a397f11..f55d9d9c01a8 100644
> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c
> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c
> @@ -40,6 +40,13 @@
>  void bcmgenet_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
>  {
>         struct bcmgenet_priv *priv = netdev_priv(dev);
> +       struct device *kdev = &priv->pdev->dev;
> +
> +       if (!device_can_wakeup(kdev)) {
> +               wol->supported = 0;
> +               wol->wolopts = 0;
> +               return;
> +       }
>
>         wol->supported = WAKE_MAGIC | WAKE_MAGICSECURE | WAKE_FILTER;
>         wol->wolopts = priv->wolopts;
> --
> 2.35.1
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: bcmgenet: Don't claim WOL when its not available
  2022-03-10  4:55 [PATCH] net: bcmgenet: Don't claim WOL when its not available Jeremy Linton
  2022-03-10 17:30 ` Peter Robinson
@ 2022-03-10 18:52 ` Florian Fainelli
  2022-03-10 23:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2022-03-10 18:52 UTC (permalink / raw)
  To: Jeremy Linton, netdev
  Cc: opendmb, f.fainelli, davem, kuba, bcm-kernel-feedback-list,
	linux-kernel, pbrobinson

[-- Attachment #1: Type: text/plain, Size: 790 bytes --]

On 3/9/22 8:55 PM, Jeremy Linton wrote:
> Some of the bcmgenet platforms don't correctly support WOL, yet
> ethtool returns:
> 
> "Supports Wake-on: gsf"
> 
> which is false.
> 
> Ideally if there isn't a wol_irq, or there is something else that
> keeps the device from being able to wakeup it should display:
> 
> "Supports Wake-on: d"
> 
> This patch checks whether the device can wakup, before using the
> hard-coded supported flags. This corrects the ethtool reporting, as
> well as the WOL configuration because ethtool verifies that the mode
> is supported before attempting it.
> 
> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Fixes: c51de7f3976b ("net: bcmgenet: add Wake-on-LAN support code")

Thanks Jeremy!
-- 
Florian

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: bcmgenet: Don't claim WOL when its not available
  2022-03-10  4:55 [PATCH] net: bcmgenet: Don't claim WOL when its not available Jeremy Linton
  2022-03-10 17:30 ` Peter Robinson
  2022-03-10 18:52 ` Florian Fainelli
@ 2022-03-10 23:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-03-10 23:00 UTC (permalink / raw)
  To: Jeremy Linton
  Cc: netdev, opendmb, f.fainelli, davem, kuba,
	bcm-kernel-feedback-list, linux-kernel, pbrobinson

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Wed,  9 Mar 2022 22:55:35 -0600 you wrote:
> Some of the bcmgenet platforms don't correctly support WOL, yet
> ethtool returns:
> 
> "Supports Wake-on: gsf"
> 
> which is false.
> 
> [...]

Here is the summary with links:
  - net: bcmgenet: Don't claim WOL when its not available
    https://git.kernel.org/netdev/net/c/00b022f8f876

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-03-10 23:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-10  4:55 [PATCH] net: bcmgenet: Don't claim WOL when its not available Jeremy Linton
2022-03-10 17:30 ` Peter Robinson
2022-03-10 18:52 ` Florian Fainelli
2022-03-10 23:00 ` patchwork-bot+netdevbpf

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.