diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2007-05-30 13:57:13 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.(none)> | 2007-06-01 12:56:40 -0400 |
commit | 8ad5781ae9702a8f95cfdf30967752e4297613ee (patch) | |
tree | caafde966ac7e9cda0e27e3b5412f25021d2d561 | |
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>
-rw-r--r-- | drivers/infiniband/ulp/iser/iscsi_iser.c | 3 | ||||
-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 | ||||
-rw-r--r-- | include/scsi/iscsi_if.h | 2 | ||||
-rw-r--r-- | include/scsi/libiscsi.h | 1 |
7 files changed, 27 insertions, 4 deletions
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index 2a99b7b6c906..e39d9a07bc5d 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c | |||
@@ -576,7 +576,8 @@ static struct iscsi_transport iscsi_iser_transport = { | |||
576 | ISCSI_PERSISTENT_ADDRESS | | 576 | ISCSI_PERSISTENT_ADDRESS | |
577 | ISCSI_TARGET_NAME | | 577 | ISCSI_TARGET_NAME | |
578 | ISCSI_TPGT, | 578 | ISCSI_TPGT, |
579 | .host_param_mask = ISCSI_HOST_HWADDRESS, | 579 | .host_param_mask = ISCSI_HOST_HWADDRESS | |
580 | ISCSI_HOST_INITIATOR_NAME, | ||
580 | .host_template = &iscsi_iser_sht, | 581 | .host_template = &iscsi_iser_sht, |
581 | .conndata_size = sizeof(struct iscsi_conn), | 582 | .conndata_size = sizeof(struct iscsi_conn), |
582 | .max_lun = ISCSI_ISER_MAX_LUN, | 583 | .max_lun = ISCSI_ISER_MAX_LUN, |
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 9a42fc074b76..8201e6c4d8a9 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c | |||
@@ -2181,7 +2181,8 @@ static struct iscsi_transport iscsi_tcp_transport = { | |||
2181 | ISCSI_PERSISTENT_ADDRESS | | 2181 | ISCSI_PERSISTENT_ADDRESS | |
2182 | ISCSI_TARGET_NAME | | 2182 | ISCSI_TARGET_NAME | |
2183 | ISCSI_TPGT, | 2183 | ISCSI_TPGT, |
2184 | .host_param_mask = ISCSI_HOST_HWADDRESS, | 2184 | .host_param_mask = ISCSI_HOST_HWADDRESS | |
2185 | ISCSI_HOST_INITIATOR_NAME, | ||
2185 | .host_template = &iscsi_sht, | 2186 | .host_template = &iscsi_sht, |
2186 | .conndata_size = sizeof(struct iscsi_conn), | 2187 | .conndata_size = sizeof(struct iscsi_conn), |
2187 | .max_conn = 1, | 2188 | .max_conn = 1, |
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index d430e227e9b7..5e6a42429c39 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) | |||
1463 | 1463 | ||
1464 | kfree(session->targetname); | 1464 | kfree(session->targetname); |
1465 | kfree(session->hwaddress); | 1465 | kfree(session->hwaddress); |
1466 | kfree(session->initiatorname); | ||
1466 | 1467 | ||
1467 | iscsi_destroy_session(cls_session); | 1468 | iscsi_destroy_session(cls_session); |
1468 | scsi_host_put(shost); | 1469 | scsi_host_put(shost); |
@@ -2004,6 +2005,13 @@ int iscsi_host_get_param(struct Scsi_Host *shost, enum iscsi_host_param param, | |||
2004 | else | 2005 | else |
2005 | len = sprintf(buf, "%s\n", session->hwaddress); | 2006 | len = sprintf(buf, "%s\n", session->hwaddress); |
2006 | break; | 2007 | break; |
2008 | case ISCSI_HOST_PARAM_INITIATOR_NAME: | ||
2009 | if (!session->initiatorname) | ||
2010 | len = sprintf(buf, "%s\n", "unknown"); | ||
2011 | else | ||
2012 | len = sprintf(buf, "%s\n", session->initiatorname); | ||
2013 | break; | ||
2014 | |||
2007 | default: | 2015 | default: |
2008 | return -ENOSYS; | 2016 | return -ENOSYS; |
2009 | } | 2017 | } |
@@ -2022,6 +2030,10 @@ int iscsi_host_set_param(struct Scsi_Host *shost, enum iscsi_host_param param, | |||
2022 | if (!session->hwaddress) | 2030 | if (!session->hwaddress) |
2023 | session->hwaddress = kstrdup(buf, GFP_KERNEL); | 2031 | session->hwaddress = kstrdup(buf, GFP_KERNEL); |
2024 | break; | 2032 | break; |
2033 | case ISCSI_HOST_PARAM_INITIATOR_NAME: | ||
2034 | if (!session->initiatorname) | ||
2035 | session->initiatorname = kstrdup(buf, GFP_KERNEL); | ||
2036 | break; | ||
2025 | default: | 2037 | default: |
2026 | return -ENOSYS; | 2038 | return -ENOSYS; |
2027 | } | 2039 | } |
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 29cd4b90ebed..7502bb4808d6 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 = { | |||
104 | .name = DRIVER_NAME, | 104 | .name = DRIVER_NAME, |
105 | .param_mask = ISCSI_CONN_PORT | ISCSI_CONN_ADDRESS | | 105 | .param_mask = ISCSI_CONN_PORT | ISCSI_CONN_ADDRESS | |
106 | ISCSI_TARGET_NAME | ISCSI_TPGT, | 106 | ISCSI_TARGET_NAME | ISCSI_TPGT, |
107 | .host_param_mask = ISCSI_HOST_HWADDRESS, | 107 | .host_param_mask = ISCSI_HOST_HWADDRESS | |
108 | ISCSI_HOST_INITIATOR_NAME, | ||
108 | .sessiondata_size = sizeof(struct ddb_entry), | 109 | .sessiondata_size = sizeof(struct ddb_entry), |
109 | .host_template = &qla4xxx_driver_template, | 110 | .host_template = &qla4xxx_driver_template, |
110 | 111 | ||
@@ -190,6 +191,9 @@ static int qla4xxx_host_get_param(struct Scsi_Host *shost, | |||
190 | case ISCSI_HOST_PARAM_HWADDRESS: | 191 | case ISCSI_HOST_PARAM_HWADDRESS: |
191 | len = format_addr(buf, ha->my_mac, MAC_ADDR_LEN); | 192 | len = format_addr(buf, ha->my_mac, MAC_ADDR_LEN); |
192 | break; | 193 | break; |
194 | case ISCSI_HOST_PARAM_INITIATOR_NAME: | ||
195 | len = sprintf(buf, ha->name_string); | ||
196 | break; | ||
193 | default: | 197 | default: |
194 | return -ENOSYS; | 198 | return -ENOSYS; |
195 | } | 199 | } |
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 3fd2da451fe1..5ec2fbea8937 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c | |||
@@ -32,7 +32,7 @@ | |||
32 | 32 | ||
33 | #define ISCSI_SESSION_ATTRS 11 | 33 | #define ISCSI_SESSION_ATTRS 11 |
34 | #define ISCSI_CONN_ATTRS 11 | 34 | #define ISCSI_CONN_ATTRS 11 |
35 | #define ISCSI_HOST_ATTRS 1 | 35 | #define ISCSI_HOST_ATTRS 2 |
36 | #define ISCSI_TRANSPORT_VERSION "2.0-724" | 36 | #define ISCSI_TRANSPORT_VERSION "2.0-724" |
37 | 37 | ||
38 | struct iscsi_internal { | 38 | struct iscsi_internal { |
@@ -1253,6 +1253,7 @@ static ISCSI_CLASS_ATTR(host, field, S_IRUGO, show_host_param_##param, \ | |||
1253 | NULL); | 1253 | NULL); |
1254 | 1254 | ||
1255 | iscsi_host_attr(hwaddress, ISCSI_HOST_PARAM_HWADDRESS); | 1255 | iscsi_host_attr(hwaddress, ISCSI_HOST_PARAM_HWADDRESS); |
1256 | iscsi_host_attr(initiatorname, ISCSI_HOST_PARAM_INITIATOR_NAME); | ||
1256 | 1257 | ||
1257 | #define SETUP_PRIV_SESSION_RD_ATTR(field) \ | 1258 | #define SETUP_PRIV_SESSION_RD_ATTR(field) \ |
1258 | do { \ | 1259 | do { \ |
@@ -1389,6 +1390,7 @@ iscsi_register_transport(struct iscsi_transport *tt) | |||
1389 | transport_container_register(&priv->t.host_attrs); | 1390 | transport_container_register(&priv->t.host_attrs); |
1390 | 1391 | ||
1391 | SETUP_HOST_RD_ATTR(hwaddress, ISCSI_HOST_HWADDRESS); | 1392 | SETUP_HOST_RD_ATTR(hwaddress, ISCSI_HOST_HWADDRESS); |
1393 | SETUP_HOST_RD_ATTR(initiatorname, ISCSI_HOST_INITIATOR_NAME); | ||
1392 | BUG_ON(count > ISCSI_HOST_ATTRS); | 1394 | BUG_ON(count > ISCSI_HOST_ATTRS); |
1393 | priv->host_attrs[count] = NULL; | 1395 | priv->host_attrs[count] = NULL; |
1394 | count = 0; | 1396 | count = 0; |
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h index 3d0372e30ca1..e057c5d3703d 100644 --- a/include/scsi/iscsi_if.h +++ b/include/scsi/iscsi_if.h | |||
@@ -259,10 +259,12 @@ enum iscsi_param { | |||
259 | /* iSCSI HBA params */ | 259 | /* iSCSI HBA params */ |
260 | enum iscsi_host_param { | 260 | enum iscsi_host_param { |
261 | ISCSI_HOST_PARAM_HWADDRESS, | 261 | ISCSI_HOST_PARAM_HWADDRESS, |
262 | ISCSI_HOST_PARAM_INITIATOR_NAME, | ||
262 | ISCSI_HOST_PARAM_MAX, | 263 | ISCSI_HOST_PARAM_MAX, |
263 | }; | 264 | }; |
264 | 265 | ||
265 | #define ISCSI_HOST_HWADDRESS (1 << ISCSI_HOST_PARAM_HWADDRESS) | 266 | #define ISCSI_HOST_HWADDRESS (1 << ISCSI_HOST_PARAM_HWADDRESS) |
267 | #define ISCSI_HOST_INITIATOR_NAME (1 << ISCSI_HOST_PARAM_INITIATOR_NAME) | ||
266 | 268 | ||
267 | #define iscsi_ptr(_handle) ((void*)(unsigned long)_handle) | 269 | #define iscsi_ptr(_handle) ((void*)(unsigned long)_handle) |
268 | #define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr) | 270 | #define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr) |
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index e202cc00c8e7..deae90a56a0d 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h | |||
@@ -224,6 +224,7 @@ struct iscsi_session { | |||
224 | int erl; | 224 | int erl; |
225 | int tpgt; | 225 | int tpgt; |
226 | char *targetname; | 226 | char *targetname; |
227 | char *initiatorname; | ||
227 | /* hw address being used for iscsi connection */ | 228 | /* hw address being used for iscsi connection */ |
228 | char *hwaddress; | 229 | char *hwaddress; |
229 | /* control data */ | 230 | /* control data */ |