• Alan Stern's avatar
    USB: OHCI: accept very late isochronous URBs · 7ca9229c
    Alan Stern authored
    commit a8693424 upstream.
    
    Commit 24f53137 (USB: EHCI: accept very late isochronous URBs)
    changed the isochronous API provided by ehci-hcd.  URBs submitted too
    late, so that the time slots for all their packets have already
    expired, are no longer rejected outright.  Instead the submission is
    accepted, and the URB completes normally with a -EXDEV error for each
    packet.  This is what client drivers expect.
    
    This patch implements the same policy in ohci-hcd.  The change is more
    complicated than it was in ehci-hcd, because ohci-hcd doesn't scan for
    isochronous completions in the same way as ehci-hcd does.  Rather, it
    depends on the hardware adding completed TDs to a "done queue".  Some
    OHCI controller don't handle this properly when a TD's time slot has
    already expired, so we have to avoid adding such TDs to the schedule
    in the first place.  As a result, if the URB was submitted too late
    then none of its TDs will get put on the schedule, so none of them
    will end up on the done queue, so the driver will never realize that
    the URB should be completed.
    
    To solve this problem, the patch adds one to urb_priv->td_cnt for such
    URBs, making it larger than urb_priv->length (td_cnt already gets set
    to the number of TD's that had to be skipped because their slots have
    expired).  Each time an URB is given back, the finish_urb() routine
    looks to see if urb_priv->td_cnt for the next URB on the same endpoint
    is marked in this way.  If so, it gives back the next URB right away.
    
    This should be applied to all kernels containing commit 815fa7b9
    (USB: OHCI: fix logic for scheduling isochronous URBs).
    Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    7ca9229c
ohci-q.c 32.5 KB