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: 9874131 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 2C9BC60365 for ; Tue, 1 Aug 2017 10:39:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3269328643 for ; Tue, 1 Aug 2017 10:39:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 276C528683; Tue, 1 Aug 2017 10:39:42 +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=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D638C286A7 for ; Tue, 1 Aug 2017 10:39:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751700AbdHAKj3 (ORCPT ); Tue, 1 Aug 2017 06:39:29 -0400 Received: from mail-qk0-f180.google.com ([209.85.220.180]:36286 "EHLO mail-qk0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751101AbdHAKj1 (ORCPT ); Tue, 1 Aug 2017 06:39:27 -0400 Received: by mail-qk0-f180.google.com with SMTP id d136so6457425qkg.3 for ; Tue, 01 Aug 2017 03:39:27 -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=PF0Apk/OCbQjvJqc5rke83f2OIAvN2PGp+GpNRVHhEGQaujyN4hZt/s8a3SIC4fkIe qCXDD3Jjc9Rb4eYpMGf73hdswqm5fYKawwCUbSSZMMQ8Cqq0x7Bp0pz6sIn0lMExobBJ fIIRb7lCqgGF7Bxrkdu/mxe6lA2U8yqhPCVp/W3AlS+5BjHNRa/r4Yz+iq+LIaduiGLq W/+2fWmFU4aupQm42QO3+u//J7N4aiaS7IgvuzwEgfPX6hgxItbv1vhD5JDLMj/Uh0CH Lr0fWgDQh+HVV9kGa7kIv6rEM2fuwYbHrns1WEtCU6vEKj3Lga8g6Z/L6fKY58shltu0 8Okw== X-Gm-Message-State: AIVw113PECcWxZh0wdJVVOVSiazFHsWTHqDi/blZuGOlW03EEnSgtIb9 Um1rNsNtvM2t4pw/ 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 Cc: Florian Fainelli , Scott Branden , Ray Jui , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, dmaengine@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, Anup Patel 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> Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.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,