aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/infiniband/ulp/iser/iscsi_iser.c4
-rw-r--r--drivers/scsi/iscsi_tcp.c4
-rw-r--r--drivers/scsi/libiscsi.c40
-rw-r--r--include/scsi/libiscsi.h13
4 files changed, 60 insertions, 1 deletions
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c
index dd221eda3ea6..2a99b7b6c906 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -576,6 +576,7 @@ 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_template = &iscsi_iser_sht, 580 .host_template = &iscsi_iser_sht,
580 .conndata_size = sizeof(struct iscsi_conn), 581 .conndata_size = sizeof(struct iscsi_conn),
581 .max_lun = ISCSI_ISER_MAX_LUN, 582 .max_lun = ISCSI_ISER_MAX_LUN,
@@ -592,6 +593,9 @@ static struct iscsi_transport iscsi_iser_transport = {
592 .get_session_param = iscsi_session_get_param, 593 .get_session_param = iscsi_session_get_param,
593 .start_conn = iscsi_iser_conn_start, 594 .start_conn = iscsi_iser_conn_start,
594 .stop_conn = iscsi_conn_stop, 595 .stop_conn = iscsi_conn_stop,
596 /* iscsi host params */
597 .get_host_param = iscsi_host_get_param,
598 .set_host_param = iscsi_host_set_param,
595 /* IO */ 599 /* IO */
596 .send_pdu = iscsi_conn_send_pdu, 600 .send_pdu = iscsi_conn_send_pdu,
597 .get_stats = iscsi_iser_conn_get_stats, 601 .get_stats = iscsi_iser_conn_get_stats,
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index c9a3abf9e7b6..9a42fc074b76 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -2181,6 +2181,7 @@ 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_template = &iscsi_sht, 2185 .host_template = &iscsi_sht,
2185 .conndata_size = sizeof(struct iscsi_conn), 2186 .conndata_size = sizeof(struct iscsi_conn),
2186 .max_conn = 1, 2187 .max_conn = 1,
@@ -2197,6 +2198,9 @@ static struct iscsi_transport iscsi_tcp_transport = {
2197 .get_session_param = iscsi_session_get_param, 2198 .get_session_param = iscsi_session_get_param,
2198 .start_conn = iscsi_conn_start, 2199 .start_conn = iscsi_conn_start,
2199 .stop_conn = iscsi_tcp_conn_stop, 2200 .stop_conn = iscsi_tcp_conn_stop,
2201 /* iscsi host params */
2202 .get_host_param = iscsi_host_get_param,
2203 .set_host_param = iscsi_host_set_param,
2200 /* IO */ 2204 /* IO */
2201 .send_pdu = iscsi_conn_send_pdu, 2205 .send_pdu = iscsi_conn_send_pdu,
2202 .get_stats = iscsi_conn_get_stats, 2206 .get_stats = iscsi_conn_get_stats,
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 3f5b9b445b29..d430e227e9b7 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -1462,6 +1462,7 @@ void iscsi_session_teardown(struct iscsi_cls_session *cls_session)
1462 iscsi_pool_free(&session->cmdpool, (void**)session->cmds); 1462 iscsi_pool_free(&session->cmdpool, (void**)session->cmds);
1463 1463
1464 kfree(session->targetname); 1464 kfree(session->targetname);
1465 kfree(session->hwaddress);
1465 1466
1466 iscsi_destroy_session(cls_session); 1467 iscsi_destroy_session(cls_session);
1467 scsi_host_put(shost); 1468 scsi_host_put(shost);
@@ -1990,6 +1991,45 @@ int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn,
1990} 1991}
1991EXPORT_SYMBOL_GPL(iscsi_conn_get_param); 1992EXPORT_SYMBOL_GPL(iscsi_conn_get_param);
1992 1993
1994int iscsi_host_get_param(struct Scsi_Host *shost, enum iscsi_host_param param,
1995 char *buf)
1996{
1997 struct iscsi_session *session = iscsi_hostdata(shost->hostdata);
1998 int len;
1999
2000 switch (param) {
2001 case ISCSI_HOST_PARAM_HWADDRESS:
2002 if (!session->hwaddress)
2003 len = sprintf(buf, "%s\n", "default");
2004 else
2005 len = sprintf(buf, "%s\n", session->hwaddress);
2006 break;
2007 default:
2008 return -ENOSYS;
2009 }
2010
2011 return len;
2012}
2013EXPORT_SYMBOL_GPL(iscsi_host_get_param);
2014
2015int iscsi_host_set_param(struct Scsi_Host *shost, enum iscsi_host_param param,
2016 char *buf, int buflen)
2017{
2018 struct iscsi_session *session = iscsi_hostdata(shost->hostdata);
2019
2020 switch (param) {
2021 case ISCSI_HOST_PARAM_HWADDRESS:
2022 if (!session->hwaddress)
2023 session->hwaddress = kstrdup(buf, GFP_KERNEL);
2024 break;
2025 default:
2026 return -ENOSYS;
2027 }
2028
2029 return 0;
2030}
2031EXPORT_SYMBOL_GPL(iscsi_host_set_param);
2032
1993MODULE_AUTHOR("Mike Christie"); 2033MODULE_AUTHOR("Mike Christie");
1994MODULE_DESCRIPTION("iSCSI library functions"); 2034MODULE_DESCRIPTION("iSCSI library functions");
1995MODULE_LICENSE("GPL"); 2035MODULE_LICENSE("GPL");
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index ea0816d4904d..e202cc00c8e7 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -224,7 +224,8 @@ struct iscsi_session {
224 int erl; 224 int erl;
225 int tpgt; 225 int tpgt;
226 char *targetname; 226 char *targetname;
227 227 /* hw address being used for iscsi connection */
228 char *hwaddress;
228 /* control data */ 229 /* control data */
229 struct iscsi_transport *tt; 230 struct iscsi_transport *tt;
230 struct Scsi_Host *host; 231 struct Scsi_Host *host;
@@ -255,6 +256,16 @@ extern int iscsi_eh_host_reset(struct scsi_cmnd *sc);
255extern int iscsi_queuecommand(struct scsi_cmnd *sc, 256extern int iscsi_queuecommand(struct scsi_cmnd *sc,
256 void (*done)(struct scsi_cmnd *)); 257 void (*done)(struct scsi_cmnd *));
257 258
259
260/*
261 * iSCSI host helpers.
262 */
263extern int iscsi_host_set_param(struct Scsi_Host *shost,
264 enum iscsi_host_param param, char *buf,
265 int buflen);
266extern int iscsi_host_get_param(struct Scsi_Host *shost,
267 enum iscsi_host_param param, char *buf);
268
258/* 269/*
259 * session management 270 * session management
260 */ 271 */