Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Mar 2021 03:01:34 GMT
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 3ef86cd7c3cc - stable/12 - Make software iSCSI more configurable.
Message-ID:  <202103150301.12F31YLR098108@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by mav:

URL: https://cgit.FreeBSD.org/src/commit/?id=3ef86cd7c3ccef27d42bb7cbdecd41f0fdd81f69

commit 3ef86cd7c3ccef27d42bb7cbdecd41f0fdd81f69
Author:     Alexander Motin <mav@FreeBSD.org>
AuthorDate: 2021-01-28 20:53:49 +0000
Commit:     Alexander Motin <mav@FreeBSD.org>
CommitDate: 2021-03-15 03:00:38 +0000

    Make software iSCSI more configurable.
    
    Move software iSCSI tunables/sysctls into kern.icl.soft subtree.
    Replace several hardcoded length constants there with variables.
    
    While there, stretch the limits to better match Linux' open-iscsi
    and our own initiator with new MAXPHYS of 1MB.  Our CTL target is
    also optimized for up to 1MB I/Os, so there is also a match now.
    For Windows 10 and VMware 6.7 initiators at default settings it
    should make no change, since previous limits were sufficient there.
    
    Tests of QD1 1MB writes from FreeBSD over 10GigE link show throughput
    increase by 29% on idle connection and 132% with concurrent QD8 reads.
    
    MFC after:      3 days
    Sponsored by:   iXsystems, Inc.
    
    (cherry picked from commit b75168ed24ca74f65929e5c57d4fed5f0ab08f2a)
---
 sys/dev/iscsi/icl.h      |  2 --
 sys/dev/iscsi/icl_soft.c | 45 +++++++++++++++++++++++++--------------------
 2 files changed, 25 insertions(+), 22 deletions(-)

diff --git a/sys/dev/iscsi/icl.h b/sys/dev/iscsi/icl.h
index 9105f0d68a35..0039a31390fd 100644
--- a/sys/dev/iscsi/icl.h
+++ b/sys/dev/iscsi/icl.h
@@ -91,8 +91,6 @@ struct icl_pdu {
 #define ICL_CONN_STATE_DATA		4
 #define ICL_CONN_STATE_DATA_DIGEST	5
 
-#define	ICL_MAX_DATA_SEGMENT_LENGTH	(128 * 1024)
-
 struct icl_conn {
 	KOBJ_FIELDS;
 	struct mtx		*ic_lock;
diff --git a/sys/dev/iscsi/icl_soft.c b/sys/dev/iscsi/icl_soft.c
index 454afe15c398..32b59fe60e50 100644
--- a/sys/dev/iscsi/icl_soft.c
+++ b/sys/dev/iscsi/icl_soft.c
@@ -63,18 +63,29 @@ __FBSDID("$FreeBSD$");
 #include <dev/iscsi/iscsi_proto.h>
 #include <icl_conn_if.h>
 
+SYSCTL_NODE(_kern_icl, OID_AUTO, soft, CTLFLAG_RD | CTLFLAG_MPSAFE, 0,
+    "Software iSCSI");
 static int coalesce = 1;
-SYSCTL_INT(_kern_icl, OID_AUTO, coalesce, CTLFLAG_RWTUN,
+SYSCTL_INT(_kern_icl_soft, OID_AUTO, coalesce, CTLFLAG_RWTUN,
     &coalesce, 0, "Try to coalesce PDUs before sending");
-static int partial_receive_len = 128 * 1024;
-SYSCTL_INT(_kern_icl, OID_AUTO, partial_receive_len, CTLFLAG_RWTUN,
+static int partial_receive_len = 256 * 1024;
+SYSCTL_INT(_kern_icl_soft, OID_AUTO, partial_receive_len, CTLFLAG_RWTUN,
     &partial_receive_len, 0, "Minimum read size for partially received "
     "data segment");
-static int sendspace = 1048576;
-SYSCTL_INT(_kern_icl, OID_AUTO, sendspace, CTLFLAG_RWTUN,
+static int max_data_segment_length = 256 * 1024;
+SYSCTL_INT(_kern_icl_soft, OID_AUTO, max_data_segment_length, CTLFLAG_RWTUN,
+    &max_data_segment_length, 0, "Maximum data segment length");
+static int first_burst_length = 1024 * 1024;
+SYSCTL_INT(_kern_icl_soft, OID_AUTO, first_burst_length, CTLFLAG_RWTUN,
+    &first_burst_length, 0, "First burst length");
+static int max_burst_length = 1024 * 1024;
+SYSCTL_INT(_kern_icl_soft, OID_AUTO, max_burst_length, CTLFLAG_RWTUN,
+    &max_burst_length, 0, "Maximum burst length");
+static int sendspace = 1536 * 1024;
+SYSCTL_INT(_kern_icl_soft, OID_AUTO, sendspace, CTLFLAG_RWTUN,
     &sendspace, 0, "Default send socket buffer size");
-static int recvspace = 1048576;
-SYSCTL_INT(_kern_icl, OID_AUTO, recvspace, CTLFLAG_RWTUN,
+static int recvspace = 1536 * 1024;
+SYSCTL_INT(_kern_icl_soft, OID_AUTO, recvspace, CTLFLAG_RWTUN,
     &recvspace, 0, "Default receive socket buffer size");
 
 static MALLOC_DEFINE(M_ICL_SOFT, "icl_soft", "iSCSI software backend");
@@ -509,10 +520,8 @@ icl_conn_receive_pdu(struct icl_conn *ic, struct mbuf **r, size_t *rs)
 		len = icl_pdu_data_segment_length(request);
 		if (len > ic->ic_max_data_segment_length) {
 			ICL_WARN("received data segment "
-			    "length %zd is larger than negotiated "
-			    "MaxDataSegmentLength %zd; "
-			    "dropping connection",
-			    len, ic->ic_max_data_segment_length);
+			    "length %zd is larger than negotiated; "
+			    "dropping connection", len);
 			error = EINVAL;
 			break;
 		}
@@ -1076,7 +1085,7 @@ icl_soft_new_conn(const char *name, struct mtx *lock)
 #ifdef DIAGNOSTIC
 	refcount_init(&ic->ic_outstanding_pdus, 0);
 #endif
-	ic->ic_max_data_segment_length = ICL_MAX_DATA_SEGMENT_LENGTH;
+	ic->ic_max_data_segment_length = max_data_segment_length;
 	ic->ic_name = name;
 	ic->ic_offload = "None";
 	ic->ic_unmapped = false;
@@ -1126,10 +1135,6 @@ icl_conn_start(struct icl_conn *ic)
 	 * For sendspace, this is required because the current code cannot
 	 * send a PDU in pieces; thus, the minimum buffer size is equal
 	 * to the maximum PDU size.  "+4" is to account for possible padding.
-	 *
-	 * What we should actually do here is to use autoscaling, but set
-	 * some minimal buffer size to "minspace".  I don't know a way to do
-	 * that, though.
 	 */
 	minspace = sizeof(struct iscsi_bhs) + ic->ic_max_data_segment_length +
 	    ISCSI_HEADER_DIGEST_SIZE + ISCSI_DATA_DIGEST_SIZE + 4;
@@ -1373,10 +1378,10 @@ static int
 icl_soft_limits(struct icl_drv_limits *idl)
 {
 
-	idl->idl_max_recv_data_segment_length = 128 * 1024;
-	idl->idl_max_send_data_segment_length = 128 * 1024;
-	idl->idl_max_burst_length = 262144;
-	idl->idl_first_burst_length = idl->idl_max_burst_length;
+	idl->idl_max_recv_data_segment_length = max_data_segment_length;
+	idl->idl_max_send_data_segment_length = max_data_segment_length;
+	idl->idl_max_burst_length = max_burst_length;
+	idl->idl_first_burst_length = first_burst_length;
 
 	return (0);
 }



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