From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 2AA86A0C41;
	Wed,  6 Oct 2021 19:02:45 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 99BE9411EF;
	Wed,  6 Oct 2021 19:01:44 +0200 (CEST)
Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13])
 by mails.dpdk.org (Postfix) with ESMTP id 72769411A5
 for <dev@dpdk.org>; Wed,  6 Oct 2021 19:01:37 +0200 (CEST)
Received: from inva020.nxp.com (localhost [127.0.0.1])
 by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 4C68A1A23FF;
 Wed,  6 Oct 2021 19:01:37 +0200 (CEST)
Received: from aprdc01srsp001v.ap-rdc01.nxp.com
 (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16])
 by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 142FD1A23FE;
 Wed,  6 Oct 2021 19:01:37 +0200 (CEST)
Received: from lsv03274.swis.in-blr01.nxp.com (lsv03274.swis.in-blr01.nxp.com
 [92.120.147.114])
 by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 72438183AD05;
 Thu,  7 Oct 2021 01:01:36 +0800 (+08)
From: nipun.gupta@nxp.com
To: dev@dpdk.org
Cc: thomas@monjalon.net, ferruh.yigit@intel.com, hemant.agrawal@nxp.com,
 sachin.saxena@nxp.com, Nipun Gupta <nipun.gupta@nxp.com>
Date: Wed,  6 Oct 2021 22:31:29 +0530
Message-Id: <20211006170131.32616-9-nipun.gupta@nxp.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20211006170131.32616-1-nipun.gupta@nxp.com>
References: <20210927122650.30881-1-nipun.gupta@nxp.com>
 <20211006170131.32616-1-nipun.gupta@nxp.com>
X-Virus-Scanned: ClamAV using ClamSMTP
Subject: [dpdk-dev] [PATCH v3 08/10] raw/dpaa2_qdma: use correct params for
 config and queue setup
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

From: Nipun Gupta <nipun.gupta@nxp.com>

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 <nipun.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 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 <string.h>
@@ -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.17.1