Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci - Backout if_wm.c rev.1.574 and pri...



details:   https://anonhg.NetBSD.org/src/rev/25d407f7e1c4
branches:  trunk
changeset: 318420:25d407f7e1c4
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Mon Apr 23 01:35:25 2018 +0000
description:
- Backout if_wm.c rev.1.574 and print "device timeout (lost interrupt)"
 when all descriptors in a queue are free. When all descripters are free after
 wm_txeof(), it's caused by lost interrupt (though I've never seen it). One
 possibility is chip bug and another possibility is software bug. We should
 reset in any cases. If we don't reset and don't print error message, TX
 processing is done intermittently and user might not noticed the problem.

- Rename txq_watchdog to txq_sending to make the meaning clear.

diffstat:

 sys/dev/pci/if_wm.c |  29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)

diffs (103 lines):

diff -r 131ad91a3230 -r 25d407f7e1c4 sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Mon Apr 23 01:29:23 2018 +0000
+++ b/sys/dev/pci/if_wm.c       Mon Apr 23 01:35:25 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.575 2018/04/23 01:29:23 msaitoh Exp $      */
+/*     $NetBSD: if_wm.c,v 1.576 2018/04/23 01:35:25 msaitoh Exp $      */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.575 2018/04/23 01:29:23 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.576 2018/04/23 01:35:25 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -370,7 +370,7 @@
 
        bool txq_stopping;
 
-       bool txq_watchdog;
+       bool txq_sending;
        time_t txq_lastsent;
 
        uint32_t txq_packets;           /* for AIM */
@@ -3010,7 +3010,7 @@
 {
 
        mutex_enter(txq->txq_lock);
-       if (txq->txq_watchdog &&
+       if (txq->txq_sending &&
            time_uptime - txq->txq_lastsent > wm_watchdog_timeout) {
                wm_watchdog_txq_locked(ifp, txq, hang);
        }
@@ -3032,14 +3032,17 @@
         */
        wm_txeof(txq, UINT_MAX);
 
-       if (txq->txq_free != WM_NTXDESC(txq)) {
+       if (txq->txq_sending)
+               *hang |= __BIT(wmq->wmq_id);
+
+       if (txq->txq_free == WM_NTXDESC(txq)) {
+               log(LOG_ERR, "%s: device timeout (lost interrupt)\n",
+                   device_xname(sc->sc_dev));
+       } else {
 #ifdef WM_DEBUG
                int i, j;
                struct wm_txsoft *txs;
 #endif
-               if (txq->txq_watchdog)
-                       *hang |= __BIT(wmq->wmq_id);
-
                log(LOG_ERR,
                    "%s: device timeout (txfree %d txsfree %d txnext %d)\n",
                    device_xname(sc->sc_dev), txq->txq_free, txq->txq_sfree,
@@ -6011,7 +6014,7 @@
                struct wm_queue *wmq = &sc->sc_queue[qidx];
                struct wm_txqueue *txq = &wmq->wmq_txq;
                mutex_enter(txq->txq_lock);
-               txq->txq_watchdog = false; /* ensure watchdog disabled */
+               txq->txq_sending = false; /* ensure watchdog disabled */
                for (i = 0; i < WM_TXQUEUELEN(txq); i++) {
                        txs = &txq->txq_soft[i];
                        if (txs->txs_mbuf != NULL) {
@@ -6700,7 +6703,7 @@
        wm_init_tx_regs(sc, wmq, txq);
        wm_init_tx_buffer(sc, txq);
 
-       txq->txq_watchdog = false;
+       txq->txq_sending = false;
 }
 
 static void
@@ -7467,7 +7470,7 @@
        if (txq->txq_free != ofree) {
                /* Set a watchdog timer in case the chip flakes out. */
                txq->txq_lastsent = time_uptime;
-               txq->txq_watchdog = true;
+               txq->txq_sending = true;
        }
 }
 
@@ -8041,7 +8044,7 @@
        if (sent) {
                /* Set a watchdog timer in case the chip flakes out. */
                txq->txq_lastsent = time_uptime;
-               txq->txq_watchdog = true;
+               txq->txq_sending = true;
        }
 }
 
@@ -8186,7 +8189,7 @@
         * timer.
         */
        if (txq->txq_sfree == WM_TXQUEUELEN(txq))
-               txq->txq_watchdog = false;
+               txq->txq_sending = false;
 
        return more;
 }



Home | Main Index | Thread Index | Old Index