From mboxrd@z Thu Jan 1 00:00:00 1970 From: James Smart Subject: [PATCH 13/15] lpfc: Fix PRLI retry handling when target rejects it. Date: Tue, 30 May 2017 23:04:37 -0700 Message-ID: <20170531060439.2073-14-jsmart2021@gmail.com> References: <20170531060439.2073-1-jsmart2021@gmail.com> Return-path: Received: from mail-qk0-f193.google.com ([209.85.220.193]:35462 "EHLO mail-qk0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751081AbdEaGFL (ORCPT ); Wed, 31 May 2017 02:05:11 -0400 Received: by mail-qk0-f193.google.com with SMTP id v195so738314qka.2 for ; Tue, 30 May 2017 23:05:10 -0700 (PDT) In-Reply-To: <20170531060439.2073-1-jsmart2021@gmail.com> Sender: linux-scsi-owner@vger.kernel.org List-Id: linux-scsi@vger.kernel.org To: linux-scsi@vger.kernel.org Cc: James Smart , Dick Kennedy , James Smart The nvmet driver was rejecting the initiator's PRLI because its reg_rpi for the PLOGI was still outstanding. The initiator would resend the PRLI without delay and get the same answer. The PRLI retries would exhaust causing the nvme initiator to set the nvmet ndlp to UNMAPPED. The driver's lpfc_els_retry handler did not have a policy for an LS_RJT with explanation CMD_IN_PROGRESS for PRLI or NVME_PRLI. This caused the delay to remain at 0 but retry set 1. Fix: When the ELS response is LS_RJT, TPC and the command was PRLI or NVME_PRLI, just set the delay to 1000 mS to get a 1 second delay on the PRLI retry. This was enough to allow the REG_RPI to complete at the target. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_els.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 8e532b39ae93..a140318d6159 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -3332,6 +3332,19 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, */ switch (stat.un.b.lsRjtRsnCode) { case LSRJT_UNABLE_TPC: + /* The driver has a VALID PLOGI but the rport has + * rejected the PRLI - can't do it now. Delay + * for 1 second and try again - don't care about + * the explanation. + */ + if (cmd == ELS_CMD_PRLI || cmd == ELS_CMD_NVMEPRLI) { + delay = 1000; + maxretry = lpfc_max_els_tries + 1; + retry = 1; + break; + } + + /* Legacy bug fix code for targets with PLOGI delays. */ if (stat.un.b.lsRjtRsnCodeExp == LSEXP_CMD_IN_PROGRESS) { if (cmd == ELS_CMD_PLOGI) { @@ -3350,9 +3363,7 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, retry = 1; break; } - if ((cmd == ELS_CMD_PLOGI) || - (cmd == ELS_CMD_PRLI) || - (cmd == ELS_CMD_NVMEPRLI)) { + if (cmd == ELS_CMD_PLOGI) { delay = 1000; maxretry = lpfc_max_els_tries + 1; retry = 1; -- 2.11.0