Lines Matching refs:cmd
31 struct iscsit_cmd *cmd, in iscsit_tmr_abort_task() argument
35 struct iscsit_conn *conn = cmd->conn; in iscsit_tmr_abort_task()
36 struct iscsi_tmr_req *tmr_req = cmd->tmr_req; in iscsit_tmr_abort_task()
37 struct se_tmr_req *se_tmr = cmd->se_cmd.se_tmr_req; in iscsit_tmr_abort_task()
106 struct iscsit_cmd *cmd, in iscsit_tmr_task_reassign() argument
110 struct iscsit_conn *conn = cmd->conn; in iscsit_tmr_task_reassign()
112 struct iscsi_tmr_req *tmr_req = cmd->tmr_req; in iscsit_tmr_task_reassign()
113 struct se_tmr_req *se_tmr = cmd->se_cmd.se_tmr_req; in iscsit_tmr_task_reassign()
178 struct iscsit_cmd *cmd, in iscsit_task_reassign_remove_cmd() argument
185 ret = iscsit_remove_cmd_from_connection_recovery(cmd, sess); in iscsit_task_reassign_remove_cmd()
198 struct iscsit_cmd *cmd = tmr_req->ref_cmd; in iscsit_task_reassign_complete_nop_out() local
201 if (!cmd->cr) { in iscsit_task_reassign_complete_nop_out()
203 " is NULL!\n", cmd->init_task_tag); in iscsit_task_reassign_complete_nop_out()
206 cr = cmd->cr; in iscsit_task_reassign_complete_nop_out()
213 cmd->stat_sn = cmd->exp_stat_sn = 0; in iscsit_task_reassign_complete_nop_out()
215 iscsit_task_reassign_remove_cmd(cmd, cr, conn->sess); in iscsit_task_reassign_complete_nop_out()
218 list_add_tail(&cmd->i_conn_node, &conn->conn_cmd_list); in iscsit_task_reassign_complete_nop_out()
221 cmd->i_state = ISTATE_SEND_NOPIN; in iscsit_task_reassign_complete_nop_out()
222 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); in iscsit_task_reassign_complete_nop_out()
227 struct iscsit_cmd *cmd, in iscsit_task_reassign_complete_write() argument
232 struct iscsit_conn *conn = cmd->conn; in iscsit_task_reassign_complete_write()
233 struct se_cmd *se_cmd = &cmd->se_cmd; in iscsit_task_reassign_complete_write()
239 cmd->cmd_flags &= ~ICF_GOT_DATACK_SNACK; in iscsit_task_reassign_complete_write()
240 cmd->acked_data_sn = 0; in iscsit_task_reassign_complete_write()
242 cmd->cmd_flags |= ICF_GOT_DATACK_SNACK; in iscsit_task_reassign_complete_write()
243 cmd->acked_data_sn = (tmr_req->exp_data_sn - 1); in iscsit_task_reassign_complete_write()
251 if (cmd->cmd_flags & ICF_GOT_LAST_DATAOUT) { in iscsit_task_reassign_complete_write()
252 if (!(cmd->se_cmd.transport_state & CMD_T_SENT)) { in iscsit_task_reassign_complete_write()
255 cmd->init_task_tag, cmd->se_cmd.t_state); in iscsit_task_reassign_complete_write()
260 cmd->i_state = ISTATE_SEND_STATUS; in iscsit_task_reassign_complete_write()
261 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); in iscsit_task_reassign_complete_write()
269 if (cmd->unsolicited_data) { in iscsit_task_reassign_complete_write()
270 cmd->unsolicited_data = 0; in iscsit_task_reassign_complete_write()
272 offset = cmd->next_burst_len = cmd->write_data_done; in iscsit_task_reassign_complete_write()
275 cmd->se_cmd.data_length) { in iscsit_task_reassign_complete_write()
277 length = (cmd->se_cmd.data_length - offset); in iscsit_task_reassign_complete_write()
281 spin_lock_bh(&cmd->r2t_lock); in iscsit_task_reassign_complete_write()
282 if (iscsit_add_r2t_to_list(cmd, offset, length, 0, 0) < 0) { in iscsit_task_reassign_complete_write()
283 spin_unlock_bh(&cmd->r2t_lock); in iscsit_task_reassign_complete_write()
286 cmd->outstanding_r2ts++; in iscsit_task_reassign_complete_write()
287 spin_unlock_bh(&cmd->r2t_lock); in iscsit_task_reassign_complete_write()
295 return conn->conn_transport->iscsit_get_dataout(conn, cmd, true); in iscsit_task_reassign_complete_write()
299 struct iscsit_cmd *cmd, in iscsit_task_reassign_complete_read() argument
302 struct iscsit_conn *conn = cmd->conn; in iscsit_task_reassign_complete_read()
304 struct se_cmd *se_cmd = &cmd->se_cmd; in iscsit_task_reassign_complete_read()
310 cmd->cmd_flags &= ~ICF_GOT_DATACK_SNACK; in iscsit_task_reassign_complete_read()
311 cmd->acked_data_sn = 0; in iscsit_task_reassign_complete_read()
313 cmd->cmd_flags |= ICF_GOT_DATACK_SNACK; in iscsit_task_reassign_complete_read()
314 cmd->acked_data_sn = (tmr_req->exp_data_sn - 1); in iscsit_task_reassign_complete_read()
317 if (!(cmd->se_cmd.transport_state & CMD_T_SENT)) { in iscsit_task_reassign_complete_read()
319 " transport\n", cmd->init_task_tag, in iscsit_task_reassign_complete_read()
320 cmd->se_cmd.t_state); in iscsit_task_reassign_complete_read()
327 " from transport\n", cmd->init_task_tag, in iscsit_task_reassign_complete_read()
328 cmd->se_cmd.t_state); in iscsit_task_reassign_complete_read()
344 iscsit_attach_datain_req(cmd, dr); in iscsit_task_reassign_complete_read()
346 cmd->i_state = ISTATE_SEND_DATAIN; in iscsit_task_reassign_complete_read()
347 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); in iscsit_task_reassign_complete_read()
352 struct iscsit_cmd *cmd, in iscsit_task_reassign_complete_none() argument
355 struct iscsit_conn *conn = cmd->conn; in iscsit_task_reassign_complete_none()
357 cmd->i_state = ISTATE_SEND_STATUS; in iscsit_task_reassign_complete_none()
358 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); in iscsit_task_reassign_complete_none()
366 struct iscsit_cmd *cmd = tmr_req->ref_cmd; in iscsit_task_reassign_complete_scsi_cmnd() local
369 if (!cmd->cr) { in iscsit_task_reassign_complete_scsi_cmnd()
371 " is NULL!\n", cmd->init_task_tag); in iscsit_task_reassign_complete_scsi_cmnd()
374 cr = cmd->cr; in iscsit_task_reassign_complete_scsi_cmnd()
381 cmd->stat_sn = cmd->exp_stat_sn = 0; in iscsit_task_reassign_complete_scsi_cmnd()
383 iscsit_task_reassign_remove_cmd(cmd, cr, conn->sess); in iscsit_task_reassign_complete_scsi_cmnd()
386 list_add_tail(&cmd->i_conn_node, &conn->conn_cmd_list); in iscsit_task_reassign_complete_scsi_cmnd()
389 if (cmd->se_cmd.se_cmd_flags & SCF_SENT_CHECK_CONDITION) { in iscsit_task_reassign_complete_scsi_cmnd()
390 cmd->i_state = ISTATE_SEND_STATUS; in iscsit_task_reassign_complete_scsi_cmnd()
391 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); in iscsit_task_reassign_complete_scsi_cmnd()
395 switch (cmd->data_direction) { in iscsit_task_reassign_complete_scsi_cmnd()
397 return iscsit_task_reassign_complete_write(cmd, tmr_req); in iscsit_task_reassign_complete_scsi_cmnd()
399 return iscsit_task_reassign_complete_read(cmd, tmr_req); in iscsit_task_reassign_complete_scsi_cmnd()
401 return iscsit_task_reassign_complete_none(cmd, tmr_req); in iscsit_task_reassign_complete_scsi_cmnd()
404 cmd->data_direction); in iscsit_task_reassign_complete_scsi_cmnd()
415 struct iscsit_cmd *cmd; in iscsit_task_reassign_complete() local
422 cmd = tmr_req->ref_cmd; in iscsit_task_reassign_complete()
424 cmd->conn = conn; in iscsit_task_reassign_complete()
426 switch (cmd->iscsi_opcode) { in iscsit_task_reassign_complete()
435 " command reallegiance\n", cmd->iscsi_opcode); in iscsit_task_reassign_complete()
443 " ITT: 0x%08x to CID: %hu.\n", cmd->iscsi_opcode, in iscsit_task_reassign_complete()
444 cmd->init_task_tag, conn->cid); in iscsit_task_reassign_complete()
454 int iscsit_tmr_post_handler(struct iscsit_cmd *cmd, struct iscsit_conn *conn) in iscsit_tmr_post_handler() argument
456 struct iscsi_tmr_req *tmr_req = cmd->tmr_req; in iscsit_tmr_post_handler()
457 struct se_tmr_req *se_tmr = cmd->se_cmd.se_tmr_req; in iscsit_tmr_post_handler()
478 struct iscsit_cmd *cmd, in iscsit_task_reassign_prepare_unsolicited_dataout() argument
486 cmd->data_sn = 0; in iscsit_task_reassign_prepare_unsolicited_dataout()
488 if (cmd->immediate_data) in iscsit_task_reassign_prepare_unsolicited_dataout()
489 cmd->r2t_offset += (cmd->first_burst_len - in iscsit_task_reassign_prepare_unsolicited_dataout()
490 cmd->seq_start_offset); in iscsit_task_reassign_prepare_unsolicited_dataout()
493 cmd->write_data_done -= (cmd->immediate_data) ? in iscsit_task_reassign_prepare_unsolicited_dataout()
494 (cmd->first_burst_len - in iscsit_task_reassign_prepare_unsolicited_dataout()
495 cmd->seq_start_offset) : in iscsit_task_reassign_prepare_unsolicited_dataout()
496 cmd->first_burst_len; in iscsit_task_reassign_prepare_unsolicited_dataout()
497 cmd->first_burst_len = 0; in iscsit_task_reassign_prepare_unsolicited_dataout()
501 for (i = 0; i < cmd->pdu_count; i++) { in iscsit_task_reassign_prepare_unsolicited_dataout()
502 pdu = &cmd->pdu_list[i]; in iscsit_task_reassign_prepare_unsolicited_dataout()
507 if ((pdu->offset >= cmd->seq_start_offset) && in iscsit_task_reassign_prepare_unsolicited_dataout()
509 cmd->seq_end_offset)) { in iscsit_task_reassign_prepare_unsolicited_dataout()
510 cmd->first_burst_len -= pdu->length; in iscsit_task_reassign_prepare_unsolicited_dataout()
511 cmd->write_data_done -= pdu->length; in iscsit_task_reassign_prepare_unsolicited_dataout()
516 for (i = 0; i < cmd->seq_count; i++) { in iscsit_task_reassign_prepare_unsolicited_dataout()
517 seq = &cmd->seq_list[i]; in iscsit_task_reassign_prepare_unsolicited_dataout()
522 cmd->write_data_done -= in iscsit_task_reassign_prepare_unsolicited_dataout()
524 cmd->first_burst_len = 0; in iscsit_task_reassign_prepare_unsolicited_dataout()
534 pdu = &cmd->pdu_list[j+seq->pdu_start]; in iscsit_task_reassign_prepare_unsolicited_dataout()
549 struct iscsit_cmd *cmd = tmr_req->ref_cmd; in iscsit_task_reassign_prepare_write() local
558 if (cmd->unsolicited_data) in iscsit_task_reassign_prepare_write()
559 iscsit_task_reassign_prepare_unsolicited_dataout(cmd, conn); in iscsit_task_reassign_prepare_write()
582 spin_lock_bh(&cmd->r2t_lock); in iscsit_task_reassign_prepare_write()
583 if (list_empty(&cmd->cmd_r2t_list)) { in iscsit_task_reassign_prepare_write()
584 spin_unlock_bh(&cmd->r2t_lock); in iscsit_task_reassign_prepare_write()
588 list_for_each_entry(r2t, &cmd->cmd_r2t_list, r2t_list) { in iscsit_task_reassign_prepare_write()
637 cmd->r2t_offset -= r2t->xfer_len; in iscsit_task_reassign_prepare_write()
642 cmd->data_sn = 0; in iscsit_task_reassign_prepare_write()
643 cmd->r2t_offset -= (r2t->xfer_len - in iscsit_task_reassign_prepare_write()
644 cmd->next_burst_len); in iscsit_task_reassign_prepare_write()
649 cmd->data_sn = 0; in iscsit_task_reassign_prepare_write()
650 cmd->r2t_offset -= r2t->xfer_len; in iscsit_task_reassign_prepare_write()
652 for (i = 0; i < cmd->pdu_count; i++) { in iscsit_task_reassign_prepare_write()
653 pdu = &cmd->pdu_list[i]; in iscsit_task_reassign_prepare_write()
661 cmd->next_burst_len -= pdu->length; in iscsit_task_reassign_prepare_write()
662 cmd->write_data_done -= pdu->length; in iscsit_task_reassign_prepare_write()
671 seq = iscsit_get_seq_holder(cmd, r2t->offset, in iscsit_task_reassign_prepare_write()
674 spin_unlock_bh(&cmd->r2t_lock); in iscsit_task_reassign_prepare_write()
678 cmd->write_data_done -= in iscsit_task_reassign_prepare_write()
685 cmd->seq_send_order--; in iscsit_task_reassign_prepare_write()
691 pdu = &cmd->pdu_list[i+seq->pdu_start]; in iscsit_task_reassign_prepare_write()
701 cmd->outstanding_r2ts--; in iscsit_task_reassign_prepare_write()
703 spin_unlock_bh(&cmd->r2t_lock); in iscsit_task_reassign_prepare_write()
717 cmd->cmd_flags &= ~ICF_SENT_LAST_R2T; in iscsit_task_reassign_prepare_write()
718 cmd->r2t_sn = tmr_req->exp_data_sn; in iscsit_task_reassign_prepare_write()
720 spin_lock_bh(&cmd->r2t_lock); in iscsit_task_reassign_prepare_write()
721 list_for_each_entry_safe(r2t, r2t_tmp, &cmd->cmd_r2t_list, r2t_list) { in iscsit_task_reassign_prepare_write()
736 spin_unlock_bh(&cmd->r2t_lock); in iscsit_task_reassign_prepare_write()
741 iscsit_free_r2t(r2t, cmd); in iscsit_task_reassign_prepare_write()
762 cmd->r2t_offset -= r2t->xfer_len; in iscsit_task_reassign_prepare_write()
764 cmd->seq_send_order--; in iscsit_task_reassign_prepare_write()
766 cmd->outstanding_r2ts--; in iscsit_task_reassign_prepare_write()
767 iscsit_free_r2t(r2t, cmd); in iscsit_task_reassign_prepare_write()
769 spin_unlock_bh(&cmd->r2t_lock); in iscsit_task_reassign_prepare_write()