Module Name: src Committed By: jakllsch Date: Thu May 21 15:28:35 UTC 2020
Modified Files: src/sys/dev/usb: xhci.c Log Message: 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.128 -r1.129 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.128 src/sys/dev/usb/xhci.c:1.129 --- src/sys/dev/usb/xhci.c:1.128 Thu May 21 13:47:10 2020 +++ src/sys/dev/usb/xhci.c Thu May 21 15:28:35 2020 @@ -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 @@ 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" @@ -2054,6 +2047,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 @@ -2078,6 +2078,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;