Skip to content

Commit

Permalink
USB: EHCI: fix counting of transaction error retries
Browse files Browse the repository at this point in the history
This patch (as1274) simplifies the counting of transaction-error
retries.  Now we will count up from 0 to QH_XACTERR_MAX instead of
down from QH_XACTERR_MAX to 0.

The patch also fixes a small bug: qh->xacterr was not getting
initialized for interrupt endpoints.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Matthijs Kooijman <matthijs@stdin.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Aug 7, 2009
1 parent 7a0f0d9 commit ef4638f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/usb/host/ehci-q.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,12 +375,11 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
*/
if ((token & QTD_STS_XACT) &&
QTD_CERR(token) == 0 &&
--qh->xacterrs > 0 &&
++qh->xacterrs < QH_XACTERR_MAX &&
!urb->unlinked) {
ehci_dbg(ehci,
"detected XactErr len %zu/%zu retry %d\n",
qtd->length - QTD_LENGTH(token), qtd->length,
QH_XACTERR_MAX - qh->xacterrs);
qtd->length - QTD_LENGTH(token), qtd->length, qh->xacterrs);

/* reset the token in the qtd and the
* qh overlay (which still contains
Expand Down Expand Up @@ -494,7 +493,7 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
last = qtd;

/* reinit the xacterr counter for the next qtd */
qh->xacterrs = QH_XACTERR_MAX;
qh->xacterrs = 0;
}

/* last urb's completion might still need calling */
Expand Down Expand Up @@ -941,7 +940,7 @@ static void qh_link_async (struct ehci_hcd *ehci, struct ehci_qh *qh)
head->hw_next = dma;

qh_get(qh);
qh->xacterrs = QH_XACTERR_MAX;
qh->xacterrs = 0;
qh->qh_state = QH_STATE_LINKED;
/* qtd completions reported later by interrupt */
}
Expand Down
1 change: 1 addition & 0 deletions drivers/usb/host/ehci-sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ static int qh_link_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh)
}
}
qh->qh_state = QH_STATE_LINKED;
qh->xacterrs = 0;
qh_get (qh);

/* update per-qh bandwidth for usbfs */
Expand Down

0 comments on commit ef4638f

Please sign in to comment.