From patchwork Tue Aug 22 09:56:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 9914865 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5AC7660381 for ; Tue, 22 Aug 2017 10:46:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3BE6128820 for ; Tue, 22 Aug 2017 10:46:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 30B702884C; Tue, 22 Aug 2017 10:46:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 94BE428820 for ; Tue, 22 Aug 2017 10:46:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Gv/YCAXuWllSBw5NksBg79Lzs9R/eVDYJjUTp09xpG8=; b=a+5I92A7GoXyDnxQLiv0XzPW+Y UT+bCkceLSpcuqioudt3XOj84Pl07d+osSEWITMBfuBDl22Y8Q7LvBNAESmjF9AKv6ik/bAPihfrB TlgUa1i1H3o00/4G+ZGw0VBoZxsxWGW6PsYnKFNDf9YFMbBiLb/4GLDV+Q83cO26/Omd/ts2WMOw+ xYL7CWVy0mSjgE3SwD/0YRIP80Qwpgcue+Ld1rpKfaj4L+SJGdyClVnQQXa3kFPEuAuLOz7x3H7sj 90sv9pC1SPlA2qCVCQoISFTAITQtENK9v04Mba8XRQuaHV+p8YdCZgeCbo9jFCK4gok/DPpd1s/14 WIDg+DEw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dk6hP-0003ud-Ac; Tue, 22 Aug 2017 10:46:19 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dk6fm-0001aH-SA for linux-arm-kernel@bombadil.infradead.org; Tue, 22 Aug 2017 10:44:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=55gI3zOz+R/VM+QXWZ82fb/+rLf7483QZTzrvGUKKn8=; b=VblrYSov0eraKdkIZUFSdu4BG 4oGUJJogdkpoQ0d51opiF2By4xHZtWHObf0tSv2Y/TE2rDDslr4N+bq9ZQdN4AwlEjUrWoFGsMEKK +ZihVLCt3hoRcI8+pztMrklPxr3SYFNOJB8laIo0MfkuvHDGlf6e+Xmq5+I4tXpXxe8vwip9bs92+ /QDtSqomat9iCRaY5oiVsTiVdJk3qJiFrJunoJMjgRwjSy2m73kA0mv17zAI9AGanXca87uMT37th d8Ev+/EQXxl3D10Wg8QJkGpy45+eRcZeUGjSOMPFafcx4CdQDx9kLjDlpnswDDX51kzqmawiyEE3o A0e4uHT2Q==; Received: from mail-wr0-x231.google.com ([2a00:1450:400c:c0c::231]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dk5xL-0007ZL-5e for linux-arm-kernel@lists.infradead.org; Tue, 22 Aug 2017 09:58:44 +0000 Received: by mail-wr0-x231.google.com with SMTP id k46so45882797wre.2 for ; Tue, 22 Aug 2017 02:58:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=55gI3zOz+R/VM+QXWZ82fb/+rLf7483QZTzrvGUKKn8=; b=CPa2BZeAdIm9u+GdycrT//xl/tEZpENcZQrgpPdWAQS9r4jRrJj1vpwl3O94SXnx/H acT21EoGWN817AW1NwSrP+u270bxVsQu+Z4phJif9glux/5sY+/EFsDf3GpVCeLDbw/A +Ht5/Ja08kKkysoB+TDD1cL0tftuUkuv5GSSY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=55gI3zOz+R/VM+QXWZ82fb/+rLf7483QZTzrvGUKKn8=; b=YfxPjpkPmSrtNwORW5FLDVbCpf2qQUPztHPqnhTUkM6PZj8xhYeOmmZ9nq/nU/QmPj uLIPpAWwE4Qiantte2BtM1GZfwacdHBSzWAQPHF/gonj3pdX1HbM4qjWlgxbIuRVkVfa Rq4nHls9qc762uBCQIKUnHc8BT3BBioQ2q636XvZTUmfMjVQ/45+3tQwvFXHZLSnVu+J nkQP2IGKs0Rz6bSb4egcAoWDICcyp0PUWad35TW4hzffUgymTySZC8z3MzzLsgrrseX7 h6zofbf5Guwd7SZdranNppjzJeHCLLFoJ2336lytFYvDpQWFt6QQRjr1EbOnSmi5/aNf 78zg== X-Gm-Message-State: AHYfb5hyjyWCGBZCoc+zwTxEs9pQvxcwaR+asCB9pvMWWocHvafw5qD6 CFOvmA2s3bVelZ/L X-Received: by 10.28.180.8 with SMTP id d8mr10758wmf.161.1503395898481; Tue, 22 Aug 2017 02:58:18 -0700 (PDT) Received: from anup-HP-Compaq-8100-Elite-CMT-PC.dhcp.avagotech.net ([192.19.237.250]) by smtp.gmail.com with ESMTPSA id e137sm12257913wma.29.2017.08.22.02.58.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 22 Aug 2017 02:58:17 -0700 (PDT) From: Anup Patel To: Vinod Koul , Dan Williams Subject: [PATCH v3 08/17] dmaengine: bcm-sba-raid: Increase number of free sba_request Date: Tue, 22 Aug 2017 15:26:57 +0530 Message-Id: <1503395827-19428-9-git-send-email-anup.patel@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503395827-19428-1-git-send-email-anup.patel@broadcom.com> References: <1503395827-19428-1-git-send-email-anup.patel@broadcom.com> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Florian Fainelli , Anup Patel , Scott Branden , Ray Jui , linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, we have only 1024 free sba_request created by sba_prealloc_channel_resources(). This is too low and the prep_xxx() callbacks start failing more often at time of RAID array setup over NVMe disks. This patch sets number of free sba_request created by sba_prealloc_channel_resources() to be: x 8192 Due to above, we will have sufficient number of free sba_request and prep_xxx() callbacks failing is very unlikely. Signed-off-by: Anup Patel --- drivers/dma/bcm-sba-raid.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/dma/bcm-sba-raid.c b/drivers/dma/bcm-sba-raid.c index cd6e3cd..af6cc8e 100644 --- a/drivers/dma/bcm-sba-raid.c +++ b/drivers/dma/bcm-sba-raid.c @@ -83,6 +83,8 @@ #define SBA_CMD_WRITE_BUFFER 0xc #define SBA_CMD_GALOIS 0xe +#define SBA_MAX_REQ_PER_MBOX_CHANNEL 8192 + /* Driver helper macros */ #define to_sba_request(tx) \ container_of(tx, struct sba_request, tx) @@ -1622,6 +1624,13 @@ static int sba_probe(struct platform_device *pdev) sba->dev = &pdev->dev; platform_set_drvdata(pdev, sba); + /* Number of channels equals number of mailbox channels */ + ret = of_count_phandle_with_args(pdev->dev.of_node, + "mboxes", "#mbox-cells"); + if (ret <= 0) + return -ENODEV; + mchans_count = ret; + /* Determine SBA version from DT compatible string */ if (of_device_is_compatible(sba->dev->of_node, "brcm,iproc-sba")) sba->ver = SBA_VER_1; @@ -1634,14 +1643,12 @@ static int sba_probe(struct platform_device *pdev) /* Derived Configuration parameters */ switch (sba->ver) { case SBA_VER_1: - sba->max_req = 1024; sba->hw_buf_size = 4096; sba->hw_resp_size = 8; sba->max_pq_coefs = 6; sba->max_pq_srcs = 6; break; case SBA_VER_2: - sba->max_req = 1024; sba->hw_buf_size = 4096; sba->hw_resp_size = 8; sba->max_pq_coefs = 30; @@ -1655,6 +1662,7 @@ static int sba_probe(struct platform_device *pdev) default: return -EINVAL; } + sba->max_req = SBA_MAX_REQ_PER_MBOX_CHANNEL * mchans_count; sba->max_cmd_per_req = sba->max_pq_srcs + 3; sba->max_xor_srcs = sba->max_cmd_per_req - 1; sba->max_resp_pool_size = sba->max_req * sba->hw_resp_size; @@ -1668,22 +1676,14 @@ static int sba_probe(struct platform_device *pdev) sba->client.knows_txdone = false; sba->client.tx_tout = 0; - /* Number of channels equals number of mailbox channels */ - ret = of_count_phandle_with_args(pdev->dev.of_node, - "mboxes", "#mbox-cells"); - if (ret <= 0) - return -ENODEV; - mchans_count = ret; - sba->mchans_count = 0; - atomic_set(&sba->mchans_current, 0); - /* Allocate mailbox channel array */ - sba->mchans = devm_kcalloc(&pdev->dev, sba->mchans_count, + sba->mchans = devm_kcalloc(&pdev->dev, mchans_count, sizeof(*sba->mchans), GFP_KERNEL); if (!sba->mchans) return -ENOMEM; /* Request mailbox channels */ + sba->mchans_count = 0; for (i = 0; i < mchans_count; i++) { sba->mchans[i] = mbox_request_channel(&sba->client, i); if (IS_ERR(sba->mchans[i])) { @@ -1692,6 +1692,7 @@ static int sba_probe(struct platform_device *pdev) } sba->mchans_count++; } + atomic_set(&sba->mchans_current, 0); /* Find-out underlying mailbox device */ ret = of_parse_phandle_with_args(pdev->dev.of_node,