DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chengwen Feng <fengchengwen@huawei.com>
To: <dev@dpdk.org>
Cc: <thomas@monjalon.net>, <kevin.laatz@intel.com>,
	<bruce.richardson@intel.com>
Subject: [PATCH 1/4] dma/hisilicon: fix return last-idx when no DMA completed
Date: Fri, 27 May 2022 11:40:52 +0800	[thread overview]
Message-ID: <20220527034055.33271-2-fengchengwen@huawei.com> (raw)
In-Reply-To: <20220527034055.33271-1-fengchengwen@huawei.com>

If no DMA request is completed, the ring_idx of the last completed
operation need returned by last_idx parameter. This patch fixes it.

Fixes: 2db4f0b82360 ("dma/hisilicon: add data path")
Cc: stable@dpdk.org

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/dma/hisilicon/hisi_dmadev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/dma/hisilicon/hisi_dmadev.c b/drivers/dma/hisilicon/hisi_dmadev.c
index 9cef2cbfbe..f5c3cd914d 100644
--- a/drivers/dma/hisilicon/hisi_dmadev.c
+++ b/drivers/dma/hisilicon/hisi_dmadev.c
@@ -702,12 +702,12 @@ hisi_dma_completed(void *dev_private,
 		}
 		sq_head = (sq_head + 1) & hw->sq_depth_mask;
 	}
+	*last_idx = hw->cridx + i - 1;
 	if (i > 0) {
 		hw->cridx += i;
-		*last_idx = hw->cridx - 1;
 		hw->sq_head = sq_head;
+		hw->completed += i;
 	}
-	hw->completed += i;
 
 	return i;
 }
@@ -761,12 +761,12 @@ hisi_dma_completed_status(void *dev_private,
 		hw->status[sq_head] = HISI_DMA_STATUS_SUCCESS;
 		sq_head = (sq_head + 1) & hw->sq_depth_mask;
 	}
+	*last_idx = hw->cridx + cpl_num - 1;
 	if (likely(cpl_num > 0)) {
 		hw->cridx += cpl_num;
-		*last_idx = hw->cridx - 1;
 		hw->sq_head = sq_head;
+		hw->completed += cpl_num;
 	}
-	hw->completed += cpl_num;
 
 	return cpl_num;
 }
-- 
2.33.0


  reply	other threads:[~2022-05-27  3:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-27  3:40 [PATCH 0/4] bugfix and feature for Hisilicon DMA PMD Chengwen Feng
2022-05-27  3:40 ` Chengwen Feng [this message]
2022-05-27  3:40 ` [PATCH 2/4] app/test: support test last-idx when no DMA completed Chengwen Feng
2022-05-30 11:40   ` Kevin Laatz
2022-05-27  3:40 ` [PATCH 3/4] dma/hisilicon: enhance robustness of scan CQ Chengwen Feng
2022-05-27  3:40 ` [PATCH 4/4] dma/hisilicon: support vchan-status ops Chengwen Feng
2022-06-07 10:44 ` [PATCH 0/4] bugfix and feature for Hisilicon DMA PMD Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220527034055.33271-2-fengchengwen@huawei.com \
    --to=fengchengwen@huawei.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=kevin.laatz@intel.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).