Lines Matching refs:cmd

257 	struct qla_tgt_cmd *cmd = container_of(work, struct qla_tgt_cmd, work);  in tcm_qla2xxx_complete_free()  local
259 cmd->cmd_in_wq = 0; in tcm_qla2xxx_complete_free()
261 WARN_ON(cmd->trc_flags & TRC_CMD_FREE); in tcm_qla2xxx_complete_free()
264 cmd->qpair->tgt_counters.qla_core_ret_sta_ctio++; in tcm_qla2xxx_complete_free()
265 cmd->trc_flags |= TRC_CMD_FREE; in tcm_qla2xxx_complete_free()
266 cmd->cmd_sent_to_fw = 0; in tcm_qla2xxx_complete_free()
268 transport_generic_free_cmd(&cmd->se_cmd, 0); in tcm_qla2xxx_complete_free()
274 struct qla_tgt_cmd *cmd; in tcm_qla2xxx_get_cmd() local
281 cmd = &((struct qla_tgt_cmd *)se_sess->sess_cmd_map)[tag]; in tcm_qla2xxx_get_cmd()
282 memset(cmd, 0, sizeof(struct qla_tgt_cmd)); in tcm_qla2xxx_get_cmd()
283 cmd->se_cmd.map_tag = tag; in tcm_qla2xxx_get_cmd()
284 cmd->se_cmd.map_cpu = cpu; in tcm_qla2xxx_get_cmd()
286 return cmd; in tcm_qla2xxx_get_cmd()
289 static void tcm_qla2xxx_rel_cmd(struct qla_tgt_cmd *cmd) in tcm_qla2xxx_rel_cmd() argument
291 target_free_tag(cmd->sess->se_sess, &cmd->se_cmd); in tcm_qla2xxx_rel_cmd()
299 static void tcm_qla2xxx_free_cmd(struct qla_tgt_cmd *cmd) in tcm_qla2xxx_free_cmd() argument
301 cmd->qpair->tgt_counters.core_qla_free_cmd++; in tcm_qla2xxx_free_cmd()
302 cmd->cmd_in_wq = 1; in tcm_qla2xxx_free_cmd()
304 WARN_ON(cmd->trc_flags & TRC_CMD_DONE); in tcm_qla2xxx_free_cmd()
305 cmd->trc_flags |= TRC_CMD_DONE; in tcm_qla2xxx_free_cmd()
307 INIT_WORK(&cmd->work, tcm_qla2xxx_complete_free); in tcm_qla2xxx_free_cmd()
308 queue_work_on(smp_processor_id(), tcm_qla2xxx_free_wq, &cmd->work); in tcm_qla2xxx_free_cmd()
316 struct qla_tgt_cmd *cmd; in tcm_qla2xxx_check_stop_free() local
319 cmd = container_of(se_cmd, struct qla_tgt_cmd, se_cmd); in tcm_qla2xxx_check_stop_free()
320 cmd->trc_flags |= TRC_CMD_CHK_STOP; in tcm_qla2xxx_check_stop_free()
331 struct qla_tgt_cmd *cmd; in tcm_qla2xxx_release_cmd() local
339 cmd = container_of(se_cmd, struct qla_tgt_cmd, se_cmd); in tcm_qla2xxx_release_cmd()
341 if (WARN_ON(cmd->cmd_sent_to_fw)) in tcm_qla2xxx_release_cmd()
344 qlt_free_cmd(cmd); in tcm_qla2xxx_release_cmd()
387 struct qla_tgt_cmd *cmd = container_of(se_cmd, in tcm_qla2xxx_write_pending() local
390 if (cmd->aborted) { in tcm_qla2xxx_write_pending()
397 cmd, kref_read(&cmd->se_cmd.cmd_kref), in tcm_qla2xxx_write_pending()
398 cmd->se_cmd.transport_state, in tcm_qla2xxx_write_pending()
399 cmd->se_cmd.t_state, in tcm_qla2xxx_write_pending()
400 cmd->se_cmd.se_cmd_flags); in tcm_qla2xxx_write_pending()
401 transport_generic_request_failure(&cmd->se_cmd, in tcm_qla2xxx_write_pending()
405 cmd->trc_flags |= TRC_XFR_RDY; in tcm_qla2xxx_write_pending()
406 cmd->bufflen = se_cmd->data_length; in tcm_qla2xxx_write_pending()
407 cmd->dma_data_direction = target_reverse_dma_direction(se_cmd); in tcm_qla2xxx_write_pending()
409 cmd->sg_cnt = se_cmd->t_data_nents; in tcm_qla2xxx_write_pending()
410 cmd->sg = se_cmd->t_data_sg; in tcm_qla2xxx_write_pending()
412 cmd->prot_sg_cnt = se_cmd->t_prot_nents; in tcm_qla2xxx_write_pending()
413 cmd->prot_sg = se_cmd->t_prot_sg; in tcm_qla2xxx_write_pending()
414 cmd->blk_sz = se_cmd->se_dev->dev_attrib.block_size; in tcm_qla2xxx_write_pending()
421 return qlt_rdy_to_xfer(cmd); in tcm_qla2xxx_write_pending()
432 struct qla_tgt_cmd *cmd = container_of(se_cmd, in tcm_qla2xxx_get_cmd_state() local
434 return cmd->state; in tcm_qla2xxx_get_cmd_state()
443 static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd, in tcm_qla2xxx_handle_cmd() argument
447 struct se_cmd *se_cmd = &cmd->se_cmd; in tcm_qla2xxx_handle_cmd()
462 sess = cmd->sess; in tcm_qla2xxx_handle_cmd()
483 cmd->qpair->tgt_counters.qla_core_sbt_cmd++; in tcm_qla2xxx_handle_cmd()
484 return target_submit_cmd(se_cmd, se_sess, cdb, &cmd->sense_buffer[0], in tcm_qla2xxx_handle_cmd()
485 cmd->unpacked_lun, data_length, fcp_task_attr, in tcm_qla2xxx_handle_cmd()
491 struct qla_tgt_cmd *cmd = container_of(work, struct qla_tgt_cmd, work); in tcm_qla2xxx_handle_data_work() local
497 cmd->cmd_in_wq = 0; in tcm_qla2xxx_handle_data_work()
498 cmd->cmd_sent_to_fw = 0; in tcm_qla2xxx_handle_data_work()
499 if (cmd->aborted) { in tcm_qla2xxx_handle_data_work()
500 transport_generic_request_failure(&cmd->se_cmd, in tcm_qla2xxx_handle_data_work()
505 cmd->qpair->tgt_counters.qla_core_ret_ctio++; in tcm_qla2xxx_handle_data_work()
506 if (!cmd->write_data_transferred) { in tcm_qla2xxx_handle_data_work()
507 switch (cmd->dif_err_code) { in tcm_qla2xxx_handle_data_work()
509 cmd->se_cmd.pi_err = in tcm_qla2xxx_handle_data_work()
513 cmd->se_cmd.pi_err = in tcm_qla2xxx_handle_data_work()
517 cmd->se_cmd.pi_err = in tcm_qla2xxx_handle_data_work()
525 if (cmd->se_cmd.pi_err) in tcm_qla2xxx_handle_data_work()
526 transport_generic_request_failure(&cmd->se_cmd, in tcm_qla2xxx_handle_data_work()
527 cmd->se_cmd.pi_err); in tcm_qla2xxx_handle_data_work()
529 transport_generic_request_failure(&cmd->se_cmd, in tcm_qla2xxx_handle_data_work()
535 return target_execute_cmd(&cmd->se_cmd); in tcm_qla2xxx_handle_data_work()
541 static void tcm_qla2xxx_handle_data(struct qla_tgt_cmd *cmd) in tcm_qla2xxx_handle_data() argument
543 cmd->trc_flags |= TRC_DATA_IN; in tcm_qla2xxx_handle_data()
544 cmd->cmd_in_wq = 1; in tcm_qla2xxx_handle_data()
545 INIT_WORK(&cmd->work, tcm_qla2xxx_handle_data_work); in tcm_qla2xxx_handle_data()
546 queue_work_on(smp_processor_id(), tcm_qla2xxx_free_wq, &cmd->work); in tcm_qla2xxx_handle_data()
554 static int tcm_qla2xxx_dif_tags(struct qla_tgt_cmd *cmd, in tcm_qla2xxx_dif_tags() argument
557 struct se_cmd *se_cmd = &cmd->se_cmd; in tcm_qla2xxx_dif_tags()
622 struct qla_tgt_cmd *cmd = NULL; in tcm_qla2xxx_find_cmd_by_tag() local
636 cmd = container_of(secmd, struct qla_tgt_cmd, se_cmd); in tcm_qla2xxx_find_cmd_by_tag()
642 return cmd; in tcm_qla2xxx_find_cmd_by_tag()
647 struct qla_tgt_cmd *cmd = container_of(se_cmd, in tcm_qla2xxx_queue_data_in() local
650 if (cmd->aborted) { in tcm_qla2xxx_queue_data_in()
657 cmd, kref_read(&cmd->se_cmd.cmd_kref), in tcm_qla2xxx_queue_data_in()
658 cmd->se_cmd.transport_state, in tcm_qla2xxx_queue_data_in()
659 cmd->se_cmd.t_state, in tcm_qla2xxx_queue_data_in()
660 cmd->se_cmd.se_cmd_flags); in tcm_qla2xxx_queue_data_in()
664 cmd->trc_flags |= TRC_XMIT_DATA; in tcm_qla2xxx_queue_data_in()
665 cmd->bufflen = se_cmd->data_length; in tcm_qla2xxx_queue_data_in()
666 cmd->dma_data_direction = target_reverse_dma_direction(se_cmd); in tcm_qla2xxx_queue_data_in()
668 cmd->sg_cnt = se_cmd->t_data_nents; in tcm_qla2xxx_queue_data_in()
669 cmd->sg = se_cmd->t_data_sg; in tcm_qla2xxx_queue_data_in()
670 cmd->offset = 0; in tcm_qla2xxx_queue_data_in()
672 cmd->prot_sg_cnt = se_cmd->t_prot_nents; in tcm_qla2xxx_queue_data_in()
673 cmd->prot_sg = se_cmd->t_prot_sg; in tcm_qla2xxx_queue_data_in()
674 cmd->blk_sz = se_cmd->se_dev->dev_attrib.block_size; in tcm_qla2xxx_queue_data_in()
680 return qlt_xmit_response(cmd, QLA_TGT_XMIT_DATA|QLA_TGT_XMIT_STATUS, in tcm_qla2xxx_queue_data_in()
686 struct qla_tgt_cmd *cmd = container_of(se_cmd, in tcm_qla2xxx_queue_status() local
690 if (cmd->aborted) { in tcm_qla2xxx_queue_status()
698 cmd, kref_read(&cmd->se_cmd.cmd_kref), in tcm_qla2xxx_queue_status()
699 cmd->se_cmd.transport_state, cmd->se_cmd.t_state, in tcm_qla2xxx_queue_status()
700 cmd->se_cmd.se_cmd_flags); in tcm_qla2xxx_queue_status()
703 cmd->bufflen = se_cmd->data_length; in tcm_qla2xxx_queue_status()
704 cmd->sg = NULL; in tcm_qla2xxx_queue_status()
705 cmd->sg_cnt = 0; in tcm_qla2xxx_queue_status()
706 cmd->offset = 0; in tcm_qla2xxx_queue_status()
707 cmd->dma_data_direction = target_reverse_dma_direction(se_cmd); in tcm_qla2xxx_queue_status()
708 cmd->trc_flags |= TRC_XMIT_STATUS; in tcm_qla2xxx_queue_status()
722 cmd->bufflen = 0; in tcm_qla2xxx_queue_status()
727 return qlt_xmit_response(cmd, xmit_type, se_cmd->scsi_status); in tcm_qla2xxx_queue_status()
766 struct qla_tgt_cmd *cmd = container_of(se_cmd, in tcm_qla2xxx_aborted_task() local
769 if (qlt_abort_cmd(cmd)) in tcm_qla2xxx_aborted_task()