All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Tristram.Ha@microchip.com
Cc: "David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, UNGLinuxDriver@microchip.com
Subject: Re: [PATCH net-next 1/2] net: phy: smsc: add WoL support to LAN8740/LAN8742 PHYs.
Date: Sun, 3 Jul 2022 18:38:04 +0200	[thread overview]
Message-ID: <YsHF7G+afEkcBGw6@lunn.ch> (raw)
In-Reply-To: <1656802708-7918-2-git-send-email-Tristram.Ha@microchip.com>

> +static void lan874x_get_wol(struct phy_device *phydev,
> +			    struct ethtool_wolinfo *wol)
> +{
> +	struct smsc_phy_priv *priv = phydev->priv;
> +	u16 val_wucsr;
> +	int rc;

> +
> +	/* WoL event notification */
> +	if (val_wucsr & MII_LAN874X_PHY_WOL_WUFR) {
> +		if (wol->wolopts & WAKE_ARP)
> +			phydev_info(phydev, "ARP WoL event received\n");
> +		if (wol->wolopts & WAKE_MCAST)
> +			phydev_info(phydev, "MCAST WoL event received\n");
> +	}
> +
> +	if (val_wucsr & MII_LAN874X_PHY_WOL_PFDA_FR)
> +		phydev_info(phydev, "UCAST WoL event received\n");
> +
> +	if (val_wucsr & MII_LAN874X_PHY_WOL_BCAST_FR)
> +		phydev_info(phydev, "BCAST WoL event received\n");
> +
> +	if (val_wucsr & MII_LAN874X_PHY_WOL_MPR)
> +		phydev_info(phydev, "Magic WoL event received\n");
> +
> +	/* clear WoL event */
> +	rc = phy_write_mmd(phydev, MDIO_MMD_PCS, MII_LAN874X_PHY_MMD_WOL_WUCSR,
> +			   val_wucsr);

Why dump this information to the kernel log? And why clear it, in
get_wol. I assume WOL triggers an interrupt? Then dumping the event in
the interrupt handler would make sense. Also clearing the event in the
interrupt handler is probably required, since it is probably a level
interrupt, and you want to avoid a storm. But in get_wol?

> +static int lan874x_set_wol(struct phy_device *phydev,
> +			   struct ethtool_wolinfo *wol)
> +{
> +	struct net_device *ndev = phydev->attached_dev;
> +	struct smsc_phy_priv *priv = phydev->priv;
> +	u16 val, val_wucsr;
> +	int i = 0, rc;
> +	u8 data[128];
> +	u8 datalen;
> +

Do you need to clear the WOL event here? Could there be an event left
over from the past?

     Andrew

  reply	other threads:[~2022-07-03 16:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-02 22:58 [PATCH net-next 0/2] net: phy: smsc: add WoL and EEE support to LAN8740/LAN8742 Tristram.Ha
2022-07-02 22:58 ` [PATCH net-next 1/2] net: phy: smsc: add WoL support to LAN8740/LAN8742 PHYs Tristram.Ha
2022-07-03 16:38   ` Andrew Lunn [this message]
2022-07-02 22:58 ` [PATCH net-next 2/2] net: phy: smsc: add EEE " Tristram.Ha
2022-07-03 16:43   ` Andrew Lunn

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=YsHF7G+afEkcBGw6@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=Tristram.Ha@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=davem@davemloft.net \
    --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 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.