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

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