linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Woojung.Huh@microchip.com, netdev@vger.kernel.org
Cc: davem@davemloft.net, UNGLinuxDriver@microchip.com,
	steve.glendinning@shawell.net, keescook@chromium.org,
	akurz@blala.de, hayeswang@realtek.com,
	kai.heng.feng@canonical.com, grundler@chromium.org,
	zhongjiang@huawei.com, bigeasy@linutronix.de, ran.wang_1@nxp.com,
	edumazet@google.com, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net 3/7] lan78xx: Check for supported Wake-on-LAN modes
Date: Tue, 25 Sep 2018 11:35:48 -0700	[thread overview]
Message-ID: <8de18c23-d846-cbb4-c852-9b7d97a95c11@gmail.com> (raw)
In-Reply-To: <BN6PR1101MB2130D18F03C79BC1E54C9FBAE7160@BN6PR1101MB2130.namprd11.prod.outlook.com>

On 09/25/2018 10:32 AM, Woojung.Huh@microchip.com wrote:
> Hi Florian,
> 
>>>> +	if (pdata->wol == 0)
>>>> +		return -EINVAL;
>>>> +
>>> It will make function return when disabling WOL.
>>
>> Huh, yes, good point.
>>
>>> Is there other place handling this scenario?
>>
>> How do you mean?
>>
> I meant there is another path I might miss when disabling WOL 
> than this xxx_set_wol().

I don't think so, at least not from the ethtool perspective, this should
fix the issue before, and simplifying the code, since all we are doing
it taking a bitmask, checking each bit we support, and again, make it
the same bitmask in pdata->wol, can you test that? If you have a new
enough version of ethtool, try using: ethtool -s <iface> wol f, which
was added recently and which this driver does not support:

diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index a9991c5f4736..2e37028ef6ca 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -1401,19 +1401,10 @@ static int lan78xx_set_wol(struct net_device
*netdev,
        if (ret < 0)
                return ret;

-       pdata->wol = 0;
-       if (wol->wolopts & WAKE_UCAST)
-               pdata->wol |= WAKE_UCAST;
-       if (wol->wolopts & WAKE_MCAST)
-               pdata->wol |= WAKE_MCAST;
-       if (wol->wolopts & WAKE_BCAST)
-               pdata->wol |= WAKE_BCAST;
-       if (wol->wolopts & WAKE_MAGIC)
-               pdata->wol |= WAKE_MAGIC;
-       if (wol->wolopts & WAKE_PHY)
-               pdata->wol |= WAKE_PHY;
-       if (wol->wolopts & WAKE_ARP)
-               pdata->wol |= WAKE_ARP;
+       if (pdata->wol & ~WAKE_ALL)
+               return -EINVAL;
+
+       pdata->wol = wol->wolopts;

        device_set_wakeup_enable(&dev->udev->dev, (bool)wol->wolopts);


-- 
Florian

  reply	other threads:[~2018-09-25 18:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-24 20:54 [PATCH net 0/7] net: usb: Check for Wake-on-LAN modes Florian Fainelli
2018-09-24 20:54 ` [PATCH net 1/7] asix: Check for supported " Florian Fainelli
2018-09-24 20:54 ` [PATCH net 2/7] ax88179_178a: " Florian Fainelli
2018-09-24 20:54 ` [PATCH net 3/7] lan78xx: " Florian Fainelli
2018-09-25 17:19   ` Woojung.Huh
2018-09-25 17:26     ` Florian Fainelli
2018-09-25 17:32       ` Woojung.Huh
2018-09-25 18:35         ` Florian Fainelli [this message]
2018-09-25 22:32           ` Woojung.Huh
2018-09-24 20:54 ` [PATCH net 4/7] sr9800: " Florian Fainelli
2018-09-24 20:54 ` [PATCH net 5/7] r8152: Check for supported Wake-on-LAN Modes Florian Fainelli
2018-09-24 20:54 ` [PATCH net 6/7] smsc75xx: Check for Wake-on-LAN modes Florian Fainelli
2018-09-24 20:54 ` [PATCH net 7/7] smsc95xx: " Florian Fainelli
2018-09-27  0:12 ` [PATCH net 0/7] net: usb: " David Miller
2018-09-27  0:15   ` 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=8de18c23-d846-cbb4-c852-9b7d97a95c11@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=Woojung.Huh@microchip.com \
    --cc=akurz@blala.de \
    --cc=bigeasy@linutronix.de \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=grundler@chromium.org \
    --cc=hayeswang@realtek.com \
    --cc=kai.heng.feng@canonical.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ran.wang_1@nxp.com \
    --cc=steve.glendinning@shawell.net \
    --cc=zhongjiang@huawei.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).