From patchwork Tue Aug 1 10:37:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 9874149 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 6D3AC60365 for ; Tue, 1 Aug 2017 10:41:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7585B286B1 for ; Tue, 1 Aug 2017 10:41:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 684B6286B7; Tue, 1 Aug 2017 10:41:39 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE 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 BC6FA286A7 for ; Tue, 1 Aug 2017 10:41:38 +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=O5vpAVC5HesQfGt0sHrD3WhTB2 AbpSO8QUs37ZG+XMQ5+PsCzF7TeTO9b8oNaX7J5rlAJVTsFQ0mLfA7D2BInjLGmecWPN31UQfiFdE S/hFDGOCGodShdOHGBAloSCRg1W3Ku3tbufTs3u+QBvwlQdhoCcdd1LktxL9JKM12Mm8hkWOmDqcl SBzYZSRnckVPQuwFa6e0RGxf4b1dz7OQb5BDGns8PVv804iOLXAo8NQ3FQuNKcE85Gbg09HoT4uWq gV0AFlXjOoPAbsIch7pCDLlWt4GPWN7j3OchopKHY12Ue5YmR6CwtM7CpNsiB/K4wgfZbaHbl5rrW ZV/dsK8A==; 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 1dcUc3-0006aC-90; Tue, 01 Aug 2017 10:41: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 1dcUb9-0004fD-RP for linux-arm-kernel@bombadil.infradead.org; Tue, 01 Aug 2017 10:40:24 +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=z4gNIu5HYEfZbGQBuc/upeXmy RFoORlVQhU/bjGq0P+KvX7rJFSKoURfV06u7U1QVzpOn98h7EwzBPM5rzzA5GHK/7j40OIZ4pZsUr wvki/xm/voy0XAXzXijTd7vP/m6X150hYRZ7OBpnnujmbovVwuZ35owzaaRjcGHZwiDePZ0r5IgRE wLZWAcfEqnPC6lS5wMnOAIZlwV1UzOmGLWKHzLOM/eIaPb0B7yd4HzO+Pv8RVZkkY0VA2CEC0D84d 3eLDASWev46LO32LCHl4rph+756ekCdRjhO/Amx45b3L9cq+jSlqFsAxk4PQEbYGelY40TvOXusRb f3E0f+Vxg==; Received: from mail-qk0-x22f.google.com ([2607:f8b0:400d:c09::22f]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dcUaa-0005hp-Td for linux-arm-kernel@lists.infradead.org; Tue, 01 Aug 2017 10:39:49 +0000 Received: by mail-qk0-x22f.google.com with SMTP id a77so6499283qkb.0 for ; Tue, 01 Aug 2017 03:39:28 -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=Fp2PayotuvBUTy4t+MghfwcCTKZlQPPIZZM8TXnWqxEOspVDqA3JIkxHdp9I8NKNsv QhPhmJ24wV5DVxqFfQlrAfIWEiNe7BwGafkuVUblHj03xLknshlrsg4AdaTGiflq2wKO kRN8iowNH3BW4Yuig4K4F9iKmF/jQtPvW8jCY= 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=MAljLasXCIrrsrLdPQ+/RbpxVlrCwC8a9WpEU+71SCHmkKKXixgfGpAl5Xy45nVFXS MJygaoarw5YC48LiTjHtZgzsMt2yDI45LB6WEQqOl0KsFW0lnVOUKyNXKSsRCryDReu0 ZJTu06WOU1qcLf48DEO5QamXo2HtpcGpj//aqDYxJImiNpS1ppC/kB8Lo2Ec+D+pH0X2 E4gaP/geOnyNtn7PPT9AsgqfVuMgw6Jf4yR/eue0FG3RwQ3Jn6WW/HgfWWdcZXrSTQDA 2ikj69UyQBEtiTbV5naMksm+wc5rmu3TSEDfbrlLlFILz4tPyEnVE/CcqSYk1pIA3XjW 3vDQ== X-Gm-Message-State: AIVw110M4IGAqh4IuI3uleKJB7wSv5c2Xmid4UDDr/5LA2xkzAdy84gq FBmwco4XOM6VxYNW X-Received: by 10.55.21.193 with SMTP id 62mr27841209qkv.42.1501583966474; Tue, 01 Aug 2017 03:39:26 -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 e32sm21784162qtb.63.2017.08.01.03.39.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 01 Aug 2017 03:39:26 -0700 (PDT) From: Anup Patel To: Rob Herring , Mark Rutland , Vinod Koul , Dan Williams Subject: [PATCH v2 08/16] dmaengine: bcm-sba-raid: Increase number of free sba_request Date: Tue, 1 Aug 2017 16:07:52 +0530 Message-Id: <1501583880-32072-9-git-send-email-anup.patel@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1501583880-32072-1-git-send-email-anup.patel@broadcom.com> References: <1501583880-32072-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: devicetree@vger.kernel.org, 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,