mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Gagniuc, Alexandru" <alexandru.gagniuc@hp.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"edumazet@google.com" <edumazet@google.com>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"hayeswang@realtek.com" <hayeswang@realtek.com>,
	"jflf_kernel@gmx.com" <jflf_kernel@gmx.com>,
	"bjorn@mork.no" <bjorn@mork.no>,
	"svenva@chromium.org" <svenva@chromium.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Zhang, Eniac" <eniac-xw.zhang@hp.com>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH v2] r8152: Suspend USB device before shutdown when WoL is enabled
Date: Wed, 2 Aug 2023 14:56:43 +0000	[thread overview]
Message-ID: <SJ0PR84MB2088F20891376312BA8D550A8F0BA@SJ0PR84MB2088.NAMPRD84.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <3c4fd3d8-2b0b-492e-aacc-afafcea98417@rowland.harvard.edu>

On Wed, Jul 19, 2023 at 02:36:25PM -0400, Alan Stern wrote:
> On Wed, Jul 19, 2023 at 05:37:56PM +0000, Alexandru Gagniuc wrote:
> > For Wake-on-LAN to work from S5 (shutdown), the USB link must be put
> > in U3 state. If it is not, and the host "disappears", the chip will
> > no longer respond to WoL triggers.
> > 
> > To resolve this, add a notifier block and register it as a reboot
> > notifier. When WoL is enabled, work through the usb_device struct to
> > get to the suspend function. Calling this function puts the link in
> > the correct state for WoL to function.
> 
> How do you know that the link will _remain_ in the correct state?

The objective is to get to xhci_set_link_state() with the USB_SS_PORT_LS_U3
argument. This is achieved through usb_port_suspend() in drivers/usb/host/hub.c,
and the function is implemented in drivers/usb/host/xhci-hub.c.

This is the only path in the kernel that I am aware of for setting the U3 link
state. Given that it is part of the USB subsystem, I am fairly confident it will
show consistent behavior across platforms.
 
> That is, how do you know that the shutdown processing for the USB host 
> controller won't disable the link entirely, thereby preventing WoL from 
> working?

We are talking to the USB hub in order to set the link state. I don't see how
specifics of the host controller would influence behavior. I do expect a
controller which advertises S4/S5 in /proc/acpi/wakeup to not do anything that
would sabotage this capability. Disabling the link entirely would probalby
violate that promise.

Think of USB-C docks with a power button showing up as a HID class. The scenario
herein would disable the power button. I would take that to be a bug in the host
controller driver if the S4/S5 capability is advertised.

Alex

P.S. I sincerely apologize for the delay in my reply. The corporate email servers here
have "difficulties" with plaintext and  interleaved replies.



  reply	other threads:[~2023-08-02 14:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-06 18:28 [PATCH] " Alexandru Gagniuc
2023-07-08  0:12 ` Jakub Kicinski
2023-07-08  1:51   ` Alan Stern
2023-07-19 17:37     ` [PATCH v2] " Alexandru Gagniuc
2023-07-19 18:36       ` Alan Stern
2023-08-02 14:56         ` Gagniuc, Alexandru [this message]
2023-08-02 15:23           ` Alan Stern
2023-08-10 16:22         ` Alexandru Gagniuc
2023-08-10 17:34           ` Alan Stern
2023-08-10 22:51             ` Alexandru Gagniuc
2023-08-11  1:51               ` Alan Stern
2023-07-20  8:39       ` Oliver Neukum

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=SJ0PR84MB2088F20891376312BA8D550A8F0BA@SJ0PR84MB2088.NAMPRD84.PROD.OUTLOOK.COM \
    --to=alexandru.gagniuc@hp.com \
    --cc=bjorn@mork.no \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eniac-xw.zhang@hp.com \
    --cc=hayeswang@realtek.com \
    --cc=jflf_kernel@gmx.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    --cc=svenva@chromium.org \
    /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

all inboxes | Powered by JetHome®