From 27f37573981874befdba1a749f834785d8df9458 Mon Sep 17 00:00:00 2001 From: Nipun Gupta Date: Wed, 6 Oct 2021 22:31:29 +0530 Subject: [PATCH] raw/dpaa2_qdma: handle size for config and queue setup RAW configure and Queue setup APIs support size parameter for configure. This patch supports the same for DPAA2 QDMA PMD APIs Signed-off-by: Nipun Gupta Acked-by: Hemant Agrawal --- drivers/raw/dpaa2_qdma/dpaa2_qdma.c | 14 +++++++++++--- drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h | 8 ++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c index 7b80370b36..e45412e640 100644 --- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c +++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2018-2020 NXP + * Copyright 2018-2021 NXP */ #include @@ -1146,8 +1146,12 @@ dpaa2_qdma_configure(const struct rte_rawdev *rawdev, DPAA2_QDMA_FUNC_TRACE(); - if (config_size != sizeof(*qdma_config)) + if (config_size != sizeof(*qdma_config)) { + DPAA2_QDMA_ERR("Config size mismatch. Expected %" PRIu64 + ", Got: %" PRIu64, (uint64_t)(sizeof(*qdma_config)), + (uint64_t)config_size); return -EINVAL; + } /* In case QDMA device is not in stopped state, return -EBUSY */ if (qdma_dev->state == 1) { @@ -1247,8 +1251,12 @@ dpaa2_qdma_queue_setup(struct rte_rawdev *rawdev, DPAA2_QDMA_FUNC_TRACE(); - if (conf_size != sizeof(*q_config)) + if (conf_size != sizeof(*q_config)) { + DPAA2_QDMA_ERR("Config size mismatch. Expected %" PRIu64 + ", Got: %" PRIu64, (uint64_t)(sizeof(*q_config)), + (uint64_t)conf_size); return -EINVAL; + } rte_spinlock_lock(&qdma_dev->lock); diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h index cc1ac25451..1314474271 100644 --- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h +++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2018-2020 NXP + * Copyright 2018-2021 NXP */ #ifndef __RTE_PMD_DPAA2_QDMA_H__ @@ -177,13 +177,13 @@ struct rte_qdma_queue_config { #define rte_qdma_info rte_rawdev_info #define rte_qdma_start(id) rte_rawdev_start(id) #define rte_qdma_reset(id) rte_rawdev_reset(id) -#define rte_qdma_configure(id, cf) rte_rawdev_configure(id, cf) +#define rte_qdma_configure(id, cf, sz) rte_rawdev_configure(id, cf, sz) #define rte_qdma_dequeue_buffers(id, buf, num, ctxt) \ rte_rawdev_dequeue_buffers(id, buf, num, ctxt) #define rte_qdma_enqueue_buffers(id, buf, num, ctxt) \ rte_rawdev_enqueue_buffers(id, buf, num, ctxt) -#define rte_qdma_queue_setup(id, qid, cfg) \ - rte_rawdev_queue_setup(id, qid, cfg) +#define rte_qdma_queue_setup(id, qid, cfg, sz) \ + rte_rawdev_queue_setup(id, qid, cfg, sz) /*TODO introduce per queue stats API in rawdew */ /** -- 2.20.1