Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Disable printf()s in wm_flush_desc_rings() becau...



details:   https://anonhg.NetBSD.org/src/rev/d12e09c77713
branches:  trunk
changeset: 989923:d12e09c77713
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Oct 20 08:06:45 2021 +0000

description:
Disable printf()s in wm_flush_desc_rings() because the code is verified.

 The problem was very rare, so I added those printf()s as we can see.
Last week, knakahara and I found a procedure to reproduce the problem and
verified it worked correctly.

 To reproduce the problem:

 0) Use I219 V1 to V5. Not all of them have the problem and newer than V5 may
    have the problem. I used V2 for the test.
 1) Define WM_DEBUG or add printf in wm_flush_desc_rings() to see
    DESCRING_STATUS_FLUSH_REQ bit.
 2) Run "iperf -s" on the DUT.
 3) Run "iperf3 -R -u -c 192.168.1.110 -w 8m -b 1g" repeatedly on another
    machine. Note that kern.sbmax should be increased on both machines.
 4) run
        while true; do
        ifconfig wm0 down up
        sleep 30
        done
 5) After DESCRING_STATUS_FLUSH_REQ is set, without wm_flush_desc_rings(),
    TX stalls and reboot is required to recover from it.
    With wm_flush_desc_rings(), no device hang.
 6) If you can't see the DESCRING_STATUS_FLUSH_REQ is set, change the media
    to 100BASE-T.

 Note that if_wm.c rev. 1.710 originally written by chuq is required for the
test. Without the change, the device becomes unrecoverable state before
wm_flush_desc_rings() and the function doesn't recover from the problem.

diffstat:

 sys/dev/pci/if_wm.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (40 lines):

diff -r bc8cae101de9 -r d12e09c77713 sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Wed Oct 20 08:02:07 2021 +0000
+++ b/sys/dev/pci/if_wm.c       Wed Oct 20 08:06:45 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.713 2021/10/20 08:02:07 msaitoh Exp $      */
+/*     $NetBSD: if_wm.c,v 1.714 2021/10/20 08:06:45 msaitoh Exp $      */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.713 2021/10/20 08:02:07 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.714 2021/10/20 08:06:45 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -4890,8 +4890,9 @@
         * the data of the next descriptor. We don't care about the data we are
         * about to reset the HW.
         */
-       device_printf(sc->sc_dev, "Need TX flush (reg = %08x, len = %u)\n",
-           preg, reg);
+#ifdef WM_DEBUG
+       device_printf(sc->sc_dev, "Need TX flush (reg = %08x)\n", preg);
+#endif
        reg = CSR_READ(sc, WMREG_TCTL);
        CSR_WRITE(sc, WMREG_TCTL, reg | TCTL_EN);
 
@@ -4921,7 +4922,9 @@
         * Mark all descriptors in the RX ring as consumed and disable the
         * rx ring.
         */
+#ifdef WM_DEBUG
        device_printf(sc->sc_dev, "Need RX flush (reg = %08x)\n", preg);
+#endif
        rctl = CSR_READ(sc, WMREG_RCTL);
        CSR_WRITE(sc, WMREG_RCTL, rctl & ~RCTL_EN);
        CSR_WRITE_FLUSH(sc);



Home | Main Index | Thread Index | Old Index