From: Seungwon Jeon <tgih.jun@samsung.com>
To: 'Santosh Y' <santoshsy@gmail.com>
Cc: linux-scsi@vger.kernel.org,
'Vinayak Holikatti' <vinholikatti@gmail.com>,
"'James E.J. Bottomley'" <JBottomley@parallels.com>
Subject: RE: [PATCH 2/7] scsi: ufs: find out sense data over scsi status values
Date: Tue, 30 Jul 2013 22:03:29 +0900 [thread overview]
Message-ID: <002c01ce8d25$2feadab0$8fc09010$%jun@samsung.com> (raw)
In-Reply-To: <CALMYJDu3T_hySfd+3K=Q06+-v08hRkojC=v+8XUu2LFZit75VQ@mail.gmail.com>
On Tue, July 30, 2013, Santosh Y wrote:
> On Fri, Jul 26, 2013 at 7:16 PM, Seungwon Jeon <tgih.jun@samsung.com> wrote:
> > Except for 'GOOD' and 'CHECK CONDITION', other status value
> > in Response UPIU may or may contain sense data. If a non-zero
> > value is in the Data Segment Length field, it means that UPIU
> > has Sense Data in the Data Segment area.
> >
> > Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
> > ---
> > drivers/scsi/ufs/ufs.h | 1 +
> > drivers/scsi/ufs/ufshcd.c | 27 +++++++++++++++++++--------
> > 2 files changed, 20 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h
> > index 139bc06..737c31b 100644
> > --- a/drivers/scsi/ufs/ufs.h
> > +++ b/drivers/scsi/ufs/ufs.h
> > @@ -114,6 +114,7 @@ enum {
> > MASK_SCSI_STATUS = 0xFF,
> > MASK_TASK_RESPONSE = 0xFF00,
> > MASK_RSP_UPIU_RESULT = 0xFFFF,
> > + MASK_RSP_UPIU_DATA_SEG_LEN = 0xFFFF,
> > };
> >
> > /* Task management service response */
> > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> > index 4cf3a2d..688ae0e 100644
> > --- a/drivers/scsi/ufs/ufshcd.c
> > +++ b/drivers/scsi/ufs/ufshcd.c
> > @@ -218,6 +218,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 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_config_int_aggr - Configure interrupt aggregation values.
> > * Currently there is no use case where we want to configure
> > @@ -298,7 +312,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->sense_data_len);
> > memcpy(lrbp->sense_buffer,
> > lrbp->ucd_rsp_ptr->sense_data,
>
> Also please change the SCSI_SENSE_BUFFERSIZE to 18-bytes as per the
> spec, *in case* if wrong 'data segment length' is returned, there
> won't be a need to memcpy extra bytes ;-).
>
> #define UFS_SENSE_BUFFERSIZE 18
> memcpy(lrbp->sense_buffer,
> lrbp->ucd_rsp_ptr->sense_data,
> min_t(int, len, UFS_SENSE_BUFFERSIZE));
Ok. I'll check.
But considering the extension with spec. revision, it's not bad to be kept.
Current: [#define SCSI_SENSE_BUFFERSIZE 96]
Thanks,
Seungwon Jeon
>
>
> > @@ -1156,21 +1171,17 @@ ufshcd_scsi_cmd_status(struct ufshcd_lrb *lrbp, int scsi_status)
> > SAM_STAT_CHECK_CONDITION;
> > ufshcd_copy_sense_data(lrbp);
> > break;
> > - case SAM_STAT_BUSY:
> > - result |= SAM_STAT_BUSY;
> > - 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;
> > + result |= scsi_status;
> > + ufshcd_copy_sense_data(lrbp);
> > break;
> > default:
> > result |= DID_ERROR << 16;
> > --
> > 1.7.0.4
> >
> >
>
>
>
> --
> ~Santosh
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2013-07-30 13:03 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 [this message]
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
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='002c01ce8d25$2feadab0$8fc09010$%jun@samsung.com' \
--to=tgih.jun@samsung.com \
--cc=JBottomley@parallels.com \
--cc=linux-scsi@vger.kernel.org \
--cc=santoshsy@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).