Lines Matching refs:se_cmd
265 transport_generic_free_cmd(&mcmd->se_cmd, 0); in tcm_qla2xxx_complete_mcmd()
288 transport_generic_free_cmd(&cmd->se_cmd, 0); in tcm_qla2xxx_complete_free()
306 static int tcm_qla2xxx_check_stop_free(struct se_cmd *se_cmd) in tcm_qla2xxx_check_stop_free() argument
310 if ((se_cmd->se_cmd_flags & SCF_SCSI_TMR_CDB) == 0) { in tcm_qla2xxx_check_stop_free()
311 cmd = container_of(se_cmd, struct qla_tgt_cmd, se_cmd); in tcm_qla2xxx_check_stop_free()
315 return target_put_sess_cmd(se_cmd); in tcm_qla2xxx_check_stop_free()
321 static void tcm_qla2xxx_release_cmd(struct se_cmd *se_cmd) in tcm_qla2xxx_release_cmd() argument
325 if (se_cmd->se_cmd_flags & SCF_SCSI_TMR_CDB) { in tcm_qla2xxx_release_cmd()
326 struct qla_tgt_mgmt_cmd *mcmd = container_of(se_cmd, in tcm_qla2xxx_release_cmd()
327 struct qla_tgt_mgmt_cmd, se_cmd); in tcm_qla2xxx_release_cmd()
332 cmd = container_of(se_cmd, struct qla_tgt_cmd, se_cmd); in tcm_qla2xxx_release_cmd()
371 static int tcm_qla2xxx_write_pending(struct se_cmd *se_cmd) in tcm_qla2xxx_write_pending() argument
373 struct qla_tgt_cmd *cmd = container_of(se_cmd, in tcm_qla2xxx_write_pending()
374 struct qla_tgt_cmd, se_cmd); in tcm_qla2xxx_write_pending()
376 cmd->bufflen = se_cmd->data_length; in tcm_qla2xxx_write_pending()
377 cmd->dma_data_direction = target_reverse_dma_direction(se_cmd); in tcm_qla2xxx_write_pending()
379 cmd->sg_cnt = se_cmd->t_data_nents; in tcm_qla2xxx_write_pending()
380 cmd->sg = se_cmd->t_data_sg; in tcm_qla2xxx_write_pending()
382 cmd->prot_sg_cnt = se_cmd->t_prot_nents; in tcm_qla2xxx_write_pending()
383 cmd->prot_sg = se_cmd->t_prot_sg; in tcm_qla2xxx_write_pending()
384 cmd->blk_sz = se_cmd->se_dev->dev_attrib.block_size; in tcm_qla2xxx_write_pending()
385 se_cmd->pi_err = 0; in tcm_qla2xxx_write_pending()
394 static int tcm_qla2xxx_write_pending_status(struct se_cmd *se_cmd) in tcm_qla2xxx_write_pending_status() argument
401 spin_lock_irqsave(&se_cmd->t_state_lock, flags); in tcm_qla2xxx_write_pending_status()
402 if (se_cmd->t_state == TRANSPORT_WRITE_PENDING || in tcm_qla2xxx_write_pending_status()
403 se_cmd->t_state == TRANSPORT_COMPLETE_QF_WP) { in tcm_qla2xxx_write_pending_status()
404 spin_unlock_irqrestore(&se_cmd->t_state_lock, flags); in tcm_qla2xxx_write_pending_status()
405 wait_for_completion_timeout(&se_cmd->t_transport_stop_comp, in tcm_qla2xxx_write_pending_status()
409 spin_unlock_irqrestore(&se_cmd->t_state_lock, flags); in tcm_qla2xxx_write_pending_status()
419 static int tcm_qla2xxx_get_cmd_state(struct se_cmd *se_cmd) in tcm_qla2xxx_get_cmd_state() argument
421 if (!(se_cmd->se_cmd_flags & SCF_SCSI_TMR_CDB)) { in tcm_qla2xxx_get_cmd_state()
422 struct qla_tgt_cmd *cmd = container_of(se_cmd, in tcm_qla2xxx_get_cmd_state()
423 struct qla_tgt_cmd, se_cmd); in tcm_qla2xxx_get_cmd_state()
437 struct se_cmd *se_cmd = &cmd->se_cmd; in tcm_qla2xxx_handle_cmd() local
457 return target_submit_cmd(se_cmd, se_sess, cdb, &cmd->sense_buffer[0], in tcm_qla2xxx_handle_cmd()
477 if (cmd->se_cmd.transport_state & CMD_T_ABORTED) { in tcm_qla2xxx_handle_data_work()
478 complete(&cmd->se_cmd.t_transport_stop_comp); in tcm_qla2xxx_handle_data_work()
482 if (cmd->se_cmd.pi_err) in tcm_qla2xxx_handle_data_work()
483 transport_generic_request_failure(&cmd->se_cmd, in tcm_qla2xxx_handle_data_work()
484 cmd->se_cmd.pi_err); in tcm_qla2xxx_handle_data_work()
486 transport_generic_request_failure(&cmd->se_cmd, in tcm_qla2xxx_handle_data_work()
492 return target_execute_cmd(&cmd->se_cmd); in tcm_qla2xxx_handle_data_work()
514 kref_get(&cmd->se_cmd.cmd_kref); in tcm_qla2xxx_handle_dif_work()
515 transport_generic_request_failure(&cmd->se_cmd, cmd->se_cmd.pi_err); in tcm_qla2xxx_handle_dif_work()
534 struct se_cmd *se_cmd = &mcmd->se_cmd; in tcm_qla2xxx_handle_tmr() local
536 return target_submit_tmr(se_cmd, sess->se_sess, NULL, lun, mcmd, in tcm_qla2xxx_handle_tmr()
540 static int tcm_qla2xxx_queue_data_in(struct se_cmd *se_cmd) in tcm_qla2xxx_queue_data_in() argument
542 struct qla_tgt_cmd *cmd = container_of(se_cmd, in tcm_qla2xxx_queue_data_in()
543 struct qla_tgt_cmd, se_cmd); in tcm_qla2xxx_queue_data_in()
546 cmd->bufflen = se_cmd->data_length; in tcm_qla2xxx_queue_data_in()
547 cmd->dma_data_direction = target_reverse_dma_direction(se_cmd); in tcm_qla2xxx_queue_data_in()
549 cmd->sg_cnt = se_cmd->t_data_nents; in tcm_qla2xxx_queue_data_in()
550 cmd->sg = se_cmd->t_data_sg; in tcm_qla2xxx_queue_data_in()
553 cmd->prot_sg_cnt = se_cmd->t_prot_nents; in tcm_qla2xxx_queue_data_in()
554 cmd->prot_sg = se_cmd->t_prot_sg; in tcm_qla2xxx_queue_data_in()
555 cmd->blk_sz = se_cmd->se_dev->dev_attrib.block_size; in tcm_qla2xxx_queue_data_in()
556 se_cmd->pi_err = 0; in tcm_qla2xxx_queue_data_in()
562 se_cmd->scsi_status); in tcm_qla2xxx_queue_data_in()
565 static int tcm_qla2xxx_queue_status(struct se_cmd *se_cmd) in tcm_qla2xxx_queue_status() argument
567 struct qla_tgt_cmd *cmd = container_of(se_cmd, in tcm_qla2xxx_queue_status()
568 struct qla_tgt_cmd, se_cmd); in tcm_qla2xxx_queue_status()
571 cmd->bufflen = se_cmd->data_length; in tcm_qla2xxx_queue_status()
575 cmd->dma_data_direction = target_reverse_dma_direction(se_cmd); in tcm_qla2xxx_queue_status()
582 if (se_cmd->data_direction == DMA_FROM_DEVICE) { in tcm_qla2xxx_queue_status()
587 if (se_cmd->se_cmd_flags & SCF_OVERFLOW_BIT) { in tcm_qla2xxx_queue_status()
588 se_cmd->se_cmd_flags &= ~SCF_OVERFLOW_BIT; in tcm_qla2xxx_queue_status()
589 se_cmd->residual_count = 0; in tcm_qla2xxx_queue_status()
591 se_cmd->se_cmd_flags |= SCF_UNDERFLOW_BIT; in tcm_qla2xxx_queue_status()
592 se_cmd->residual_count += se_cmd->data_length; in tcm_qla2xxx_queue_status()
599 return qlt_xmit_response(cmd, xmit_type, se_cmd->scsi_status); in tcm_qla2xxx_queue_status()
602 static void tcm_qla2xxx_queue_tm_rsp(struct se_cmd *se_cmd) in tcm_qla2xxx_queue_tm_rsp() argument
604 struct se_tmr_req *se_tmr = se_cmd->se_tmr_req; in tcm_qla2xxx_queue_tm_rsp()
605 struct qla_tgt_mgmt_cmd *mcmd = container_of(se_cmd, in tcm_qla2xxx_queue_tm_rsp()
606 struct qla_tgt_mgmt_cmd, se_cmd); in tcm_qla2xxx_queue_tm_rsp()
636 static void tcm_qla2xxx_aborted_task(struct se_cmd *se_cmd) in tcm_qla2xxx_aborted_task() argument
638 struct qla_tgt_cmd *cmd = container_of(se_cmd, in tcm_qla2xxx_aborted_task()
639 struct qla_tgt_cmd, se_cmd); in tcm_qla2xxx_aborted_task()