Date: Wed, 9 Mar 2011 21:07:09 +0000 (UTC) From: Navdeep Parhar <np@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r219436 - head/sys/dev/cxgbe Message-ID: <201103092107.p29L792Q020515@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: np Date: Wed Mar 9 21:07:09 2011 New Revision: 219436 URL: http://svn.freebsd.org/changeset/base/219436 Log: Display holdoff timers and packet counts as a list of numbers. MFC after: 1 week Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Wed Mar 9 17:15:11 2011 (r219435) +++ head/sys/dev/cxgbe/t4_main.c Wed Mar 9 21:07:09 2011 (r219436) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include <dev/pci/pcivar.h> #include <dev/pci/pci_private.h> #include <sys/firmware.h> +#include <sys/sbuf.h> #include <sys/smp.h> #include <sys/socket.h> #include <sys/sockio.h> @@ -272,6 +273,7 @@ static void t4_get_regs(struct adapter * static void cxgbe_tick(void *); static int t4_sysctls(struct adapter *); static int cxgbe_sysctls(struct port_info *); +static int sysctl_int_array(SYSCTL_HANDLER_ARGS); static int sysctl_holdoff_tmr_idx(SYSCTL_HANDLER_ARGS); static int sysctl_holdoff_pktc_idx(SYSCTL_HANDLER_ARGS); static int sysctl_qsize_rxq(SYSCTL_HANDLER_ARGS); @@ -2294,15 +2296,13 @@ t4_sysctls(struct adapter *sc) SYSCTL_ADD_INT(ctx, children, OID_AUTO, "core_clock", CTLFLAG_RD, &sc->params.vpd.cclk, 0, "core clock frequency (in KHz)"); - /* XXX: this doesn't seem to show up */ - SYSCTL_ADD_OPAQUE(ctx, children, OID_AUTO, "holdoff_tmr", - CTLFLAG_RD, &intr_timer, sizeof(intr_timer), "IU", - "interrupt holdoff timer values (us)"); - - /* XXX: this doesn't seem to show up */ - SYSCTL_ADD_OPAQUE(ctx, children, OID_AUTO, "holdoff_pktc", - CTLFLAG_RD, &intr_pktcount, sizeof(intr_pktcount), "IU", - "interrupt holdoff packet counter values"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "holdoff_timers", + CTLTYPE_STRING | CTLFLAG_RD, &intr_timer, sizeof(intr_timer), + sysctl_int_array, "A", "interrupt holdoff timer values (us)"); + + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "holdoff_pkt_counts", + CTLTYPE_STRING | CTLFLAG_RD, &intr_pktcount, sizeof(intr_pktcount), + sysctl_int_array, "A", "interrupt holdoff packet counter values"); return (0); } @@ -2505,6 +2505,22 @@ cxgbe_sysctls(struct port_info *pi) } static int +sysctl_int_array(SYSCTL_HANDLER_ARGS) +{ + int rc, *i; + struct sbuf sb; + + sbuf_new(&sb, NULL, 32, SBUF_AUTOEXTEND); + for (i = arg1; arg2; arg2 -= sizeof(int), i++) + sbuf_printf(&sb, "%d ", *i); + sbuf_trim(&sb); + sbuf_finish(&sb); + rc = sysctl_handle_string(oidp, sbuf_data(&sb), sbuf_len(&sb), req); + sbuf_delete(&sb); + return (rc); +} + +static int sysctl_holdoff_tmr_idx(SYSCTL_HANDLER_ARGS) { struct port_info *pi = arg1;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201103092107.p29L792Q020515>