Lines Matching refs:cmd

39 	struct iscsi_cmd *cmd,
43 struct iscsi_conn *conn = cmd->conn;
44 struct iscsi_tmr_req *tmr_req = cmd->tmr_req;
45 struct se_tmr_req *se_tmr = cmd->se_cmd.se_tmr_req;
114 struct iscsi_cmd *cmd,
118 struct iscsi_conn *conn = cmd->conn;
120 struct iscsi_tmr_req *tmr_req = cmd->tmr_req;
121 struct se_tmr_req *se_tmr = cmd->se_cmd.se_tmr_req;
186 struct iscsi_cmd *cmd,
193 ret = iscsit_remove_cmd_from_connection_recovery(cmd, sess);
206 struct iscsi_cmd *cmd = tmr_req->ref_cmd;
209 if (!cmd->cr) {
211 " is NULL!\n", cmd->init_task_tag);
214 cr = cmd->cr;
221 cmd->stat_sn = cmd->exp_stat_sn = 0;
223 iscsit_task_reassign_remove_cmd(cmd, cr, conn->sess);
226 list_add_tail(&cmd->i_conn_node, &conn->conn_cmd_list);
229 cmd->i_state = ISTATE_SEND_NOPIN;
230 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state);
235 struct iscsi_cmd *cmd,
240 struct iscsi_conn *conn = cmd->conn;
241 struct se_cmd *se_cmd = &cmd->se_cmd;
247 cmd->cmd_flags &= ~ICF_GOT_DATACK_SNACK;
248 cmd->acked_data_sn = 0;
250 cmd->cmd_flags |= ICF_GOT_DATACK_SNACK;
251 cmd->acked_data_sn = (tmr_req->exp_data_sn - 1);
259 if (cmd->cmd_flags & ICF_GOT_LAST_DATAOUT) {
260 if (!(cmd->se_cmd.transport_state & CMD_T_SENT)) {
263 cmd->init_task_tag, cmd->se_cmd.t_state);
268 cmd->i_state = ISTATE_SEND_STATUS;
269 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state);
277 if (cmd->unsolicited_data) {
278 cmd->unsolicited_data = 0;
280 offset = cmd->next_burst_len = cmd->write_data_done;
283 cmd->se_cmd.data_length) {
285 length = (cmd->se_cmd.data_length - offset);
289 spin_lock_bh(&cmd->r2t_lock);
290 if (iscsit_add_r2t_to_list(cmd, offset, length, 0, 0) < 0) {
291 spin_unlock_bh(&cmd->r2t_lock);
294 cmd->outstanding_r2ts++;
295 spin_unlock_bh(&cmd->r2t_lock);
303 return conn->conn_transport->iscsit_get_dataout(conn, cmd, true);
307 struct iscsi_cmd *cmd,
310 struct iscsi_conn *conn = cmd->conn;
312 struct se_cmd *se_cmd = &cmd->se_cmd;
318 cmd->cmd_flags &= ~ICF_GOT_DATACK_SNACK;
319 cmd->acked_data_sn = 0;
321 cmd->cmd_flags |= ICF_GOT_DATACK_SNACK;
322 cmd->acked_data_sn = (tmr_req->exp_data_sn - 1);
325 if (!(cmd->se_cmd.transport_state & CMD_T_SENT)) {
327 " transport\n", cmd->init_task_tag,
328 cmd->se_cmd.t_state);
335 " from transport\n", cmd->init_task_tag,
336 cmd->se_cmd.t_state);
352 iscsit_attach_datain_req(cmd, dr);
354 cmd->i_state = ISTATE_SEND_DATAIN;
355 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state);
360 struct iscsi_cmd *cmd,
363 struct iscsi_conn *conn = cmd->conn;
365 cmd->i_state = ISTATE_SEND_STATUS;
366 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state);
374 struct iscsi_cmd *cmd = tmr_req->ref_cmd;
377 if (!cmd->cr) {
379 " is NULL!\n", cmd->init_task_tag);
382 cr = cmd->cr;
389 cmd->stat_sn = cmd->exp_stat_sn = 0;
391 iscsit_task_reassign_remove_cmd(cmd, cr, conn->sess);
394 list_add_tail(&cmd->i_conn_node, &conn->conn_cmd_list);
397 if (cmd->se_cmd.se_cmd_flags & SCF_SENT_CHECK_CONDITION) {
398 cmd->i_state = ISTATE_SEND_STATUS;
399 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state);
403 switch (cmd->data_direction) {
405 return iscsit_task_reassign_complete_write(cmd, tmr_req);
407 return iscsit_task_reassign_complete_read(cmd, tmr_req);
409 return iscsit_task_reassign_complete_none(cmd, tmr_req);
411 pr_err("Unknown cmd->data_direction: 0x%02x\n",
412 cmd->data_direction);
423 struct iscsi_cmd *cmd;
430 cmd = tmr_req->ref_cmd;
432 cmd->conn = conn;
434 switch (cmd->iscsi_opcode) {
443 " command realligence\n", cmd->iscsi_opcode);
451 " ITT: 0x%08x to CID: %hu.\n", cmd->iscsi_opcode,
452 cmd->init_task_tag, conn->cid);
462 int iscsit_tmr_post_handler(struct iscsi_cmd *cmd, struct iscsi_conn *conn)
464 struct iscsi_tmr_req *tmr_req = cmd->tmr_req;
465 struct se_tmr_req *se_tmr = cmd->se_cmd.se_tmr_req;
486 struct iscsi_cmd *cmd,
494 cmd->data_sn = 0;
496 if (cmd->immediate_data)
497 cmd->r2t_offset += (cmd->first_burst_len -
498 cmd->seq_start_offset);
501 cmd->write_data_done -= (cmd->immediate_data) ?
502 (cmd->first_burst_len -
503 cmd->seq_start_offset) :
504 cmd->first_burst_len;
505 cmd->first_burst_len = 0;
509 for (i = 0; i < cmd->pdu_count; i++) {
510 pdu = &cmd->pdu_list[i];
515 if ((pdu->offset >= cmd->seq_start_offset) &&
517 cmd->seq_end_offset)) {
518 cmd->first_burst_len -= pdu->length;
519 cmd->write_data_done -= pdu->length;
524 for (i = 0; i < cmd->seq_count; i++) {
525 seq = &cmd->seq_list[i];
530 cmd->write_data_done -=
532 cmd->first_burst_len = 0;
542 pdu = &cmd->pdu_list[j+seq->pdu_start];
557 struct iscsi_cmd *cmd = tmr_req->ref_cmd;
566 if (cmd->unsolicited_data)
567 iscsit_task_reassign_prepare_unsolicited_dataout(cmd, conn);
590 spin_lock_bh(&cmd->r2t_lock);
591 if (list_empty(&cmd->cmd_r2t_list)) {
592 spin_unlock_bh(&cmd->r2t_lock);
596 list_for_each_entry(r2t, &cmd->cmd_r2t_list, r2t_list) {
645 cmd->r2t_offset -= r2t->xfer_len;
650 cmd->data_sn = 0;
651 cmd->r2t_offset -= (r2t->xfer_len -
652 cmd->next_burst_len);
657 cmd->data_sn = 0;
658 cmd->r2t_offset -= r2t->xfer_len;
660 for (i = 0; i < cmd->pdu_count; i++) {
661 pdu = &cmd->pdu_list[i];
669 cmd->next_burst_len -= pdu->length;
670 cmd->write_data_done -= pdu->length;
679 seq = iscsit_get_seq_holder(cmd, r2t->offset,
682 spin_unlock_bh(&cmd->r2t_lock);
686 cmd->write_data_done -=
693 cmd->seq_send_order--;
699 pdu = &cmd->pdu_list[i+seq->pdu_start];
709 cmd->outstanding_r2ts--;
711 spin_unlock_bh(&cmd->r2t_lock);
725 cmd->cmd_flags &= ~ICF_SENT_LAST_R2T;
726 cmd->r2t_sn = tmr_req->exp_data_sn;
728 spin_lock_bh(&cmd->r2t_lock);
729 list_for_each_entry_safe(r2t, r2t_tmp, &cmd->cmd_r2t_list, r2t_list) {
744 spin_unlock_bh(&cmd->r2t_lock);
749 iscsit_free_r2t(r2t, cmd);
763 * current offset and original offset from cmd->write_data_done
770 cmd->r2t_offset -= r2t->xfer_len;
772 cmd->seq_send_order--;
774 cmd->outstanding_r2ts--;
775 iscsit_free_r2t(r2t, cmd);
777 spin_unlock_bh(&cmd->r2t_lock);