Skip to contentSkip to conversation

usb-linux: return USB_RET_STALL on -EPIPE

PATCH In review Paul Bolle 4 participants 8 messages Oct 13, 2009

lore
Share & tools
lore

Paul Bolle

author
#0 lore raw

PATCH 1/1 usb-linux: return USB_RET_STALL on -EPIPE

0) This is an attempt to get an issue in usb-linux.c, for which a patch was posted about a year ago, finally fixed.

1) Mark Burkley submitted a "EHCI emulation module" for review in in October 2008 (see:
http://lists.gnu.org/archive/html/qemu-devel/2008-10/msg01326.html). No EHCI emulation module was ever committed to qemu.

2) Part of that (large) patch was a fix for a separate issue in usb-linux.c. Max Krasnyansky has ACK'ed that fix (see:
http://lists.gnu.org/archive/html/qemu-devel/2008-11/msg00032.html).

3) I already asked whether this fix was ready to be committed in last April (see:
http://lists.gnu.org/archive/html/qemu-devel/2009-04/msg01763.html)

4) Maybe submitting this fix as a separate patch (with a really long commit message but without a Signed-off-by) and cc-ing everbody involved will help if actually getting this issue fixed.

Paul Bolle
---
usb-linux: return USB_RET_STALL on -EPIPE

Quoted 17 lines · Max Krasnyansky
Quoted 10 lines · Anthony Liguori
Quoted 9 lines · Mark Burkley

Hi Anthony,
[...]
I am seeing an issue with a
memory key I am using for testing. ioctl returns EPIPE (which I would have thought was a STALL) to an asynchronous IN completion in usb-linux.c but then this is returned as USB_RET_NAK to EHCI which confuses my WinXP target because the transfer is then never completed.

Quoted 5 lines
Quoted 5 lines

Can I just check that it was intentional to return NAK for EPIPE returns in asynchronous completions? If so, then I will try to detect the stall in my implementation and treat differently to a NAK. It's just that if I modify usb-linux.c to return USB_RET_STALL on -EPIPE then it works fine.

Quoted 9 lines

I just looked at the usb-linuc.c:async_complete() code and it looks like it was intentional but I cannot remember why I wrote that way. And what you're saying makes sense. ie It should be a STALL. In fact I think that might fix the regression with USB storage devices that some people have reported.
I'll play some more with this later today. I want to make sure that the change we're talking about does not break existing devices that I thoroughly tested as part of the usb async re-write. If everything works as expected then we'll change it.

Ok. I just tested that change (ie returning STALL instead of NAK on EPIPE) with a bunch of devices: USB serial adapter, CF card reader, USB webcam (MS VX-3000) and MS USB mouse. All that stuff was hooked up to XP-SP3 and all of them are perfectly usable at the same time.

In other words here is my ACK :)

---
 usb-linux.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
usb-linux.c +3 -1
index 9e5d9c4..d712134 100644
@@ -275,7 +275,9 @@ static void async_complete(void *opaque)
 
             case -EPIPE:
                 set_halt(s, p->devep);
-                /* fall through */
+		p->len = USB_RET_STALL;
+		break;
+
             default:
                 p->len = USB_RET_NAK;
                 break;
Signature · 1 line
1.6.5.rc2
#1 lore raw
Quoted 8 lines · Paul Bolle

0) This is an attempt to get an issue in usb-linux.c, for which a patch was posted about a year ago, finally fixed.

1) Mark Burkley submitted a "EHCI emulation module" for review in in October 2008 (see:
http://lists.gnu.org/archive/html/qemu-devel/2008-10/msg01326.html). No EHCI emulation module was ever committed to qemu.

Yeah, it's ashame that noone's followed up with this patch.

Quoted 4 lines

2) Part of that (large) patch was a fix for a separate issue in usb-linux.c. Max Krasnyansky has ACK'ed that fix (see:
http://lists.gnu.org/archive/html/qemu-devel/2008-11/msg00032.html).

Quoted 8 lines

3) I already asked whether this fix was ready to be committed in last April (see:
http://lists.gnu.org/archive/html/qemu-devel/2009-04/msg01763.html)

4) Maybe submitting this fix as a separate patch (with a really long commit message but without a Signed-off-by) and cc-ing everbody involved will help if actually getting this issue fixed.

Yes, separate fixes should always be separate patches.

Quoted 10 lines

Ok. I just tested that change (ie returning STALL instead of NAK on EPIPE) with a bunch of devices: USB serial adapter, CF card reader, USB webcam (MS VX-3000) and MS USB mouse. All that stuff was hooked up to XP-SP3 and all of them are perfectly usable at the same time.

In other words here is my ACK :)

Someone needs to provide a Signed-off-by.

Quoted 20 lines
---
 usb-linux.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
usb-linux.c +3 -1
index 9e5d9c4..d712134 100644
@@ -275,7 +275,9 @@ static void async_complete(void *opaque)
 
             case -EPIPE:
                 set_halt(s, p->devep);
-                /* fall through */
+		p->len = USB_RET_STALL;
+		break;
+
             default:
                 p->len = USB_RET_NAK;
                 break;
Signature · 3 lines
Regards,

Anthony Liguori
author
#4 lore raw
Quoted 4 lines · Anthony Liguori
Quoted 2 lines · Paul Bolle

Does it matter who actually signs off this patch?

Yes.

So a Signed-off-by tag provided by me won't do?

Paul

#5 lore raw
Quoted 4 lines · Paul Bolle
Quoted 2 lines · Anthony Liguori

Paul Bolle wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Does it matter who actually signs off this patch?

Yes.

So a Signed-off-by tag provided by me won't do?

A SoB is a statement of intent so if you feel you can contribute a SoB is a decision for you to make. See Documentation/SubmittingPatches in Linux for more details about the ramification of DCO.

Regards,

Anthony Liguori

#6 lore raw
Quoted 8 lines · Anthony Liguori
Quoted 7 lines · Paul Bolle
Quoted 5 lines · Anthony Liguori
Quoted 3 lines · Paul Bolle

Does it matter who actually signs off this patch?

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Yes.

So a Signed-off-by tag provided by me won't do?

A SoB is a statement of intent so if you feel you can contribute a SoB is a decision for you to make. See Documentation/SubmittingPatches in Linux for more details about the ramification of DCO.

I guess I could've provided the Signed-off-by instead of Acked-by. In other words if you're ok with converting my Acked-By to Signed-off-by in the aforementioned patch then lets go ahead an do it.

I could also resend the full patch but I'm totally swamped right now and might not get to doing it this week.

btw Paul you can also resend and sign off yourself and keep my ack.

Max

author
#7 lore raw
Quoted 5 lines · Max Krasnyansky
Quoted 3 lines · Anthony Liguori

A SoB is a statement of intent so if you feel you can contribute a SoB is a decision for you to make. See Documentation/SubmittingPatches in Linux for more details about the ramification of DCO.

Quoted 8 lines

I guess I could've provided the Signed-off-by instead of Acked-by. In other words if you're ok with converting my Acked-By to Signed-off-by in the aforementioned patch then lets go ahead an do it.

I could also resend the full patch but I'm totally swamped right now and might not get to doing it this week.

btw Paul you can also resend and sign off yourself and keep my ack.

I guess this patch should make everybody happy.

I've replaced the verbose commit message with (basically) a longer version of the commit summary. A search for the summary should turn up this thread, which will in turn point to previous steps for those readers really interested.
---
usb-linux: return USB_RET_STALL on -EPIPE

If -EPIPE is returned to an asynchronous IN completion async_complete() should return USB_RET_STALL.

---
 usb-linux.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
usb-linux.c +3 -1
index 9e5d9c4..d712134 100644
@@ -275,7 +275,9 @@ static void async_complete(void *opaque)
 
             case -EPIPE:
                 set_halt(s, p->devep);
-                /* fall through */
+		p->len = USB_RET_STALL;
+		break;
+
             default:
                 p->len = USB_RET_NAK;
                 break;
Signature · 1 line
1.6.5.rc2