mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
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 <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
This commit is contained in:
parent
58d9261877
commit
b0d7994660
2 changed files with 7 additions and 0 deletions
|
|
@ -1701,6 +1701,8 @@ void target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess,
|
|||
*/
|
||||
transport_init_se_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess,
|
||||
data_length, data_dir, task_attr, sense);
|
||||
if (flags & TARGET_SCF_UNKNOWN_SIZE)
|
||||
se_cmd->unknown_data_length = 1;
|
||||
/*
|
||||
* Obtain struct se_cmd->cmd_kref reference and add new cmd to
|
||||
* se_sess->sess_cmd_list. A second kref_get here is necessary
|
||||
|
|
@ -3142,6 +3144,9 @@ static int transport_generic_cmd_sequencer(
|
|||
goto out_unsupported_cdb;
|
||||
}
|
||||
|
||||
if (cmd->unknown_data_length)
|
||||
cmd->data_length = size;
|
||||
|
||||
if (size != cmd->data_length) {
|
||||
pr_warn("TARGET_CORE[%s]: Expected Transfer Length:"
|
||||
" %u does not match SCSI CDB Length: %u for SAM Opcode:"
|
||||
|
|
|
|||
Loading…
Reference in a new issue