Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Jul 2018 07:29: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: r336735 - head/sys/dev/cxgbe
Message-ID:  <201807260729.w6Q7TiYH035772@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201807260729.w6Q7TiYH035772>