Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Fix a serious bug in bandwidth accounting that t...



details:   https://anonhg.NetBSD.org/src/rev/a9509bfe1cae
branches:  trunk
changeset: 472848:a9509bfe1cae
user:      augustss <augustss%NetBSD.org@localhost>
date:      Sun May 09 22:48:35 1999 +0000

description:
Fix a serious bug in bandwidth accounting that thrashed memory.
Thanks to Joel Chen <jchen%nc.com@localhost> for tracking it down.

diffstat:

 sys/dev/usb/ohci.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r a23b81277d31 -r a9509bfe1cae sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c        Sun May 09 21:22:53 1999 +0000
+++ b/sys/dev/usb/ohci.c        Sun May 09 22:48:35 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohci.c,v 1.27 1999/01/13 10:33:53 augustss Exp $       */
+/*     $NetBSD: ohci.c,v 1.28 1999/05/09 22:48:35 augustss Exp $       */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -2153,7 +2153,7 @@
        splx(s);
 
        for (j = 0; j < nslots; j++)
-               --sc->sc_bws[pos * nslots + j];
+               --sc->sc_bws[(pos * nslots + j) & OHCI_NO_INTRS];
 
        ohci_free_std(sc, opipe->tail);
        ohci_free_sed(sc, opipe->sed);
@@ -2199,7 +2199,7 @@
        for (best = i = slow, bestbw = ~0; i < shigh; i++) {
                bw = 0;
                for (j = 0; j < nslots; j++)
-                       bw += sc->sc_bws[i * nslots + j];
+                       bw += sc->sc_bws[(i * nslots + j) % OHCI_NO_INTRS];
                if (bw < bestbw) {
                        best = i;
                        bestbw = bw;
@@ -2217,7 +2217,7 @@
        splx(s);
 
        for (j = 0; j < nslots; j++)
-               ++sc->sc_bws[best * nslots + j];
+               ++sc->sc_bws[(best * nslots + j) % OHCI_NO_INTRS];
        opipe->u.intr.nslots = nslots;
        opipe->u.intr.pos = best;
 



Home | Main Index | Thread Index | Old Index