aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2008-05-21 16:54:06 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-07-12 09:22:19 -0400
commit3e5c28ad0391389959ccae81c938c7533efb3490 (patch)
treebcfb02dc14afa91dd21fd59ec7c82f881be065c9 /include/scsi
parent052d014485d2ce5bb7fa8dd0df875dafd1db77df (diff)
[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: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'include/scsi')
-rw-r--r--include/scsi/libiscsi.h29
-rw-r--r--include/scsi/scsi_transport_iscsi.h41
2 files changed, 26 insertions, 44 deletions
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 9be6a70faff..d1c36759b35 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -85,18 +85,6 @@ enum {
85 ISCSI_DIGEST_SIZE = sizeof(__u32), 85 ISCSI_DIGEST_SIZE = sizeof(__u32),
86}; 86};
87 87
88struct iscsi_mgmt_task {
89 /*
90 * Becuae LLDs allocate their hdr differently, this is a pointer to
91 * that storage. It must be setup at session creation time.
92 */
93 struct iscsi_hdr *hdr;
94 char *data; /* mgmt payload */
95 unsigned data_count; /* counts data to be sent */
96 uint32_t itt; /* this ITT */
97 void *dd_data; /* driver/transport data */
98 struct list_head running;
99};
100 88
101enum { 89enum {
102 ISCSI_TASK_COMPLETED, 90 ISCSI_TASK_COMPLETED,
@@ -121,6 +109,7 @@ struct iscsi_cmd_task {
121 /* offset in unsolicited stream (bytes); */ 109 /* offset in unsolicited stream (bytes); */
122 unsigned unsol_offset; 110 unsigned unsol_offset;
123 unsigned data_count; /* remaining Data-Out */ 111 unsigned data_count; /* remaining Data-Out */
112 char *data; /* mgmt payload */
124 struct scsi_cmnd *sc; /* associated SCSI cmd*/ 113 struct scsi_cmnd *sc; /* associated SCSI cmd*/
125 struct iscsi_conn *conn; /* used connection */ 114 struct iscsi_conn *conn; /* used connection */
126 115
@@ -162,7 +151,7 @@ struct iscsi_conn {
162 unsigned long last_ping; 151 unsigned long last_ping;
163 int ping_timeout; 152 int ping_timeout;
164 int recv_timeout; 153 int recv_timeout;
165 struct iscsi_mgmt_task *ping_mtask; 154 struct iscsi_cmd_task *ping_ctask;
166 155
167 /* iSCSI connection-wide sequencing */ 156 /* iSCSI connection-wide sequencing */
168 uint32_t exp_statsn; 157 uint32_t exp_statsn;
@@ -178,9 +167,8 @@ struct iscsi_conn {
178 * should always fit in this buffer 167 * should always fit in this buffer
179 */ 168 */
180 char *data; 169 char *data;
181 struct iscsi_mgmt_task *login_mtask; /* mtask used for login/text */ 170 struct iscsi_cmd_task *login_ctask; /* mtask used for login/text */
182 struct iscsi_mgmt_task *mtask; /* xmit mtask in progress */ 171 struct iscsi_cmd_task *ctask; /* xmit task in progress */
183 struct iscsi_cmd_task *ctask; /* xmit ctask in progress */
184 172
185 /* xmit */ 173 /* xmit */
186 struct list_head mgmtqueue; /* mgmt (control) xmit queue */ 174 struct list_head mgmtqueue; /* mgmt (control) xmit queue */
@@ -295,12 +283,10 @@ struct iscsi_session {
295 int state; /* session state */ 283 int state; /* session state */
296 int age; /* counts session re-opens */ 284 int age; /* counts session re-opens */
297 285
286 int scsi_cmds_max; /* max scsi commands */
298 int cmds_max; /* size of cmds array */ 287 int cmds_max; /* size of cmds array */
299 struct iscsi_cmd_task **cmds; /* Original Cmds arr */ 288 struct iscsi_cmd_task **cmds; /* Original Cmds arr */
300 struct iscsi_pool cmdpool; /* PDU's pool */ 289 struct iscsi_pool cmdpool; /* PDU's pool */
301 int mgmtpool_max; /* size of mgmt array */
302 struct iscsi_mgmt_task **mgmt_cmds; /* Original mgmt arr */
303 struct iscsi_pool mgmtpool; /* Mgmt PDU's pool */
304}; 290};
305 291
306struct iscsi_host { 292struct iscsi_host {
@@ -345,7 +331,7 @@ extern void iscsi_host_free(struct Scsi_Host *shost);
345 */ 331 */
346extern struct iscsi_cls_session * 332extern struct iscsi_cls_session *
347iscsi_session_setup(struct iscsi_transport *, struct Scsi_Host *shost, 333iscsi_session_setup(struct iscsi_transport *, struct Scsi_Host *shost,
348 uint16_t, int, int, uint32_t); 334 uint16_t, int, uint32_t);
349extern void iscsi_session_teardown(struct iscsi_cls_session *); 335extern void iscsi_session_teardown(struct iscsi_cls_session *);
350extern void iscsi_session_recovery_timedout(struct iscsi_cls_session *); 336extern void iscsi_session_recovery_timedout(struct iscsi_cls_session *);
351extern int iscsi_set_param(struct iscsi_cls_conn *cls_conn, 337extern 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 *,
388extern int iscsi_verify_itt(struct iscsi_conn *, itt_t); 374extern int iscsi_verify_itt(struct iscsi_conn *, itt_t);
389extern struct iscsi_cmd_task *iscsi_itt_to_ctask(struct iscsi_conn *, itt_t); 375extern struct iscsi_cmd_task *iscsi_itt_to_ctask(struct iscsi_conn *, itt_t);
390extern void iscsi_requeue_ctask(struct iscsi_cmd_task *ctask); 376extern void iscsi_requeue_ctask(struct iscsi_cmd_task *ctask);
391extern void iscsi_free_mgmt_task(struct iscsi_conn *conn, 377extern void iscsi_put_ctask(struct iscsi_cmd_task *ctask);
392 struct iscsi_mgmt_task *mtask);
393 378
394/* 379/*
395 * generic helpers 380 * generic helpers
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 4028f121d54..3f24503dfdf 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -34,7 +34,6 @@ struct Scsi_Host;
34struct iscsi_cls_conn; 34struct iscsi_cls_conn;
35struct iscsi_conn; 35struct iscsi_conn;
36struct iscsi_cmd_task; 36struct iscsi_cmd_task;
37struct iscsi_mgmt_task;
38struct sockaddr; 37struct sockaddr;
39 38
40/** 39/**
@@ -58,19 +57,22 @@ struct sockaddr;
58 * @stop_conn: suspend/recover/terminate connection 57 * @stop_conn: suspend/recover/terminate connection
59 * @send_pdu: send iSCSI PDU, Login, Logout, NOP-Out, Reject, Text. 58 * @send_pdu: send iSCSI PDU, Login, Logout, NOP-Out, Reject, Text.
60 * @session_recovery_timedout: notify LLD a block during recovery timed out 59 * @session_recovery_timedout: notify LLD a block during recovery timed out
61 * @init_cmd_task: Initialize a iscsi_cmd_task and any internal structs. 60 * @init_task: Initialize a iscsi_task and any internal structs.
62 * Called from queuecommand with session lock held. 61 * When offloading the data path, this is called from
63 * @init_mgmt_task: Initialize a iscsi_mgmt_task and any internal structs. 62 * queuecommand with the session lock, or from the
64 * Called from iscsi_conn_send_generic with xmitmutex. 63 * iscsi_conn_send_pdu context with the session lock.
65 * @xmit_cmd_task: Requests LLD to transfer cmd task. Returns 0 or the 64 * When not offloading the data path, this is called
65 * from the scsi work queue without the session lock.
66 * @xmit_task Requests LLD to transfer cmd task. Returns 0 or the
66 * the number of bytes transferred on success, and -Exyz 67 * the number of bytes transferred on success, and -Exyz
67 * value on error. 68 * value on error. When offloading the data path, this
68 * @xmit_mgmt_task: Requests LLD to transfer mgmt task. Returns 0 or the 69 * is called from queuecommand with the session lock, or
69 * the number of bytes transferred on success, and -Exyz 70 * from the iscsi_conn_send_pdu context with the session
70 * value on error. 71 * lock. When not offloading the data path, this is called
71 * @cleanup_cmd_task: requests LLD to fail cmd task. Called with xmitmutex 72 * from the scsi work queue without the session lock.
72 * and session->lock after the connection has been 73 * @cleanup_task: requests LLD to fail task. Called with session lock
73 * suspended and terminated during recovery. If called 74 * and after the connection has been suspended and
75 * terminated during recovery. If called
74 * from abort task then connection is not suspended 76 * from abort task then connection is not suspended
75 * or terminated but sk_callback_lock is held 77 * or terminated but sk_callback_lock is held
76 * 78 *
@@ -110,15 +112,10 @@ struct iscsi_transport {
110 char *data, uint32_t data_size); 112 char *data, uint32_t data_size);
111 void (*get_stats) (struct iscsi_cls_conn *conn, 113 void (*get_stats) (struct iscsi_cls_conn *conn,
112 struct iscsi_stats *stats); 114 struct iscsi_stats *stats);
113 int (*init_cmd_task) (struct iscsi_cmd_task *ctask); 115 int (*init_task) (struct iscsi_cmd_task *task);
114 void (*init_mgmt_task) (struct iscsi_conn *conn, 116 int (*xmit_task) (struct iscsi_cmd_task *task);
115 struct iscsi_mgmt_task *mtask); 117 void (*cleanup_task) (struct iscsi_conn *conn,
116 int (*xmit_cmd_task) (struct iscsi_conn *conn, 118 struct iscsi_cmd_task *task);
117 struct iscsi_cmd_task *ctask);
118 void (*cleanup_cmd_task) (struct iscsi_conn *conn,
119 struct iscsi_cmd_task *ctask);
120 int (*xmit_mgmt_task) (struct iscsi_conn *conn,
121 struct iscsi_mgmt_task *mtask);
122 void (*session_recovery_timedout) (struct iscsi_cls_session *session); 119 void (*session_recovery_timedout) (struct iscsi_cls_session *session);
123 int (*ep_connect) (struct sockaddr *dst_addr, int non_blocking, 120 int (*ep_connect) (struct sockaddr *dst_addr, int non_blocking,
124 uint64_t *ep_handle); 121 uint64_t *ep_handle);