diff mbox series

[12/13] qla2xxx: Increase max limit of ql2xnvme_queues

Message ID 20220308082048.9774-13-njavali@marvell.com
State Superseded
Headers show
Series qla2xxx driver fixes | expand

Commit Message

Nilesh Javali March 8, 2022, 8:20 a.m. UTC
From: Shreyas Deodhar <sdeodhar@marvell.com>

Increase max limit of ql2xnvme_queues to (max_qpair - 1).

Cc: stable@vger.kernel.org
Fixes: 65120de26a547 ("scsi: qla2xxx: Add ql2xnvme_queues module param to configure number of NVMe queues")
Signed-off-by: Shreyas Deodhar <sdeodhar@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
---
 drivers/scsi/qla2xxx/qla_nvme.c | 15 ++++++++++-----
 drivers/scsi/qla2xxx/qla_nvme.h |  1 -
 drivers/scsi/qla2xxx/qla_os.c   |  1 -
 3 files changed, 10 insertions(+), 7 deletions(-)

Comments

Himanshu Madhani March 9, 2022, 7:13 p.m. UTC | #1
> On Mar 8, 2022, at 12:20 AM, Nilesh Javali <njavali@marvell.com> wrote:
> 
> From: Shreyas Deodhar <sdeodhar@marvell.com>
> 
> Increase max limit of ql2xnvme_queues to (max_qpair - 1).
> 
> Cc: stable@vger.kernel.org
> Fixes: 65120de26a547 ("scsi: qla2xxx: Add ql2xnvme_queues module param to configure number of NVMe queues")
> Signed-off-by: Shreyas Deodhar <sdeodhar@marvell.com>
> Signed-off-by: Nilesh Javali <njavali@marvell.com>
> ---
> drivers/scsi/qla2xxx/qla_nvme.c | 15 ++++++++++-----
> drivers/scsi/qla2xxx/qla_nvme.h |  1 -
> drivers/scsi/qla2xxx/qla_os.c   |  1 -
> 3 files changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c
> index 794a95b2e3b4..87c9404aa401 100644
> --- a/drivers/scsi/qla2xxx/qla_nvme.c
> +++ b/drivers/scsi/qla2xxx/qla_nvme.c
> @@ -799,17 +799,22 @@ int qla_nvme_register_hba(struct scsi_qla_host *vha)
> 	ha = vha->hw;
> 	tmpl = &qla_nvme_fc_transport;
> 
> -	if (ql2xnvme_queues < MIN_NVME_HW_QUEUES || ql2xnvme_queues > MAX_NVME_HW_QUEUES) {
> +	if (ql2xnvme_queues < MIN_NVME_HW_QUEUES) {
> 		ql_log(ql_log_warn, vha, 0xfffd,
> -		    "ql2xnvme_queues=%d is out of range(MIN:%d - MAX:%d). Resetting ql2xnvme_queues to:%d\n",
> -		    ql2xnvme_queues, MIN_NVME_HW_QUEUES, MAX_NVME_HW_QUEUES,
> -		    DEF_NVME_HW_QUEUES);
> +		    "ql2xnvme_queues=%d is lower than minimum queues: %d. Resetting ql2xnvme_queues to:%d\n",
> +		    ql2xnvme_queues, MIN_NVME_HW_QUEUES, DEF_NVME_HW_QUEUES);
> 		ql2xnvme_queues = DEF_NVME_HW_QUEUES;
> +	} else if (ql2xnvme_queues > (ha->max_qpairs - 1)) {
> +		ql_log(ql_log_warn, vha, 0xfffd,
> +		       "ql2xnvme_queues=%d is greater than available IRQs: %d. Resetting ql2xnvme_queues to: %d\n",
> +		       ql2xnvme_queues, (ha->max_qpairs - 1),
> +		       (ha->max_qpairs - 1));
> +		ql2xnvme_queues = ((ha->max_qpairs - 1));
> 	}
> 
> 	qla_nvme_fc_transport.max_hw_queues =
> 	    min((uint8_t)(ql2xnvme_queues),
> -		(uint8_t)(ha->max_qpairs ? ha->max_qpairs : 1));
> +		(uint8_t)((ha->max_qpairs - 1) ? (ha->max_qpairs - 1) : 1));
> 
> 	ql_log(ql_log_info, vha, 0xfffb,
> 	       "Number of NVME queues used for this port: %d\n",
> diff --git a/drivers/scsi/qla2xxx/qla_nvme.h b/drivers/scsi/qla2xxx/qla_nvme.h
> index d0e3c0e07baa..d299478371b2 100644
> --- a/drivers/scsi/qla2xxx/qla_nvme.h
> +++ b/drivers/scsi/qla2xxx/qla_nvme.h
> @@ -14,7 +14,6 @@
> #include "qla_dsd.h"
> 
> #define MIN_NVME_HW_QUEUES 1
> -#define MAX_NVME_HW_QUEUES 128
> #define DEF_NVME_HW_QUEUES 8
> 
> #define NVME_ATIO_CMD_OFF 32
> diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
> index 89c7ac36a41a..8f47dd421e33 100644
> --- a/drivers/scsi/qla2xxx/qla_os.c
> +++ b/drivers/scsi/qla2xxx/qla_os.c
> @@ -344,7 +344,6 @@ MODULE_PARM_DESC(ql2xnvme_queues,
> 	"Number of NVMe Queues that can be configured.\n"
> 	"Final value will be min(ql2xnvme_queues, num_cpus,num_chip_queues)\n"
> 	"1 - Minimum number of queues supported\n"
> -	"128 - Maximum number of queues supported\n"
> 	"8 - Default value");
> 
> static struct scsi_transport_template *qla2xxx_transport_template = NULL;
> -- 
> 2.19.0.rc0
> 

Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>

--
Himanshu Madhani	 Oracle Linux Engineering
diff mbox series

Patch

diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c
index 794a95b2e3b4..87c9404aa401 100644
--- a/drivers/scsi/qla2xxx/qla_nvme.c
+++ b/drivers/scsi/qla2xxx/qla_nvme.c
@@ -799,17 +799,22 @@  int qla_nvme_register_hba(struct scsi_qla_host *vha)
 	ha = vha->hw;
 	tmpl = &qla_nvme_fc_transport;
 
-	if (ql2xnvme_queues < MIN_NVME_HW_QUEUES || ql2xnvme_queues > MAX_NVME_HW_QUEUES) {
+	if (ql2xnvme_queues < MIN_NVME_HW_QUEUES) {
 		ql_log(ql_log_warn, vha, 0xfffd,
-		    "ql2xnvme_queues=%d is out of range(MIN:%d - MAX:%d). Resetting ql2xnvme_queues to:%d\n",
-		    ql2xnvme_queues, MIN_NVME_HW_QUEUES, MAX_NVME_HW_QUEUES,
-		    DEF_NVME_HW_QUEUES);
+		    "ql2xnvme_queues=%d is lower than minimum queues: %d. Resetting ql2xnvme_queues to:%d\n",
+		    ql2xnvme_queues, MIN_NVME_HW_QUEUES, DEF_NVME_HW_QUEUES);
 		ql2xnvme_queues = DEF_NVME_HW_QUEUES;
+	} else if (ql2xnvme_queues > (ha->max_qpairs - 1)) {
+		ql_log(ql_log_warn, vha, 0xfffd,
+		       "ql2xnvme_queues=%d is greater than available IRQs: %d. Resetting ql2xnvme_queues to: %d\n",
+		       ql2xnvme_queues, (ha->max_qpairs - 1),
+		       (ha->max_qpairs - 1));
+		ql2xnvme_queues = ((ha->max_qpairs - 1));
 	}
 
 	qla_nvme_fc_transport.max_hw_queues =
 	    min((uint8_t)(ql2xnvme_queues),
-		(uint8_t)(ha->max_qpairs ? ha->max_qpairs : 1));
+		(uint8_t)((ha->max_qpairs - 1) ? (ha->max_qpairs - 1) : 1));
 
 	ql_log(ql_log_info, vha, 0xfffb,
 	       "Number of NVME queues used for this port: %d\n",
diff --git a/drivers/scsi/qla2xxx/qla_nvme.h b/drivers/scsi/qla2xxx/qla_nvme.h
index d0e3c0e07baa..d299478371b2 100644
--- a/drivers/scsi/qla2xxx/qla_nvme.h
+++ b/drivers/scsi/qla2xxx/qla_nvme.h
@@ -14,7 +14,6 @@ 
 #include "qla_dsd.h"
 
 #define MIN_NVME_HW_QUEUES 1
-#define MAX_NVME_HW_QUEUES 128
 #define DEF_NVME_HW_QUEUES 8
 
 #define NVME_ATIO_CMD_OFF 32
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 89c7ac36a41a..8f47dd421e33 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -344,7 +344,6 @@  MODULE_PARM_DESC(ql2xnvme_queues,
 	"Number of NVMe Queues that can be configured.\n"
 	"Final value will be min(ql2xnvme_queues, num_cpus,num_chip_queues)\n"
 	"1 - Minimum number of queues supported\n"
-	"128 - Maximum number of queues supported\n"
 	"8 - Default value");
 
 static struct scsi_transport_template *qla2xxx_transport_template = NULL;