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) { _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"