linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: Zhai Zhaoxuan <kxuanobj@gmail.com>,
	Valentina Manea <valentina.manea.m@gmail.com>,
	Shuah Khan <shuah@kernel.org>
Cc: linux-usb@vger.kernel.org, Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [issue] usbip: vhci-hcd: Device unable to get work after reset
Date: Wed, 11 Dec 2019 09:00:11 -0700	[thread overview]
Message-ID: <804f452e-e724-b508-80e7-cfd05da2ff84@linuxfoundation.org> (raw)
In-Reply-To: <9b961779-abe7-f6a4-3f2b-f9303ef39c5b@gmail.com>

On 12/10/19 4:43 AM, Zhai Zhaoxuan wrote:
> Hi,
> 
> I am trying to implement a virtual USB device using usbip. But I get a 
> trouble.
> 

Can you give me more details on why you are planning to add virtual USB
to usbip? How does it work with conjunction with the usbip server side?

> When a running port on vhci_hcd is resetted (by setting 
> USB_PORT_FEAT_RESET), it will never be enabled again.
> 
> The kernel version is 5.5.0-rc1-00012-g6794862a16ef.
> In the source file drivers/usb/usbip/vhci_hcd.c:
> 
>   565         case USB_PORT_FEAT_RESET:
> ...
>   572             /* if it's already enabled, disable */
>   573             if (hcd->speed == HCD_USB3) {
>   574                 vhci_hcd->port_status[rhport] = 0;
>   575                 vhci_hcd->port_status[rhport] =
>   576                     (USB_SS_PORT_STAT_POWER |
>   577                      USB_PORT_STAT_CONNECTION |
>   578                      USB_PORT_STAT_RESET);
>   579             } else if (vhci_hcd->port_status[rhport] & 
> USB_PORT_STAT_ENABLE) {
>   580                 vhci_hcd->port_status[rhport] &= 
> ~(USB_PORT_STAT_ENABLE
>   581                     | USB_PORT_STAT_LOW_SPEED
>   582                     | USB_PORT_STAT_HIGH_SPEED);
>   583             }
>   584
> 
> The USB_PORT_STAT_ENABLE is cleard. And it should be set later.
> But, the GetPortStatus only set the USB_PORT_STAT_ENABLE for 
> not-assigned ports.
> 
>   430     case GetPortStatus:
> ...
>   456             if (vhci_hcd->vdev[rhport].ud.status ==
>   457                 VDEV_ST_NOTASSIGNED) {
>   458                 usbip_dbg_vhci_rh(
>   459                     " enable rhport %d (status %u)\n",
>   460                     rhport,
>   461                     vhci_hcd->vdev[rhport].ud.status);
>   462                 vhci_hcd->port_status[rhport] |=
>   463                     USB_PORT_STAT_ENABLE;
>   464             }
> 
> The used port (status == VDEV_ST_USED) will be disabled after 
> USB_PORT_FEAT_RESET, and unable to be enabled again.
> 
> Should VDEV_ST_USED be added to line 457?
> And if it shouldn't, how can I enable a port after USB_PORT_FEAT_RESET?
> 
>

I would like to see server and client side patches and a use-case for
adding virtual device.

thanks,
-- Shuah



  reply	other threads:[~2019-12-11 16:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-10 11:43 [issue] usbip: vhci-hcd: Device unable to get work after reset Zhai Zhaoxuan
2019-12-11 16:00 ` Shuah Khan [this message]
2019-12-12  3:23   ` Zhai Zhaoxuan
     [not found]   ` <3e97b00c-ca87-0085-3f8e-6e85fd9b6c30@gmail.com>
2019-12-12 22:33     ` Shuah Khan
2019-12-13  3:01       ` Zhai Zhaoxuan
2020-01-01 11:50         ` Zhai Zhaoxuan
2020-01-01 23:17           ` 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=804f452e-e724-b508-80e7-cfd05da2ff84@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=kxuanobj@gmail.com \
    --cc=linux-usb@vger.kernel.org \
    --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).