Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Add some sysctl info for debugging.



details:   https://anonhg.NetBSD.org/src/rev/0106303941ef
branches:  trunk
changeset: 1024777:0106303941ef
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu Nov 04 12:25:05 2021 +0000

description:
Add some sysctl info for debugging.

diffstat:

 sys/dev/pci/if_wm.c |  87 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 84 insertions(+), 3 deletions(-)

diffs (140 lines):

diff -r da8c6fada468 -r 0106303941ef sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Thu Nov 04 07:28:34 2021 +0000
+++ b/sys/dev/pci/if_wm.c       Thu Nov 04 12:25:05 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.715 2021/10/20 08:10:26 msaitoh Exp $      */
+/*     $NetBSD: if_wm.c,v 1.716 2021/11/04 12:25:05 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.715 2021/10/20 08:10:26 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.716 2021/11/04 12:25:05 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -1068,6 +1068,8 @@
 static void    wm_set_linkdown_discard(struct wm_softc *);
 static void    wm_clear_linkdown_discard(struct wm_softc *);
 
+static int     wm_sysctl_tdh_handler(SYSCTLFN_PROTO);
+static int     wm_sysctl_tdt_handler(SYSCTLFN_PROTO);
 #ifdef WM_DEBUG
 static int     wm_sysctl_debug(SYSCTLFN_PROTO);
 #endif
@@ -5991,6 +5993,7 @@
                    sc->sc_queue[i].sysctlname, SYSCTL_DESCR("Queue Name"),
                    NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL) != 0)
                        break;
+
                if (sysctl_createv(log, 0, &qnode, &cnode,
                    CTLFLAG_READONLY, CTLTYPE_INT,
                    "txq_free", SYSCTL_DESCR("TX queue free"),
@@ -5999,10 +6002,58 @@
                        break;
                if (sysctl_createv(log, 0, &qnode, &cnode,
                    CTLFLAG_READONLY, CTLTYPE_INT,
+                   "txd_head", SYSCTL_DESCR("TX descriptor head"),
+                   wm_sysctl_tdh_handler, 0, (void *)txq,
+                   0, CTL_CREATE, CTL_EOL) != 0)
+                       break;
+               if (sysctl_createv(log, 0, &qnode, &cnode,
+                   CTLFLAG_READONLY, CTLTYPE_INT,
+                   "txd_tail", SYSCTL_DESCR("TX descriptor tail"),
+                   wm_sysctl_tdt_handler, 0, (void *)txq,
+                   0, CTL_CREATE, CTL_EOL) != 0)
+                       break;
+               if (sysctl_createv(log, 0, &qnode, &cnode,
+                   CTLFLAG_READONLY, CTLTYPE_INT,
                    "txq_next", SYSCTL_DESCR("TX queue next"),
                    NULL, 0, &txq->txq_next,
                    0, CTL_CREATE, CTL_EOL) != 0)
                        break;
+               if (sysctl_createv(log, 0, &qnode, &cnode,
+                   CTLFLAG_READONLY, CTLTYPE_INT,
+                   "txq_sfree", SYSCTL_DESCR("TX queue sfree"),
+                   NULL, 0, &txq->txq_sfree,
+                   0, CTL_CREATE, CTL_EOL) != 0)
+                       break;
+               if (sysctl_createv(log, 0, &qnode, &cnode,
+                   CTLFLAG_READONLY, CTLTYPE_INT,
+                   "txq_snext", SYSCTL_DESCR("TX queue snext"),
+                   NULL, 0, &txq->txq_snext,
+                   0, CTL_CREATE, CTL_EOL) != 0)
+                       break;
+               if (sysctl_createv(log, 0, &qnode, &cnode,
+                   CTLFLAG_READONLY, CTLTYPE_INT,
+                   "txq_sdirty", SYSCTL_DESCR("TX queue sdirty"),
+                   NULL, 0, &txq->txq_sdirty,
+                   0, CTL_CREATE, CTL_EOL) != 0)
+                       break;
+               if (sysctl_createv(log, 0, &qnode, &cnode,
+                   CTLFLAG_READONLY, CTLTYPE_INT,
+                   "txq_flags", SYSCTL_DESCR("TX queue flags"),
+                   NULL, 0, &txq->txq_flags,
+                   0, CTL_CREATE, CTL_EOL) != 0)
+                       break;
+               if (sysctl_createv(log, 0, &qnode, &cnode,
+                   CTLFLAG_READONLY, CTLTYPE_BOOL,
+                   "txq_stopping", SYSCTL_DESCR("TX queue stopping"),
+                   NULL, 0, &txq->txq_stopping,
+                   0, CTL_CREATE, CTL_EOL) != 0)
+                       break;
+               if (sysctl_createv(log, 0, &qnode, &cnode,
+                   CTLFLAG_READONLY, CTLTYPE_BOOL,
+                   "txq_sending", SYSCTL_DESCR("TX queue sending"),
+                   NULL, 0, &txq->txq_sending,
+                   0, CTL_CREATE, CTL_EOL) != 0)
+                       break;
 
                if (sysctl_createv(log, 0, &qnode, &cnode,
                    CTLFLAG_READONLY, CTLTYPE_INT,
@@ -17084,7 +17135,35 @@
        CSR_WRITE(sc, WMREG_FEXTNVM9, reg);
 }
 
-/* Sysctl function */
+/* Sysctl functions */
+static int
+wm_sysctl_tdh_handler(SYSCTLFN_ARGS)
+{
+       struct sysctlnode node = *rnode;
+       struct wm_txqueue *txq = (struct wm_txqueue *)node.sysctl_data;
+       struct wm_queue *wmq = container_of(txq, struct wm_queue, wmq_txq);
+       struct wm_softc *sc = txq->txq_sc; 
+       uint32_t reg;
+
+       reg = CSR_READ(sc, WMREG_TDH(wmq->wmq_id));
+       node.sysctl_data = &reg;
+       return sysctl_lookup(SYSCTLFN_CALL(&node));
+}
+
+static int
+wm_sysctl_tdt_handler(SYSCTLFN_ARGS)
+{
+       struct sysctlnode node = *rnode;
+       struct wm_txqueue *txq = (struct wm_txqueue *)node.sysctl_data;
+       struct wm_queue *wmq = container_of(txq, struct wm_queue, wmq_txq);
+       struct wm_softc *sc = txq->txq_sc; 
+       uint32_t reg;
+
+       reg = CSR_READ(sc, WMREG_TDT(wmq->wmq_id));
+       node.sysctl_data = &reg;
+       return sysctl_lookup(SYSCTLFN_CALL(&node));
+}
+
 #ifdef WM_DEBUG
 static int
 wm_sysctl_debug(SYSCTLFN_ARGS)
@@ -17102,6 +17181,8 @@
                return error;
 
        sc->sc_debug = dflags;
+       device_printf(sc->sc_dev, "TARC0: %08x\n", CSR_READ(sc, WMREG_TARC0));
+       device_printf(sc->sc_dev, "TDT0: %08x\n", CSR_READ(sc, WMREG_TDT(0)));
 
        return 0;
 }



Home | Main Index | Thread Index | Old Index