aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/ulp/iser/iscsi_iser.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/ulp/iser/iscsi_iser.c')
-rw-r--r--drivers/infiniband/ulp/iser/iscsi_iser.c114
1 files changed, 57 insertions, 57 deletions
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c
index baecca1ed42a..86d9c42f0d33 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -124,33 +124,33 @@ error:
124 124
125 125
126/** 126/**
127 * iscsi_iser_task_init - Initialize ctask 127 * iscsi_iser_task_init - Initialize task
128 * @ctask: iscsi ctask 128 * @task: iscsi task
129 * 129 *
130 * Initialize the ctask for the scsi command or mgmt command. 130 * Initialize the task for the scsi command or mgmt command.
131 */ 131 */
132static int 132static int
133iscsi_iser_task_init(struct iscsi_cmd_task *ctask) 133iscsi_iser_task_init(struct iscsi_task *task)
134{ 134{
135 struct iscsi_iser_conn *iser_conn = ctask->conn->dd_data; 135 struct iscsi_iser_conn *iser_conn = task->conn->dd_data;
136 struct iscsi_iser_cmd_task *iser_ctask = ctask->dd_data; 136 struct iscsi_iser_task *iser_task = task->dd_data;
137 137
138 /* mgmt ctask */ 138 /* mgmt task */
139 if (!ctask->sc) { 139 if (!task->sc) {
140 iser_ctask->desc.data = ctask->data; 140 iser_task->desc.data = task->data;
141 return 0; 141 return 0;
142 } 142 }
143 143
144 iser_ctask->command_sent = 0; 144 iser_task->command_sent = 0;
145 iser_ctask->iser_conn = iser_conn; 145 iser_task->iser_conn = iser_conn;
146 iser_ctask_rdma_init(iser_ctask); 146 iser_task_rdma_init(iser_task);
147 return 0; 147 return 0;
148} 148}
149 149
150/** 150/**
151 * iscsi_iser_mtask_xmit - xmit management(immediate) ctask 151 * iscsi_iser_mtask_xmit - xmit management(immediate) task
152 * @conn: iscsi connection 152 * @conn: iscsi connection
153 * @ctask: ctask management ctask 153 * @task: task management task
154 * 154 *
155 * Notes: 155 * Notes:
156 * The function can return -EAGAIN in which case caller must 156 * The function can return -EAGAIN in which case caller must
@@ -159,19 +159,19 @@ iscsi_iser_task_init(struct iscsi_cmd_task *ctask)
159 * 159 *
160 **/ 160 **/
161static int 161static int
162iscsi_iser_mtask_xmit(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) 162iscsi_iser_mtask_xmit(struct iscsi_conn *conn, struct iscsi_task *task)
163{ 163{
164 int error = 0; 164 int error = 0;
165 165
166 debug_scsi("ctask deq [cid %d itt 0x%x]\n", conn->id, ctask->itt); 166 debug_scsi("task deq [cid %d itt 0x%x]\n", conn->id, task->itt);
167 167
168 error = iser_send_control(conn, ctask); 168 error = iser_send_control(conn, task);
169 169
170 /* since iser xmits control with zero copy, ctasks can not be recycled 170 /* since iser xmits control with zero copy, tasks can not be recycled
171 * right after sending them. 171 * right after sending them.
172 * The recycling scheme is based on whether a response is expected 172 * The recycling scheme is based on whether a response is expected
173 * - if yes, the ctask is recycled at iscsi_complete_pdu 173 * - if yes, the task is recycled at iscsi_complete_pdu
174 * - if no, the ctask is recycled at iser_snd_completion 174 * - if no, the task is recycled at iser_snd_completion
175 */ 175 */
176 if (error && error != -ENOBUFS) 176 if (error && error != -ENOBUFS)
177 iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED); 177 iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED);
@@ -181,27 +181,27 @@ iscsi_iser_mtask_xmit(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
181 181
182static int 182static int
183iscsi_iser_task_xmit_unsol_data(struct iscsi_conn *conn, 183iscsi_iser_task_xmit_unsol_data(struct iscsi_conn *conn,
184 struct iscsi_cmd_task *ctask) 184 struct iscsi_task *task)
185{ 185{
186 struct iscsi_data hdr; 186 struct iscsi_data hdr;
187 int error = 0; 187 int error = 0;
188 188
189 /* Send data-out PDUs while there's still unsolicited data to send */ 189 /* Send data-out PDUs while there's still unsolicited data to send */
190 while (ctask->unsol_count > 0) { 190 while (task->unsol_count > 0) {
191 iscsi_prep_unsolicit_data_pdu(ctask, &hdr); 191 iscsi_prep_unsolicit_data_pdu(task, &hdr);
192 debug_scsi("Sending data-out: itt 0x%x, data count %d\n", 192 debug_scsi("Sending data-out: itt 0x%x, data count %d\n",
193 hdr.itt, ctask->data_count); 193 hdr.itt, task->data_count);
194 194
195 /* the buffer description has been passed with the command */ 195 /* the buffer description has been passed with the command */
196 /* Send the command */ 196 /* Send the command */
197 error = iser_send_data_out(conn, ctask, &hdr); 197 error = iser_send_data_out(conn, task, &hdr);
198 if (error) { 198 if (error) {
199 ctask->unsol_datasn--; 199 task->unsol_datasn--;
200 goto iscsi_iser_task_xmit_unsol_data_exit; 200 goto iscsi_iser_task_xmit_unsol_data_exit;
201 } 201 }
202 ctask->unsol_count -= ctask->data_count; 202 task->unsol_count -= task->data_count;
203 debug_scsi("Need to send %d more as data-out PDUs\n", 203 debug_scsi("Need to send %d more as data-out PDUs\n",
204 ctask->unsol_count); 204 task->unsol_count);
205 } 205 }
206 206
207iscsi_iser_task_xmit_unsol_data_exit: 207iscsi_iser_task_xmit_unsol_data_exit:
@@ -209,37 +209,37 @@ iscsi_iser_task_xmit_unsol_data_exit:
209} 209}
210 210
211static int 211static int
212iscsi_iser_task_xmit(struct iscsi_cmd_task *ctask) 212iscsi_iser_task_xmit(struct iscsi_task *task)
213{ 213{
214 struct iscsi_conn *conn = ctask->conn; 214 struct iscsi_conn *conn = task->conn;
215 struct iscsi_iser_cmd_task *iser_ctask = ctask->dd_data; 215 struct iscsi_iser_task *iser_task = task->dd_data;
216 int error = 0; 216 int error = 0;
217 217
218 if (!ctask->sc) 218 if (!task->sc)
219 return iscsi_iser_mtask_xmit(conn, ctask); 219 return iscsi_iser_mtask_xmit(conn, task);
220 220
221 if (ctask->sc->sc_data_direction == DMA_TO_DEVICE) { 221 if (task->sc->sc_data_direction == DMA_TO_DEVICE) {
222 BUG_ON(scsi_bufflen(ctask->sc) == 0); 222 BUG_ON(scsi_bufflen(task->sc) == 0);
223 223
224 debug_scsi("cmd [itt %x total %d imm %d unsol_data %d\n", 224 debug_scsi("cmd [itt %x total %d imm %d unsol_data %d\n",
225 ctask->itt, scsi_bufflen(ctask->sc), 225 task->itt, scsi_bufflen(task->sc),
226 ctask->imm_count, ctask->unsol_count); 226 task->imm_count, task->unsol_count);
227 } 227 }
228 228
229 debug_scsi("ctask deq [cid %d itt 0x%x]\n", 229 debug_scsi("task deq [cid %d itt 0x%x]\n",
230 conn->id, ctask->itt); 230 conn->id, task->itt);
231 231
232 /* Send the cmd PDU */ 232 /* Send the cmd PDU */
233 if (!iser_ctask->command_sent) { 233 if (!iser_task->command_sent) {
234 error = iser_send_command(conn, ctask); 234 error = iser_send_command(conn, task);
235 if (error) 235 if (error)
236 goto iscsi_iser_task_xmit_exit; 236 goto iscsi_iser_task_xmit_exit;
237 iser_ctask->command_sent = 1; 237 iser_task->command_sent = 1;
238 } 238 }
239 239
240 /* Send unsolicited data-out PDU(s) if necessary */ 240 /* Send unsolicited data-out PDU(s) if necessary */
241 if (ctask->unsol_count) 241 if (task->unsol_count)
242 error = iscsi_iser_task_xmit_unsol_data(conn, ctask); 242 error = iscsi_iser_task_xmit_unsol_data(conn, task);
243 243
244 iscsi_iser_task_xmit_exit: 244 iscsi_iser_task_xmit_exit:
245 if (error && error != -ENOBUFS) 245 if (error && error != -ENOBUFS)
@@ -248,17 +248,17 @@ iscsi_iser_task_xmit(struct iscsi_cmd_task *ctask)
248} 248}
249 249
250static void 250static void
251iscsi_iser_cleanup_task(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) 251iscsi_iser_cleanup_task(struct iscsi_conn *conn, struct iscsi_task *task)
252{ 252{
253 struct iscsi_iser_cmd_task *iser_ctask = ctask->dd_data; 253 struct iscsi_iser_task *iser_task = task->dd_data;
254 254
255 /* mgmt tasks do not need special cleanup */ 255 /* mgmt tasks do not need special cleanup */
256 if (!ctask->sc) 256 if (!task->sc)
257 return; 257 return;
258 258
259 if (iser_ctask->status == ISER_TASK_STATUS_STARTED) { 259 if (iser_task->status == ISER_TASK_STATUS_STARTED) {
260 iser_ctask->status = ISER_TASK_STATUS_COMPLETED; 260 iser_task->status = ISER_TASK_STATUS_COMPLETED;
261 iser_ctask_rdma_finalize(iser_ctask); 261 iser_task_rdma_finalize(iser_task);
262 } 262 }
263} 263}
264 264
@@ -408,8 +408,8 @@ iscsi_iser_session_create(struct Scsi_Host *shost,
408 struct iscsi_cls_session *cls_session; 408 struct iscsi_cls_session *cls_session;
409 struct iscsi_session *session; 409 struct iscsi_session *session;
410 int i; 410 int i;
411 struct iscsi_cmd_task *ctask; 411 struct iscsi_task *task;
412 struct iscsi_iser_cmd_task *iser_ctask; 412 struct iscsi_iser_task *iser_task;
413 413
414 if (shost) { 414 if (shost) {
415 printk(KERN_ERR "iscsi_tcp: invalid shost %d.\n", 415 printk(KERN_ERR "iscsi_tcp: invalid shost %d.\n",
@@ -436,7 +436,7 @@ iscsi_iser_session_create(struct Scsi_Host *shost,
436 */ 436 */
437 cls_session = iscsi_session_setup(&iscsi_iser_transport, shost, 437 cls_session = iscsi_session_setup(&iscsi_iser_transport, shost,
438 ISCSI_DEF_XMIT_CMDS_MAX, 438 ISCSI_DEF_XMIT_CMDS_MAX,
439 sizeof(struct iscsi_iser_cmd_task), 439 sizeof(struct iscsi_iser_task),
440 initial_cmdsn); 440 initial_cmdsn);
441 if (!cls_session) 441 if (!cls_session)
442 goto remove_host; 442 goto remove_host;
@@ -445,10 +445,10 @@ iscsi_iser_session_create(struct Scsi_Host *shost,
445 shost->can_queue = session->scsi_cmds_max; 445 shost->can_queue = session->scsi_cmds_max;
446 /* libiscsi setup itts, data and pool so just set desc fields */ 446 /* libiscsi setup itts, data and pool so just set desc fields */
447 for (i = 0; i < session->cmds_max; i++) { 447 for (i = 0; i < session->cmds_max; i++) {
448 ctask = session->cmds[i]; 448 task = session->cmds[i];
449 iser_ctask = ctask->dd_data; 449 iser_task = task->dd_data;
450 ctask->hdr = (struct iscsi_cmd *)&iser_ctask->desc.iscsi_header; 450 task->hdr = (struct iscsi_cmd *)&iser_task->desc.iscsi_header;
451 ctask->hdr_max = sizeof(iser_ctask->desc.iscsi_header); 451 task->hdr_max = sizeof(iser_task->desc.iscsi_header);
452 } 452 }
453 return cls_session; 453 return cls_session;
454 454