svn commit: r346869 - stable/11/sys/dev/cxgbe
Navdeep Parhar
np at FreeBSD.org
Mon Apr 29 02:30:07 UTC 2019
Author: np
Date: Mon Apr 29 02:30:06 2019
New Revision: 346869
URL: https://svnweb.freebsd.org/changeset/base/346869
Log:
MFC r335223:
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:
stable/11/sys/dev/cxgbe/t4_main.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/dev/cxgbe/t4_main.c
==============================================================================
--- stable/11/sys/dev/cxgbe/t4_main.c Mon Apr 29 01:40:35 2019 (r346868)
+++ stable/11/sys/dev/cxgbe/t4_main.c Mon Apr 29 02:30:06 2019 (r346869)
@@ -662,6 +662,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);
@@ -5728,6 +5729,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.
*/
@@ -8853,6 +8862,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
More information about the svn-src-stable
mailing list