netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: usb: r8152: Set default WOL options
@ 2022-05-12 21:50 Kyle Pelton
  2022-05-13  3:31 ` Hayes Wang
  0 siblings, 1 reply; 2+ messages in thread
From: Kyle Pelton @ 2022-05-12 21:50 UTC (permalink / raw)
  To: netdev, davem, hayeswang, aaron.ma; +Cc: Kyle Pelton

Set default wake-on-lan options on probe to avoid state from previous
boot.

Fixes issue on some boots where wake-on-lan settings are incorrectly set
due to previous runtime-suspend activity. This causes spurious wakeups
while in suspend.

Signed-off-by: Kyle Pelton <kyle.d.pelton@linux.intel.com>
---
 drivers/net/usb/r8152.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index ee41088c5251..a2b3c398beee 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -3269,6 +3269,7 @@ static int rtl8152_set_features(struct net_device *dev,
 }
 
 #define WAKE_ANY (WAKE_PHY | WAKE_MAGIC | WAKE_UCAST | WAKE_BCAST | WAKE_MCAST)
+#define WAKE_DEFAULT (WAKE_PHY << 5)
 
 static u32 __rtl_get_wol(struct r8152 *tp)
 {
@@ -9717,10 +9718,12 @@ static int rtl8152_probe(struct usb_interface *intf,
 
 	intf->needs_remote_wakeup = 1;
 
-	if (!rtl_can_wakeup(tp))
+	if (!rtl_can_wakeup(tp)) {
 		__rtl_set_wol(tp, 0);
-	else
+	} else {
+		__rtl_set_wol(tp, WAKE_DEFAULT);
 		tp->saved_wolopts = __rtl_get_wol(tp);
+	}
 
 	tp->rtl_ops.init(tp);
 #if IS_BUILTIN(CONFIG_USB_RTL8152)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [PATCH] net: usb: r8152: Set default WOL options
  2022-05-12 21:50 [PATCH] net: usb: r8152: Set default WOL options Kyle Pelton
@ 2022-05-13  3:31 ` Hayes Wang
  0 siblings, 0 replies; 2+ messages in thread
From: Hayes Wang @ 2022-05-13  3:31 UTC (permalink / raw)
  To: Kyle Pelton, netdev, davem, aaron.ma; +Cc: nic_swsd

Kyle Pelton <kyle.d.pelton@linux.intel.com>
> Sent: Friday, May 13, 2022 5:50 AM
[...]
>  #define WAKE_ANY (WAKE_PHY | WAKE_MAGIC | WAKE_UCAST |
> WAKE_BCAST | WAKE_MCAST)
> +#define WAKE_DEFAULT (WAKE_PHY << 5)

I think the (WAKE_PHY << 5) is equal to WAKE_MAGIC.

>  static u32 __rtl_get_wol(struct r8152 *tp)
>  {
> @@ -9717,10 +9718,12 @@ static int rtl8152_probe(struct usb_interface *intf,
> 
>  	intf->needs_remote_wakeup = 1;
> 
> -	if (!rtl_can_wakeup(tp))
> +	if (!rtl_can_wakeup(tp)) {
>  		__rtl_set_wol(tp, 0);
> -	else
> +	} else {
> +		__rtl_set_wol(tp, WAKE_DEFAULT);
>  		tp->saved_wolopts = __rtl_get_wol(tp);

I think it is better to set tp->saved_wolopts = WAKE_MAGIC. Besides,
add rtl_runtime_suspend_enable(tp, false) in r8152b_init() as same
as r8153_init(), r8153b_init(), and so on. You don't need
__rtl_set_wol() here.

> +	}
> 
>  	tp->rtl_ops.init(tp);
>  #if IS_BUILTIN(CONFIG_USB_RTL8152)


Best Regards,
Hayes


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-13  3:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12 21:50 [PATCH] net: usb: r8152: Set default WOL options Kyle Pelton
2022-05-13  3:31 ` Hayes Wang

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).