From patchwork Mon Aug 31 20:48:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 7101591 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 883D7BEEC1 for ; Mon, 31 Aug 2015 20:48:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ACD88206A7 for ; Mon, 31 Aug 2015 20:48:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BEC97206A4 for ; Mon, 31 Aug 2015 20:48:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753291AbbHaUsp (ORCPT ); Mon, 31 Aug 2015 16:48:45 -0400 Received: from mail-qg0-f43.google.com ([209.85.192.43]:36626 "EHLO mail-qg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753249AbbHaUsf (ORCPT ); Mon, 31 Aug 2015 16:48:35 -0400 Received: by qgeb6 with SMTP id b6so73668912qge.3 for ; Mon, 31 Aug 2015 13:48:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=avagotech.com; s=google; h=date:from:to:subject:message-id:user-agent:mime-version :content-type:content-transfer-encoding; bh=09HVOb1IQDZNAAbzGY6MpKyJXD+hR7PGkzdBciJS16Y=; b=ITEohfAPfq/fw02Y/LxwHc7q3MU4PhkKLtneM1Cskj0xOITb2fhW2XdZVaRcdgdOTW 5ONMWI2GN0FvG1+np1Ye99oJn+4BtH+bqzuQHssimpjNvjGpuscMNHj4VQkPOK0qBU/7 UgZwB+H2jRY3rfZ0LNg9G4nnAHbS8Kik0QdW0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:user-agent :mime-version:content-type:content-transfer-encoding; bh=09HVOb1IQDZNAAbzGY6MpKyJXD+hR7PGkzdBciJS16Y=; b=awMzpda0tdS43KdZkid+4SRscQzCdYzo7kYo9UbHeRSnCbrD6K4N8VsEQ9wfGG1yBI fOROiRASlq6WUnWw8M3c0c6ON33OgY+9q1KpwVV6nCJFQrWnaa1LzaAq9iY68lgW0tvv bUR1uR89+PyyzvLn6qWOrjQiuDbhi1Tqv949u5ugjleJQCkIZcCYn0Bs/wy++CehGX+v z+5FGXTD80c9JUDX5pcvDkrDSu/voMMeFyAo0V/LR+hVaEiMZeMQWuQbU+9ni4WreHDo 1yLDCZSfLqkWoZ4f2jTl0mT9OUok3Hr8seUvqHYbtEfXr1oRInR+qdnWJWyBq9ssgOkI NqhQ== X-Gm-Message-State: ALoCoQlEXlyfu5vwMtHjrvfcwdyyIsApxBzJhHiOGrLqb4//cUaMmHsyfMqe8SAzCBF+SbgJgzt1 X-Received: by 10.140.232.135 with SMTP id d129mr5515292qhc.34.1441054114291; Mon, 31 Aug 2015 13:48:34 -0700 (PDT) Received: from myfc17 (c-75-67-235-135.hsd1.nh.comcast.net. [75.67.235.135]) by smtp.gmail.com with ESMTPSA id 139sm1709033qhh.32.2015.08.31.13.48.33 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 31 Aug 2015 13:48:33 -0700 (PDT) Date: Mon, 31 Aug 2015 16:48:18 -0400 From: james.smart@avagotech.com (James Smart) To: linux-scsi@vger.kernel.org Subject: [PATCH 11/14] lpfc: Fix for discovery failure in PT2PT when FLOGI's ELS ACC response gets aborted Message-ID: <55e4bd92.KegerC79Wj93PQSl%james.smart@avagotech.com> User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix for discovery failure in PT2PT when FLOGI's ELS ACC response gets aborted Change login state machine to: - Restart FLOGI if prior is ABTS'd - Reject incoming FLOGIs if we have one pending The above ensures that we always finish FLOGI processing, regardless of who initated FLOGI, before processing PLOGI's. Signed-off-by: Dick Kennedy Signed-off-by: James Smart Reviewed-by: Hannes Reinecke --- drivers/scsi/lpfc/lpfc_els.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 598313d..759fa9b 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -5850,6 +5850,13 @@ lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, return 1; } + /* send our FLOGI first */ + if (vport->port_state < LPFC_FLOGI) { + vport->fc_myDID = 0; + lpfc_initial_flogi(vport); + vport->fc_myDID = Fabric_DID; + } + /* Send back ACC */ lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, NULL); @@ -7324,6 +7331,15 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, "Data: x%x x%x x%x x%x\n", cmd, did, vport->port_state, vport->fc_flag, vport->fc_myDID, vport->fc_prevDID); + + /* reject till our FLOGI completes */ + if ((vport->port_state < LPFC_FABRIC_CFG_LINK) && + (cmd != ELS_CMD_FLOGI)) { + rjt_err = LSRJT_UNABLE_TPC; + rjt_exp = LSEXP_NOTHING_MORE; + goto lsrjt; + } + switch (cmd) { case ELS_CMD_PLOGI: lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, @@ -7361,20 +7377,6 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, rjt_exp = LSEXP_NOTHING_MORE; break; } - /* We get here, and drop thru, if we are PT2PT with - * another NPort and the other side has initiated - * the PLOGI before responding to our FLOGI. - */ - if (phba->sli_rev == LPFC_SLI_REV4 && - (phba->fc_topology_changed || - vport->fc_myDID != vport->fc_prevDID)) { - lpfc_unregister_fcf_prep(phba); - spin_lock_irq(shost->host_lock); - vport->fc_flag &= ~FC_VFI_REGISTERED; - spin_unlock_irq(shost->host_lock); - phba->fc_topology_changed = 0; - lpfc_issue_reg_vfi(vport); - } } spin_lock_irq(shost->host_lock); @@ -7605,6 +7607,7 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, break; } +lsrjt: /* check if need to LS_RJT received ELS cmd */ if (rjt_err) { memset(&stat, 0, sizeof(stat));