[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YsHF7G+afEkcBGw6@lunn.ch>
Date: Sun, 3 Jul 2022 18:38:04 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Tristram.Ha@...rochip.com
Cc: "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
UNGLinuxDriver@...rochip.com
Subject: Re: [PATCH net-next 1/2] net: phy: smsc: add WoL support to
LAN8740/LAN8742 PHYs.
> +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
Powered by blists - more mailing lists