Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Be more careful about issuing CU_RESUME in fxp_st...



details:   https://anonhg.NetBSD.org/src/rev/3fbac8b8b0c5
branches:  trunk
changeset: 565172:3fbac8b8b0c5
user:      briggs <briggs%NetBSD.org@localhost>
date:      Wed Mar 31 14:48:31 2004 +0000

description:
Be more careful about issuing CU_RESUME in fxp_start()--only doing
it if we think it's probably necessary.  Then do it again in the
tx interrupt handler, if we again think it's necessary.  This
reduces the number of commands we issue the chip.  Prior to this
change, the i82550 (running without extended feature set, so like
a '559) would sometimes fail in fxp_scb_wait() prior to issuing
another CU_RESUME, resulting in
        fxp0: WARNING: SCB timed out!
messages on the console, often followed by device timeouts.

diffstat:

 sys/dev/ic/i82557.c |  21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diffs (50 lines):

diff -r 1a39347f42f1 -r 3fbac8b8b0c5 sys/dev/ic/i82557.c
--- a/sys/dev/ic/i82557.c       Wed Mar 31 13:01:00 2004 +0000
+++ b/sys/dev/ic/i82557.c       Wed Mar 31 14:48:31 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i82557.c,v 1.81 2004/02/19 14:21:40 yamt Exp $ */
+/*     $NetBSD: i82557.c,v 1.82 2004/03/31 14:48:31 briggs Exp $       */
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.81 2004/02/19 14:21:40 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.82 2004/03/31 14:48:31 briggs Exp $");
 
 #include "bpfilter.h"
 #include "rnd.h"
@@ -1089,9 +1089,18 @@
 
                /*
                 * Issue a Resume command in case the chip was suspended.
+                * We only do this if we know we were idle before.  If we
+                * weren't idle before, we might be now, but we should also
+                * have a pending interrupt, and we'll kick it again, there.
+                * This might result in a tiny delay, but it also prevents
+                * us from slamming the chip with CU_RESUME commands, which
+                * might sometimes fail, resulting in SCB timeouts in
+                * fxp_scb_wait().
                 */
-               fxp_scb_wait(sc);
-               fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_RESUME);
+               if (opending == 0) {
+                       fxp_scb_wait(sc);
+                       fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_RESUME);
+               }
 
                /* Set a watchdog timer in case the chip flakes out. */
                ifp->if_timer = 5;
@@ -1224,6 +1233,10 @@
         */
        if (sc->sc_txpending == 0)
                ifp->if_timer = 0;
+       else {
+               fxp_scb_wait(sc);
+               fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_RESUME);
+       }
 }
 
 /*



Home | Main Index | Thread Index | Old Index