Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb xhci(4): only usbd_xfer_trycomplete() if certain...



details:   https://anonhg.NetBSD.org/src/rev/18085ba492fe
branches:  trunk
changeset: 972255:18085ba492fe
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Thu May 21 15:28:35 2020 +0000

description:
xhci(4): only usbd_xfer_trycomplete() if certain to usb_transfer_complete()

Previously we'd cancel the timeout after the data stage of control xfers, and
then hope that the status stage would eventually interrupt.

diffstat:

 sys/dev/usb/xhci.c |  25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)

diffs (60 lines):

diff -r 04033cd2be77 -r 18085ba492fe sys/dev/usb/xhci.c
--- a/sys/dev/usb/xhci.c        Thu May 21 13:47:10 2020 +0000
+++ b/sys/dev/usb/xhci.c        Thu May 21 15:28:35 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xhci.c,v 1.128 2020/05/21 13:47:10 jakllsch Exp $      */
+/*     $NetBSD: xhci.c,v 1.129 2020/05/21 15:28:35 jakllsch Exp $      */
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.128 2020/05/21 13:47:10 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.129 2020/05/21 15:28:35 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1992,13 +1992,6 @@
                return;
        }
 
-       /*
-        * Try to claim this xfer for completion.  If it has already
-        * completed or aborted, drop it on the floor.
-        */
-       if (!usbd_xfer_trycomplete(xfer))
-               return;
-
        /* 4.11.5.2 Event Data TRB */
        if ((trb_3 & XHCI_TRB_3_ED_BIT) != 0) {
                DPRINTFN(14, "transfer Event Data: 0x%016jx 0x%08jx"
@@ -2054,6 +2047,13 @@
                DPRINTFN(1, "ERR %ju slot %ju dci %ju", trbcode, slot, dci, 0);
                xr->is_halted = true;
                /*
+                * Try to claim this xfer for completion.  If it has already
+                * completed or aborted, drop it on the floor.
+                */
+               if (!usbd_xfer_trycomplete(xfer))
+                       return;
+
+               /*
                 * Stalled endpoints can be recoverd by issuing
                 * command TRB TYPE_RESET_EP on xHCI instead of
                 * issuing request CLEAR_FEATURE UF_ENDPOINT_HALT
@@ -2078,6 +2078,13 @@
                break;
        }
 
+       /*
+        * Try to claim this xfer for completion.  If it has already
+        * completed or aborted, drop it on the floor.
+        */
+       if (!usbd_xfer_trycomplete(xfer))
+               return;
+
        /* Set the status.  */
        xfer->ux_status = err;
 



Home | Main Index | Thread Index | Old Index