From owner-svn-src-head@freebsd.org Thu Jul 26 07:29: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 9299E10452F0; Thu, 26 Jul 2018 07:29: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 46FDB8299B; Thu, 26 Jul 2018 07:29: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 27F6225EC1; Thu, 26 Jul 2018 07:29: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 w6Q7TinB035773; Thu, 26 Jul 2018 07:29:44 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6Q7TiYH035772; Thu, 26 Jul 2018 07:29:44 GMT (envelope-from np@FreeBSD.org) Message-Id: <201807260729.w6Q7TiYH035772@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Thu, 26 Jul 2018 07:29:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336735 - 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: 336735 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.27 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: Thu, 26 Jul 2018 07:29:45 -0000 Author: np Date: Thu Jul 26 07:29:44 2018 New Revision: 336735 URL: https://svnweb.freebsd.org/changeset/base/336735 Log: cxgbe(4): Consider rateunit before ratemode when displaying information about a traffic class. This matches the order in which the firmware evaluates unit and mode internally. 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 Thu Jul 26 06:42:09 2018 (r336734) +++ head/sys/dev/cxgbe/t4_main.c Thu Jul 26 07:29:44 2018 (r336735) @@ -8612,34 +8612,35 @@ sysctl_tc_params(SYSCTL_HANDLER_ARGS) tc = sc->port[port_id]->sched_params->cl_rl[i]; mtx_unlock(&sc->tc_lock); - if (tc.flags & TX_CLRL_ERROR) { - sbuf_printf(sb, "error"); - goto done; - } - - if (tc.ratemode == SCHED_CLASS_RATEMODE_REL) { - /* XXX: top speed or actual link speed? */ - gbps = port_top_speed(sc->port[port_id]); - sbuf_printf(sb, " %u%% of %uGbps", tc.maxrate, gbps); - } else if (tc.ratemode == SCHED_CLASS_RATEMODE_ABS) { - switch (tc.rateunit) { - case SCHED_CLASS_RATEUNIT_BITS: + switch (tc.rateunit) { + case SCHED_CLASS_RATEUNIT_BITS: + switch (tc.ratemode) { + case SCHED_CLASS_RATEMODE_REL: + /* XXX: top speed or actual link speed? */ + gbps = port_top_speed(sc->port[port_id]); + sbuf_printf(sb, "%u%% of %uGbps", tc.maxrate, gbps); + break; + case SCHED_CLASS_RATEMODE_ABS: mbps = tc.maxrate / 1000; gbps = tc.maxrate / 1000000; if (tc.maxrate == gbps * 1000000) - sbuf_printf(sb, " %uGbps", gbps); + sbuf_printf(sb, "%uGbps", gbps); else if (tc.maxrate == mbps * 1000) - sbuf_printf(sb, " %uMbps", mbps); + sbuf_printf(sb, "%uMbps", mbps); else - sbuf_printf(sb, " %uKbps", tc.maxrate); + sbuf_printf(sb, "%uKbps", tc.maxrate); break; - case SCHED_CLASS_RATEUNIT_PKTS: - sbuf_printf(sb, " %upps", tc.maxrate); - break; default: rc = ENXIO; goto done; } + break; + case SCHED_CLASS_RATEUNIT_PKTS: + sbuf_printf(sb, "%upps", tc.maxrate); + break; + default: + rc = ENXIO; + goto done; } switch (tc.mode) {