Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1696790

[PATCH 2/6] dma: bcm-sba-raid: Peek mbox when we are left with no free requests

Path csiph.com!news.mixmin.net!news.unit0.net!news.panservice.it!diesel.cu.mi.it!bofh.it!news.nic.it!robomod
From Anup Patel <anup.patel@broadcom.com>
Newsgroups linux.kernel
Subject [PATCH 2/6] dma: bcm-sba-raid: Peek mbox when we are left with no free requests
Date Wed, 26 Jul 2017 07:40:02 +0200
Message-ID <u7nd8-4CC-21@gated-at.bofh.it> (permalink)
References <u7nd7-4CC-5@gated-at.bofh.it>
X-Original-To Rob Herring <robh+dt@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Vinod Koul <vinod.koul@intel.com>, Dan Williams <dan.j.williams@intel.com>
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=vjLNb62Cnh9eJR3eBWcXJTxcKGR6Qg7IuUA1XOL0ySA=; b=RAPBAYWpXWlciR0qR31OXP3QnDbxQ0iqL1LDJutqZFdGQQ6E1rVf4Q4+f5vdouib0A GLzZT/4ZwoGC8JJ6+VQ3tlu37n2HT2L8ocltDPYFWeXvNZV2PR+hmQRm5FkYdqcXrUox kGcHJvF7zMUJ/2wt2S7AGaBEmO+ViOkEsARRs=
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=vjLNb62Cnh9eJR3eBWcXJTxcKGR6Qg7IuUA1XOL0ySA=; b=a6Jmb+/LBRTN3u9mrgEOe+V0QwdTxzdCACZ07V5QJRkrlvYBS4obs0cw1dk1Ps2fY1 Ul8YQc6KSkfnhNVP7FoSI0vO3FY9eG9agJgMnLxgDbWN+ApNcKnAqj+ax+mSood7cQv9 U4yZbt2KWZo/B2wqbf5XvKyJDMlcbtl/HNANSTzdmJWRt8/iwgHjjb61WB0JRdIfcwXL xcYgHNM4jlg/DMm0tEkJfdliTWRXuPzbpvjcSZQ6qGNlwbzagPc1v2TyN1JGTvAr92XT 2tuvvc+MP1WK+HXHkG7jdsiAXdPMGnbFsm4yCKD16DF9fbwHHw23VGR7+MmzTyA/m+H/ wUHw==
X-Gm-Message-State AIVw110lL5oCg3BgbMzRrEtjSVSt7EygRXtAc/F9xDdTZ/H9vvqV8mX9 1M7npfz/21Og8OWh
X-Received by 10.28.140.67 with SMTP id o64mr10085482wmd.68.1501047461663; Tue, 25 Jul 2017 22:37:41 -0700 (PDT)
X-Mailer git-send-email 2.7.4
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 70
Organization linux.* mail to news gateway
X-Original-Cc Florian Fainelli <f.fainelli@gmail.com>, Scott Branden <sbranden@broadcom.com>, Ray Jui <rjui@broadcom.com>, 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 <anup.patel@broadcom.com>
X-Original-Date Wed, 26 Jul 2017 11:06:40 +0530
X-Original-Message-ID <1501047404-14456-3-git-send-email-anup.patel@broadcom.com>
X-Original-References <1501047404-14456-1-git-send-email-anup.patel@broadcom.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1696790

Show key headers only | View raw


We should peek mbox channels when we are left with no free
sba_requests in sba_alloc_request()

Signed-off-by: Anup Patel <anup.patel@broadcom.com>
Reviewed-by: Ray Jui <ray.jui@broadcom.com>
Reviewed-by: Scott Branden <scott.branden@broadcom.com>
---
 drivers/dma/bcm-sba-raid.c | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/drivers/dma/bcm-sba-raid.c b/drivers/dma/bcm-sba-raid.c
index 6d15fed..321420b 100644
--- a/drivers/dma/bcm-sba-raid.c
+++ b/drivers/dma/bcm-sba-raid.c
@@ -199,6 +199,14 @@ static inline u32 __pure sba_cmd_pq_c_mdata(u32 d, u32 b1, u32 b0)
 
 /* ====== General helper routines ===== */
 
+static void sba_peek_mchans(struct sba_device *sba)
+{
+	int mchan_idx;
+
+	for (mchan_idx = 0; mchan_idx < sba->mchans_count; mchan_idx++)
+		mbox_client_peek_data(sba->mchans[mchan_idx]);
+}
+
 static struct sba_request *sba_alloc_request(struct sba_device *sba)
 {
 	unsigned long flags;
@@ -210,8 +218,17 @@ static struct sba_request *sba_alloc_request(struct sba_device *sba)
 	if (req)
 		list_move_tail(&req->node, &sba->reqs_alloc_list);
 	spin_unlock_irqrestore(&sba->reqs_lock, flags);
-	if (!req)
+
+	if (!req) {
+		/*
+		 * We have no more free requests so, we peek
+		 * mailbox channels hoping few active requests
+		 * would have completed which will create more
+		 * room for new requests.
+		 */
+		sba_peek_mchans(sba);
 		return NULL;
+	}
 
 	req->flags = SBA_REQUEST_STATE_ALLOCED;
 	req->first = req;
@@ -558,17 +575,15 @@ static enum dma_status sba_tx_status(struct dma_chan *dchan,
 				     dma_cookie_t cookie,
 				     struct dma_tx_state *txstate)
 {
-	int mchan_idx;
 	enum dma_status ret;
 	struct sba_device *sba = to_sba_device(dchan);
 
-	for (mchan_idx = 0; mchan_idx < sba->mchans_count; mchan_idx++)
-		mbox_client_peek_data(sba->mchans[mchan_idx]);
-
 	ret = dma_cookie_status(dchan, cookie, txstate);
 	if (ret == DMA_COMPLETE)
 		return ret;
 
+	sba_peek_mchans(sba);
+
 	return dma_cookie_status(dchan, cookie, txstate);
 }
 
-- 
2.7.4

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/6] Broadcom SBA-RAID driver improvements Anup Patel <anup.patel@broadcom.com> - 2017-07-26 07:40 +0200
  [PATCH 1/6] dma: bcm-sba-raid: Improve memory allocation in SBA RAID driver Anup Patel <anup.patel@broadcom.com> - 2017-07-26 07:40 +0200
    Re: [PATCH 1/6] dma: bcm-sba-raid: Improve memory allocation in SBA  RAID driver Vinod Koul <vinod.koul@intel.com> - 2017-07-26 19:10 +0200
      Re: [PATCH 1/6] dma: bcm-sba-raid: Improve memory allocation in SBA  RAID driver Anup Patel <anup.patel@broadcom.com> - 2017-07-27 06:20 +0200
        Re: [PATCH 1/6] dma: bcm-sba-raid: Improve memory allocation in SBA  RAID driver Vinod Koul <vinod.koul@intel.com> - 2017-07-28 05:20 +0200
          Re: [PATCH 1/6] dma: bcm-sba-raid: Improve memory allocation in SBA  RAID driver Anup Patel <anup.patel@broadcom.com> - 2017-07-28 05:50 +0200
  [PATCH 2/6] dma: bcm-sba-raid: Peek mbox when we are left with no free requests Anup Patel <anup.patel@broadcom.com> - 2017-07-26 07:40 +0200
    Re: [PATCH 2/6] dma: bcm-sba-raid: Peek mbox when we are left with  no free requests Vinod Koul <vinod.koul@intel.com> - 2017-07-26 19:10 +0200
      Re: [PATCH 2/6] dma: bcm-sba-raid: Peek mbox when we are left with no  free requests Anup Patel <anup.patel@broadcom.com> - 2017-07-27 07:00 +0200
        Re: [PATCH 2/6] dma: bcm-sba-raid: Peek mbox when we are left with  no free requests Vinod Koul <vinod.koul@intel.com> - 2017-07-28 05:20 +0200
          Re: [PATCH 2/6] dma: bcm-sba-raid: Peek mbox when we are left with no  free requests Anup Patel <anup.patel@broadcom.com> - 2017-07-28 05:40 +0200
  [PATCH 6/6] arm64: dts: Add SBA-RAID DT nodes for Stingray SoC Anup Patel <anup.patel@broadcom.com> - 2017-07-26 07:40 +0200
  Re: [PATCH 0/6] Broadcom SBA-RAID driver improvements Vinod Koul <vinod.koul@intel.com> - 2017-07-26 19:10 +0200
    Re: [PATCH 0/6] Broadcom SBA-RAID driver improvements Anup Patel <anup.patel@broadcom.com> - 2017-07-27 06:10 +0200

csiph-web