From: Oliver Neukum <oneukum@suse.com>
To: Alan Stern <stern@rowland.harvard.edu>, Oliver Neukum <oneukum@suse.com>
Cc: "Thinh Nguyen" <Thinh.Nguyen@synopsys.com>,
"Michal Pecio" <michal.pecio@gmail.com>,
"Bjørn Mork" <bjorn@mork.no>,
"USB list" <linux-usb@vger.kernel.org>
Subject: Re: correctly handling EPROTO
Date: Wed, 18 Mar 2026 10:54:20 +0100 [thread overview]
Message-ID: <8a14fe29-0d92-4ce5-a7e2-2c084c710727@suse.com> (raw)
In-Reply-To: <4ada5d68-56f1-41b7-82d9-463901c927db@rowland.harvard.edu>
On 17.03.26 19:03, Alan Stern wrote:
> On Tue, Mar 17, 2026 at 05:20:37PM +0100, Oliver Neukum wrote:
> You know, with a USB-2 host controller, transaction errors don't make an
> endpoint unusable, and clear-halt isn't necessary. I wonder if xhci-hcd
> couldn't be adjusted to behave the same way (issuing its own clear-halt
> internally, if that is needed). That would make things simpler.
It could be. But do you want a HCD to generate requests to endpoint 0
on its own without coordination with usbcore or drivers bound to interfaces
of the device?
It would be an elegant solution, but I think it would bite us into our
posterior. E.g. what do we do if a reset is requested or somebody
wants to suspend the device or change the configuration or a setting?
> Another possibility is to change usbcore to automatically unlink all
> the endpoint's pending URBs as soon as a transaction error occurs. Then
> drivers wouldn't have to worry about it. But even then, drivers would
> need to know how to react when it happened.
Yes. That looks more plausible.
> Reset isn't always the next step. In some cases the driver should just
> give up. For instance, if the device has been unplugged.
Then we do not care. Signalling and detecting an unplug is not a driver's
task. A driver should leave enough time for that detection to happen, but
if usbcore does not eventually tell us that a device is gone, we need
to treat errors as genuine.
>> In principle we know how a reset is handled, don't we?
>> Again, we cannot know whether a driver is the first, let alone only, driver
>> to request error handling.
>> If we decide to reset there is no point in clearing a halt and resubmitting
>> URBs would be wrong.
>
> In practice, does resetting ever help? With usb-storage and uas, yes,
> occasionally. But those are unusual drivers; what about all the other
> ones?
They don't even try. UAS, storage and usbhid are the only drivers with
a full error handling. usbnet has vestiges. That is about it. Others
may try to clear a spurious halt and that's it.
Generically speaking, short of giving up, what is the generic alternative?
As far as other examples are concerned, isn't this scheme quite close
to what SCSI does in terms of algorithm?
>> How else would you handle errors of this kind. It seems to me that we
>> need to make the delays and number of retries tunable, but other than that
>> what can you do generically?
>
> You're right that those are the only things to be done. The question is
> whether they can be done in a way that will be easy for all drivers to
> adopt.
Provide defaults, again best be copied from usbhid.
> Consider that while error recovery is in progress, the rest of the
> driver has to remain essentially dormant because the endpoint cannot be
> used. I don't think many drivers are written to support such an
> operating mode.
Isn't that exactly what you have to do after pre_reset() and suspend()?
Nor do you have to use this facility, do you?
Regards
Oliver
next prev parent reply other threads:[~2026-03-18 9:54 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-12 13:55 correctly handling EPROTO Oliver Neukum
2026-03-12 14:21 ` Alan Stern
2026-03-12 15:57 ` Oliver Neukum
2026-03-13 7:53 ` Michal Pecio
2026-03-13 10:33 ` Oliver Neukum
2026-03-13 15:28 ` Alan Stern
2026-03-13 22:45 ` Thinh Nguyen
2026-03-14 2:39 ` Alan Stern
2026-03-16 12:58 ` Oliver Neukum
2026-03-16 14:02 ` Alan Stern
2026-03-16 14:47 ` Oliver Neukum
2026-03-16 17:33 ` Alan Stern
2026-03-16 19:32 ` Oliver Neukum
2026-03-17 9:05 ` Mathias Nyman
2026-03-17 14:31 ` Alan Stern
2026-03-17 16:20 ` Oliver Neukum
2026-03-17 18:03 ` Alan Stern
2026-03-18 9:54 ` Oliver Neukum [this message]
2026-03-18 17:46 ` Alan Stern
2026-03-18 21:38 ` Michal Pecio
2026-03-18 23:59 ` Thinh Nguyen
2026-03-19 2:07 ` Alan Stern
2026-03-19 23:16 ` Thinh Nguyen
2026-03-20 9:58 ` Michal Pecio
2026-03-20 16:20 ` Alan Stern
2026-03-20 17:49 ` Oliver Neukum
2026-03-21 2:14 ` Thinh Nguyen
2026-03-21 5:54 ` Michal Pecio
2026-03-21 15:58 ` Alan Stern
2026-03-28 21:22 ` Michal Pecio
2026-03-29 1:52 ` Alan Stern
2026-03-29 16:46 ` Michal Pecio
2026-03-30 1:32 ` Alan Stern
2026-03-30 12:36 ` Michal Pecio
2026-04-01 21:50 ` Michal Pecio
2026-04-02 2:20 ` Alan Stern
2026-03-23 10:26 ` Oliver Neukum
2026-03-24 1:06 ` Thinh Nguyen
2026-03-24 9:28 ` Oliver Neukum
2026-03-24 13:25 ` Alan Stern
2026-03-25 1:44 ` Thinh Nguyen
2026-03-19 1:56 ` Alan Stern
2026-03-19 8:40 ` Mathias Nyman
2026-03-19 23:34 ` Thinh Nguyen
2026-03-19 8:55 ` Michal Pecio
2026-03-19 14:24 ` Alan Stern
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=8a14fe29-0d92-4ce5-a7e2-2c084c710727@suse.com \
--to=oneukum@suse.com \
--cc=Thinh.Nguyen@synopsys.com \
--cc=bjorn@mork.no \
--cc=linux-usb@vger.kernel.org \
--cc=michal.pecio@gmail.com \
--cc=stern@rowland.harvard.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.