aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2012-01-10 08:16:59 -0500
committerNicholas Bellinger <nab@linux-iscsi.org>2012-04-14 20:40:03 -0400
commitb0d7994660af1601cc26ef7ab748569fdb9c253b (patch)
tree49740bdc2f2284762b1d367295b238c5f3bc931d /drivers/target
parent58d926187758f76647d68e2f51ce44e6ace81873 (diff)
target: add unknown size flag to target_submit_cmd()
The UASP protocol does not inform the target device upfront how much data it should expect so we have to learn in from the CDB. So in order to handle this case, add a TARGET_SCF_UNKNOWN_SIZE to target_submit_cmd() and perform an explictly assignment for se_cmd->data_length from the extracted CDB size in transport_generic_cmd_sequencer(). Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/target_core_transport.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 443704f84fd5..25c67c800f3d 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -1701,6 +1701,8 @@ void target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess,
1701 */ 1701 */
1702 transport_init_se_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess, 1702 transport_init_se_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess,
1703 data_length, data_dir, task_attr, sense); 1703 data_length, data_dir, task_attr, sense);
1704 if (flags & TARGET_SCF_UNKNOWN_SIZE)
1705 se_cmd->unknown_data_length = 1;
1704 /* 1706 /*
1705 * Obtain struct se_cmd->cmd_kref reference and add new cmd to 1707 * Obtain struct se_cmd->cmd_kref reference and add new cmd to
1706 * se_sess->sess_cmd_list. A second kref_get here is necessary 1708 * se_sess->sess_cmd_list. A second kref_get here is necessary
@@ -3142,6 +3144,9 @@ static int transport_generic_cmd_sequencer(
3142 goto out_unsupported_cdb; 3144 goto out_unsupported_cdb;
3143 } 3145 }
3144 3146
3147 if (cmd->unknown_data_length)
3148 cmd->data_length = size;
3149
3145 if (size != cmd->data_length) { 3150 if (size != cmd->data_length) {
3146 pr_warn("TARGET_CORE[%s]: Expected Transfer Length:" 3151 pr_warn("TARGET_CORE[%s]: Expected Transfer Length:"
3147 " %u does not match SCSI CDB Length: %u for SAM Opcode:" 3152 " %u does not match SCSI CDB Length: %u for SAM Opcode:"