From: Chengwen Feng <fengchengwen@huawei.com>
To: <dev@dpdk.org>
Cc: <thomas@monjalon.net>, <kevin.laatz@intel.com>,
<bruce.richardson@intel.com>
Subject: [PATCH 4/4] dma/hisilicon: support vchan-status ops
Date: Fri, 27 May 2022 11:40:55 +0800 [thread overview]
Message-ID: <20220527034055.33271-5-fengchengwen@huawei.com> (raw)
In-Reply-To: <20220527034055.33271-1-fengchengwen@huawei.com>
This patch adds support for vchan-status ops.
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/dma/hisilicon/hisi_dmadev.c | 30 +++++++++++++++++++++++++++++
drivers/dma/hisilicon/hisi_dmadev.h | 7 ++++++-
2 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/drivers/dma/hisilicon/hisi_dmadev.c b/drivers/dma/hisilicon/hisi_dmadev.c
index fbe09284ed..9494b60779 100644
--- a/drivers/dma/hisilicon/hisi_dmadev.c
+++ b/drivers/dma/hisilicon/hisi_dmadev.c
@@ -461,6 +461,27 @@ hisi_dma_stats_reset(struct rte_dma_dev *dev, uint16_t vchan)
return 0;
}
+static int
+hisi_dma_vchan_status(const struct rte_dma_dev *dev, uint16_t vchan,
+ enum rte_dma_vchan_status *status)
+{
+ struct hisi_dma_dev *hw = dev->data->dev_private;
+ uint32_t val;
+
+ RTE_SET_USED(vchan);
+
+ val = hisi_dma_read_queue(hw, HISI_DMA_QUEUE_FSM_REG);
+ val = FIELD_GET(HISI_DMA_QUEUE_FSM_STS_M, val);
+ if (val == HISI_DMA_STATE_RUN)
+ *status = RTE_DMA_VCHAN_ACTIVE;
+ else if (val == HISI_DMA_STATE_CPL)
+ *status = RTE_DMA_VCHAN_IDLE;
+ else
+ *status = RTE_DMA_VCHAN_HALTED_ERROR;
+
+ return 0;
+}
+
static void
hisi_dma_dump_range(struct hisi_dma_dev *hw, FILE *f, uint32_t start,
uint32_t end)
@@ -816,6 +837,14 @@ hisi_dma_gen_dev_name(const struct rte_pci_device *pci_dev,
* dev_stop| |
* | v
* ------------------
+ * | CPL |
+ * ------------------
+ * ^ |
+ * hardware | |
+ * completed all| |dev_submit
+ * descriptors | |
+ * | |
+ * ------------------
* | RUN |
* ------------------
*
@@ -829,6 +858,7 @@ static const struct rte_dma_dev_ops hisi_dmadev_ops = {
.vchan_setup = hisi_dma_vchan_setup,
.stats_get = hisi_dma_stats_get,
.stats_reset = hisi_dma_stats_reset,
+ .vchan_status = hisi_dma_vchan_status,
.dev_dump = hisi_dma_dump,
};
diff --git a/drivers/dma/hisilicon/hisi_dmadev.h b/drivers/dma/hisilicon/hisi_dmadev.h
index 90b85322ca..deb1357eea 100644
--- a/drivers/dma/hisilicon/hisi_dmadev.h
+++ b/drivers/dma/hisilicon/hisi_dmadev.h
@@ -132,11 +132,16 @@ enum {
/**
* In fact, there are multiple states, but it need to pay attention to
- * the following two states for the driver:
+ * the following three states for the driver:
*/
enum {
HISI_DMA_STATE_IDLE = 0,
HISI_DMA_STATE_RUN,
+ /**
+ * All of the submitted descriptor are finished, and the queue
+ * is waiting for new descriptors.
+ */
+ HISI_DMA_STATE_CPL,
};
/**
--
2.33.0
next prev parent 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 ` [PATCH 1/4] dma/hisilicon: fix return last-idx when no DMA completed Chengwen Feng
2022-05-27 3:40 ` [PATCH 2/4] app/test: support test " 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 ` Chengwen Feng [this message]
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-5-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).