From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8906EC5B578 for ; Sat, 6 Jul 2019 23:48:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4E64D20836 for ; Sat, 6 Jul 2019 23:48:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726859AbfGFXo4 (ORCPT ); Sat, 6 Jul 2019 19:44:56 -0400 Received: from gate.crashing.org ([63.228.1.57]:44944 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726731AbfGFXo4 (ORCPT ); Sat, 6 Jul 2019 19:44:56 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id x66NiZR3021900; Sat, 6 Jul 2019 18:44:36 -0500 Message-ID: Subject: Re: Virtual hub, resets etc... From: Benjamin Herrenschmidt To: Alan Stern Cc: Felipe Balbi , "linux-usb@vger.kernel.org" , Michal Nazarewicz Date: Sun, 07 Jul 2019 09:44:34 +1000 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org On Sat, 2019-07-06 at 14:37 -0400, Alan Stern wrote: > On Sat, 6 Jul 2019, Benjamin Herrenschmidt wrote: > > > On Fri, 2019-07-05 at 10:08 -0400, Alan Stern wrote: > > > On Fri, 5 Jul 2019, Benjamin Herrenschmidt wrote: > > > > > Sure but it would be nice if the mass storage dealt with > -ESHUTDOWN > > > > properly and stopped :-) Or other errors... if the UDC HW for > example > > > > dies for some reason, mass storage will lockup. > > > > > > I suppose we could add code to check for this case and handle > it, > > > although I'm not sure what would be the right thing to do. Delay > for > > > one second and try again? Disable the gadget until the host does > a > > > reset? > > > > I think just stop it until the next reset yes. > > Can you test this patch? Not for a few days, I'm away from the machine and that test requires me being physically present, but I will when I'm back. Thanks ! Cheers, Ben. > Alan Stern > > > > Index: usb-devel/drivers/usb/gadget/function/f_mass_storage.c > =================================================================== > --- usb-devel.orig/drivers/usb/gadget/function/f_mass_storage.c > +++ usb-devel/drivers/usb/gadget/function/f_mass_storage.c > @@ -552,13 +552,14 @@ static int start_transfer(struct fsg_dev > > /* We can't do much more than wait for a reset */ > req->status = rc; > + if (rc == -ESHUTDOWN) > + fsg->common->running = 0; > > /* > * Note: currently the net2280 driver fails zero- > length > * submissions if DMA is enabled. > */ > - if (rc != -ESHUTDOWN && > - !(rc == -EOPNOTSUPP && req->length == > 0)) > + else if (!(rc == -EOPNOTSUPP && req->length == 0)) > WARNING(fsg, "error in submission: %s --> > %d\n", > ep->name, rc); > }