Date: Fri, 15 Jun 2018 18:04:44 +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: r335223 - head/sys/dev/cxgbe Message-ID: <201806151804.w5FI4i46064041@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: np Date: Fri Jun 15 18:04:44 2018 New Revision: 335223 URL: https://svnweb.freebsd.org/changeset/base/335223 Log: cxgbe(4): sysctls to display the local and intr CPUs for the adapter. The driver assumes the list can change (even though it does't right now) and queries it every time the sysctl runs. sysctl dev.<nexus>.<inst>.local_cpus sysctl dev.<nexus>.<inst>.intr_cpus sysctl dev.t6nex.0.local_cpus sysctl dev.t6nex.0.intr_cpus Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Fri Jun 15 17:44:21 2018 (r335222) +++ head/sys/dev/cxgbe/t4_main.c Fri Jun 15 18:04:44 2018 (r335223) @@ -588,6 +588,7 @@ static int sysctl_tx_rate(SYSCTL_HANDLER_ARGS); static int sysctl_ulprx_la(SYSCTL_HANDLER_ARGS); static int sysctl_wcwr_stats(SYSCTL_HANDLER_ARGS); static int sysctl_tc_params(SYSCTL_HANDLER_ARGS); +static int sysctl_cpus(SYSCTL_HANDLER_ARGS); #ifdef TCP_OFFLOAD static int sysctl_tls_rx_ports(SYSCTL_HANDLER_ARGS); static int sysctl_tp_tick(SYSCTL_HANDLER_ARGS); @@ -5547,6 +5548,14 @@ t4_sysctls(struct adapter *sc) SYSCTL_ADD_INT(ctx, children, OID_AUTO, "core_vdd", CTLFLAG_RD, &sc->params.core_vdd, 0, "core Vdd (in mV)"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "local_cpus", + CTLTYPE_STRING | CTLFLAG_RD, sc, LOCAL_CPUS, + sysctl_cpus, "A", "local CPUs"); + + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_cpus", + CTLTYPE_STRING | CTLFLAG_RD, sc, INTR_CPUS, + sysctl_cpus, "A", "preferred CPUs for interrupts"); + /* * dev.t4nex.X.misc. Marked CTLFLAG_SKIP to avoid information overload. */ @@ -8610,6 +8619,39 @@ done: sbuf_delete(sb); return (rc); +} + +static int +sysctl_cpus(SYSCTL_HANDLER_ARGS) +{ + struct adapter *sc = arg1; + enum cpu_sets op = arg2; + cpuset_t cpuset; + struct sbuf *sb; + int i, rc; + + MPASS(op == LOCAL_CPUS || op == INTR_CPUS); + + CPU_ZERO(&cpuset); + rc = bus_get_cpus(sc->dev, op, sizeof(cpuset), &cpuset); + if (rc != 0) + return (rc); + + rc = sysctl_wire_old_buffer(req, 0); + if (rc != 0) + return (rc); + + sb = sbuf_new_for_sysctl(NULL, NULL, 4096, req); + if (sb == NULL) + return (ENOMEM); + + CPU_FOREACH(i) + sbuf_printf(sb, "%d ", i); + rc = sbuf_finish(sb); + sbuf_delete(sb); + + return (rc); + } #ifdef TCP_OFFLOAD
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806151804.w5FI4i46064041>