diff mbox series

[1/5] megaraid_sas: Limit device qd to controller qd when device qd is greater than controller qd

Message ID 20200508083838.22778-2-chandrakanth.patil@broadcom.com (mailing list archive)
State Accepted
Headers show
Series megaraid_sas: driver updates for 07.714.04.00-rc1 | expand

Commit Message

Chandrakanth Patil May 8, 2020, 8:38 a.m. UTC
Currently, driver assigns pre-defined qd when firmware provided
device qd is greater than the controller queue depth.
This change assigns controller queue depth instead of pre-defined
qd when firmware provided qd is greater than controller queue depth.

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Chandrakanth Patil <chandrakanth.patil@broadcom.com>
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Hannes Reinecke May 13, 2020, 6:20 a.m. UTC | #1
On 5/8/20 10:38 AM, Chandrakanth Patil wrote:
> Currently, driver assigns pre-defined qd when firmware provided
> device qd is greater than the controller queue depth.
> This change assigns controller queue depth instead of pre-defined
> qd when firmware provided qd is greater than controller queue depth.
> 
> Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> Signed-off-by: Chandrakanth Patil <chandrakanth.patil@broadcom.com>
> ---
>   drivers/scsi/megaraid/megaraid_sas_base.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
> index fb9c3ce..aeb5952 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -1982,9 +1982,8 @@ static void megasas_set_fw_assisted_qd(struct scsi_device *sdev,
>   
>   	if (is_target_prop) {
>   		tgt_device_qd = le32_to_cpu(instance->tgt_prop->device_qdepth);
> -		if (tgt_device_qd &&
> -		    (tgt_device_qd <= instance->host->can_queue))
> -			device_qd = tgt_device_qd;
> +		if (tgt_device_qd)
> +			device_qd = min(instance->host->can_queue, (int)tgt_device_qd);
>   	}
>   
>   	if (instance->enable_sdev_max_qd && interface_type != UNKNOWN_DRIVE)
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
diff mbox series

Patch

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index fb9c3ce..aeb5952 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -1982,9 +1982,8 @@  static void megasas_set_fw_assisted_qd(struct scsi_device *sdev,
 
 	if (is_target_prop) {
 		tgt_device_qd = le32_to_cpu(instance->tgt_prop->device_qdepth);
-		if (tgt_device_qd &&
-		    (tgt_device_qd <= instance->host->can_queue))
-			device_qd = tgt_device_qd;
+		if (tgt_device_qd)
+			device_qd = min(instance->host->can_queue, (int)tgt_device_qd);
 	}
 
 	if (instance->enable_sdev_max_qd && interface_type != UNKNOWN_DRIVE)