[PATCH 1/2] Enable more iscsi local params

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch is restructuring  step done in order to configuring local parameters for tgtd through tgtadm.
Local parameters in this context are parameters that are not negotiated with the initiator.

Currently there is one such parameter i.e. ISCSI_PARAM_MAX_XMIT_DLENGTH and we want to add more e.g. max commands.

This patch aims to standardize the adding and handling of such local parameters by moving them to the end of the list.
A new enumeration was named ISCSI_PARAM_FIRST_LOCAL was added.
Explicit tests done against ISCSI_PARAM_MAX_XMIT_DLENGTH in order not to send a prameter's value to the initiator
were modified to check if the parameter's index is greater or equal to ISCSI_PARAM_FIRST_LOCAL
(where the index of ISCSI_PARAM_MAX_XMIT_DLENGTH is the one of the "first local").

Signed-off-by: Shlomo Pongratz <shlomop@xxxxxxxxxxxx>
---
 usr/iscsi/iscsi_if.h  |    4 +++-
 usr/iscsi/iscsid.c    |    6 +++---
 usr/iscsi/iser_text.c |    4 ++--
 usr/iscsi/param.c     |    5 +++--
 usr/iscsi/target.c    |    3 ++-
 5 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/usr/iscsi/iscsi_if.h b/usr/iscsi/iscsi_if.h
index 0e9c2eb..cee91c3 100644
--- a/usr/iscsi/iscsi_if.h
+++ b/usr/iscsi/iscsi_if.h
@@ -197,7 +197,6 @@ enum iscsi_err {
  */
 enum iscsi_param {
 	ISCSI_PARAM_MAX_RECV_DLENGTH,
-	ISCSI_PARAM_MAX_XMIT_DLENGTH,
 	ISCSI_PARAM_HDRDGST_EN,
 	ISCSI_PARAM_DATADGST_EN,
 	ISCSI_PARAM_INITIAL_R2T_EN,
@@ -220,6 +219,9 @@ enum iscsi_param {
 	ISCSI_PARAM_TARGET_RDSL,
 	ISCSI_PARAM_INITIATOR_RDSL,
 	ISCSI_PARAM_MAX_OUTST_PDU,
+	/* "local" parmas, never sent to the initiator */
+	ISCSI_PARAM_FIRST_LOCAL,
+	ISCSI_PARAM_MAX_XMIT_DLENGTH = ISCSI_PARAM_FIRST_LOCAL,
 	/* must always be last */
 	ISCSI_PARAM_MAX,
 };
diff --git a/usr/iscsi/iscsid.c b/usr/iscsi/iscsid.c
index 005bac5..ec011dd 100644
--- a/usr/iscsi/iscsid.c
+++ b/usr/iscsi/iscsid.c
@@ -348,7 +348,7 @@ static void text_scan_login(struct iscsi_connection *conn)
 				text_key_add_reject(conn, key);
 				continue;
 			}
-			if (idx == ISCSI_PARAM_MAX_XMIT_DLENGTH)
+			if (idx >= ISCSI_PARAM_FIRST_LOCAL)
 				conn->session_param[idx].val = val;
 			else
 				param_set_val(session_keys,
@@ -357,7 +357,7 @@ static void text_scan_login(struct iscsi_connection *conn)
 
 			switch (conn->session_param[idx].state) {
 			case KEY_STATE_START:
-				if (idx == ISCSI_PARAM_MAX_XMIT_DLENGTH)
+				if (idx >= ISCSI_PARAM_FIRST_LOCAL)
 					break;
 				memset(buf, 0, sizeof(buf));
 				param_val_to_str(session_keys, idx, val, buf);
@@ -405,7 +405,7 @@ static int text_check_param(struct iscsi_connection *conn)
 	for (i = 0, cnt = 0; session_keys[i].name; i++) {
 		if (p[i].state == KEY_STATE_START && p[i].val != session_keys[i].def) {
 			if (conn->state == STATE_LOGIN) {
-				if (i == ISCSI_PARAM_MAX_XMIT_DLENGTH) {
+				if (i >= ISCSI_PARAM_FIRST_LOCAL) {
 					if (p[i].val > session_keys[i].def)
 						p[i].val = session_keys[i].def;
 					p[i].state = KEY_STATE_DONE;
diff --git a/usr/iscsi/iser_text.c b/usr/iscsi/iser_text.c
index c76501a..6617a34 100644
--- a/usr/iscsi/iser_text.c
+++ b/usr/iscsi/iser_text.c
@@ -293,7 +293,7 @@ static void iser_login_oper_scan(struct iscsi_connection *iscsi_conn,
 
 			switch (iscsi_conn->session_param[idx].state) {
 			case KEY_STATE_START:
-				if (idx == ISCSI_PARAM_MAX_XMIT_DLENGTH)
+				if (idx >= ISCSI_PARAM_FIRST_LOCAL)
 					break;
 				memset(buf, 0, sizeof(buf));
 				param_val_to_str(session_keys, idx, val, buf);
@@ -343,7 +343,7 @@ static int iser_login_check_params(struct iscsi_connection *iscsi_conn,
 	for (i = 0, cnt = 0; session_keys[i].name; i++) {
 		if (p[i].state == KEY_STATE_START && p[i].val != session_keys[i].def) {
 			if (iscsi_conn->state == STATE_LOGIN) {
-				if (i == ISCSI_PARAM_MAX_XMIT_DLENGTH) {
+				if (i >= ISCSI_PARAM_FIRST_LOCAL) {
 					if (p[i].val > session_keys[i].def)
 						p[i].val = session_keys[i].def;
 					p[i].state = KEY_STATE_DONE;
diff --git a/usr/iscsi/param.c b/usr/iscsi/param.c
index a6ca6da..0d9788b 100644
--- a/usr/iscsi/param.c
+++ b/usr/iscsi/param.c
@@ -322,8 +322,6 @@ static struct iscsi_key_ops marker_ops = {
 struct iscsi_key session_keys[] = {
 	[ISCSI_PARAM_MAX_RECV_DLENGTH] =
 	{"MaxRecvDataSegmentLength", 8192, 512, 16777215, &minimum_ops},
-	[ISCSI_PARAM_MAX_XMIT_DLENGTH] =
-	{"MaxXmitDataSegmentLength", 8192, 512, 16777215, &minimum_ops},
 	[ISCSI_PARAM_HDRDGST_EN] =
 	{"HeaderDigest", DIGEST_NONE, DIGEST_NONE, DIGEST_ALL, &digest_ops},
 	[ISCSI_PARAM_DATADGST_EN] =
@@ -367,6 +365,9 @@ struct iscsi_key session_keys[] = {
 	{"InitiatorRecvDataSegmentLength", 8192, 512, 16777215, &minimum_ops},
 	[ISCSI_PARAM_MAX_OUTST_PDU] =
 	{"MaxOutstandingUnexpectedPDUs", 0, 2, 4294967295U, &min_or_zero_ops},
+	/* "local" parmas, never sent to the initiator */
+	[ISCSI_PARAM_MAX_XMIT_DLENGTH] =
+	{"MaxXmitDataSegmentLength", 8192, 512, 16777215, &minimum_ops},
 	[ISCSI_PARAM_MAX] =
 	{NULL,},
 };
diff --git a/usr/iscsi/target.c b/usr/iscsi/target.c
index 20fb1da..4797b4c 100644
--- a/usr/iscsi/target.c
+++ b/usr/iscsi/target.c
@@ -433,7 +433,6 @@ int iscsi_target_create(struct target *t)
 	struct iscsi_target *target;
 	struct param default_tgt_session_param[] = {
 		[ISCSI_PARAM_MAX_RECV_DLENGTH] = {0, 8192},
-		[ISCSI_PARAM_MAX_XMIT_DLENGTH] = {0, 8192},  /* do not edit */
 		[ISCSI_PARAM_HDRDGST_EN] = {0, DIGEST_NONE},
 		[ISCSI_PARAM_DATADGST_EN] = {0, DIGEST_NONE},
 		[ISCSI_PARAM_INITIAL_R2T_EN] = {0, 1},
@@ -455,6 +454,8 @@ int iscsi_target_create(struct target *t)
 		[ISCSI_PARAM_TARGET_RDSL] = {0, 262144},
 		[ISCSI_PARAM_INITIATOR_RDSL] = {0, 262144},
 		[ISCSI_PARAM_MAX_OUTST_PDU] =  {0, 0},  /* not in open-iscsi */
+		/* "local" parmas, never sent to the initiator */
+		[ISCSI_PARAM_MAX_XMIT_DLENGTH] = {0, 8192},  /* do not edit */
 	};
 
 	target = malloc(sizeof(*target));
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux