aboutsummaryrefslogtreecommitdiffstats
path: root/include/target
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2011-11-18 23:36:22 -0500
committerNicholas Bellinger <nab@linux-iscsi.org>2011-12-14 06:40:56 -0500
commita63607855224702ea17e6016ecf3f7d544e83625 (patch)
tree844d9a7dbdc636ba657763f04945b91ca8da9ba7 /include/target
parent7481deb413be132a22193e8a0bce88b311ecb3c2 (diff)
target: Add target_submit_cmd() for process context fabric submission
This patch adds a target_submit_cmd() caller that can be used by fabrics to submit an uninitialized se_cmd descriptor to an struct se_session + unpacked_lun from workqueue process context. This call will invoke the following steps: - transport_init_se_cmd() to setup se_cmd specific pointers - Obtain se_cmd->cmd_kref references with target_get_sess_cmd() - set se_cmd->t_tasks_bidi - transport_lookup_cmd_lun() to setup struct se_cmd->se_lun from the passed unpacked_lun - transport_generic_allocate_tasks() to setup the passed *cdb, and - transport_handle_cdb_direct() handle READ dispatch or WRITE ready-to-transfer callback to fabric v2 changes from hch feedback: *) Add target_sc_flags_table for target_submit_cmd flags *) Rename bidi parameter to flags, add TARGET_SCF_BIDI_OP *) Convert checks to BUG_ON *) Add out_check_cond for transport_send_check_condition_and_sense usage v3 changes: *) Add TARGET_SCF_ACK_KREF for target_submit_cmd into target_get_sess_cmd to determine when the fabric caller is expecting a second kref_put() from fabric packet acknowledgement. Cc: Christoph Hellwig <hch@lst.de> Cc: Roland Dreier <roland@purestorage.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'include/target')
-rw-r--r--include/target/target_core_base.h5
-rw-r--r--include/target/target_core_fabric.h4
2 files changed, 8 insertions, 1 deletions
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index af088a9e4905..28190dc10eef 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -226,6 +226,11 @@ enum tcm_sense_reason_table {
226 TCM_RESERVATION_CONFLICT = 0x10, 226 TCM_RESERVATION_CONFLICT = 0x10,
227}; 227};
228 228
229enum target_sc_flags_table {
230 TARGET_SCF_BIDI_OP = 0x01,
231 TARGET_SCF_ACK_KREF = 0x02,
232};
233
229/* fabric independent task management function values */ 234/* fabric independent task management function values */
230enum tcm_tmreq_table { 235enum tcm_tmreq_table {
231 TMR_ABORT_TASK = 1, 236 TMR_ABORT_TASK = 1,
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h
index d035d865dbef..aaa26da5a527 100644
--- a/include/target/target_core_fabric.h
+++ b/include/target/target_core_fabric.h
@@ -118,6 +118,8 @@ void transport_init_se_cmd(struct se_cmd *, struct target_core_fabric_ops *,
118 struct se_session *, u32, int, int, unsigned char *); 118 struct se_session *, u32, int, int, unsigned char *);
119int transport_lookup_cmd_lun(struct se_cmd *, u32); 119int transport_lookup_cmd_lun(struct se_cmd *, u32);
120int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *); 120int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *);
121int target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *,
122 unsigned char *, u32, u32, int, int, int);
121int transport_handle_cdb_direct(struct se_cmd *); 123int transport_handle_cdb_direct(struct se_cmd *);
122int transport_generic_handle_cdb_map(struct se_cmd *); 124int transport_generic_handle_cdb_map(struct se_cmd *);
123int transport_generic_handle_data(struct se_cmd *); 125int transport_generic_handle_data(struct se_cmd *);
@@ -134,7 +136,7 @@ bool transport_wait_for_tasks(struct se_cmd *);
134int transport_check_aborted_status(struct se_cmd *, int); 136int transport_check_aborted_status(struct se_cmd *, int);
135int transport_send_check_condition_and_sense(struct se_cmd *, u8, int); 137int transport_send_check_condition_and_sense(struct se_cmd *, u8, int);
136 138
137void target_get_sess_cmd(struct se_session *, struct se_cmd *); 139void target_get_sess_cmd(struct se_session *, struct se_cmd *, bool);
138int target_put_sess_cmd(struct se_session *, struct se_cmd *); 140int target_put_sess_cmd(struct se_session *, struct se_cmd *);
139void target_splice_sess_cmd_list(struct se_session *); 141void target_splice_sess_cmd_list(struct se_session *);
140void target_wait_for_sess_cmds(struct se_session *, int); 142void target_wait_for_sess_cmds(struct se_session *, int);