Re: [issue] usbip: vhci-hcd: Device unable to get work after reset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Zhai Zhaoxuan,

On 1/1/20 4:50 AM, Zhai Zhaoxuan wrote:
Hi Shuah,


It has been almost 3 weeks since the last email.

December got away from em with holidays and vacation time.
Sorry for the delay.


Can you confirm if this is a bug or a feature?



The behavior you are seeing is specific to how your use-case.

I am trying to implement a virtual USB device using usbip. But I get a trouble.

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?

Right.There is no need to clear VDEV_ST_USED because the port is still
used, and reset is sent to the usbip_host. VDEV_ST_NOTASSIGNED indicates
that the port is in used state with no usb addresses assigned.

I am not sure what is happening in your environment. It would be useful
to see dmesg from the usbip server and client in you environment.

I would be very interested to see if you can reproduce this problem
outside the USB Redirect scenario.

thanks,
-- Shuah








[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux