diff mbox series

[v1,2/3] scsi: ufs: Distinguish between TM request UPIU and response UPIU in TM UPIU trace

Message ID 20201206164226.6595-3-huobean@gmail.com (mailing list archive)
State Changes Requested
Headers show
Series Three fixes for the UPIU trace | expand

Commit Message

Bean Huo Dec. 6, 2020, 4:42 p.m. UTC
From: Bean Huo <beanhuo@micron.com>

Distinguish between TM request UPIU and response UPIU in TM UPIU trace,
for the TM response, let TM UPIU trace print its TM response UPIU.

Signed-off-by: Bean Huo <beanhuo@micron.com>
---
 drivers/scsi/ufs/ufshcd.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Bart Van Assche Dec. 6, 2020, 6:52 p.m. UTC | #1
On 12/6/20 8:42 AM, Bean Huo wrote:
> From: Bean Huo <beanhuo@micron.com>
> 
> Distinguish between TM request UPIU and response UPIU in TM UPIU trace,
> for the TM response, let TM UPIU trace print its TM response UPIU.
> 
> Signed-off-by: Bean Huo <beanhuo@micron.com>
> ---
>  drivers/scsi/ufs/ufshcd.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index e10de94adb3f..29d7240a61bf 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -338,8 +338,12 @@ static void ufshcd_add_tm_upiu_trace(struct ufs_hba *hba, unsigned int tag,
>  	int off = (int)tag - hba->nutrs;
>  	struct utp_task_req_desc *descp = &hba->utmrdl_base_addr[off];
>  
> -	trace_ufshcd_upiu(dev_name(hba->dev), str, &descp->req_header,
> -			&descp->input_param1);
> +	if (!strcmp("tm_send", str))
> +		trace_ufshcd_upiu(dev_name(hba->dev), str, &descp->req_header,
> +				  &descp->input_param1);
> +	else
> +		trace_ufshcd_upiu(dev_name(hba->dev), str, &descp->rsp_header,
> +				  &descp->output_param1);
>  }

Same comment here: please change the type of the 'str' argument in an
enum such that the strcmp() call can be changed into an integer comparison.

Thanks,

Bart.
Avri Altman Dec. 7, 2020, 7:49 a.m. UTC | #2
> 
> 
> From: Bean Huo <beanhuo@micron.com>
> 
> Distinguish between TM request UPIU and response UPIU in TM UPIU trace,
> for the TM response, let TM UPIU trace print its TM response UPIU.
> 
> Signed-off-by: Bean Huo <beanhuo@micron.com>
Acked-by: Avri Altman <avri.altman@wdc.com>

Again - same comment:
But you need to change the complete string so not to break the current parsers.
I would also pass to the  struct utp_upiu_header *,
so no comparison is needed.

Thanks,
Avri

> ---
>  drivers/scsi/ufs/ufshcd.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index e10de94adb3f..29d7240a61bf 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -338,8 +338,12 @@ static void ufshcd_add_tm_upiu_trace(struct
> ufs_hba *hba, unsigned int tag,
>         int off = (int)tag - hba->nutrs;
>         struct utp_task_req_desc *descp = &hba->utmrdl_base_addr[off];
> 
> -       trace_ufshcd_upiu(dev_name(hba->dev), str, &descp->req_header,
> -                       &descp->input_param1);
> +       if (!strcmp("tm_send", str))
> +               trace_ufshcd_upiu(dev_name(hba->dev), str, &descp-
> >req_header,
> +                                 &descp->input_param1);
> +       else
> +               trace_ufshcd_upiu(dev_name(hba->dev), str, &descp-
> >rsp_header,
> +                                 &descp->output_param1);
>  }
> 
>  static void ufshcd_add_uic_command_trace(struct ufs_hba *hba,
> --
> 2.17.1
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index e10de94adb3f..29d7240a61bf 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -338,8 +338,12 @@  static void ufshcd_add_tm_upiu_trace(struct ufs_hba *hba, unsigned int tag,
 	int off = (int)tag - hba->nutrs;
 	struct utp_task_req_desc *descp = &hba->utmrdl_base_addr[off];
 
-	trace_ufshcd_upiu(dev_name(hba->dev), str, &descp->req_header,
-			&descp->input_param1);
+	if (!strcmp("tm_send", str))
+		trace_ufshcd_upiu(dev_name(hba->dev), str, &descp->req_header,
+				  &descp->input_param1);
+	else
+		trace_ufshcd_upiu(dev_name(hba->dev), str, &descp->rsp_header,
+				  &descp->output_param1);
 }
 
 static void ufshcd_add_uic_command_trace(struct ufs_hba *hba,