Re: [PATCH 09/36] target: Add common Task Management values

Dmitry Bogdanov
2022-07-07T19:36:23Z

Hi Thinh,

On Wed, Jul 06, 2022 at 04:35:20PM -0700, Thinh Nguyen wrote:
> Add some standard TMR and match their code id based on UAS-r04 and
> SPL4-r13. Note that the non-standard TMR_LUN_RESET_PRO is using the same
> id value of QUERY TASK. Change it to 0xf0 instead.
>
> Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
> ---
> drivers/target/target_core_transport.c | 10 ++++++++++
> include/target/target_core_base.h | 8 ++++++--
> 2 files changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
> index 105d3b0e470f..cbd876e44cf0 100644
> --- a/drivers/target/target_core_transport.c
> +++ b/drivers/target/target_core_transport.c
> @@ -3090,6 +3090,10 @@ static const char *target_tmf_name(enum tcm_tmreq_table tmf)
> case TMR_TARGET_WARM_RESET: return "TARGET_WARM_RESET";
> case TMR_TARGET_COLD_RESET: return "TARGET_COLD_RESET";
> case TMR_LUN_RESET_PRO: return "LUN_RESET_PRO";
> + case TMR_I_T_NEXUS_RESET: return "I_T_NEXUS_RESET";
> + case TMR_QUERY_TASK: return "QUERY_TASK";
> + case TMR_QUERY_TASK_SET: return "QUERY_TASK_SET";
> + case TMR_QUERY_ASYNC_EVENT: return "QUERY_ASYNC_EVENT";
> case TMR_UNKNOWN: break;
> }
> return "(?)";
> @@ -3538,6 +3542,12 @@ static void target_tmr_work(struct work_struct *work)
> case TMR_TARGET_COLD_RESET:
> tmr->response = TMR_FUNCTION_REJECTED;
> break;
> + case TMR_I_T_NEXUS_RESET:
> + case TMR_QUERY_TASK:
> + case TMR_QUERY_TASK_SET:
> + case TMR_QUERY_ASYNC_EVENT:
> + tmr->response = TMR_FUNCTION_REJECTED;
> + break;
> default:
> pr_err("Unknown TMR function: 0x%02x.\n",
> tmr->function);
> diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
> index 8e3da143a1ce..ccd98604eaf4 100644
> --- a/include/target/target_core_base.h
> +++ b/include/target/target_core_base.h
> @@ -206,12 +206,16 @@ enum target_sc_flags_table {
> enum tcm_tmreq_table {
> TMR_ABORT_TASK = 1,
> TMR_ABORT_TASK_SET = 2,
> - TMR_CLEAR_ACA = 3,
> + TMR_CLEAR_ACA = 0x40,
There is no need to align that values to some standart. This enum is not
standard. That is even stated in the comment for it:
/* fabric independent task management function values */
So, just add new values continuing from 8.
> TMR_CLEAR_TASK_SET = 4,
> TMR_LUN_RESET = 5,
> TMR_TARGET_WARM_RESET = 6,
> TMR_TARGET_COLD_RESET = 7,
> - TMR_LUN_RESET_PRO = 0x80,
> + TMR_I_T_NEXUS_RESET = 0x10,
> + TMR_QUERY_TASK = 0x80,
> + TMR_QUERY_TASK_SET = 0x81,
> + TMR_QUERY_ASYNC_EVENT = 0x82,
> + TMR_LUN_RESET_PRO = 0xf0,
> TMR_UNKNOWN = 0xff,
> };
>