Blob Blame Raw
From e696b94743d880c30c6e4e39c753e4d652845e85 Mon Sep 17 00:00:00 2001
From: John Soni Jose <jose0here@gmail.com>
Date: Fri, 21 Mar 2014 11:51:19 +0530
Subject: [PATCH] Fix StatSN in Open-iSCSI Stack.

 When LIO target is used, STATSN in login response can be in
 the range 0x0 - 0xFFFFFFFF. Open-iSCSI Stack had the type
 as ISCSI_INT for StatSN, so StatSN used to get reset to 0.

 Adding new type ISCSI_UINT feild to fix this issue.

Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
---
 usr/initiator_common.c | 2 +-
 usr/iscsi_ipc.h        | 1 +
 usr/netlink.c          | 3 +++
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/usr/initiator_common.c b/usr/initiator_common.c
index 109e8d7..50f8d41 100644
--- a/usr/initiator_common.c
+++ b/usr/initiator_common.c
@@ -431,7 +431,7 @@ int iscsi_session_set_neg_params(struct iscsi_conn *conn)
 		}, {
 			.param = ISCSI_PARAM_EXP_STATSN,
 			.value = &conn->exp_statsn,
-			.type = ISCSI_INT,
+			.type = ISCSI_UINT,
 			.conn_only = 1,
 		}, {
 			.param = ISCSI_PARAM_TPGT,
diff --git a/usr/iscsi_ipc.h b/usr/iscsi_ipc.h
index 9d26d54..5087b5c 100644
--- a/usr/iscsi_ipc.h
+++ b/usr/iscsi_ipc.h
@@ -30,6 +30,7 @@
 
 enum {
 	ISCSI_INT,
+	ISCSI_UINT,
 	ISCSI_STRING,
 };
 
diff --git a/usr/netlink.c b/usr/netlink.c
index 532d9ef..b0dfb03 100644
--- a/usr/netlink.c
+++ b/usr/netlink.c
@@ -716,6 +716,9 @@ kset_param(uint64_t transport_handle, uint32_t sid, uint32_t cid,
 	case ISCSI_INT:
 		sprintf(param_str, "%d", *((int *)value));
 		break;
+	case ISCSI_UINT:
+		sprintf(param_str, "%u", *((unsigned int *)value));
+		break;
 	case ISCSI_STRING:
 		if (!strlen(value))
 			return 0;
-- 
1.9.3