Commit b5c7a12d authored by Mike Christie's avatar Mike Christie Committed by James Bottomley

[SCSI] iscsi: rm kernel iscsi handles usage for session and connection

from hare@suse.de and michaelc@cs.wisc.edu

hw iscsi like qla4xxx does not allocate a host per session and
for userspace it is difficult to restart iscsid using the
"iscsi handles" for the session and connection, so this
patch just has the class or userspace allocate the id for
the session and connection.

Note: this breaks userspace and requires users to upgrade to the newest
open-iscsi tools. Sorry about his but open-iscsi is still too new to
say we have a stable user-kernel api and we were not good nough
designers to know that other hw iscsi drivers and iscsid itself would
need such changes. Actually we sorta did but at the time we did not
have the HW available to us so we could only guess.

Luckily, the only tools hooking into the class are the open-iscsi ones
or other tools like iscsitart hook into the open-iscsi engine from
userspace or prgroams like anaconda call our tools so they are not affected.
Signed-off-by: default avatarMike Christie <michaelc@cs.wisc.edu>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 13f7e5ac
...@@ -3254,7 +3254,7 @@ static struct iscsi_transport iscsi_tcp_transport; ...@@ -3254,7 +3254,7 @@ static struct iscsi_transport iscsi_tcp_transport;
static struct iscsi_cls_session * static struct iscsi_cls_session *
iscsi_session_create(struct scsi_transport_template *scsit, iscsi_session_create(struct scsi_transport_template *scsit,
uint32_t initial_cmdsn, uint32_t *sid) uint32_t initial_cmdsn, uint32_t *hostno)
{ {
struct Scsi_Host *shost; struct Scsi_Host *shost;
struct iscsi_session *session; struct iscsi_session *session;
...@@ -3274,7 +3274,8 @@ iscsi_session_create(struct scsi_transport_template *scsit, ...@@ -3274,7 +3274,8 @@ iscsi_session_create(struct scsi_transport_template *scsit,
session->exp_cmdsn = initial_cmdsn + 1; session->exp_cmdsn = initial_cmdsn + 1;
session->max_cmdsn = initial_cmdsn + 1; session->max_cmdsn = initial_cmdsn + 1;
session->max_r2t = 1; session->max_r2t = 1;
*sid = shost->host_no;
*hostno = shost->host_no;
/* initialize SCSI PDU commands pool */ /* initialize SCSI PDU commands pool */
if (iscsi_pool_init(&session->cmdpool, session->cmds_max, if (iscsi_pool_init(&session->cmdpool, session->cmds_max,
......
This diff is collapsed.
...@@ -60,59 +60,68 @@ struct iscsi_uevent { ...@@ -60,59 +60,68 @@ struct iscsi_uevent {
uint32_t initial_cmdsn; uint32_t initial_cmdsn;
} c_session; } c_session;
struct msg_destroy_session { struct msg_destroy_session {
uint64_t session_handle;
uint32_t sid; uint32_t sid;
} d_session; } d_session;
struct msg_create_conn { struct msg_create_conn {
uint64_t session_handle;
uint32_t cid;
uint32_t sid; uint32_t sid;
uint32_t cid;
} c_conn; } c_conn;
struct msg_bind_conn { struct msg_bind_conn {
uint64_t session_handle; uint32_t sid;
uint64_t conn_handle; uint32_t cid;
uint32_t transport_fd; uint32_t transport_fd;
uint32_t is_leading; uint32_t is_leading;
} b_conn; } b_conn;
struct msg_destroy_conn { struct msg_destroy_conn {
uint64_t conn_handle; uint32_t sid;
uint32_t cid; uint32_t cid;
} d_conn; } d_conn;
struct msg_send_pdu { struct msg_send_pdu {
uint32_t sid;
uint32_t cid;
uint32_t hdr_size; uint32_t hdr_size;
uint32_t data_size; uint32_t data_size;
uint64_t conn_handle;
} send_pdu; } send_pdu;
struct msg_set_param { struct msg_set_param {
uint64_t conn_handle; uint32_t sid;
uint32_t cid;
uint32_t param; /* enum iscsi_param */ uint32_t param; /* enum iscsi_param */
uint32_t value; uint32_t value;
} set_param; } set_param;
struct msg_start_conn { struct msg_start_conn {
uint64_t conn_handle; uint32_t sid;
uint32_t cid;
} start_conn; } start_conn;
struct msg_stop_conn { struct msg_stop_conn {
uint32_t sid;
uint32_t cid;
uint64_t conn_handle; uint64_t conn_handle;
uint32_t flag; uint32_t flag;
} stop_conn; } stop_conn;
struct msg_get_stats { struct msg_get_stats {
uint64_t conn_handle; uint32_t sid;
uint32_t cid;
} get_stats; } get_stats;
} u; } u;
union { union {
/* messages k -> u */ /* messages k -> u */
uint64_t handle;
int retcode; int retcode;
struct msg_create_session_ret { struct msg_create_session_ret {
uint64_t session_handle;
uint32_t sid; uint32_t sid;
uint32_t host_no;
} c_session_ret; } c_session_ret;
struct msg_create_conn_ret {
uint32_t sid;
uint32_t cid;
} c_conn_ret;
struct msg_recv_req { struct msg_recv_req {
uint32_t sid;
uint32_t cid;
uint64_t recv_handle; uint64_t recv_handle;
uint64_t conn_handle;
} recv_req; } recv_req;
struct msg_conn_error { struct msg_conn_error {
uint64_t conn_handle; uint32_t sid;
uint32_t cid;
uint32_t error; /* enum iscsi_err */ uint32_t error; /* enum iscsi_err */
} connerror; } connerror;
} r; } r;
......
...@@ -60,11 +60,13 @@ struct iscsi_transport { ...@@ -60,11 +60,13 @@ struct iscsi_transport {
int ihostdata_size; int ihostdata_size;
/* LLD connection data size */ /* LLD connection data size */
int conndata_size; int conndata_size;
/* LLD session data size */
int sessiondata_size;
int max_lun; int max_lun;
unsigned int max_conn; unsigned int max_conn;
unsigned int max_cmd_len; unsigned int max_cmd_len;
struct iscsi_cls_session *(*create_session) struct iscsi_cls_session *(*create_session)
(struct scsi_transport_template *t, uint32_t sn, uint32_t *sid); (struct scsi_transport_template *t, uint32_t sn, uint32_t *hn);
void (*destroy_session) (struct iscsi_cls_session *session); void (*destroy_session) (struct iscsi_cls_session *session);
struct iscsi_cls_conn *(*create_conn) (struct iscsi_cls_session *sess, struct iscsi_cls_conn *(*create_conn) (struct iscsi_cls_session *sess,
uint32_t cid); uint32_t cid);
...@@ -104,6 +106,7 @@ struct iscsi_cls_conn { ...@@ -104,6 +106,7 @@ struct iscsi_cls_conn {
struct list_head conn_list; /* item in connlist */ struct list_head conn_list; /* item in connlist */
void *dd_data; /* LLD private data */ void *dd_data; /* LLD private data */
struct iscsi_transport *transport; struct iscsi_transport *transport;
uint32_t cid; /* connection id */
int active; /* must be accessed with the connlock */ int active; /* must be accessed with the connlock */
struct device dev; /* sysfs transport/container device */ struct device dev; /* sysfs transport/container device */
struct mempool_zone *z_error; struct mempool_zone *z_error;
...@@ -117,6 +120,8 @@ struct iscsi_cls_conn { ...@@ -117,6 +120,8 @@ struct iscsi_cls_conn {
struct iscsi_cls_session { struct iscsi_cls_session {
struct list_head sess_list; /* item in session_list */ struct list_head sess_list; /* item in session_list */
struct iscsi_transport *transport; struct iscsi_transport *transport;
int sid; /* session id */
void *dd_data; /* LLD private data */
struct device dev; /* sysfs transport/container device */ struct device dev; /* sysfs transport/container device */
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment