diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2008-05-21 16:53:56 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-07-12 09:22:15 -0400 |
commit | 40753caa364bfba60ebd5e2a8bdf366ef175d03c (patch) | |
tree | ed43045b841521eb9c9fedc08d603df89a77cf6f /drivers | |
parent | d54d48b80fb523ce1b1a644e4876b08835ad757f (diff) |
[SCSI] iscsi class, iscsi_tcp/iser: add host arg to session creation
iscsi offload (bnx2i and qla4xx) allocate a scsi host per hba,
so the session creation path needs a shost/host_no argument.
Software iscsi/iser will follow the same behabior as before
where it allcoates a host per session, but in the future iser
will probably look more like bnx2i where the host's parent is
the hardware (rnic for iser and for bnx2i it is the nic), because
it does not use a socket layer like how iscsi_tcp does.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/infiniband/ulp/iser/iscsi_iser.c | 1 | ||||
-rw-r--r-- | drivers/scsi/iscsi_tcp.c | 5 | ||||
-rw-r--r-- | drivers/scsi/scsi_transport_iscsi.c | 46 |
3 files changed, 41 insertions, 11 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; | |||
368 | static struct iscsi_cls_session * | 368 | static struct iscsi_cls_session * |
369 | iscsi_iser_session_create(struct iscsi_transport *iscsit, | 369 | iscsi_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) | |||
1871 | static struct iscsi_cls_session * | 1871 | static struct iscsi_cls_session * |
1872 | iscsi_tcp_session_create(struct iscsi_transport *iscsit, | 1872 | iscsi_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, | |||
1017 | EXPORT_SYMBOL_GPL(iscsi_session_event); | 1017 | EXPORT_SYMBOL_GPL(iscsi_session_event); |
1018 | 1018 | ||
1019 | static int | 1019 | static int |
1020 | iscsi_if_create_session(struct iscsi_internal *priv, struct iscsi_uevent *ev) | 1020 | iscsi_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 | |||
1190 | iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | 1207 | iscsi_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); |