diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2007-05-30 12:57:13 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.(none)> | 2007-06-01 12:56:40 -0400 |
commit | 8ad5781ae9702a8f95cfdf30967752e4297613ee (patch) | |
tree | caafde966ac7e9cda0e27e3b5412f25021d2d561 /drivers/scsi | |
parent | 0801c242a33426fddc005c2f559a3d2fa6fca7eb (diff) |
[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: Mike Christie <michaelc@cs.wisc.edu>
Cc: Roland Dreier <rdreier@cisco.com>
Cc: David C Somayajulu <david.somayajulu@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/iscsi_tcp.c | 3 | ||||
-rw-r--r-- | drivers/scsi/libiscsi.c | 12 | ||||
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_os.c | 6 | ||||
-rw-r--r-- | drivers/scsi/scsi_transport_iscsi.c | 4 |
4 files changed, 22 insertions, 3 deletions
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 9a42fc074b7..8201e6c4d8a 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -2181,7 +2181,8 @@ static struct iscsi_transport iscsi_tcp_transport = { ISCSI_PERSISTENT_ADDRESS | ISCSI_TARGET_NAME | ISCSI_TPGT, - .host_param_mask = ISCSI_HOST_HWADDRESS, + .host_param_mask = ISCSI_HOST_HWADDRESS | + ISCSI_HOST_INITIATOR_NAME, .host_template = &iscsi_sht, .conndata_size = sizeof(struct iscsi_conn), .max_conn = 1, diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index d430e227e9b..5e6a42429c3 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -1463,6 +1463,7 @@ void iscsi_session_teardown(struct iscsi_cls_session *cls_session) kfree(session->targetname); kfree(session->hwaddress); + kfree(session->initiatorname); iscsi_destroy_session(cls_session); scsi_host_put(shost); @@ -2004,6 +2005,13 @@ int iscsi_host_get_param(struct Scsi_Host *shost, enum iscsi_host_param param, else len = sprintf(buf, "%s\n", session->hwaddress); 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: return -ENOSYS; } @@ -2022,6 +2030,10 @@ int iscsi_host_set_param(struct Scsi_Host *shost, enum iscsi_host_param param, if (!session->hwaddress) session->hwaddress = kstrdup(buf, GFP_KERNEL); break; + case ISCSI_HOST_PARAM_INITIATOR_NAME: + if (!session->initiatorname) + session->initiatorname = kstrdup(buf, GFP_KERNEL); + break; default: return -ENOSYS; } diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 29cd4b90ebe..7502bb4808d 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c @@ -104,7 +104,8 @@ static struct iscsi_transport qla4xxx_iscsi_transport = { .name = DRIVER_NAME, .param_mask = ISCSI_CONN_PORT | ISCSI_CONN_ADDRESS | 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), .host_template = &qla4xxx_driver_template, @@ -190,6 +191,9 @@ static int qla4xxx_host_get_param(struct Scsi_Host *shost, case ISCSI_HOST_PARAM_HWADDRESS: len = format_addr(buf, ha->my_mac, MAC_ADDR_LEN); break; + case ISCSI_HOST_PARAM_INITIATOR_NAME: + len = sprintf(buf, ha->name_string); + break; default: return -ENOSYS; } diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 3fd2da451fe..5ec2fbea893 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -32,7 +32,7 @@ #define ISCSI_SESSION_ATTRS 11 #define ISCSI_CONN_ATTRS 11 -#define ISCSI_HOST_ATTRS 1 +#define ISCSI_HOST_ATTRS 2 #define ISCSI_TRANSPORT_VERSION "2.0-724" struct iscsi_internal { @@ -1253,6 +1253,7 @@ static ISCSI_CLASS_ATTR(host, field, S_IRUGO, show_host_param_##param, \ NULL); iscsi_host_attr(hwaddress, ISCSI_HOST_PARAM_HWADDRESS); +iscsi_host_attr(initiatorname, ISCSI_HOST_PARAM_INITIATOR_NAME); #define SETUP_PRIV_SESSION_RD_ATTR(field) \ do { \ @@ -1389,6 +1390,7 @@ iscsi_register_transport(struct iscsi_transport *tt) transport_container_register(&priv->t.host_attrs); SETUP_HOST_RD_ATTR(hwaddress, ISCSI_HOST_HWADDRESS); + SETUP_HOST_RD_ATTR(initiatorname, ISCSI_HOST_INITIATOR_NAME); BUG_ON(count > ISCSI_HOST_ATTRS); priv->host_attrs[count] = NULL; count = 0; |