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,
......
...@@ -56,6 +56,8 @@ struct iscsi_internal { ...@@ -56,6 +56,8 @@ struct iscsi_internal {
struct class_device_attribute *session_attrs[ISCSI_SESSION_ATTRS + 1]; struct class_device_attribute *session_attrs[ISCSI_SESSION_ATTRS + 1];
}; };
static int iscsi_session_nr; /* sysfs session id for next new session */
/* /*
* list of registered transports and lock that must * list of registered transports and lock that must
* be held while accessing list. The iscsi_transport_lock must * be held while accessing list. The iscsi_transport_lock must
...@@ -165,14 +167,23 @@ static DEFINE_SPINLOCK(sesslock); ...@@ -165,14 +167,23 @@ static DEFINE_SPINLOCK(sesslock);
static LIST_HEAD(connlist); static LIST_HEAD(connlist);
static DEFINE_SPINLOCK(connlock); static DEFINE_SPINLOCK(connlock);
static struct iscsi_cls_session *iscsi_session_lookup(uint64_t handle) static uint32_t iscsi_conn_get_sid(struct iscsi_cls_conn *conn)
{
struct iscsi_cls_session *sess = iscsi_dev_to_session(conn->dev.parent);
return sess->sid;
}
/*
* Returns the matching session to a given sid
*/
static struct iscsi_cls_session *iscsi_session_lookup(uint32_t sid)
{ {
unsigned long flags; unsigned long flags;
struct iscsi_cls_session *sess; struct iscsi_cls_session *sess;
spin_lock_irqsave(&sesslock, flags); spin_lock_irqsave(&sesslock, flags);
list_for_each_entry(sess, &sesslist, sess_list) { list_for_each_entry(sess, &sesslist, sess_list) {
if (sess == iscsi_ptr(handle)) { if (sess->sid == sid) {
spin_unlock_irqrestore(&sesslock, flags); spin_unlock_irqrestore(&sesslock, flags);
return sess; return sess;
} }
...@@ -181,14 +192,17 @@ static struct iscsi_cls_session *iscsi_session_lookup(uint64_t handle) ...@@ -181,14 +192,17 @@ static struct iscsi_cls_session *iscsi_session_lookup(uint64_t handle)
return NULL; return NULL;
} }
static struct iscsi_cls_conn *iscsi_conn_lookup(uint64_t handle) /*
* Returns the matching connection to a given sid / cid tuple
*/
static struct iscsi_cls_conn *iscsi_conn_lookup(uint32_t sid, uint32_t cid)
{ {
unsigned long flags; unsigned long flags;
struct iscsi_cls_conn *conn; struct iscsi_cls_conn *conn;
spin_lock_irqsave(&connlock, flags); spin_lock_irqsave(&connlock, flags);
list_for_each_entry(conn, &connlist, conn_list) { list_for_each_entry(conn, &connlist, conn_list) {
if (conn == iscsi_ptr(handle)) { if ((conn->cid == cid) && (iscsi_conn_get_sid(conn) == sid)) {
spin_unlock_irqrestore(&connlock, flags); spin_unlock_irqrestore(&connlock, flags);
return conn; return conn;
} }
...@@ -223,7 +237,7 @@ static int iscsi_is_session_dev(const struct device *dev) ...@@ -223,7 +237,7 @@ static int iscsi_is_session_dev(const struct device *dev)
* @shost: scsi host * @shost: scsi host
* @transport: iscsi transport * @transport: iscsi transport
* *
* This can be called from a LLD or iscsi_transport * This can be called from a LLD or iscsi_transport.
**/ **/
struct iscsi_cls_session * struct iscsi_cls_session *
iscsi_create_session(struct Scsi_Host *shost, struct iscsi_transport *transport) iscsi_create_session(struct Scsi_Host *shost, struct iscsi_transport *transport)
...@@ -234,14 +248,20 @@ iscsi_create_session(struct Scsi_Host *shost, struct iscsi_transport *transport) ...@@ -234,14 +248,20 @@ iscsi_create_session(struct Scsi_Host *shost, struct iscsi_transport *transport)
if (!try_module_get(transport->owner)) if (!try_module_get(transport->owner))
return NULL; return NULL;
session = kzalloc(sizeof(*session), GFP_KERNEL); session = kzalloc(sizeof(*session) + transport->sessiondata_size,
GFP_KERNEL);
if (!session) if (!session)
goto module_put; goto module_put;
session->transport = transport; session->transport = transport;
if (transport->sessiondata_size)
session->dd_data = &session[1];
/* this is released in the dev's release function */ /* this is released in the dev's release function */
scsi_host_get(shost); scsi_host_get(shost);
snprintf(session->dev.bus_id, BUS_ID_SIZE, "session%u", shost->host_no); session->sid = iscsi_session_nr++;
snprintf(session->dev.bus_id, BUS_ID_SIZE, "session%u",
session->sid);
session->dev.parent = &shost->shost_gendev; session->dev.parent = &shost->shost_gendev;
session->dev.release = iscsi_session_release; session->dev.release = iscsi_session_release;
err = device_register(&session->dev); err = device_register(&session->dev);
...@@ -301,12 +321,16 @@ static int iscsi_is_conn_dev(const struct device *dev) ...@@ -301,12 +321,16 @@ static int iscsi_is_conn_dev(const struct device *dev)
* This can be called from a LLD or iscsi_transport. The connection * This can be called from a LLD or iscsi_transport. The connection
* is child of the session so cid must be unique for all connections * is child of the session so cid must be unique for all connections
* on the session. * on the session.
*
* Since we do not support MCS, cid will normally be zero. In some cases
* for software iscsi we could be trying to preallocate a connection struct
* in which case there could be two connection structs and cid would be
* non-zero.
**/ **/
struct iscsi_cls_conn * struct iscsi_cls_conn *
iscsi_create_conn(struct iscsi_cls_session *session, uint32_t cid) iscsi_create_conn(struct iscsi_cls_session *session, uint32_t cid)
{ {
struct iscsi_transport *transport = session->transport; struct iscsi_transport *transport = session->transport;
struct Scsi_Host *shost = iscsi_session_to_shost(session);
struct iscsi_cls_conn *conn; struct iscsi_cls_conn *conn;
int err; int err;
...@@ -319,12 +343,14 @@ iscsi_create_conn(struct iscsi_cls_session *session, uint32_t cid) ...@@ -319,12 +343,14 @@ iscsi_create_conn(struct iscsi_cls_session *session, uint32_t cid)
INIT_LIST_HEAD(&conn->conn_list); INIT_LIST_HEAD(&conn->conn_list);
conn->transport = transport; conn->transport = transport;
conn->cid = cid;
/* this is released in the dev's release function */ /* this is released in the dev's release function */
if (!get_device(&session->dev)) if (!get_device(&session->dev))
goto free_conn; goto free_conn;
snprintf(conn->dev.bus_id, BUS_ID_SIZE, "connection%d:%u", snprintf(conn->dev.bus_id, BUS_ID_SIZE, "connection%d:%u",
shost->host_no, cid); session->sid, cid);
conn->dev.parent = &session->dev; conn->dev.parent = &session->dev;
conn->dev.release = iscsi_conn_release; conn->dev.release = iscsi_conn_release;
err = device_register(&conn->dev); err = device_register(&conn->dev);
...@@ -607,7 +633,8 @@ int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr, ...@@ -607,7 +633,8 @@ int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr,
ev->type = ISCSI_KEVENT_RECV_PDU; ev->type = ISCSI_KEVENT_RECV_PDU;
if (atomic_read(&conn->z_pdu->allocated) >= conn->z_pdu->hiwat) if (atomic_read(&conn->z_pdu->allocated) >= conn->z_pdu->hiwat)
ev->iferror = -ENOMEM; ev->iferror = -ENOMEM;
ev->r.recv_req.conn_handle = iscsi_handle(conn); ev->r.recv_req.cid = conn->cid;
ev->r.recv_req.sid = iscsi_conn_get_sid(conn);
pdu = (char*)ev + sizeof(*ev); pdu = (char*)ev + sizeof(*ev);
memcpy(pdu, hdr, sizeof(struct iscsi_hdr)); memcpy(pdu, hdr, sizeof(struct iscsi_hdr));
memcpy(pdu + sizeof(struct iscsi_hdr), data, data_size); memcpy(pdu + sizeof(struct iscsi_hdr), data, data_size);
...@@ -639,7 +666,8 @@ void iscsi_conn_error(struct iscsi_cls_conn *conn, enum iscsi_err error) ...@@ -639,7 +666,8 @@ void iscsi_conn_error(struct iscsi_cls_conn *conn, enum iscsi_err error)
if (atomic_read(&conn->z_error->allocated) >= conn->z_error->hiwat) if (atomic_read(&conn->z_error->allocated) >= conn->z_error->hiwat)
ev->iferror = -ENOMEM; ev->iferror = -ENOMEM;
ev->r.connerror.error = error; ev->r.connerror.error = error;
ev->r.connerror.conn_handle = iscsi_handle(conn); ev->r.connerror.cid = conn->cid;
ev->r.connerror.sid = iscsi_conn_get_sid(conn);
iscsi_unicast_skb(conn->z_error, skb); iscsi_unicast_skb(conn->z_error, skb);
...@@ -689,7 +717,7 @@ iscsi_if_get_stats(struct iscsi_transport *transport, struct nlmsghdr *nlh) ...@@ -689,7 +717,7 @@ iscsi_if_get_stats(struct iscsi_transport *transport, struct nlmsghdr *nlh)
ISCSI_STATS_CUSTOM_MAX); ISCSI_STATS_CUSTOM_MAX);
int err = 0; int err = 0;
conn = iscsi_conn_lookup(ev->u.get_stats.conn_handle); conn = iscsi_conn_lookup(ev->u.get_stats.sid, ev->u.get_stats.cid);
if (!conn) if (!conn)
return -EEXIST; return -EEXIST;
...@@ -713,8 +741,10 @@ iscsi_if_get_stats(struct iscsi_transport *transport, struct nlmsghdr *nlh) ...@@ -713,8 +741,10 @@ iscsi_if_get_stats(struct iscsi_transport *transport, struct nlmsghdr *nlh)
evstat->type = nlh->nlmsg_type; evstat->type = nlh->nlmsg_type;
if (atomic_read(&conn->z_pdu->allocated) >= conn->z_pdu->hiwat) if (atomic_read(&conn->z_pdu->allocated) >= conn->z_pdu->hiwat)
evstat->iferror = -ENOMEM; evstat->iferror = -ENOMEM;
evstat->u.get_stats.conn_handle = evstat->u.get_stats.cid =
ev->u.get_stats.conn_handle; ev->u.get_stats.cid;
evstat->u.get_stats.sid =
ev->u.get_stats.sid;
stats = (struct iscsi_stats *) stats = (struct iscsi_stats *)
((char*)evstat + sizeof(*evstat)); ((char*)evstat + sizeof(*evstat));
memset(stats, 0, sizeof(*stats)); memset(stats, 0, sizeof(*stats));
...@@ -740,16 +770,16 @@ iscsi_if_create_session(struct iscsi_internal *priv, struct iscsi_uevent *ev) ...@@ -740,16 +770,16 @@ iscsi_if_create_session(struct iscsi_internal *priv, struct iscsi_uevent *ev)
{ {
struct iscsi_transport *transport = priv->iscsi_transport; struct iscsi_transport *transport = priv->iscsi_transport;
struct iscsi_cls_session *session; struct iscsi_cls_session *session;
uint32_t sid; uint32_t hostno;
session = transport->create_session(&priv->t, session = transport->create_session(&priv->t,
ev->u.c_session.initial_cmdsn, ev->u.c_session.initial_cmdsn,
&sid); &hostno);
if (!session) if (!session)
return -ENOMEM; return -ENOMEM;
ev->r.c_session_ret.session_handle = iscsi_handle(session); ev->r.c_session_ret.host_no = hostno;
ev->r.c_session_ret.sid = sid; ev->r.c_session_ret.sid = session->sid;
return 0; return 0;
} }
...@@ -760,13 +790,20 @@ iscsi_if_create_conn(struct iscsi_transport *transport, struct iscsi_uevent *ev) ...@@ -760,13 +790,20 @@ iscsi_if_create_conn(struct iscsi_transport *transport, struct iscsi_uevent *ev)
struct iscsi_cls_session *session; struct iscsi_cls_session *session;
unsigned long flags; unsigned long flags;
session = iscsi_session_lookup(ev->u.c_conn.session_handle); session = iscsi_session_lookup(ev->u.c_conn.sid);
if (!session) if (!session) {
printk(KERN_ERR "iscsi: invalid session %d\n",
ev->u.c_conn.sid);
return -EINVAL; return -EINVAL;
}
conn = transport->create_conn(session, ev->u.c_conn.cid); conn = transport->create_conn(session, ev->u.c_conn.cid);
if (!conn) if (!conn) {
printk(KERN_ERR "iscsi: couldn't create a new "
"connection for session %d\n",
session->sid);
return -ENOMEM; return -ENOMEM;
}
conn->z_pdu = mempool_zone_init(Z_MAX_PDU, conn->z_pdu = mempool_zone_init(Z_MAX_PDU,
NLMSG_SPACE(sizeof(struct iscsi_uevent) + NLMSG_SPACE(sizeof(struct iscsi_uevent) +
...@@ -788,7 +825,8 @@ iscsi_if_create_conn(struct iscsi_transport *transport, struct iscsi_uevent *ev) ...@@ -788,7 +825,8 @@ iscsi_if_create_conn(struct iscsi_transport *transport, struct iscsi_uevent *ev)
goto free_pdu_pool; goto free_pdu_pool;
} }
ev->r.handle = iscsi_handle(conn); ev->r.c_conn_ret.sid = session->sid;
ev->r.c_conn_ret.cid = conn->cid;
spin_lock_irqsave(&connlock, flags); spin_lock_irqsave(&connlock, flags);
list_add(&conn->conn_list, &connlist); list_add(&conn->conn_list, &connlist);
...@@ -812,7 +850,7 @@ iscsi_if_destroy_conn(struct iscsi_transport *transport, struct iscsi_uevent *ev ...@@ -812,7 +850,7 @@ iscsi_if_destroy_conn(struct iscsi_transport *transport, struct iscsi_uevent *ev
struct iscsi_cls_conn *conn; struct iscsi_cls_conn *conn;
struct mempool_zone *z_error, *z_pdu; struct mempool_zone *z_error, *z_pdu;
conn = iscsi_conn_lookup(ev->u.d_conn.conn_handle); conn = iscsi_conn_lookup(ev->u.d_conn.sid, ev->u.d_conn.cid);
if (!conn) if (!conn)
return -EINVAL; return -EINVAL;
spin_lock_irqsave(&connlock, flags); spin_lock_irqsave(&connlock, flags);
...@@ -855,7 +893,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) ...@@ -855,7 +893,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
err = iscsi_if_create_session(priv, ev); err = iscsi_if_create_session(priv, ev);
break; break;
case ISCSI_UEVENT_DESTROY_SESSION: case ISCSI_UEVENT_DESTROY_SESSION:
session = iscsi_session_lookup(ev->u.d_session.session_handle); session = iscsi_session_lookup(ev->u.d_session.sid);
if (session) if (session)
transport->destroy_session(session); transport->destroy_session(session);
else else
...@@ -868,8 +906,8 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) ...@@ -868,8 +906,8 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
err = iscsi_if_destroy_conn(transport, ev); err = iscsi_if_destroy_conn(transport, ev);
break; break;
case ISCSI_UEVENT_BIND_CONN: case ISCSI_UEVENT_BIND_CONN:
session = iscsi_session_lookup(ev->u.b_conn.session_handle); session = iscsi_session_lookup(ev->u.b_conn.sid);
conn = iscsi_conn_lookup(ev->u.b_conn.conn_handle); conn = iscsi_conn_lookup(ev->u.b_conn.sid, ev->u.b_conn.cid);
if (session && conn) if (session && conn)
ev->r.retcode = transport->bind_conn(session, conn, ev->r.retcode = transport->bind_conn(session, conn,
...@@ -879,7 +917,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) ...@@ -879,7 +917,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
err = -EINVAL; err = -EINVAL;
break; break;
case ISCSI_UEVENT_SET_PARAM: case ISCSI_UEVENT_SET_PARAM:
conn = iscsi_conn_lookup(ev->u.set_param.conn_handle); conn = iscsi_conn_lookup(ev->u.set_param.sid, ev->u.set_param.cid);
if (conn) if (conn)
ev->r.retcode = transport->set_param(conn, ev->r.retcode = transport->set_param(conn,
ev->u.set_param.param, ev->u.set_param.value); ev->u.set_param.param, ev->u.set_param.value);
...@@ -887,7 +925,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) ...@@ -887,7 +925,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
err = -EINVAL; err = -EINVAL;
break; break;
case ISCSI_UEVENT_START_CONN: case ISCSI_UEVENT_START_CONN:
conn = iscsi_conn_lookup(ev->u.start_conn.conn_handle); conn = iscsi_conn_lookup(ev->u.start_conn.sid, ev->u.start_conn.cid);
if (conn) if (conn)
ev->r.retcode = transport->start_conn(conn); ev->r.retcode = transport->start_conn(conn);
else else
...@@ -895,14 +933,14 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) ...@@ -895,14 +933,14 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
break; break;
case ISCSI_UEVENT_STOP_CONN: case ISCSI_UEVENT_STOP_CONN:
conn = iscsi_conn_lookup(ev->u.stop_conn.conn_handle); conn = iscsi_conn_lookup(ev->u.stop_conn.sid, ev->u.stop_conn.cid);
if (conn) if (conn)
transport->stop_conn(conn, ev->u.stop_conn.flag); transport->stop_conn(conn, ev->u.stop_conn.flag);
else else
err = -EINVAL; err = -EINVAL;
break; break;
case ISCSI_UEVENT_SEND_PDU: case ISCSI_UEVENT_SEND_PDU:
conn = iscsi_conn_lookup(ev->u.send_pdu.conn_handle); conn = iscsi_conn_lookup(ev->u.send_pdu.sid, ev->u.send_pdu.cid);
if (conn) if (conn)
ev->r.retcode = transport->send_pdu(conn, ev->r.retcode = transport->send_pdu(conn,
(struct iscsi_hdr*)((char*)ev + sizeof(*ev)), (struct iscsi_hdr*)((char*)ev + sizeof(*ev)),
...@@ -923,9 +961,11 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) ...@@ -923,9 +961,11 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
return err; return err;
} }
/* Get message from skb (based on rtnetlink_rcv_skb). Each message is /*
* processed by iscsi_if_recv_msg. Malformed skbs with wrong length are * Get message from skb (based on rtnetlink_rcv_skb). Each message is
* or invalid creds discarded silently. */ * processed by iscsi_if_recv_msg. Malformed skbs with wrong lengths or
* invalid creds are discarded silently.
*/
static void static void
iscsi_if_rx(struct sock *sk, int len) iscsi_if_rx(struct sock *sk, int len)
{ {
......
...@@ -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