Thread (15 messages) 15 messages, 3 authors, 2018-09-27

Re: [PATCH net 3/7] lan78xx: Check for supported Wake-on-LAN modes

From: Florian Fainelli <f.fainelli@gmail.com>
Date: 2018-09-25 18:36:08
Also in: linux-usb, lkml
Subsystem: networking drivers, the rest, usb lan78xx ethernet driver, usb networking drivers · Maintainers: Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds, Thangaraj Samynathan

On 09/25/2018 10:32 AM, Woojung.Huh@microchip.com wrote:
Hi Florian,
quoted
quoted
quoted
+	if (pdata->wol == 0)
+		return -EINVAL;
+
It will make function return when disabling WOL.
Huh, yes, good point.
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help