diff options
| author | msaitoh <msaitoh@NetBSD.org> | 2021-11-04 12:25:05 +0000 |
|---|---|---|
| committer | msaitoh <msaitoh@NetBSD.org> | 2021-11-04 12:25:05 +0000 |
| commit | 2ded0618b9599da5fae4a1adbbf632f9544846b0 (patch) | |
| tree | 30612b360f07c2f71accbd20379c493cc4c3bb3d /sys/dev | |
| parent | 6fc434dd79e903987a1c19e143269296a181a144 (diff) | |
Add some sysctl info for debugging.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/pci/if_wm.c | 87 |
1 files changed, 84 insertions, 3 deletions
diff --git a/sys/dev/pci/if_wm.c b/sys/dev/pci/if_wm.c index df29c401fad..431b69a74b1 100644 --- a/sys/dev/pci/if_wm.c +++ b/sys/dev/pci/if_wm.c @@ -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 bool wm_phy_need_linkdown_discard(struct wm_softc *); 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 @@ wm_init_sysctls(struct wm_softc *sc) 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 @@ wm_init_sysctls(struct wm_softc *sc) 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 @@ wm_legacy_irq_quirk_spt(struct wm_softc *sc) 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 = ® + 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 = ® + return sysctl_lookup(SYSCTLFN_CALL(&node)); +} + #ifdef WM_DEBUG static int wm_sysctl_debug(SYSCTLFN_ARGS) @@ -17102,6 +17181,8 @@ wm_sysctl_debug(SYSCTLFN_ARGS) 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; } |
