Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/ti Uncomment and protect sanity checks that wou...



details:   https://anonhg.NetBSD.org/src/rev/92461084ed22
branches:  trunk
changeset: 373772:92461084ed22
user:      sekiya <sekiya%NetBSD.org@localhost>
date:      Mon Feb 27 21:15:09 2023 +0000

description:
Uncomment and protect sanity checks that would drop into the debugger with a
CPSW_DEBUG_DMA define.

This handles a condition where checking for DMA_RXEOQ in the received packet
results in the console being spammed with "rxeoq" messages, which soon results
in a kernel panic.  The corresponding Debugger() call for this check was
commented out.

The TI documentation ("AM335x and AMIC110 Sitara™ Processors Technical
Reference Manual") documents the EOQ bit thus:

        (14.3.2.4.1.2.4) This bit is set by the EMAC when the EMAC identifies
        that a descriptor is the last for a given packet received (also sets
        the EOP flag), and there are no more descriptors in the receive list
        (next descriptor pointer is NULL).  The software application can use
        this bit to detect when the EMAC receiver for the corresponding channel
        has halted. This is useful when the application appends additional free
        buffer descriptors to an active receive queue. Note that this flag is
        valid on EOP descriptors only.

Moving this check (and the offending printf() ) into a debug #ifdef results in
the BeagleBone Green surviving the nightly checks; it would always drop into
the debugger before this change.

diffstat:

 sys/arch/arm/ti/if_cpsw.c |  16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diffs (67 lines):

diff -r 3b076cf2323e -r 92461084ed22 sys/arch/arm/ti/if_cpsw.c
--- a/sys/arch/arm/ti/if_cpsw.c Mon Feb 27 21:04:43 2023 +0000
+++ b/sys/arch/arm/ti/if_cpsw.c Mon Feb 27 21:15:09 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_cpsw.c,v 1.16 2022/09/18 15:47:09 thorpej Exp $     */
+/*     $NetBSD: if_cpsw.c,v 1.17 2023/02/27 21:15:09 sekiya Exp $      */
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -53,7 +53,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.16 2022/09/18 15:47:09 thorpej Exp $");
+__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.17 2023/02/27 21:15:09 sekiya Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -95,6 +95,8 @@
 CTASSERT(powerof2(CPSW_NTXDESCS));
 CTASSERT(powerof2(CPSW_NRXDESCS));
 
+#undef CPSW_DEBUG_DMA  /* define this for DMA debugging */
+
 #define CPSW_PAD_LEN (ETHER_MIN_LEN - ETHER_CRC_LEN)
 
 #define TXDESC_NEXT(x) cpsw_txdesc_adjust((x), 1)
@@ -1181,10 +1183,12 @@
                        return 1;
                }
 
+#if defined(CPSW_DEBUG_DMA)
                if ((dw[3] & (CPDMA_BD_SOP | CPDMA_BD_EOP)) !=
                    (CPDMA_BD_SOP | CPDMA_BD_EOP)) {
-                       //Debugger();
+                       Debugger();
                }
+#endif
 
                bus_dmamap_sync(sc->sc_bdt, dm, 0, dm->dm_mapsize,
                    BUS_DMASYNC_POSTREAD);
@@ -1219,10 +1223,12 @@
                    cpsw_rxdesc_paddr(sc, i));
        }
 
+#if defined(CPSW_DEBUG_DMA)
        if (sc->sc_rxeoq) {
                device_printf(sc->sc_dev, "rxeoq\n");
-               //Debugger();
+               Debugger();
        }
+#endif
 
        cpsw_write_4(sc, CPSW_CPDMA_CPDMA_EOI_VECTOR, CPSW_INTROFF_RX);
 
@@ -1269,9 +1275,11 @@
 
                cpsw_get_txdesc(sc, sc->sc_txhead, &bd);
 
+#if defined(CPSW_DEBUG_DMA)
                if (dw[2] == 0) {
                        //Debugger();
                }
+#endif
 
                if (ISSET(dw[3], CPDMA_BD_SOP) == 0)
                        goto next;


Home | Main Index | Thread Index | Old Index