Commit 8ad5781a authored by Mike Christie's avatar Mike Christie Committed by James Bottomley

[SCSI] iscsi class, qla4xxx, iscsi_tcp, ib_iser: export/set initiator name

For iscsi root boot, software iscsi needs to know what the BIOS/OF
initiator used for the initiator name so this puts it in sysfs
for userspace to be able to pick up.

For hw iscsi, it is nice to see what the card is using.

This patch adds the new param, and hooks in qla4xxx, iscsi_tcp, and ib_iser.
Signed-off-by: default avatarMike Christie <michaelc@cs.wisc.edu>
Cc: Roland Dreier <rdreier@cisco.com>
Cc: David C Somayajulu <david.somayajulu@qlogic.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 0801c242
...@@ -576,7 +576,8 @@ static struct iscsi_transport iscsi_iser_transport = { ...@@ -576,7 +576,8 @@ static struct iscsi_transport iscsi_iser_transport = {
ISCSI_PERSISTENT_ADDRESS | ISCSI_PERSISTENT_ADDRESS |
ISCSI_TARGET_NAME | ISCSI_TARGET_NAME |
ISCSI_TPGT, ISCSI_TPGT,
.host_param_mask = ISCSI_HOST_HWADDRESS, .host_param_mask = ISCSI_HOST_HWADDRESS |
ISCSI_HOST_INITIATOR_NAME,
.host_template = &iscsi_iser_sht, .host_template = &iscsi_iser_sht,
.conndata_size = sizeof(struct iscsi_conn), .conndata_size = sizeof(struct iscsi_conn),
.max_lun = ISCSI_ISER_MAX_LUN, .max_lun = ISCSI_ISER_MAX_LUN,
......
...@@ -2181,7 +2181,8 @@ static struct iscsi_transport iscsi_tcp_transport = { ...@@ -2181,7 +2181,8 @@ static struct iscsi_transport iscsi_tcp_transport = {
ISCSI_PERSISTENT_ADDRESS | ISCSI_PERSISTENT_ADDRESS |
ISCSI_TARGET_NAME | ISCSI_TARGET_NAME |
ISCSI_TPGT, ISCSI_TPGT,
.host_param_mask = ISCSI_HOST_HWADDRESS, .host_param_mask = ISCSI_HOST_HWADDRESS |
ISCSI_HOST_INITIATOR_NAME,
.host_template = &iscsi_sht, .host_template = &iscsi_sht,
.conndata_size = sizeof(struct iscsi_conn), .conndata_size = sizeof(struct iscsi_conn),
.max_conn = 1, .max_conn = 1,
......
...@@ -1463,6 +1463,7 @@ void iscsi_session_teardown(struct iscsi_cls_session *cls_session) ...@@ -1463,6 +1463,7 @@ void iscsi_session_teardown(struct iscsi_cls_session *cls_session)
kfree(session->targetname); kfree(session->targetname);
kfree(session->hwaddress); kfree(session->hwaddress);
kfree(session->initiatorname);
iscsi_destroy_session(cls_session); iscsi_destroy_session(cls_session);
scsi_host_put(shost); scsi_host_put(shost);
...@@ -2004,6 +2005,13 @@ int iscsi_host_get_param(struct Scsi_Host *shost, enum iscsi_host_param param, ...@@ -2004,6 +2005,13 @@ int iscsi_host_get_param(struct Scsi_Host *shost, enum iscsi_host_param param,
else else
len = sprintf(buf, "%s\n", session->hwaddress); len = sprintf(buf, "%s\n", session->hwaddress);
break; break;
case ISCSI_HOST_PARAM_INITIATOR_NAME:
if (!session->initiatorname)
len = sprintf(buf, "%s\n", "unknown");
else
len = sprintf(buf, "%s\n", session->initiatorname);
break;
default: default:
return -ENOSYS; return -ENOSYS;
} }
...@@ -2022,6 +2030,10 @@ int iscsi_host_set_param(struct Scsi_Host *shost, enum iscsi_host_param param, ...@@ -2022,6 +2030,10 @@ int iscsi_host_set_param(struct Scsi_Host *shost, enum iscsi_host_param param,
if (!session->hwaddress) if (!session->hwaddress)
session->hwaddress = kstrdup(buf, GFP_KERNEL); session->hwaddress = kstrdup(buf, GFP_KERNEL);
break; break;
case ISCSI_HOST_PARAM_INITIATOR_NAME:
if (!session->initiatorname)
session->initiatorname = kstrdup(buf, GFP_KERNEL);
break;
default: default:
return -ENOSYS; return -ENOSYS;
} }
......
...@@ -104,7 +104,8 @@ static struct iscsi_transport qla4xxx_iscsi_transport = { ...@@ -104,7 +104,8 @@ static struct iscsi_transport qla4xxx_iscsi_transport = {
.name = DRIVER_NAME, .name = DRIVER_NAME,
.param_mask = ISCSI_CONN_PORT | ISCSI_CONN_ADDRESS | .param_mask = ISCSI_CONN_PORT | ISCSI_CONN_ADDRESS |
ISCSI_TARGET_NAME | ISCSI_TPGT, ISCSI_TARGET_NAME | ISCSI_TPGT,
.host_param_mask = ISCSI_HOST_HWADDRESS, .host_param_mask = ISCSI_HOST_HWADDRESS |
ISCSI_HOST_INITIATOR_NAME,
.sessiondata_size = sizeof(struct ddb_entry), .sessiondata_size = sizeof(struct ddb_entry),
.host_template = &qla4xxx_driver_template, .host_template = &qla4xxx_driver_template,
...@@ -190,6 +191,9 @@ static int qla4xxx_host_get_param(struct Scsi_Host *shost, ...@@ -190,6 +191,9 @@ static int qla4xxx_host_get_param(struct Scsi_Host *shost,
case ISCSI_HOST_PARAM_HWADDRESS: case ISCSI_HOST_PARAM_HWADDRESS:
len = format_addr(buf, ha->my_mac, MAC_ADDR_LEN); len = format_addr(buf, ha->my_mac, MAC_ADDR_LEN);
break; break;
case ISCSI_HOST_PARAM_INITIATOR_NAME:
len = sprintf(buf, ha->name_string);
break;
default: default:
return -ENOSYS; return -ENOSYS;
} }
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#define ISCSI_SESSION_ATTRS 11 #define ISCSI_SESSION_ATTRS 11
#define ISCSI_CONN_ATTRS 11 #define ISCSI_CONN_ATTRS 11
#define ISCSI_HOST_ATTRS 1 #define ISCSI_HOST_ATTRS 2
#define ISCSI_TRANSPORT_VERSION "2.0-724" #define ISCSI_TRANSPORT_VERSION "2.0-724"
struct iscsi_internal { struct iscsi_internal {
...@@ -1253,6 +1253,7 @@ static ISCSI_CLASS_ATTR(host, field, S_IRUGO, show_host_param_##param, \ ...@@ -1253,6 +1253,7 @@ static ISCSI_CLASS_ATTR(host, field, S_IRUGO, show_host_param_##param, \
NULL); NULL);
iscsi_host_attr(hwaddress, ISCSI_HOST_PARAM_HWADDRESS); iscsi_host_attr(hwaddress, ISCSI_HOST_PARAM_HWADDRESS);
iscsi_host_attr(initiatorname, ISCSI_HOST_PARAM_INITIATOR_NAME);
#define SETUP_PRIV_SESSION_RD_ATTR(field) \ #define SETUP_PRIV_SESSION_RD_ATTR(field) \
do { \ do { \
...@@ -1389,6 +1390,7 @@ iscsi_register_transport(struct iscsi_transport *tt) ...@@ -1389,6 +1390,7 @@ iscsi_register_transport(struct iscsi_transport *tt)
transport_container_register(&priv->t.host_attrs); transport_container_register(&priv->t.host_attrs);
SETUP_HOST_RD_ATTR(hwaddress, ISCSI_HOST_HWADDRESS); SETUP_HOST_RD_ATTR(hwaddress, ISCSI_HOST_HWADDRESS);
SETUP_HOST_RD_ATTR(initiatorname, ISCSI_HOST_INITIATOR_NAME);
BUG_ON(count > ISCSI_HOST_ATTRS); BUG_ON(count > ISCSI_HOST_ATTRS);
priv->host_attrs[count] = NULL; priv->host_attrs[count] = NULL;
count = 0; count = 0;
......
...@@ -259,10 +259,12 @@ enum iscsi_param { ...@@ -259,10 +259,12 @@ enum iscsi_param {
/* iSCSI HBA params */ /* iSCSI HBA params */
enum iscsi_host_param { enum iscsi_host_param {
ISCSI_HOST_PARAM_HWADDRESS, ISCSI_HOST_PARAM_HWADDRESS,
ISCSI_HOST_PARAM_INITIATOR_NAME,
ISCSI_HOST_PARAM_MAX, ISCSI_HOST_PARAM_MAX,
}; };
#define ISCSI_HOST_HWADDRESS (1 << ISCSI_HOST_PARAM_HWADDRESS) #define ISCSI_HOST_HWADDRESS (1 << ISCSI_HOST_PARAM_HWADDRESS)
#define ISCSI_HOST_INITIATOR_NAME (1 << ISCSI_HOST_PARAM_INITIATOR_NAME)
#define iscsi_ptr(_handle) ((void*)(unsigned long)_handle) #define iscsi_ptr(_handle) ((void*)(unsigned long)_handle)
#define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr) #define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr)
......
...@@ -224,6 +224,7 @@ struct iscsi_session { ...@@ -224,6 +224,7 @@ struct iscsi_session {
int erl; int erl;
int tpgt; int tpgt;
char *targetname; char *targetname;
char *initiatorname;
/* hw address being used for iscsi connection */ /* hw address being used for iscsi connection */
char *hwaddress; char *hwaddress;
/* control data */ /* control data */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment