All of lore.kernel.org
 help / color / mirror / Atom feed
From: Subhash Jadavani <subhashj@codeaurora.org>
To: Akinobu Mita <mita@fixstars.com>
Cc: linux-scsi@vger.kernel.org,
	Vinayak Holikatti <vinholikatti@gmail.com>,
	Santosh Y <santoshsy@gmail.com>,
	"James E.J. Bottomley" <JBottomley@parallels.com>
Subject: Re: [PATCH] ufs: adjust queue settings to PRDT limitations
Date: Mon, 23 Sep 2013 13:18:01 +0530	[thread overview]
Message-ID: <523FF231.7080300@codeaurora.org> (raw)
In-Reply-To: <1379745419-7099-1-git-send-email-mita@fixstars.com>

On 9/21/2013 12:06 PM, Akinobu Mita wrote:
> The data byte count field of PRDT indicates the length of data block
> which is a segment of data transfer for SCSI commands.  The value of
> this field shall have Dword granularity and the the maximum of length
> is 256KB.
>
> This adjusts dma pad mask and max segment size to the above-mentioned
> PRDT limitations.
>
> Signed-off-by: Akinobu Mita <mita@fixstars.com>
> Cc: Vinayak Holikatti <vinholikatti@gmail.com>
> Cc: Santosh Y <santoshsy@gmail.com>
> Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
> Cc: linux-scsi@vger.kernel.org
> ---
>   drivers/scsi/ufs/ufshcd.c | 15 +++++++++++++++
>   drivers/scsi/ufs/ufshci.h |  3 +++
>   2 files changed, 18 insertions(+)
>
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 7ef9c17..c60537f 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -1919,6 +1919,20 @@ static int ufshcd_slave_alloc(struct scsi_device *sdev)
>   }
>   
>   /**
> + * ufshcd_slave_configure - adjust SCSI device configurations
> + * @sdev: pointer to SCSI device
> + */
> +static int ufshcd_slave_configure(struct scsi_device *sdev)
> +{
> +	struct request_queue *q = sdev->request_queue;
> +
> +	blk_queue_update_dma_pad(q, PRDT_DATA_BYTE_COUNT_PAD - 1);
> +	blk_queue_max_segment_size(q, PRDT_DATA_BYTE_COUNT_MAX);
> +
> +	return 0;
> +}
> +
> +/**
>    * ufshcd_slave_destroy - remove SCSI device configurations
>    * @sdev: pointer to SCSI device
>    */
> @@ -2749,6 +2763,7 @@ static struct scsi_host_template ufshcd_driver_template = {
>   	.proc_name		= UFSHCD,
>   	.queuecommand		= ufshcd_queuecommand,
>   	.slave_alloc		= ufshcd_slave_alloc,
> +	.slave_configure	= ufshcd_slave_configure,
>   	.slave_destroy		= ufshcd_slave_destroy,
>   	.eh_abort_handler	= ufshcd_abort,
>   	.eh_device_reset_handler = ufshcd_device_reset,
> diff --git a/drivers/scsi/ufs/ufshci.h b/drivers/scsi/ufs/ufshci.h
> index 0475c66..c8de354 100644
> --- a/drivers/scsi/ufs/ufshci.h
> +++ b/drivers/scsi/ufs/ufshci.h
> @@ -296,6 +296,9 @@ enum {
>   	MASK_OCS			= 0x0F,
>   };
>   

Ideally there should be comment here to explain the reason for this 
limitation. I see comments in commit text but not here in code.
Its not general practice to browse through history to understand the 
reason behind this limitations. so it always helps to add comments in 
code itself.

Regards,
Subhash

> +#define PRDT_DATA_BYTE_COUNT_MAX	(256 * 1024)
> +#define PRDT_DATA_BYTE_COUNT_PAD	4
> +
>   /**
>    * struct ufshcd_sg_entry - UFSHCI PRD Entry
>    * @base_addr: Lower 32bit physical address DW-0


  reply	other threads:[~2013-09-23  7:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-21  6:36 [PATCH] ufs: adjust queue settings to PRDT limitations Akinobu Mita
2013-09-23  7:48 ` Subhash Jadavani [this message]
2013-09-23 22:42   ` Akinobu Mita

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=523FF231.7080300@codeaurora.org \
    --to=subhashj@codeaurora.org \
    --cc=JBottomley@parallels.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mita@fixstars.com \
    --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 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.