Skip to content

Commit f6ce4e3

Browse files
jsmart-ghgregkh
authored andcommitted
scsi: lpfc: Fix pt2pt NVMe PRLI reject LOGO loop
commit 7f4c5a2 upstream. When connected point to point, the driver does not know the FC4's supported by the other end. In Fabrics, it can query the nameserver. Thus the driver must send PRLIs for the FC4s it supports and enable support based on the acc(ept) or rej(ect) of the respective FC4 PRLI. Currently the driver supports SCSI and NVMe PRLIs. Unfortunately, although the behavior is per standard, many devices have come to expect only SCSI PRLIs. In this particular example, the NVMe PRLI is properly RJT'd but the target decided that it must LOGO after seeing the unexpected NVMe PRLI. The LOGO causes the sequence to restart and login is now in an infinite failure loop. Fix the problem by having the driver, on a pt2pt link, remember NVMe PRLI accept or reject status across logout as long as the link stays "up". When retrying login, if the prior NVMe PRLI was rejected, it will not be sent on the next login. Link: https://lore.kernel.org/r/20220212163120.15385-1-jsmart2021@gmail.com Cc: <stable@vger.kernel.org> # v5.4+ Reviewed-by: Ewan D. Milne <emilne@redhat.com> Signed-off-by: James Smart <jsmart2021@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3680b2b commit f6ce4e3

4 files changed

Lines changed: 26 additions & 3 deletions

File tree

‎drivers/scsi/lpfc/lpfc.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ struct lpfc_vport {
374374
#define FC_VPORT_LOGO_RCVD 0x200 /* LOGO received on vport */
375375
#define FC_RSCN_DISCOVERY 0x400 /* Auth all devices after RSCN */
376376
#define FC_LOGO_RCVD_DID_CHNG 0x800 /* FDISC on phys port detect DID chng*/
377+
#define FC_PT2PT_NO_NVME 0x1000 /* Don't send NVME PRLI */
377378
#define FC_SCSI_SCAN_TMO 0x4000 /* scsi scan timer running */
378379
#define FC_ABORT_DISCOVERY 0x8000 /* we want to abort discovery */
379380
#define FC_NDISC_ACTIVE 0x10000 /* NPort discovery active */

‎drivers/scsi/lpfc/lpfc_attr.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,6 +1142,9 @@ lpfc_issue_lip(struct Scsi_Host *shost)
11421142
pmboxq->u.mb.mbxCommand = MBX_DOWN_LINK;
11431143
pmboxq->u.mb.mbxOwner = OWN_HOST;
11441144

1145+
if ((vport->fc_flag & FC_PT2PT) && (vport->fc_flag & FC_PT2PT_NO_NVME))
1146+
vport->fc_flag &= ~FC_PT2PT_NO_NVME;
1147+
11451148
mbxstatus = lpfc_sli_issue_mbox_wait(phba, pmboxq, LPFC_MBOX_TMO * 2);
11461149

11471150
if ((mbxstatus == MBX_SUCCESS) &&

‎drivers/scsi/lpfc/lpfc_els.c‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,8 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
10671067

10681068
/* FLOGI failed, so there is no fabric */
10691069
spin_lock_irq(shost->host_lock);
1070-
vport->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP);
1070+
vport->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP |
1071+
FC_PT2PT_NO_NVME);
10711072
spin_unlock_irq(shost->host_lock);
10721073

10731074
/* If private loop, then allow max outstanding els to be
@@ -3945,6 +3946,23 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
39453946
/* Added for Vendor specifc support
39463947
* Just keep retrying for these Rsn / Exp codes
39473948
*/
3949+
if ((vport->fc_flag & FC_PT2PT) &&
3950+
cmd == ELS_CMD_NVMEPRLI) {
3951+
switch (stat.un.b.lsRjtRsnCode) {
3952+
case LSRJT_UNABLE_TPC:
3953+
case LSRJT_INVALID_CMD:
3954+
case LSRJT_LOGICAL_ERR:
3955+
case LSRJT_CMD_UNSUPPORTED:
3956+
lpfc_printf_vlog(vport, KERN_WARNING, LOG_ELS,
3957+
"0168 NVME PRLI LS_RJT "
3958+
"reason %x port doesn't "
3959+
"support NVME, disabling NVME\n",
3960+
stat.un.b.lsRjtRsnCode);
3961+
retry = 0;
3962+
vport->fc_flag |= FC_PT2PT_NO_NVME;
3963+
goto out_retry;
3964+
}
3965+
}
39483966
switch (stat.un.b.lsRjtRsnCode) {
39493967
case LSRJT_UNABLE_TPC:
39503968
/* The driver has a VALID PLOGI but the rport has

‎drivers/scsi/lpfc/lpfc_nportdisc.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2010,8 +2010,9 @@ lpfc_cmpl_reglogin_reglogin_issue(struct lpfc_vport *vport,
20102010
* is configured try it.
20112011
*/
20122012
ndlp->nlp_fc4_type |= NLP_FC4_FCP;
2013-
if ((vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) ||
2014-
(vport->cfg_enable_fc4_type == LPFC_ENABLE_NVME)) {
2013+
if ((!(vport->fc_flag & FC_PT2PT_NO_NVME)) &&
2014+
(vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH ||
2015+
vport->cfg_enable_fc4_type == LPFC_ENABLE_NVME)) {
20152016
ndlp->nlp_fc4_type |= NLP_FC4_NVME;
20162017
/* We need to update the localport also */
20172018
lpfc_nvme_update_localport(vport);

0 commit comments

Comments
 (0)