Skip to content

Commit 12e896c

Browse files
Justin Teemartinkpetersen
Justin Tee
authored andcommitted
scsi: lpfc: Reject received PRLIs with only initiator fcn role for NPIV ports
Currently, NPIV ports send PRLI_ACC to all received unsolicited PRLI requests. For an NPIV port, there is no point to PRLI_ACC if the received PRLI request has the initiator function bit set and the target function bit unset. Modify the lpfc_rcv_prli_support_check() routine to send a PRLI_RJT in such cases. NPIV ports are expected to send PRLI_ACC only if the Target function bit is set. Signed-off-by: Justin Tee <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent d472a76 commit 12e896c

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

drivers/scsi/lpfc/lpfc_nportdisc.c

+14-4
Original file line numberDiff line numberDiff line change
@@ -934,25 +934,35 @@ lpfc_rcv_prli_support_check(struct lpfc_vport *vport,
934934
struct ls_rjt stat;
935935
uint32_t *payload;
936936
uint32_t cmd;
937+
PRLI *npr;
937938

938939
payload = cmdiocb->cmd_dmabuf->virt;
939940
cmd = *payload;
941+
npr = (PRLI *)((uint8_t *)payload + sizeof(uint32_t));
942+
940943
if (vport->phba->nvmet_support) {
941944
/* Must be a NVME PRLI */
942-
if (cmd == ELS_CMD_PRLI)
945+
if (cmd == ELS_CMD_PRLI)
943946
goto out;
944947
} else {
945948
/* Initiator mode. */
946949
if (!vport->nvmei_support && (cmd == ELS_CMD_NVMEPRLI))
947950
goto out;
951+
952+
/* NPIV ports will RJT initiator only functions */
953+
if (vport->port_type == LPFC_NPIV_PORT &&
954+
npr->initiatorFunc && !npr->targetFunc)
955+
goto out;
948956
}
949957
return 1;
950958
out:
951-
lpfc_printf_vlog(vport, KERN_WARNING, LOG_NVME_DISC,
959+
lpfc_printf_vlog(vport, KERN_WARNING, LOG_DISCOVERY,
952960
"6115 Rcv PRLI (%x) check failed: ndlp rpi %d "
953-
"state x%x flags x%x\n",
961+
"state x%x flags x%x port_type: x%x "
962+
"npr->initfcn: x%x npr->tgtfcn: x%x\n",
954963
cmd, ndlp->nlp_rpi, ndlp->nlp_state,
955-
ndlp->nlp_flag);
964+
ndlp->nlp_flag, vport->port_type,
965+
npr->initiatorFunc, npr->targetFunc);
956966
memset(&stat, 0, sizeof(struct ls_rjt));
957967
stat.un.b.lsRjtRsnCode = LSRJT_CMD_UNSUPPORTED;
958968
stat.un.b.lsRjtRsnCodeExp = LSEXP_REQ_UNSUPPORTED;

0 commit comments

Comments
 (0)