diff mbox series

[v1,1/5] scsi: Adjust DBD setting in mode sense for caching mode page per LLD

Message ID 1572234608-32654-2-git-send-email-cang@codeaurora.org (mailing list archive)
State Superseded
Headers show
Series UFS driver general fixes bundle 1 | expand

Commit Message

Can Guo Oct. 28, 2019, 3:50 a.m. UTC
Host sends MODE_SENSE_10 with caching mode page, to check if the device
supports the cache feature.
Some LLD standards requires DBD field to be set to 1.

This patch allows LLD to define the setting of DBD if required.

Change-Id: I0c8752c1888654942d6d7e6e0f6dc197033ac326
Signed-off-by: Can Guo <cang@codeaurora.org>
---
 drivers/scsi/sd.c        | 6 +++++-
 include/scsi/scsi_host.h | 6 ++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

Comments

Bart Van Assche Oct. 28, 2019, 2:58 p.m. UTC | #1
On 10/27/19 8:50 PM, Can Guo wrote:
> Host sends MODE_SENSE_10 with caching mode page, to check if the device
> supports the cache feature.
> Some LLD standards requires DBD field to be set to 1.

Which LLD standard are you referring to? Please mention at least one 
name of such a standard in the patch description.

> Change-Id: I0c8752c1888654942d6d7e6e0f6dc197033ac326

Change-IDs should be left out from upstream patches. Does the presence 
of this ID mean that this patch has not been verified with checkpatch? 
 From the checkpatch source code:

# Check for unwanted Gerrit info
if ($in_commit_log && $line =~ /^\s*change-id:/i) {
	ERROR("GERRIT_CHANGE_ID",
	      "Remove Gerrit Change-Id's before submitting upstream.\n"\
		 . $herecurr);
}

> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index aab4ed8..6d8194f 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -2629,6 +2629,7 @@ static int sd_try_rc16_first(struct scsi_device *sdp)
>   {
>   	int len = 0, res;
>   	struct scsi_device *sdp = sdkp->device;
> +	struct Scsi_Host *host = sdp->host;
>   
>   	int dbd;
>   	int modepage;
> @@ -2660,7 +2661,10 @@ static int sd_try_rc16_first(struct scsi_device *sdp)
>   		dbd = 8;
>   	} else {
>   		modepage = 8;
> -		dbd = 0;
> +		if (host->set_dbd_for_caching)
> +			dbd = 8;
> +		else
> +			dbd = 0;
>   	}
>   
>   	/* cautiously ask */
> diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
> index 2c3f0c5..3900987 100644
> --- a/include/scsi/scsi_host.h
> +++ b/include/scsi/scsi_host.h
> @@ -650,6 +650,12 @@ struct Scsi_Host {
>   	unsigned no_scsi2_lun_in_cdb:1;
>   
>   	/*
> +	 * Set "DBD" field in mode_sense caching mode page in case it is
> +	 * mandatory by LLD standard.
> +	 */
> +	unsigned set_dbd_for_caching:1;
> +
> +	/*
>   	 * Optional work queue to be utilized by the transport
>   	 */
>   	char work_q_name[20];

Since this patch by itself has no effect, please resubmit this patch 
together with the LLD patch that sets set_dbd_for_caching.

Thanks,

Bart.
Bart Van Assche Oct. 28, 2019, 3:01 p.m. UTC | #2
On 10/28/19 7:58 AM, Bart Van Assche wrote:
> Since this patch by itself has no effect, please resubmit this patch 
> together with the LLD patch that sets set_dbd_for_caching.

Please ignore this part of my email. Patch 1/5 showed up in my inbox 
before the rest of this patch series.

Bart.
Can Guo Oct. 29, 2019, 2:14 a.m. UTC | #3
On 2019-10-28 22:58, Bart Van Assche wrote:
> On 10/27/19 8:50 PM, Can Guo wrote:
>> Host sends MODE_SENSE_10 with caching mode page, to check if the 
>> device
>> supports the cache feature.
>> Some LLD standards requires DBD field to be set to 1.
> 
> Which LLD standard are you referring to? Please mention at least one
> name of such a standard in the patch description.
> 

Hi Bart, Thank you for your review.

The LLD standard here is UFS. I will update the commit message and 
re-upload it later.

Thanks,

Can Guo

>> Change-Id: I0c8752c1888654942d6d7e6e0f6dc197033ac326
> 
> Change-IDs should be left out from upstream patches. Does the presence
> of this ID mean that this patch has not been verified with checkpatch?
> From the checkpatch source code:
> 
> # Check for unwanted Gerrit info
> if ($in_commit_log && $line =~ /^\s*change-id:/i) {
> 	ERROR("GERRIT_CHANGE_ID",
> 	      "Remove Gerrit Change-Id's before submitting upstream.\n"\
> 		 . $herecurr);
> }
> 

Sorry, forgot to remove the change-id.

>> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
>> index aab4ed8..6d8194f 100644
>> --- a/drivers/scsi/sd.c
>> +++ b/drivers/scsi/sd.c
>> @@ -2629,6 +2629,7 @@ static int sd_try_rc16_first(struct scsi_device 
>> *sdp)
>>   {
>>   	int len = 0, res;
>>   	struct scsi_device *sdp = sdkp->device;
>> +	struct Scsi_Host *host = sdp->host;
>>     	int dbd;
>>   	int modepage;
>> @@ -2660,7 +2661,10 @@ static int sd_try_rc16_first(struct scsi_device 
>> *sdp)
>>   		dbd = 8;
>>   	} else {
>>   		modepage = 8;
>> -		dbd = 0;
>> +		if (host->set_dbd_for_caching)
>> +			dbd = 8;
>> +		else
>> +			dbd = 0;
>>   	}
>>     	/* cautiously ask */
>> diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
>> index 2c3f0c5..3900987 100644
>> --- a/include/scsi/scsi_host.h
>> +++ b/include/scsi/scsi_host.h
>> @@ -650,6 +650,12 @@ struct Scsi_Host {
>>   	unsigned no_scsi2_lun_in_cdb:1;
>>     	/*
>> +	 * Set "DBD" field in mode_sense caching mode page in case it is
>> +	 * mandatory by LLD standard.
>> +	 */
>> +	unsigned set_dbd_for_caching:1;
>> +
>> +	/*
>>   	 * Optional work queue to be utilized by the transport
>>   	 */
>>   	char work_q_name[20];
> 
> Since this patch by itself has no effect, please resubmit this patch
> together with the LLD patch that sets set_dbd_for_caching.
> 
> Thanks,
> 
> Bart.
diff mbox series

Patch

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index aab4ed8..6d8194f 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2629,6 +2629,7 @@  static int sd_try_rc16_first(struct scsi_device *sdp)
 {
 	int len = 0, res;
 	struct scsi_device *sdp = sdkp->device;
+	struct Scsi_Host *host = sdp->host;
 
 	int dbd;
 	int modepage;
@@ -2660,7 +2661,10 @@  static int sd_try_rc16_first(struct scsi_device *sdp)
 		dbd = 8;
 	} else {
 		modepage = 8;
-		dbd = 0;
+		if (host->set_dbd_for_caching)
+			dbd = 8;
+		else
+			dbd = 0;
 	}
 
 	/* cautiously ask */
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 2c3f0c5..3900987 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -650,6 +650,12 @@  struct Scsi_Host {
 	unsigned no_scsi2_lun_in_cdb:1;
 
 	/*
+	 * Set "DBD" field in mode_sense caching mode page in case it is
+	 * mandatory by LLD standard.
+	 */
+	unsigned set_dbd_for_caching:1;
+
+	/*
 	 * Optional work queue to be utilized by the transport
 	 */
 	char work_q_name[20];