aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/infiniband/ulp/iser/iscsi_iser.c1
-rw-r--r--drivers/scsi/iscsi_tcp.c5
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c46
-rw-r--r--include/scsi/iscsi_if.h7
-rw-r--r--include/scsi/libiscsi.h1
-rw-r--r--include/scsi/scsi_transport_iscsi.h4
6 files changed, 51 insertions, 13 deletions
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c
index aeb58cae9a3f..efc121986c50 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -368,6 +368,7 @@ static struct iscsi_transport iscsi_iser_transport;
368static struct iscsi_cls_session * 368static struct iscsi_cls_session *
369iscsi_iser_session_create(struct iscsi_transport *iscsit, 369iscsi_iser_session_create(struct iscsi_transport *iscsit,
370 struct scsi_transport_template *scsit, 370 struct scsi_transport_template *scsit,
371 struct Scsi_Host *shost,
371 uint16_t cmds_max, uint16_t qdepth, 372 uint16_t cmds_max, uint16_t qdepth,
372 uint32_t initial_cmdsn, uint32_t *hostno) 373 uint32_t initial_cmdsn, uint32_t *hostno)
373{ 374{
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 72b9b2a0eba3..81c421a7d477 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -1871,8 +1871,9 @@ iscsi_conn_get_stats(struct iscsi_cls_conn *cls_conn, struct iscsi_stats *stats)
1871static struct iscsi_cls_session * 1871static struct iscsi_cls_session *
1872iscsi_tcp_session_create(struct iscsi_transport *iscsit, 1872iscsi_tcp_session_create(struct iscsi_transport *iscsit,
1873 struct scsi_transport_template *scsit, 1873 struct scsi_transport_template *scsit,
1874 uint16_t cmds_max, uint16_t qdepth, 1874 struct Scsi_Host *shost, uint16_t cmds_max,
1875 uint32_t initial_cmdsn, uint32_t *hostno) 1875 uint16_t qdepth, uint32_t initial_cmdsn,
1876 uint32_t *hostno)
1876{ 1877{
1877 struct iscsi_cls_session *cls_session; 1878 struct iscsi_cls_session *cls_session;
1878 struct iscsi_session *session; 1879 struct iscsi_session *session;
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 65d1737eb664..2a6669d967cb 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -1017,21 +1017,38 @@ int iscsi_session_event(struct iscsi_cls_session *session,
1017EXPORT_SYMBOL_GPL(iscsi_session_event); 1017EXPORT_SYMBOL_GPL(iscsi_session_event);
1018 1018
1019static int 1019static int
1020iscsi_if_create_session(struct iscsi_internal *priv, struct iscsi_uevent *ev) 1020iscsi_if_create_session(struct iscsi_internal *priv, struct iscsi_uevent *ev,
1021 uint32_t host_no, uint32_t initial_cmdsn,
1022 uint16_t cmds_max, uint16_t queue_depth)
1021{ 1023{
1022 struct iscsi_transport *transport = priv->iscsi_transport; 1024 struct iscsi_transport *transport = priv->iscsi_transport;
1023 struct iscsi_cls_session *session; 1025 struct iscsi_cls_session *session;
1024 uint32_t hostno; 1026 struct Scsi_Host *shost = NULL;
1025 1027
1026 session = transport->create_session(transport, &priv->t, 1028 /*
1027 ev->u.c_session.cmds_max, 1029 * Software iscsi allocates a host per session, but
1028 ev->u.c_session.queue_depth, 1030 * offload drivers (and possibly iser one day) allocate a host per
1029 ev->u.c_session.initial_cmdsn, 1031 * hba/nic/rnic. Offload will match a host here, but software will
1030 &hostno); 1032 * return a new hostno after the create_session callback has returned.
1033 */
1034 if (host_no != UINT_MAX) {
1035 shost = scsi_host_lookup(host_no);
1036 if (IS_ERR(shost)) {
1037 printk(KERN_ERR "Could not find host no %u to "
1038 "create session\n", host_no);
1039 return -ENODEV;
1040 }
1041 }
1042
1043 session = transport->create_session(transport, &priv->t, shost,
1044 cmds_max, queue_depth,
1045 initial_cmdsn, &host_no);
1046 if (shost)
1047 scsi_host_put(shost);
1031 if (!session) 1048 if (!session)
1032 return -ENOMEM; 1049 return -ENOMEM;
1033 1050
1034 ev->r.c_session_ret.host_no = hostno; 1051 ev->r.c_session_ret.host_no = host_no;
1035 ev->r.c_session_ret.sid = session->sid; 1052 ev->r.c_session_ret.sid = session->sid;
1036 return 0; 1053 return 0;
1037} 1054}
@@ -1190,6 +1207,7 @@ static int
1190iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) 1207iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
1191{ 1208{
1192 int err = 0; 1209 int err = 0;
1210 uint32_t host_no = UINT_MAX;
1193 struct iscsi_uevent *ev = NLMSG_DATA(nlh); 1211 struct iscsi_uevent *ev = NLMSG_DATA(nlh);
1194 struct iscsi_transport *transport = NULL; 1212 struct iscsi_transport *transport = NULL;
1195 struct iscsi_internal *priv; 1213 struct iscsi_internal *priv;
@@ -1208,7 +1226,17 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
1208 1226
1209 switch (nlh->nlmsg_type) { 1227 switch (nlh->nlmsg_type) {
1210 case ISCSI_UEVENT_CREATE_SESSION: 1228 case ISCSI_UEVENT_CREATE_SESSION:
1211 err = iscsi_if_create_session(priv, ev); 1229 err = iscsi_if_create_session(priv, ev, host_no,
1230 ev->u.c_session.initial_cmdsn,
1231 ev->u.c_session.cmds_max,
1232 ev->u.c_session.queue_depth);
1233 break;
1234 case ISCSI_UEVENT_CREATE_BOUND_SESSION:
1235 err = iscsi_if_create_session(priv, ev,
1236 ev->u.c_bound_session.host_no,
1237 ev->u.c_bound_session.initial_cmdsn,
1238 ev->u.c_bound_session.cmds_max,
1239 ev->u.c_bound_session.queue_depth);
1212 break; 1240 break;
1213 case ISCSI_UEVENT_DESTROY_SESSION: 1241 case ISCSI_UEVENT_DESTROY_SESSION:
1214 session = iscsi_session_lookup(ev->u.d_session.sid); 1242 session = iscsi_session_lookup(ev->u.d_session.sid);
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index e19e58423166..1883c85cd3ee 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -50,6 +50,7 @@ enum iscsi_uevent_e {
50 ISCSI_UEVENT_TGT_DSCVR = UEVENT_BASE + 15, 50 ISCSI_UEVENT_TGT_DSCVR = UEVENT_BASE + 15,
51 ISCSI_UEVENT_SET_HOST_PARAM = UEVENT_BASE + 16, 51 ISCSI_UEVENT_SET_HOST_PARAM = UEVENT_BASE + 16,
52 ISCSI_UEVENT_UNBIND_SESSION = UEVENT_BASE + 17, 52 ISCSI_UEVENT_UNBIND_SESSION = UEVENT_BASE + 17,
53 ISCSI_UEVENT_CREATE_BOUND_SESSION = UEVENT_BASE + 18,
53 54
54 /* up events */ 55 /* up events */
55 ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1, 56 ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1,
@@ -78,6 +79,12 @@ struct iscsi_uevent {
78 uint16_t cmds_max; 79 uint16_t cmds_max;
79 uint16_t queue_depth; 80 uint16_t queue_depth;
80 } c_session; 81 } c_session;
82 struct msg_create_bound_session {
83 uint32_t host_no;
84 uint32_t initial_cmdsn;
85 uint16_t cmds_max;
86 uint16_t queue_depth;
87 } c_bound_session;
81 struct msg_destroy_session { 88 struct msg_destroy_session {
82 uint32_t sid; 89 uint32_t sid;
83 } d_session; 90 } d_session;
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index cd3ca63d4fb1..f24cf0246739 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -24,6 +24,7 @@
24#define LIBISCSI_H 24#define LIBISCSI_H
25 25
26#include <linux/types.h> 26#include <linux/types.h>
27#include <linux/wait.h>
27#include <linux/mutex.h> 28#include <linux/mutex.h>
28#include <linux/timer.h> 29#include <linux/timer.h>
29#include <linux/workqueue.h> 30#include <linux/workqueue.h>
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index aab1eae2ec4c..02a852000be7 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -92,8 +92,8 @@ struct iscsi_transport {
92 unsigned int max_conn; 92 unsigned int max_conn;
93 unsigned int max_cmd_len; 93 unsigned int max_cmd_len;
94 struct iscsi_cls_session *(*create_session) (struct iscsi_transport *it, 94 struct iscsi_cls_session *(*create_session) (struct iscsi_transport *it,
95 struct scsi_transport_template *t, uint16_t, uint16_t, 95 struct scsi_transport_template *t, struct Scsi_Host *shost,
96 uint32_t sn, uint32_t *hn); 96 uint16_t cmds_max, uint16_t qdepth, uint32_t sn, uint32_t *hn);
97 void (*destroy_session) (struct iscsi_cls_session *session); 97 void (*destroy_session) (struct iscsi_cls_session *session);
98 struct iscsi_cls_conn *(*create_conn) (struct iscsi_cls_session *sess, 98 struct iscsi_cls_conn *(*create_conn) (struct iscsi_cls_session *sess,
99 uint32_t cid); 99 uint32_t cid);