Subject: Re: [PATCH v2 net-next 6/9] lan743x: Add power management support

From: Andrew Lunn <[email-masked]>
Date: Fri, 13 Jul 2018 00:42:34 +0200

> +#ifdef CONFIG_PM
> +static void lan743x_ethtool_get_wol(struct net_device *netdev,
> +				    struct ethtool_wolinfo *wol)
> +{
> +	struct lan743x_adapter *adapter = netdev_priv(netdev);
> +
> +	wol->supported = WAKE_BCAST | WAKE_UCAST | WAKE_MCAST |
> +		WAKE_MAGIC | WAKE_PHY | WAKE_ARP;
> +
> +	wol->wolopts = adapter->wolopts;
> +}
> +#endif /* CONFIG_PM */
> +
> +#ifdef CONFIG_PM
> +static int lan743x_ethtool_set_wol(struct net_device *netdev,
> +				   struct ethtool_wolinfo *wol)
> +{
> +	struct lan743x_adapter *adapter = netdev_priv(netdev);
> +
> +	if (wol->wolopts & WAKE_MAGICSECURE)
> +		return -EOPNOTSUPP;
> +
> +	adapter->wolopts = 0;
> +	if (wol->wolopts & WAKE_UCAST)
> +		adapter->wolopts |= WAKE_UCAST;
> +	if (wol->wolopts & WAKE_MCAST)
> +		adapter->wolopts |= WAKE_MCAST;
> +	if (wol->wolopts & WAKE_BCAST)
> +		adapter->wolopts |= WAKE_BCAST;
> +	if (wol->wolopts & WAKE_MAGIC)
> +		adapter->wolopts |= WAKE_MAGIC;
> +	if (wol->wolopts & WAKE_PHY)
> +		adapter->wolopts |= WAKE_PHY;
> +	if (wol->wolopts & WAKE_ARP)
> +		adapter->wolopts |= WAKE_ARP;
> +
> +	device_set_wakeup_enable(&adapter->pdev->dev, (bool)wol->wolopts);
> +
> +	phy_ethtool_set_wol(netdev->phydev, wol);

Hi Bryan

This seems asymmetric. set_wol you call into the phylib to enable wol
in the PHY. But get_wol does not call into phylib. So the phy has no
chance to set what it supports.

       Andrew