From patchwork Sat Dec 4 00:26:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 520741 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8645AC433FE for ; Sat, 4 Dec 2021 00:26:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354449AbhLDAaR (ORCPT ); Fri, 3 Dec 2021 19:30:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344630AbhLDAaQ (ORCPT ); Fri, 3 Dec 2021 19:30:16 -0500 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC2F6C061353 for ; Fri, 3 Dec 2021 16:26:51 -0800 (PST) Received: by mail-pg1-x534.google.com with SMTP id s37so4606382pga.9 for ; Fri, 03 Dec 2021 16:26:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ur/r6wT/Vkx34niFpBt5uzndAh1CFO1vZCZdCvcCCxg=; b=FervtfrDDlhkyT/du5h87yCB7RpDpPr02S9TKP7GRSFXVdsomMRlI3+PuyJpTHyUdD G+1TAo/QQ7pbN74ZuSiw0BMeopk9ze16FmnMJVD0xQB8n/uuTXg9Yqixo1uplxqM9maf 5pO2Pdl+/Etzq60IZmfsPvbUQWFZhEa1kIqbo08BbJ+CN75luO+irRskuNNLGqxiFHlS aQRJVu6aCxgtdZE7+P1r7M8LqXpQAPzmYxf4ts+ewv0cYn0y7lvmaZ6a0x2s4m0g8/ib qPo2eMdCW9AcAvVzc8C70pdgR4czBL/OUxQ4Bac444IlMYzZyARyXOrn4l2YtNh/xiZ2 R0Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ur/r6wT/Vkx34niFpBt5uzndAh1CFO1vZCZdCvcCCxg=; b=1Ppfhmrf1TbExRAyCC8Jpd88r30ASd06PpmoSOofbVg7ck0XGexBj/G8VCAvAjv5Bf te2CBc7BquKyHYTyOrA4boB1qr7RmkzgNuZvbelxCFfmZNpXRpVgpfHn2nrZIw0c6S8A rHwdB3JHEeUkjoFV2Pjwu2JEO1H+E0IqwVIhi00mzKSKKRXl3HGNHuYtJ5ljJTR5333X wWRExeOKcOIEomd/nklZF5kz/UmjJOdRjZJbW3TLHM7NnOZc1yJbBYEJZFgO8FMVPcJc Ci404ve3k7Xc/2R6J/bX5l7bs3LncfSJkV3BFYDp/LiBSorPT0nOWDrRVXbIIoPBLJvo CWtA== X-Gm-Message-State: AOAM5339j2cgEvIkJ1QaJUeC1BrBrrnl+acrQqIjC+BA0QmsJLOJTs1M FwVztgnxBwgqbKD+EaUStETENi2AWSI= X-Google-Smtp-Source: ABdhPJysXjvIRshm1X8WO8oDfqW/j0BiOD5yNcVSZM9BFKrgewPuKz/pgI12hvlzqSenIHt2QuPpxw== X-Received: by 2002:a05:6a00:ac6:b029:374:a33b:a74 with SMTP id c6-20020a056a000ac6b0290374a33b0a74mr22161365pfl.51.1638577611194; Fri, 03 Dec 2021 16:26:51 -0800 (PST) Received: from mail-lvn-it-01.broadcom.com ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id q17sm4970707pfu.117.2021.12.03.16.26.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Dec 2021 16:26:50 -0800 (PST) From: James Smart To: linux-scsi@vger.kernel.org Cc: James Smart , Justin Tee Subject: [PATCH 1/9] lpfc: Fix leaked lpfc_dmabuf mbox allocations with npiv Date: Fri, 3 Dec 2021 16:26:36 -0800 Message-Id: <20211204002644.116455-2-jsmart2021@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20211204002644.116455-1-jsmart2021@gmail.com> References: <20211204002644.116455-1-jsmart2021@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org During rmmod testing, messages appeared indicating lpfc_mbuf_pool entries were still busy. This situation was only seen doing rmmod after at least 1 vport (NPIV) instance was created and destroyed. The number of messages scaled with the number of vports created. When a vport is created, it can receive a PLOGI from another initiator Nport. When this happens, the driver prepares to ack the plogi and prepares an RPI for registration (via mbx cmd) which includes an mbuf allocation. During the unsolicited plogi processing and after the rpi preparation, the driver recognizes it's one of the vport instances and decides to reject the PLOGI. During the LS_RJT preparation for the PLOGI, the mailbox struct allocated for RPI registration is freed, but the mbuf that was also allocated is not released. Fix by freeing the mbuf with the mailbox struct in the LS_RJT path. As part of the code review to figure the issue out, a couple of other areas where found that also would not have released the mbuf. Those are cleaned up as well. Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_els.c | 6 +++++- drivers/scsi/lpfc/lpfc_init.c | 8 ++++++-- drivers/scsi/lpfc/lpfc_nportdisc.c | 6 ++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index e83453bea2ae..5c10416c1c75 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -6899,6 +6899,7 @@ static int lpfc_get_rdp_info(struct lpfc_hba *phba, struct lpfc_rdp_context *rdp_context) { LPFC_MBOXQ_t *mbox = NULL; + struct lpfc_dmabuf *mp; int rc; mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); @@ -6914,8 +6915,11 @@ lpfc_get_rdp_info(struct lpfc_hba *phba, struct lpfc_rdp_context *rdp_context) mbox->mbox_cmpl = lpfc_mbx_cmpl_rdp_page_a0; mbox->ctx_ndlp = (struct lpfc_rdp_context *)rdp_context; rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT); - if (rc == MBX_NOT_FINISHED) + if (rc == MBX_NOT_FINISHED) { + mp = (struct lpfc_dmabuf *)mbox->ctx_buf; + lpfc_mbuf_free(phba, mp->virt, mp->phys); goto issue_mbox_fail; + } return 0; diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index ba17a8f740a9..7628b0634c57 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -5373,8 +5373,10 @@ lpfc_sli4_async_link_evt(struct lpfc_hba *phba, */ if (!(phba->hba_flag & HBA_FCOE_MODE)) { rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); - if (rc == MBX_NOT_FINISHED) + if (rc == MBX_NOT_FINISHED) { + lpfc_mbuf_free(phba, mp->virt, mp->phys); goto out_free_dmabuf; + } return; } /* @@ -6337,8 +6339,10 @@ lpfc_sli4_async_fc_evt(struct lpfc_hba *phba, struct lpfc_acqe_fc_la *acqe_fc) } rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); - if (rc == MBX_NOT_FINISHED) + if (rc == MBX_NOT_FINISHED) { + lpfc_mbuf_free(phba, mp->virt, mp->phys); goto out_free_dmabuf; + } return; out_free_dmabuf: diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c index 27263f02ab9f..7d717a4ac14d 100644 --- a/drivers/scsi/lpfc/lpfc_nportdisc.c +++ b/drivers/scsi/lpfc/lpfc_nportdisc.c @@ -322,6 +322,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, { struct lpfc_hba *phba = vport->phba; struct lpfc_dmabuf *pcmd; + struct lpfc_dmabuf *mp; uint64_t nlp_portwwn = 0; uint32_t *lp; IOCB_t *icmd; @@ -571,6 +572,11 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, * a default RPI. */ if (phba->sli_rev == LPFC_SLI_REV4) { + mp = (struct lpfc_dmabuf *)login_mbox->ctx_buf; + if (mp) { + lpfc_mbuf_free(phba, mp->virt, mp->phys); + kfree(mp); + } mempool_free(login_mbox, phba->mbox_mem_pool); login_mbox = NULL; } else { From patchwork Sat Dec 4 00:26:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 520912 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9EF6C4332F for ; Sat, 4 Dec 2021 00:26:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354477AbhLDAaS (ORCPT ); Fri, 3 Dec 2021 19:30:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354412AbhLDAaQ (ORCPT ); Fri, 3 Dec 2021 19:30:16 -0500 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D2B4C061751 for ; Fri, 3 Dec 2021 16:26:52 -0800 (PST) Received: by mail-pg1-x534.google.com with SMTP id 200so4656632pga.1 for ; Fri, 03 Dec 2021 16:26:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Wo2Im+69e7cDpOGpRnEBqx1Tl2DuIRRR2RoQczgIUYA=; b=MPR9jxb2RHIwlZkoYGFp137Nnr5zlb11ITBEIa0ySrfDvA4w3hug3xBYs97V4xiddX dfjCFyyk+Sw+QCFtMYra9isRXhMn5Up4CnnFrt/L3RKCqGXQ7hsyDOJ5d4zT0K0NzDz5 f03m+Ed4Argt/89CAkqx1wj+VYIzOW6MZ1HutVeV+3p+PMCZgZSLc2SJYmG1Oemmxbdf DNllz2tN3R1phx01+5Zvhl798qGyJ5u6/hqpAC7L5O1b/GHoiLetal98M44ntsvd7wod byOefC95meVfXtiK5B4XFwJTr1X95AL5GIVDOJ+Tb5+V8G4p1u7P2d2J+APxeSqsiKLS lvPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Wo2Im+69e7cDpOGpRnEBqx1Tl2DuIRRR2RoQczgIUYA=; b=NAnawR36y+p+Lo84b9dO9J7ZzxnmN7rpauCwGHP8amPIpb/DJyxRF1bG8UA8F4Z/FN H4aJ+MdqEPXIdKnimYQuDy/rXPUMGAEA5X9HvYPG/am+bLGbJ3d4iMqfimQXQyoJFGYM 0fvObvkgFIeflOlTgse3nGo7QN6VC60hhODyRazJj4wmptUowB1eeDeqW1r0amHD+zzm IOA5ubHjhkh7XiVvAR2o5NHsKHGQqozK2/XSVoazk7loJkGNM3b4JqoKXFCxZAnLYrYK K8p69AjPnDkXSrWD8qokBGzL9oa6NjP+qptkkBzLRgkiDwOa+GjB75dnfp+PGw81BB6k WM6g== X-Gm-Message-State: AOAM531s0Yv12zJlEV9PdZimgD+e7jIGUPsCtzzT/Dx6GGw+wu/cRhD0 ufbC1xCp+szVKTdKc9O8A7oyPd10dKk= X-Google-Smtp-Source: ABdhPJw9mk6t3DeBb+djusdr3FA5ATrL9d3L/6Q1pWsFHEuNDw61/2x+rvEpZG9U3PxX+M4Yy4Tkcw== X-Received: by 2002:a05:6a00:114d:b0:4a2:87bd:37f with SMTP id b13-20020a056a00114d00b004a287bd037fmr22380199pfm.82.1638577611864; Fri, 03 Dec 2021 16:26:51 -0800 (PST) Received: from mail-lvn-it-01.broadcom.com ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id q17sm4970707pfu.117.2021.12.03.16.26.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Dec 2021 16:26:51 -0800 (PST) From: James Smart To: linux-scsi@vger.kernel.org Cc: James Smart , Justin Tee Subject: [PATCH 2/9] lpfc: Change return code on ios received during link bounce Date: Fri, 3 Dec 2021 16:26:37 -0800 Message-Id: <20211204002644.116455-3-jsmart2021@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20211204002644.116455-1-jsmart2021@gmail.com> References: <20211204002644.116455-1-jsmart2021@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org During heavy I/O testing with issue_lip to bounce the link, occasionally I/O is terminated with status 3 result 9, which means the RPI is suspended. The io is completed and this type of error will result in immediate retry by the scsi layer. The retry count expires and the io fails and returns error to the application. To avoid these quick retry/retries exhausted scenarios change the return code given to the midlayer to DID_REQUEUE rather than DID_ERROR. This gets them retried, and eventually succeed when the link recovers. Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_hw.h | 2 +- drivers/scsi/lpfc/lpfc_scsi.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h index 634f8fff7425..61c9db31d9da 100644 --- a/drivers/scsi/lpfc/lpfc_hw.h +++ b/drivers/scsi/lpfc/lpfc_hw.h @@ -3746,7 +3746,7 @@ typedef struct { #define IOERR_ILLEGAL_COMMAND 0x06 #define IOERR_XCHG_DROPPED 0x07 #define IOERR_ILLEGAL_FIELD 0x08 -#define IOERR_BAD_CONTINUE 0x09 +#define IOERR_RPI_SUSPENDED 0x09 #define IOERR_TOO_MANY_BUFFERS 0x0A #define IOERR_RCV_BUFFER_WAITING 0x0B #define IOERR_NO_CONNECTION 0x0C diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 6ccf573acdec..5a3da38a9067 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -4393,6 +4393,7 @@ lpfc_fcp_io_cmd_wqe_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn, if (lpfc_cmd->result == IOERR_INVALID_RPI || lpfc_cmd->result == IOERR_NO_RESOURCES || lpfc_cmd->result == IOERR_ABORT_REQUESTED || + lpfc_cmd->result == IOERR_RPI_SUSPENDED || lpfc_cmd->result == IOERR_SLER_CMD_RCV_FAILURE) { cmd->result = DID_REQUEUE << 16; break; @@ -4448,10 +4449,11 @@ lpfc_fcp_io_cmd_wqe_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn, lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, "9039 Iodone <%d/%llu> cmd x%px, error " - "x%x SNS x%x x%x Data: x%x x%x\n", + "x%x SNS x%x x%x LBA x%llx Data: x%x x%x\n", cmd->device->id, cmd->device->lun, cmd, - cmd->result, *lp, *(lp + 3), cmd->retries, - scsi_get_resid(cmd)); + cmd->result, *lp, *(lp + 3), + (u64)scsi_get_lba(cmd), + cmd->retries, scsi_get_resid(cmd)); } lpfc_update_stats(vport, lpfc_cmd); From patchwork Sat Dec 4 00:26:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 520740 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C66BCC433F5 for ; Sat, 4 Dec 2021 00:26:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354580AbhLDAaT (ORCPT ); Fri, 3 Dec 2021 19:30:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354465AbhLDAaR (ORCPT ); Fri, 3 Dec 2021 19:30:17 -0500 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13690C061751; Fri, 3 Dec 2021 16:26:53 -0800 (PST) Received: by mail-pf1-x429.google.com with SMTP id i12so4395348pfd.6; Fri, 03 Dec 2021 16:26:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xt4I0hFpcTJ+06LRJTbR8pOWcg/Rgjcqw9G3A/8QWVY=; b=NB2aSL/UaQ34PKQCx8Q1fjvBwXBD+2royM7CgCzBILFJyI4KNNpoI4oziud9tDhe9Q FlbKbm9O9810kcM+bN4bycWXIl9zq0GYnCnRySGDF5wTYzzQOXBnaO5NQFNXQ60Yh7Bw N/XFBz9rv+7r69SiMNhRFag157vGLKzPGM+2h7PHcqX8hKqiQsVQ8y1byMlFAKeRgN/t nKLeG1KrU4PTVsQXq0MbRpWIbEksfXj7KwfBfvWHIKzg7l02FDwTBVEA9QuOusbTQtEP UBINWWDq3a0Y36nkWRm0wkk8a/Wi/F6iQ10Xajh8vJoz0t8x/e9vKCutrgBjMt63O/yo AApA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xt4I0hFpcTJ+06LRJTbR8pOWcg/Rgjcqw9G3A/8QWVY=; b=y/Rsz6WtJfnhSSN34vGNtLpqZLYkb+Y2aCqhSVh37u/8f52uoRrFQkgrKlmtxwr/R/ rJ82+7prbqqt7Qfi4tSQkY5BJMfHWtQC+Jt1deqflJ+f5aVaL24Z322zXMx1N5kpLz2C MxB9mGvBJn7TV4BJxBw7wQCXmdULmPi8fxKZCPK9fuvrFStZnd2NHOmTGMBAhghqYtwK owaIKnURCf5uR7bQvbChch66Dq0aLKSYKlS9Nz34KGpSK5G0VmXVHOwe4IprRWt3SdeL sL/as0LgbCLDgTlCmD5YM1OoASM7c3NovvIXLoaUWU6WrEsDJE9cacRtgzvQ5iRQj8DR gTug== X-Gm-Message-State: AOAM5317D/UEKkXo2iausmKNU3LUhuEqYacywSWQLgoZpWnCFDAIyfVi fDJhxKgVYGUhe1Xa2mwKQIGpV5z1MmU= X-Google-Smtp-Source: ABdhPJy8CO5kC/1SnRRJXIPtONAsqVPcnD/drmDwKq3cK4+l6DU70/8bTAWFiAtcKzB1Ay6nKmHFEQ== X-Received: by 2002:a63:6b44:: with SMTP id g65mr7223945pgc.502.1638577612477; Fri, 03 Dec 2021 16:26:52 -0800 (PST) Received: from mail-lvn-it-01.broadcom.com ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id q17sm4970707pfu.117.2021.12.03.16.26.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Dec 2021 16:26:52 -0800 (PST) From: James Smart To: linux-scsi@vger.kernel.org Cc: James Smart , stable@vger.kernel.org, Justin Tee Subject: [PATCH 3/9] lpfc: Fix lpfc_force_rscn ndlp kref imbalance Date: Fri, 3 Dec 2021 16:26:38 -0800 Message-Id: <20211204002644.116455-4-jsmart2021@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20211204002644.116455-1-jsmart2021@gmail.com> References: <20211204002644.116455-1-jsmart2021@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Issuing lpfc_force_rscn twice results in an ndlp kref use-after-free call trace. A prior patch reworked the get/put handling by ensuring nlp_get was done before WQE submission and a put was done in the completion path. Unfortunately, the issue_els_rscn path had a piece of legacy code that did a nlp_put, causing an imbalance on the ref counts. Fixed by removing the unnecessary legacy code snippet. Fixes: 4430f7fd09ec ("scsi: lpfc: Rework locations of ndlp reference taking") Cc: # v5.11+ Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_els.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 5c10416c1c75..78024f11b794 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -3538,11 +3538,6 @@ lpfc_issue_els_rscn(struct lpfc_vport *vport, uint8_t retry) return 1; } - /* This will cause the callback-function lpfc_cmpl_els_cmd to - * trigger the release of node. - */ - if (!(vport->fc_flag & FC_PT2PT)) - lpfc_nlp_put(ndlp); return 0; } From patchwork Sat Dec 4 00:26:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 520911 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2AE7C433EF for ; Sat, 4 Dec 2021 00:26:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383709AbhLDAaW (ORCPT ); Fri, 3 Dec 2021 19:30:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354412AbhLDAaS (ORCPT ); Fri, 3 Dec 2021 19:30:18 -0500 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6AB9C061751 for ; Fri, 3 Dec 2021 16:26:53 -0800 (PST) Received: by mail-pf1-x42f.google.com with SMTP id r130so4427697pfc.1 for ; Fri, 03 Dec 2021 16:26:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=penQCOHdz+dKm0WVkjWhd8LFIt83Iq116gseXWeXtXc=; b=cesxwG6LBRbhpDgDwkFtj7qmhOC6qEbzuvraKpAPNgiRbZW0z51CGShCBrF49+AaaP Dfq8GZnudvsJaWqqK1tQw+OYvVbmFAYJKiCU+Xf9m8HCi9cd1F0LrojwOC+HAjjG9Wms Q2Em7jow47hkCdz76uL7ifrV0QmfNxYH1+rSwhT8rR6D5mFZXnNCDsayK17rWonH7t57 SEDYLwSOJL8Z9vwIMFGruTZjrzomT/JNI3oF/4nu9TyOdoUt6l0xOM3jOn+9IlWkb94E Fow+F48qcr5GksGfloP6MTHHuWTsFDIa/eK/cRDz1KD/MQR1tX6J63GvSNL43n/12j/K ZgHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=penQCOHdz+dKm0WVkjWhd8LFIt83Iq116gseXWeXtXc=; b=B+i5rrwcvAnVVTZ80tdXHEBLDoMO7yhq+r1mQM27Ot9rLGDDsCJaqJZomdAKWr1aNz cbWfwtGbAdr/g+oUwQzpDMMh26TmYvx0U7VEW65HyJIGu8ZYEEUVE1P8wAf4W9TTAClF FDqNw0o8K5yfzZnVcitHrmS2p2yOc/VeRT9z3T5dFt5mHGPs020fj4HnGoitRAphk/jk yCfSBMdu58cnHE6p6duYQ/zZSpuN4B+LE28e1bBbl2Yc8iih6/HwpzyLcpD0J8LshLbY /VYqmhHFVYfF/6Q8zKmX4f2xyX63C45rxzzIywwlfVrh5QALBLLD45aERQhZiPj1Umvc I/Cw== X-Gm-Message-State: AOAM532++SbTOtXgm7g7F9hvUXDIqkXNdPtFYoUql9+qRDHHE2kWo30v DxiyxFucjLA6Ii59IyFoMKo61oN2y1Q= X-Google-Smtp-Source: ABdhPJzZKboEzpoFnyK3ywCHWDtdj5oNXmvivc79fl4lzMcD+NBoz4NRG1+QzoZCReuAKwlu2h4iEA== X-Received: by 2002:a05:6a00:23cc:b0:49f:bfaa:e2f6 with SMTP id g12-20020a056a0023cc00b0049fbfaae2f6mr22401316pfc.35.1638577613102; Fri, 03 Dec 2021 16:26:53 -0800 (PST) Received: from mail-lvn-it-01.broadcom.com ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id q17sm4970707pfu.117.2021.12.03.16.26.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Dec 2021 16:26:52 -0800 (PST) From: James Smart To: linux-scsi@vger.kernel.org Cc: James Smart , Justin Tee Subject: [PATCH 4/9] lpfc: Fix NPIV port deletion crash Date: Fri, 3 Dec 2021 16:26:39 -0800 Message-Id: <20211204002644.116455-5-jsmart2021@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20211204002644.116455-1-jsmart2021@gmail.com> References: <20211204002644.116455-1-jsmart2021@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The driver is calling schedule_timeout after the DA_ID nameserver request and LOGO commands are issued to the fabric by the initiator virtual endport. These fixed delay functions are causing long delays in the driver's worker thread when processing discovery IOs in a serialized fashion, which is then triggering mailbox timeout errors artificially. To fix this, don't wait on the DA_ID request to complete and call wait_event_timeout to allow the vport delete thread to make progress on an event driven basis rather than fixing the wait time. Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc.h | 2 - drivers/scsi/lpfc/lpfc_els.c | 11 ++++- drivers/scsi/lpfc/lpfc_hbadisc.c | 2 - drivers/scsi/lpfc/lpfc_vport.c | 83 ++++++++++++++++++++++++-------- 4 files changed, 73 insertions(+), 25 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index 2f8e6d0a926f..a04995832459 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -669,8 +669,6 @@ struct lpfc_vport { struct timer_list els_tmofunc; struct timer_list delayed_disc_tmo; - int unreg_vpi_cmpl; - uint8_t load_flag; #define FC_LOADING 0x1 /* HBA in process of loading drvr */ #define FC_UNLOADING 0x2 /* HBA in process of unloading drvr */ diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 78024f11b794..db5ccae1b63d 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -10973,10 +10973,19 @@ lpfc_cmpl_els_npiv_logo(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, lpfc_can_disctmo(vport); } + if (ndlp->save_flags & NLP_WAIT_FOR_LOGO) { + /* Wake up lpfc_vport_delete if waiting...*/ + if (ndlp->logo_waitq) + wake_up(ndlp->logo_waitq); + spin_lock_irq(&ndlp->lock); + ndlp->nlp_flag &= ~(NLP_ISSUE_LOGO | NLP_LOGO_SND); + ndlp->save_flags &= ~NLP_WAIT_FOR_LOGO; + spin_unlock_irq(&ndlp->lock); + } + /* Safe to release resources now. */ lpfc_els_free_iocb(phba, cmdiocb); lpfc_nlp_put(ndlp); - vport->unreg_vpi_cmpl = VPORT_ERROR; } /** diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index 9fe6e5b386ce..802fd30a9fb8 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -3928,7 +3928,6 @@ lpfc_mbx_cmpl_unreg_vpi(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) vport->vpi_state &= ~LPFC_VPI_REGISTERED; vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI; spin_unlock_irq(shost->host_lock); - vport->unreg_vpi_cmpl = VPORT_OK; mempool_free(pmb, phba->mbox_mem_pool); lpfc_cleanup_vports_rrqs(vport, NULL); /* @@ -3958,7 +3957,6 @@ lpfc_mbx_unreg_vpi(struct lpfc_vport *vport) lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, "1800 Could not issue unreg_vpi\n"); mempool_free(mbox, phba->mbox_mem_pool); - vport->unreg_vpi_cmpl = VPORT_ERROR; return rc; } return 0; diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c index da9a1f72d938..d694d0cff5a5 100644 --- a/drivers/scsi/lpfc/lpfc_vport.c +++ b/drivers/scsi/lpfc/lpfc_vport.c @@ -485,23 +485,68 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) return rc; } +static int +lpfc_send_npiv_logo(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) +{ + int rc; + struct lpfc_hba *phba = vport->phba; + + DECLARE_WAIT_QUEUE_HEAD_ONSTACK(waitq); + + spin_lock_irq(&ndlp->lock); + if (!(ndlp->save_flags & NLP_WAIT_FOR_LOGO) && + !ndlp->logo_waitq) { + ndlp->logo_waitq = &waitq; + ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE; + ndlp->nlp_flag |= NLP_ISSUE_LOGO; + ndlp->save_flags |= NLP_WAIT_FOR_LOGO; + } + spin_unlock_irq(&ndlp->lock); + rc = lpfc_issue_els_npiv_logo(vport, ndlp); + if (!rc) { + wait_event_timeout(waitq, + (!(ndlp->save_flags & NLP_WAIT_FOR_LOGO)), + msecs_to_jiffies(phba->fc_ratov * 2000)); + + if (!(ndlp->save_flags & NLP_WAIT_FOR_LOGO)) + goto logo_cmpl; + /* LOGO wait failed. Correct status. */ + rc = -EINTR; + } else { + rc = -EIO; + } + + /* Error - clean up node flags. */ + spin_lock_irq(&ndlp->lock); + ndlp->nlp_flag &= ~NLP_ISSUE_LOGO; + ndlp->save_flags &= ~NLP_WAIT_FOR_LOGO; + spin_unlock_irq(&ndlp->lock); + + logo_cmpl: + lpfc_printf_vlog(vport, KERN_INFO, LOG_VPORT, + "1824 Issue LOGO completes with status %d\n", + rc); + spin_lock_irq(&ndlp->lock); + ndlp->logo_waitq = NULL; + spin_unlock_irq(&ndlp->lock); + return rc; +} + static int disable_vport(struct fc_vport *fc_vport) { struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data; struct lpfc_hba *phba = vport->phba; struct lpfc_nodelist *ndlp = NULL, *next_ndlp = NULL; - long timeout; struct Scsi_Host *shost = lpfc_shost_from_vport(vport); + /* Can't disable during an outstanding delete. */ + if (vport->load_flag & FC_UNLOADING) + return 0; + ndlp = lpfc_findnode_did(vport, Fabric_DID); - if (ndlp && phba->link_state >= LPFC_LINK_UP) { - vport->unreg_vpi_cmpl = VPORT_INVAL; - timeout = msecs_to_jiffies(phba->fc_ratov * 2000); - if (!lpfc_issue_els_npiv_logo(vport, ndlp)) - while (vport->unreg_vpi_cmpl == VPORT_INVAL && timeout) - timeout = schedule_timeout(timeout); - } + if (ndlp && phba->link_state >= LPFC_LINK_UP) + (void)lpfc_send_npiv_logo(vport, ndlp); lpfc_sli_host_down(vport); @@ -600,7 +645,7 @@ lpfc_vport_delete(struct fc_vport *fc_vport) struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data; struct Scsi_Host *shost = lpfc_shost_from_vport(vport); struct lpfc_hba *phba = vport->phba; - long timeout; + int rc; if (vport->port_type == LPFC_PHYSICAL_PORT) { lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, @@ -665,15 +710,14 @@ lpfc_vport_delete(struct fc_vport *fc_vport) phba->fc_topology != LPFC_TOPOLOGY_LOOP) { if (vport->cfg_enable_da_id) { /* Send DA_ID and wait for a completion. */ - timeout = msecs_to_jiffies(phba->fc_ratov * 2000); - if (!lpfc_ns_cmd(vport, SLI_CTNS_DA_ID, 0, 0)) - while (vport->ct_flags && timeout) - timeout = schedule_timeout(timeout); - else + rc = lpfc_ns_cmd(vport, SLI_CTNS_DA_ID, 0, 0); + if (rc) { lpfc_printf_log(vport->phba, KERN_WARNING, LOG_VPORT, "1829 CT command failed to " - "delete objects on fabric\n"); + "delete objects on fabric, " + "rc %d\n", rc); + } } /* @@ -688,11 +732,10 @@ lpfc_vport_delete(struct fc_vport *fc_vport) ndlp = lpfc_findnode_did(vport, Fabric_DID); if (!ndlp) goto skip_logo; - vport->unreg_vpi_cmpl = VPORT_INVAL; - timeout = msecs_to_jiffies(phba->fc_ratov * 2000); - if (!lpfc_issue_els_npiv_logo(vport, ndlp)) - while (vport->unreg_vpi_cmpl == VPORT_INVAL && timeout) - timeout = schedule_timeout(timeout); + + rc = lpfc_send_npiv_logo(vport, ndlp); + if (rc) + goto skip_logo; } if (!(phba->pport->load_flag & FC_UNLOADING)) From patchwork Sat Dec 4 00:26:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 520739 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EE60C433FE for ; Sat, 4 Dec 2021 00:27:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383717AbhLDAaY (ORCPT ); Fri, 3 Dec 2021 19:30:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354494AbhLDAaS (ORCPT ); Fri, 3 Dec 2021 19:30:18 -0500 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DE24C061353 for ; Fri, 3 Dec 2021 16:26:54 -0800 (PST) Received: by mail-pf1-x42f.google.com with SMTP id b68so4366391pfg.11 for ; Fri, 03 Dec 2021 16:26:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Xz8H6wq4pc21RvdktZiCAvkDGRjCb74RFrPYuwcPwJ0=; b=mU0dE7nrT7yeNWWDV+cHKWglnzCKi7FVGWR5illHzQlD66fjswXFdQju/5NN7cblRj UzuXTCsruqbyzx2LMQWfQyRBb1NfQZarf5O4wtIYSo3qdk69N0XkWnCQcBgN/sq22mVa Zqgv2aKw+EjHwF0i7bI8sCAf7eS8q7XFcM0T8yh5mEgVzNfJO8XdeYgVA0+vWie3mg9j bhCtnY5fFRcRlsmZBf6W7aR7xHGH6TFQfnLbZuk4FkmqpuJhgMCfHPs7WTPc95DYQJmR K6cRffXZ6nDZHUW2GXYPoD63mfFaoPyZqWTfjsfdQz3zxij+MU3G0zGW0VnXrj6Anta7 4TgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Xz8H6wq4pc21RvdktZiCAvkDGRjCb74RFrPYuwcPwJ0=; b=LNM0Jp9oHSsGffJoTBa8ZZ6FlLtHmeFpmeqPbtVRa9z1MLzjw7+ptzaVXOZ2smvUw9 n1Gp+2YY7ZppJHOsoNbDC0g+4S+/gYXaNij5y1Ga1uawr4k1FcYBGq3R+Oo8KvzmBC9g lAwx+m74qgY+prG/zElJ5FtzCjbol2sMLEid4GoGe0TzAMk/4VORbQBchol3WcXCAw8A 1GMdbs5o5VEQkVR+p1+19CEdlRpUkJqv+snCxYq8H1+P5DGCcQ1ixb8rTb72vT2A5Z3r E1g24GRm3BmoOzRsw78S3aWCilhy/X4kRXchcz0PkipBLzdEOhmINXtxOf+DfGkC6nR7 aNdQ== X-Gm-Message-State: AOAM530Ky44g+kFsBjInJ1g3aCBx2MDWYUZjs0h+88J0XwhBkSDTkCa+ /4fKZ22J6HcdhXdej869CyzR9XabED0= X-Google-Smtp-Source: ABdhPJzPw5mVUKMc0biG4vQY2uYBY08sRCF68DRSZV9p3Q+d101CtzxDjp+YVFL3MexF+R96BW+Nfw== X-Received: by 2002:a05:6a00:2444:b0:4a3:239f:d58a with SMTP id d4-20020a056a00244400b004a3239fd58amr5950830pfj.85.1638577613675; Fri, 03 Dec 2021 16:26:53 -0800 (PST) Received: from mail-lvn-it-01.broadcom.com ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id q17sm4970707pfu.117.2021.12.03.16.26.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Dec 2021 16:26:53 -0800 (PST) From: James Smart To: linux-scsi@vger.kernel.org Cc: James Smart , Justin Tee Subject: [PATCH 5/9] lpfc: Trigger SLI4 firmware dump before doing driver cleanup Date: Fri, 3 Dec 2021 16:26:40 -0800 Message-Id: <20211204002644.116455-6-jsmart2021@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20211204002644.116455-1-jsmart2021@gmail.com> References: <20211204002644.116455-1-jsmart2021@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Extraneous teardown routines are present in the firmware dump path causing altered states in firmware captures. When a firmware dump is requested via sysfs, trigger the dump immediately without tearing down structures and changing adapter state. The driver shall rely on pre-existing firmware error state clean up handlers to restore the adapter. Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc.h | 2 +- drivers/scsi/lpfc/lpfc_attr.c | 62 ++++++++++++++++++++------------ drivers/scsi/lpfc/lpfc_hbadisc.c | 8 ++++- drivers/scsi/lpfc/lpfc_sli.c | 6 ---- 4 files changed, 48 insertions(+), 30 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index a04995832459..e652926fb47a 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -1021,7 +1021,6 @@ struct lpfc_hba { #define HBA_DEVLOSS_TMO 0x2000 /* HBA in devloss timeout */ #define HBA_RRQ_ACTIVE 0x4000 /* process the rrq active list */ #define HBA_IOQ_FLUSH 0x8000 /* FCP/NVME I/O queues being flushed */ -#define HBA_FW_DUMP_OP 0x10000 /* Skips fn reset before FW dump */ #define HBA_RECOVERABLE_UE 0x20000 /* Firmware supports recoverable UE */ #define HBA_FORCED_LINK_SPEED 0x40000 /* * Firmware supports Forced Link Speed @@ -1038,6 +1037,7 @@ struct lpfc_hba { #define HBA_HBEAT_TMO 0x8000000 /* HBEAT initiated after timeout */ #define HBA_FLOGI_OUTSTANDING 0x10000000 /* FLOGI is outstanding */ + struct completion *fw_dump_cmpl; /* cmpl event tracker for fw_dump */ uint32_t fcp_ring_in_use; /* When polling test if intr-hndlr active*/ struct lpfc_dmabuf slim2p; diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index dd4c51b6ef4e..7a7f17d71811 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -1709,25 +1709,25 @@ lpfc_sli4_pdev_reg_request(struct lpfc_hba *phba, uint32_t opcode) before_fc_flag = phba->pport->fc_flag; sriov_nr_virtfn = phba->cfg_sriov_nr_virtfn; - /* Disable SR-IOV virtual functions if enabled */ - if (phba->cfg_sriov_nr_virtfn) { - pci_disable_sriov(pdev); - phba->cfg_sriov_nr_virtfn = 0; - } + if (opcode == LPFC_FW_DUMP) { + init_completion(&online_compl); + phba->fw_dump_cmpl = &online_compl; + } else { + /* Disable SR-IOV virtual functions if enabled */ + if (phba->cfg_sriov_nr_virtfn) { + pci_disable_sriov(pdev); + phba->cfg_sriov_nr_virtfn = 0; + } - if (opcode == LPFC_FW_DUMP) - phba->hba_flag |= HBA_FW_DUMP_OP; + status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE); - status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE); + if (status != 0) + return status; - if (status != 0) { - phba->hba_flag &= ~HBA_FW_DUMP_OP; - return status; + /* wait for the device to be quiesced before firmware reset */ + msleep(100); } - /* wait for the device to be quiesced before firmware reset */ - msleep(100); - reg_val = readl(phba->sli4_hba.conf_regs_memmap_p + LPFC_CTL_PDEV_CTL_OFFSET); @@ -1756,24 +1756,42 @@ lpfc_sli4_pdev_reg_request(struct lpfc_hba *phba, uint32_t opcode) lpfc_printf_log(phba, KERN_ERR, LOG_SLI, "3153 Fail to perform the requested " "access: x%x\n", reg_val); + if (phba->fw_dump_cmpl) + phba->fw_dump_cmpl = NULL; return rc; } /* keep the original port state */ - if (before_fc_flag & FC_OFFLINE_MODE) - goto out; - - init_completion(&online_compl); - job_posted = lpfc_workq_post_event(phba, &status, &online_compl, - LPFC_EVT_ONLINE); - if (!job_posted) + if (before_fc_flag & FC_OFFLINE_MODE) { + if (phba->fw_dump_cmpl) + phba->fw_dump_cmpl = NULL; goto out; + } - wait_for_completion(&online_compl); + /* Firmware dump will trigger an HA_ERATT event, and + * lpfc_handle_eratt_s4 routine already handles bringing the port back + * online. + */ + if (opcode == LPFC_FW_DUMP) { + wait_for_completion(phba->fw_dump_cmpl); + } else { + init_completion(&online_compl); + job_posted = lpfc_workq_post_event(phba, &status, &online_compl, + LPFC_EVT_ONLINE); + if (!job_posted) + goto out; + wait_for_completion(&online_compl); + } out: /* in any case, restore the virtual functions enabled as before */ if (sriov_nr_virtfn) { + /* If fw_dump was performed, first disable to clean up */ + if (opcode == LPFC_FW_DUMP) { + pci_disable_sriov(pdev); + phba->cfg_sriov_nr_virtfn = 0; + } + sriov_err = lpfc_sli_probe_sriov_nr_virtfn(phba, sriov_nr_virtfn); if (!sriov_err) diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index 802fd30a9fb8..816fc406135b 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -869,10 +869,16 @@ lpfc_work_done(struct lpfc_hba *phba) if (phba->pci_dev_grp == LPFC_PCI_DEV_OC) lpfc_sli4_post_async_mbox(phba); - if (ha_copy & HA_ERATT) + if (ha_copy & HA_ERATT) { /* Handle the error attention event */ lpfc_handle_eratt(phba); + if (phba->fw_dump_cmpl) { + complete(phba->fw_dump_cmpl); + phba->fw_dump_cmpl = NULL; + } + } + if (ha_copy & HA_MBATT) lpfc_sli_handle_mb_event(phba); diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 5dedb3de271d..513a78d08b1d 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -5046,12 +5046,6 @@ lpfc_sli4_brdreset(struct lpfc_hba *phba) phba->fcf.fcf_flag = 0; spin_unlock_irq(&phba->hbalock); - /* SLI4 INTF 2: if FW dump is being taken skip INIT_PORT */ - if (phba->hba_flag & HBA_FW_DUMP_OP) { - phba->hba_flag &= ~HBA_FW_DUMP_OP; - return rc; - } - /* Now physically reset the device */ lpfc_printf_log(phba, KERN_INFO, LOG_INIT, "0389 Performing PCI function reset!\n"); From patchwork Sat Dec 4 00:26:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 520909 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F13CCC433F5 for ; Sat, 4 Dec 2021 00:27:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383726AbhLDAaY (ORCPT ); Fri, 3 Dec 2021 19:30:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354508AbhLDAaT (ORCPT ); Fri, 3 Dec 2021 19:30:19 -0500 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 000EBC061354 for ; Fri, 3 Dec 2021 16:26:54 -0800 (PST) Received: by mail-pg1-x52d.google.com with SMTP id m15so4603430pgu.11 for ; Fri, 03 Dec 2021 16:26:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4+PRV9LosVlZ9ZDh93g4uetT+X/2Sswu6M+7eCceBt4=; b=K6ZlelNPqwRYAwnnw73JEOdPZ6LKmSKejZI9Uck1RP4ei8hj/cHuzGFRwWTVv5tDpF 1OFGULEFB9e7i1UhQu3XxOmPtlthanwlt4XXZRHLR36ew9GRIMVE/osF2x2UtdEdUURq Su9U4Dtg+lsmzFowYn62Ibsj6H3Ccyy5G8cokrMH4UfbrvM4q38MBGtj2IKlmZnQv+e2 O6KlYLs16XqZwdBhJOvM7SRU3Hl+REqaECXdHuJFkz2A7wrQJjMJ12mRPmzE1GviSxQy UBVBAGQHUiT4VqaHr2CME9PM91TC2Kuq9Tym+A6yEUg0ZzUepIiKVQ3RiRq2XLPPLG7w GNIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4+PRV9LosVlZ9ZDh93g4uetT+X/2Sswu6M+7eCceBt4=; b=ecTcfpWm8/8gKKjpwgw87+AUPpKFLGXs76y/8B0BxfADh2cGjH8IGQDWm6BhtTxwoX LKYYfNdFzfx+zOVe6IhSLVLC7FJqEf/hCULsQ6AnAte4KarXyHrwSyW1C/wsbgIMqKNv 8+NvXmzMQnRY+7Xz0n2J/6qg5thQ4o+32F8NjIEADVXfJPYBG2WvrdnoLFdl26ZDrpsE YqaqRzNOrkJBA+O+MlFQBw8bO1KcDzXJsYRl4y69M6r1rKgzonI01cafabCOYwJ3s7dT PKyPmerKhsm11sqZVxhTNaQdQztl/CC0w48HjIIG0sMoJhswYil5d/8UYKxWcRjfqlj1 XUSA== X-Gm-Message-State: AOAM532A/irBAsR3sk9e5SM9jXAkK7a8LSO6TlllZaL0Lvp+p32cO8Fg 6l1teZX9xwOJVIi31VR9jhlbIncaeMI= X-Google-Smtp-Source: ABdhPJwmvCTAGNbrG6ye+pX6OT4JqR05PdaX8ddmCCEdH0Ge9SzEmMtQ/DF7268+Bzox/vGtY4f09A== X-Received: by 2002:a05:6a00:2181:b0:4a7:ed1f:c5ba with SMTP id h1-20020a056a00218100b004a7ed1fc5bamr22512931pfi.2.1638577614347; Fri, 03 Dec 2021 16:26:54 -0800 (PST) Received: from mail-lvn-it-01.broadcom.com ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id q17sm4970707pfu.117.2021.12.03.16.26.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Dec 2021 16:26:54 -0800 (PST) From: James Smart To: linux-scsi@vger.kernel.org Cc: James Smart , Justin Tee Subject: [PATCH 6/9] lpfc: Adjust CMF total bytes and rxmonitor Date: Fri, 3 Dec 2021 16:26:41 -0800 Message-Id: <20211204002644.116455-7-jsmart2021@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20211204002644.116455-1-jsmart2021@gmail.com> References: <20211204002644.116455-1-jsmart2021@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Calculate any extra bytes needed to account for timer accuracy. If we are less than LPFC_CMF_INTERVAL, then calculate the adjustment needed for total to reflect a full LPFC_CMF_INTERVAL. Add additional info to rxmonitor, and adjust some log formatting. Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc.h | 1 + drivers/scsi/lpfc/lpfc_debugfs.c | 14 ++++++++------ drivers/scsi/lpfc/lpfc_debugfs.h | 2 +- drivers/scsi/lpfc/lpfc_init.c | 20 ++++++++++++-------- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index e652926fb47a..49abbf132bee 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -1602,6 +1602,7 @@ struct lpfc_hba { #define LPFC_MAX_RXMONITOR_ENTRY 800 #define LPFC_MAX_RXMONITOR_DUMP 32 struct rxtable_entry { + uint64_t cmf_bytes; /* Total no of read bytes for CMF_SYNC_WQE */ uint64_t total_bytes; /* Total no of read bytes requested */ uint64_t rcv_bytes; /* Total no of read bytes completed */ uint64_t avg_io_size; diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index bd6d459afce5..ab2550ad0597 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c @@ -5561,22 +5561,24 @@ lpfc_rx_monitor_read(struct file *file, char __user *buf, size_t nbytes, start = tail; len += scnprintf(buffer + len, MAX_DEBUGFS_RX_TABLE_SIZE - len, - " MaxBPI\t Total Data Cmd Total Data Cmpl " - " Latency(us) Avg IO Size\tMax IO Size IO cnt " - "Info BWutil(ms)\n"); + " MaxBPI Tot_Data_CMF Tot_Data_Cmd " + "Tot_Data_Cmpl Lat(us) Avg_IO Max_IO " + "Bsy IO_cnt Info BWutil(ms)\n"); get_table: for (i = start; i < last; i++) { entry = &phba->rxtable[i]; len += scnprintf(buffer + len, MAX_DEBUGFS_RX_TABLE_SIZE - len, - "%3d:%12lld %12lld\t%12lld\t" - "%8lldus\t%8lld\t%10lld " - "%8d %2d %2d(%2d)\n", + "%3d:%12lld %12lld %12lld %12lld " + "%7lldus %8lld %7lld " + "%2d %4d %2d %2d(%2d)\n", i, entry->max_bytes_per_interval, + entry->cmf_bytes, entry->total_bytes, entry->rcv_bytes, entry->avg_io_latency, entry->avg_io_size, entry->max_read_cnt, + entry->cmf_busy, entry->io_cnt, entry->cmf_info, entry->timer_utilization, diff --git a/drivers/scsi/lpfc/lpfc_debugfs.h b/drivers/scsi/lpfc/lpfc_debugfs.h index a5bf71b34972..6dd361c1fd31 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.h +++ b/drivers/scsi/lpfc/lpfc_debugfs.h @@ -282,7 +282,7 @@ struct lpfc_idiag { void *ptr_private; }; -#define MAX_DEBUGFS_RX_TABLE_SIZE (100 * LPFC_MAX_RXMONITOR_ENTRY) +#define MAX_DEBUGFS_RX_TABLE_SIZE (128 * LPFC_MAX_RXMONITOR_ENTRY) struct lpfc_rx_monitor_debug { char *i_private; char *buffer; diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 7628b0634c57..132f2e60bdb4 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -5927,7 +5927,7 @@ lpfc_cmf_timer(struct hrtimer *timer) uint32_t io_cnt; uint32_t head, tail; uint32_t busy, max_read; - uint64_t total, rcv, lat, mbpi, extra; + uint64_t total, rcv, lat, mbpi, extra, cnt; int timer_interval = LPFC_CMF_INTERVAL; uint32_t ms; struct lpfc_cgn_stat *cgs; @@ -5998,20 +5998,23 @@ lpfc_cmf_timer(struct hrtimer *timer) /* Calculate any extra bytes needed to account for the * timer accuracy. If we are less than LPFC_CMF_INTERVAL - * add an extra 3% slop factor, equal to LPFC_CMF_INTERVAL - * add an extra 2%. The goal is to equalize total with a - * time > LPFC_CMF_INTERVAL or <= LPFC_CMF_INTERVAL + 1 + * calculate the adjustment needed for total to reflect + * a full LPFC_CMF_INTERVAL. */ - if (ms == LPFC_CMF_INTERVAL) - extra = div_u64(total, 50); - else if (ms < LPFC_CMF_INTERVAL) - extra = div_u64(total, 33); + if (ms && ms < LPFC_CMF_INTERVAL) { + cnt = div_u64(total, ms); /* bytes per ms */ + cnt *= LPFC_CMF_INTERVAL; /* what total should be */ + if (cnt > mbpi) + cnt = mbpi; + extra = cnt - total; + } lpfc_issue_cmf_sync_wqe(phba, LPFC_CMF_INTERVAL, total + extra); } else { /* For Monitor mode or link down we want mbpi * to be the full link speed */ mbpi = phba->cmf_link_byte_count; + extra = 0; } phba->cmf_timer_cnt++; @@ -6042,6 +6045,7 @@ lpfc_cmf_timer(struct hrtimer *timer) LPFC_RXMONITOR_TABLE_IN_USE); entry = &phba->rxtable[head]; entry->total_bytes = total; + entry->cmf_bytes = total + extra; entry->rcv_bytes = rcv; entry->cmf_busy = busy; entry->cmf_info = phba->cmf_active_info; From patchwork Sat Dec 4 00:26:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 520910 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55E8FC4332F for ; Sat, 4 Dec 2021 00:27:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383712AbhLDAaZ (ORCPT ); Fri, 3 Dec 2021 19:30:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383668AbhLDAaU (ORCPT ); Fri, 3 Dec 2021 19:30:20 -0500 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A52CC061359 for ; Fri, 3 Dec 2021 16:26:55 -0800 (PST) Received: by mail-pg1-x529.google.com with SMTP id f125so4697215pgc.0 for ; Fri, 03 Dec 2021 16:26:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=F2b6CO0wbY7ltn0TUDXIpHpO2ZaLmPQnprTRUm0/D/g=; b=LzTIeZlGFAPSgykOBkV1jrdoL7uXA/SB4uXF4/JotolfCznyDjiU7AaMMl7Ts1ppUj 70SPyWUBO8WDIKAtl9VjCQPhTeGeD8sIGxdecx0r77sIwYr0qQqU8aumSCn/AMcnk67K 7KGarYaz0zatpX+N/8q4VfxnpaBOSWvDU4y9TaEn4xLObMqozPT6ovs94rkoAxbl9+fR 3l4t27vp8/30L40RTHsGze/YBWuEvd0vaIrjVY2FLniruBtS9qxgfsTcJalZcFNAFXkJ xQ+TrJssBgwtIFCwlpJnCRNq34PezsLbda+Mzf5GBrRyCGmMgUl5YbEuGKwtxqOO5Fbl vCmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=F2b6CO0wbY7ltn0TUDXIpHpO2ZaLmPQnprTRUm0/D/g=; b=bADf3oCO3/c1ivlIgefuPJsLOYcLgA33joQcOV2dYZcv5ooZUe9SDxsessZtQNfNHY WdTROUbUGbRySnHTPjEB+A+xX2U4yHrec9ENlXNffmKThkq0x29u6ZuNWQW9REmXFWy7 cdx830/sItLBGkr3bg05TIXCOskWWujtQFdstIZAR8oMlqdOyMM999cKM+m7gzyvKX3y yenL97xlrQVbSMpLpM8GiHutuNP0MFWKUHEprY/zjY5c0USSVNcu4t6aYNfJBYWIM32H pj1mR1KjV5Soyhl6wqar2c+oW4Ijr4NvVknNIHWcIX8Lsa7A4ttH7sTNwHE4510qqz9e rxFQ== X-Gm-Message-State: AOAM532eIIRAwpe9iE1mrcAMZksQjvMGJuN1vu5kM7bE86mTq6NoLvW2 IvUvBdcozdJzOfqBDZwa5oXBZsVLBMo= X-Google-Smtp-Source: ABdhPJy+Civ5wgKJYJRQO/QiGt8DXSvmVSsyQtZIvsQeWLE7MUxbchI90oE+QfLqqyO12hmcJMaEsg== X-Received: by 2002:a05:6a00:228f:b0:49f:d8ac:2f1c with SMTP id f15-20020a056a00228f00b0049fd8ac2f1cmr22563916pfe.35.1638577615007; Fri, 03 Dec 2021 16:26:55 -0800 (PST) Received: from mail-lvn-it-01.broadcom.com ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id q17sm4970707pfu.117.2021.12.03.16.26.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Dec 2021 16:26:54 -0800 (PST) From: James Smart To: linux-scsi@vger.kernel.org Cc: James Smart , Justin Tee Subject: [PATCH 7/9] lpfc: Cap CMF read bytes to MBPI Date: Fri, 3 Dec 2021 16:26:42 -0800 Message-Id: <20211204002644.116455-8-jsmart2021@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20211204002644.116455-1-jsmart2021@gmail.com> References: <20211204002644.116455-1-jsmart2021@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Ensure read bytes data does not go over MBPI for CMF timer intervals that are purposely shortened. Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc.h | 2 +- drivers/scsi/lpfc/lpfc_init.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index 49abbf132bee..3faadcfcdcbb 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -1028,7 +1028,7 @@ struct lpfc_hba { */ #define HBA_PCI_ERR 0x80000 /* The PCI slot is offline */ #define HBA_FLOGI_ISSUED 0x100000 /* FLOGI was issued */ -#define HBA_CGN_RSVD1 0x200000 /* Reserved CGN flag */ +#define HBA_SHORT_CMF 0x200000 /* shorter CMF timer routine */ #define HBA_CGN_DAY_WRAP 0x400000 /* HBA Congestion info day wraps */ #define HBA_DEFER_FLOGI 0x800000 /* Defer FLOGI till read_sparm cmpl */ #define HBA_SETUP 0x1000000 /* Signifies HBA setup is completed */ diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 132f2e60bdb4..2fe7d9d885d9 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -6004,8 +6004,13 @@ lpfc_cmf_timer(struct hrtimer *timer) if (ms && ms < LPFC_CMF_INTERVAL) { cnt = div_u64(total, ms); /* bytes per ms */ cnt *= LPFC_CMF_INTERVAL; /* what total should be */ - if (cnt > mbpi) + + /* If the timeout is scheduled to be shorter, + * this value may skew the data, so cap it at mbpi. + */ + if ((phba->hba_flag & HBA_SHORT_CMF) && cnt > mbpi) cnt = mbpi; + extra = cnt - total; } lpfc_issue_cmf_sync_wqe(phba, LPFC_CMF_INTERVAL, total + extra); @@ -6088,6 +6093,8 @@ lpfc_cmf_timer(struct hrtimer *timer) /* Each minute save Fabric and Driver congestion information */ lpfc_cgn_save_evt_cnt(phba); + phba->hba_flag &= ~HBA_SHORT_CMF; + /* Since we need to call lpfc_cgn_save_evt_cnt every minute, on the * minute, adjust our next timer interval, if needed, to ensure a * 1 minute granularity when we get the next timer interrupt. @@ -6098,6 +6105,8 @@ lpfc_cmf_timer(struct hrtimer *timer) jiffies); if (timer_interval <= 0) timer_interval = LPFC_CMF_INTERVAL; + else + phba->hba_flag |= HBA_SHORT_CMF; /* If we adjust timer_interval, max_bytes_per_interval * needs to be adjusted as well. From patchwork Sat Dec 4 00:26:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 520738 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1B20C433EF for ; Sat, 4 Dec 2021 00:27:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354494AbhLDAaZ (ORCPT ); Fri, 3 Dec 2021 19:30:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383694AbhLDAaU (ORCPT ); Fri, 3 Dec 2021 19:30:20 -0500 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F2CBC061751 for ; Fri, 3 Dec 2021 16:26:56 -0800 (PST) Received: by mail-pg1-x52e.google.com with SMTP id 71so4647465pgb.4 for ; Fri, 03 Dec 2021 16:26:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tangISIjMFoARjF61DTQkK8+AJWtgxHEidCHBUi2IkA=; b=ZopRFYHg5UWYvdlS0VRvSyIBttTQSbOXFF7leFWJSr/CTMHcuQ2qUkWimL/U+BJdWj NiRg2/PbVmSkGca/3T33cLv82aq/6tb0aoQlmnteSpAj/eKVX+2SBg1tMVvjnD4v/qgI 50I7FJ/vb3nTH0+RxCWI/J99o4S8zyGqo9RPTlM669SY2hvr1IAldK0RLvfyHH10vOct lDNr5pvzbM1FJXbcqQK1Oa+eqr0BeOy2wTJ3ATTGHGu12fatDqPEbglUype26pla/zKu RkxhskCnsToWC4wLGtYu34g6RwnYlC81vHYGBjF0AsEtpB8vDyWTa3SN6qGI7f5Y8RVv /7oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tangISIjMFoARjF61DTQkK8+AJWtgxHEidCHBUi2IkA=; b=kCJ+jOfQU1tr0MFwE21ojxEvqv39RZ3RyapN5kj7Y+rJo+wE66unQGPyMXOVZvMd6q B51+fwIGtYFGYHKbaKwRf4B6AzYTAlAaV6rHTquVnZdz43DLC8pl7fulCQkHRG92Kfv0 H5yGFlv/nxDCt45vbkZ9tOMw7wnKYLFsLCstuhI8LbHtVODrNq5dycSw8fkm+kMo4erJ mxbtToO5SZL5+YGsjae6EP59AA8a/uByufLJZLmLx8P6UBpzY6NLFj1rVskjMBd5DN10 es9dV7f9+dVipuJZRgYo4DRT57Wuvg3+AeK6Jh8nPfBT78dLbFdkSS/CHmagE47d0eFq VqLg== X-Gm-Message-State: AOAM530DxBF3DnJiBjN4De86kPwIPp8qcAHoyhAPtS26AFNNyeYDoCcq avFJhiK4LcodwtKUtTG1KbLvcA01TKo= X-Google-Smtp-Source: ABdhPJyJk9ohiXwqUUnqg12mTkSFKWvLGpD7U8vULjmqE6y1ma5CCUKojXdsfy5HpxqhHIPWbtiKNw== X-Received: by 2002:a65:4bc8:: with SMTP id p8mr7105686pgr.119.1638577615526; Fri, 03 Dec 2021 16:26:55 -0800 (PST) Received: from mail-lvn-it-01.broadcom.com ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id q17sm4970707pfu.117.2021.12.03.16.26.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Dec 2021 16:26:55 -0800 (PST) From: James Smart To: linux-scsi@vger.kernel.org Cc: James Smart , Justin Tee Subject: [PATCH 8/9] lpfc: Add additional debugfs support for CMF Date: Fri, 3 Dec 2021 16:26:43 -0800 Message-Id: <20211204002644.116455-9-jsmart2021@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20211204002644.116455-1-jsmart2021@gmail.com> References: <20211204002644.116455-1-jsmart2021@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Dump raw CMF parameter information in debugfs cgn_buffer. Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_debugfs.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index ab2550ad0597..21152c9a96ef 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c @@ -5484,7 +5484,7 @@ lpfc_cgn_buffer_read(struct file *file, char __user *buf, size_t nbytes, if (len > (LPFC_CGN_BUF_SIZE - LPFC_DEBUG_OUT_LINE_SZ)) { len += scnprintf(buffer + len, LPFC_CGN_BUF_SIZE - len, "Truncated . . .\n"); - break; + goto out; } len += scnprintf(buffer + len, LPFC_CGN_BUF_SIZE - len, "%03x: %08x %08x %08x %08x " @@ -5495,6 +5495,17 @@ lpfc_cgn_buffer_read(struct file *file, char __user *buf, size_t nbytes, cnt += 32; ptr += 8; } + if (len > (LPFC_CGN_BUF_SIZE - LPFC_DEBUG_OUT_LINE_SZ)) { + len += scnprintf(buffer + len, LPFC_CGN_BUF_SIZE - len, + "Truncated . . .\n"); + goto out; + } + len += scnprintf(buffer + len, LPFC_CGN_BUF_SIZE - len, + "Parameter Data\n"); + ptr = (uint32_t *)&phba->cgn_p; + len += scnprintf(buffer + len, LPFC_CGN_BUF_SIZE - len, + "%08x %08x %08x %08x\n", + *ptr, *(ptr + 1), *(ptr + 2), *(ptr + 3)); out: return simple_read_from_buffer(buf, nbytes, ppos, buffer, len); } From patchwork Sat Dec 4 00:26:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 520737 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 082EFC433FE for ; Sat, 4 Dec 2021 00:27:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354448AbhLDAa0 (ORCPT ); Fri, 3 Dec 2021 19:30:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383701AbhLDAaV (ORCPT ); Fri, 3 Dec 2021 19:30:21 -0500 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9500BC061A83 for ; Fri, 3 Dec 2021 16:26:56 -0800 (PST) Received: by mail-pg1-x52b.google.com with SMTP id s37so4606488pga.9 for ; Fri, 03 Dec 2021 16:26:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FUNmraKcoaJkWHut5uSl5vhwQY377caQsEZF5H8QK9E=; b=l4xZtjcWPjCHQ7nx/KDUdOXYhTVpssfm1JRSwXTwB9pTRCFyZSAMnWnEmKcUV73H1+ GiJi+iMiq6cn2QCX47MbgmjHbwwRc7TEnYHmaz9+7DTjCTCCiGH25cQ1l27U9ewCNOuP 7QkgNp9wNmztNcBQfsvjBRuplNzgjvEFgvmBz//pr2rYsl29PwXQKpZkyy39a1WIqqMC /tujak2CT8glbVhO2FPAWxAStZFmFQxu7HUGP065+c00y1hG1kJ7TKY9fMXVagVFF40Z BBgL+YhmikslHmyXWRpD2e2s0lf41zPC0wCOkEtFnBQ1RO3Xra6tQa3KCYUYHKi36khL pq/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FUNmraKcoaJkWHut5uSl5vhwQY377caQsEZF5H8QK9E=; b=jwi79NTZ0xIRNLtHmOskhVp/T8rYTtMfGVTwtTA3MwQdpGOwGrpgkrFFFxZgIU1uQJ Wmf2w5VvA6+IbYe8gFzUJrcAlbLRxFhIL3suxyb9iensAlxx9LBnL0WcT246ydjdUKqQ qTq+L7YPZZKht+BAdvgJI/M1V5Et8bngxl3eP7WFEzwCekMzSx8qXVsrNVDcvDfsQ5tb POoI9mrT12GxPL1nzC0r+PU/Zppomc+3GQ/8JwY9ciG7ixJdWp78pdDvTQoTSEY1cwvK 7Z42jS9u/dBtMfgXbcOpD0ogS1ssWeqHm9B5XpAT/lGYUTBYHX+bPR3clwPLb/Yb/SZ/ 2HXQ== X-Gm-Message-State: AOAM530SA3JEuRyc1pr+CO+uAaYlpylkCq1dt7xkKw9QkaDxDtWyX663 E3L0WMzNjPgE5WaCl9lzHMWdPGNuTvA= X-Google-Smtp-Source: ABdhPJz8cpOQ3ko4Xsijn66pNaXyTrOY6dcD1aJApqxk1r6kqDb48kH6w2dB/VUzreuoaNx36rgojA== X-Received: by 2002:a05:6a00:1344:b0:49f:f357:ac9 with SMTP id k4-20020a056a00134400b0049ff3570ac9mr22175192pfu.62.1638577616041; Fri, 03 Dec 2021 16:26:56 -0800 (PST) Received: from mail-lvn-it-01.broadcom.com ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id q17sm4970707pfu.117.2021.12.03.16.26.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Dec 2021 16:26:55 -0800 (PST) From: James Smart To: linux-scsi@vger.kernel.org Cc: James Smart , Justin Tee Subject: [PATCH 9/9] lpfc: Update lpfc version to 14.0.0.4 Date: Fri, 3 Dec 2021 16:26:44 -0800 Message-Id: <20211204002644.116455-10-jsmart2021@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20211204002644.116455-1-jsmart2021@gmail.com> References: <20211204002644.116455-1-jsmart2021@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Update lpfc version to 14.0.0.4 Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h index 5a4d3b24fbce..2e9348a6897c 100644 --- a/drivers/scsi/lpfc/lpfc_version.h +++ b/drivers/scsi/lpfc/lpfc_version.h @@ -20,7 +20,7 @@ * included with this package. * *******************************************************************/ -#define LPFC_DRIVER_VERSION "14.0.0.3" +#define LPFC_DRIVER_VERSION "14.0.0.4" #define LPFC_DRIVER_NAME "lpfc" /* Used for SLI 2/3 */