Re: [PATCH v2] vhci_hcd: USB port can get stuck in the disabled state

From: Shuah Khan
Date: Thu Aug 19 2021 - 18:57:49 EST


On 8/10/21 8:30 PM, Michael wrote:
On Wed, 11 Aug 2021 at 03:46, Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx> wrote:

On 8/2/21 7:00 PM, Michael wrote:
On Tue, 3 Aug 2021 at 09:14, Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx> wrote:

On 7/30/21 5:52 PM, Michael wrote:
Yes i think just adding the VDEV_ST_USED check in addition to the
VDEV_ST_NOT_ASSIGNED state is fine and would fix the issue.


Can you please confirm if this works?

After many years of writing virtualhere (a similar system to usb/ip
but cross-platform and different non-kernel way of doing it server
side) I've seen many drivers that issue reset at any time. Loading
firmware is usually the reason. Also sometimes switching
configurations requires a reset also, for example some gaming wheels
do this. I don't think you should make this VDEV_ST_USED check
specific to Wifi devices, as a lot of devices don't follow too closely
to the USB protocol to begin with from my experience. They primarily
base their USB interactions assuming the windows platform and its
quirks.


When sending responses to Linux kernel mailing lists, please use bottom post.
This check will be used for all drivers. We don't add checks for specific cases
in the code.

thanks,
-- Shuah


Yes it works with that change.


Would you like to send me a patch for this?

thanks,
-- Shuah

usbip: Allow port reset to occur when the port is also in the ST_USED state

Signed-off-by: Michael <mail@xxxxxxxxxxxxxxx>
---
drivers/usb/usbip/vhci_hcd.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c
index 4ba6bcdaa8e9..300131ae5897 100644
--- a/drivers/usb/usbip/vhci_hcd.c
+++ b/drivers/usb/usbip/vhci_hcd.c
@@ -456,7 +456,9 @@ static int vhci_hub_control(struct usb_hcd *hcd,
u16 typeReq, u16 wValue,
vhci_hcd->re_timeout = 0;

if (vhci_hcd->vdev[rhport].ud.status ==
- VDEV_ST_NOTASSIGNED) {
+ VDEV_ST_NOTASSIGNED ||
+ vhci_hcd->vdev[rhport].ud.status ==
+ VDEV_ST_USED) {
usbip_dbg_vhci_rh(
" enable rhport %d (status %u)\n",
rhport,
--
2.30.2


Unfortunately we can't apply this diff. I turned this into a proper
patch giving you credit for reporting the problem, suggesting the
fix and testing it. Patch will be sent shortly.

thanks,
-- Shuah