Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp879920pxk; Thu, 17 Sep 2020 20:10:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWz6LfNzOZaiP5AC1CwoxDSQaSWE5b4VhTLaWhx6ez9fznDoZycbVKeOpm3b9SPvQksWNV X-Received: by 2002:a17:906:2b48:: with SMTP id b8mr35300046ejg.125.1600398628828; Thu, 17 Sep 2020 20:10:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600398628; cv=none; d=google.com; s=arc-20160816; b=PtsTDyjFujSbudiAhEgIAqcfKZhXfJ2jdH3mY+eNP+muamXXgjeoAOa4S3rcl/IBPo Ih+FQebmiScOq79rUY1SiBfnEPlb/Li8spatQkvmRvfHAvYZR5KB+24JewuKlL3S3X55 UVek5ZaHHuaB7UZPsq3LCCvEZ48yU2w9c81T91tRKrfuP5zr84UqQvsXLtLPvUc2gDxV FgLcuejkm9MtAMjeL79gPVTm+a9gSajA7paM5AJZ7jO84+Yd421C+guq8sbNCw+6gPUb 9RZKHjQTVtI1xNN1Rmw2IZj+Sey7edLI8l/3g8gkO5FQdKLtc3QyRQ/2PeX0afhoZHHI P2iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7RVdKkJw9LDLCGzRjir9E0mho3x2tysaUGHzW2mCJOo=; b=ydPF6vlzcPcsJLgBivwK1q5WS7qupFcUADWuHJ5U0Uw2hhqeWlOZQ3JQJbYamJcHi7 pvBGtUyrsG+gg2hDXXkSYuS8DgVyNoIZIg4n87C2Z8d4AKSW+wBsi9IxmFU37pmjzbzH MSZ5BH4byxBv/WEy9mujYfoX9wj1NX0aY01sDZ4hDtNRho6D2KP6X46fUjKo/kwO922z BK6DCK7dspULTG13GR6bRpq/Ltzzuj+rfVNUZ9+lOPt15Ha6tKUS42Mx+efWqL8/wTvw Uc/YIH+oKAVC3xZhpIkOP7mgclxou/wkolNaeklujJPhVSKlNPm13yVFHIOYU6J+zBoZ JjmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=orWArJaN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d20si1120917ejb.704.2020.09.17.20.10.05; Thu, 17 Sep 2020 20:10:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=orWArJaN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729829AbgIRDHz (ORCPT + 99 others); Thu, 17 Sep 2020 23:07:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:50192 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727123AbgIRCDk (ORCPT ); Thu, 17 Sep 2020 22:03:40 -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 C29282376E; Fri, 18 Sep 2020 02:03:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394620; bh=Bj9+ahUI5Nep1spGhW6DPpAZotFigiPtUE7NCh11NrU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=orWArJaNVRaYKBDgNWJVz6UCPtkGoR6qCgT/FS8Mc+zjtbWfRfaXIsFMpeEagZxUB o9b0zY9EPT/MYHrpTg5OoOWxq2ThqZEzmovXTUJlUE3q1ZeC1UvM+2/8SEfB+KQC6S qJXuQz7xAKniB6dtpczuLodszLQRznh7ZsioeAZ8= 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 5.4 122/330] scsi: lpfc: Fix RQ buffer leakage when no IOCBs available Date: Thu, 17 Sep 2020 21:57:42 -0400 Message-Id: <20200918020110.2063155-122-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit 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 a951e1c8165ed..e2877d2b3cc0d 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -17866,6 +17866,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.25.1