Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Change the test to check if transfers are done. ...



details:   https://anonhg.NetBSD.org/src/rev/6ba9de5f862a
branches:  trunk
changeset: 481389:6ba9de5f862a
user:      augustss <augustss%NetBSD.org@localhost>
date:      Fri Jan 28 00:15:54 2000 +0000

description:
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.

diffstat:

 sys/dev/usb/uhci.c |  16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diffs (37 lines):

diff -r 1114082338c0 -r 6ba9de5f862a sys/dev/usb/uhci.c
--- a/sys/dev/usb/uhci.c        Fri Jan 28 00:11:38 2000 +0000
+++ b/sys/dev/usb/uhci.c        Fri Jan 28 00:15:54 2000 +0000
@@ -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 @@
                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 @@
                return;
        }
  done:
+       DPRINTFN(15, ("uhci_check_intr: ii=%p done\n", ii));
        usb_untimeout(uhci_timeout, ii, ii->timeout_handle);
        uhci_idone(ii);
 }



Home | Main Index | Thread Index | Old Index