git: 1b3027b10541 - stable/13 - cxgbe(4): Add knob to control congestion behavior for TOE queues.

From: Navdeep Parhar <np_at_FreeBSD.org>
Date: Thu, 02 Feb 2023 07:39:40 UTC
The branch stable/13 has been updated by np:

URL: https://cgit.FreeBSD.org/src/commit/?id=1b3027b1054106c863a34f7f78f4de3063a3b728

commit 1b3027b1054106c863a34f7f78f4de3063a3b728
Author:     Navdeep Parhar <np@FreeBSD.org>
AuthorDate: 2022-09-09 22:21:18 +0000
Commit:     Navdeep Parhar <np@FreeBSD.org>
CommitDate: 2023-02-02 07:20:10 +0000

    cxgbe(4): Add knob to control congestion behavior for TOE queues.
    
    hw.cxgbe.ofld_cong_drop works just like hw.cxgbe.cong_drop but for TOE
    rx queues.
    
    Sponsored by:   Chelsio Communications
    
    (cherry picked from commit 998eb37aca6670b1ecbb7b5cad2b5b2d85d744b8)
---
 sys/dev/cxgbe/t4_sge.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c
index 8d83567c2725..4a11c6c89573 100644
--- a/sys/dev/cxgbe/t4_sge.c
+++ b/sys/dev/cxgbe/t4_sge.c
@@ -128,6 +128,11 @@ SYSCTL_INT(_hw_cxgbe, OID_AUTO, spg_len, CTLFLAG_RDTUN, &spg_len, 0,
 static int cong_drop = 0;
 SYSCTL_INT(_hw_cxgbe, OID_AUTO, cong_drop, CTLFLAG_RDTUN, &cong_drop, 0,
     "Congestion control for NIC RX queues (0 = backpressure, 1 = drop, 2 = both");
+#ifdef TCP_OFFLOAD
+static int ofld_cong_drop = 0;
+SYSCTL_INT(_hw_cxgbe, OID_AUTO, ofld_cong_drop, CTLFLAG_RDTUN, &ofld_cong_drop, 0,
+    "Congestion control for TOE RX queues (0 = backpressure, 1 = drop, 2 = both");
+#endif
 
 /*
  * Deliver multiple frames in the same free list buffer if they fit.
@@ -559,6 +564,13 @@ t4_sge_modload(void)
 		    " using 0 instead.\n", cong_drop);
 		cong_drop = 0;
 	}
+#ifdef TCP_OFFLOAD
+	if (ofld_cong_drop < -1 || ofld_cong_drop > 2) {
+		printf("Invalid hw.cxgbe.ofld_cong_drop value (%d),"
+		    " using 0 instead.\n", ofld_cong_drop);
+		ofld_cong_drop = 0;
+	}
+#endif
 
 	if (tscale != 1 && (tscale < 3 || tscale > 17)) {
 		printf("Invalid hw.cxgbe.tscale value (%d),"
@@ -1011,6 +1023,10 @@ t4_sge_sysctls(struct adapter *sc, struct sysctl_ctx_list *ctx,
 
 	SYSCTL_ADD_INT(ctx, children, OID_AUTO, "cong_drop", CTLFLAG_RD,
 	    NULL, cong_drop, "congestion drop setting");
+#ifdef TCP_OFFLOAD
+	SYSCTL_ADD_INT(ctx, children, OID_AUTO, "ofld_cong_drop", CTLFLAG_RD,
+	    NULL, ofld_cong_drop, "congestion drop setting");
+#endif
 
 	SYSCTL_ADD_INT(ctx, children, OID_AUTO, "fl_pack", CTLFLAG_RD,
 	    NULL, sp->pack_boundary, "payload pack boundary (bytes)");
@@ -4143,7 +4159,7 @@ alloc_ofld_rxq(struct vi_info *vi, struct sge_ofld_rxq *ofld_rxq, int idx,
 		    CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "offload rx queue");
 
 		init_iq(&ofld_rxq->iq, sc, vi->ofld_tmr_idx, vi->ofld_pktc_idx,
-		    vi->qsize_rxq, intr_idx, 0, IQ_OFLD);
+		    vi->qsize_rxq, intr_idx, ofld_cong_drop, IQ_OFLD);
 		snprintf(name, sizeof(name), "%s ofld_rxq%d-fl",
 		    device_get_nameunit(vi->dev), idx);
 		init_fl(sc, &ofld_rxq->fl, vi->qsize_rxq / 8, maxp, name);