From 4e9e8e52f401e87d648c5e58a84ef7a577fdc77f Mon Sep 17 00:00:00 2001 From: augustss Date: Fri, 28 Jan 2000 00:15:54 +0000 Subject: [PATCH] Change the test to check if transfers are done. The old test was broken and sometimes reported transfers as done prematurely. This fix seems to stabilize the Ethernet drivers. --- sys/dev/usb/uhci.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c index 7e38cdfdfd1d..76c3cf579431 100644 --- a/sys/dev/usb/uhci.c +++ b/sys/dev/usb/uhci.c @@ -1,4 +1,4 @@ -/* $NetBSD: uhci.c,v 1.82 2000/01/26 10:04:38 augustss Exp $ */ +/* $NetBSD: uhci.c,v 1.83 2000/01/28 00:15:54 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */ /* @@ -1049,9 +1049,16 @@ uhci_check_intr(sc, ii) DPRINTFN(15, ("uhci_check_intr: active ii=%p\n", ii)); for (std = ii->stdstart; std != lstd; std = std->link.std) { status = LE(std->td.td_status); - if ((status & UHCI_TD_STALLED) || - (status & (UHCI_TD_SPD | UHCI_TD_ACTIVE)) == - UHCI_TD_SPD) + /* If there's an active TD the xfer isn't done. */ + if (status & UHCI_TD_ACTIVE) + break; + /* Any kind of error makes the xfer done. */ + if (status & UHCI_TD_STALLED) + goto done; + /* We want short packets, and it is short: it's done */ + if ((status & UHCI_TD_SPD) && + UHCI_TD_GET_ACTLEN(status) < + UHCI_TD_GET_MAXLEN(LE(std->td.td_token))) goto done; } DPRINTFN(15, ("uhci_check_intr: ii=%p std=%p still active\n", @@ -1059,6 +1066,7 @@ uhci_check_intr(sc, ii) return; } done: + DPRINTFN(15, ("uhci_check_intr: ii=%p done\n", ii)); usb_untimeout(uhci_timeout, ii, ii->timeout_handle); uhci_idone(ii); }