* [PATCH net v2 0/7] net: usb: Check for Wake-on-LAN modes
@ 2018-09-28 23:18 Florian Fainelli
2018-09-28 23:18 ` [PATCH net v2 1/7] asix: Check for supported " Florian Fainelli
` (7 more replies)
0 siblings, 8 replies; 10+ messages in thread
From: Florian Fainelli @ 2018-09-28 23:18 UTC (permalink / raw)
To: netdev
Cc: Florian Fainelli, David S. Miller, Woojung Huh,
Microchip Linux Driver Support, Steve Glendinning, Kees Cook,
Alexander Kurz, Hayes Wang, Kai-Heng Feng, Grant Grundler,
zhong jiang, Sebastian Andrzej Siewior, Ran Wang, Eric Dumazet,
open list:USB NETWORKING DRIVERS, open list
Hi all,
Most of our USB Ethernet drivers don't seem to be checking properly
whether the user is supplying a correct Wake-on-LAN mode to enter, so
the experience as an user could be confusing, since it would generally
lead to either no wake-up, or the device not being marked for wake-up.
Please review!
Changes in v2:
- fixed lan78xx handling, thanks Woojung!
Florian Fainelli (7):
asix: Check for supported Wake-on-LAN modes
ax88179_178a: Check for supported Wake-on-LAN modes
lan78xx: Check for supported Wake-on-LAN modes
sr9800: Check for supported Wake-on-LAN modes
r8152: Check for supported Wake-on-LAN Modes
smsc75xx: Check for Wake-on-LAN modes
smsc95xx: Check for Wake-on-LAN modes
drivers/net/usb/asix_common.c | 3 +++
drivers/net/usb/ax88179_178a.c | 3 +++
drivers/net/usb/lan78xx.c | 17 ++++-------------
drivers/net/usb/r8152.c | 3 +++
drivers/net/usb/smsc75xx.c | 3 +++
drivers/net/usb/smsc95xx.c | 3 +++
drivers/net/usb/sr9800.c | 3 +++
7 files changed, 22 insertions(+), 13 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH net v2 1/7] asix: Check for supported Wake-on-LAN modes
2018-09-28 23:18 [PATCH net v2 0/7] net: usb: Check for Wake-on-LAN modes Florian Fainelli
@ 2018-09-28 23:18 ` Florian Fainelli
2018-09-28 23:18 ` [PATCH net v2 2/7] ax88179_178a: " Florian Fainelli
` (6 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Florian Fainelli @ 2018-09-28 23:18 UTC (permalink / raw)
To: netdev
Cc: Florian Fainelli, David S. Miller, Woojung Huh,
Microchip Linux Driver Support, Steve Glendinning, Kees Cook,
Alexander Kurz, Hayes Wang, Kai-Heng Feng, Grant Grundler,
zhong jiang, Sebastian Andrzej Siewior, Ran Wang, Eric Dumazet,
open list:USB NETWORKING DRIVERS, open list
The driver currently silently accepts unsupported Wake-on-LAN modes
(other than WAKE_PHY or WAKE_MAGIC) without reporting that to the user,
which is confusing.
Fixes: 2e55cc7210fe ("[PATCH] USB: usbnet (3/9) module for ASIX Ethernet adapters")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/usb/asix_common.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c
index e95dd12edec4..023b8d0bf175 100644
--- a/drivers/net/usb/asix_common.c
+++ b/drivers/net/usb/asix_common.c
@@ -607,6 +607,9 @@ int asix_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
struct usbnet *dev = netdev_priv(net);
u8 opt = 0;
+ if (wolinfo->wolopts & ~(WAKE_PHY | WAKE_MAGIC))
+ return -EINVAL;
+
if (wolinfo->wolopts & WAKE_PHY)
opt |= AX_MONITOR_LINK;
if (wolinfo->wolopts & WAKE_MAGIC)
--
2.17.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH net v2 2/7] ax88179_178a: Check for supported Wake-on-LAN modes
2018-09-28 23:18 [PATCH net v2 0/7] net: usb: Check for Wake-on-LAN modes Florian Fainelli
2018-09-28 23:18 ` [PATCH net v2 1/7] asix: Check for supported " Florian Fainelli
@ 2018-09-28 23:18 ` Florian Fainelli
2018-09-28 23:18 ` [PATCH net v2 3/7] lan78xx: " Florian Fainelli
` (5 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Florian Fainelli @ 2018-09-28 23:18 UTC (permalink / raw)
To: netdev
Cc: Florian Fainelli, David S. Miller, Woojung Huh,
Microchip Linux Driver Support, Steve Glendinning, Kees Cook,
Alexander Kurz, Hayes Wang, Kai-Heng Feng, Grant Grundler,
zhong jiang, Sebastian Andrzej Siewior, Ran Wang, Eric Dumazet,
open list:USB NETWORKING DRIVERS, open list
The driver currently silently accepts unsupported Wake-on-LAN modes
(other than WAKE_PHY or WAKE_MAGIC) without reporting that to the user,
which is confusing.
Fixes: e2ca90c276e1 ("ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/usb/ax88179_178a.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
index 9e8ad372f419..2207f7a7d1ff 100644
--- a/drivers/net/usb/ax88179_178a.c
+++ b/drivers/net/usb/ax88179_178a.c
@@ -566,6 +566,9 @@ ax88179_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
struct usbnet *dev = netdev_priv(net);
u8 opt = 0;
+ if (wolinfo->wolopts & ~(WAKE_PHY | WAKE_MAGIC))
+ return -EINVAL;
+
if (wolinfo->wolopts & WAKE_PHY)
opt |= AX_MONITOR_MODE_RWLC;
if (wolinfo->wolopts & WAKE_MAGIC)
--
2.17.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH net v2 3/7] lan78xx: Check for supported Wake-on-LAN modes
2018-09-28 23:18 [PATCH net v2 0/7] net: usb: Check for Wake-on-LAN modes Florian Fainelli
2018-09-28 23:18 ` [PATCH net v2 1/7] asix: Check for supported " Florian Fainelli
2018-09-28 23:18 ` [PATCH net v2 2/7] ax88179_178a: " Florian Fainelli
@ 2018-09-28 23:18 ` Florian Fainelli
2018-09-28 23:27 ` Woojung.Huh
2018-09-28 23:18 ` [PATCH net v2 4/7] sr9800: " Florian Fainelli
` (4 subsequent siblings)
7 siblings, 1 reply; 10+ messages in thread
From: Florian Fainelli @ 2018-09-28 23:18 UTC (permalink / raw)
To: netdev
Cc: Florian Fainelli, David S. Miller, Woojung Huh,
Microchip Linux Driver Support, Steve Glendinning, Kees Cook,
Alexander Kurz, Hayes Wang, Kai-Heng Feng, Grant Grundler,
zhong jiang, Sebastian Andrzej Siewior, Ran Wang, Eric Dumazet,
open list:USB NETWORKING DRIVERS, open list
The driver supports a fair amount of Wake-on-LAN modes, but is not
checking that the user specified one that is supported.
Fixes: 55d7de9de6c3 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/usb/lan78xx.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index a9991c5f4736..c3c9ba44e2a1 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 (wol->wolopts & ~WAKE_ALL)
+ return -EINVAL;
+
+ pdata->wol = wol->wolopts;
device_set_wakeup_enable(&dev->udev->dev, (bool)wol->wolopts);
--
2.17.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH net v2 4/7] sr9800: Check for supported Wake-on-LAN modes
2018-09-28 23:18 [PATCH net v2 0/7] net: usb: Check for Wake-on-LAN modes Florian Fainelli
` (2 preceding siblings ...)
2018-09-28 23:18 ` [PATCH net v2 3/7] lan78xx: " Florian Fainelli
@ 2018-09-28 23:18 ` Florian Fainelli
2018-09-28 23:18 ` [PATCH net v2 5/7] r8152: Check for supported Wake-on-LAN Modes Florian Fainelli
` (3 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Florian Fainelli @ 2018-09-28 23:18 UTC (permalink / raw)
To: netdev
Cc: Florian Fainelli, David S. Miller, Woojung Huh,
Microchip Linux Driver Support, Steve Glendinning, Kees Cook,
Alexander Kurz, Hayes Wang, Kai-Heng Feng, Grant Grundler,
zhong jiang, Sebastian Andrzej Siewior, Ran Wang, Eric Dumazet,
open list:USB NETWORKING DRIVERS, open list
The driver currently silently accepts unsupported Wake-on-LAN modes
(other than WAKE_PHY or WAKE_MAGIC) without reporting that to the user,
which is confusing.
Fixes: 19a38d8e0aa3 ("USB2NET : SR9800 : One chip USB2.0 USB2NET SR9800 Device Driver Support")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/usb/sr9800.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/usb/sr9800.c b/drivers/net/usb/sr9800.c
index 9277a0f228df..35f39f23d881 100644
--- a/drivers/net/usb/sr9800.c
+++ b/drivers/net/usb/sr9800.c
@@ -421,6 +421,9 @@ sr_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
struct usbnet *dev = netdev_priv(net);
u8 opt = 0;
+ if (wolinfo->wolopts & ~(WAKE_PHY | WAKE_MAGIC))
+ return -EINVAL;
+
if (wolinfo->wolopts & WAKE_PHY)
opt |= SR_MONITOR_LINK;
if (wolinfo->wolopts & WAKE_MAGIC)
--
2.17.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH net v2 5/7] r8152: Check for supported Wake-on-LAN Modes
2018-09-28 23:18 [PATCH net v2 0/7] net: usb: Check for Wake-on-LAN modes Florian Fainelli
` (3 preceding siblings ...)
2018-09-28 23:18 ` [PATCH net v2 4/7] sr9800: " Florian Fainelli
@ 2018-09-28 23:18 ` Florian Fainelli
2018-09-28 23:18 ` [PATCH net v2 6/7] smsc75xx: Check for Wake-on-LAN modes Florian Fainelli
` (2 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Florian Fainelli @ 2018-09-28 23:18 UTC (permalink / raw)
To: netdev
Cc: Florian Fainelli, David S. Miller, Woojung Huh,
Microchip Linux Driver Support, Steve Glendinning, Kees Cook,
Alexander Kurz, Hayes Wang, Kai-Heng Feng, Grant Grundler,
zhong jiang, Sebastian Andrzej Siewior, Ran Wang, Eric Dumazet,
open list:USB NETWORKING DRIVERS, open list
The driver does not check for Wake-on-LAN modes specified by an user,
but will conditionally set the device as wake-up enabled or not based on
that, which could be a very confusing user experience.
Fixes: 21ff2e8976b1 ("r8152: support WOL")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/usb/r8152.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 2cd71bdb6484..f1b5201cc320 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -4506,6 +4506,9 @@ static int rtl8152_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
if (!rtl_can_wakeup(tp))
return -EOPNOTSUPP;
+ if (wol->wolopts & ~WAKE_ANY)
+ return -EINVAL;
+
ret = usb_autopm_get_interface(tp->intf);
if (ret < 0)
goto out_set_wol;
--
2.17.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH net v2 6/7] smsc75xx: Check for Wake-on-LAN modes
2018-09-28 23:18 [PATCH net v2 0/7] net: usb: Check for Wake-on-LAN modes Florian Fainelli
` (4 preceding siblings ...)
2018-09-28 23:18 ` [PATCH net v2 5/7] r8152: Check for supported Wake-on-LAN Modes Florian Fainelli
@ 2018-09-28 23:18 ` Florian Fainelli
2018-09-28 23:18 ` [PATCH net v2 7/7] smsc95xx: " Florian Fainelli
2018-09-29 18:32 ` [PATCH net v2 0/7] net: usb: " David Miller
7 siblings, 0 replies; 10+ messages in thread
From: Florian Fainelli @ 2018-09-28 23:18 UTC (permalink / raw)
To: netdev
Cc: Florian Fainelli, David S. Miller, Woojung Huh,
Microchip Linux Driver Support, Steve Glendinning, Kees Cook,
Alexander Kurz, Hayes Wang, Kai-Heng Feng, Grant Grundler,
zhong jiang, Sebastian Andrzej Siewior, Ran Wang, Eric Dumazet,
open list:USB NETWORKING DRIVERS, open list
The driver does not check for Wake-on-LAN modes specified by an user,
but will conditionally set the device as wake-up enabled or not based on
that, which could be a very confusing user experience.
Fixes: 6c636503260d ("smsc75xx: add wol magic packet support")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/usb/smsc75xx.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
index 05553d252446..e5a4cbb366dc 100644
--- a/drivers/net/usb/smsc75xx.c
+++ b/drivers/net/usb/smsc75xx.c
@@ -731,6 +731,9 @@ static int smsc75xx_ethtool_set_wol(struct net_device *net,
struct smsc75xx_priv *pdata = (struct smsc75xx_priv *)(dev->data[0]);
int ret;
+ if (wolinfo->wolopts & ~SUPPORTED_WAKE)
+ return -EINVAL;
+
pdata->wolopts = wolinfo->wolopts & SUPPORTED_WAKE;
ret = device_set_wakeup_enable(&dev->udev->dev, pdata->wolopts);
--
2.17.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH net v2 7/7] smsc95xx: Check for Wake-on-LAN modes
2018-09-28 23:18 [PATCH net v2 0/7] net: usb: Check for Wake-on-LAN modes Florian Fainelli
` (5 preceding siblings ...)
2018-09-28 23:18 ` [PATCH net v2 6/7] smsc75xx: Check for Wake-on-LAN modes Florian Fainelli
@ 2018-09-28 23:18 ` Florian Fainelli
2018-09-29 18:32 ` [PATCH net v2 0/7] net: usb: " David Miller
7 siblings, 0 replies; 10+ messages in thread
From: Florian Fainelli @ 2018-09-28 23:18 UTC (permalink / raw)
To: netdev
Cc: Florian Fainelli, David S. Miller, Woojung Huh,
Microchip Linux Driver Support, Steve Glendinning, Kees Cook,
Alexander Kurz, Hayes Wang, Kai-Heng Feng, Grant Grundler,
zhong jiang, Sebastian Andrzej Siewior, Ran Wang, Eric Dumazet,
open list:USB NETWORKING DRIVERS, open list
The driver does not check for Wake-on-LAN modes specified by an user,
but will conditionally set the device as wake-up enabled or not based on
that, which could be a very confusing user experience.
Fixes: e0e474a83c18 ("smsc95xx: add wol magic packet support")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/usb/smsc95xx.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 06b4d290784d..262e7a3c23cb 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -774,6 +774,9 @@ static int smsc95xx_ethtool_set_wol(struct net_device *net,
struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
int ret;
+ if (wolinfo->wolopts & ~SUPPORTED_WAKE)
+ return -EINVAL;
+
pdata->wolopts = wolinfo->wolopts & SUPPORTED_WAKE;
ret = device_set_wakeup_enable(&dev->udev->dev, pdata->wolopts);
--
2.17.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* RE: [PATCH net v2 3/7] lan78xx: Check for supported Wake-on-LAN modes
2018-09-28 23:18 ` [PATCH net v2 3/7] lan78xx: " Florian Fainelli
@ 2018-09-28 23:27 ` Woojung.Huh
0 siblings, 0 replies; 10+ messages in thread
From: Woojung.Huh @ 2018-09-28 23:27 UTC (permalink / raw)
To: f.fainelli, netdev
Cc: davem, UNGLinuxDriver, steve.glendinning, keescook, akurz,
hayeswang, kai.heng.feng, grundler, zhongjiang, bigeasy,
ran.wang_1, edumazet, linux-usb, linux-kernel
> The driver supports a fair amount of Wake-on-LAN modes, but is not
> checking that the user specified one that is supported.
>
> Fixes: 55d7de9de6c3 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Woojung Huh <Woojung.Huh@Microchip.com>
Thanks.
Woojung
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net v2 0/7] net: usb: Check for Wake-on-LAN modes
2018-09-28 23:18 [PATCH net v2 0/7] net: usb: Check for Wake-on-LAN modes Florian Fainelli
` (6 preceding siblings ...)
2018-09-28 23:18 ` [PATCH net v2 7/7] smsc95xx: " Florian Fainelli
@ 2018-09-29 18:32 ` David Miller
7 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2018-09-29 18:32 UTC (permalink / raw)
To: f.fainelli
Cc: netdev, woojung.huh, UNGLinuxDriver, steve.glendinning, keescook,
akurz, hayeswang, kai.heng.feng, grundler, zhongjiang, bigeasy,
ran.wang_1, edumazet, linux-usb, linux-kernel
From: Florian Fainelli <f.fainelli@gmail.com>
Date: Fri, 28 Sep 2018 16:18:49 -0700
> Most of our USB Ethernet drivers don't seem to be checking properly
> whether the user is supplying a correct Wake-on-LAN mode to enter, so
> the experience as an user could be confusing, since it would generally
> lead to either no wake-up, or the device not being marked for wake-up.
>
> Please review!
>
> Changes in v2:
>
> - fixed lan78xx handling, thanks Woojung!
Series applied, thanks Florian.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2018-09-29 18:32 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-28 23:18 [PATCH net v2 0/7] net: usb: Check for Wake-on-LAN modes Florian Fainelli
2018-09-28 23:18 ` [PATCH net v2 1/7] asix: Check for supported " Florian Fainelli
2018-09-28 23:18 ` [PATCH net v2 2/7] ax88179_178a: " Florian Fainelli
2018-09-28 23:18 ` [PATCH net v2 3/7] lan78xx: " Florian Fainelli
2018-09-28 23:27 ` Woojung.Huh
2018-09-28 23:18 ` [PATCH net v2 4/7] sr9800: " Florian Fainelli
2018-09-28 23:18 ` [PATCH net v2 5/7] r8152: Check for supported Wake-on-LAN Modes Florian Fainelli
2018-09-28 23:18 ` [PATCH net v2 6/7] smsc75xx: Check for Wake-on-LAN modes Florian Fainelli
2018-09-28 23:18 ` [PATCH net v2 7/7] smsc95xx: " Florian Fainelli
2018-09-29 18:32 ` [PATCH net v2 0/7] net: usb: " David Miller
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).