Lines Matching defs:se_cmd

54 static void transport_complete_task_attr(struct se_cmd *cmd);
55 static void translate_sense_reason(struct se_cmd *cmd, sense_reason_t reason);
56 static void transport_handle_queue_full(struct se_cmd *cmd,
696 static void target_remove_from_state_list(struct se_cmd *cmd)
712 static void target_remove_from_tmr_list(struct se_cmd *cmd)
734 static int transport_cmd_check_stop_to_fabric(struct se_cmd *cmd)
757 * allocated I/O reference and struct se_cmd now.
759 * Fabric modules are expected to return '1' here if the se_cmd being
765 static void transport_lun_remove_cmd(struct se_cmd *cmd)
779 * Clear struct se_cmd->se_lun before the handoff to FE.
786 struct se_cmd *cmd = container_of(work, struct se_cmd, work);
795 static unsigned char *transport_get_sense_buffer(struct se_cmd *cmd)
814 void transport_copy_sense_to_cmd(struct se_cmd *cmd, unsigned char *sense)
832 static void target_handle_abort(struct se_cmd *cmd)
880 struct se_cmd *cmd = container_of(work, struct se_cmd, work);
885 static bool target_cmd_interrupted(struct se_cmd *cmd)
906 void target_complete_cmd_with_sense(struct se_cmd *cmd, u8 scsi_status,
948 void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status)
956 void target_set_cmd_data_length(struct se_cmd *cmd, int length)
971 void target_complete_cmd_with_length(struct se_cmd *cmd, u8 scsi_status, int length)
982 static void target_add_to_state_list(struct se_cmd *cmd)
999 static void transport_write_pending_qf(struct se_cmd *cmd);
1000 static void transport_complete_qf(struct se_cmd *cmd);
1007 struct se_cmd *cmd, *cmd_tmp;
1031 unsigned char *transport_dump_cmd_direction(struct se_cmd *cmd)
1324 target_check_max_data_sg_nents(struct se_cmd *cmd, struct se_device *dev,
1333 * exceeds se_cmd->data_length. If true, set SCF_UNDERFLOW_BIT +
1386 target_cmd_size_check(struct se_cmd *cmd, unsigned int size)
1443 * Used by fabric modules containing a local struct se_cmd within their
1448 void __target_init_cmd(struct se_cmd *cmd,
1483 transport_check_alloc_task_attr(struct se_cmd *cmd)
1504 target_cmd_init_cdb(struct se_cmd *cmd, unsigned char *cdb, gfp_t gfp)
1555 target_cmd_parse_cdb(struct se_cmd *cmd)
1579 static int __target_submit(struct se_cmd *cmd)
1641 transport_generic_map_mem_to_cmd(struct se_cmd *cmd, struct scatterlist *sgl,
1668 * target_init_cmd - initialize se_cmd
1669 * @se_cmd: command descriptor to init
1678 * Task tags are supported if the caller has set @se_cmd->tag.
1688 int target_init_cmd(struct se_cmd *se_cmd, struct se_session *se_sess,
1696 BUG_ON(se_cmd->se_tfo || se_cmd->se_sess);
1699 se_cmd->se_cmd_flags |= SCF_USE_CPUID;
1704 se_cmd->se_cmd_flags |= SCF_BIDI;
1707 se_cmd->unknown_data_length = 1;
1709 * Initialize se_cmd for target operation. From this point
1713 __target_init_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess, data_length,
1718 * Obtain struct se_cmd->cmd_kref reference. A second kref_get here is
1722 return target_get_sess_cmd(se_cmd, flags & TARGET_SCF_ACK_KREF);
1728 * @se_cmd: command descriptor to prep
1745 int target_submit_prep(struct se_cmd *se_cmd, unsigned char *cdb,
1753 rc = target_cmd_init_cdb(se_cmd, cdb, gfp);
1758 * Locate se_lun pointer and attach it to struct se_cmd
1760 rc = transport_lookup_cmd_lun(se_cmd);
1764 rc = target_cmd_parse_cdb(se_cmd);
1773 se_cmd->t_prot_sg = sgl_prot;
1774 se_cmd->t_prot_nents = sgl_prot_count;
1775 se_cmd->se_cmd_flags |= SCF_PASSTHROUGH_PROT_SG_TO_MEM_NOALLOC;
1786 rc = transport_generic_map_mem_to_cmd(se_cmd, sgl, sgl_count,
1795 transport_send_check_condition_and_sense(se_cmd, rc, 0);
1796 target_put_sess_cmd(se_cmd);
1800 transport_generic_request_failure(se_cmd, rc);
1806 * target_submit_cmd - lookup unpacked lun and submit uninitialized se_cmd
1808 * @se_cmd: command descriptor to submit
1818 * Task tags are supported if the caller has set @se_cmd->tag.
1830 void target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess,
1836 rc = target_init_cmd(se_cmd, se_sess, sense, unpacked_lun, data_length,
1842 if (target_submit_prep(se_cmd, cdb, NULL, 0, NULL, 0, NULL, 0,
1846 target_submit(se_cmd);
1883 struct se_cmd *se_cmd, *next_cmd;
1894 llist_for_each_entry_safe(se_cmd, next_cmd, cmd_list, se_cmd_list) {
1896 se_dev = se_cmd->se_dev;
1900 __target_submit(se_cmd);
1909 * @se_cmd: command descriptor to submit
1911 static void target_queue_submission(struct se_cmd *se_cmd)
1913 struct se_device *se_dev = se_cmd->se_dev;
1914 int cpu = se_cmd->cpuid;
1918 llist_add(&se_cmd->se_cmd_list, &sq->cmd_list);
1924 * @se_cmd: command descriptor to submit
1929 int target_submit(struct se_cmd *se_cmd)
1931 const struct target_core_fabric_ops *tfo = se_cmd->se_sess->se_tpg->se_tpg_tfo;
1932 struct se_dev_attrib *da = &se_cmd->se_dev->dev_attrib;
1944 return __target_submit(se_cmd);
1946 target_queue_submission(se_cmd);
1953 struct se_cmd *se_cmd = container_of(work, struct se_cmd, work);
1955 se_cmd->se_tmr_req->response = TMR_LUN_DOES_NOT_EXIST;
1956 se_cmd->se_tfo->queue_tm_rsp(se_cmd);
1958 transport_lun_remove_cmd(se_cmd);
1959 transport_cmd_check_stop_to_fabric(se_cmd);
1963 * target_submit_tmr - lookup unpacked lun and submit uninitialized se_cmd
1966 * @se_cmd: command descriptor to submit
1979 int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess,
1990 __target_init_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess,
1994 * FIXME: Currently expect caller to handle se_cmd->se_tmr_req
1997 ret = core_tmr_alloc_req(se_cmd, fabric_tmr_ptr, tm_type, gfp);
2002 se_cmd->se_tmr_req->ref_task_tag = tag;
2005 ret = target_get_sess_cmd(se_cmd, flags & TARGET_SCF_ACK_KREF);
2007 core_tmr_release_req(se_cmd->se_tmr_req);
2011 ret = transport_lookup_tmr_lun(se_cmd);
2015 transport_generic_handle_tmr(se_cmd);
2023 INIT_WORK(&se_cmd->work, target_complete_tmr_failure);
2024 schedule_work(&se_cmd->work);
2032 void transport_generic_request_failure(struct se_cmd *cmd,
2042 * For SAM Task Attribute emulation for failed struct se_cmd
2137 void __target_execute_cmd(struct se_cmd *cmd, bool do_checks)
2178 static int target_write_prot_action(struct se_cmd *cmd)
2213 static bool target_handle_task_attr(struct se_cmd *cmd)
2224 * to allow the passed struct se_cmd list of tasks to the front of the list.
2277 void target_execute_cmd(struct se_cmd *cmd)
2314 struct se_cmd *cmd;
2320 struct se_cmd, se_delayed_node);
2355 static void transport_complete_task_attr(struct se_cmd *cmd)
2389 static void transport_complete_qf(struct se_cmd *cmd)
2413 * the struct se_cmd in question. We do NOT want
2457 static void transport_handle_queue_full(struct se_cmd *cmd, struct se_device *dev,
2484 static bool target_read_prot_action(struct se_cmd *cmd)
2514 struct se_cmd *cmd = container_of(work, struct se_cmd, work);
2533 * the struct se_cmd in question. We do NOT want
2651 pr_debug("Handling complete_ok QUEUE_FULL: se_cmd: %p,"
2663 static inline void transport_reset_sgl_orig(struct se_cmd *cmd)
2679 static inline void transport_free_pages(struct se_cmd *cmd)
2712 void *transport_kmap_data_sg(struct se_cmd *cmd)
2749 void transport_kunmap_data_sg(struct se_cmd *cmd)
2780 transport_generic_new_cmd(struct se_cmd *cmd)
2875 pr_debug("Handling write_pending QUEUE__FULL: se_cmd: %p\n", cmd);
2881 static void transport_write_pending_qf(struct se_cmd *cmd)
2900 pr_debug("Handling write_pending QUEUE__FULL: se_cmd: %p\n",
2907 __transport_wait_for_tasks(struct se_cmd *, bool, bool *, bool *,
2910 static void target_wait_free_cmd(struct se_cmd *cmd, bool *aborted, bool *tas)
2923 void target_put_cmd_and_wait(struct se_cmd *cmd)
2956 int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks)
2968 * has already added se_cmd to state_list, but fabric has
2991 * @se_cmd: command descriptor to add
2994 int target_get_sess_cmd(struct se_cmd *se_cmd, bool ack_kref)
3001 * invocations before se_cmd descriptor release.
3004 kref_get(&se_cmd->cmd_kref);
3005 se_cmd->se_cmd_flags |= SCF_ACK_KREF;
3012 if (se_cmd->cmd_cnt) {
3013 if (!percpu_ref_tryget_live(&se_cmd->cmd_cnt->refcnt))
3017 target_put_sess_cmd(se_cmd);
3023 static void target_free_cmd_mem(struct se_cmd *cmd)
3035 struct se_cmd *se_cmd = container_of(kref, struct se_cmd, cmd_kref);
3036 struct target_cmd_counter *cmd_cnt = se_cmd->cmd_cnt;
3037 struct completion *free_compl = se_cmd->free_compl;
3038 struct completion *abrt_compl = se_cmd->abrt_compl;
3040 target_free_cmd_mem(se_cmd);
3041 se_cmd->se_tfo->release_cmd(se_cmd);
3053 * @se_cmd: command to drop a reference from
3058 int target_put_sess_cmd(struct se_cmd *se_cmd)
3060 return kref_put(&se_cmd->cmd_kref, target_release_cmd_kref);
3143 void target_show_cmd(const char *pfx, struct se_cmd *cmd)
3241 __transport_wait_for_tasks(struct se_cmd *cmd, bool fabric_stop,
3294 bool transport_wait_for_tasks(struct se_cmd *cmd)
3495 static void translate_sense_reason(struct se_cmd *cmd, sense_reason_t reason)
3533 transport_send_check_condition_and_sense(struct se_cmd *cmd,
3562 int target_send_busy(struct se_cmd *cmd)
3574 struct se_cmd *cmd = container_of(work, struct se_cmd, work);
3627 struct se_cmd *cmd)