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 values for debugging TX/RX queues.



details:   https://anonhg.NetBSD.org/src/rev/29977a9bfdd3
branches:  trunk
changeset: 957131:29977a9bfdd3
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu Nov 19 02:36:30 2020 +0000

description:
Add some sysctl values for debugging TX/RX queues.

diffstat:

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

diffs (78 lines):

diff -r c13e0de6e7af -r 29977a9bfdd3 sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Thu Nov 19 02:23:24 2020 +0000
+++ b/sys/dev/pci/if_wm.c       Thu Nov 19 02:36:30 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.696 2020/11/16 11:54:10 rin Exp $  */
+/*     $NetBSD: if_wm.c,v 1.697 2020/11/19 02:36:30 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.696 2020/11/16 11:54:10 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.697 2020/11/19 02:36:30 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -481,6 +481,7 @@
 
        struct wm_txqueue wmq_txq;
        struct wm_rxqueue wmq_rxq;
+       char sysctlname[32];            /* Name for sysctl */
 
        bool wmq_txrx_use_workqueue;
        struct work wmq_cookie;
@@ -5886,8 +5887,8 @@
 wm_init_sysctls(struct wm_softc *sc)
 {
        struct sysctllog **log;
-       const struct sysctlnode *rnode, *cnode;
-       int rv;
+       const struct sysctlnode *rnode, *qnode, *cnode;
+       int i, rv;
        const char *dvname;
 
        log = &sc->sc_sysctllog;
@@ -5906,6 +5907,40 @@
        if (rv != 0)
                goto teardown;
 
+       for (i = 0; i < sc->sc_nqueues; i++) {
+               struct wm_queue *wmq = &sc->sc_queue[i];
+               struct wm_txqueue *txq = &wmq->wmq_txq;
+               struct wm_rxqueue *rxq = &wmq->wmq_rxq;
+
+               snprintf(sc->sc_queue[i].sysctlname,
+                   sizeof(sc->sc_queue[i].sysctlname), "q%d", i);
+
+               if (sysctl_createv(log, 0, &rnode, &qnode,
+                   0, CTLTYPE_NODE,
+                   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"),
+                   NULL, 0, &txq->txq_free,
+                   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,
+                   "rxq_ptr", SYSCTL_DESCR("RX queue pointer"),
+                   NULL, 0, &rxq->rxq_ptr,
+                   0, CTL_CREATE, CTL_EOL) != 0)
+                       break;
+       }
+
 #ifdef WM_DEBUG
        rv = sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READWRITE,
            CTLTYPE_INT, "debug_flags",



Home | Main Index | Thread Index | Old Index