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