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 <justin.tee@broadcom.com> Link: https://lore.kernel.org/r/20231009161812.97232-4-justintee8345@gmail.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
committed by
Martin K. Petersen
parent
d472a76603
commit
12e896c742
@ -934,25 +934,35 @@ lpfc_rcv_prli_support_check(struct lpfc_vport *vport,
|
|||||||
struct ls_rjt stat;
|
struct ls_rjt stat;
|
||||||
uint32_t *payload;
|
uint32_t *payload;
|
||||||
uint32_t cmd;
|
uint32_t cmd;
|
||||||
|
PRLI *npr;
|
||||||
|
|
||||||
payload = cmdiocb->cmd_dmabuf->virt;
|
payload = cmdiocb->cmd_dmabuf->virt;
|
||||||
cmd = *payload;
|
cmd = *payload;
|
||||||
|
npr = (PRLI *)((uint8_t *)payload + sizeof(uint32_t));
|
||||||
|
|
||||||
if (vport->phba->nvmet_support) {
|
if (vport->phba->nvmet_support) {
|
||||||
/* Must be a NVME PRLI */
|
/* Must be a NVME PRLI */
|
||||||
if (cmd == ELS_CMD_PRLI)
|
if (cmd == ELS_CMD_PRLI)
|
||||||
goto out;
|
goto out;
|
||||||
} else {
|
} else {
|
||||||
/* Initiator mode. */
|
/* Initiator mode. */
|
||||||
if (!vport->nvmei_support && (cmd == ELS_CMD_NVMEPRLI))
|
if (!vport->nvmei_support && (cmd == ELS_CMD_NVMEPRLI))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
/* NPIV ports will RJT initiator only functions */
|
||||||
|
if (vport->port_type == LPFC_NPIV_PORT &&
|
||||||
|
npr->initiatorFunc && !npr->targetFunc)
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
out:
|
out:
|
||||||
lpfc_printf_vlog(vport, KERN_WARNING, LOG_NVME_DISC,
|
lpfc_printf_vlog(vport, KERN_WARNING, LOG_DISCOVERY,
|
||||||
"6115 Rcv PRLI (%x) check failed: ndlp rpi %d "
|
"6115 Rcv PRLI (%x) check failed: ndlp rpi %d "
|
||||||
"state x%x flags x%x\n",
|
"state x%x flags x%x port_type: x%x "
|
||||||
|
"npr->initfcn: x%x npr->tgtfcn: x%x\n",
|
||||||
cmd, ndlp->nlp_rpi, ndlp->nlp_state,
|
cmd, ndlp->nlp_rpi, ndlp->nlp_state,
|
||||||
ndlp->nlp_flag);
|
ndlp->nlp_flag, vport->port_type,
|
||||||
|
npr->initiatorFunc, npr->targetFunc);
|
||||||
memset(&stat, 0, sizeof(struct ls_rjt));
|
memset(&stat, 0, sizeof(struct ls_rjt));
|
||||||
stat.un.b.lsRjtRsnCode = LSRJT_CMD_UNSUPPORTED;
|
stat.un.b.lsRjtRsnCode = LSRJT_CMD_UNSUPPORTED;
|
||||||
stat.un.b.lsRjtRsnCodeExp = LSEXP_REQ_UNSUPPORTED;
|
stat.un.b.lsRjtRsnCodeExp = LSEXP_REQ_UNSUPPORTED;
|
||||||
|
Reference in New Issue
Block a user