From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 029E7C2BB86 for ; Sat, 11 Apr 2020 23:19:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CA14620757 for ; Sat, 11 Apr 2020 23:19:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586647170; bh=AnOC8hx0CNXBOtgMGKbZg5cI4NU05oF9XXGOEdP+CiQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=kKk7Ei7/I2GnPICNisVo+JdQvDrUeinoKqXVxhbg+4ZzORaSaep2Es3GduZ/MQx8x j4NiykMPHkF9LCRprHFVSDNNeRw5eQaWZjbidMSVsH9zwXCWGKnLlDX3ZqKWO73Cjy uOC0Yg6k7KwbRxW2F6VdrlgoluokUA9c8Izpe6GA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730261AbgDKXT2 (ORCPT ); Sat, 11 Apr 2020 19:19:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:55308 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729056AbgDKXNz (ORCPT ); Sat, 11 Apr 2020 19:13:55 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EF6E92173E; Sat, 11 Apr 2020 23:13:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586646835; bh=AnOC8hx0CNXBOtgMGKbZg5cI4NU05oF9XXGOEdP+CiQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yoKbkZ7au48N8JWR6gkfCkdSQ7rwz+FuDxPOXdugHVAdl3xAXyIiccm2LVjzLJT0b owsYglALqhFbrYLMSA5wQOk810reNKPcPentTB4nT1YOKlLK2ovM4JqGZbegqwbbfb 0BJmdCk9LEmCIa98PPsTjr0jnoM5xLXaahE9AFLw= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: James Smart , Dick Kennedy , "Martin K . Petersen" , Sasha Levin , linux-scsi@vger.kernel.org Subject: [PATCH AUTOSEL 4.14 24/37] scsi: lpfc: Fix RQ buffer leakage when no IOCBs available Date: Sat, 11 Apr 2020 19:13:13 -0400 Message-Id: <20200411231327.26550-24-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200411231327.26550-1-sashal@kernel.org> References: <20200411231327.26550-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: James Smart [ Upstream commit 39c4f1a965a9244c3ba60695e8ff8da065ec6ac4 ] The driver is occasionally seeing the following SLI Port error, requiring reset and reinit: Port Status Event: ... error 1=0x52004a01, error 2=0x218 The failure means an RQ timeout. That is, the adapter had received asynchronous receive frames, ran out of buffer slots to place the frames, and the driver did not replenish the buffer slots before a timeout occurred. The driver should not be so slow in replenishing buffers that a timeout can occur. When the driver received all the frames of a sequence, it allocates an IOCB to put the frames in. In a situation where there was no IOCB available for the frame of a sequence, the RQ buffer corresponding to the first frame of the sequence was not returned to the FW. Eventually, with enough traffic encountering the situation, the timeout occurred. Fix by releasing the buffer back to firmware whenever there is no IOCB for the first frame. [mkp: typo] Link: https://lore.kernel.org/r/20200128002312.16346-2-jsmart2021@gmail.com Signed-off-by: Dick Kennedy Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/lpfc/lpfc_sli.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index d8e0ba68879c3..28801b0f63caf 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -17036,6 +17036,10 @@ lpfc_prep_seq(struct lpfc_vport *vport, struct hbq_dmabuf *seq_dmabuf) list_add_tail(&iocbq->list, &first_iocbq->list); } } + /* Free the sequence's header buffer */ + if (!first_iocbq) + lpfc_in_buf_free(vport->phba, &seq_dmabuf->dbuf); + return first_iocbq; } -- 2.20.1