Blame SOURCES/0001-enable-MaxOutstandingR2T-negotiation.patch

e88930
From a54966e121ef5deaee2e113d1c912a7dd85aca86 Mon Sep 17 00:00:00 2001
e88930
From: Chris Leech <cleech@redhat.com>
e88930
Date: Wed, 20 Jun 2018 22:09:35 -0700
e88930
Subject: [PATCH 1/1] enable MaxOutstandingR2T negotiation
e88930
e88930
The iscsi_tcp kernel side R2T handling is in libiscsi_tcp and is shared
e88930
with at least cxgbi3, and the drivers claim CAP_MULTI_R2T. But the
e88930
iscsid login parameter negotiation code never enabled MaxOutstandingR2T.
e88930
e88930
I've tested this against an LIO target, negotiating to 2 and 4 R2Ts.
e88930
The network traces looked good, with the initiator keeping track of
e88930
multiple outstanding R2Ts and using the correct next identifier.
e88930
Throughput of bulk write data was improved, even over low latency virtio
e88930
links.
e88930
e88930
Signed-off-by: Chris Leech <cleech@redhat.com>
e88930
---
e88930
 usr/initiator.h        |  1 +
e88930
 usr/initiator_common.c |  3 ++-
e88930
 usr/login.c            | 14 +++++---------
e88930
 3 files changed, 8 insertions(+), 10 deletions(-)
e88930
e88930
diff --git a/usr/initiator.h b/usr/initiator.h
e88930
index 4f96d6b6e2c5..3ee1454b6de2 100644
e88930
--- a/usr/initiator.h
e88930
+++ b/usr/initiator.h
e88930
@@ -212,6 +212,7 @@ typedef struct iscsi_session {
e88930
 	int erl;
e88930
 	uint32_t imm_data_en;
e88930
 	uint32_t initial_r2t_en;
e88930
+	uint32_t max_r2t;
e88930
 	uint32_t fast_abort;
e88930
 	uint32_t first_burst;
e88930
 	uint32_t max_burst;
e88930
diff --git a/usr/initiator_common.c b/usr/initiator_common.c
e88930
index 191e779bb942..d00bd9e7469b 100644
e88930
--- a/usr/initiator_common.c
e88930
+++ b/usr/initiator_common.c
e88930
@@ -173,6 +173,7 @@ iscsi_copy_operational_params(struct iscsi_conn *conn,
e88930
 
e88930
 	/* session's operational parameters */
e88930
 	session->initial_r2t_en = session_conf->InitialR2T;
e88930
+	session->max_r2t = session_conf->MaxOutstandingR2T;
e88930
 	session->imm_data_en = session_conf->ImmediateData;
e88930
 	session->first_burst = align_32_down(session_conf->FirstBurstLength);
e88930
 	/*
e88930
@@ -375,7 +376,7 @@ int iscsi_session_set_neg_params(struct iscsi_conn *conn)
e88930
 			.conn_only = 0,
e88930
 		}, {
e88930
 			.param = ISCSI_PARAM_MAX_R2T,
e88930
-			.value = &one, /* FIXME: session->max_r2t */
e88930
+			.value = &session->max_r2t,
e88930
 			.type = ISCSI_INT,
e88930
 			.conn_only = 0,
e88930
 		}, {
e88930
diff --git a/usr/login.c b/usr/login.c
e88930
index 294ad0bf73fd..d7dad21180cf 100644
e88930
--- a/usr/login.c
e88930
+++ b/usr/login.c
e88930
@@ -524,14 +524,9 @@ get_op_params_text_keys(iscsi_session_t *session, int cid,
e88930
 		text = value_end;
e88930
 	} else if (iscsi_find_key_value("MaxOutstandingR2T", text, end, &value,
e88930
 					 &value_end)) {
e88930
-		if (session->type == ISCSI_SESSION_TYPE_NORMAL) {
e88930
-			if (strcmp(value, "1")) {
e88930
-				log_error("Login negotiation "
e88930
-					       "failed, can't accept Max"
e88930
-					       "OutstandingR2T %s", value);
e88930
-				return LOGIN_NEGOTIATION_FAILED;
e88930
-			}
e88930
-		} else
e88930
+		if (session->type == ISCSI_SESSION_TYPE_NORMAL)
e88930
+			session->max_r2t = strtoul(value, NULL, 0);
e88930
+		else
e88930
 			session->irrelevant_keys_bitmap |=
e88930
 						IRRELEVANT_MAXOUTSTANDINGR2T;
e88930
 		text = value_end;
e88930
@@ -810,8 +805,9 @@ add_params_normal_session(iscsi_session_t *session, struct iscsi_hdr *pdu,
e88930
 		return 0;
e88930
 
e88930
 	/* these we must have */
e88930
+	sprintf(value, "%d", session->max_r2t);
e88930
 	if (!iscsi_add_text(pdu, data, max_data_length,
e88930
-			    "MaxOutstandingR2T", "1"))
e88930
+			    "MaxOutstandingR2T", value))
e88930
 		return 0;
e88930
 	if (!iscsi_add_text(pdu, data, max_data_length,
e88930
 			    "MaxConnections", "1"))
e88930
-- 
e88930
2.14.4
e88930