Module Name: src
Committed By: msaitoh
Date: Wed Oct 20 08:06:45 UTC 2021
Modified Files:
src/sys/dev/pci: if_wm.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.713 -r1.714 src/sys/dev/pci/if_wm.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.713 src/sys/dev/pci/if_wm.c:1.714
--- src/sys/dev/pci/if_wm.c:1.713 Wed Oct 20 08:02:07 2021
+++ src/sys/dev/pci/if_wm.c Wed Oct 20 08:06:45 2021
@@ -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 @@ wm_flush_desc_rings(struct wm_softc *sc)
* 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 @@ wm_flush_desc_rings(struct wm_softc *sc)
* 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);