[v2,07/11] qla2xxx: Fix WARN_ON in qla_nvme_register_hba
diff mbox series

Message ID 20200806111014.28434-8-njavali@marvell.com
State Accepted
Headers show
Series
  • qla2xxx driver bug fixes
Related show

Commit Message

Nilesh Javali Aug. 6, 2020, 11:10 a.m. UTC
From: Arun Easi <aeasi@marvell.com>

qla_nvme_register_hba puts out a warning when there are not enough
queue pairs available for FC-NVME.
Just fail the NVME registration rather than a WARNING + Call Trace.

Signed-off-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
---
 drivers/scsi/qla2xxx/qla_def.h  |  1 +
 drivers/scsi/qla2xxx/qla_nvme.c | 10 +++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

Comments

Himanshu Madhani Aug. 12, 2020, 7:46 p.m. UTC | #1
> On Aug 6, 2020, at 6:10 AM, Nilesh Javali <njavali@marvell.com> wrote:
> 
> From: Arun Easi <aeasi@marvell.com>
> 
> qla_nvme_register_hba puts out a warning when there are not enough
> queue pairs available for FC-NVME.
> Just fail the NVME registration rather than a WARNING + Call Trace.
> 
> Signed-off-by: Arun Easi <aeasi@marvell.com>
> Signed-off-by: Nilesh Javali <njavali@marvell.com>
> ---
> drivers/scsi/qla2xxx/qla_def.h  |  1 +
> drivers/scsi/qla2xxx/qla_nvme.c | 10 +++++++++-
> 2 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
> index 8c92af5e4390..1bc090d8a71b 100644
> --- a/drivers/scsi/qla2xxx/qla_def.h
> +++ b/drivers/scsi/qla2xxx/qla_def.h
> @@ -3880,6 +3880,7 @@ struct qla_hw_data {
> 		uint32_t	scm_supported_f:1;
> 				/* Enabled in Driver */
> 		uint32_t	scm_enabled:1;
> +		uint32_t	max_req_queue_warned:1;
> 	} flags;
> 
> 	uint16_t max_exchg;
> diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c
> index d66d47a0f958..be1d49f5c622 100644
> --- a/drivers/scsi/qla2xxx/qla_nvme.c
> +++ b/drivers/scsi/qla2xxx/qla_nvme.c
> @@ -686,7 +686,15 @@ int qla_nvme_register_hba(struct scsi_qla_host *vha)
> 	tmpl = &qla_nvme_fc_transport;
> 
> 	WARN_ON(vha->nvme_local_port);
> -	WARN_ON(ha->max_req_queues < 3);
> +
> +	if (ha->max_req_queues < 3) {
> +		if (!ha->flags.max_req_queue_warned)
> +			ql_log(ql_log_info, vha, 0x2120,
> +			       "%s: Disabling FC-NVME due to lack of free queue pairs (%d).\n",
> +			       __func__, ha->max_req_queues);
> +		ha->flags.max_req_queue_warned = 1;
> +		return ret;
> +	}
> 
> 	qla_nvme_fc_transport.max_hw_queues =
> 	    min((uint8_t)(qla_nvme_fc_transport.max_hw_queues),
> -- 
> 2.19.0.rc0
> 

Makes Sense

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

--
Himanshu Madhani	 Oracle Linux Engineering

Patch
diff mbox series

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 8c92af5e4390..1bc090d8a71b 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -3880,6 +3880,7 @@  struct qla_hw_data {
 		uint32_t	scm_supported_f:1;
 				/* Enabled in Driver */
 		uint32_t	scm_enabled:1;
+		uint32_t	max_req_queue_warned:1;
 	} flags;
 
 	uint16_t max_exchg;
diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c
index d66d47a0f958..be1d49f5c622 100644
--- a/drivers/scsi/qla2xxx/qla_nvme.c
+++ b/drivers/scsi/qla2xxx/qla_nvme.c
@@ -686,7 +686,15 @@  int qla_nvme_register_hba(struct scsi_qla_host *vha)
 	tmpl = &qla_nvme_fc_transport;
 
 	WARN_ON(vha->nvme_local_port);
-	WARN_ON(ha->max_req_queues < 3);
+
+	if (ha->max_req_queues < 3) {
+		if (!ha->flags.max_req_queue_warned)
+			ql_log(ql_log_info, vha, 0x2120,
+			       "%s: Disabling FC-NVME due to lack of free queue pairs (%d).\n",
+			       __func__, ha->max_req_queues);
+		ha->flags.max_req_queue_warned = 1;
+		return ret;
+	}
 
 	qla_nvme_fc_transport.max_hw_queues =
 	    min((uint8_t)(qla_nvme_fc_transport.max_hw_queues),