Commit 58c36e80 authored by James Smart's avatar James Smart Committed by Martin K. Petersen

scsi: lpfc: Fix vport indices in lpfc_find_vport_by_vpid()

Calls to lpfc_find_vport_by_vpid() for the highest indexed vport fails with
error, "2936 Could not find Vport mapped to vpi XXX".  Our vport indices in
the loop and if-clauses were off by one.

Correct the vpid range used for vpi lookup to include the highest possible
vpid.

Link: https://lore.kernel.org/r/20210301171821.3427-3-jsmart2021@gmail.comCo-developed-by: default avatarDick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: default avatarDick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: default avatarJames Smart <jsmart2021@gmail.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 9302154c
...@@ -6081,12 +6081,12 @@ lpfc_find_vport_by_vpid(struct lpfc_hba *phba, uint16_t vpi) ...@@ -6081,12 +6081,12 @@ lpfc_find_vport_by_vpid(struct lpfc_hba *phba, uint16_t vpi)
* Translate the physical vpi to the logical vpi. The * Translate the physical vpi to the logical vpi. The
* vport stores the logical vpi. * vport stores the logical vpi.
*/ */
for (i = 0; i < phba->max_vpi; i++) { for (i = 0; i <= phba->max_vpi; i++) {
if (vpi == phba->vpi_ids[i]) if (vpi == phba->vpi_ids[i])
break; break;
} }
if (i >= phba->max_vpi) { if (i > phba->max_vpi) {
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
"2936 Could not find Vport mapped " "2936 Could not find Vport mapped "
"to vpi %d\n", vpi); "to vpi %d\n", vpi);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment