From: Subhash Jadavani <subhashj@codeaurora.org>
To: Seungwon Jeon <tgih.jun@samsung.com>
Cc: linux-scsi@vger.kernel.org,
'Vinayak Holikatti' <vinholikatti@gmail.com>,
'Santosh Y' <santoshsy@gmail.com>,
"'James E.J. Bottomley'" <James.Bottomley@HansenPartnership.com>
Subject: Re: [PATCH v3 1/6] scsi: ufs: find out sense data over scsi status values
Date: Tue, 27 Aug 2013 14:23:09 +0530 [thread overview]
Message-ID: <521C68F5.6060607@codeaurora.org> (raw)
In-Reply-To: <003601cea26a$31334600$9399d200$%jun@samsung.com>
Looks good to me.
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
On 8/26/2013 8:10 PM, Seungwon Jeon wrote:
> Unlike 'GOOD' and 'CHECK CONDITION', other status values in
> Response UPIU may or may not contain sense data. That is returning
> sense data isn't obvious. So, in this case the Data Segment Length
> field should be checked. If a non-zero value, it means that UPIU
> has Sense Data in the Data Segment area.
>
> Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
> Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
> ---
> drivers/scsi/ufs/ufs.h | 1 +
> drivers/scsi/ufs/ufshcd.c | 37 ++++++++++++++++++++++---------------
> 2 files changed, 23 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h
> index bce09a6..7210500 100644
> --- a/drivers/scsi/ufs/ufs.h
> +++ b/drivers/scsi/ufs/ufs.h
> @@ -177,6 +177,7 @@ enum {
> MASK_TASK_RESPONSE = 0xFF00,
> MASK_RSP_UPIU_RESULT = 0xFFFF,
> MASK_QUERY_DATA_SEG_LEN = 0xFFFF,
> + MASK_RSP_UPIU_DATA_SEG_LEN = 0xFFFF,
> MASK_RSP_EXCEPTION_EVENT = 0x10000,
> };
>
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 1b99c0a..6ff16c9 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -310,6 +310,20 @@ ufshcd_get_rsp_upiu_result(struct utp_upiu_rsp *ucd_rsp_ptr)
> return be32_to_cpu(ucd_rsp_ptr->header.dword_1) & MASK_RSP_UPIU_RESULT;
> }
>
> +/*
> + * ufshcd_get_rsp_upiu_data_seg_len - Get the data segment length
> + * from response UPIU
> + * @ucd_rsp_ptr: pointer to response UPIU
> + *
> + * Return the data segment length.
> + */
> +static inline unsigned int
> +ufshcd_get_rsp_upiu_data_seg_len(struct utp_upiu_rsp *ucd_rsp_ptr)
> +{
> + return be32_to_cpu(ucd_rsp_ptr->header.dword_2) &
> + MASK_RSP_UPIU_DATA_SEG_LEN;
> +}
> +
> /**
> * ufshcd_is_exception_event - Check if the device raised an exception event
> * @ucd_rsp_ptr: pointer to response UPIU
> @@ -405,7 +419,8 @@ void ufshcd_send_command(struct ufs_hba *hba, unsigned int task_tag)
> static inline void ufshcd_copy_sense_data(struct ufshcd_lrb *lrbp)
> {
> int len;
> - if (lrbp->sense_buffer) {
> + if (lrbp->sense_buffer &&
> + ufshcd_get_rsp_upiu_data_seg_len(lrbp->ucd_rsp_ptr)) {
> len = be16_to_cpu(lrbp->ucd_rsp_ptr->sr.sense_data_len);
> memcpy(lrbp->sense_buffer,
> lrbp->ucd_rsp_ptr->sr.sense_data,
> @@ -1789,32 +1804,24 @@ ufshcd_scsi_cmd_status(struct ufshcd_lrb *lrbp, int scsi_status)
> int result = 0;
>
> switch (scsi_status) {
> - case SAM_STAT_GOOD:
> - result |= DID_OK << 16 |
> - COMMAND_COMPLETE << 8 |
> - SAM_STAT_GOOD;
> - break;
> case SAM_STAT_CHECK_CONDITION:
> + ufshcd_copy_sense_data(lrbp);
> + case SAM_STAT_GOOD:
> result |= DID_OK << 16 |
> COMMAND_COMPLETE << 8 |
> - SAM_STAT_CHECK_CONDITION;
> - ufshcd_copy_sense_data(lrbp);
> - break;
> - case SAM_STAT_BUSY:
> - result |= SAM_STAT_BUSY;
> + scsi_status;
> break;
> case SAM_STAT_TASK_SET_FULL:
> -
> /*
> * If a LUN reports SAM_STAT_TASK_SET_FULL, then the LUN queue
> * depth needs to be adjusted to the exact number of
> * outstanding commands the LUN can handle at any given time.
> */
> ufshcd_adjust_lun_qdepth(lrbp->cmd);
> - result |= SAM_STAT_TASK_SET_FULL;
> - break;
> + case SAM_STAT_BUSY:
> case SAM_STAT_TASK_ABORTED:
> - result |= SAM_STAT_TASK_ABORTED;
> + ufshcd_copy_sense_data(lrbp);
> + result |= scsi_status;
> break;
> default:
> result |= DID_ERROR << 16;
next prev parent reply other threads:[~2013-08-27 8:53 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-20 0:41 [PATCH v2 0/3] ufs: fix bugs in probing and removing driver paths Akinobu Mita
2013-07-20 0:41 ` [PATCH v2 1/3] ufshcd-pci: release ioremapped region during removing driver Akinobu Mita
2013-07-26 13:45 ` [PATCH 1/7] scsi: ufs: amend the ocs handling with fatal error Seungwon Jeon
2013-07-29 6:17 ` Subhash Jadavani
2013-07-29 10:05 ` Seungwon Jeon
2013-07-29 10:27 ` Subhash Jadavani
2013-07-29 10:51 ` Sujit Reddy Thumma
2013-07-30 13:02 ` Seungwon Jeon
2013-08-12 7:17 ` Subhash Jadavani
2013-08-13 11:50 ` Seungwon Jeon
2013-08-13 13:39 ` Subhash Jadavani
2013-07-29 18:03 ` Santosh Y
2013-07-20 0:41 ` [PATCH v2 2/3] ufs: don't disable_irq() if the IRQ can be shared among devices Akinobu Mita
2013-07-26 13:44 ` [PATCH 0/7] scsi: ufs: some fixes and updates Seungwon Jeon
2013-08-23 13:00 ` [PATCH v2 0/6] " Seungwon Jeon
2013-08-25 11:23 ` Dolev Raviv
2013-08-26 14:40 ` [PATCH v3 " Seungwon Jeon
2013-08-28 10:46 ` Subhash Jadavani
2013-07-20 0:41 ` [PATCH v2 3/3] ufs: don't stop controller before scsi_remove_host() Akinobu Mita
2013-07-26 13:46 ` [PATCH 2/7] scsi: ufs: find out sense data over scsi status values Seungwon Jeon
2013-07-29 6:35 ` Subhash Jadavani
2013-07-30 13:00 ` Seungwon Jeon
2013-07-29 10:51 ` Sujit Reddy Thumma
2013-07-30 13:03 ` Seungwon Jeon
2013-07-30 3:53 ` Santosh Y
2013-07-30 13:03 ` Seungwon Jeon
2013-07-31 0:15 ` Elliott, Robert (Server Storage)
2013-08-06 12:08 ` Seungwon Jeon
2013-08-23 13:00 ` [PATCH v2 1/6] " Seungwon Jeon
2013-08-23 13:00 ` [PATCH v2 2/6] scsi: ufs: fix the setting interrupt aggregation counter Seungwon Jeon
2013-08-23 13:00 ` [PATCH v2 3/6] scsi: ufs: add dme configuration primitives Seungwon Jeon
2013-08-23 13:00 ` [PATCH v2 4/6] scsi: ufs: add unipro attribute IDs Seungwon Jeon
2013-08-23 13:00 ` [PATCH v2 5/6] scsi: ufs: add operation for the uic power mode change Seungwon Jeon
2013-08-23 13:00 ` [PATCH v2 6/6] scsi: ufs: configure the attribute for power mode Seungwon Jeon
2013-08-26 14:40 ` [PATCH v3 1/6] scsi: ufs: find out sense data over scsi status values Seungwon Jeon
2013-08-27 8:53 ` Subhash Jadavani [this message]
2013-08-28 12:43 ` Yaniv Gardi
2013-08-26 14:40 ` [PATCH v3 2/6] scsi: ufs: fix the setting interrupt aggregation counter Seungwon Jeon
2013-08-27 9:01 ` Subhash Jadavani
2013-08-28 12:43 ` Yaniv Gardi
2013-08-26 14:40 ` [PATCH v3 3/6] scsi: ufs: add dme configuration primitives Seungwon Jeon
2013-08-27 9:15 ` Subhash Jadavani
2013-08-28 12:44 ` Yaniv Gardi
2013-08-26 14:40 ` [PATCH v3 4/6] scsi: ufs: add unipro attribute IDs Seungwon Jeon
2013-08-27 9:14 ` Subhash Jadavani
2013-08-28 12:46 ` Yaniv Gardi
2013-08-26 14:40 ` [PATCH v3 5/6] scsi: ufs: add operation for the uic power mode change Seungwon Jeon
2013-08-27 9:53 ` Subhash Jadavani
2013-08-27 11:28 ` Seungwon Jeon
2013-08-27 11:47 ` Subhash Jadavani
2013-08-27 11:58 ` Seungwon Jeon
2013-08-28 12:45 ` Yaniv Gardi
2013-08-26 14:41 ` [PATCH v3 6/6] scsi: ufs: configure the attribute for power mode Seungwon Jeon
2013-08-27 10:21 ` Subhash Jadavani
2013-08-27 10:27 ` Subhash Jadavani
2013-09-09 11:51 ` [PATCH] scsi: ufs: export the helper functions for vender probe/remove Seungwon Jeon
2013-07-26 13:46 ` [PATCH 3/7] scsi: ufs: fix the setting interrupt aggregation counter Seungwon Jeon
2013-07-29 7:03 ` Subhash Jadavani
2013-07-30 13:01 ` Seungwon Jeon
2013-07-26 13:47 ` [PATCH 4/7] scsi: ufs: add dme configuration primitives Seungwon Jeon
2013-07-29 9:24 ` Subhash Jadavani
2013-07-30 13:02 ` Seungwon Jeon
2013-08-13 6:56 ` Subhash Jadavani
2013-07-26 13:48 ` [PATCH 5/7] scsi: ufs: add unipro attribute IDs Seungwon Jeon
2013-07-29 9:26 ` Subhash Jadavani
2013-07-26 13:48 ` [PATCH 6/7] scsi: ufs: add operation for the uic power mode change Seungwon Jeon
2013-07-29 9:53 ` Subhash Jadavani
2013-07-30 13:02 ` Seungwon Jeon
2013-07-26 13:49 ` [PATCH 7/7] scsi: ufs: configure the attribute for power mode Seungwon Jeon
2013-07-31 13:28 ` Subhash Jadavani
2013-08-06 12:08 ` Seungwon Jeon
2013-08-13 7:00 ` Subhash Jadavani
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=521C68F5.6060607@codeaurora.org \
--to=subhashj@codeaurora.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=linux-scsi@vger.kernel.org \
--cc=santoshsy@gmail.com \
--cc=tgih.jun@samsung.com \
--cc=vinholikatti@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.