Lines Matching refs:se_cmd

382 	transport_generic_free_cmd(&mcmd->se_cmd, 0);  in tcm_qla2xxx_complete_mcmd()
405 transport_generic_free_cmd(&cmd->se_cmd, 0); in tcm_qla2xxx_complete_free()
423 static int tcm_qla2xxx_check_stop_free(struct se_cmd *se_cmd) in tcm_qla2xxx_check_stop_free() argument
427 if ((se_cmd->se_cmd_flags & SCF_SCSI_TMR_CDB) == 0) { in tcm_qla2xxx_check_stop_free()
428 cmd = container_of(se_cmd, struct qla_tgt_cmd, se_cmd); in tcm_qla2xxx_check_stop_free()
432 return target_put_sess_cmd(se_cmd); in tcm_qla2xxx_check_stop_free()
438 static void tcm_qla2xxx_release_cmd(struct se_cmd *se_cmd) in tcm_qla2xxx_release_cmd() argument
442 if (se_cmd->se_cmd_flags & SCF_SCSI_TMR_CDB) { in tcm_qla2xxx_release_cmd()
443 struct qla_tgt_mgmt_cmd *mcmd = container_of(se_cmd, in tcm_qla2xxx_release_cmd()
444 struct qla_tgt_mgmt_cmd, se_cmd); in tcm_qla2xxx_release_cmd()
449 cmd = container_of(se_cmd, struct qla_tgt_cmd, se_cmd); in tcm_qla2xxx_release_cmd()
488 static int tcm_qla2xxx_write_pending(struct se_cmd *se_cmd) in tcm_qla2xxx_write_pending() argument
490 struct qla_tgt_cmd *cmd = container_of(se_cmd, in tcm_qla2xxx_write_pending()
491 struct qla_tgt_cmd, se_cmd); in tcm_qla2xxx_write_pending()
493 cmd->bufflen = se_cmd->data_length; in tcm_qla2xxx_write_pending()
494 cmd->dma_data_direction = target_reverse_dma_direction(se_cmd); in tcm_qla2xxx_write_pending()
496 cmd->sg_cnt = se_cmd->t_data_nents; in tcm_qla2xxx_write_pending()
497 cmd->sg = se_cmd->t_data_sg; in tcm_qla2xxx_write_pending()
499 cmd->prot_sg_cnt = se_cmd->t_prot_nents; in tcm_qla2xxx_write_pending()
500 cmd->prot_sg = se_cmd->t_prot_sg; in tcm_qla2xxx_write_pending()
501 cmd->blk_sz = se_cmd->se_dev->dev_attrib.block_size; in tcm_qla2xxx_write_pending()
502 se_cmd->pi_err = 0; in tcm_qla2xxx_write_pending()
511 static int tcm_qla2xxx_write_pending_status(struct se_cmd *se_cmd) in tcm_qla2xxx_write_pending_status() argument
518 spin_lock_irqsave(&se_cmd->t_state_lock, flags); in tcm_qla2xxx_write_pending_status()
519 if (se_cmd->t_state == TRANSPORT_WRITE_PENDING || in tcm_qla2xxx_write_pending_status()
520 se_cmd->t_state == TRANSPORT_COMPLETE_QF_WP) { in tcm_qla2xxx_write_pending_status()
521 spin_unlock_irqrestore(&se_cmd->t_state_lock, flags); in tcm_qla2xxx_write_pending_status()
522 wait_for_completion_timeout(&se_cmd->t_transport_stop_comp, in tcm_qla2xxx_write_pending_status()
526 spin_unlock_irqrestore(&se_cmd->t_state_lock, flags); in tcm_qla2xxx_write_pending_status()
536 static u32 tcm_qla2xxx_get_task_tag(struct se_cmd *se_cmd) in tcm_qla2xxx_get_task_tag() argument
541 if (se_cmd->se_cmd_flags & SCF_SCSI_TMR_CDB) in tcm_qla2xxx_get_task_tag()
544 cmd = container_of(se_cmd, struct qla_tgt_cmd, se_cmd); in tcm_qla2xxx_get_task_tag()
549 static int tcm_qla2xxx_get_cmd_state(struct se_cmd *se_cmd) in tcm_qla2xxx_get_cmd_state() argument
561 struct se_cmd *se_cmd = &cmd->se_cmd; in tcm_qla2xxx_handle_cmd() local
581 return target_submit_cmd(se_cmd, se_sess, cdb, &cmd->sense_buffer[0], in tcm_qla2xxx_handle_cmd()
601 if (cmd->se_cmd.transport_state & CMD_T_ABORTED) { in tcm_qla2xxx_handle_data_work()
602 complete(&cmd->se_cmd.t_transport_stop_comp); in tcm_qla2xxx_handle_data_work()
606 if (cmd->se_cmd.pi_err) in tcm_qla2xxx_handle_data_work()
607 transport_generic_request_failure(&cmd->se_cmd, in tcm_qla2xxx_handle_data_work()
608 cmd->se_cmd.pi_err); in tcm_qla2xxx_handle_data_work()
610 transport_generic_request_failure(&cmd->se_cmd, in tcm_qla2xxx_handle_data_work()
616 return target_execute_cmd(&cmd->se_cmd); in tcm_qla2xxx_handle_data_work()
638 kref_get(&cmd->se_cmd.cmd_kref); in tcm_qla2xxx_handle_dif_work()
639 transport_generic_request_failure(&cmd->se_cmd, cmd->se_cmd.pi_err); in tcm_qla2xxx_handle_dif_work()
658 struct se_cmd *se_cmd = &mcmd->se_cmd; in tcm_qla2xxx_handle_tmr() local
660 return target_submit_tmr(se_cmd, sess->se_sess, NULL, lun, mcmd, in tcm_qla2xxx_handle_tmr()
664 static int tcm_qla2xxx_queue_data_in(struct se_cmd *se_cmd) in tcm_qla2xxx_queue_data_in() argument
666 struct qla_tgt_cmd *cmd = container_of(se_cmd, in tcm_qla2xxx_queue_data_in()
667 struct qla_tgt_cmd, se_cmd); in tcm_qla2xxx_queue_data_in()
670 cmd->bufflen = se_cmd->data_length; in tcm_qla2xxx_queue_data_in()
671 cmd->dma_data_direction = target_reverse_dma_direction(se_cmd); in tcm_qla2xxx_queue_data_in()
673 cmd->sg_cnt = se_cmd->t_data_nents; in tcm_qla2xxx_queue_data_in()
674 cmd->sg = se_cmd->t_data_sg; in tcm_qla2xxx_queue_data_in()
678 cmd->prot_sg_cnt = se_cmd->t_prot_nents; in tcm_qla2xxx_queue_data_in()
679 cmd->prot_sg = se_cmd->t_prot_sg; in tcm_qla2xxx_queue_data_in()
680 cmd->blk_sz = se_cmd->se_dev->dev_attrib.block_size; in tcm_qla2xxx_queue_data_in()
681 se_cmd->pi_err = 0; in tcm_qla2xxx_queue_data_in()
687 se_cmd->scsi_status); in tcm_qla2xxx_queue_data_in()
690 static int tcm_qla2xxx_queue_status(struct se_cmd *se_cmd) in tcm_qla2xxx_queue_status() argument
692 struct qla_tgt_cmd *cmd = container_of(se_cmd, in tcm_qla2xxx_queue_status()
693 struct qla_tgt_cmd, se_cmd); in tcm_qla2xxx_queue_status()
696 cmd->bufflen = se_cmd->data_length; in tcm_qla2xxx_queue_status()
700 cmd->dma_data_direction = target_reverse_dma_direction(se_cmd); in tcm_qla2xxx_queue_status()
707 if (se_cmd->data_direction == DMA_FROM_DEVICE) { in tcm_qla2xxx_queue_status()
712 if (se_cmd->se_cmd_flags & SCF_OVERFLOW_BIT) { in tcm_qla2xxx_queue_status()
713 se_cmd->se_cmd_flags &= ~SCF_OVERFLOW_BIT; in tcm_qla2xxx_queue_status()
714 se_cmd->residual_count = 0; in tcm_qla2xxx_queue_status()
716 se_cmd->se_cmd_flags |= SCF_UNDERFLOW_BIT; in tcm_qla2xxx_queue_status()
717 se_cmd->residual_count += se_cmd->data_length; in tcm_qla2xxx_queue_status()
724 return qlt_xmit_response(cmd, xmit_type, se_cmd->scsi_status); in tcm_qla2xxx_queue_status()
727 static void tcm_qla2xxx_queue_tm_rsp(struct se_cmd *se_cmd) in tcm_qla2xxx_queue_tm_rsp() argument
729 struct se_tmr_req *se_tmr = se_cmd->se_tmr_req; in tcm_qla2xxx_queue_tm_rsp()
730 struct qla_tgt_mgmt_cmd *mcmd = container_of(se_cmd, in tcm_qla2xxx_queue_tm_rsp()
731 struct qla_tgt_mgmt_cmd, se_cmd); in tcm_qla2xxx_queue_tm_rsp()
761 static void tcm_qla2xxx_aborted_task(struct se_cmd *se_cmd) in tcm_qla2xxx_aborted_task() argument
763 struct qla_tgt_cmd *cmd = container_of(se_cmd, in tcm_qla2xxx_aborted_task()
764 struct qla_tgt_cmd, se_cmd); in tcm_qla2xxx_aborted_task()