netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@corigine.com>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: netdev@vger.kernel.org, "Doug Berger" <opendmb@gmail.com>,
	"Broadcom internal kernel review list"
	<bcm-kernel-feedback-list@broadcom.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>, "Andrew Lunn" <andrew@lunn.ch>,
	"Heiner Kallweit" <hkallweit1@gmail.com>,
	"Russell King" <linux@armlinux.org.uk>,
	"Marek Behún" <kabel@kernel.org>,
	"Peter Geis" <pgwipeout@gmail.com>,
	Frank <Frank.Sae@motor-comm.com>,
	"open list" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next 2/3] net: phy: broadcom: Add support for Wake-on-LAN
Date: Mon, 8 May 2023 21:23:13 +0200	[thread overview]
Message-ID: <ZFlMIUB4rKQMQq9v@corigine.com> (raw)
In-Reply-To: <20230508184309.1628108-3-f.fainelli@gmail.com>

On Mon, May 08, 2023 at 11:43:08AM -0700, Florian Fainelli wrote:
> Add support for WAKE_UCAST, WAKE_MCAST, WAKE_BCAST, WAKE_MAGIC and
> WAKE_MAGICSECURE. This is only supported with the BCM54210E and
> compatible Ethernet PHYs. Using the in-band interrupt or an out of band
> GPIO interrupts are supported.
> 
> Broadcom PHYs will generate a Wake-on-LAN level low interrupt on LED4 as
> soon as one of the supported patterns is being matched. That includes
> generating such an interrupt even if the PHY is operated during normal
> modes. If WAKE_UCAST is selected, this could lead to the LED4 interrupt
> firing up for every packet being received which is absolutely
> undesirable from a performance point of view.
> 
> Because the Wake-on-LAN configuration can be set long before the system
> is actually put to sleep, we cannot have an interrupt service routine to
> clear on read the interrupt status register and ensure that new packet
> matches will be detected.
> 
> It is desirable to enable the Wake-on-LAN interrupt as late as possible
> during the system suspend process such that we limit the number of
> interrupts to be handled by the system, but also conversely feed into
> the Linux's system suspend way of dealing with interrupts in and around
> the points of no return.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

...

> @@ -437,14 +460,38 @@ static int bcm54xx_iddq_set(struct phy_device *phydev, bool enable)
>  	return ret;
>  }
>  
> -static int bcm54xx_suspend(struct phy_device *phydev)
> +static int bcm54xx_set_wakeup_irq(struct phy_device *phydev, bool state)
>  {
> +	struct bcm54xx_phy_priv *priv = phydev->priv;
>  	int ret;
>  
> +	if (!bcm54xx_phy_can_wakeup(phydev))
> +		return 0;
> +
> +	if (priv->wake_irq_enabled != state) {
> +		if (state)
> +			ret = enable_irq_wake(priv->wake_irq);
> +		else
> +			ret = disable_irq_wake(priv->wake_irq);
> +		priv->wake_irq_enabled = state;
> +	}

Hi Florian,

If priv->wake_irq_enabled == state the ret is uninitialised here.

> +
> +	return ret;
> +}

...

  parent reply	other threads:[~2023-05-08 19:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-08 18:43 [PATCH net-next 0/3] Support for Wake-on-LAN for Broadcom PHYs Florian Fainelli
2023-05-08 18:43 ` [PATCH net-next 1/3] net: phy: Let drivers check Wake-on-LAN status Florian Fainelli
2023-05-08 19:02   ` Andrew Lunn
2023-05-08 19:17     ` Florian Fainelli
2023-05-08 19:18       ` Florian Fainelli
2023-05-08 18:43 ` [PATCH net-next 2/3] net: phy: broadcom: Add support for Wake-on-LAN Florian Fainelli
2023-05-08 19:09   ` Andrew Lunn
2023-05-08 19:12     ` Florian Fainelli
2023-05-08 19:23   ` Simon Horman [this message]
2023-05-09  9:25   ` kernel test robot
2023-05-08 18:43 ` [PATCH net-next 3/3] net: bcmgenet: Add support for PHY-based Wake-on-LAN Florian Fainelli

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=ZFlMIUB4rKQMQq9v@corigine.com \
    --to=simon.horman@corigine.com \
    --cc=Frank.Sae@motor-comm.com \
    --cc=andrew@lunn.ch \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=kabel@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=opendmb@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=pgwipeout@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 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).