git: 811a82d53aaf - main - cxgbetool(8): User interface to round-robin queue selection via COP.

From: Navdeep Parhar <np_at_FreeBSD.org>
Date: Thu, 14 Apr 2022 23:01:07 UTC
The branch main has been updated by np:

URL: https://cgit.FreeBSD.org/src/commit/?id=811a82d53aaf905bebb523600d375a457069f022

commit 811a82d53aaf905bebb523600d375a457069f022
Author:     Navdeep Parhar <np@FreeBSD.org>
AuthorDate: 2022-04-14 22:54:13 +0000
Commit:     Navdeep Parhar <np@FreeBSD.org>
CommitDate: 2022-04-14 22:54:13 +0000

    cxgbetool(8): User interface to round-robin queue selection via COP.
    
    Queue "roundrobin" in a COP rule means the driver should select queues
    for new tids in a round-robin manner.
    
    Reviewed by:    jhb@
    MFC after:      1 week
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D34922
---
 usr.sbin/cxgbetool/cxgbetool.8 | 18 +++++++++++-------
 usr.sbin/cxgbetool/cxgbetool.c | 15 +++++++++------
 2 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/usr.sbin/cxgbetool/cxgbetool.8 b/usr.sbin/cxgbetool/cxgbetool.8
index d1c6f528d04e..96e66632e758 100644
--- a/usr.sbin/cxgbetool/cxgbetool.8
+++ b/usr.sbin/cxgbetool/cxgbetool.8
@@ -31,7 +31,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 23, 2021
+.Dd April 14, 2022
 .Dt CXGBETOOL 8
 .Os
 .Sh NAME
@@ -649,18 +649,22 @@ must be one of
 .It Cm class Ar sc
 Bind the connection to the specified tx scheduling class.
 Valid range is 0 to 14 (for T4) and 0 to 15 (T5 onwards).
-.It Cm rxq Ar qid
+.It Cm rxq Ar qnum
 Use the specified offload rx queue.
-.Ar qid
-should be between 0 and nofldrxq for the ifnet.
+.Ar qnum
+should be
+.Cm random Ns , Cm roundrobin Ns ,
+or a number between 0 and nofldrxq for the ifnet.
 .It Cm txq Ar qnum
 Use the specified offload tx queue.
-.Ar qid
-should be between 0 and nofldtxq for the ifnet.
+.Ar qnum
+should be
+.Cm random Ns , Cm roundrobin Ns ,
+or a number between 0 and nofldtxq for the ifnet.
 .It Cm bind Ar qnum
 Shorthand for
 .Cm rxq Ar qnum Cm txq Ar qnum Ns .
-Use only when nofldrxq is the same as nofldtxq.
+Use when nofldrxq is the same as nofldtxq.
 .It Cm mss Ar val
 Set the advertised TCP MSS in the SYN for this connection to
 .Ar val
diff --git a/usr.sbin/cxgbetool/cxgbetool.c b/usr.sbin/cxgbetool/cxgbetool.c
index 77f092123de9..53de8f8ff89a 100644
--- a/usr.sbin/cxgbetool/cxgbetool.c
+++ b/usr.sbin/cxgbetool/cxgbetool.c
@@ -3150,14 +3150,17 @@ parse_offload_settings_word(const char *s, char **pnext, const char *ws,
 			os->sched_class = val;
 		} else if (!strcmp(s, "bind") || !strcmp(s, "txq") ||
 		    !strcmp(s, "rxq")) {
-			val = -1;
-			if (strcmp(param, "random")) {
+			if (!strcmp(param, "random")) {
+				val = QUEUE_RANDOM;
+			} else if (!strcmp(param, "roundrobin")) {
+				val = QUEUE_ROUNDROBIN;
+			} else {
 				p = str_to_number(param, &val, NULL);
 				if (*p || val < 0 || val > 0xffff) {
 					warnx("invalid queue specification "
 					    "\"%s\".  \"%s\" needs an integer"
-					    " value, or \"random\".",
-					    param, s);
+					    " value, \"random\", or "
+					    "\"roundrobin\".", param, s);
 					return (EINVAL);
 				}
 			}
@@ -3207,8 +3210,8 @@ parse_offload_settings(const char *settings_ro, struct offload_settings *os)
 		.ecn = -1,
 		.ddp = -1,
 		.tls = -1,
-		.txq = -1,
-		.rxq = -1,
+		.txq = QUEUE_RANDOM,
+		.rxq = QUEUE_RANDOM,
 		.mss = -1,
 	};