Module Name:    src
Committed By:   martin
Date:           Mon May 25 15:31:45 UTC 2020

Modified Files:
        src/sys/dev/usb [netbsd-9]: xhci.c

Log Message:
Pull up following revision(s) (requested by jakllsch in ticket #921):

        sys/dev/usb/xhci.c: revision 1.129

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.


To generate a diff of this commit:
cvs rdiff -u -r1.107.2.5 -r1.107.2.6 src/sys/dev/usb/xhci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.107.2.5 src/sys/dev/usb/xhci.c:1.107.2.6
--- src/sys/dev/usb/xhci.c:1.107.2.5	Sun Mar  1 12:35:16 2020
+++ src/sys/dev/usb/xhci.c	Mon May 25 15:31:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.107.2.5 2020/03/01 12:35:16 martin Exp $	*/
+/*	$NetBSD: xhci.c,v 1.107.2.6 2020/05/25 15:31:45 martin Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.107.2.5 2020/03/01 12:35:16 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.107.2.6 2020/05/25 15:31:45 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1969,13 +1969,6 @@ xhci_event_transfer(struct xhci_softc * 
 		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"
@@ -2031,6 +2024,13 @@ xhci_event_transfer(struct xhci_softc * 
 		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
@@ -2055,6 +2055,13 @@ xhci_event_transfer(struct xhci_softc * 
 		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;
 

Reply via email to