All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Robinson <pbrobinson@gmail.com>
To: Jeremy Linton <jeremy.linton@arm.com>
Cc: netdev@vger.kernel.org, opendmb@gmail.com, f.fainelli@gmail.com,
	davem@davemloft.net, kuba@kernel.org,
	bcm-kernel-feedback-list@broadcom.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: bcmgenet: Don't claim WOL when its not available
Date: Thu, 10 Mar 2022 17:30:31 +0000	[thread overview]
Message-ID: <CALeDE9OjSAV0Mas7NPJfFQ5SW6ZJV8HgyvZyVnE_LZK2tkPOmQ@mail.gmail.com> (raw)
In-Reply-To: <20220310045535.224450-1-jeremy.linton@arm.com>

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
>

  reply	other threads:[~2022-03-10 17:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2022-03-10 18:52 ` Florian Fainelli
2022-03-10 23:00 ` patchwork-bot+netdevbpf

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=CALeDE9OjSAV0Mas7NPJfFQ5SW6ZJV8HgyvZyVnE_LZK2tkPOmQ@mail.gmail.com \
    --to=pbrobinson@gmail.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=jeremy.linton@arm.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=opendmb@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.