On Fri, Oct 18, 2019 at 05:14:24PM +0200, Martin Pieuchot wrote:
> As soon as a transfer with an error condition is passed to
> usb_transfer_complete(), usbd_start_next() won't be called.
> 
> If the callback of that transfer had already enqueue a new xfer, via
> usbd_transfer(), it will stay on the queue until the pipe is aborted.
> 
> Currently all our drivers call usbd_transfer() without reinitializing
> `xfer->status' and that confuses *hci's abort() methods.
> 
> Does the diff below help?

Yes it does. Thanks! OK by me.

ulptwrite
usbd_do_request_flags
ulpt_status: status=0x18 err=0
ulptwrite: transfer 16384 bytes
xhci0: txerr? code 4
ulpt_input: got some data
xhci0: txerr? code 4
usbd_clear_endpoint_stall
usbd_do_request_flags
xhci0: txerr? code 4
usb0: usb_needs_explore
usb_add_task: task=0xffff800000093e80 state=0 type=1
ulptwrite: error=13
usb_explore: usb0
usbd_do_request_flags
usbd_do_request_flags
usbd_do_request_flags
usbd_do_request_flags
ulpt_detach: sc=0xffff8000003f7b00
ulpt_detach: aborting pipe=0xffff800000ddf000
usbd_abort_pipe: pipe=0xffff800000ddf000
ulpt_detach: aborting pipe=0xffff800000de0000
usbd_abort_pipe: pipe=0xffff800000de0000
usbd_abort_pipe: pipe=0xffff800000de0000 xfer=0xfffffd811f8da000 
(methods=0xffffffff81ef98b0)
xhci_abort_xfer: xfer=0xfffffd811f8da000 status=NOT_STARTED err=CANCELLED 
actlen=23 len=64 idx=-1
ulpt_input: got some data
xhci0: xhci_cmd_configure_ep dev 4
usbd_abort_pipe: pipe=0xffff800000de0000
xhci0: xhci_cmd_configure_ep dev 4
ulptclose: closed
ulpt0 detached
usbd_abort_pipe: pipe=0xffff800000407000
xhci0: xhci_cmd_configure_ep dev 4
xhci0: xhci_cmd_slot_control
usbd_do_request_flags
usbd_do_request_flags


> Index: usbdi.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/usb/usbdi.c,v
> retrieving revision 1.101
> diff -u -p -r1.101 usbdi.c
> --- usbdi.c   6 Oct 2019 17:11:51 -0000       1.101
> +++ usbdi.c   18 Oct 2019 15:11:29 -0000
> @@ -294,6 +294,7 @@ usbd_transfer(struct usbd_xfer *xfer)
>               usbd_dump_queue(pipe);
>  #endif
>       xfer->done = 0;
> +     xfer->status = USBD_NOT_STARTED;
>  
>       if (pipe->aborting)
>               return (USBD_CANCELLED);
> 
> 

Reply via email to