From: Chengwen Feng <fengchengwen@huawei.com>
To: <thomas@monjalon.net>, <Sivaprasad.Tummala@amd.com>,
<Vipin.Varghese@amd.com>
Cc: <dev@dpdk.org>, <bruce.richardson@intel.com>, <kevin.laatz@intel.com>
Subject: [PATCH 1/3] dma/skeleton: fix return last-idx when no memcopy completed
Date: Wed, 8 Jun 2022 16:50:05 +0800 [thread overview]
Message-ID: <20220608085007.10679-2-fengchengwen@huawei.com> (raw)
In-Reply-To: <20220608085007.10679-1-fengchengwen@huawei.com>
If no memcopy request is completed, the ring_idx of the last completed
operation need returned by last_idx parameter. This patch fixes it.
Fixes: 05d5fc66a269 ("dma/skeleton: introduce skeleton driver")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/dma/skeleton/skeleton_dmadev.c | 17 ++++++++++++++---
drivers/dma/skeleton/skeleton_dmadev.h | 1 +
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/drivers/dma/skeleton/skeleton_dmadev.c b/drivers/dma/skeleton/skeleton_dmadev.c
index 81cbdd286e..6b0bb14e2c 100644
--- a/drivers/dma/skeleton/skeleton_dmadev.c
+++ b/drivers/dma/skeleton/skeleton_dmadev.c
@@ -118,6 +118,7 @@ skeldma_start(struct rte_dma_dev *dev)
fflush_ring(hw, hw->desc_running);
fflush_ring(hw, hw->desc_completed);
hw->ridx = 0;
+ hw->last_ridx = hw->ridx - 1;
hw->submitted_count = 0;
hw->zero_req_count = 0;
hw->completed_count = 0;
@@ -322,9 +323,11 @@ skeldma_dump(const struct rte_dma_dev *dev, FILE *f)
GET_RING_COUNT(hw->desc_completed));
(void)fprintf(f,
" next_ring_idx: %u\n"
+ " last_ring_idx: %u\n"
" submitted_count: %" PRIu64 "\n"
" completed_count: %" PRIu64 "\n",
- hw->ridx, hw->submitted_count, hw->completed_count);
+ hw->ridx, hw->last_ridx,
+ hw->submitted_count, hw->completed_count);
return 0;
}
@@ -398,11 +401,15 @@ skeldma_completed(void *dev_private,
count = RTE_MIN(nb_cpls, rte_ring_count(hw->desc_completed));
while (index < count) {
(void)rte_ring_dequeue(hw->desc_completed, (void **)&desc);
- if (index == count - 1)
+ if (index == count - 1) {
+ hw->last_ridx = desc->ridx;
*last_idx = desc->ridx;
+ }
index++;
(void)rte_ring_enqueue(hw->desc_empty, (void *)desc);
}
+ if (unlikely(count == 0))
+ *last_idx = hw->last_ridx;
return count;
}
@@ -422,11 +429,15 @@ skeldma_completed_status(void *dev_private,
count = RTE_MIN(nb_cpls, rte_ring_count(hw->desc_completed));
while (index < count) {
(void)rte_ring_dequeue(hw->desc_completed, (void **)&desc);
- if (index == count - 1)
+ if (index == count - 1) {
+ hw->last_ridx = desc->ridx;
*last_idx = desc->ridx;
+ }
status[index++] = RTE_DMA_STATUS_SUCCESSFUL;
(void)rte_ring_enqueue(hw->desc_empty, (void *)desc);
}
+ if (unlikely(count == 0))
+ *last_idx = hw->last_ridx;
return count;
}
diff --git a/drivers/dma/skeleton/skeleton_dmadev.h b/drivers/dma/skeleton/skeleton_dmadev.h
index 91eb5460fc..6f89400480 100644
--- a/drivers/dma/skeleton/skeleton_dmadev.h
+++ b/drivers/dma/skeleton/skeleton_dmadev.h
@@ -50,6 +50,7 @@ struct skeldma_hw {
/* Cache delimiter for dataplane API's operation data */
char cache1 __rte_cache_aligned;
uint16_t ridx; /* ring idx */
+ uint16_t last_ridx;
uint64_t submitted_count;
/* Cache delimiter for cpucopy thread's operation data */
--
2.33.0
next prev parent reply other threads:[~2022-06-08 8:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-08 8:50 [PATCH 0/3] bugfix and feature for skeleton DMA Chengwen Feng
2022-06-08 8:50 ` Chengwen Feng [this message]
2022-06-08 8:50 ` [PATCH 2/3] test/dma: reset last-idx before invoke DMA completed ops Chengwen Feng
2022-06-08 8:50 ` [PATCH 3/3] dma/skeleton: support multiple instances Chengwen Feng
2022-06-15 14:19 ` [PATCH 0/3] bugfix and feature for skeleton DMA 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=20220608085007.10679-2-fengchengwen@huawei.com \
--to=fengchengwen@huawei.com \
--cc=Sivaprasad.Tummala@amd.com \
--cc=Vipin.Varghese@amd.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).