|
@@ -1448,6 +1448,7 @@ int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess
|
|
if (sgl_prot_count) {
|
|
if (sgl_prot_count) {
|
|
se_cmd->t_prot_sg = sgl_prot;
|
|
se_cmd->t_prot_sg = sgl_prot;
|
|
se_cmd->t_prot_nents = sgl_prot_count;
|
|
se_cmd->t_prot_nents = sgl_prot_count;
|
|
|
|
+ se_cmd->se_cmd_flags |= SCF_PASSTHROUGH_PROT_SG_TO_MEM_NOALLOC;
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -2178,6 +2179,12 @@ static inline void transport_reset_sgl_orig(struct se_cmd *cmd)
|
|
|
|
|
|
static inline void transport_free_pages(struct se_cmd *cmd)
|
|
static inline void transport_free_pages(struct se_cmd *cmd)
|
|
{
|
|
{
|
|
|
|
+ if (!(cmd->se_cmd_flags & SCF_PASSTHROUGH_PROT_SG_TO_MEM_NOALLOC)) {
|
|
|
|
+ transport_free_sgl(cmd->t_prot_sg, cmd->t_prot_nents);
|
|
|
|
+ cmd->t_prot_sg = NULL;
|
|
|
|
+ cmd->t_prot_nents = 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
if (cmd->se_cmd_flags & SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC) {
|
|
if (cmd->se_cmd_flags & SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC) {
|
|
/*
|
|
/*
|
|
* Release special case READ buffer payload required for
|
|
* Release special case READ buffer payload required for
|
|
@@ -2201,10 +2208,6 @@ static inline void transport_free_pages(struct se_cmd *cmd)
|
|
transport_free_sgl(cmd->t_bidi_data_sg, cmd->t_bidi_data_nents);
|
|
transport_free_sgl(cmd->t_bidi_data_sg, cmd->t_bidi_data_nents);
|
|
cmd->t_bidi_data_sg = NULL;
|
|
cmd->t_bidi_data_sg = NULL;
|
|
cmd->t_bidi_data_nents = 0;
|
|
cmd->t_bidi_data_nents = 0;
|
|
-
|
|
|
|
- transport_free_sgl(cmd->t_prot_sg, cmd->t_prot_nents);
|
|
|
|
- cmd->t_prot_sg = NULL;
|
|
|
|
- cmd->t_prot_nents = 0;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -2343,6 +2346,14 @@ transport_generic_new_cmd(struct se_cmd *cmd)
|
|
int ret = 0;
|
|
int ret = 0;
|
|
bool zero_flag = !(cmd->se_cmd_flags & SCF_SCSI_DATA_CDB);
|
|
bool zero_flag = !(cmd->se_cmd_flags & SCF_SCSI_DATA_CDB);
|
|
|
|
|
|
|
|
+ if (cmd->prot_op != TARGET_PROT_NORMAL &&
|
|
|
|
+ !(cmd->se_cmd_flags & SCF_PASSTHROUGH_PROT_SG_TO_MEM_NOALLOC)) {
|
|
|
|
+ ret = target_alloc_sgl(&cmd->t_prot_sg, &cmd->t_prot_nents,
|
|
|
|
+ cmd->prot_length, true);
|
|
|
|
+ if (ret < 0)
|
|
|
|
+ return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
|
|
|
|
+ }
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* Determine is the TCM fabric module has already allocated physical
|
|
* Determine is the TCM fabric module has already allocated physical
|
|
* memory, and is directly calling transport_generic_map_mem_to_cmd()
|
|
* memory, and is directly calling transport_generic_map_mem_to_cmd()
|
|
@@ -2368,14 +2379,6 @@ transport_generic_new_cmd(struct se_cmd *cmd)
|
|
return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
|
|
return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
|
|
}
|
|
}
|
|
|
|
|
|
- if (cmd->prot_op != TARGET_PROT_NORMAL) {
|
|
|
|
- ret = target_alloc_sgl(&cmd->t_prot_sg,
|
|
|
|
- &cmd->t_prot_nents,
|
|
|
|
- cmd->prot_length, true);
|
|
|
|
- if (ret < 0)
|
|
|
|
- return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
ret = target_alloc_sgl(&cmd->t_data_sg, &cmd->t_data_nents,
|
|
ret = target_alloc_sgl(&cmd->t_data_sg, &cmd->t_data_nents,
|
|
cmd->data_length, zero_flag);
|
|
cmd->data_length, zero_flag);
|
|
if (ret < 0)
|
|
if (ret < 0)
|