Commit 3e5c28ad authored by Mike Christie's avatar Mike Christie Committed by James Bottomley

[SCSI] libiscsi: merge iscsi_mgmt_task and iscsi_cmd_task

There is no need to have the mgmt and cmd tasks separate
structs. It used to save a lot of memory when we overprealocated
memory for tasks, but the next patches will set up the
driver so in the future they can use a mempool or some other
common scsi command allocator and common tagging.
Signed-off-by: default avatarMike Christie <michaelc@cs.wisc.edu>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent 052d0144
This diff is collapsed.
...@@ -85,18 +85,6 @@ enum { ...@@ -85,18 +85,6 @@ enum {
ISCSI_DIGEST_SIZE = sizeof(__u32), ISCSI_DIGEST_SIZE = sizeof(__u32),
}; };
struct iscsi_mgmt_task {
/*
* Becuae LLDs allocate their hdr differently, this is a pointer to
* that storage. It must be setup at session creation time.
*/
struct iscsi_hdr *hdr;
char *data; /* mgmt payload */
unsigned data_count; /* counts data to be sent */
uint32_t itt; /* this ITT */
void *dd_data; /* driver/transport data */
struct list_head running;
};
enum { enum {
ISCSI_TASK_COMPLETED, ISCSI_TASK_COMPLETED,
...@@ -121,6 +109,7 @@ struct iscsi_cmd_task { ...@@ -121,6 +109,7 @@ struct iscsi_cmd_task {
/* offset in unsolicited stream (bytes); */ /* offset in unsolicited stream (bytes); */
unsigned unsol_offset; unsigned unsol_offset;
unsigned data_count; /* remaining Data-Out */ unsigned data_count; /* remaining Data-Out */
char *data; /* mgmt payload */
struct scsi_cmnd *sc; /* associated SCSI cmd*/ struct scsi_cmnd *sc; /* associated SCSI cmd*/
struct iscsi_conn *conn; /* used connection */ struct iscsi_conn *conn; /* used connection */
...@@ -162,7 +151,7 @@ struct iscsi_conn { ...@@ -162,7 +151,7 @@ struct iscsi_conn {
unsigned long last_ping; unsigned long last_ping;
int ping_timeout; int ping_timeout;
int recv_timeout; int recv_timeout;
struct iscsi_mgmt_task *ping_mtask; struct iscsi_cmd_task *ping_ctask;
/* iSCSI connection-wide sequencing */ /* iSCSI connection-wide sequencing */
uint32_t exp_statsn; uint32_t exp_statsn;
...@@ -178,9 +167,8 @@ struct iscsi_conn { ...@@ -178,9 +167,8 @@ struct iscsi_conn {
* should always fit in this buffer * should always fit in this buffer
*/ */
char *data; char *data;
struct iscsi_mgmt_task *login_mtask; /* mtask used for login/text */ struct iscsi_cmd_task *login_ctask; /* mtask used for login/text */
struct iscsi_mgmt_task *mtask; /* xmit mtask in progress */ struct iscsi_cmd_task *ctask; /* xmit task in progress */
struct iscsi_cmd_task *ctask; /* xmit ctask in progress */
/* xmit */ /* xmit */
struct list_head mgmtqueue; /* mgmt (control) xmit queue */ struct list_head mgmtqueue; /* mgmt (control) xmit queue */
...@@ -295,12 +283,10 @@ struct iscsi_session { ...@@ -295,12 +283,10 @@ struct iscsi_session {
int state; /* session state */ int state; /* session state */
int age; /* counts session re-opens */ int age; /* counts session re-opens */
int scsi_cmds_max; /* max scsi commands */
int cmds_max; /* size of cmds array */ int cmds_max; /* size of cmds array */
struct iscsi_cmd_task **cmds; /* Original Cmds arr */ struct iscsi_cmd_task **cmds; /* Original Cmds arr */
struct iscsi_pool cmdpool; /* PDU's pool */ struct iscsi_pool cmdpool; /* PDU's pool */
int mgmtpool_max; /* size of mgmt array */
struct iscsi_mgmt_task **mgmt_cmds; /* Original mgmt arr */
struct iscsi_pool mgmtpool; /* Mgmt PDU's pool */
}; };
struct iscsi_host { struct iscsi_host {
...@@ -345,7 +331,7 @@ extern void iscsi_host_free(struct Scsi_Host *shost); ...@@ -345,7 +331,7 @@ extern void iscsi_host_free(struct Scsi_Host *shost);
*/ */
extern struct iscsi_cls_session * extern struct iscsi_cls_session *
iscsi_session_setup(struct iscsi_transport *, struct Scsi_Host *shost, iscsi_session_setup(struct iscsi_transport *, struct Scsi_Host *shost,
uint16_t, int, int, uint32_t); uint16_t, int, uint32_t);
extern void iscsi_session_teardown(struct iscsi_cls_session *); extern void iscsi_session_teardown(struct iscsi_cls_session *);
extern void iscsi_session_recovery_timedout(struct iscsi_cls_session *); extern void iscsi_session_recovery_timedout(struct iscsi_cls_session *);
extern int iscsi_set_param(struct iscsi_cls_conn *cls_conn, extern int iscsi_set_param(struct iscsi_cls_conn *cls_conn,
...@@ -388,8 +374,7 @@ extern int iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *, ...@@ -388,8 +374,7 @@ extern int iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *,
extern int iscsi_verify_itt(struct iscsi_conn *, itt_t); extern int iscsi_verify_itt(struct iscsi_conn *, itt_t);
extern struct iscsi_cmd_task *iscsi_itt_to_ctask(struct iscsi_conn *, itt_t); extern struct iscsi_cmd_task *iscsi_itt_to_ctask(struct iscsi_conn *, itt_t);
extern void iscsi_requeue_ctask(struct iscsi_cmd_task *ctask); extern void iscsi_requeue_ctask(struct iscsi_cmd_task *ctask);
extern void iscsi_free_mgmt_task(struct iscsi_conn *conn, extern void iscsi_put_ctask(struct iscsi_cmd_task *ctask);
struct iscsi_mgmt_task *mtask);
/* /*
* generic helpers * generic helpers
......
...@@ -34,7 +34,6 @@ struct Scsi_Host; ...@@ -34,7 +34,6 @@ struct Scsi_Host;
struct iscsi_cls_conn; struct iscsi_cls_conn;
struct iscsi_conn; struct iscsi_conn;
struct iscsi_cmd_task; struct iscsi_cmd_task;
struct iscsi_mgmt_task;
struct sockaddr; struct sockaddr;
/** /**
...@@ -58,19 +57,22 @@ struct sockaddr; ...@@ -58,19 +57,22 @@ struct sockaddr;
* @stop_conn: suspend/recover/terminate connection * @stop_conn: suspend/recover/terminate connection
* @send_pdu: send iSCSI PDU, Login, Logout, NOP-Out, Reject, Text. * @send_pdu: send iSCSI PDU, Login, Logout, NOP-Out, Reject, Text.
* @session_recovery_timedout: notify LLD a block during recovery timed out * @session_recovery_timedout: notify LLD a block during recovery timed out
* @init_cmd_task: Initialize a iscsi_cmd_task and any internal structs. * @init_task: Initialize a iscsi_task and any internal structs.
* Called from queuecommand with session lock held. * When offloading the data path, this is called from
* @init_mgmt_task: Initialize a iscsi_mgmt_task and any internal structs. * queuecommand with the session lock, or from the
* Called from iscsi_conn_send_generic with xmitmutex. * iscsi_conn_send_pdu context with the session lock.
* @xmit_cmd_task: Requests LLD to transfer cmd task. Returns 0 or the * When not offloading the data path, this is called
* from the scsi work queue without the session lock.
* @xmit_task Requests LLD to transfer cmd task. Returns 0 or the
* the number of bytes transferred on success, and -Exyz * the number of bytes transferred on success, and -Exyz
* value on error. * value on error. When offloading the data path, this
* @xmit_mgmt_task: Requests LLD to transfer mgmt task. Returns 0 or the * is called from queuecommand with the session lock, or
* the number of bytes transferred on success, and -Exyz * from the iscsi_conn_send_pdu context with the session
* value on error. * lock. When not offloading the data path, this is called
* @cleanup_cmd_task: requests LLD to fail cmd task. Called with xmitmutex * from the scsi work queue without the session lock.
* and session->lock after the connection has been * @cleanup_task: requests LLD to fail task. Called with session lock
* suspended and terminated during recovery. If called * and after the connection has been suspended and
* terminated during recovery. If called
* from abort task then connection is not suspended * from abort task then connection is not suspended
* or terminated but sk_callback_lock is held * or terminated but sk_callback_lock is held
* *
...@@ -110,15 +112,10 @@ struct iscsi_transport { ...@@ -110,15 +112,10 @@ struct iscsi_transport {
char *data, uint32_t data_size); char *data, uint32_t data_size);
void (*get_stats) (struct iscsi_cls_conn *conn, void (*get_stats) (struct iscsi_cls_conn *conn,
struct iscsi_stats *stats); struct iscsi_stats *stats);
int (*init_cmd_task) (struct iscsi_cmd_task *ctask); int (*init_task) (struct iscsi_cmd_task *task);
void (*init_mgmt_task) (struct iscsi_conn *conn, int (*xmit_task) (struct iscsi_cmd_task *task);
struct iscsi_mgmt_task *mtask); void (*cleanup_task) (struct iscsi_conn *conn,
int (*xmit_cmd_task) (struct iscsi_conn *conn, struct iscsi_cmd_task *task);
struct iscsi_cmd_task *ctask);
void (*cleanup_cmd_task) (struct iscsi_conn *conn,
struct iscsi_cmd_task *ctask);
int (*xmit_mgmt_task) (struct iscsi_conn *conn,
struct iscsi_mgmt_task *mtask);
void (*session_recovery_timedout) (struct iscsi_cls_session *session); void (*session_recovery_timedout) (struct iscsi_cls_session *session);
int (*ep_connect) (struct sockaddr *dst_addr, int non_blocking, int (*ep_connect) (struct sockaddr *dst_addr, int non_blocking,
uint64_t *ep_handle); uint64_t *ep_handle);
......
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