From: Sivaprasad Tummala <Sivaprasad.Tummala@amd.com>
To: <fengchengwen@huawei.com>
Cc: <dev@dpdk.org>, Sivaprasad Tummala <Sivaprasad.Tummala@amd.com>
Subject: [PATCH] dma/skeleton: support multiple instances
Date: Mon, 28 Mar 2022 07:23:14 -0700 [thread overview]
Message-ID: <20220328142314.46322-1-Sivaprasad.Tummala@amd.com> (raw)
dpdk app can support multiple hardware dma instances.
with dma skeleton, only a single instance can be configured.
This patch supports multiple driver instances per device.
Signed-off-by: Sivaprasad Tummala <Sivaprasad.Tummala@amd.com>
---
drivers/dma/skeleton/skeleton_dmadev.c | 37 +++++++++++++++-----------
1 file changed, 22 insertions(+), 15 deletions(-)
diff --git a/drivers/dma/skeleton/skeleton_dmadev.c b/drivers/dma/skeleton/skeleton_dmadev.c
index 81cbdd286e..6b1c01d89c 100644
--- a/drivers/dma/skeleton/skeleton_dmadev.c
+++ b/drivers/dma/skeleton/skeleton_dmadev.c
@@ -100,6 +100,7 @@ static int
skeldma_start(struct rte_dma_dev *dev)
{
struct skeldma_hw *hw = dev->data->dev_private;
+ char name[RTE_MAX_THREAD_NAME_LEN];
rte_cpuset_t cpuset;
int ret;
@@ -125,7 +126,8 @@ skeldma_start(struct rte_dma_dev *dev)
rte_mb();
- ret = rte_ctrl_thread_create(&hw->thread, "dma_skeleton", NULL,
+ snprintf(name, sizeof(name), "dma_skel_%d", dev->data->dev_id);
+ ret = rte_ctrl_thread_create(&hw->thread, name, NULL,
cpucopy_thread, dev);
if (ret) {
SKELDMA_LOG(ERR, "Start cpucopy thread fail!");
@@ -160,7 +162,7 @@ skeldma_stop(struct rte_dma_dev *dev)
}
static int
-vchan_setup(struct skeldma_hw *hw, uint16_t nb_desc)
+vchan_setup(struct skeldma_hw *hw, int16_t dev_id, uint16_t nb_desc)
{
struct skeldma_desc *desc;
struct rte_ring *empty;
@@ -168,8 +170,12 @@ vchan_setup(struct skeldma_hw *hw, uint16_t nb_desc)
struct rte_ring *running;
struct rte_ring *completed;
uint16_t i;
+ char pool_name[RTE_RING_NAMESIZE];
+ char ring_name[RTE_RING_NAMESIZE];
- desc = rte_zmalloc_socket("dma_skeleton_desc",
+ snprintf(pool_name, RTE_RING_NAMESIZE, "dma_skel_desc_pool_%d",
+ dev_id);
+ desc = rte_zmalloc_socket(pool_name,
nb_desc * sizeof(struct skeldma_desc),
RTE_CACHE_LINE_SIZE, hw->socket_id);
if (desc == NULL) {
@@ -177,13 +183,21 @@ vchan_setup(struct skeldma_hw *hw, uint16_t nb_desc)
return -ENOMEM;
}
- empty = rte_ring_create("dma_skeleton_desc_empty", nb_desc,
+ snprintf(ring_name, RTE_RING_NAMESIZE, "dma_skel_desc_empty_%d",
+ dev_id);
+ empty = rte_ring_create(ring_name, nb_desc,
hw->socket_id, RING_F_SP_ENQ | RING_F_SC_DEQ);
- pending = rte_ring_create("dma_skeleton_desc_pending", nb_desc,
+ snprintf(ring_name, RTE_RING_NAMESIZE, "dma_skel_desc_pend_%d",
+ dev_id);
+ pending = rte_ring_create(ring_name, nb_desc,
hw->socket_id, RING_F_SP_ENQ | RING_F_SC_DEQ);
- running = rte_ring_create("dma_skeleton_desc_running", nb_desc,
+ snprintf(ring_name, RTE_RING_NAMESIZE, "dma_skel_desc_run_%d",
+ dev_id);
+ running = rte_ring_create(ring_name, nb_desc,
hw->socket_id, RING_F_SP_ENQ | RING_F_SC_DEQ);
- completed = rte_ring_create("dma_skeleton_desc_completed", nb_desc,
+ snprintf(ring_name, RTE_RING_NAMESIZE, "dma_skel_desc_comp_%d",
+ dev_id);
+ completed = rte_ring_create(ring_name, nb_desc,
hw->socket_id, RING_F_SP_ENQ | RING_F_SC_DEQ);
if (empty == NULL || pending == NULL || running == NULL ||
completed == NULL) {
@@ -254,7 +268,7 @@ skeldma_vchan_setup(struct rte_dma_dev *dev, uint16_t vchan,
}
vchan_release(hw);
- return vchan_setup(hw, conf->nb_desc);
+ return vchan_setup(hw, dev->data->dev_id, conf->nb_desc);
}
static int
@@ -548,13 +562,6 @@ skeldma_probe(struct rte_vdev_device *vdev)
return -EINVAL;
}
- /* More than one instance is not supported */
- if (skeldma_count > 0) {
- SKELDMA_LOG(ERR, "Multiple instance not supported for %s",
- name);
- return -EINVAL;
- }
-
skeldma_parse_vdev_args(vdev, &lcore_id);
ret = skeldma_create(name, vdev, lcore_id);
--
2.17.1
next reply other threads:[~2022-03-28 14:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-28 14:23 Sivaprasad Tummala [this message]
2022-03-28 14:40 ` Varghese, Vipin
2022-06-07 10:49 ` Thomas Monjalon
2022-06-08 7:10 ` fengchengwen
-- strict thread matches above, loose matches on Subject: below --
2022-03-28 12:53 Sivaprasad Tummala
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=20220328142314.46322-1-Sivaprasad.Tummala@amd.com \
--to=sivaprasad.tummala@amd.com \
--cc=dev@dpdk.org \
--cc=fengchengwen@huawei.com \
/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).