From owner-svn-src-head@freebsd.org Fri Jun 15 18:04:45 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7027B1016BCC; Fri, 15 Jun 2018 18:04:45 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 252927BABC; Fri, 15 Jun 2018 18:04:45 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 063CF1ADC2; Fri, 15 Jun 2018 18:04:45 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5FI4ieo064042; Fri, 15 Jun 2018 18:04:44 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5FI4i46064041; Fri, 15 Jun 2018 18:04:44 GMT (envelope-from np@FreeBSD.org) Message-Id: <201806151804.w5FI4i46064041@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 15 Jun 2018 18:04:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r335223 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 335223 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2018 18:04:45 -0000 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...local_cpus sysctl dev...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