Blame SOURCES/0031-PATCH-v5-1-3-ISCSISTART-Saved-ibft-boot-info-to-the-.patch

786c6d
From 5992173f13550d75659fec1d7e1f6e87895d560a Mon Sep 17 00:00:00 2001
786c6d
From: Mike Christie <michaelc@cs.wisc.edu>
786c6d
Date: Wed, 11 Sep 2013 23:59:31 -0700
786c6d
Subject: [PATCH] [PATCH v5 1/3] ISCSISTART: Saved ibft boot info to the
786c6d
 session
786c6d
786c6d
Patch and description from Eddie Wai:
6c64be
6c64be
Three new session sysfs parameters are introduced:
6c64be
boot_root   - holds the ibft boot root folder name
6c64be
boot_nic    - holds the ibft boot ethernetN name
6c64be
boot_target - holds the ibft boot targetN name
6c64be
786c6d
This patch copies over the /sys/firmware/<boot_root>/ethernetN/targetN
786c6d
info
6c64be
from the boot context to the node_rec.
6c64be
6c64be
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
6c64be
---
6c64be
 include/fw_context.h               |  3 +++
6c64be
 include/iscsi_proto.h              |  1 +
6c64be
 usr/config.h                       |  3 +++
6c64be
 usr/idbm.c                         |  6 ++++++
6c64be
 usr/initiator_common.c             | 14 +++++++++++++-
6c64be
 utils/fwparam_ibft/fwparam_sysfs.c |  8 ++++++++
786c6d
 6 files changed, 34 insertions(+), 1 deletion(-)
6c64be
6c64be
diff --git a/include/fw_context.h b/include/fw_context.h
6c64be
index 1640859..6563d68 100644
6c64be
--- a/include/fw_context.h
6c64be
+++ b/include/fw_context.h
6c64be
@@ -30,6 +30,9 @@
6c64be
 
6c64be
 struct boot_context {
6c64be
 	struct list_head list;
6c64be
+	char boot_root[BOOT_NAME_MAXLEN];
6c64be
+	char boot_nic[BOOT_NAME_MAXLEN];
6c64be
+	char boot_target[BOOT_NAME_MAXLEN];
6c64be
 
6c64be
 	/* target settings */
6c64be
 	int target_port;
6c64be
diff --git a/include/iscsi_proto.h b/include/iscsi_proto.h
6c64be
index 1c69feb..56f757b 100644
6c64be
--- a/include/iscsi_proto.h
6c64be
+++ b/include/iscsi_proto.h
6c64be
@@ -619,6 +619,7 @@ struct iscsi_reject {
6c64be
 #define KEY_MAXLEN		64
6c64be
 #define VALUE_MAXLEN		255
6c64be
 #define TARGET_NAME_MAXLEN	VALUE_MAXLEN
6c64be
+#define BOOT_NAME_MAXLEN	256
6c64be
 
6c64be
 #define ISCSI_DEF_MAX_RECV_SEG_LEN		8192
6c64be
 #define ISCSI_MIN_MAX_RECV_SEG_LEN		512
6c64be
diff --git a/usr/config.h b/usr/config.h
6c64be
index 998caff..d457bdd 100644
6c64be
--- a/usr/config.h
6c64be
+++ b/usr/config.h
6c64be
@@ -201,6 +201,9 @@ typedef struct session_rec {
6c64be
 	 * allowed to be initiated on this record
6c64be
 	 */
6c64be
 	unsigned char                           multiple;
6c64be
+	char					boot_root[BOOT_NAME_MAXLEN];
6c64be
+	char					boot_nic[BOOT_NAME_MAXLEN];
6c64be
+	char					boot_target[BOOT_NAME_MAXLEN];
6c64be
 } session_rec_t;
6c64be
 
6c64be
 #define ISCSI_TRANSPORT_NAME_MAXLEN 16
6c64be
diff --git a/usr/idbm.c b/usr/idbm.c
6c64be
index bc06058..1e4f8c8 100644
6c64be
--- a/usr/idbm.c
6c64be
+++ b/usr/idbm.c
6c64be
@@ -2748,6 +2748,12 @@ struct node_rec *idbm_create_rec_from_boot_context(struct boot_context *context)
6c64be
 				strlen((char *)context->chap_password);
6c64be
 	rec->session.auth.password_in_length =
6c64be
 				strlen((char *)context->chap_password_in);
6c64be
+	strlcpy(rec->session.boot_root, context->boot_root,
6c64be
+		sizeof(context->boot_root));
6c64be
+	strlcpy(rec->session.boot_nic, context->boot_nic,
6c64be
+		sizeof(context->boot_nic));
6c64be
+	strlcpy(rec->session.boot_target, context->boot_target,
6c64be
+		sizeof(context->boot_target));
6c64be
 
6c64be
 	iface_setup_from_boot_context(&rec->iface, context);
6c64be
 
6c64be
diff --git a/usr/initiator_common.c b/usr/initiator_common.c
786c6d
index 0fb7edc..e2e87a1 100644
6c64be
--- a/usr/initiator_common.c
6c64be
+++ b/usr/initiator_common.c
786c6d
@@ -345,7 +345,7 @@ void iscsi_session_init_params(struct iscsi_session *session)
786c6d
 	}
6c64be
 }
6c64be
 
6c64be
-#define MAX_SESSION_PARAMS 32
6c64be
+#define MAX_SESSION_PARAMS 35
6c64be
 
6c64be
 int iscsi_session_set_params(struct iscsi_conn *conn)
6c64be
 {
786c6d
@@ -516,6 +516,18 @@ int iscsi_session_set_params(struct iscsi_conn *conn)
6c64be
 			.param = ISCSI_PARAM_INITIATOR_NAME,
6c64be
 			.value = session->initiator_name,
6c64be
 			.type = ISCSI_STRING,
6c64be
+		}, {
6c64be
+			.param = ISCSI_PARAM_BOOT_ROOT,
6c64be
+			.value = session->nrec.session.boot_root,
6c64be
+			.type = ISCSI_STRING,
6c64be
+		}, {
6c64be
+			.param = ISCSI_PARAM_BOOT_NIC,
6c64be
+			.value = session->nrec.session.boot_nic,
6c64be
+			.type = ISCSI_STRING,
6c64be
+		}, {
6c64be
+			.param = ISCSI_PARAM_BOOT_TARGET,
6c64be
+			.value = session->nrec.session.boot_target,
6c64be
+			.type = ISCSI_STRING,
6c64be
 		},
6c64be
 	};
6c64be
 
6c64be
diff --git a/utils/fwparam_ibft/fwparam_sysfs.c b/utils/fwparam_ibft/fwparam_sysfs.c
6c64be
index 3997363..2f37b59 100644
6c64be
--- a/utils/fwparam_ibft/fwparam_sysfs.c
6c64be
+++ b/utils/fwparam_ibft/fwparam_sysfs.c
6c64be
@@ -200,6 +200,9 @@ static int fill_nic_context(char *subsys, char *id,
6c64be
 		strlcpy(context->scsi_host_name, subsys,
6c64be
 			sizeof(context->scsi_host_name));
6c64be
 
6c64be
+	memset(&context->boot_nic, 0, sizeof(context->boot_nic));
6c64be
+	snprintf(context->boot_nic, sizeof(context->boot_nic), "%s", id);
6c64be
+
6c64be
 	sysfs_get_str(id, subsys, "ip-addr", context->ipaddr,
6c64be
 		      sizeof(context->ipaddr));
6c64be
 	sysfs_get_str(id, subsys, "vlan", context->vlan,
6c64be
@@ -224,6 +227,8 @@ static void fill_initiator_context(char *subsys, struct boot_context *context)
6c64be
 		      sizeof(context->initiatorname));
6c64be
 	sysfs_get_str("initiator", subsys, "isid", context->isid,
6c64be
 		      sizeof(context->isid));
6c64be
+
6c64be
+	strlcpy(context->boot_root, subsys, sizeof(context->boot_root));
6c64be
 }
6c64be
 static int fill_tgt_context(char *subsys, char *id,
6c64be
 			    struct boot_context *context)
6c64be
@@ -240,6 +245,9 @@ static int fill_tgt_context(char *subsys, char *id,
6c64be
 	if (rc)
6c64be
 		return rc;
6c64be
 
6c64be
+	memset(&context->boot_target, 0, sizeof(context->boot_target));
6c64be
+	snprintf(context->boot_target, sizeof(context->boot_target), "%s", id);
6c64be
+
6c64be
 	/*
6c64be
 	 * We can live without the rest of they do not exist. If we
6c64be
 	 * failed to get them we will figure it out when we login.
6c64be
-- 
786c6d
1.8.3.1
6c64be