linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: Michael Broadfoot <msbroadf@gmail.com>,
	valentina.manea.m@gmail.com, shuah@kernel.org,
	gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH v2] vhci_hcd: USB port can get stuck in the disabled state
Date: Wed, 21 Jul 2021 19:26:02 -0600	[thread overview]
Message-ID: <7b02cb66-d672-ae95-01ea-c6015725e1ac@linuxfoundation.org> (raw)
In-Reply-To: <20210721235526.10588-1-msbroadf@gmail.com>

On 7/21/21 5:55 PM, Michael Broadfoot wrote:
> When a remote usb device is attached to the local Virtual USB
> Host Controller Root Hub port, the bound device driver may send a
> port reset command. For example to initialize firmware (eg. btusb does this).
> This port reset command can be sent at any time, however the VHCI hcd
> root hub is only expecting reset to occur before the device receives
> SET_ADDRESS. The USB port should always be enabled after a reset
> (because the port is virtual and there is no possibility of hardware errors)
> 
> 
> 
> Signed-off-by: Michael Broadfoot <msbroadf@gmail.com>
> ---
>   drivers/usb/usbip/vhci_hcd.c | 13 ++++---------
>   1 file changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c
> index 4ba6bcdaa8e9..d3cda1b2c15a 100644
> --- a/drivers/usb/usbip/vhci_hcd.c
> +++ b/drivers/usb/usbip/vhci_hcd.c
> @@ -455,15 +455,10 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
>   			vhci_hcd->port_status[rhport] &= ~(1 << USB_PORT_FEAT_RESET);
>   			vhci_hcd->re_timeout = 0;
>   
> -			if (vhci_hcd->vdev[rhport].ud.status ==
> -			    VDEV_ST_NOTASSIGNED) {
> -				usbip_dbg_vhci_rh(
> -					" enable rhport %d (status %u)\n",
> -					rhport,
> -					vhci_hcd->vdev[rhport].ud.status);
> -				vhci_hcd->port_status[rhport] |=
> -					USB_PORT_STAT_ENABLE;
> -			}

VDEV_ST_NOTASSIGNED status indicates that the vdev is in use without
address assigned - in other words port is initializing.

This is part of the attach request handling when user requests to
attach to a remote device. attach_store() will change the status
to VDEV_ST_NOTASSIGNED and then initiate port_connect sequence.

We don't want to touch the vdev when it is in other states.
   
> +			usbip_dbg_vhci_rh(" enable rhport %d (status %u)\n",
> +					  rhport,
> +					  vhci_hcd->vdev[rhport].ud.status);
> +			vhci_hcd->port_status[rhport] |= USB_PORT_STAT_ENABLE;
>   
>   			if (hcd->speed < HCD_USB3) {
>   				switch (vhci_hcd->vdev[rhport].speed) {
> 

How did you find this problem? Does the port get into stuck state
while attaching to a remote usbip device on the host?

thanks,
-- Shuah

  reply	other threads:[~2021-07-22  1:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-21 23:55 [PATCH v2] vhci_hcd: USB port can get stuck in the disabled state Michael Broadfoot
2021-07-22  1:26 ` Shuah Khan [this message]
     [not found]   ` <CALdjXpA4_eXen6RjhsEBYt8CQs-2gzwYs9h9q0Z2LKZ=rXVp+Q@mail.gmail.com>
2021-07-22  6:19     ` Michael
2021-07-23 16:29     ` Shuah Khan
2021-07-23 23:53       ` Michael
2021-07-23 23:58       ` Michael
2021-07-30 22:52         ` Shuah Khan
2021-07-30 23:52           ` Michael
2021-08-02 23:14             ` Shuah Khan
2021-08-03  1:00               ` Michael
2021-08-10 17:46                 ` Shuah Khan
2021-08-11  2:30                   ` Michael
2021-08-19 22:57                     ` Shuah Khan

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=7b02cb66-d672-ae95-01ea-c6015725e1ac@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=msbroadf@gmail.com \
    --cc=shuah@kernel.org \
    --cc=valentina.manea.m@gmail.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).