diff mbox series

scsi: lpfc: do not set queue->page_count to 0 if pc_sli4_params.wqpcnt is invalid

Message ID 20181213202516.7940-1-emilne@redhat.com (mailing list archive)
State Accepted
Headers show
Series scsi: lpfc: do not set queue->page_count to 0 if pc_sli4_params.wqpcnt is invalid | expand

Commit Message

Ewan Milne Dec. 13, 2018, 8:25 p.m. UTC
Certain older adapters such as the OneConnect OCe10100 may not have a valid wqpcnt
value.  In this case, do not set queue->page_count to 0 in lpfc_sli4_queue_alloc()
as this will prevent the driver from initializing.

Fixes: 895427bd01 ("scsi: lpfc: NVME Initiator: Base modifications")
Cc: stable@vger.kernel.org # 4.11+
Signed-off-by: Ewan D. Milne <emilne@redhat.com>
---
 drivers/scsi/lpfc/lpfc_sli.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Laurence Oberman Dec. 13, 2018, 8:29 p.m. UTC | #1
On Thu, 2018-12-13 at 15:25 -0500, Ewan D. Milne wrote:
> Certain older adapters such as the OneConnect OCe10100 may not have a
> valid wqpcnt
> value.  In this case, do not set queue->page_count to 0 in
> lpfc_sli4_queue_alloc()
> as this will prevent the driver from initializing.
> 
> Fixes: 895427bd01 ("scsi: lpfc: NVME Initiator: Base modifications")
> Cc: stable@vger.kernel.org # 4.11+
> Signed-off-by: Ewan D. Milne <emilne@redhat.com>
> ---
>  drivers/scsi/lpfc/lpfc_sli.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/lpfc/lpfc_sli.c
> b/drivers/scsi/lpfc/lpfc_sli.c
> index b9e5cd7..462ed4a 100644
> --- a/drivers/scsi/lpfc/lpfc_sli.c
> +++ b/drivers/scsi/lpfc/lpfc_sli.c
> @@ -14501,7 +14501,8 @@ lpfc_sli4_queue_alloc(struct lpfc_hba *phba,
> uint32_t page_size,
>  			hw_page_size))/hw_page_size;
>  
>  	/* If needed, Adjust page count to match the max the adapter
> supports */
> -	if (queue->page_count > phba-
> >sli4_hba.pc_sli4_params.wqpcnt)
> +	if (phba->sli4_hba.pc_sli4_params.wqpcnt &&
> +	    (queue->page_count > phba-
> >sli4_hba.pc_sli4_params.wqpcnt))
>  		queue->page_count = phba-
> >sli4_hba.pc_sli4_params.wqpcnt;
>  
>  	INIT_LIST_HEAD(&queue->list);

Compiled and test to bring up card fully and connect to switch port the
Red Hat Lab.

Reviewed-by: Laurence Oberman <loberman@redhat.com>
Tested-by:   Laurence Oberman <loberman@redhat.com>
Martin K. Petersen Dec. 19, 2018, 4:26 a.m. UTC | #2
Ewan,

> Certain older adapters such as the OneConnect OCe10100 may not have a
> valid wqpcnt value.  In this case, do not set queue->page_count to 0
> in lpfc_sli4_queue_alloc() as this will prevent the driver from
> initializing.

Applied to 4.21/scsi-queue, thanks!
diff mbox series

Patch

diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index b9e5cd7..462ed4a 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -14501,7 +14501,8 @@  lpfc_sli4_queue_alloc(struct lpfc_hba *phba, uint32_t page_size,
 			hw_page_size))/hw_page_size;
 
 	/* If needed, Adjust page count to match the max the adapter supports */
-	if (queue->page_count > phba->sli4_hba.pc_sli4_params.wqpcnt)
+	if (phba->sli4_hba.pc_sli4_params.wqpcnt &&
+	    (queue->page_count > phba->sli4_hba.pc_sli4_params.wqpcnt))
 		queue->page_count = phba->sli4_hba.pc_sli4_params.wqpcnt;
 
 	INIT_LIST_HEAD(&queue->list);