DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/6] baseband: introduce NXP LA12xx driver
@ 2021-03-18  6:34 Hemant Agrawal
  2021-03-18  6:34 ` [dpdk-dev] [PATCH 2/6] baseband/la12xx: add devargs for max queues Hemant Agrawal
                   ` (13 more replies)
  0 siblings, 14 replies; 157+ messages in thread
From: Hemant Agrawal @ 2021-03-18  6:34 UTC (permalink / raw)
  To: dev; +Cc: Nipun Gupta, Hemant Agrawal

This patch introduce the baseband device drivers for NXP's
LA1200 series software defined baseband modem.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c        | 110 ++++++++++++++++++
 .../baseband/la12xx/bbdev_la12xx_pmd_logs.h   |  38 ++++++
 drivers/baseband/la12xx/meson.build           |   6 +
 drivers/baseband/la12xx/version.map           |   3 +
 drivers/baseband/meson.build                  |   2 +-
 5 files changed, 158 insertions(+), 1 deletion(-)
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.c
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
 create mode 100644 drivers/baseband/la12xx/meson.build
 create mode 100644 drivers/baseband/la12xx/version.map

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
new file mode 100644
index 000000000..b4c3000e9
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -0,0 +1,110 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+
+#include <string.h>
+
+#include <rte_common.h>
+#include <rte_bus_vdev.h>
+#include <rte_malloc.h>
+#include <rte_ring.h>
+#include <rte_kvargs.h>
+
+#include <rte_bbdev.h>
+#include <rte_bbdev_pmd.h>
+
+#include <bbdev_la12xx_pmd_logs.h>
+
+#define DRIVER_NAME baseband_la12xx
+
+RTE_LOG_REGISTER(bbdev_la12xx_logtype, pmd.bb.la12xx, NOTICE);
+
+/* private data structure */
+struct bbdev_la12xx_private {
+	unsigned int max_nb_queues;  /**< Max number of queues */
+};
+/* Create device */
+static int
+la12xx_bbdev_create(struct rte_vdev_device *vdev)
+{
+	struct rte_bbdev *bbdev;
+	const char *name = rte_vdev_device_name(vdev);
+
+	PMD_INIT_FUNC_TRACE();
+
+	bbdev = rte_bbdev_allocate(name);
+	if (bbdev == NULL)
+		return -ENODEV;
+
+	bbdev->data->dev_private = rte_zmalloc(name,
+			sizeof(struct bbdev_la12xx_private),
+			RTE_CACHE_LINE_SIZE);
+	if (bbdev->data->dev_private == NULL) {
+		rte_bbdev_release(bbdev);
+		return -ENOMEM;
+	}
+
+	bbdev->dev_ops = NULL;
+	bbdev->device = &vdev->device;
+	bbdev->data->socket_id = 0;
+	bbdev->intr_handle = NULL;
+
+	/* register rx/tx burst functions for data path */
+	bbdev->dequeue_enc_ops = NULL;
+	bbdev->dequeue_dec_ops = NULL;
+	bbdev->enqueue_enc_ops = NULL;
+	bbdev->enqueue_dec_ops = NULL;
+
+	return 0;
+}
+
+/* Initialise device */
+static int
+la12xx_bbdev_probe(struct rte_vdev_device *vdev)
+{
+	const char *name;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (vdev == NULL)
+		return -EINVAL;
+
+	name = rte_vdev_device_name(vdev);
+	if (name == NULL)
+		return -EINVAL;
+
+	return la12xx_bbdev_create(vdev);
+}
+
+/* Uninitialise device */
+static int
+la12xx_bbdev_remove(struct rte_vdev_device *vdev)
+{
+	struct rte_bbdev *bbdev;
+	const char *name;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (vdev == NULL)
+		return -EINVAL;
+
+	name = rte_vdev_device_name(vdev);
+	if (name == NULL)
+		return -EINVAL;
+
+	bbdev = rte_bbdev_get_named_dev(name);
+	if (bbdev == NULL)
+		return -EINVAL;
+
+	rte_free(bbdev->data->dev_private);
+
+	return rte_bbdev_release(bbdev);
+}
+
+static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
+	.probe = la12xx_bbdev_probe,
+	.remove = la12xx_bbdev_remove
+};
+
+RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
+RTE_PMD_REGISTER_ALIAS(DRIVER_NAME, bbdev_la12xx);
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h b/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
new file mode 100644
index 000000000..71613a5ba
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020 NXP
+ */
+
+#ifndef _BBDEV_LA12XX_PMD_LOGS_H_
+#define _BBDEV_LA12XX_PMD_LOGS_H_
+
+#define BBDEV_LA12XX_PMD_LOG(level, fmt, args...) \
+	rte_log(RTE_LOG_ ## level, bbdev_la12xx_logtype, "bbdev_la12xx: " \
+		fmt "\n", ##args)
+
+#define BBDEV_LA12XX_PMD_DEBUG(fmt, args...) \
+	rte_log(RTE_LOG_DEBUG, bbdev_la12xx_logtype, "bbdev_la12xx: %s(): "\
+		fmt "\n", __func__, ##args)
+
+#define PMD_INIT_FUNC_TRACE() BBDEV_LA12XX_PMD_DEBUG(">>")
+
+#define BBDEV_LA12XX_PMD_CRIT(fmt, args...) \
+	BBDEV_LA12XX_PMD_LOG(CRIT, fmt, ## args)
+#define BBDEV_LA12XX_PMD_INFO(fmt, args...) \
+	BBDEV_LA12XX_PMD_LOG(INFO, fmt, ## args)
+#define BBDEV_LA12XX_PMD_ERR(fmt, args...) \
+	BBDEV_LA12XX_PMD_LOG(ERR, fmt, ## args)
+#define BBDEV_LA12XX_PMD_WARN(fmt, args...) \
+	BBDEV_LA12XX_PMD_LOG(WARNING, fmt, ## args)
+
+/* DP Logs, toggled out at compile time if level lower than current level */
+#define BBDEV_LA12XX_PMD_DP_LOG(level, fmt, args...) \
+	RTE_LOG_DP(level, PMD, fmt, ## args)
+
+#define BBDEV_LA12XX_PMD_DP_DEBUG(fmt, args...) \
+	BBDEV_LA12XX_PMD_DP_LOG(DEBUG, fmt, ## args)
+#define BBDEV_LA12XX_PMD_DP_INFO(fmt, args...) \
+	BBDEV_LA12XX_PMD_DP_LOG(INFO, fmt, ## args)
+#define BBDEV_LA12XX_PMD_DP_WARN(fmt, args...) \
+	BBDEV_LA12XX_PMD_DP_LOG(WARNING, fmt, ## args)
+
+#endif /* _BBDEV_LA12XX_PMD_LOGS_H_ */
diff --git a/drivers/baseband/la12xx/meson.build b/drivers/baseband/la12xx/meson.build
new file mode 100644
index 000000000..7a017dcff
--- /dev/null
+++ b/drivers/baseband/la12xx/meson.build
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020-2021 NXP
+
+deps += ['bbdev', 'bus_vdev', 'ring']
+
+sources = files('bbdev_la12xx.c')
diff --git a/drivers/baseband/la12xx/version.map b/drivers/baseband/la12xx/version.map
new file mode 100644
index 000000000..4a76d1d52
--- /dev/null
+++ b/drivers/baseband/la12xx/version.map
@@ -0,0 +1,3 @@
+DPDK_21 {
+	local: *;
+};
diff --git a/drivers/baseband/meson.build b/drivers/baseband/meson.build
index 920e3b02e..ba5b2e570 100644
--- a/drivers/baseband/meson.build
+++ b/drivers/baseband/meson.build
@@ -5,4 +5,4 @@ if is_windows
 	subdir_done()
 endif
 
-drivers = ['null', 'turbo_sw', 'fpga_lte_fec', 'fpga_5gnr_fec', 'acc100']
+drivers = ['null', 'turbo_sw', 'fpga_lte_fec', 'fpga_5gnr_fec', 'acc100', 'la12xx']
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH 2/6] baseband/la12xx: add devargs for max queues
  2021-03-18  6:34 [dpdk-dev] [PATCH 1/6] baseband: introduce NXP LA12xx driver Hemant Agrawal
@ 2021-03-18  6:34 ` Hemant Agrawal
  2021-03-18  6:34 ` [dpdk-dev] [PATCH 3/6] baseband/la12xx: add support for multiple modems Hemant Agrawal
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 157+ messages in thread
From: Hemant Agrawal @ 2021-03-18  6:34 UTC (permalink / raw)
  To: dev; +Cc: Nipun Gupta, Hemant Agrawal

This patch adds dev args to take  max queues as input

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c | 72 +++++++++++++++++++++++++-
 1 file changed, 70 insertions(+), 2 deletions(-)

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index b4c3000e9..b5a8f26ed 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -19,13 +19,72 @@
 
 RTE_LOG_REGISTER(bbdev_la12xx_logtype, pmd.bb.la12xx, NOTICE);
 
+/*  Initialisation params structure that can be used by LA12xx BBDEV driver */
+struct bbdev_la12xx_params {
+	uint8_t queues_num; /*< LA12xx BBDEV queues number */
+};
+
+#define BBDEV_LA12XX_MAX_NB_QUEUES_ARG  "max_nb_queues"
+
+static const char * const bbdev_la12xx_valid_params[] = {
+	BBDEV_LA12XX_MAX_NB_QUEUES_ARG,
+};
+
 /* private data structure */
 struct bbdev_la12xx_private {
 	unsigned int max_nb_queues;  /**< Max number of queues */
 };
+static inline int
+parse_u16_arg(const char *key, const char *value, void *extra_args)
+{
+	uint16_t *u16 = extra_args;
+
+	unsigned int long result;
+	if ((value == NULL) || (extra_args == NULL))
+		return -EINVAL;
+	errno = 0;
+	result = strtoul(value, NULL, 0);
+	if ((result >= (1 << 16)) || (errno != 0)) {
+		BBDEV_LA12XX_PMD_ERR("Invalid value %lu for %s", result, key);
+		return -ERANGE;
+	}
+	*u16 = (uint16_t)result;
+	return 0;
+}
+
+/* Parse parameters used to create device */
+static int
+parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
+		const char *input_args)
+{
+	struct rte_kvargs *kvlist = NULL;
+	int ret = 0;
+
+	if (params == NULL)
+		return -EINVAL;
+	if (input_args) {
+		kvlist = rte_kvargs_parse(input_args,
+				bbdev_la12xx_valid_params);
+		if (kvlist == NULL)
+			return -EFAULT;
+
+		ret = rte_kvargs_process(kvlist, bbdev_la12xx_valid_params[0],
+					&parse_u16_arg, &params->queues_num);
+		if (ret < 0)
+			goto exit;
+
+	}
+
+exit:
+	if (kvlist)
+		rte_kvargs_free(kvlist);
+	return ret;
+}
+
 /* Create device */
 static int
-la12xx_bbdev_create(struct rte_vdev_device *vdev)
+la12xx_bbdev_create(struct rte_vdev_device *vdev,
+		struct bbdev_la12xx_params *init_params)
 {
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
@@ -62,7 +121,11 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev)
 static int
 la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 {
+	struct bbdev_la12xx_params init_params = {
+		RTE_BBDEV_DEFAULT_MAX_NB_QUEUES
+	};
 	const char *name;
+	const char *input_args;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -73,7 +136,10 @@ la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 	if (name == NULL)
 		return -EINVAL;
 
-	return la12xx_bbdev_create(vdev);
+	input_args = rte_vdev_device_args(vdev);
+	parse_bbdev_la12xx_params(&init_params, input_args);
+
+	return la12xx_bbdev_create(vdev, &init_params);
 }
 
 /* Uninitialise device */
@@ -107,4 +173,6 @@ static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
 };
 
 RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
+RTE_PMD_REGISTER_PARAM_STRING(DRIVER_NAME,
+	BBDEV_LA12XX_MAX_NB_QUEUES_ARG"=<int>");
 RTE_PMD_REGISTER_ALIAS(DRIVER_NAME, bbdev_la12xx);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH 3/6] baseband/la12xx: add support for multiple modems
  2021-03-18  6:34 [dpdk-dev] [PATCH 1/6] baseband: introduce NXP LA12xx driver Hemant Agrawal
  2021-03-18  6:34 ` [dpdk-dev] [PATCH 2/6] baseband/la12xx: add devargs for max queues Hemant Agrawal
@ 2021-03-18  6:34 ` Hemant Agrawal
  2021-03-18  6:34 ` [dpdk-dev] [PATCH 4/6] baseband/la12xx: add queue and modem config support Hemant Agrawal
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 157+ messages in thread
From: Hemant Agrawal @ 2021-03-18  6:34 UTC (permalink / raw)
  To: dev; +Cc: Hemant Agrawal

This patch add support for multiple modems by assigning
a modem id as dev args in vdev creation.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c     | 62 +++++++++++++++++++---
 drivers/baseband/la12xx/bbdev_la12xx.h     | 56 +++++++++++++++++++
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 20 +++++++
 3 files changed, 132 insertions(+), 6 deletions(-)
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_ipc.h

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index b5a8f26ed..81793a993 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -14,6 +14,8 @@
 #include <rte_bbdev_pmd.h>
 
 #include <bbdev_la12xx_pmd_logs.h>
+#include <bbdev_la12xx_ipc.h>
+#include <bbdev_la12xx.h>
 
 #define DRIVER_NAME baseband_la12xx
 
@@ -22,18 +24,18 @@ RTE_LOG_REGISTER(bbdev_la12xx_logtype, pmd.bb.la12xx, NOTICE);
 /*  Initialisation params structure that can be used by LA12xx BBDEV driver */
 struct bbdev_la12xx_params {
 	uint8_t queues_num; /*< LA12xx BBDEV queues number */
+	int8_t modem_id; /*< LA12xx modem instance id */
 };
 
 #define BBDEV_LA12XX_MAX_NB_QUEUES_ARG  "max_nb_queues"
+#define BBDEV_LA12XX_VDEV_MODEM_ID_ARG	"modem"
+#define LA12XX_MAX_MODEM 4
 
 static const char * const bbdev_la12xx_valid_params[] = {
 	BBDEV_LA12XX_MAX_NB_QUEUES_ARG,
+	BBDEV_LA12XX_VDEV_MODEM_ID_ARG,
 };
 
-/* private data structure */
-struct bbdev_la12xx_private {
-	unsigned int max_nb_queues;  /**< Max number of queues */
-};
 static inline int
 parse_u16_arg(const char *key, const char *value, void *extra_args)
 {
@@ -52,6 +54,28 @@ parse_u16_arg(const char *key, const char *value, void *extra_args)
 	return 0;
 }
 
+/* Parse integer from integer argument */
+static int
+parse_integer_arg(const char *key __rte_unused,
+		const char *value, void *extra_args)
+{
+	int i;
+	char *end;
+
+	errno = 0;
+
+	i = strtol(value, &end, 10);
+	if (*end != 0 || errno != 0 || i < 0 || i > LA12XX_MAX_MODEM) {
+		BBDEV_LA12XX_PMD_ERR("Supported Port IDS are 0 to %d",
+			LA12XX_MAX_MODEM - 1);
+		return -EINVAL;
+	}
+
+	*((uint32_t *)extra_args) = i;
+
+	return 0;
+}
+
 /* Parse parameters used to create device */
 static int
 parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
@@ -73,6 +97,16 @@ parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
 		if (ret < 0)
 			goto exit;
 
+		ret = rte_kvargs_process(kvlist,
+					bbdev_la12xx_valid_params[1],
+					&parse_integer_arg,
+					&params->modem_id);
+
+		if (params->modem_id >= LA12XX_MAX_MODEM) {
+			BBDEV_LA12XX_PMD_ERR("Invalid modem id, must be < %u",
+					LA12XX_MAX_MODEM);
+			goto exit;
+		}
 	}
 
 exit:
@@ -88,6 +122,7 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 {
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
+	struct bbdev_la12xx_private *priv;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -103,6 +138,20 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 		return -ENOMEM;
 	}
 
+	priv = bbdev->data->dev_private;
+	priv->modem_id = init_params->modem_id;
+	/* if modem id is not configured */
+	if (priv->modem_id == -1)
+		priv->modem_id = bbdev->data->dev_id;
+
+	/* Reset Global variables */
+	priv->num_ldpc_enc_queues = 0;
+	priv->num_ldpc_dec_queues = 0;
+	priv->num_valid_queues = 0;
+	priv->max_nb_queues = init_params->queues_num;
+
+	BBDEV_LA12XX_PMD_INFO("Setting Up %s: DevId=%d, ModemId=%d",
+				name, bbdev->data->dev_id, priv->modem_id);
 	bbdev->dev_ops = NULL;
 	bbdev->device = &vdev->device;
 	bbdev->data->socket_id = 0;
@@ -122,7 +171,7 @@ static int
 la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 {
 	struct bbdev_la12xx_params init_params = {
-		RTE_BBDEV_DEFAULT_MAX_NB_QUEUES
+		RTE_BBDEV_DEFAULT_MAX_NB_QUEUES, -1,
 	};
 	const char *name;
 	const char *input_args;
@@ -174,5 +223,6 @@ static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
 
 RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
 RTE_PMD_REGISTER_PARAM_STRING(DRIVER_NAME,
-	BBDEV_LA12XX_MAX_NB_QUEUES_ARG"=<int>");
+	BBDEV_LA12XX_MAX_NB_QUEUES_ARG"=<int>"
+	BBDEV_LA12XX_VDEV_MODEM_ID_ARG "=<int> ");
 RTE_PMD_REGISTER_ALIAS(DRIVER_NAME, bbdev_la12xx);
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.h b/drivers/baseband/la12xx/bbdev_la12xx.h
new file mode 100644
index 000000000..522850233
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx.h
@@ -0,0 +1,56 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+
+#ifndef __BBDEV_LA12XX_H__
+#define __BBDEV_LA12XX_H__
+
+#define BBDEV_IPC_ENC_OP_TYPE	1
+#define BBDEV_IPC_DEC_OP_TYPE	2
+
+#define MAX_LDPC_ENC_FECA_QUEUES	4
+#define MAX_LDPC_DEC_FECA_QUEUES	4
+
+#define MAX_CHANNEL_DEPTH 16
+/* private data structure */
+struct bbdev_la12xx_private {
+	void *ipc_priv;
+	uint8_t num_valid_queues;
+	uint8_t max_nb_queues;
+	uint8_t num_ldpc_enc_queues;
+	uint8_t num_ldpc_dec_queues;
+	int8_t modem_id;
+	struct bbdev_la12xx_q_priv *queues_priv[32];
+};
+
+struct hugepage_info {
+	void *vaddr;
+	phys_addr_t paddr;
+	size_t len;
+};
+
+struct bbdev_la12xx_q_priv {
+	struct bbdev_la12xx_private *bbdev_priv;
+	uint32_t q_id;	/**< Channel ID */
+	uint32_t feca_blk_id;	/** FECA block ID for processing */
+	uint32_t feca_blk_id_be32; /**< FECA Block ID for this queue */
+	uint8_t en_napi; /* 0: napi disabled, 1: napi enabled */
+	uint16_t queue_size;	/**< Queue depth */
+	int32_t eventfd;	/**< Event FD value */
+	enum rte_bbdev_op_type op_type; /**< Operation type */
+	uint32_t la12xx_core_id;
+		/* LA12xx core ID on which this will be scheduled */
+	struct rte_mempool *mp; /**< Pool from where buffers would be cut */
+	void *bbdev_op[MAX_CHANNEL_DEPTH];
+			/**< Stores bbdev op for each index */
+	void *msg_ch_vaddr[MAX_CHANNEL_DEPTH];
+			/**< Stores msg channel addr for modem->host */
+	uint32_t host_pi;	/**< Producer_Index for HOST->MODEM */
+	uint32_t host_ci;	/**< Consumer Index for MODEM->HOST */
+	host_ipc_params_t *host_params; /**< Host parameters */
+};
+
+#define lower_32_bits(x) ((uint32_t)((uint64_t)x))
+#define upper_32_bits(x) ((uint32_t)(((uint64_t)(x) >> 16) >> 16))
+
+#endif
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
new file mode 100644
index 000000000..9aa556298
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+#ifndef __BBDEV_LA12XX_IPC_H__
+#define __BBDEV_LA12XX_IPC_H__
+
+/** No. of max channel per instance */
+#define IPC_MAX_DEPTH	(16)
+
+/* This shared memory would be on the host side which have copy of some
+ * of the parameters which are also part of Shared BD ring. Read access
+ * of these parameters from the host side would not be over PCI.
+ */
+typedef struct host_ipc_params {
+	volatile uint32_t pi;
+	volatile uint32_t ci;
+	volatile uint32_t modem_ptr[IPC_MAX_DEPTH];
+} __rte_packed host_ipc_params_t;
+
+#endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH 4/6] baseband/la12xx: add queue and modem config support
  2021-03-18  6:34 [dpdk-dev] [PATCH 1/6] baseband: introduce NXP LA12xx driver Hemant Agrawal
  2021-03-18  6:34 ` [dpdk-dev] [PATCH 2/6] baseband/la12xx: add devargs for max queues Hemant Agrawal
  2021-03-18  6:34 ` [dpdk-dev] [PATCH 3/6] baseband/la12xx: add support for multiple modems Hemant Agrawal
@ 2021-03-18  6:34 ` Hemant Agrawal
  2021-03-18  6:34 ` [dpdk-dev] [PATCH 5/6] baseband/la12xx: add enqueue and dequeue support Hemant Agrawal
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 157+ messages in thread
From: Hemant Agrawal @ 2021-03-18  6:34 UTC (permalink / raw)
  To: dev; +Cc: Nipun Gupta, Hemant Agrawal

This patch add support for connecting with modem
and creating the ipc channel as queues with modem
for the exchange of data.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c     | 566 ++++++++++++++++++++-
 drivers/baseband/la12xx/bbdev_la12xx.h     |   5 +-
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 180 +++++++
 3 files changed, 748 insertions(+), 3 deletions(-)

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 81793a993..a72ba1c2b 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -3,6 +3,11 @@
  */
 
 #include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <dirent.h>
 
 #include <rte_common.h>
 #include <rte_bus_vdev.h>
@@ -31,11 +36,563 @@ struct bbdev_la12xx_params {
 #define BBDEV_LA12XX_VDEV_MODEM_ID_ARG	"modem"
 #define LA12XX_MAX_MODEM 4
 
+#define LA12XX_MAX_CORES	4
+#define BBDEV_LA12XX_LDPC_ENC_CORE	0
+#define BBDEV_LA12XX_LDPC_DEC_CORE	1
+
 static const char * const bbdev_la12xx_valid_params[] = {
 	BBDEV_LA12XX_MAX_NB_QUEUES_ARG,
 	BBDEV_LA12XX_VDEV_MODEM_ID_ARG,
 };
 
+static const struct rte_bbdev_op_cap bbdev_capabilities[] = {
+	{
+		.type   = RTE_BBDEV_OP_LDPC_ENC,
+		.cap.ldpc_enc = {
+			.capability_flags =
+					RTE_BBDEV_LDPC_CRC_24A_ATTACH |
+					RTE_BBDEV_LDPC_CRC_24B_ATTACH,
+			.num_buffers_src =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+			.num_buffers_dst =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+		}
+	},
+	{
+		.type   = RTE_BBDEV_OP_LDPC_DEC,
+		.cap.ldpc_dec = {
+			.capability_flags =
+				RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK |
+					RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK |
+					RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP,
+			.num_buffers_src =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+			.num_buffers_hard_out =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+		}
+	},
+	RTE_BBDEV_END_OF_CAPABILITIES_LIST()
+};
+
+static struct rte_bbdev_queue_conf default_queue_conf = {
+	.queue_size = MAX_CHANNEL_DEPTH,
+};
+
+/* Get device info */
+static void
+la12xx_info_get(struct rte_bbdev *dev,
+		struct rte_bbdev_driver_info *dev_info)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	dev_info->driver_name = RTE_STR(DRIVER_NAME);
+	dev_info->max_num_queues = LA12XX_MAX_QUEUES;
+	dev_info->queue_size_lim = MAX_CHANNEL_DEPTH;
+	dev_info->hardware_accelerated = true;
+	dev_info->max_dl_queue_priority = 0;
+	dev_info->max_ul_queue_priority = 0;
+	dev_info->default_queue_conf = default_queue_conf;
+	dev_info->capabilities = bbdev_capabilities;
+	dev_info->cpu_flag_reqs = NULL;
+	dev_info->min_alignment = 64;
+
+	BBDEV_LA12XX_PMD_DEBUG("got device info from %u", dev->data->dev_id);
+}
+
+/* Release queue */
+static int
+la12xx_queue_release(struct rte_bbdev *dev, uint16_t q_id)
+{
+	RTE_SET_USED(dev);
+	RTE_SET_USED(q_id);
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* TODO: Implement */
+
+	return 0;
+}
+
+#define HUGEPG_OFFSET(A) \
+		((uint64_t) ((unsigned long) (A) \
+		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
+
+static int ipc_queue_configure(uint32_t channel_id,
+		ipc_t instance, struct bbdev_la12xx_q_priv *q_priv)
+{
+	ipc_userspace_t *ipc_priv = (ipc_userspace_t *)instance;
+	ipc_instance_t *ipc_instance = ipc_priv->instance;
+	ipc_ch_t *ch;
+	void *vaddr;
+	uint32_t i = 0;
+	uint32_t msg_size = sizeof(struct bbdev_ipc_enqueue_op);
+
+	PMD_INIT_FUNC_TRACE();
+
+	BBDEV_LA12XX_PMD_DEBUG("%x %p", ipc_instance->initialized,
+		ipc_priv->instance);
+	ch = &(ipc_instance->ch_list[channel_id]);
+
+	BBDEV_LA12XX_PMD_DEBUG("channel: %u, depth: %u, msg size: %u",
+		channel_id, q_priv->queue_size, msg_size);
+
+	/* Start init of channel */
+	ch->md.ring_size = rte_cpu_to_be_32(q_priv->queue_size);
+	ch->md.pi = 0;
+	ch->md.ci = 0;
+	ch->md.msg_size = msg_size;
+	for (i = 0; i < q_priv->queue_size; i++) {
+		vaddr = rte_malloc(NULL, msg_size, RTE_CACHE_LINE_SIZE);
+		if (!vaddr)
+			return IPC_HOST_BUF_ALLOC_FAIL;
+		/* Only offset now */
+		ch->bd[i].modem_ptr =
+			rte_cpu_to_be_32(HUGEPG_OFFSET(vaddr));
+		ch->bd[i].host_virt_l = lower_32_bits(vaddr);
+		ch->bd[i].host_virt_h = upper_32_bits(vaddr);
+		q_priv->msg_ch_vaddr[i] = vaddr;
+		/* Not sure use of this len may be for CRC*/
+		ch->bd[i].len = 0;
+	}
+	ch->host_ipc_params =
+		rte_cpu_to_be_32(HUGEPG_OFFSET(q_priv->host_params));
+	ch->bl_initialized = 1;
+
+	BBDEV_LA12XX_PMD_DEBUG("Channel configured");
+	return IPC_SUCCESS;
+}
+
+static int
+la12xx_e200_queue_setup(struct rte_bbdev *dev,
+		struct bbdev_la12xx_q_priv *q_priv)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	struct gul_hif *mhif;
+	ipc_metadata_t *ipc_md;
+	ipc_ch_t *ch;
+	int instance_id = 0, i;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		q_priv->la12xx_core_id = BBDEV_LA12XX_LDPC_ENC_CORE;
+		break;
+	case RTE_BBDEV_OP_LDPC_DEC:
+		q_priv->la12xx_core_id = BBDEV_LA12XX_LDPC_DEC_CORE;
+		break;
+	default:
+		BBDEV_LA12XX_PMD_ERR("Unsupported op type\n");
+		return -1;
+	}
+
+	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+	/* offset is from start of PEB */
+	ipc_md = (ipc_metadata_t *)((uint64_t)ipc_priv->peb_start.host_vaddr +
+		mhif->ipc_regs.ipc_mdata_offset);
+	ch = &ipc_md->instance_list[instance_id].ch_list[q_priv->q_id];
+
+	if (q_priv->q_id < priv->num_valid_queues) {
+		ipc_br_md_t *md, *host_md;
+		ipc_ch_t *host_rx_ch;
+
+		host_rx_ch =
+			&ipc_md->instance_list[instance_id].ch_list[q_priv->q_id
+				+ HOST_RX_QUEUEID_OFFSET];
+		md = &(ch->md);
+		host_md = &(host_rx_ch->md);
+
+		q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
+		q_priv->feca_blk_id_be32 = ch->feca_blk_id;
+		q_priv->host_pi = rte_be_to_cpu_32(host_md->pi);
+		q_priv->host_ci = rte_be_to_cpu_32(md->ci);
+		q_priv->host_params = (host_ipc_params_t *)
+			(rte_be_to_cpu_32(ch->host_ipc_params) +
+			((uint64_t)ipc_priv->hugepg_start.host_vaddr));
+
+		for (i = 0; i < q_priv->queue_size; i++) {
+			uint32_t h, l;
+
+			h = host_rx_ch->bd[i].host_virt_h;
+			l = host_rx_ch->bd[i].host_virt_l;
+			q_priv->msg_ch_vaddr[i] = (void *)join_32_bits(h, l);
+		}
+
+		BBDEV_LA12XX_PMD_WARN(
+			"Queue [%d] already configured, not configuring again",
+			q_priv->q_id);
+		return 0;
+	}
+
+	BBDEV_LA12XX_PMD_DEBUG("setting up queue %d", q_priv->q_id);
+
+	q_priv->host_params = rte_zmalloc(NULL, sizeof(host_ipc_params_t),
+			RTE_CACHE_LINE_SIZE);
+	ch->host_ipc_params =
+		rte_cpu_to_be_32(HUGEPG_OFFSET(q_priv->host_params));
+
+	/* Call ipc_configure_channel */
+	ret = ipc_queue_configure((q_priv->q_id + HOST_RX_QUEUEID_OFFSET),
+				  ipc_priv, q_priv);
+	if (ret) {
+		BBDEV_LA12XX_PMD_ERR("Unable to setup queue (%d) (err=%d)",
+		       q_priv->q_id, ret);
+		return ret;
+	}
+
+	/* Set queue properties for LA12xx device */
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		if (priv->num_ldpc_enc_queues >= MAX_LDPC_ENC_FECA_QUEUES) {
+			BBDEV_LA12XX_PMD_ERR(
+				"num_ldpc_enc_queues reached max value");
+			return -1;
+		}
+		ch->la12xx_core_id =
+			rte_cpu_to_be_32(BBDEV_LA12XX_LDPC_ENC_CORE);
+		ch->feca_blk_id = rte_cpu_to_be_32(priv->num_ldpc_enc_queues++);
+		break;
+	case RTE_BBDEV_OP_LDPC_DEC:
+		if (priv->num_ldpc_dec_queues >= MAX_LDPC_DEC_FECA_QUEUES) {
+			BBDEV_LA12XX_PMD_ERR(
+				"num_ldpc_dec_queues reached max value");
+			return -1;
+		}
+		ch->la12xx_core_id =
+			rte_cpu_to_be_32(BBDEV_LA12XX_LDPC_DEC_CORE);
+		ch->feca_blk_id = rte_cpu_to_be_32(priv->num_ldpc_dec_queues++);
+		break;
+	default:
+		BBDEV_LA12XX_PMD_ERR("Not supported op type\n");
+		return -1;
+	}
+	ch->op_type = rte_cpu_to_be_32(q_priv->op_type);
+	ch->depth = rte_cpu_to_be_32(q_priv->queue_size);
+
+	/* Store queue config here */
+	q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
+	q_priv->feca_blk_id_be32 = ch->feca_blk_id;
+
+	return 0;
+}
+
+/* Setup a queue */
+static int
+la12xx_queue_setup(struct rte_bbdev *dev, uint16_t q_id,
+		const struct rte_bbdev_queue_conf *queue_conf)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	struct rte_bbdev_queue_data *q_data;
+	struct bbdev_la12xx_q_priv *q_priv;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* Move to setup_queues callback */
+	q_data = &dev->data->queues[q_id];
+	q_data->queue_private = rte_zmalloc(NULL,
+		sizeof(struct bbdev_la12xx_q_priv), 0);
+	if (!q_data->queue_private) {
+		BBDEV_LA12XX_PMD_ERR("Memory allocation failed for qpriv");
+		return -ENOMEM;
+	}
+	q_priv = q_data->queue_private;
+	q_priv->q_id = q_id;
+	q_priv->bbdev_priv = dev->data->dev_private;
+	q_priv->queue_size = queue_conf->queue_size;
+	q_priv->op_type = queue_conf->op_type;
+
+	ret = la12xx_e200_queue_setup(dev, q_priv);
+	if (ret) {
+		BBDEV_LA12XX_PMD_ERR("e200_queue_setup failed for qid: %d",
+				     q_id);
+		return ret;
+	}
+
+	/* Store queue config here */
+	priv->num_valid_queues++;
+
+	return 0;
+}
+
+static int
+la12xx_start(struct rte_bbdev *dev)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	int ready = 0;
+	struct gul_hif *hif_start;
+
+	PMD_INIT_FUNC_TRACE();
+
+	hif_start = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+
+	/* Set Host Read bit */
+	SET_HIF_HOST_RDY(hif_start, HIF_HOST_READY_IPC_APP);
+
+	/* Now wait for modem ready bit */
+	while (!ready)
+		ready = CHK_HIF_MOD_RDY(hif_start, HIF_MOD_READY_IPC_APP);
+
+	return 0;
+}
+
+static const struct rte_bbdev_ops pmd_ops = {
+	.info_get = la12xx_info_get,
+	.queue_setup = la12xx_queue_setup,
+	.queue_release = la12xx_queue_release,
+	.start = la12xx_start
+};
+static struct hugepage_info *
+get_hugepage_info(void)
+{
+	struct hugepage_info *hp_info;
+	struct rte_memseg *mseg;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* TODO - find a better way */
+	hp_info = rte_malloc(NULL, sizeof(struct hugepage_info), 0);
+	if (!hp_info) {
+		BBDEV_LA12XX_PMD_ERR("Unable to allocate on local heap");
+		return NULL;
+	}
+
+	mseg = rte_mem_virt2memseg(hp_info, NULL);
+	hp_info->vaddr = mseg->addr;
+	hp_info->paddr = rte_mem_virt2phy(mseg->addr);
+	hp_info->len = mseg->len;
+
+	return hp_info;
+}
+
+static int open_ipc_dev(int modem_id)
+{
+	char dev_initials[16], dev_path[PATH_MAX];
+	struct dirent *entry;
+	int dev_ipc = 0;
+	DIR *dir;
+
+	dir = opendir("/dev/");
+	if (!dir) {
+		BBDEV_LA12XX_PMD_ERR("Unable to open /dev/");
+		return -1;
+	}
+
+	sprintf(dev_initials, "gulipcgul%d", modem_id);
+
+	while ((entry = readdir(dir)) != NULL) {
+		if (!strncmp(dev_initials, entry->d_name,
+		    sizeof(dev_initials) - 1))
+			break;
+	}
+
+	if (!entry) {
+		BBDEV_LA12XX_PMD_ERR("Error: No gulipcgul%d device", modem_id);
+		return -1;
+	}
+
+	sprintf(dev_path, "/dev/%s", entry->d_name);
+	dev_ipc = open(dev_path, O_RDWR);
+	if (dev_ipc  < 0) {
+		BBDEV_LA12XX_PMD_ERR("Error: Cannot open %s", dev_path);
+		return -errno;
+	}
+
+	return dev_ipc;
+}
+
+static int
+setup_la12xx_dev(struct rte_bbdev *dev)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	struct hugepage_info *hp = NULL;
+	ipc_channel_us_t *ipc_priv_ch = NULL;
+	int dev_ipc = 0, dev_mem = 0, i;
+	ipc_metadata_t *ipc_md;
+	struct gul_hif *mhif;
+	uint32_t phy_align = 0;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (!ipc_priv) {
+		/* TODO - get a better way */
+		/* Get the hugepage info against it */
+		hp = get_hugepage_info();
+		if (!hp) {
+			BBDEV_LA12XX_PMD_ERR("Unable to get hugepage info");
+			ret = -ENOMEM;
+			goto err;
+		}
+
+		BBDEV_LA12XX_PMD_DEBUG("%lx %p %lx",
+				hp->paddr, hp->vaddr, hp->len);
+
+		ipc_priv = rte_zmalloc(0, sizeof(ipc_userspace_t), 0);
+		if (ipc_priv == NULL) {
+			BBDEV_LA12XX_PMD_ERR(
+				"Unable to allocate memory for ipc priv");
+			ret = -ENOMEM;
+			goto err;
+		}
+
+		for (i = 0; i < IPC_MAX_CHANNEL_COUNT; i++) {
+			ipc_priv_ch = rte_zmalloc(0,
+				sizeof(ipc_channel_us_t), 0);
+			if (ipc_priv_ch == NULL) {
+				BBDEV_LA12XX_PMD_ERR(
+					"Unable to allocate memory for channels");
+				ret = -ENOMEM;
+			}
+			ipc_priv->channels[i] = ipc_priv_ch;
+		}
+
+		dev_mem = open("/dev/mem", O_RDWR);
+		if (dev_mem < 0) {
+			BBDEV_LA12XX_PMD_ERR("Error: Cannot open /dev/mem");
+			ret = -errno;
+			goto err;
+		}
+
+		ipc_priv->instance_id = 0;
+		ipc_priv->dev_mem = dev_mem;
+
+		BBDEV_LA12XX_PMD_DEBUG("hugepg input %lx %p %lx",
+			hp->paddr, hp->vaddr, hp->len);
+
+		ipc_priv->sys_map.hugepg_start.host_phys = hp->paddr;
+		ipc_priv->sys_map.hugepg_start.size = hp->len;
+
+		ipc_priv->hugepg_start.host_phys = hp->paddr;
+		ipc_priv->hugepg_start.host_vaddr = hp->vaddr;
+		ipc_priv->hugepg_start.size = hp->len;
+
+		rte_free(hp);
+	}
+
+	dev_ipc = open_ipc_dev(priv->modem_id);
+	if (dev_ipc < 0) {
+		BBDEV_LA12XX_PMD_ERR("Error: open_ipc_dev failed");
+		goto err;
+	}
+	ipc_priv->dev_ipc = dev_ipc;
+
+	/* Send IOCTL to get system map */
+	/* Send IOCTL to put hugepg_start map */
+	ret = ioctl(ipc_priv->dev_ipc, IOCTL_GUL_IPC_GET_SYS_MAP,
+		    &ipc_priv->sys_map);
+	if (ret) {
+		BBDEV_LA12XX_PMD_ERR(
+			"IOCTL_GUL_IPC_GET_SYS_MAP ioctl failed");
+		goto err;
+	}
+
+	phy_align = (ipc_priv->sys_map.mhif_start.host_phys % 0x1000);
+	ipc_priv->mhif_start.host_vaddr =
+		mmap(0, ipc_priv->sys_map.mhif_start.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.mhif_start.host_phys - phy_align));
+	if (ipc_priv->mhif_start.host_vaddr == MAP_FAILED) {
+		BBDEV_LA12XX_PMD_ERR("MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->mhif_start.host_vaddr = (void *) ((uint64_t)
+		(ipc_priv->mhif_start.host_vaddr) + phy_align);
+
+	phy_align = (ipc_priv->sys_map.peb_start.host_phys % 0x1000);
+	ipc_priv->peb_start.host_vaddr =
+		mmap(0, ipc_priv->sys_map.peb_start.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.peb_start.host_phys - phy_align));
+	if (ipc_priv->peb_start.host_vaddr == MAP_FAILED) {
+		BBDEV_LA12XX_PMD_ERR("MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->peb_start.host_vaddr = (void *)((uint64_t)
+		(ipc_priv->peb_start.host_vaddr) + phy_align);
+
+	phy_align = (ipc_priv->sys_map.modem_ccsrbar.host_phys % 0x1000);
+	ipc_priv->modem_ccsrbar.host_vaddr =
+		mmap(0, ipc_priv->sys_map.modem_ccsrbar.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.modem_ccsrbar.host_phys - phy_align));
+	if (ipc_priv->modem_ccsrbar.host_vaddr == MAP_FAILED) {
+		BBDEV_LA12XX_PMD_ERR("MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->modem_ccsrbar.host_vaddr = (void *)((uint64_t)
+		(ipc_priv->modem_ccsrbar.host_vaddr) + phy_align);
+
+	ipc_priv->hugepg_start.modem_phys =
+		ipc_priv->sys_map.hugepg_start.modem_phys;
+
+	ipc_priv->mhif_start.host_phys =
+		ipc_priv->sys_map.mhif_start.host_phys;
+	ipc_priv->mhif_start.size = ipc_priv->sys_map.mhif_start.size;
+	ipc_priv->peb_start.host_phys = ipc_priv->sys_map.peb_start.host_phys;
+	ipc_priv->peb_start.size = ipc_priv->sys_map.peb_start.size;
+
+	BBDEV_LA12XX_PMD_INFO("peb %lx %p %x",
+			ipc_priv->peb_start.host_phys,
+			ipc_priv->peb_start.host_vaddr,
+			ipc_priv->peb_start.size);
+	BBDEV_LA12XX_PMD_INFO("hugepg %lx %p %x",
+			ipc_priv->hugepg_start.host_phys,
+			ipc_priv->hugepg_start.host_vaddr,
+			ipc_priv->hugepg_start.size);
+	BBDEV_LA12XX_PMD_INFO("mhif %lx %p %x",
+			ipc_priv->mhif_start.host_phys,
+			ipc_priv->mhif_start.host_vaddr,
+			ipc_priv->mhif_start.size);
+	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+
+	/* offset is from start of PEB */
+	ipc_md = (ipc_metadata_t *)((uint64_t)ipc_priv->peb_start.host_vaddr +
+			mhif->ipc_regs.ipc_mdata_offset);
+
+	if (sizeof(ipc_metadata_t) != mhif->ipc_regs.ipc_mdata_size) {
+		BBDEV_LA12XX_PMD_ERR(
+			"\n ipc_metadata_t =%lx, mhif->ipc_regs.ipc_mdata_size=%x",
+			sizeof(ipc_metadata_t), mhif->ipc_regs.ipc_mdata_size);
+		BBDEV_LA12XX_PMD_ERR(
+			"--> mhif->ipc_regs.ipc_mdata_offset= %x",
+			mhif->ipc_regs.ipc_mdata_offset);
+		BBDEV_LA12XX_PMD_ERR(
+			"gul_hif size=%lx", sizeof(struct gul_hif));
+		return IPC_MD_SZ_MISS_MATCH;
+	}
+
+	ipc_priv->instance = (ipc_instance_t *)
+		(&ipc_md->instance_list[ipc_priv->instance_id]);
+
+	BBDEV_LA12XX_PMD_DEBUG("finish host init");
+
+	priv->ipc_priv = ipc_priv;
+
+	return 0;
+
+err:
+	rte_free(hp);
+	rte_free(ipc_priv);
+	rte_free(ipc_priv_ch);
+	if (dev_mem)
+		close(dev_mem);
+	if (dev_ipc)
+		close(dev_ipc);
+
+	return ret;
+}
+
 static inline int
 parse_u16_arg(const char *key, const char *value, void *extra_args)
 {
@@ -123,6 +680,7 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
 	struct bbdev_la12xx_private *priv;
+	int ret;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -152,7 +710,13 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 
 	BBDEV_LA12XX_PMD_INFO("Setting Up %s: DevId=%d, ModemId=%d",
 				name, bbdev->data->dev_id, priv->modem_id);
-	bbdev->dev_ops = NULL;
+	ret = setup_la12xx_dev(bbdev);
+	if (ret) {
+		BBDEV_LA12XX_PMD_ERR("IPC Setup failed for %s", name);
+		rte_free(bbdev->data->dev_private);
+		return ret;
+	}
+	bbdev->dev_ops = &pmd_ops;
 	bbdev->device = &vdev->device;
 	bbdev->data->socket_id = 0;
 	bbdev->intr_handle = NULL;
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.h b/drivers/baseband/la12xx/bbdev_la12xx.h
index 522850233..15231c07d 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx.h
@@ -14,7 +14,7 @@
 #define MAX_CHANNEL_DEPTH 16
 /* private data structure */
 struct bbdev_la12xx_private {
-	void *ipc_priv;
+	ipc_userspace_t *ipc_priv;
 	uint8_t num_valid_queues;
 	uint8_t max_nb_queues;
 	uint8_t num_ldpc_enc_queues;
@@ -52,5 +52,6 @@ struct bbdev_la12xx_q_priv {
 
 #define lower_32_bits(x) ((uint32_t)((uint64_t)x))
 #define upper_32_bits(x) ((uint32_t)(((uint64_t)(x) >> 16) >> 16))
-
+#define join_32_bits(upper, lower) \
+	((uint64_t)(((uint64_t)(upper) << 32) | (uint32_t)(lower)))
 #endif
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
index 9aa556298..1b3a1902e 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -4,9 +4,175 @@
 #ifndef __BBDEV_LA12XX_IPC_H__
 #define __BBDEV_LA12XX_IPC_H__
 
+#define LA12XX_MAX_QUEUES 20
+
+/** No. of max channel per instance */
+#define IPC_MAX_CHANNEL_COUNT	(64)
+
 /** No. of max channel per instance */
 #define IPC_MAX_DEPTH	(16)
 
+/** No. of max IPC instance per modem */
+#define IPC_MAX_INSTANCE_COUNT	(1)
+
+#define HOST_RX_QUEUEID_OFFSET LA12XX_MAX_QUEUES
+
+#define MAX_MEM_POOL_COUNT 8
+
+/** Error codes */
+#define IPC_SUCCESS		(0) /** IPC operation success */
+#define IPC_INPUT_INVALID	(-1) /** Invalid input to API */
+#define IPC_CH_INVALID		(-2) /** Channel no is invalid */
+#define IPC_INSTANCE_INVALID	(-3) /** Instance no is invalid */
+#define IPC_MEM_INVALID		(-4) /** Insufficient memory */
+#define IPC_CH_FULL		(-5) /** Channel is full */
+#define IPC_CH_EMPTY		(-6) /** Channel is empty */
+#define IPC_BL_EMPTY		(-7) /** Free buffer list is empty */
+#define IPC_BL_FULL		(-8) /** Free buffer list is full */
+#define IPC_HOST_BUF_ALLOC_FAIL	(-9) /** DPDK malloc fail */
+#define IPC_MD_SZ_MISS_MATCH	(-10) /** META DATA sz in mhif miss matched*/
+#define IPC_MALLOC_FAIL		(-11) /** system malloc fail */
+#define IPC_IOCTL_FAIL		(-12) /** IOCTL call failed */
+#define IPC_MMAP_FAIL		(-14) /** MMAP fail */
+#define IPC_OPEN_FAIL		(-15) /** OPEN fail */
+#define IPC_EVENTFD_FAIL	(-16) /** eventfd initalization failed */
+#define IPC_NOT_IMPLEMENTED	(-17) /** IPC feature is not implemented yet*/
+
+#define SET_HIF_HOST_RDY(hif, RDY_MASK) (hif->host_ready |= RDY_MASK)
+#define CHK_HIF_MOD_RDY(hif, RDY_MASK) (hif->mod_ready & RDY_MASK)
+
+/* Host Ready bits */
+#define HIF_HOST_READY_HOST_REGIONS	(1 << 0)
+#define HIF_HOST_READY_IPC_LIB		(1 << 12)
+#define HIF_HOST_READY_IPC_APP		(1 << 13)
+#define HIF_HOST_READY_FECA		(1 << 14)
+
+/* Modem Ready bits */
+#define HIF_MOD_READY_IPC_LIB		(1 << 5)
+#define HIF_MOD_READY_IPC_APP		(1 << 6)
+#define HIF_MOD_READY_FECA		(1 << 7)
+
+typedef void *ipc_t;
+
+struct ipc_msg {
+	int chid;
+	void *addr;
+	uint32_t len;
+	uint8_t flags;
+};
+
+typedef struct {
+	uint64_t host_phys;
+	uint32_t modem_phys;
+	void    *host_vaddr;
+	uint32_t size;
+} mem_range_t;
+
+#define GUL_IPC_MAGIC	'R'
+
+#define IOCTL_GUL_IPC_GET_SYS_MAP _IOW(GUL_IPC_MAGIC, 1, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_REGISTER _IOWR(GUL_IPC_MAGIC, 4, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_DEREGISTER \
+	_IOWR(GUL_IPC_MAGIC, 5, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_RAISE_INTERRUPT _IOW(GUL_IPC_MAGIC, 6, int *)
+
+/** buffer ring common metadata */
+typedef struct ipc_bd_ring_md {
+	volatile uint32_t pi;		/**< Producer index and flag (MSB)
+					  *  which flip for each Ring wrapping
+					  */
+	volatile uint32_t ci;		/**< Consumer index and flag (MSB)
+					  *  which flip for each Ring wrapping
+					  */
+	uint32_t ring_size;	/**< depth (Used to roll-over pi/ci) */
+	uint32_t msg_size;	/**< Size of the each buffer */
+} __rte_packed ipc_br_md_t;
+
+/** IPC buffer descriptor */
+typedef struct ipc_buffer_desc {
+	union {
+		uint64_t host_virt;	/**< msg's host virtual address */
+		struct {
+			uint32_t host_virt_l;
+			uint32_t host_virt_h;
+		};
+	};
+	uint64_t host_phy;	/**< msg's host physical address */
+	uint32_t modem_ptr;	/**< msg's modem physical address */
+	uint32_t len;		/**< msg len */
+	uint64_t crc;		/**< crc */
+} __rte_packed ipc_bd_t;
+
+typedef struct ipc_channel {
+	uint32_t ch_id;		/**< Channel id */
+	uint32_t bl_initialized;/**< Set when buffer list is initialized */
+	ipc_br_md_t md;
+	ipc_bd_t bd[IPC_MAX_DEPTH];
+	uint32_t op_type;/* BBDEV operation supported on this channel */
+	uint32_t depth;	/* Channel depth */
+	uint32_t feca_blk_id;/* FECA Transport Block ID for processing */
+	uint32_t la12xx_core_id;/* LA12xx core ID to scheduled work for it*/
+	uint32_t host_ipc_params;/* Address for host IPC parameters */
+} __rte_packed ipc_ch_t;
+
+typedef struct ipc_instance {
+	uint32_t initialized;		/**< Set in ipc_init */
+	ipc_ch_t ch_list[IPC_MAX_CHANNEL_COUNT];
+		/**< Channel descriptors in this instance */
+} __rte_packed ipc_instance_t;
+
+typedef struct ipc_metadata {
+	ipc_instance_t instance_list[IPC_MAX_INSTANCE_COUNT];
+} __rte_packed ipc_metadata_t;
+
+typedef struct ipc_channel_us_priv {
+	int32_t		eventfd;
+	uint32_t	channel_id;
+	/* In flight packets status for buffer list. */
+	uint8_t		bufs_inflight[IPC_MAX_DEPTH];
+} ipc_channel_us_t;
+
+typedef struct {
+	uint64_t host_phys;
+	uint32_t modem_phys;
+	uint32_t size;
+} mem_strt_addr_t;
+
+typedef struct {
+	mem_strt_addr_t modem_ccsrbar;
+	mem_strt_addr_t peb_start; /* PEB meta data */
+	mem_strt_addr_t mhif_start; /* MHIF meta daat */
+	mem_strt_addr_t hugepg_start; /* Modem to access hugepage */
+} sys_map_t;
+
+typedef struct ipc_priv_t {
+	int instance_id;
+	int dev_ipc;
+	int dev_mem;
+	struct rte_mempool *rtemempool[MAX_MEM_POOL_COUNT];
+	sys_map_t sys_map;
+	mem_range_t modem_ccsrbar;
+	mem_range_t peb_start;
+	mem_range_t mhif_start;
+	mem_range_t hugepg_start;
+	ipc_channel_us_t *channels[IPC_MAX_CHANNEL_COUNT];
+	ipc_instance_t	*instance;
+} ipc_userspace_t;
+
+/** Structure specifying enqueue operation (enqueue at LA1224) */
+struct bbdev_ipc_enqueue_op {
+	/** Status of operation that was performed */
+	int32_t status;
+	/** CRC Status of SD operation that was performed */
+	int32_t crc_stat_addr;
+	/** HARQ Output buffer memory length for Shared Decode.
+	 * Filled by LA12xx.
+	 */
+	uint32_t out_len;
+	/** Reserved (for 8 byte alignment) */
+	uint32_t rsvd;
+};
+
 /* This shared memory would be on the host side which have copy of some
  * of the parameters which are also part of Shared BD ring. Read access
  * of these parameters from the host side would not be over PCI.
@@ -17,4 +183,18 @@ typedef struct host_ipc_params {
 	volatile uint32_t modem_ptr[IPC_MAX_DEPTH];
 } __rte_packed host_ipc_params_t;
 
+struct hif_ipc_regs {
+	uint32_t ipc_mdata_offset;
+	uint32_t ipc_mdata_size;
+} __rte_packed;
+
+struct gul_hif {
+	uint32_t ver;
+	uint32_t hif_ver;
+	uint32_t status;
+	volatile uint32_t host_ready;
+	volatile uint32_t mod_ready;
+	struct hif_ipc_regs ipc_regs;
+} __rte_packed;
+
 #endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH 5/6] baseband/la12xx: add enqueue and dequeue support
  2021-03-18  6:34 [dpdk-dev] [PATCH 1/6] baseband: introduce NXP LA12xx driver Hemant Agrawal
                   ` (2 preceding siblings ...)
  2021-03-18  6:34 ` [dpdk-dev] [PATCH 4/6] baseband/la12xx: add queue and modem config support Hemant Agrawal
@ 2021-03-18  6:34 ` Hemant Agrawal
  2021-03-18  6:34 ` [dpdk-dev] [PATCH 6/6] baseband/la12xx: add documentation support Hemant Agrawal
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 157+ messages in thread
From: Hemant Agrawal @ 2021-03-18  6:34 UTC (permalink / raw)
  To: dev; +Cc: Nipun Gupta, Hemant Agrawal

Add support for enqueue and dequeue the LDPC enc/dec
from the modem device.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c     | 393 ++++++++++++++++++++-
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h |  37 ++
 2 files changed, 426 insertions(+), 4 deletions(-)

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index a72ba1c2b..a305771fc 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -117,6 +117,10 @@ la12xx_queue_release(struct rte_bbdev *dev, uint16_t q_id)
 		((uint64_t) ((unsigned long) (A) \
 		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
 
+#define MODEM_P2V(A) \
+	((uint64_t) ((unsigned long) (A) \
+		+ (unsigned long)(ipc_priv->peb_start.host_vaddr)))
+
 static int ipc_queue_configure(uint32_t channel_id,
 		ipc_t instance, struct bbdev_la12xx_q_priv *q_priv)
 {
@@ -345,6 +349,387 @@ static const struct rte_bbdev_ops pmd_ops = {
 	.queue_release = la12xx_queue_release,
 	.start = la12xx_start
 };
+
+static int
+fill_feca_desc_enc(struct bbdev_la12xx_q_priv *q_priv,
+		   struct bbdev_ipc_dequeue_op *bbdev_ipc_op,
+		   struct rte_bbdev_enc_op *bbdev_enc_op,
+		   struct rte_bbdev_op_data *in_op_data)
+{
+	RTE_SET_USED(q_priv);
+	RTE_SET_USED(bbdev_ipc_op);
+	RTE_SET_USED(bbdev_enc_op);
+	RTE_SET_USED(in_op_data);
+
+	return 0;
+}
+
+static int
+fill_feca_desc_dec(struct bbdev_la12xx_q_priv *q_priv,
+		   struct bbdev_ipc_dequeue_op *bbdev_ipc_op,
+		   struct rte_bbdev_dec_op *bbdev_dec_op,
+		   struct rte_bbdev_op_data *out_op_data)
+{
+	RTE_SET_USED(q_priv);
+	RTE_SET_USED(bbdev_ipc_op);
+	RTE_SET_USED(bbdev_dec_op);
+	RTE_SET_USED(out_op_data);
+
+	return 0;
+}
+
+static inline int
+is_bd_ring_full(uint32_t ci, uint32_t ci_flag,
+		uint32_t pi, uint32_t pi_flag)
+{
+	if (pi == ci) {
+		if (pi_flag != ci_flag)
+			return 1; /* Ring is Full */
+	}
+	return 0;
+}
+
+static inline int
+prepare_ldpc_enc_op(struct rte_bbdev_enc_op *bbdev_enc_op,
+		    struct bbdev_ipc_dequeue_op *bbdev_ipc_op,
+		    struct bbdev_la12xx_q_priv *q_priv,
+		    struct rte_bbdev_op_data *in_op_data,
+		    struct rte_bbdev_op_data *out_op_data)
+{
+	struct rte_bbdev_op_ldpc_enc *ldpc_enc = &bbdev_enc_op->ldpc_enc;
+	uint32_t total_out_bits;
+	int ret;
+
+	total_out_bits = (ldpc_enc->tb_params.cab *
+		ldpc_enc->tb_params.ea) + (ldpc_enc->tb_params.c -
+		ldpc_enc->tb_params.cab) * ldpc_enc->tb_params.eb;
+
+	ldpc_enc->output.length = (total_out_bits + 7)/8;
+
+	ret = fill_feca_desc_enc(q_priv, bbdev_ipc_op,
+				 bbdev_enc_op, in_op_data);
+	if (ret) {
+		BBDEV_LA12XX_PMD_ERR(
+			"fill_feca_desc_enc failed, ret: %d", ret);
+		return ret;
+	}
+
+	rte_pktmbuf_append(out_op_data->data, ldpc_enc->output.length);
+
+	return 0;
+}
+
+static inline int
+prepare_ldpc_dec_op(struct rte_bbdev_dec_op *bbdev_dec_op,
+		    struct bbdev_ipc_dequeue_op *bbdev_ipc_op,
+		    struct bbdev_la12xx_q_priv *q_priv,
+		    struct rte_bbdev_op_data *out_op_data)
+{
+	struct rte_bbdev_op_ldpc_dec *ldpc_dec = &bbdev_dec_op->ldpc_dec;
+	uint32_t total_out_bits;
+	uint32_t num_code_blocks = 0;
+	uint16_t sys_cols;
+	int ret;
+
+	sys_cols = (ldpc_dec->basegraph == 1) ? 22 : 10;
+	if (ldpc_dec->tb_params.c == 1) {
+		total_out_bits = ((sys_cols * ldpc_dec->z_c) -
+				ldpc_dec->n_filler);
+		/* 5G-NR protocol uses 16 bit CRC when output packet
+		 * size <= 3824 (bits). Otherwise 24 bit CRC is used.
+		 * Adjust the output bits accordingly
+		 */
+		if (total_out_bits - 16 <= 3824)
+			total_out_bits -= 16;
+		else
+			total_out_bits -= 24;
+		ldpc_dec->hard_output.length = (total_out_bits / 8);
+	} else {
+		total_out_bits = (((sys_cols * ldpc_dec->z_c) -
+				ldpc_dec->n_filler - 24) *
+				ldpc_dec->tb_params.c);
+		ldpc_dec->hard_output.length = (total_out_bits / 8) - 3;
+	}
+
+	num_code_blocks = ldpc_dec->tb_params.c;
+
+	bbdev_ipc_op->num_code_blocks = rte_cpu_to_be_32(num_code_blocks);
+
+	ret = fill_feca_desc_dec(q_priv, bbdev_ipc_op,
+				 bbdev_dec_op, out_op_data);
+	if (ret) {
+		BBDEV_LA12XX_PMD_ERR("fill_feca_desc_dec failed, ret: %d", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+static int
+enqueue_single_op(struct bbdev_la12xx_q_priv *q_priv, void *bbdev_op)
+{
+	struct bbdev_la12xx_private *priv = q_priv->bbdev_priv;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	ipc_instance_t *ipc_instance = ipc_priv->instance;
+	struct bbdev_ipc_dequeue_op *bbdev_ipc_op;
+	struct rte_bbdev_op_ldpc_enc *ldpc_enc;
+	struct rte_bbdev_op_ldpc_dec *ldpc_dec;
+	uint32_t q_id = q_priv->q_id;
+	uint32_t ci, ci_flag, pi, pi_flag;
+	ipc_ch_t *ch = &(ipc_instance->ch_list[q_id]);
+	ipc_br_md_t *md = &(ch->md);
+	uint64_t virt;
+	char *huge_start_addr =
+		(char *)q_priv->bbdev_priv->ipc_priv->hugepg_start.host_vaddr;
+	struct rte_bbdev_op_data *in_op_data, *out_op_data;
+	char *data_ptr;
+	uint32_t l1_pcie_addr;
+	int ret;
+	uint32_t temp_ci;
+
+	temp_ci = q_priv->host_params->ci;
+	ci = IPC_GET_CI_INDEX(temp_ci);
+	ci_flag = IPC_GET_CI_FLAG(temp_ci);
+
+	pi = IPC_GET_PI_INDEX(q_priv->host_pi);
+	pi_flag = IPC_GET_PI_FLAG(q_priv->host_pi);
+
+	BBDEV_LA12XX_PMD_DP_DEBUG(
+		"before bd_ring_full: pi: %u, ci: %u, pi_flag: %u, ci_flag: %u, ring size: %u",
+		pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	if (is_bd_ring_full(ci, ci_flag, pi, pi_flag)) {
+		BBDEV_LA12XX_PMD_DP_DEBUG(
+				"bd ring full for queue id: %d", q_id);
+		return IPC_CH_FULL;
+	}
+
+	virt = MODEM_P2V(q_priv->host_params->modem_ptr[pi]);
+	bbdev_ipc_op = (struct bbdev_ipc_dequeue_op *)virt;
+	q_priv->bbdev_op[pi] = bbdev_op;
+
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		ldpc_enc = &(((struct rte_bbdev_enc_op *)bbdev_op)->ldpc_enc);
+		in_op_data = &ldpc_enc->input;
+		out_op_data = &ldpc_enc->output;
+
+		ret = prepare_ldpc_enc_op(bbdev_op, bbdev_ipc_op, q_priv,
+					  in_op_data, out_op_data);
+		if (ret) {
+			BBDEV_LA12XX_PMD_ERR(
+				"process_ldpc_enc_op failed, ret: %d", ret);
+			return ret;
+		}
+		break;
+
+	case RTE_BBDEV_OP_LDPC_DEC:
+		ldpc_dec = &(((struct rte_bbdev_dec_op *)bbdev_op)->ldpc_dec);
+		in_op_data = &ldpc_dec->input;
+
+			out_op_data = &ldpc_dec->hard_output;
+
+		ret = prepare_ldpc_dec_op(bbdev_op, bbdev_ipc_op,
+					  q_priv, out_op_data);
+		if (ret) {
+			BBDEV_LA12XX_PMD_ERR(
+				"process_ldpc_dec_op failed, ret: %d", ret);
+			return ret;
+		}
+		break;
+
+	default:
+		BBDEV_LA12XX_PMD_ERR("unsupported bbdev_ipc op type");
+		return -1;
+	}
+
+	if (in_op_data->data) {
+		data_ptr = rte_pktmbuf_mtod(in_op_data->data, char *);
+		l1_pcie_addr = (uint32_t)GUL_USER_HUGE_PAGE_ADDR +
+			       data_ptr - huge_start_addr;
+		bbdev_ipc_op->in_addr = l1_pcie_addr;
+		bbdev_ipc_op->in_len = in_op_data->length;
+	}
+
+	if (out_op_data->data) {
+		data_ptr = rte_pktmbuf_mtod(out_op_data->data, char *);
+		l1_pcie_addr = (uint32_t)GUL_USER_HUGE_PAGE_ADDR +
+				data_ptr - huge_start_addr;
+		bbdev_ipc_op->out_addr = rte_cpu_to_be_32(l1_pcie_addr);
+		bbdev_ipc_op->out_len = rte_cpu_to_be_32(out_op_data->length);
+	}
+
+	/* Move Producer Index forward */
+	pi++;
+	/* Flip the PI flag, if wrapping */
+	if (unlikely(q_priv->queue_size == pi)) {
+		pi = 0;
+		pi_flag = pi_flag ? 0 : 1;
+	}
+
+	if (pi_flag)
+		IPC_SET_PI_FLAG(pi);
+	else
+		IPC_RESET_PI_FLAG(pi);
+	/* Wait for Data Copy & pi_flag update to complete before updating pi */
+	rte_mb();
+	/* now update pi */
+	md->pi = rte_cpu_to_be_32(pi);
+	q_priv->host_pi = pi;
+
+	BBDEV_LA12XX_PMD_DP_DEBUG(
+			"enter: pi: %u, ci: %u, pi_flag: %u, ci_flag: %u, ring size: %u",
+			pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	return 0;
+}
+
+/* Enqueue decode burst */
+static uint16_t
+enqueue_dec_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_dec_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	int nb_enqueued, ret;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ret = enqueue_single_op(q_priv, ops[nb_enqueued]);
+		if (ret)
+			break;
+	}
+
+	q_data->queue_stats.enqueue_err_count += nb_ops - nb_enqueued;
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
+/* Enqueue encode burst */
+static uint16_t
+enqueue_enc_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_enc_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	int nb_enqueued, ret;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ret = enqueue_single_op(q_priv, ops[nb_enqueued]);
+		if (ret)
+			break;
+	}
+
+	q_data->queue_stats.enqueue_err_count += nb_ops - nb_enqueued;
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
+static inline int
+is_bd_ring_empty(uint32_t ci, uint32_t ci_flag,
+		 uint32_t pi, uint32_t pi_flag)
+{
+	if (ci == pi) {
+		if (ci_flag == pi_flag)
+			return 1; /* No more Buffer */
+	}
+	return 0;
+}
+
+/* Dequeue encode burst */
+static void *
+dequeue_single_op(struct bbdev_la12xx_q_priv *q_priv, void *dst)
+{
+	struct bbdev_la12xx_private *priv = q_priv->bbdev_priv;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	uint32_t q_id = q_priv->q_id + HOST_RX_QUEUEID_OFFSET;
+	ipc_instance_t *ipc_instance = ipc_priv->instance;
+	ipc_ch_t *ch = &(ipc_instance->ch_list[q_id]);
+	uint32_t ci, ci_flag, pi, pi_flag;
+	ipc_br_md_t *md;
+	void *op;
+	uint32_t temp_pi;
+
+	md = &(ch->md);
+	ci = IPC_GET_CI_INDEX(q_priv->host_ci);
+	ci_flag = IPC_GET_CI_FLAG(q_priv->host_ci);
+
+	temp_pi = q_priv->host_params->pi;
+	pi = IPC_GET_PI_INDEX(temp_pi);
+	pi_flag = IPC_GET_PI_FLAG(temp_pi);
+
+	if (is_bd_ring_empty(ci, ci_flag, pi, pi_flag))
+		return NULL;
+
+	BBDEV_LA12XX_PMD_DP_DEBUG(
+		"pi: %u, ci: %u, pi_flag: %u, ci_flag: %u, ring size: %u",
+		pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	op = q_priv->bbdev_op[ci];
+
+	rte_memcpy(dst, q_priv->msg_ch_vaddr[ci],
+		sizeof(struct bbdev_ipc_enqueue_op));
+
+	/* Move Consumer Index forward */
+	ci++;
+	/* Flip the CI flag, if wrapping */
+	if (q_priv->queue_size == ci) {
+		ci = 0;
+		ci_flag = ci_flag ? 0 : 1;
+	}
+	if (ci_flag)
+		IPC_SET_CI_FLAG(ci);
+	else
+		IPC_RESET_CI_FLAG(ci);
+	md->ci = rte_cpu_to_be_32(ci);
+	q_priv->host_ci = ci;
+
+	BBDEV_LA12XX_PMD_DP_DEBUG(
+		"exit: pi: %u, ci: %u, pi_flag: %u, ci_flag: %u, ring size: %u",
+		pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	return op;
+}
+
+/* Dequeue decode burst */
+static uint16_t
+dequeue_dec_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_dec_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	struct bbdev_ipc_enqueue_op bbdev_ipc_op;
+	int nb_dequeued;
+
+	for (nb_dequeued = 0; nb_dequeued < nb_ops; nb_dequeued++) {
+		ops[nb_dequeued] = dequeue_single_op(q_priv, &bbdev_ipc_op);
+		if (!ops[nb_dequeued])
+			break;
+		ops[nb_dequeued]->status = bbdev_ipc_op.status;
+	}
+	q_data->queue_stats.dequeued_count += nb_dequeued;
+
+	return nb_dequeued;
+}
+
+/* Dequeue encode burst */
+static uint16_t
+dequeue_enc_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_enc_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	struct bbdev_ipc_enqueue_op bbdev_ipc_op;
+	int nb_enqueued;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ops[nb_enqueued] = dequeue_single_op(q_priv, &bbdev_ipc_op);
+		if (!ops[nb_enqueued])
+			break;
+		ops[nb_enqueued]->status = bbdev_ipc_op.status;
+	}
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
 static struct hugepage_info *
 get_hugepage_info(void)
 {
@@ -722,10 +1107,10 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 	bbdev->intr_handle = NULL;
 
 	/* register rx/tx burst functions for data path */
-	bbdev->dequeue_enc_ops = NULL;
-	bbdev->dequeue_dec_ops = NULL;
-	bbdev->enqueue_enc_ops = NULL;
-	bbdev->enqueue_dec_ops = NULL;
+	bbdev->dequeue_enc_ops = dequeue_enc_ops;
+	bbdev->dequeue_dec_ops = dequeue_dec_ops;
+	bbdev->enqueue_enc_ops = enqueue_enc_ops;
+	bbdev->enqueue_dec_ops = enqueue_dec_ops;
 
 	return 0;
 }
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
index 1b3a1902e..290528e2b 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -76,6 +76,25 @@ typedef struct {
 	_IOWR(GUL_IPC_MAGIC, 5, struct ipc_msg *)
 #define IOCTL_GUL_IPC_CHANNEL_RAISE_INTERRUPT _IOW(GUL_IPC_MAGIC, 6, int *)
 
+#define GUL_USER_HUGE_PAGE_OFFSET	(0)
+#define GUL_PCI1_ADDR_BASE	(0x00000000ULL)
+
+#define GUL_USER_HUGE_PAGE_ADDR	(GUL_PCI1_ADDR_BASE + GUL_USER_HUGE_PAGE_OFFSET)
+
+/* IPC PI/CI index & flag manipulation helpers */
+#define IPC_PI_CI_FLAG_MASK	0x80000000 /*  (1<<31) */
+#define IPC_PI_CI_INDEX_MASK	0x7FFFFFFF /* ~(1<<31) */
+
+#define IPC_SET_PI_FLAG(x)	(x |= IPC_PI_CI_FLAG_MASK)
+#define IPC_RESET_PI_FLAG(x)	(x &= IPC_PI_CI_INDEX_MASK)
+#define IPC_GET_PI_FLAG(x)	(x >> 31)
+#define IPC_GET_PI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
+
+#define IPC_SET_CI_FLAG(x)	(x |= IPC_PI_CI_FLAG_MASK)
+#define IPC_RESET_CI_FLAG(x)	(x &= IPC_PI_CI_INDEX_MASK)
+#define IPC_GET_CI_FLAG(x)	(x >> 31)
+#define IPC_GET_CI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
+
 /** buffer ring common metadata */
 typedef struct ipc_bd_ring_md {
 	volatile uint32_t pi;		/**< Producer index and flag (MSB)
@@ -173,6 +192,24 @@ struct bbdev_ipc_enqueue_op {
 	uint32_t rsvd;
 };
 
+/** Structure specifying dequeue operation (dequeue at LA1224) */
+struct bbdev_ipc_dequeue_op {
+	/** Input buffer memory address */
+	uint32_t in_addr;
+	/** Input buffer memory length */
+	uint32_t in_len;
+	/** Output buffer memory address */
+	uint32_t out_addr;
+	/** Output buffer memory length */
+	uint32_t out_len;
+	/* Number of code blocks. Only set when HARQ is used */
+	uint32_t num_code_blocks;
+	/** Dequeue Operation flags */
+	uint32_t op_flags;
+	/** Shared metadata between L1 and L2 */
+	uint32_t shared_metadata;
+};
+
 /* This shared memory would be on the host side which have copy of some
  * of the parameters which are also part of Shared BD ring. Read access
  * of these parameters from the host side would not be over PCI.
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH 6/6] baseband/la12xx: add documentation support
  2021-03-18  6:34 [dpdk-dev] [PATCH 1/6] baseband: introduce NXP LA12xx driver Hemant Agrawal
                   ` (3 preceding siblings ...)
  2021-03-18  6:34 ` [dpdk-dev] [PATCH 5/6] baseband/la12xx: add enqueue and dequeue support Hemant Agrawal
@ 2021-03-18  6:34 ` Hemant Agrawal
  2021-03-18 14:53 ` [dpdk-dev] [PATCH 1/6] baseband: introduce NXP LA12xx driver David Marchand
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 157+ messages in thread
From: Hemant Agrawal @ 2021-03-18  6:34 UTC (permalink / raw)
  To: dev; +Cc: Nipun Gupta, Hemant Agrawal

This patch add documentation for LA12xx PMD.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 MAINTAINERS                            |   9 ++
 doc/guides/bbdevs/features/la12xx.ini  |  14 +++
 doc/guides/bbdevs/index.rst            |   1 +
 doc/guides/bbdevs/la12xx.rst           | 139 +++++++++++++++++++++++++
 doc/guides/rel_notes/release_21_05.rst |   5 +
 5 files changed, 168 insertions(+)
 create mode 100644 doc/guides/bbdevs/features/la12xx.ini
 create mode 100644 doc/guides/bbdevs/la12xx.rst

diff --git a/MAINTAINERS b/MAINTAINERS
index e341bc81d..655e802ad 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1289,6 +1289,15 @@ F: doc/guides/rawdevs/ntb.rst
 F: examples/ntb/
 F: doc/guides/sample_app_ug/ntb.rst
 
+Baseband Drivers
+-------------------
+
+NXP LA12xx
+M: Hemant Agrawal <hemant.agrawal@nxp.com>
+M: Nipun Gupta <nipun.gupta@nxp.com>
+F: drivers/baseband/la12xx/
+F: doc/guides/bbdevs/la12xx.rst
+F: doc/guides/bbdevs/features/la12xx.ini
 
 Packet processing
 -----------------
diff --git a/doc/guides/bbdevs/features/la12xx.ini b/doc/guides/bbdevs/features/la12xx.ini
new file mode 100644
index 000000000..979d9dd22
--- /dev/null
+++ b/doc/guides/bbdevs/features/la12xx.ini
@@ -0,0 +1,14 @@
+;
+; Supported features of the 'la12xx' bbdev driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Turbo Decoder (4G)     = N
+Turbo Encoder (4G)     = N
+LDPC Decoder (5G)      = Y
+LDPC Encoder (5G)      = Y
+LLR/HARQ Compression   = N
+External DDR Access    = Y
+HW Accelerated         = Y
+BBDEV API              = Y
diff --git a/doc/guides/bbdevs/index.rst b/doc/guides/bbdevs/index.rst
index 4445cbd1b..cedd706fa 100644
--- a/doc/guides/bbdevs/index.rst
+++ b/doc/guides/bbdevs/index.rst
@@ -14,3 +14,4 @@ Baseband Device Drivers
     fpga_lte_fec
     fpga_5gnr_fec
     acc100
+    la12xx
diff --git a/doc/guides/bbdevs/la12xx.rst b/doc/guides/bbdevs/la12xx.rst
new file mode 100644
index 000000000..1cadd6f33
--- /dev/null
+++ b/doc/guides/bbdevs/la12xx.rst
@@ -0,0 +1,139 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright 2021 NXP
+
+NXP LA12xx Poll Mode Driver
+=======================================
+
+The BBDEV LA12xx poll mode driver (PMD) supports an implementation for
+offloading High Phy processing functions like LDPC Encode / Decode 5GNR wireless
+acceleration function, using PCI based LA12xx Software defined radio.
+
+More information can be found at `NXP Official Website
+<https://www.nxp.com/products/processors-and-microcontrollers/arm-processors/layerscape-processors/layerscape-access-la1200-programmable-baseband-processor:LA1200>`_.
+
+Features
+--------
+
+LA12xx PMD supports the following features:
+
+- LDPC Encode in the DL
+- LDPC Decode in the UL
+- Maximum of 8 UL queues
+- Maximum of 8 DL queues
+- PCIe Gen-3 x8 Interface
+- MSI-X
+
+LA12xx PMD supports the following BBDEV capabilities:
+
+* For the LDPC encode operation:
+   - ``RTE_BBDEV_LDPC_CRC_24B_ATTACH`` :  set to attach CRC24B to CB(s)
+   - ``RTE_BBDEV_LDPC_RATE_MATCH`` :  if set then do not do Rate Match bypass
+
+* For the LDPC decode operation:
+   - ``RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK`` :  check CRC24B from CB(s)
+   - ``RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP`` :  drops CRC24B bits appended while decoding
+   - ``RTE_BBDEV_LDPC_DEC_SCATTER_GATHER`` :  supports scatter-gather for input/output data
+
+Installation
+------------
+
+Section 3 of the DPDK manual provides instructions on installing and compiling DPDK.
+
+DPDK requires hugepages to be configured as detailed in section 2 of the DPDK manual.
+
+Initialization
+--------------
+
+The device can be listed on the host console with:
+
+
+Use the following lspci command to get the multiple LA12xx processor ids. The
+device ID of the LA12xx baseband processor is "1c30".
+
+.. code-block:: console
+
+  sudo lspci -nn
+
+...
+0001:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device [1957:1c30] (
+rev 10)
+...
+0002:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device [1957:1c30] (
+rev 10)
+
+
+Prerequisites
+-------------
+
+Currently supported by DPDK:
+
+- NXP LA1224 BSP **1.0+**.
+- NXP LA1224 PCIe Modem card connected to ARM host.
+
+- Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup the basic DPDK environment.
+
+* Use dev arg option ``modem=0`` to identify the modem instance for a given
+  device. This is required only if more than 1 modem cards are attached to host.
+  this is optional and the default value is 0.
+  e.g. ``--vdev=baseband_la12xx,modem=0``
+
+* Use dev arg option ``max_nb_queues=x`` to specify the maximum number of queues
+  to be used for communication with offload device i.e. modem. default is 16.
+  e.g. ``--vdev=baseband_la12xx,max_nb_queues=4``
+
+Enabling logs
+-------------
+
+For enabling logs, use the following EAL parameter:
+
+.. code-block:: console
+
+   ./your_bbdev_application <EAL args> --log-level=la12xx:<level>
+
+Using ``bb.la12xx`` as log matching criteria, all Baseband PMD logs can be
+enabled which are lower than logging ``level``.
+
+
+Test Application
+----------------
+
+BBDEV provides a test application, ``test-bbdev.py`` and range of test data for testing
+the functionality of LA12xx for FEC encode and decode, depending on the device
+capabilities. The test application is located under app->test-bbdev folder and has the
+following options:
+
+.. code-block:: console
+
+  "-p", "--testapp-path": specifies path to the bbdev test app.
+  "-e", "--eal-params"	: EAL arguments which are passed to the test app.
+  "-t", "--timeout"	: Timeout in seconds (default=300).
+  "-c", "--test-cases"	: Defines test cases to run. Run all if not specified.
+  "-v", "--test-vector"	: Test vector path (default=dpdk_path+/app/test-bbdev/test_vectors/bbdev_null.data).
+  "-n", "--num-ops"	: Number of operations to process on device (default=32).
+  "-b", "--burst-size"	: Operations enqueue/dequeue burst size (default=32).
+  "-s", "--snr"		: SNR in dB used when generating LLRs for bler tests.
+  "-s", "--iter_max"	: Number of iterations for LDPC decoder.
+  "-l", "--num-lcores"	: Number of lcores to run (default=16).
+  "-i", "--init-device" : Initialise PF device with default values.
+
+
+To execute the test application tool using simple decode or encode data,
+type one of the following:
+
+.. code-block:: console
+
+  ./test-bbdev.py -e="--vdev=baseband_la12xx,socket_id=0,max_nb_queues=8" -c validation -n 64 -b 1 -v ./ldpc_dec_default.data
+  ./test-bbdev.py -e="--vdev=baseband_la12xx,socket_id=0,max_nb_queues=8" -c validation -n 64 -b 1 -v ./ldpc_enc_default.data
+
+The test application ``test-bbdev.py``, supports the ability to configure the PF device with
+a default set of values, if the "-i" or "- -init-device" option is included. The default values
+are defined in test_bbdev_perf.c.
+
+
+Test Vectors
+~~~~~~~~~~~~
+
+In addition to the simple LDPC decoder and LDPC encoder tests, bbdev also provides
+a range of additional tests under the test_vectors folder, which may be useful. The results
+of these tests will depend on the LA12xx FEC capabilities which may cause some
+testcases to be skipped, but no failure should be reported.
diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
index 5aa9ed7db..9d4fb9c7c 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -55,6 +55,11 @@ New Features
      Also, make sure to start the actual text at the margin.
      =======================================================
 
+* **Added NXP LA12xx baseband PMD.**
+
+  Added a new baseband PMD driver for NXP LA12xx Software defined radio.
+
+  See the :doc:`../bbdevs/la12xx` for more details.
 
 Removed Items
 -------------
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH 1/6] baseband: introduce NXP LA12xx driver
  2021-03-18  6:34 [dpdk-dev] [PATCH 1/6] baseband: introduce NXP LA12xx driver Hemant Agrawal
                   ` (4 preceding siblings ...)
  2021-03-18  6:34 ` [dpdk-dev] [PATCH 6/6] baseband/la12xx: add documentation support Hemant Agrawal
@ 2021-03-18 14:53 ` David Marchand
  2021-03-19  5:54   ` Hemant Agrawal
  2021-04-10 17:02 ` [dpdk-dev] [PATCH v2 0/8] baseband: add " Hemant Agrawal
                   ` (7 subsequent siblings)
  13 siblings, 1 reply; 157+ messages in thread
From: David Marchand @ 2021-03-18 14:53 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, Nipun Gupta, Nicolas Chautru, Akhil Goyal

On Thu, Mar 18, 2021 at 7:38 AM Hemant Agrawal <hemant.agrawal@nxp.com> wrote:
>
> This patch introduce the baseband device drivers for NXP's
> LA1200 series software defined baseband modem.

Such a series deserves a cover letter.
You should copy bbdev maintainer and cryptodev subtree maintainer.

Quickly looked at the series, I see no change on the bbdev unit test code.
Are those tests running fine with no modification (I sure hope so, but
I want a confirmation).


>
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>  drivers/baseband/la12xx/bbdev_la12xx.c        | 110 ++++++++++++++++++
>  .../baseband/la12xx/bbdev_la12xx_pmd_logs.h   |  38 ++++++
>  drivers/baseband/la12xx/meson.build           |   6 +
>  drivers/baseband/la12xx/version.map           |   3 +
>  drivers/baseband/meson.build                  |   2 +-
>  5 files changed, 158 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.c
>  create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
>  create mode 100644 drivers/baseband/la12xx/meson.build
>  create mode 100644 drivers/baseband/la12xx/version.map
>

[snip]

> +};
> +
> +RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
> +RTE_PMD_REGISTER_ALIAS(DRIVER_NAME, bbdev_la12xx);

Quick glance at this patch, no need for an alias.
Alias are for maintaining compatibility when drivers are renamed but
this is a new driver.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH 1/6] baseband: introduce NXP LA12xx driver
  2021-03-18 14:53 ` [dpdk-dev] [PATCH 1/6] baseband: introduce NXP LA12xx driver David Marchand
@ 2021-03-19  5:54   ` Hemant Agrawal
  2021-04-08  8:55     ` [dpdk-dev] [EXT] " Akhil Goyal
  0 siblings, 1 reply; 157+ messages in thread
From: Hemant Agrawal @ 2021-03-19  5:54 UTC (permalink / raw)
  To: David Marchand, Hemant Agrawal; +Cc: dev, Nipun Gupta, Nicolas Chautru, gakhil


On 3/18/2021 8:23 PM, David Marchand wrote:
> On Thu, Mar 18, 2021 at 7:38 AM Hemant Agrawal <hemant.agrawal@nxp.com> wrote:
>> This patch introduce the baseband device drivers for NXP's
>> LA1200 series software defined baseband modem.
> Such a series deserves a cover letter.
Ok. I will do that in v2.
> You should copy bbdev maintainer and cryptodev subtree maintainer.
Yes, changing the Akhil's id. He moved on.
>
> Quickly looked at the series, I see no change on the bbdev unit test code.
> Are those tests running fine with no modification (I sure hope so, but
> I want a confirmation).
>
Good catch! Yes, we have made the changes and we are in the process of 
cleaning them up.

We will be posting them to mailing list soon.

>> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
>> ---
>>   drivers/baseband/la12xx/bbdev_la12xx.c        | 110 ++++++++++++++++++
>>   .../baseband/la12xx/bbdev_la12xx_pmd_logs.h   |  38 ++++++
>>   drivers/baseband/la12xx/meson.build           |   6 +
>>   drivers/baseband/la12xx/version.map           |   3 +
>>   drivers/baseband/meson.build                  |   2 +-
>>   5 files changed, 158 insertions(+), 1 deletion(-)
>>   create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.c
>>   create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
>>   create mode 100644 drivers/baseband/la12xx/meson.build
>>   create mode 100644 drivers/baseband/la12xx/version.map
>>
> [snip]
>
>> +};
>> +
>> +RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
>> +RTE_PMD_REGISTER_ALIAS(DRIVER_NAME, bbdev_la12xx);
> Quick glance at this patch, no need for an alias.
> Alias are for maintaining compatibility when drivers are renamed but
> this is a new driver.
Ok.
>
>

^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [EXT] Re: [PATCH 1/6] baseband: introduce NXP LA12xx driver
  2021-03-19  5:54   ` Hemant Agrawal
@ 2021-04-08  8:55     ` Akhil Goyal
  2021-04-08  8:57       ` Hemant Agrawal
  2021-04-08 15:29       ` Chautru, Nicolas
  0 siblings, 2 replies; 157+ messages in thread
From: Akhil Goyal @ 2021-04-08  8:55 UTC (permalink / raw)
  To: hemant.agrawal, David Marchand; +Cc: dev, Nipun Gupta, Nicolas Chautru

Hi Hemant/Nipun,

Could you please send a new version soon?
If review is completed, I would like to take it in RC1, i.e. 15th March.

Regards,
Akhil
> 
> On 3/18/2021 8:23 PM, David Marchand wrote:
> > On Thu, Mar 18, 2021 at 7:38 AM Hemant Agrawal
> <hemant.agrawal@nxp.com> wrote:
> >> This patch introduce the baseband device drivers for NXP's
> >> LA1200 series software defined baseband modem.
> > Such a series deserves a cover letter.
> Ok. I will do that in v2.
> > You should copy bbdev maintainer and cryptodev subtree maintainer.
> Yes, changing the Akhil's id. He moved on.
> >
> > Quickly looked at the series, I see no change on the bbdev unit test code.
> > Are those tests running fine with no modification (I sure hope so, but
> > I want a confirmation).
> >
> Good catch! Yes, we have made the changes and we are in the process of
> cleaning them up.
> 
> We will be posting them to mailing list soon.
> 
> >> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> >> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> >> ---
> >>   drivers/baseband/la12xx/bbdev_la12xx.c        | 110
> ++++++++++++++++++
> >>   .../baseband/la12xx/bbdev_la12xx_pmd_logs.h   |  38 ++++++
> >>   drivers/baseband/la12xx/meson.build           |   6 +
> >>   drivers/baseband/la12xx/version.map           |   3 +
> >>   drivers/baseband/meson.build                  |   2 +-
> >>   5 files changed, 158 insertions(+), 1 deletion(-)
> >>   create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.c
> >>   create mode 100644
> drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
> >>   create mode 100644 drivers/baseband/la12xx/meson.build
> >>   create mode 100644 drivers/baseband/la12xx/version.map
> >>
> > [snip]
> >
> >> +};
> >> +
> >> +RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
> >> +RTE_PMD_REGISTER_ALIAS(DRIVER_NAME, bbdev_la12xx);
> > Quick glance at this patch, no need for an alias.
> > Alias are for maintaining compatibility when drivers are renamed but
> > this is a new driver.
> Ok.
> >
> >

^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [EXT] Re: [PATCH 1/6] baseband: introduce NXP LA12xx driver
  2021-04-08  8:55     ` [dpdk-dev] [EXT] " Akhil Goyal
@ 2021-04-08  8:57       ` Hemant Agrawal
  2021-04-08 15:29       ` Chautru, Nicolas
  1 sibling, 0 replies; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-08  8:57 UTC (permalink / raw)
  To: dev


On 4/8/2021 2:25 PM, Akhil Goyal wrote:
> Hi Hemant/Nipun,
>
> Could you please send a new version soon?
> If review is completed, I would like to take it in RC1, i.e. 15th March.

yes, we are working on fixing few things. We will send it by weekend.

Regards,

Hemant



> Regards,
> Akhil
>> On 3/18/2021 8:23 PM, David Marchand wrote:
>>> On Thu, Mar 18, 2021 at 7:38 AM Hemant Agrawal
>> <hemant.agrawal@nxp.com> wrote:
>>>> This patch introduce the baseband device drivers for NXP's
>>>> LA1200 series software defined baseband modem.
>>> Such a series deserves a cover letter.
>> Ok. I will do that in v2.
>>> You should copy bbdev maintainer and cryptodev subtree maintainer.
>> Yes, changing the Akhil's id. He moved on.
>>> Quickly looked at the series, I see no change on the bbdev unit test code.
>>> Are those tests running fine with no modification (I sure hope so, but
>>> I want a confirmation).
>>>
>> Good catch! Yes, we have made the changes and we are in the process of
>> cleaning them up.
>>
>> We will be posting them to mailing list soon.
>>
>>>> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
>>>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
>>>> ---
>>>>    drivers/baseband/la12xx/bbdev_la12xx.c        | 110
>> ++++++++++++++++++
>>>>    .../baseband/la12xx/bbdev_la12xx_pmd_logs.h   |  38 ++++++
>>>>    drivers/baseband/la12xx/meson.build           |   6 +
>>>>    drivers/baseband/la12xx/version.map           |   3 +
>>>>    drivers/baseband/meson.build                  |   2 +-
>>>>    5 files changed, 158 insertions(+), 1 deletion(-)
>>>>    create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.c
>>>>    create mode 100644
>> drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
>>>>    create mode 100644 drivers/baseband/la12xx/meson.build
>>>>    create mode 100644 drivers/baseband/la12xx/version.map
>>>>
>>> [snip]
>>>
>>>> +};
>>>> +
>>>> +RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
>>>> +RTE_PMD_REGISTER_ALIAS(DRIVER_NAME, bbdev_la12xx);
>>> Quick glance at this patch, no need for an alias.
>>> Alias are for maintaining compatibility when drivers are renamed but
>>> this is a new driver.
>> Ok.
>>>

^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [EXT] Re: [PATCH 1/6] baseband: introduce NXP LA12xx driver
  2021-04-08  8:55     ` [dpdk-dev] [EXT] " Akhil Goyal
  2021-04-08  8:57       ` Hemant Agrawal
@ 2021-04-08 15:29       ` Chautru, Nicolas
  1 sibling, 0 replies; 157+ messages in thread
From: Chautru, Nicolas @ 2021-04-08 15:29 UTC (permalink / raw)
  To: Akhil Goyal, hemant.agrawal, David Marchand; +Cc: dev, Nipun Gupta

Note that I did not review this serie yet as v2 was pending (+ did not receive the initial serie). Planning to send comments once that v2 is formally shared. 

> -----Original Message-----
> From: Akhil Goyal <gakhil@marvell.com>
> Sent: Thursday, April 8, 2021 1:56 AM
> To: hemant.agrawal@nxp.com; David Marchand
> <david.marchand@redhat.com>
> Cc: dev <dev@dpdk.org>; Nipun Gupta <nipun.gupta@nxp.com>; Chautru,
> Nicolas <nicolas.chautru@intel.com>
> Subject: RE: [EXT] Re: [dpdk-dev] [PATCH 1/6] baseband: introduce NXP
> LA12xx driver
> 
> Hi Hemant/Nipun,
> 
> Could you please send a new version soon?
> If review is completed, I would like to take it in RC1, i.e. 15th March.
> 
> Regards,
> Akhil
> >
> > On 3/18/2021 8:23 PM, David Marchand wrote:
> > > On Thu, Mar 18, 2021 at 7:38 AM Hemant Agrawal
> > <hemant.agrawal@nxp.com> wrote:
> > >> This patch introduce the baseband device drivers for NXP's
> > >> LA1200 series software defined baseband modem.
> > > Such a series deserves a cover letter.
> > Ok. I will do that in v2.
> > > You should copy bbdev maintainer and cryptodev subtree maintainer.
> > Yes, changing the Akhil's id. He moved on.
> > >
> > > Quickly looked at the series, I see no change on the bbdev unit test code.
> > > Are those tests running fine with no modification (I sure hope so,
> > > but I want a confirmation).
> > >
> > Good catch! Yes, we have made the changes and we are in the process of
> > cleaning them up.
> >
> > We will be posting them to mailing list soon.
> >
> > >> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > >> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> > >> ---
> > >>   drivers/baseband/la12xx/bbdev_la12xx.c        | 110
> > ++++++++++++++++++
> > >>   .../baseband/la12xx/bbdev_la12xx_pmd_logs.h   |  38 ++++++
> > >>   drivers/baseband/la12xx/meson.build           |   6 +
> > >>   drivers/baseband/la12xx/version.map           |   3 +
> > >>   drivers/baseband/meson.build                  |   2 +-
> > >>   5 files changed, 158 insertions(+), 1 deletion(-)
> > >>   create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.c
> > >>   create mode 100644
> > drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
> > >>   create mode 100644 drivers/baseband/la12xx/meson.build
> > >>   create mode 100644 drivers/baseband/la12xx/version.map
> > >>
> > > [snip]
> > >
> > >> +};
> > >> +
> > >> +RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
> > >> +RTE_PMD_REGISTER_ALIAS(DRIVER_NAME, bbdev_la12xx);
> > > Quick glance at this patch, no need for an alias.
> > > Alias are for maintaining compatibility when drivers are renamed but
> > > this is a new driver.
> > Ok.
> > >
> > >

^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v2 0/8] baseband: add NXP LA12xx driver
  2021-03-18  6:34 [dpdk-dev] [PATCH 1/6] baseband: introduce NXP LA12xx driver Hemant Agrawal
                   ` (5 preceding siblings ...)
  2021-03-18 14:53 ` [dpdk-dev] [PATCH 1/6] baseband: introduce NXP LA12xx driver David Marchand
@ 2021-04-10 17:02 ` Hemant Agrawal
  2021-04-10 17:02   ` [dpdk-dev] [PATCH v2 1/8] baseband: introduce " Hemant Agrawal
                     ` (8 more replies)
  2021-09-12 12:15 ` [dpdk-dev] [PATCH v5 0/9] " Nipun Gupta
                   ` (6 subsequent siblings)
  13 siblings, 9 replies; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-10 17:02 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand

This series introduces the BBDEV LA12xx poll mode driver (PMD) to support
an implementation for offloading High Phy processing functions like LDPC Encode / Decode
5GNR wireless acceleration function, using PCI based LA12xx Software defined radio.

Please check the documentation patch for more info.

The driver currently implements basic feature to offload only the 5G LDPC encode/decode.

Modifications has been done in test vectors to optionally support input in network byte order.

Two test vectors are also added as an example with data in network byte order.

Hemant Agrawal (6):
  baseband: introduce NXP LA12xx driver
  baseband/la12xx: add devargs for max queues
  baseband/la12xx: add support for multiple modems
  baseband/la12xx: add queue and modem config support
  baseband/la12xx: add enqueue and dequeue support
  baseband/la12xx: add documentation support

Nipun Gupta (2):
  app/bbdev: add parameter to take input in network order
  app/bbdev: add test vectors for transport blocks

 MAINTAINERS                                   |    9 +
 app/test-bbdev/test_bbdev_vector.c            |   18 +-
 app/test-bbdev/test_bbdev_vector.h            |    2 +
 app/test-bbdev/test_vectors/ldpc_dec_tb.data  |  362 +++++
 app/test-bbdev/test_vectors/ldpc_enc_tb.data  |  482 +++++++
 doc/guides/bbdevs/features/la12xx.ini         |   14 +
 doc/guides/bbdevs/index.rst                   |    1 +
 doc/guides/bbdevs/la12xx.rst                  |  139 ++
 doc/guides/rel_notes/release_21_05.rst        |    5 +
 drivers/baseband/la12xx/bbdev_la12xx.c        | 1180 +++++++++++++++++
 drivers/baseband/la12xx/bbdev_la12xx.h        |   57 +
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h    |  237 ++++
 .../baseband/la12xx/bbdev_la12xx_pmd_logs.h   |   38 +
 drivers/baseband/la12xx/meson.build           |    6 +
 drivers/baseband/la12xx/version.map           |    3 +
 drivers/baseband/meson.build                  |    2 +-
 16 files changed, 2552 insertions(+), 3 deletions(-)
 create mode 100644 app/test-bbdev/test_vectors/ldpc_dec_tb.data
 create mode 100644 app/test-bbdev/test_vectors/ldpc_enc_tb.data
 create mode 100644 doc/guides/bbdevs/features/la12xx.ini
 create mode 100644 doc/guides/bbdevs/la12xx.rst
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.c
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_ipc.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
 create mode 100644 drivers/baseband/la12xx/meson.build
 create mode 100644 drivers/baseband/la12xx/version.map

-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v2 1/8] baseband: introduce NXP LA12xx driver
  2021-04-10 17:02 ` [dpdk-dev] [PATCH v2 0/8] baseband: add " Hemant Agrawal
@ 2021-04-10 17:02   ` Hemant Agrawal
  2021-04-10 17:02   ` [dpdk-dev] [PATCH v2 2/8] baseband/la12xx: add devargs for max queues Hemant Agrawal
                     ` (7 subsequent siblings)
  8 siblings, 0 replies; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-10 17:02 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, Nipun Gupta, Hemant Agrawal

This patch introduce the baseband device drivers for NXP's
LA1200 series software defined baseband modem.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c        | 109 ++++++++++++++++++
 .../baseband/la12xx/bbdev_la12xx_pmd_logs.h   |  38 ++++++
 drivers/baseband/la12xx/meson.build           |   6 +
 drivers/baseband/la12xx/version.map           |   3 +
 drivers/baseband/meson.build                  |   2 +-
 5 files changed, 157 insertions(+), 1 deletion(-)
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.c
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
 create mode 100644 drivers/baseband/la12xx/meson.build
 create mode 100644 drivers/baseband/la12xx/version.map

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
new file mode 100644
index 0000000000..7050b17728
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -0,0 +1,109 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+
+#include <string.h>
+
+#include <rte_common.h>
+#include <rte_bus_vdev.h>
+#include <rte_malloc.h>
+#include <rte_ring.h>
+#include <rte_kvargs.h>
+
+#include <rte_bbdev.h>
+#include <rte_bbdev_pmd.h>
+
+#include <bbdev_la12xx_pmd_logs.h>
+
+#define DRIVER_NAME baseband_la12xx
+
+RTE_LOG_REGISTER(bbdev_la12xx_logtype, pmd.bb.la12xx, NOTICE);
+
+/* private data structure */
+struct bbdev_la12xx_private {
+	unsigned int max_nb_queues;  /**< Max number of queues */
+};
+/* Create device */
+static int
+la12xx_bbdev_create(struct rte_vdev_device *vdev)
+{
+	struct rte_bbdev *bbdev;
+	const char *name = rte_vdev_device_name(vdev);
+
+	PMD_INIT_FUNC_TRACE();
+
+	bbdev = rte_bbdev_allocate(name);
+	if (bbdev == NULL)
+		return -ENODEV;
+
+	bbdev->data->dev_private = rte_zmalloc(name,
+			sizeof(struct bbdev_la12xx_private),
+			RTE_CACHE_LINE_SIZE);
+	if (bbdev->data->dev_private == NULL) {
+		rte_bbdev_release(bbdev);
+		return -ENOMEM;
+	}
+
+	bbdev->dev_ops = NULL;
+	bbdev->device = &vdev->device;
+	bbdev->data->socket_id = 0;
+	bbdev->intr_handle = NULL;
+
+	/* register rx/tx burst functions for data path */
+	bbdev->dequeue_enc_ops = NULL;
+	bbdev->dequeue_dec_ops = NULL;
+	bbdev->enqueue_enc_ops = NULL;
+	bbdev->enqueue_dec_ops = NULL;
+
+	return 0;
+}
+
+/* Initialise device */
+static int
+la12xx_bbdev_probe(struct rte_vdev_device *vdev)
+{
+	const char *name;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (vdev == NULL)
+		return -EINVAL;
+
+	name = rte_vdev_device_name(vdev);
+	if (name == NULL)
+		return -EINVAL;
+
+	return la12xx_bbdev_create(vdev);
+}
+
+/* Uninitialise device */
+static int
+la12xx_bbdev_remove(struct rte_vdev_device *vdev)
+{
+	struct rte_bbdev *bbdev;
+	const char *name;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (vdev == NULL)
+		return -EINVAL;
+
+	name = rte_vdev_device_name(vdev);
+	if (name == NULL)
+		return -EINVAL;
+
+	bbdev = rte_bbdev_get_named_dev(name);
+	if (bbdev == NULL)
+		return -EINVAL;
+
+	rte_free(bbdev->data->dev_private);
+
+	return rte_bbdev_release(bbdev);
+}
+
+static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
+	.probe = la12xx_bbdev_probe,
+	.remove = la12xx_bbdev_remove
+};
+
+RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h b/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
new file mode 100644
index 0000000000..71613a5bac
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020 NXP
+ */
+
+#ifndef _BBDEV_LA12XX_PMD_LOGS_H_
+#define _BBDEV_LA12XX_PMD_LOGS_H_
+
+#define BBDEV_LA12XX_PMD_LOG(level, fmt, args...) \
+	rte_log(RTE_LOG_ ## level, bbdev_la12xx_logtype, "bbdev_la12xx: " \
+		fmt "\n", ##args)
+
+#define BBDEV_LA12XX_PMD_DEBUG(fmt, args...) \
+	rte_log(RTE_LOG_DEBUG, bbdev_la12xx_logtype, "bbdev_la12xx: %s(): "\
+		fmt "\n", __func__, ##args)
+
+#define PMD_INIT_FUNC_TRACE() BBDEV_LA12XX_PMD_DEBUG(">>")
+
+#define BBDEV_LA12XX_PMD_CRIT(fmt, args...) \
+	BBDEV_LA12XX_PMD_LOG(CRIT, fmt, ## args)
+#define BBDEV_LA12XX_PMD_INFO(fmt, args...) \
+	BBDEV_LA12XX_PMD_LOG(INFO, fmt, ## args)
+#define BBDEV_LA12XX_PMD_ERR(fmt, args...) \
+	BBDEV_LA12XX_PMD_LOG(ERR, fmt, ## args)
+#define BBDEV_LA12XX_PMD_WARN(fmt, args...) \
+	BBDEV_LA12XX_PMD_LOG(WARNING, fmt, ## args)
+
+/* DP Logs, toggled out at compile time if level lower than current level */
+#define BBDEV_LA12XX_PMD_DP_LOG(level, fmt, args...) \
+	RTE_LOG_DP(level, PMD, fmt, ## args)
+
+#define BBDEV_LA12XX_PMD_DP_DEBUG(fmt, args...) \
+	BBDEV_LA12XX_PMD_DP_LOG(DEBUG, fmt, ## args)
+#define BBDEV_LA12XX_PMD_DP_INFO(fmt, args...) \
+	BBDEV_LA12XX_PMD_DP_LOG(INFO, fmt, ## args)
+#define BBDEV_LA12XX_PMD_DP_WARN(fmt, args...) \
+	BBDEV_LA12XX_PMD_DP_LOG(WARNING, fmt, ## args)
+
+#endif /* _BBDEV_LA12XX_PMD_LOGS_H_ */
diff --git a/drivers/baseband/la12xx/meson.build b/drivers/baseband/la12xx/meson.build
new file mode 100644
index 0000000000..7a017dcffa
--- /dev/null
+++ b/drivers/baseband/la12xx/meson.build
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020-2021 NXP
+
+deps += ['bbdev', 'bus_vdev', 'ring']
+
+sources = files('bbdev_la12xx.c')
diff --git a/drivers/baseband/la12xx/version.map b/drivers/baseband/la12xx/version.map
new file mode 100644
index 0000000000..4a76d1d52d
--- /dev/null
+++ b/drivers/baseband/la12xx/version.map
@@ -0,0 +1,3 @@
+DPDK_21 {
+	local: *;
+};
diff --git a/drivers/baseband/meson.build b/drivers/baseband/meson.build
index 920e3b02ee..ba5b2e570a 100644
--- a/drivers/baseband/meson.build
+++ b/drivers/baseband/meson.build
@@ -5,4 +5,4 @@ if is_windows
 	subdir_done()
 endif
 
-drivers = ['null', 'turbo_sw', 'fpga_lte_fec', 'fpga_5gnr_fec', 'acc100']
+drivers = ['null', 'turbo_sw', 'fpga_lte_fec', 'fpga_5gnr_fec', 'acc100', 'la12xx']
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v2 2/8] baseband/la12xx: add devargs for max queues
  2021-04-10 17:02 ` [dpdk-dev] [PATCH v2 0/8] baseband: add " Hemant Agrawal
  2021-04-10 17:02   ` [dpdk-dev] [PATCH v2 1/8] baseband: introduce " Hemant Agrawal
@ 2021-04-10 17:02   ` Hemant Agrawal
  2021-04-10 17:02   ` [dpdk-dev] [PATCH v2 3/8] baseband/la12xx: add support for multiple modems Hemant Agrawal
                     ` (6 subsequent siblings)
  8 siblings, 0 replies; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-10 17:02 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, Nipun Gupta, Hemant Agrawal

This patch adds dev args to take  max queues as input

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c | 72 +++++++++++++++++++++++++-
 1 file changed, 70 insertions(+), 2 deletions(-)

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 7050b17728..8fc58ce5ae 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -19,13 +19,72 @@
 
 RTE_LOG_REGISTER(bbdev_la12xx_logtype, pmd.bb.la12xx, NOTICE);
 
+/*  Initialisation params structure that can be used by LA12xx BBDEV driver */
+struct bbdev_la12xx_params {
+	uint8_t queues_num; /*< LA12xx BBDEV queues number */
+};
+
+#define BBDEV_LA12XX_MAX_NB_QUEUES_ARG  "max_nb_queues"
+
+static const char * const bbdev_la12xx_valid_params[] = {
+	BBDEV_LA12XX_MAX_NB_QUEUES_ARG,
+};
+
 /* private data structure */
 struct bbdev_la12xx_private {
 	unsigned int max_nb_queues;  /**< Max number of queues */
 };
+static inline int
+parse_u16_arg(const char *key, const char *value, void *extra_args)
+{
+	uint16_t *u16 = extra_args;
+
+	unsigned int long result;
+	if ((value == NULL) || (extra_args == NULL))
+		return -EINVAL;
+	errno = 0;
+	result = strtoul(value, NULL, 0);
+	if ((result >= (1 << 16)) || (errno != 0)) {
+		BBDEV_LA12XX_PMD_ERR("Invalid value %lu for %s", result, key);
+		return -ERANGE;
+	}
+	*u16 = (uint16_t)result;
+	return 0;
+}
+
+/* Parse parameters used to create device */
+static int
+parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
+		const char *input_args)
+{
+	struct rte_kvargs *kvlist = NULL;
+	int ret = 0;
+
+	if (params == NULL)
+		return -EINVAL;
+	if (input_args) {
+		kvlist = rte_kvargs_parse(input_args,
+				bbdev_la12xx_valid_params);
+		if (kvlist == NULL)
+			return -EFAULT;
+
+		ret = rte_kvargs_process(kvlist, bbdev_la12xx_valid_params[0],
+					&parse_u16_arg, &params->queues_num);
+		if (ret < 0)
+			goto exit;
+
+	}
+
+exit:
+	if (kvlist)
+		rte_kvargs_free(kvlist);
+	return ret;
+}
+
 /* Create device */
 static int
-la12xx_bbdev_create(struct rte_vdev_device *vdev)
+la12xx_bbdev_create(struct rte_vdev_device *vdev,
+		struct bbdev_la12xx_params *init_params)
 {
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
@@ -62,7 +121,11 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev)
 static int
 la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 {
+	struct bbdev_la12xx_params init_params = {
+		RTE_BBDEV_DEFAULT_MAX_NB_QUEUES
+	};
 	const char *name;
+	const char *input_args;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -73,7 +136,10 @@ la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 	if (name == NULL)
 		return -EINVAL;
 
-	return la12xx_bbdev_create(vdev);
+	input_args = rte_vdev_device_args(vdev);
+	parse_bbdev_la12xx_params(&init_params, input_args);
+
+	return la12xx_bbdev_create(vdev, &init_params);
 }
 
 /* Uninitialise device */
@@ -107,3 +173,5 @@ static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
 };
 
 RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
+RTE_PMD_REGISTER_PARAM_STRING(DRIVER_NAME,
+	BBDEV_LA12XX_MAX_NB_QUEUES_ARG"=<int>");
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v2 3/8] baseband/la12xx: add support for multiple modems
  2021-04-10 17:02 ` [dpdk-dev] [PATCH v2 0/8] baseband: add " Hemant Agrawal
  2021-04-10 17:02   ` [dpdk-dev] [PATCH v2 1/8] baseband: introduce " Hemant Agrawal
  2021-04-10 17:02   ` [dpdk-dev] [PATCH v2 2/8] baseband/la12xx: add devargs for max queues Hemant Agrawal
@ 2021-04-10 17:02   ` Hemant Agrawal
  2021-04-10 17:02   ` [dpdk-dev] [PATCH v2 4/8] baseband/la12xx: add queue and modem config support Hemant Agrawal
                     ` (5 subsequent siblings)
  8 siblings, 0 replies; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-10 17:02 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, Hemant Agrawal

This patch add support for multiple modems by assigning
a modem id as dev args in vdev creation.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c     | 62 +++++++++++++++++++---
 drivers/baseband/la12xx/bbdev_la12xx.h     | 56 +++++++++++++++++++
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 20 +++++++
 3 files changed, 132 insertions(+), 6 deletions(-)
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_ipc.h

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 8fc58ce5ae..3837e43d8e 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -14,6 +14,8 @@
 #include <rte_bbdev_pmd.h>
 
 #include <bbdev_la12xx_pmd_logs.h>
+#include <bbdev_la12xx_ipc.h>
+#include <bbdev_la12xx.h>
 
 #define DRIVER_NAME baseband_la12xx
 
@@ -22,18 +24,18 @@ RTE_LOG_REGISTER(bbdev_la12xx_logtype, pmd.bb.la12xx, NOTICE);
 /*  Initialisation params structure that can be used by LA12xx BBDEV driver */
 struct bbdev_la12xx_params {
 	uint8_t queues_num; /*< LA12xx BBDEV queues number */
+	int8_t modem_id; /*< LA12xx modem instance id */
 };
 
 #define BBDEV_LA12XX_MAX_NB_QUEUES_ARG  "max_nb_queues"
+#define BBDEV_LA12XX_VDEV_MODEM_ID_ARG	"modem"
+#define LA12XX_MAX_MODEM 4
 
 static const char * const bbdev_la12xx_valid_params[] = {
 	BBDEV_LA12XX_MAX_NB_QUEUES_ARG,
+	BBDEV_LA12XX_VDEV_MODEM_ID_ARG,
 };
 
-/* private data structure */
-struct bbdev_la12xx_private {
-	unsigned int max_nb_queues;  /**< Max number of queues */
-};
 static inline int
 parse_u16_arg(const char *key, const char *value, void *extra_args)
 {
@@ -52,6 +54,28 @@ parse_u16_arg(const char *key, const char *value, void *extra_args)
 	return 0;
 }
 
+/* Parse integer from integer argument */
+static int
+parse_integer_arg(const char *key __rte_unused,
+		const char *value, void *extra_args)
+{
+	int i;
+	char *end;
+
+	errno = 0;
+
+	i = strtol(value, &end, 10);
+	if (*end != 0 || errno != 0 || i < 0 || i > LA12XX_MAX_MODEM) {
+		BBDEV_LA12XX_PMD_ERR("Supported Port IDS are 0 to %d",
+			LA12XX_MAX_MODEM - 1);
+		return -EINVAL;
+	}
+
+	*((uint32_t *)extra_args) = i;
+
+	return 0;
+}
+
 /* Parse parameters used to create device */
 static int
 parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
@@ -73,6 +97,16 @@ parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
 		if (ret < 0)
 			goto exit;
 
+		ret = rte_kvargs_process(kvlist,
+					bbdev_la12xx_valid_params[1],
+					&parse_integer_arg,
+					&params->modem_id);
+
+		if (params->modem_id >= LA12XX_MAX_MODEM) {
+			BBDEV_LA12XX_PMD_ERR("Invalid modem id, must be < %u",
+					LA12XX_MAX_MODEM);
+			goto exit;
+		}
 	}
 
 exit:
@@ -88,6 +122,7 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 {
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
+	struct bbdev_la12xx_private *priv;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -103,6 +138,20 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 		return -ENOMEM;
 	}
 
+	priv = bbdev->data->dev_private;
+	priv->modem_id = init_params->modem_id;
+	/* if modem id is not configured */
+	if (priv->modem_id == -1)
+		priv->modem_id = bbdev->data->dev_id;
+
+	/* Reset Global variables */
+	priv->num_ldpc_enc_queues = 0;
+	priv->num_ldpc_dec_queues = 0;
+	priv->num_valid_queues = 0;
+	priv->max_nb_queues = init_params->queues_num;
+
+	BBDEV_LA12XX_PMD_INFO("Setting Up %s: DevId=%d, ModemId=%d",
+				name, bbdev->data->dev_id, priv->modem_id);
 	bbdev->dev_ops = NULL;
 	bbdev->device = &vdev->device;
 	bbdev->data->socket_id = 0;
@@ -122,7 +171,7 @@ static int
 la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 {
 	struct bbdev_la12xx_params init_params = {
-		RTE_BBDEV_DEFAULT_MAX_NB_QUEUES
+		RTE_BBDEV_DEFAULT_MAX_NB_QUEUES, -1,
 	};
 	const char *name;
 	const char *input_args;
@@ -174,4 +223,5 @@ static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
 
 RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
 RTE_PMD_REGISTER_PARAM_STRING(DRIVER_NAME,
-	BBDEV_LA12XX_MAX_NB_QUEUES_ARG"=<int>");
+	BBDEV_LA12XX_MAX_NB_QUEUES_ARG"=<int>"
+	BBDEV_LA12XX_VDEV_MODEM_ID_ARG "=<int> ");
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.h b/drivers/baseband/la12xx/bbdev_la12xx.h
new file mode 100644
index 0000000000..5228502331
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx.h
@@ -0,0 +1,56 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+
+#ifndef __BBDEV_LA12XX_H__
+#define __BBDEV_LA12XX_H__
+
+#define BBDEV_IPC_ENC_OP_TYPE	1
+#define BBDEV_IPC_DEC_OP_TYPE	2
+
+#define MAX_LDPC_ENC_FECA_QUEUES	4
+#define MAX_LDPC_DEC_FECA_QUEUES	4
+
+#define MAX_CHANNEL_DEPTH 16
+/* private data structure */
+struct bbdev_la12xx_private {
+	void *ipc_priv;
+	uint8_t num_valid_queues;
+	uint8_t max_nb_queues;
+	uint8_t num_ldpc_enc_queues;
+	uint8_t num_ldpc_dec_queues;
+	int8_t modem_id;
+	struct bbdev_la12xx_q_priv *queues_priv[32];
+};
+
+struct hugepage_info {
+	void *vaddr;
+	phys_addr_t paddr;
+	size_t len;
+};
+
+struct bbdev_la12xx_q_priv {
+	struct bbdev_la12xx_private *bbdev_priv;
+	uint32_t q_id;	/**< Channel ID */
+	uint32_t feca_blk_id;	/** FECA block ID for processing */
+	uint32_t feca_blk_id_be32; /**< FECA Block ID for this queue */
+	uint8_t en_napi; /* 0: napi disabled, 1: napi enabled */
+	uint16_t queue_size;	/**< Queue depth */
+	int32_t eventfd;	/**< Event FD value */
+	enum rte_bbdev_op_type op_type; /**< Operation type */
+	uint32_t la12xx_core_id;
+		/* LA12xx core ID on which this will be scheduled */
+	struct rte_mempool *mp; /**< Pool from where buffers would be cut */
+	void *bbdev_op[MAX_CHANNEL_DEPTH];
+			/**< Stores bbdev op for each index */
+	void *msg_ch_vaddr[MAX_CHANNEL_DEPTH];
+			/**< Stores msg channel addr for modem->host */
+	uint32_t host_pi;	/**< Producer_Index for HOST->MODEM */
+	uint32_t host_ci;	/**< Consumer Index for MODEM->HOST */
+	host_ipc_params_t *host_params; /**< Host parameters */
+};
+
+#define lower_32_bits(x) ((uint32_t)((uint64_t)x))
+#define upper_32_bits(x) ((uint32_t)(((uint64_t)(x) >> 16) >> 16))
+
+#endif
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
new file mode 100644
index 0000000000..9aa5562981
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+#ifndef __BBDEV_LA12XX_IPC_H__
+#define __BBDEV_LA12XX_IPC_H__
+
+/** No. of max channel per instance */
+#define IPC_MAX_DEPTH	(16)
+
+/* This shared memory would be on the host side which have copy of some
+ * of the parameters which are also part of Shared BD ring. Read access
+ * of these parameters from the host side would not be over PCI.
+ */
+typedef struct host_ipc_params {
+	volatile uint32_t pi;
+	volatile uint32_t ci;
+	volatile uint32_t modem_ptr[IPC_MAX_DEPTH];
+} __rte_packed host_ipc_params_t;
+
+#endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v2 4/8] baseband/la12xx: add queue and modem config support
  2021-04-10 17:02 ` [dpdk-dev] [PATCH v2 0/8] baseband: add " Hemant Agrawal
                     ` (2 preceding siblings ...)
  2021-04-10 17:02   ` [dpdk-dev] [PATCH v2 3/8] baseband/la12xx: add support for multiple modems Hemant Agrawal
@ 2021-04-10 17:02   ` Hemant Agrawal
  2021-04-10 17:02   ` [dpdk-dev] [PATCH v2 5/8] baseband/la12xx: add enqueue and dequeue support Hemant Agrawal
                     ` (4 subsequent siblings)
  8 siblings, 0 replies; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-10 17:02 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, Nipun Gupta, Hemant Agrawal

This patch add support for connecting with modem
and creating the ipc channel as queues with modem
for the exchange of data.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c     | 566 ++++++++++++++++++++-
 drivers/baseband/la12xx/bbdev_la12xx.h     |   5 +-
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 180 +++++++
 3 files changed, 748 insertions(+), 3 deletions(-)

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 3837e43d8e..7347106866 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -3,6 +3,11 @@
  */
 
 #include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <dirent.h>
 
 #include <rte_common.h>
 #include <rte_bus_vdev.h>
@@ -31,11 +36,563 @@ struct bbdev_la12xx_params {
 #define BBDEV_LA12XX_VDEV_MODEM_ID_ARG	"modem"
 #define LA12XX_MAX_MODEM 4
 
+#define LA12XX_MAX_CORES	4
+#define BBDEV_LA12XX_LDPC_ENC_CORE	0
+#define BBDEV_LA12XX_LDPC_DEC_CORE	1
+
 static const char * const bbdev_la12xx_valid_params[] = {
 	BBDEV_LA12XX_MAX_NB_QUEUES_ARG,
 	BBDEV_LA12XX_VDEV_MODEM_ID_ARG,
 };
 
+static const struct rte_bbdev_op_cap bbdev_capabilities[] = {
+	{
+		.type   = RTE_BBDEV_OP_LDPC_ENC,
+		.cap.ldpc_enc = {
+			.capability_flags =
+					RTE_BBDEV_LDPC_CRC_24A_ATTACH |
+					RTE_BBDEV_LDPC_CRC_24B_ATTACH,
+			.num_buffers_src =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+			.num_buffers_dst =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+		}
+	},
+	{
+		.type   = RTE_BBDEV_OP_LDPC_DEC,
+		.cap.ldpc_dec = {
+			.capability_flags =
+				RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK |
+					RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK |
+					RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP,
+			.num_buffers_src =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+			.num_buffers_hard_out =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+		}
+	},
+	RTE_BBDEV_END_OF_CAPABILITIES_LIST()
+};
+
+static struct rte_bbdev_queue_conf default_queue_conf = {
+	.queue_size = MAX_CHANNEL_DEPTH,
+};
+
+/* Get device info */
+static void
+la12xx_info_get(struct rte_bbdev *dev,
+		struct rte_bbdev_driver_info *dev_info)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	dev_info->driver_name = RTE_STR(DRIVER_NAME);
+	dev_info->max_num_queues = LA12XX_MAX_QUEUES;
+	dev_info->queue_size_lim = MAX_CHANNEL_DEPTH;
+	dev_info->hardware_accelerated = true;
+	dev_info->max_dl_queue_priority = 0;
+	dev_info->max_ul_queue_priority = 0;
+	dev_info->default_queue_conf = default_queue_conf;
+	dev_info->capabilities = bbdev_capabilities;
+	dev_info->cpu_flag_reqs = NULL;
+	dev_info->min_alignment = 64;
+
+	BBDEV_LA12XX_PMD_DEBUG("got device info from %u", dev->data->dev_id);
+}
+
+/* Release queue */
+static int
+la12xx_queue_release(struct rte_bbdev *dev, uint16_t q_id)
+{
+	RTE_SET_USED(dev);
+	RTE_SET_USED(q_id);
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* TODO: Implement */
+
+	return 0;
+}
+
+#define HUGEPG_OFFSET(A) \
+		((uint64_t) ((unsigned long) (A) \
+		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
+
+static int ipc_queue_configure(uint32_t channel_id,
+		ipc_t instance, struct bbdev_la12xx_q_priv *q_priv)
+{
+	ipc_userspace_t *ipc_priv = (ipc_userspace_t *)instance;
+	ipc_instance_t *ipc_instance = ipc_priv->instance;
+	ipc_ch_t *ch;
+	void *vaddr;
+	uint32_t i = 0;
+	uint32_t msg_size = sizeof(struct bbdev_ipc_enqueue_op);
+
+	PMD_INIT_FUNC_TRACE();
+
+	BBDEV_LA12XX_PMD_DEBUG("%x %p", ipc_instance->initialized,
+		ipc_priv->instance);
+	ch = &(ipc_instance->ch_list[channel_id]);
+
+	BBDEV_LA12XX_PMD_DEBUG("channel: %u, depth: %u, msg size: %u",
+		channel_id, q_priv->queue_size, msg_size);
+
+	/* Start init of channel */
+	ch->md.ring_size = rte_cpu_to_be_32(q_priv->queue_size);
+	ch->md.pi = 0;
+	ch->md.ci = 0;
+	ch->md.msg_size = msg_size;
+	for (i = 0; i < q_priv->queue_size; i++) {
+		vaddr = rte_malloc(NULL, msg_size, RTE_CACHE_LINE_SIZE);
+		if (!vaddr)
+			return IPC_HOST_BUF_ALLOC_FAIL;
+		/* Only offset now */
+		ch->bd[i].modem_ptr =
+			rte_cpu_to_be_32(HUGEPG_OFFSET(vaddr));
+		ch->bd[i].host_virt_l = lower_32_bits(vaddr);
+		ch->bd[i].host_virt_h = upper_32_bits(vaddr);
+		q_priv->msg_ch_vaddr[i] = vaddr;
+		/* Not sure use of this len may be for CRC*/
+		ch->bd[i].len = 0;
+	}
+	ch->host_ipc_params =
+		rte_cpu_to_be_32(HUGEPG_OFFSET(q_priv->host_params));
+	ch->bl_initialized = 1;
+
+	BBDEV_LA12XX_PMD_DEBUG("Channel configured");
+	return IPC_SUCCESS;
+}
+
+static int
+la12xx_e200_queue_setup(struct rte_bbdev *dev,
+		struct bbdev_la12xx_q_priv *q_priv)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	struct gul_hif *mhif;
+	ipc_metadata_t *ipc_md;
+	ipc_ch_t *ch;
+	int instance_id = 0, i;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		q_priv->la12xx_core_id = BBDEV_LA12XX_LDPC_ENC_CORE;
+		break;
+	case RTE_BBDEV_OP_LDPC_DEC:
+		q_priv->la12xx_core_id = BBDEV_LA12XX_LDPC_DEC_CORE;
+		break;
+	default:
+		BBDEV_LA12XX_PMD_ERR("Unsupported op type\n");
+		return -1;
+	}
+
+	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+	/* offset is from start of PEB */
+	ipc_md = (ipc_metadata_t *)((uint64_t)ipc_priv->peb_start.host_vaddr +
+		mhif->ipc_regs.ipc_mdata_offset);
+	ch = &ipc_md->instance_list[instance_id].ch_list[q_priv->q_id];
+
+	if (q_priv->q_id < priv->num_valid_queues) {
+		ipc_br_md_t *md, *host_md;
+		ipc_ch_t *host_rx_ch;
+
+		host_rx_ch =
+			&ipc_md->instance_list[instance_id].ch_list[q_priv->q_id
+				+ HOST_RX_QUEUEID_OFFSET];
+		md = &(ch->md);
+		host_md = &(host_rx_ch->md);
+
+		q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
+		q_priv->feca_blk_id_be32 = ch->feca_blk_id;
+		q_priv->host_pi = rte_be_to_cpu_32(host_md->pi);
+		q_priv->host_ci = rte_be_to_cpu_32(md->ci);
+		q_priv->host_params = (host_ipc_params_t *)
+			(rte_be_to_cpu_32(ch->host_ipc_params) +
+			((uint64_t)ipc_priv->hugepg_start.host_vaddr));
+
+		for (i = 0; i < q_priv->queue_size; i++) {
+			uint32_t h, l;
+
+			h = host_rx_ch->bd[i].host_virt_h;
+			l = host_rx_ch->bd[i].host_virt_l;
+			q_priv->msg_ch_vaddr[i] = (void *)join_32_bits(h, l);
+		}
+
+		BBDEV_LA12XX_PMD_WARN(
+			"Queue [%d] already configured, not configuring again",
+			q_priv->q_id);
+		return 0;
+	}
+
+	BBDEV_LA12XX_PMD_DEBUG("setting up queue %d", q_priv->q_id);
+
+	q_priv->host_params = rte_zmalloc(NULL, sizeof(host_ipc_params_t),
+			RTE_CACHE_LINE_SIZE);
+	ch->host_ipc_params =
+		rte_cpu_to_be_32(HUGEPG_OFFSET(q_priv->host_params));
+
+	/* Call ipc_configure_channel */
+	ret = ipc_queue_configure((q_priv->q_id + HOST_RX_QUEUEID_OFFSET),
+				  ipc_priv, q_priv);
+	if (ret) {
+		BBDEV_LA12XX_PMD_ERR("Unable to setup queue (%d) (err=%d)",
+		       q_priv->q_id, ret);
+		return ret;
+	}
+
+	/* Set queue properties for LA12xx device */
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		if (priv->num_ldpc_enc_queues >= MAX_LDPC_ENC_FECA_QUEUES) {
+			BBDEV_LA12XX_PMD_ERR(
+				"num_ldpc_enc_queues reached max value");
+			return -1;
+		}
+		ch->la12xx_core_id =
+			rte_cpu_to_be_32(BBDEV_LA12XX_LDPC_ENC_CORE);
+		ch->feca_blk_id = rte_cpu_to_be_32(priv->num_ldpc_enc_queues++);
+		break;
+	case RTE_BBDEV_OP_LDPC_DEC:
+		if (priv->num_ldpc_dec_queues >= MAX_LDPC_DEC_FECA_QUEUES) {
+			BBDEV_LA12XX_PMD_ERR(
+				"num_ldpc_dec_queues reached max value");
+			return -1;
+		}
+		ch->la12xx_core_id =
+			rte_cpu_to_be_32(BBDEV_LA12XX_LDPC_DEC_CORE);
+		ch->feca_blk_id = rte_cpu_to_be_32(priv->num_ldpc_dec_queues++);
+		break;
+	default:
+		BBDEV_LA12XX_PMD_ERR("Not supported op type\n");
+		return -1;
+	}
+	ch->op_type = rte_cpu_to_be_32(q_priv->op_type);
+	ch->depth = rte_cpu_to_be_32(q_priv->queue_size);
+
+	/* Store queue config here */
+	q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
+	q_priv->feca_blk_id_be32 = ch->feca_blk_id;
+
+	return 0;
+}
+
+/* Setup a queue */
+static int
+la12xx_queue_setup(struct rte_bbdev *dev, uint16_t q_id,
+		const struct rte_bbdev_queue_conf *queue_conf)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	struct rte_bbdev_queue_data *q_data;
+	struct bbdev_la12xx_q_priv *q_priv;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* Move to setup_queues callback */
+	q_data = &dev->data->queues[q_id];
+	q_data->queue_private = rte_zmalloc(NULL,
+		sizeof(struct bbdev_la12xx_q_priv), 0);
+	if (!q_data->queue_private) {
+		BBDEV_LA12XX_PMD_ERR("Memory allocation failed for qpriv");
+		return -ENOMEM;
+	}
+	q_priv = q_data->queue_private;
+	q_priv->q_id = q_id;
+	q_priv->bbdev_priv = dev->data->dev_private;
+	q_priv->queue_size = queue_conf->queue_size;
+	q_priv->op_type = queue_conf->op_type;
+
+	ret = la12xx_e200_queue_setup(dev, q_priv);
+	if (ret) {
+		BBDEV_LA12XX_PMD_ERR("e200_queue_setup failed for qid: %d",
+				     q_id);
+		return ret;
+	}
+
+	/* Store queue config here */
+	priv->num_valid_queues++;
+
+	return 0;
+}
+
+static int
+la12xx_start(struct rte_bbdev *dev)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	int ready = 0;
+	struct gul_hif *hif_start;
+
+	PMD_INIT_FUNC_TRACE();
+
+	hif_start = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+
+	/* Set Host Read bit */
+	SET_HIF_HOST_RDY(hif_start, HIF_HOST_READY_IPC_APP);
+
+	/* Now wait for modem ready bit */
+	while (!ready)
+		ready = CHK_HIF_MOD_RDY(hif_start, HIF_MOD_READY_IPC_APP);
+
+	return 0;
+}
+
+static const struct rte_bbdev_ops pmd_ops = {
+	.info_get = la12xx_info_get,
+	.queue_setup = la12xx_queue_setup,
+	.queue_release = la12xx_queue_release,
+	.start = la12xx_start
+};
+static struct hugepage_info *
+get_hugepage_info(void)
+{
+	struct hugepage_info *hp_info;
+	struct rte_memseg *mseg;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* TODO - find a better way */
+	hp_info = rte_malloc(NULL, sizeof(struct hugepage_info), 0);
+	if (!hp_info) {
+		BBDEV_LA12XX_PMD_ERR("Unable to allocate on local heap");
+		return NULL;
+	}
+
+	mseg = rte_mem_virt2memseg(hp_info, NULL);
+	hp_info->vaddr = mseg->addr;
+	hp_info->paddr = rte_mem_virt2phy(mseg->addr);
+	hp_info->len = mseg->len;
+
+	return hp_info;
+}
+
+static int open_ipc_dev(int modem_id)
+{
+	char dev_initials[16], dev_path[PATH_MAX];
+	struct dirent *entry;
+	int dev_ipc = 0;
+	DIR *dir;
+
+	dir = opendir("/dev/");
+	if (!dir) {
+		BBDEV_LA12XX_PMD_ERR("Unable to open /dev/");
+		return -1;
+	}
+
+	sprintf(dev_initials, "gulipcgul%d", modem_id);
+
+	while ((entry = readdir(dir)) != NULL) {
+		if (!strncmp(dev_initials, entry->d_name,
+		    sizeof(dev_initials) - 1))
+			break;
+	}
+
+	if (!entry) {
+		BBDEV_LA12XX_PMD_ERR("Error: No gulipcgul%d device", modem_id);
+		return -1;
+	}
+
+	sprintf(dev_path, "/dev/%s", entry->d_name);
+	dev_ipc = open(dev_path, O_RDWR);
+	if (dev_ipc  < 0) {
+		BBDEV_LA12XX_PMD_ERR("Error: Cannot open %s", dev_path);
+		return -errno;
+	}
+
+	return dev_ipc;
+}
+
+static int
+setup_la12xx_dev(struct rte_bbdev *dev)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	struct hugepage_info *hp = NULL;
+	ipc_channel_us_t *ipc_priv_ch = NULL;
+	int dev_ipc = 0, dev_mem = 0, i;
+	ipc_metadata_t *ipc_md;
+	struct gul_hif *mhif;
+	uint32_t phy_align = 0;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (!ipc_priv) {
+		/* TODO - get a better way */
+		/* Get the hugepage info against it */
+		hp = get_hugepage_info();
+		if (!hp) {
+			BBDEV_LA12XX_PMD_ERR("Unable to get hugepage info");
+			ret = -ENOMEM;
+			goto err;
+		}
+
+		BBDEV_LA12XX_PMD_DEBUG("%lx %p %lx",
+				hp->paddr, hp->vaddr, hp->len);
+
+		ipc_priv = rte_zmalloc(0, sizeof(ipc_userspace_t), 0);
+		if (ipc_priv == NULL) {
+			BBDEV_LA12XX_PMD_ERR(
+				"Unable to allocate memory for ipc priv");
+			ret = -ENOMEM;
+			goto err;
+		}
+
+		for (i = 0; i < IPC_MAX_CHANNEL_COUNT; i++) {
+			ipc_priv_ch = rte_zmalloc(0,
+				sizeof(ipc_channel_us_t), 0);
+			if (ipc_priv_ch == NULL) {
+				BBDEV_LA12XX_PMD_ERR(
+					"Unable to allocate memory for channels");
+				ret = -ENOMEM;
+			}
+			ipc_priv->channels[i] = ipc_priv_ch;
+		}
+
+		dev_mem = open("/dev/mem", O_RDWR);
+		if (dev_mem < 0) {
+			BBDEV_LA12XX_PMD_ERR("Error: Cannot open /dev/mem");
+			ret = -errno;
+			goto err;
+		}
+
+		ipc_priv->instance_id = 0;
+		ipc_priv->dev_mem = dev_mem;
+
+		BBDEV_LA12XX_PMD_DEBUG("hugepg input %lx %p %lx",
+			hp->paddr, hp->vaddr, hp->len);
+
+		ipc_priv->sys_map.hugepg_start.host_phys = hp->paddr;
+		ipc_priv->sys_map.hugepg_start.size = hp->len;
+
+		ipc_priv->hugepg_start.host_phys = hp->paddr;
+		ipc_priv->hugepg_start.host_vaddr = hp->vaddr;
+		ipc_priv->hugepg_start.size = hp->len;
+
+		rte_free(hp);
+	}
+
+	dev_ipc = open_ipc_dev(priv->modem_id);
+	if (dev_ipc < 0) {
+		BBDEV_LA12XX_PMD_ERR("Error: open_ipc_dev failed");
+		goto err;
+	}
+	ipc_priv->dev_ipc = dev_ipc;
+
+	/* Send IOCTL to get system map */
+	/* Send IOCTL to put hugepg_start map */
+	ret = ioctl(ipc_priv->dev_ipc, IOCTL_GUL_IPC_GET_SYS_MAP,
+		    &ipc_priv->sys_map);
+	if (ret) {
+		BBDEV_LA12XX_PMD_ERR(
+			"IOCTL_GUL_IPC_GET_SYS_MAP ioctl failed");
+		goto err;
+	}
+
+	phy_align = (ipc_priv->sys_map.mhif_start.host_phys % 0x1000);
+	ipc_priv->mhif_start.host_vaddr =
+		mmap(0, ipc_priv->sys_map.mhif_start.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.mhif_start.host_phys - phy_align));
+	if (ipc_priv->mhif_start.host_vaddr == MAP_FAILED) {
+		BBDEV_LA12XX_PMD_ERR("MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->mhif_start.host_vaddr = (void *) ((uint64_t)
+		(ipc_priv->mhif_start.host_vaddr) + phy_align);
+
+	phy_align = (ipc_priv->sys_map.peb_start.host_phys % 0x1000);
+	ipc_priv->peb_start.host_vaddr =
+		mmap(0, ipc_priv->sys_map.peb_start.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.peb_start.host_phys - phy_align));
+	if (ipc_priv->peb_start.host_vaddr == MAP_FAILED) {
+		BBDEV_LA12XX_PMD_ERR("MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->peb_start.host_vaddr = (void *)((uint64_t)
+		(ipc_priv->peb_start.host_vaddr) + phy_align);
+
+	phy_align = (ipc_priv->sys_map.modem_ccsrbar.host_phys % 0x1000);
+	ipc_priv->modem_ccsrbar.host_vaddr =
+		mmap(0, ipc_priv->sys_map.modem_ccsrbar.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.modem_ccsrbar.host_phys - phy_align));
+	if (ipc_priv->modem_ccsrbar.host_vaddr == MAP_FAILED) {
+		BBDEV_LA12XX_PMD_ERR("MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->modem_ccsrbar.host_vaddr = (void *)((uint64_t)
+		(ipc_priv->modem_ccsrbar.host_vaddr) + phy_align);
+
+	ipc_priv->hugepg_start.modem_phys =
+		ipc_priv->sys_map.hugepg_start.modem_phys;
+
+	ipc_priv->mhif_start.host_phys =
+		ipc_priv->sys_map.mhif_start.host_phys;
+	ipc_priv->mhif_start.size = ipc_priv->sys_map.mhif_start.size;
+	ipc_priv->peb_start.host_phys = ipc_priv->sys_map.peb_start.host_phys;
+	ipc_priv->peb_start.size = ipc_priv->sys_map.peb_start.size;
+
+	BBDEV_LA12XX_PMD_INFO("peb %lx %p %x",
+			ipc_priv->peb_start.host_phys,
+			ipc_priv->peb_start.host_vaddr,
+			ipc_priv->peb_start.size);
+	BBDEV_LA12XX_PMD_INFO("hugepg %lx %p %x",
+			ipc_priv->hugepg_start.host_phys,
+			ipc_priv->hugepg_start.host_vaddr,
+			ipc_priv->hugepg_start.size);
+	BBDEV_LA12XX_PMD_INFO("mhif %lx %p %x",
+			ipc_priv->mhif_start.host_phys,
+			ipc_priv->mhif_start.host_vaddr,
+			ipc_priv->mhif_start.size);
+	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+
+	/* offset is from start of PEB */
+	ipc_md = (ipc_metadata_t *)((uint64_t)ipc_priv->peb_start.host_vaddr +
+			mhif->ipc_regs.ipc_mdata_offset);
+
+	if (sizeof(ipc_metadata_t) != mhif->ipc_regs.ipc_mdata_size) {
+		BBDEV_LA12XX_PMD_ERR(
+			"\n ipc_metadata_t =%lx, mhif->ipc_regs.ipc_mdata_size=%x",
+			sizeof(ipc_metadata_t), mhif->ipc_regs.ipc_mdata_size);
+		BBDEV_LA12XX_PMD_ERR(
+			"--> mhif->ipc_regs.ipc_mdata_offset= %x",
+			mhif->ipc_regs.ipc_mdata_offset);
+		BBDEV_LA12XX_PMD_ERR(
+			"gul_hif size=%lx", sizeof(struct gul_hif));
+		return IPC_MD_SZ_MISS_MATCH;
+	}
+
+	ipc_priv->instance = (ipc_instance_t *)
+		(&ipc_md->instance_list[ipc_priv->instance_id]);
+
+	BBDEV_LA12XX_PMD_DEBUG("finish host init");
+
+	priv->ipc_priv = ipc_priv;
+
+	return 0;
+
+err:
+	rte_free(hp);
+	rte_free(ipc_priv);
+	rte_free(ipc_priv_ch);
+	if (dev_mem)
+		close(dev_mem);
+	if (dev_ipc)
+		close(dev_ipc);
+
+	return ret;
+}
+
 static inline int
 parse_u16_arg(const char *key, const char *value, void *extra_args)
 {
@@ -123,6 +680,7 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
 	struct bbdev_la12xx_private *priv;
+	int ret;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -152,7 +710,13 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 
 	BBDEV_LA12XX_PMD_INFO("Setting Up %s: DevId=%d, ModemId=%d",
 				name, bbdev->data->dev_id, priv->modem_id);
-	bbdev->dev_ops = NULL;
+	ret = setup_la12xx_dev(bbdev);
+	if (ret) {
+		BBDEV_LA12XX_PMD_ERR("IPC Setup failed for %s", name);
+		rte_free(bbdev->data->dev_private);
+		return ret;
+	}
+	bbdev->dev_ops = &pmd_ops;
 	bbdev->device = &vdev->device;
 	bbdev->data->socket_id = 0;
 	bbdev->intr_handle = NULL;
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.h b/drivers/baseband/la12xx/bbdev_la12xx.h
index 5228502331..15231c07db 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx.h
@@ -14,7 +14,7 @@
 #define MAX_CHANNEL_DEPTH 16
 /* private data structure */
 struct bbdev_la12xx_private {
-	void *ipc_priv;
+	ipc_userspace_t *ipc_priv;
 	uint8_t num_valid_queues;
 	uint8_t max_nb_queues;
 	uint8_t num_ldpc_enc_queues;
@@ -52,5 +52,6 @@ struct bbdev_la12xx_q_priv {
 
 #define lower_32_bits(x) ((uint32_t)((uint64_t)x))
 #define upper_32_bits(x) ((uint32_t)(((uint64_t)(x) >> 16) >> 16))
-
+#define join_32_bits(upper, lower) \
+	((uint64_t)(((uint64_t)(upper) << 32) | (uint32_t)(lower)))
 #endif
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
index 9aa5562981..9d5789f726 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -4,9 +4,175 @@
 #ifndef __BBDEV_LA12XX_IPC_H__
 #define __BBDEV_LA12XX_IPC_H__
 
+#define LA12XX_MAX_QUEUES 20
+
+/** No. of max channel per instance */
+#define IPC_MAX_CHANNEL_COUNT	(64)
+
 /** No. of max channel per instance */
 #define IPC_MAX_DEPTH	(16)
 
+/** No. of max IPC instance per modem */
+#define IPC_MAX_INSTANCE_COUNT	(1)
+
+#define HOST_RX_QUEUEID_OFFSET LA12XX_MAX_QUEUES
+
+#define MAX_MEM_POOL_COUNT 8
+
+/** Error codes */
+#define IPC_SUCCESS		(0) /** IPC operation success */
+#define IPC_INPUT_INVALID	(-1) /** Invalid input to API */
+#define IPC_CH_INVALID		(-2) /** Channel no is invalid */
+#define IPC_INSTANCE_INVALID	(-3) /** Instance no is invalid */
+#define IPC_MEM_INVALID		(-4) /** Insufficient memory */
+#define IPC_CH_FULL		(-5) /** Channel is full */
+#define IPC_CH_EMPTY		(-6) /** Channel is empty */
+#define IPC_BL_EMPTY		(-7) /** Free buffer list is empty */
+#define IPC_BL_FULL		(-8) /** Free buffer list is full */
+#define IPC_HOST_BUF_ALLOC_FAIL	(-9) /** DPDK malloc fail */
+#define IPC_MD_SZ_MISS_MATCH	(-10) /** META DATA sz in mhif miss matched*/
+#define IPC_MALLOC_FAIL		(-11) /** system malloc fail */
+#define IPC_IOCTL_FAIL		(-12) /** IOCTL call failed */
+#define IPC_MMAP_FAIL		(-14) /** MMAP fail */
+#define IPC_OPEN_FAIL		(-15) /** OPEN fail */
+#define IPC_EVENTFD_FAIL	(-16) /** eventfd initialization failed */
+#define IPC_NOT_IMPLEMENTED	(-17) /** IPC feature is not implemented yet*/
+
+#define SET_HIF_HOST_RDY(hif, RDY_MASK) (hif->host_ready |= RDY_MASK)
+#define CHK_HIF_MOD_RDY(hif, RDY_MASK) (hif->mod_ready & RDY_MASK)
+
+/* Host Ready bits */
+#define HIF_HOST_READY_HOST_REGIONS	(1 << 0)
+#define HIF_HOST_READY_IPC_LIB		(1 << 12)
+#define HIF_HOST_READY_IPC_APP		(1 << 13)
+#define HIF_HOST_READY_FECA		(1 << 14)
+
+/* Modem Ready bits */
+#define HIF_MOD_READY_IPC_LIB		(1 << 5)
+#define HIF_MOD_READY_IPC_APP		(1 << 6)
+#define HIF_MOD_READY_FECA		(1 << 7)
+
+typedef void *ipc_t;
+
+struct ipc_msg {
+	int chid;
+	void *addr;
+	uint32_t len;
+	uint8_t flags;
+};
+
+typedef struct {
+	uint64_t host_phys;
+	uint32_t modem_phys;
+	void    *host_vaddr;
+	uint32_t size;
+} mem_range_t;
+
+#define GUL_IPC_MAGIC	'R'
+
+#define IOCTL_GUL_IPC_GET_SYS_MAP _IOW(GUL_IPC_MAGIC, 1, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_REGISTER _IOWR(GUL_IPC_MAGIC, 4, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_DEREGISTER \
+	_IOWR(GUL_IPC_MAGIC, 5, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_RAISE_INTERRUPT _IOW(GUL_IPC_MAGIC, 6, int *)
+
+/** buffer ring common metadata */
+typedef struct ipc_bd_ring_md {
+	volatile uint32_t pi;		/**< Producer index and flag (MSB)
+					  *  which flip for each Ring wrapping
+					  */
+	volatile uint32_t ci;		/**< Consumer index and flag (MSB)
+					  *  which flip for each Ring wrapping
+					  */
+	uint32_t ring_size;	/**< depth (Used to roll-over pi/ci) */
+	uint32_t msg_size;	/**< Size of the each buffer */
+} __rte_packed ipc_br_md_t;
+
+/** IPC buffer descriptor */
+typedef struct ipc_buffer_desc {
+	union {
+		uint64_t host_virt;	/**< msg's host virtual address */
+		struct {
+			uint32_t host_virt_l;
+			uint32_t host_virt_h;
+		};
+	};
+	uint64_t host_phy;	/**< msg's host physical address */
+	uint32_t modem_ptr;	/**< msg's modem physical address */
+	uint32_t len;		/**< msg len */
+	uint64_t crc;		/**< crc */
+} __rte_packed ipc_bd_t;
+
+typedef struct ipc_channel {
+	uint32_t ch_id;		/**< Channel id */
+	uint32_t bl_initialized;/**< Set when buffer list is initialized */
+	ipc_br_md_t md;
+	ipc_bd_t bd[IPC_MAX_DEPTH];
+	uint32_t op_type;/* BBDEV operation supported on this channel */
+	uint32_t depth;	/* Channel depth */
+	uint32_t feca_blk_id;/* FECA Transport Block ID for processing */
+	uint32_t la12xx_core_id;/* LA12xx core ID to scheduled work for it*/
+	uint32_t host_ipc_params;/* Address for host IPC parameters */
+} __rte_packed ipc_ch_t;
+
+typedef struct ipc_instance {
+	uint32_t initialized;		/**< Set in ipc_init */
+	ipc_ch_t ch_list[IPC_MAX_CHANNEL_COUNT];
+		/**< Channel descriptors in this instance */
+} __rte_packed ipc_instance_t;
+
+typedef struct ipc_metadata {
+	ipc_instance_t instance_list[IPC_MAX_INSTANCE_COUNT];
+} __rte_packed ipc_metadata_t;
+
+typedef struct ipc_channel_us_priv {
+	int32_t		eventfd;
+	uint32_t	channel_id;
+	/* In flight packets status for buffer list. */
+	uint8_t		bufs_inflight[IPC_MAX_DEPTH];
+} ipc_channel_us_t;
+
+typedef struct {
+	uint64_t host_phys;
+	uint32_t modem_phys;
+	uint32_t size;
+} mem_strt_addr_t;
+
+typedef struct {
+	mem_strt_addr_t modem_ccsrbar;
+	mem_strt_addr_t peb_start; /* PEB meta data */
+	mem_strt_addr_t mhif_start; /* MHIF meta daat */
+	mem_strt_addr_t hugepg_start; /* Modem to access hugepage */
+} sys_map_t;
+
+typedef struct ipc_priv_t {
+	int instance_id;
+	int dev_ipc;
+	int dev_mem;
+	struct rte_mempool *rtemempool[MAX_MEM_POOL_COUNT];
+	sys_map_t sys_map;
+	mem_range_t modem_ccsrbar;
+	mem_range_t peb_start;
+	mem_range_t mhif_start;
+	mem_range_t hugepg_start;
+	ipc_channel_us_t *channels[IPC_MAX_CHANNEL_COUNT];
+	ipc_instance_t	*instance;
+} ipc_userspace_t;
+
+/** Structure specifying enqueue operation (enqueue at LA1224) */
+struct bbdev_ipc_enqueue_op {
+	/** Status of operation that was performed */
+	int32_t status;
+	/** CRC Status of SD operation that was performed */
+	int32_t crc_stat_addr;
+	/** HARQ Output buffer memory length for Shared Decode.
+	 * Filled by LA12xx.
+	 */
+	uint32_t out_len;
+	/** Reserved (for 8 byte alignment) */
+	uint32_t rsvd;
+};
+
 /* This shared memory would be on the host side which have copy of some
  * of the parameters which are also part of Shared BD ring. Read access
  * of these parameters from the host side would not be over PCI.
@@ -17,4 +183,18 @@ typedef struct host_ipc_params {
 	volatile uint32_t modem_ptr[IPC_MAX_DEPTH];
 } __rte_packed host_ipc_params_t;
 
+struct hif_ipc_regs {
+	uint32_t ipc_mdata_offset;
+	uint32_t ipc_mdata_size;
+} __rte_packed;
+
+struct gul_hif {
+	uint32_t ver;
+	uint32_t hif_ver;
+	uint32_t status;
+	volatile uint32_t host_ready;
+	volatile uint32_t mod_ready;
+	struct hif_ipc_regs ipc_regs;
+} __rte_packed;
+
 #endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v2 5/8] baseband/la12xx: add enqueue and dequeue support
  2021-04-10 17:02 ` [dpdk-dev] [PATCH v2 0/8] baseband: add " Hemant Agrawal
                     ` (3 preceding siblings ...)
  2021-04-10 17:02   ` [dpdk-dev] [PATCH v2 4/8] baseband/la12xx: add queue and modem config support Hemant Agrawal
@ 2021-04-10 17:02   ` Hemant Agrawal
  2021-04-10 17:02   ` [dpdk-dev] [PATCH v2 6/8] baseband/la12xx: add documentation support Hemant Agrawal
                     ` (3 subsequent siblings)
  8 siblings, 0 replies; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-10 17:02 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, Nipun Gupta, Hemant Agrawal

Add support for enqueue and dequeue the LDPC enc/dec
from the modem device.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c     | 397 ++++++++++++++++++++-
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h |  37 ++
 2 files changed, 430 insertions(+), 4 deletions(-)

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 7347106866..0ff4871efe 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -117,6 +117,10 @@ la12xx_queue_release(struct rte_bbdev *dev, uint16_t q_id)
 		((uint64_t) ((unsigned long) (A) \
 		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
 
+#define MODEM_P2V(A) \
+	((uint64_t) ((unsigned long) (A) \
+		+ (unsigned long)(ipc_priv->peb_start.host_vaddr)))
+
 static int ipc_queue_configure(uint32_t channel_id,
 		ipc_t instance, struct bbdev_la12xx_q_priv *q_priv)
 {
@@ -345,6 +349,387 @@ static const struct rte_bbdev_ops pmd_ops = {
 	.queue_release = la12xx_queue_release,
 	.start = la12xx_start
 };
+
+static int
+fill_feca_desc_enc(struct bbdev_la12xx_q_priv *q_priv,
+		   struct bbdev_ipc_dequeue_op *bbdev_ipc_op,
+		   struct rte_bbdev_enc_op *bbdev_enc_op,
+		   struct rte_bbdev_op_data *in_op_data)
+{
+	RTE_SET_USED(q_priv);
+	RTE_SET_USED(bbdev_ipc_op);
+	RTE_SET_USED(bbdev_enc_op);
+	RTE_SET_USED(in_op_data);
+
+	return 0;
+}
+
+static int
+fill_feca_desc_dec(struct bbdev_la12xx_q_priv *q_priv,
+		   struct bbdev_ipc_dequeue_op *bbdev_ipc_op,
+		   struct rte_bbdev_dec_op *bbdev_dec_op,
+		   struct rte_bbdev_op_data *out_op_data)
+{
+	RTE_SET_USED(q_priv);
+	RTE_SET_USED(bbdev_ipc_op);
+	RTE_SET_USED(bbdev_dec_op);
+	RTE_SET_USED(out_op_data);
+
+	return 0;
+}
+
+static inline int
+is_bd_ring_full(uint32_t ci, uint32_t ci_flag,
+		uint32_t pi, uint32_t pi_flag)
+{
+	if (pi == ci) {
+		if (pi_flag != ci_flag)
+			return 1; /* Ring is Full */
+	}
+	return 0;
+}
+
+static inline int
+prepare_ldpc_enc_op(struct rte_bbdev_enc_op *bbdev_enc_op,
+		    struct bbdev_ipc_dequeue_op *bbdev_ipc_op,
+		    struct bbdev_la12xx_q_priv *q_priv,
+		    struct rte_bbdev_op_data *in_op_data,
+		    struct rte_bbdev_op_data *out_op_data)
+{
+	struct rte_bbdev_op_ldpc_enc *ldpc_enc = &bbdev_enc_op->ldpc_enc;
+	uint32_t total_out_bits;
+	int ret;
+
+	total_out_bits = (ldpc_enc->tb_params.cab *
+		ldpc_enc->tb_params.ea) + (ldpc_enc->tb_params.c -
+		ldpc_enc->tb_params.cab) * ldpc_enc->tb_params.eb;
+
+	ldpc_enc->output.length = (total_out_bits + 7)/8;
+
+	ret = fill_feca_desc_enc(q_priv, bbdev_ipc_op,
+				 bbdev_enc_op, in_op_data);
+	if (ret) {
+		BBDEV_LA12XX_PMD_ERR(
+			"fill_feca_desc_enc failed, ret: %d", ret);
+		return ret;
+	}
+
+	rte_pktmbuf_append(out_op_data->data, ldpc_enc->output.length);
+
+	return 0;
+}
+
+static inline int
+prepare_ldpc_dec_op(struct rte_bbdev_dec_op *bbdev_dec_op,
+		    struct bbdev_ipc_dequeue_op *bbdev_ipc_op,
+		    struct bbdev_la12xx_q_priv *q_priv,
+		    struct rte_bbdev_op_data *out_op_data)
+{
+	struct rte_bbdev_op_ldpc_dec *ldpc_dec = &bbdev_dec_op->ldpc_dec;
+	uint32_t total_out_bits;
+	uint32_t num_code_blocks = 0;
+	uint16_t sys_cols;
+	int ret;
+
+	sys_cols = (ldpc_dec->basegraph == 1) ? 22 : 10;
+	if (ldpc_dec->tb_params.c == 1) {
+		total_out_bits = ((sys_cols * ldpc_dec->z_c) -
+				ldpc_dec->n_filler);
+		/* 5G-NR protocol uses 16 bit CRC when output packet
+		 * size <= 3824 (bits). Otherwise 24 bit CRC is used.
+		 * Adjust the output bits accordingly
+		 */
+		if (total_out_bits - 16 <= 3824)
+			total_out_bits -= 16;
+		else
+			total_out_bits -= 24;
+		ldpc_dec->hard_output.length = (total_out_bits / 8);
+	} else {
+		total_out_bits = (((sys_cols * ldpc_dec->z_c) -
+				ldpc_dec->n_filler - 24) *
+				ldpc_dec->tb_params.c);
+		ldpc_dec->hard_output.length = (total_out_bits / 8) - 3;
+	}
+
+	num_code_blocks = ldpc_dec->tb_params.c;
+
+	bbdev_ipc_op->num_code_blocks = rte_cpu_to_be_32(num_code_blocks);
+
+	ret = fill_feca_desc_dec(q_priv, bbdev_ipc_op,
+				 bbdev_dec_op, out_op_data);
+	if (ret) {
+		BBDEV_LA12XX_PMD_ERR("fill_feca_desc_dec failed, ret: %d", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+static int
+enqueue_single_op(struct bbdev_la12xx_q_priv *q_priv, void *bbdev_op)
+{
+	struct bbdev_la12xx_private *priv = q_priv->bbdev_priv;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	ipc_instance_t *ipc_instance = ipc_priv->instance;
+	struct bbdev_ipc_dequeue_op *bbdev_ipc_op;
+	struct rte_bbdev_op_ldpc_enc *ldpc_enc;
+	struct rte_bbdev_op_ldpc_dec *ldpc_dec;
+	uint32_t q_id = q_priv->q_id;
+	uint32_t ci, ci_flag, pi, pi_flag;
+	ipc_ch_t *ch = &(ipc_instance->ch_list[q_id]);
+	ipc_br_md_t *md = &(ch->md);
+	uint64_t virt;
+	char *huge_start_addr =
+		(char *)q_priv->bbdev_priv->ipc_priv->hugepg_start.host_vaddr;
+	struct rte_bbdev_op_data *in_op_data, *out_op_data;
+	char *data_ptr;
+	uint32_t l1_pcie_addr;
+	int ret;
+	uint32_t temp_ci;
+
+	temp_ci = q_priv->host_params->ci;
+	ci = IPC_GET_CI_INDEX(temp_ci);
+	ci_flag = IPC_GET_CI_FLAG(temp_ci);
+
+	pi = IPC_GET_PI_INDEX(q_priv->host_pi);
+	pi_flag = IPC_GET_PI_FLAG(q_priv->host_pi);
+
+	BBDEV_LA12XX_PMD_DP_DEBUG(
+		"before bd_ring_full: pi: %u, ci: %u, pi_flag: %u, ci_flag: %u, ring size: %u",
+		pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	if (is_bd_ring_full(ci, ci_flag, pi, pi_flag)) {
+		BBDEV_LA12XX_PMD_DP_DEBUG(
+				"bd ring full for queue id: %d", q_id);
+		return IPC_CH_FULL;
+	}
+
+	virt = MODEM_P2V(q_priv->host_params->modem_ptr[pi]);
+	bbdev_ipc_op = (struct bbdev_ipc_dequeue_op *)virt;
+	q_priv->bbdev_op[pi] = bbdev_op;
+
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		ldpc_enc = &(((struct rte_bbdev_enc_op *)bbdev_op)->ldpc_enc);
+		in_op_data = &ldpc_enc->input;
+		out_op_data = &ldpc_enc->output;
+
+		ret = prepare_ldpc_enc_op(bbdev_op, bbdev_ipc_op, q_priv,
+					  in_op_data, out_op_data);
+		if (ret) {
+			BBDEV_LA12XX_PMD_ERR(
+				"process_ldpc_enc_op failed, ret: %d", ret);
+			return ret;
+		}
+		break;
+
+	case RTE_BBDEV_OP_LDPC_DEC:
+		ldpc_dec = &(((struct rte_bbdev_dec_op *)bbdev_op)->ldpc_dec);
+		in_op_data = &ldpc_dec->input;
+
+			out_op_data = &ldpc_dec->hard_output;
+
+		ret = prepare_ldpc_dec_op(bbdev_op, bbdev_ipc_op,
+					  q_priv, out_op_data);
+		if (ret) {
+			BBDEV_LA12XX_PMD_ERR(
+				"process_ldpc_dec_op failed, ret: %d", ret);
+			return ret;
+		}
+		break;
+
+	default:
+		BBDEV_LA12XX_PMD_ERR("unsupported bbdev_ipc op type");
+		return -1;
+	}
+
+	if (in_op_data->data) {
+		data_ptr = rte_pktmbuf_mtod(in_op_data->data, char *);
+		l1_pcie_addr = (uint32_t)GUL_USER_HUGE_PAGE_ADDR +
+			       data_ptr - huge_start_addr;
+		bbdev_ipc_op->in_addr = l1_pcie_addr;
+		bbdev_ipc_op->in_len = in_op_data->length;
+	}
+
+	if (out_op_data->data) {
+		data_ptr = rte_pktmbuf_mtod(out_op_data->data, char *);
+		l1_pcie_addr = (uint32_t)GUL_USER_HUGE_PAGE_ADDR +
+				data_ptr - huge_start_addr;
+		bbdev_ipc_op->out_addr = rte_cpu_to_be_32(l1_pcie_addr);
+		bbdev_ipc_op->out_len = rte_cpu_to_be_32(out_op_data->length);
+	}
+
+	/* Move Producer Index forward */
+	pi++;
+	/* Flip the PI flag, if wrapping */
+	if (unlikely(q_priv->queue_size == pi)) {
+		pi = 0;
+		pi_flag = pi_flag ? 0 : 1;
+	}
+
+	if (pi_flag)
+		IPC_SET_PI_FLAG(pi);
+	else
+		IPC_RESET_PI_FLAG(pi);
+	/* Wait for Data Copy & pi_flag update to complete before updating pi */
+	rte_mb();
+	/* now update pi */
+	md->pi = rte_cpu_to_be_32(pi);
+	q_priv->host_pi = pi;
+
+	BBDEV_LA12XX_PMD_DP_DEBUG(
+			"enter: pi: %u, ci: %u, pi_flag: %u, ci_flag: %u, ring size: %u",
+			pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	return 0;
+}
+
+/* Enqueue decode burst */
+static uint16_t
+enqueue_dec_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_dec_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	int nb_enqueued, ret;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ret = enqueue_single_op(q_priv, ops[nb_enqueued]);
+		if (ret)
+			break;
+	}
+
+	q_data->queue_stats.enqueue_err_count += nb_ops - nb_enqueued;
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
+/* Enqueue encode burst */
+static uint16_t
+enqueue_enc_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_enc_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	int nb_enqueued, ret;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ret = enqueue_single_op(q_priv, ops[nb_enqueued]);
+		if (ret)
+			break;
+	}
+
+	q_data->queue_stats.enqueue_err_count += nb_ops - nb_enqueued;
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
+static inline int
+is_bd_ring_empty(uint32_t ci, uint32_t ci_flag,
+		 uint32_t pi, uint32_t pi_flag)
+{
+	if (ci == pi) {
+		if (ci_flag == pi_flag)
+			return 1; /* No more Buffer */
+	}
+	return 0;
+}
+
+/* Dequeue encode burst */
+static void *
+dequeue_single_op(struct bbdev_la12xx_q_priv *q_priv, void *dst)
+{
+	struct bbdev_la12xx_private *priv = q_priv->bbdev_priv;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	uint32_t q_id = q_priv->q_id + HOST_RX_QUEUEID_OFFSET;
+	ipc_instance_t *ipc_instance = ipc_priv->instance;
+	ipc_ch_t *ch = &(ipc_instance->ch_list[q_id]);
+	uint32_t ci, ci_flag, pi, pi_flag;
+	ipc_br_md_t *md;
+	void *op;
+	uint32_t temp_pi;
+
+	md = &(ch->md);
+	ci = IPC_GET_CI_INDEX(q_priv->host_ci);
+	ci_flag = IPC_GET_CI_FLAG(q_priv->host_ci);
+
+	temp_pi = q_priv->host_params->pi;
+	pi = IPC_GET_PI_INDEX(temp_pi);
+	pi_flag = IPC_GET_PI_FLAG(temp_pi);
+
+	if (is_bd_ring_empty(ci, ci_flag, pi, pi_flag))
+		return NULL;
+
+	BBDEV_LA12XX_PMD_DP_DEBUG(
+		"pi: %u, ci: %u, pi_flag: %u, ci_flag: %u, ring size: %u",
+		pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	op = q_priv->bbdev_op[ci];
+
+	rte_memcpy(dst, q_priv->msg_ch_vaddr[ci],
+		sizeof(struct bbdev_ipc_enqueue_op));
+
+	/* Move Consumer Index forward */
+	ci++;
+	/* Flip the CI flag, if wrapping */
+	if (q_priv->queue_size == ci) {
+		ci = 0;
+		ci_flag = ci_flag ? 0 : 1;
+	}
+	if (ci_flag)
+		IPC_SET_CI_FLAG(ci);
+	else
+		IPC_RESET_CI_FLAG(ci);
+	md->ci = rte_cpu_to_be_32(ci);
+	q_priv->host_ci = ci;
+
+	BBDEV_LA12XX_PMD_DP_DEBUG(
+		"exit: pi: %u, ci: %u, pi_flag: %u, ci_flag: %u, ring size: %u",
+		pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	return op;
+}
+
+/* Dequeue decode burst */
+static uint16_t
+dequeue_dec_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_dec_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	struct bbdev_ipc_enqueue_op bbdev_ipc_op;
+	int nb_dequeued;
+
+	for (nb_dequeued = 0; nb_dequeued < nb_ops; nb_dequeued++) {
+		ops[nb_dequeued] = dequeue_single_op(q_priv, &bbdev_ipc_op);
+		if (!ops[nb_dequeued])
+			break;
+		ops[nb_dequeued]->status = bbdev_ipc_op.status;
+	}
+	q_data->queue_stats.dequeued_count += nb_dequeued;
+
+	return nb_dequeued;
+}
+
+/* Dequeue encode burst */
+static uint16_t
+dequeue_enc_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_enc_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	struct bbdev_ipc_enqueue_op bbdev_ipc_op;
+	int nb_enqueued;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ops[nb_enqueued] = dequeue_single_op(q_priv, &bbdev_ipc_op);
+		if (!ops[nb_enqueued])
+			break;
+		ops[nb_enqueued]->status = bbdev_ipc_op.status;
+	}
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
 static struct hugepage_info *
 get_hugepage_info(void)
 {
@@ -722,10 +1107,14 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 	bbdev->intr_handle = NULL;
 
 	/* register rx/tx burst functions for data path */
-	bbdev->dequeue_enc_ops = NULL;
-	bbdev->dequeue_dec_ops = NULL;
-	bbdev->enqueue_enc_ops = NULL;
-	bbdev->enqueue_dec_ops = NULL;
+	bbdev->dequeue_enc_ops = dequeue_enc_ops;
+	bbdev->dequeue_dec_ops = dequeue_dec_ops;
+	bbdev->enqueue_enc_ops = enqueue_enc_ops;
+	bbdev->enqueue_dec_ops = enqueue_dec_ops;
+	bbdev->dequeue_ldpc_enc_ops = dequeue_enc_ops;
+	bbdev->dequeue_ldpc_dec_ops = dequeue_dec_ops;
+	bbdev->enqueue_ldpc_enc_ops = enqueue_enc_ops;
+	bbdev->enqueue_ldpc_dec_ops = enqueue_dec_ops;
 
 	return 0;
 }
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
index 9d5789f726..4e181e9254 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -76,6 +76,25 @@ typedef struct {
 	_IOWR(GUL_IPC_MAGIC, 5, struct ipc_msg *)
 #define IOCTL_GUL_IPC_CHANNEL_RAISE_INTERRUPT _IOW(GUL_IPC_MAGIC, 6, int *)
 
+#define GUL_USER_HUGE_PAGE_OFFSET	(0)
+#define GUL_PCI1_ADDR_BASE	(0x00000000ULL)
+
+#define GUL_USER_HUGE_PAGE_ADDR	(GUL_PCI1_ADDR_BASE + GUL_USER_HUGE_PAGE_OFFSET)
+
+/* IPC PI/CI index & flag manipulation helpers */
+#define IPC_PI_CI_FLAG_MASK	0x80000000 /*  (1<<31) */
+#define IPC_PI_CI_INDEX_MASK	0x7FFFFFFF /* ~(1<<31) */
+
+#define IPC_SET_PI_FLAG(x)	(x |= IPC_PI_CI_FLAG_MASK)
+#define IPC_RESET_PI_FLAG(x)	(x &= IPC_PI_CI_INDEX_MASK)
+#define IPC_GET_PI_FLAG(x)	(x >> 31)
+#define IPC_GET_PI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
+
+#define IPC_SET_CI_FLAG(x)	(x |= IPC_PI_CI_FLAG_MASK)
+#define IPC_RESET_CI_FLAG(x)	(x &= IPC_PI_CI_INDEX_MASK)
+#define IPC_GET_CI_FLAG(x)	(x >> 31)
+#define IPC_GET_CI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
+
 /** buffer ring common metadata */
 typedef struct ipc_bd_ring_md {
 	volatile uint32_t pi;		/**< Producer index and flag (MSB)
@@ -173,6 +192,24 @@ struct bbdev_ipc_enqueue_op {
 	uint32_t rsvd;
 };
 
+/** Structure specifying dequeue operation (dequeue at LA1224) */
+struct bbdev_ipc_dequeue_op {
+	/** Input buffer memory address */
+	uint32_t in_addr;
+	/** Input buffer memory length */
+	uint32_t in_len;
+	/** Output buffer memory address */
+	uint32_t out_addr;
+	/** Output buffer memory length */
+	uint32_t out_len;
+	/* Number of code blocks. Only set when HARQ is used */
+	uint32_t num_code_blocks;
+	/** Dequeue Operation flags */
+	uint32_t op_flags;
+	/** Shared metadata between L1 and L2 */
+	uint32_t shared_metadata;
+};
+
 /* This shared memory would be on the host side which have copy of some
  * of the parameters which are also part of Shared BD ring. Read access
  * of these parameters from the host side would not be over PCI.
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v2 6/8] baseband/la12xx: add documentation support
  2021-04-10 17:02 ` [dpdk-dev] [PATCH v2 0/8] baseband: add " Hemant Agrawal
                     ` (4 preceding siblings ...)
  2021-04-10 17:02   ` [dpdk-dev] [PATCH v2 5/8] baseband/la12xx: add enqueue and dequeue support Hemant Agrawal
@ 2021-04-10 17:02   ` Hemant Agrawal
  2021-04-10 17:02   ` [dpdk-dev] [PATCH v2 7/8] app/bbdev: add parameter to take input in network order Hemant Agrawal
                     ` (2 subsequent siblings)
  8 siblings, 0 replies; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-10 17:02 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, Nipun Gupta, Hemant Agrawal

This patch add documentation for LA12xx PMD.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 MAINTAINERS                            |   9 ++
 doc/guides/bbdevs/features/la12xx.ini  |  14 +++
 doc/guides/bbdevs/index.rst            |   1 +
 doc/guides/bbdevs/la12xx.rst           | 139 +++++++++++++++++++++++++
 doc/guides/rel_notes/release_21_05.rst |   5 +
 5 files changed, 168 insertions(+)
 create mode 100644 doc/guides/bbdevs/features/la12xx.ini
 create mode 100644 doc/guides/bbdevs/la12xx.rst

diff --git a/MAINTAINERS b/MAINTAINERS
index e746ef1d32..24081fceb3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1289,6 +1289,15 @@ F: doc/guides/rawdevs/ntb.rst
 F: examples/ntb/
 F: doc/guides/sample_app_ug/ntb.rst
 
+Baseband Drivers
+-------------------
+
+NXP LA12xx
+M: Hemant Agrawal <hemant.agrawal@nxp.com>
+M: Nipun Gupta <nipun.gupta@nxp.com>
+F: drivers/baseband/la12xx/
+F: doc/guides/bbdevs/la12xx.rst
+F: doc/guides/bbdevs/features/la12xx.ini
 
 Packet processing
 -----------------
diff --git a/doc/guides/bbdevs/features/la12xx.ini b/doc/guides/bbdevs/features/la12xx.ini
new file mode 100644
index 0000000000..979d9dd224
--- /dev/null
+++ b/doc/guides/bbdevs/features/la12xx.ini
@@ -0,0 +1,14 @@
+;
+; Supported features of the 'la12xx' bbdev driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Turbo Decoder (4G)     = N
+Turbo Encoder (4G)     = N
+LDPC Decoder (5G)      = Y
+LDPC Encoder (5G)      = Y
+LLR/HARQ Compression   = N
+External DDR Access    = Y
+HW Accelerated         = Y
+BBDEV API              = Y
diff --git a/doc/guides/bbdevs/index.rst b/doc/guides/bbdevs/index.rst
index 4445cbd1b0..cedd706fa6 100644
--- a/doc/guides/bbdevs/index.rst
+++ b/doc/guides/bbdevs/index.rst
@@ -14,3 +14,4 @@ Baseband Device Drivers
     fpga_lte_fec
     fpga_5gnr_fec
     acc100
+    la12xx
diff --git a/doc/guides/bbdevs/la12xx.rst b/doc/guides/bbdevs/la12xx.rst
new file mode 100644
index 0000000000..1cadd6f337
--- /dev/null
+++ b/doc/guides/bbdevs/la12xx.rst
@@ -0,0 +1,139 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright 2021 NXP
+
+NXP LA12xx Poll Mode Driver
+=======================================
+
+The BBDEV LA12xx poll mode driver (PMD) supports an implementation for
+offloading High Phy processing functions like LDPC Encode / Decode 5GNR wireless
+acceleration function, using PCI based LA12xx Software defined radio.
+
+More information can be found at `NXP Official Website
+<https://www.nxp.com/products/processors-and-microcontrollers/arm-processors/layerscape-processors/layerscape-access-la1200-programmable-baseband-processor:LA1200>`_.
+
+Features
+--------
+
+LA12xx PMD supports the following features:
+
+- LDPC Encode in the DL
+- LDPC Decode in the UL
+- Maximum of 8 UL queues
+- Maximum of 8 DL queues
+- PCIe Gen-3 x8 Interface
+- MSI-X
+
+LA12xx PMD supports the following BBDEV capabilities:
+
+* For the LDPC encode operation:
+   - ``RTE_BBDEV_LDPC_CRC_24B_ATTACH`` :  set to attach CRC24B to CB(s)
+   - ``RTE_BBDEV_LDPC_RATE_MATCH`` :  if set then do not do Rate Match bypass
+
+* For the LDPC decode operation:
+   - ``RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK`` :  check CRC24B from CB(s)
+   - ``RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP`` :  drops CRC24B bits appended while decoding
+   - ``RTE_BBDEV_LDPC_DEC_SCATTER_GATHER`` :  supports scatter-gather for input/output data
+
+Installation
+------------
+
+Section 3 of the DPDK manual provides instructions on installing and compiling DPDK.
+
+DPDK requires hugepages to be configured as detailed in section 2 of the DPDK manual.
+
+Initialization
+--------------
+
+The device can be listed on the host console with:
+
+
+Use the following lspci command to get the multiple LA12xx processor ids. The
+device ID of the LA12xx baseband processor is "1c30".
+
+.. code-block:: console
+
+  sudo lspci -nn
+
+...
+0001:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device [1957:1c30] (
+rev 10)
+...
+0002:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device [1957:1c30] (
+rev 10)
+
+
+Prerequisites
+-------------
+
+Currently supported by DPDK:
+
+- NXP LA1224 BSP **1.0+**.
+- NXP LA1224 PCIe Modem card connected to ARM host.
+
+- Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup the basic DPDK environment.
+
+* Use dev arg option ``modem=0`` to identify the modem instance for a given
+  device. This is required only if more than 1 modem cards are attached to host.
+  this is optional and the default value is 0.
+  e.g. ``--vdev=baseband_la12xx,modem=0``
+
+* Use dev arg option ``max_nb_queues=x`` to specify the maximum number of queues
+  to be used for communication with offload device i.e. modem. default is 16.
+  e.g. ``--vdev=baseband_la12xx,max_nb_queues=4``
+
+Enabling logs
+-------------
+
+For enabling logs, use the following EAL parameter:
+
+.. code-block:: console
+
+   ./your_bbdev_application <EAL args> --log-level=la12xx:<level>
+
+Using ``bb.la12xx`` as log matching criteria, all Baseband PMD logs can be
+enabled which are lower than logging ``level``.
+
+
+Test Application
+----------------
+
+BBDEV provides a test application, ``test-bbdev.py`` and range of test data for testing
+the functionality of LA12xx for FEC encode and decode, depending on the device
+capabilities. The test application is located under app->test-bbdev folder and has the
+following options:
+
+.. code-block:: console
+
+  "-p", "--testapp-path": specifies path to the bbdev test app.
+  "-e", "--eal-params"	: EAL arguments which are passed to the test app.
+  "-t", "--timeout"	: Timeout in seconds (default=300).
+  "-c", "--test-cases"	: Defines test cases to run. Run all if not specified.
+  "-v", "--test-vector"	: Test vector path (default=dpdk_path+/app/test-bbdev/test_vectors/bbdev_null.data).
+  "-n", "--num-ops"	: Number of operations to process on device (default=32).
+  "-b", "--burst-size"	: Operations enqueue/dequeue burst size (default=32).
+  "-s", "--snr"		: SNR in dB used when generating LLRs for bler tests.
+  "-s", "--iter_max"	: Number of iterations for LDPC decoder.
+  "-l", "--num-lcores"	: Number of lcores to run (default=16).
+  "-i", "--init-device" : Initialise PF device with default values.
+
+
+To execute the test application tool using simple decode or encode data,
+type one of the following:
+
+.. code-block:: console
+
+  ./test-bbdev.py -e="--vdev=baseband_la12xx,socket_id=0,max_nb_queues=8" -c validation -n 64 -b 1 -v ./ldpc_dec_default.data
+  ./test-bbdev.py -e="--vdev=baseband_la12xx,socket_id=0,max_nb_queues=8" -c validation -n 64 -b 1 -v ./ldpc_enc_default.data
+
+The test application ``test-bbdev.py``, supports the ability to configure the PF device with
+a default set of values, if the "-i" or "- -init-device" option is included. The default values
+are defined in test_bbdev_perf.c.
+
+
+Test Vectors
+~~~~~~~~~~~~
+
+In addition to the simple LDPC decoder and LDPC encoder tests, bbdev also provides
+a range of additional tests under the test_vectors folder, which may be useful. The results
+of these tests will depend on the LA12xx FEC capabilities which may cause some
+testcases to be skipped, but no failure should be reported.
diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
index 6f5858c8f6..61797e2a43 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -130,6 +130,11 @@ New Features
   * Added command to display Rx queue used descriptor count.
     ``show port (port_id) rxq (queue_id) desc used count``
 
+* **Added NXP LA12xx baseband PMD.**
+
+  Added a new baseband PMD driver for NXP LA12xx Software defined radio.
+
+  See the :doc:`../bbdevs/la12xx` for more details.
 
 Removed Items
 -------------
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v2 7/8] app/bbdev: add parameter to take input in network order
  2021-04-10 17:02 ` [dpdk-dev] [PATCH v2 0/8] baseband: add " Hemant Agrawal
                     ` (5 preceding siblings ...)
  2021-04-10 17:02   ` [dpdk-dev] [PATCH v2 6/8] baseband/la12xx: add documentation support Hemant Agrawal
@ 2021-04-10 17:02   ` Hemant Agrawal
  2021-04-12  7:22     ` David Marchand
  2021-04-10 17:02   ` [dpdk-dev] [PATCH v2 8/8] app/bbdev: add test vectors for transport blocks Hemant Agrawal
  2021-04-13  5:17   ` [dpdk-dev] [PATCH v3 0/8] baseband: add NXP LA12xx driver Hemant Agrawal
  8 siblings, 1 reply; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-10 17:02 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, Nipun Gupta

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

Test bbdev application is reading the input and output from the
test vector files in the same endianness which is of the system.
This patch adds an option to provide data in the network order
i.e. big endian format

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 app/test-bbdev/test_bbdev_vector.c | 18 ++++++++++++++++--
 app/test-bbdev/test_bbdev_vector.h |  2 ++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/app/test-bbdev/test_bbdev_vector.c b/app/test-bbdev/test_bbdev_vector.c
index 50d1da00f7..fe04bd6b95 100644
--- a/app/test-bbdev/test_bbdev_vector.c
+++ b/app/test-bbdev/test_bbdev_vector.c
@@ -53,7 +53,8 @@ starts_with(const char *str, const char *pre)
 
 /* tokenization test values separated by a comma */
 static int
-parse_values(char *tokens, uint32_t **data, uint32_t *data_length)
+parse_values(char *tokens, uint32_t **data, uint32_t *data_length,
+	     int network_order)
 {
 	uint32_t n_tokens = 0;
 	uint32_t data_size = 32;
@@ -94,6 +95,14 @@ parse_values(char *tokens, uint32_t **data, uint32_t *data_length)
 		}
 
 		*data_length = *data_length + (strlen(tok) - strlen("0x"))/2;
+		if (network_order) {
+			if ((strlen(tok) - strlen("0x"))/2 == 4)
+				values[n_tokens] =
+					rte_cpu_to_be_32(values[n_tokens]);
+			else if ((strlen(tok) - strlen("0x"))/2 == 2)
+				values[n_tokens] =
+					rte_cpu_to_be_16(values[n_tokens]);
+		}
 
 		tok = strtok(NULL, VALUE_DELIMITER);
 		if (tok == NULL)
@@ -416,7 +425,8 @@ parse_data_entry(const char *key_token, char *token,
 	/* Clear new op data struct */
 	memset(op_data + *nb_ops, 0, sizeof(struct op_data_buf));
 
-	ret = parse_values(token, &data, &data_length);
+	ret = parse_values(token, &data, &data_length,
+			vector->network_order);
 	if (!ret) {
 		op_data[*nb_ops].addr = data;
 		op_data[*nb_ops].length = data_length;
@@ -728,6 +738,10 @@ parse_ldpc_encoder_params(const char *key_token, char *token,
 		ret = parse_expected_status(token, &status, vector->op_type);
 		if (!ret)
 			vector->expected_status = status;
+	} else if (!strcmp(key_token, "network_order")) {
+		vector->mask |= TEST_BBDEV_VF_NETWORK_ORDER;
+		vector->network_order = (uint8_t) strtoul(token, &err, 0);
+		ret = ((err == NULL) || (*err != '\0')) ? -1 : 0;
 	} else {
 		printf("Not valid ldpc enc key: '%s'\n", key_token);
 		return -1;
diff --git a/app/test-bbdev/test_bbdev_vector.h b/app/test-bbdev/test_bbdev_vector.h
index 4e5dbf5d50..aa53f0bb0d 100644
--- a/app/test-bbdev/test_bbdev_vector.h
+++ b/app/test-bbdev/test_bbdev_vector.h
@@ -35,6 +35,7 @@ enum {
 	TEST_BBDEV_VF_CODE_BLOCK_MODE = (1ULL << 23),
 	TEST_BBDEV_VF_OP_FLAGS = (1ULL << 24),
 	TEST_BBDEV_VF_EXPECTED_STATUS = (1ULL << 25),
+	TEST_BBDEV_VF_NETWORK_ORDER = (1ULL << 26),
 };
 
 enum op_data_type {
@@ -60,6 +61,7 @@ struct test_bbdev_vector {
 	enum rte_bbdev_op_type op_type;
 	int expected_status;
 	int mask;
+	int network_order;
 	union {
 		struct rte_bbdev_op_turbo_dec turbo_dec;
 		struct rte_bbdev_op_turbo_enc turbo_enc;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v2 8/8] app/bbdev: add test vectors for transport blocks
  2021-04-10 17:02 ` [dpdk-dev] [PATCH v2 0/8] baseband: add " Hemant Agrawal
                     ` (6 preceding siblings ...)
  2021-04-10 17:02   ` [dpdk-dev] [PATCH v2 7/8] app/bbdev: add parameter to take input in network order Hemant Agrawal
@ 2021-04-10 17:02   ` Hemant Agrawal
  2021-04-13  5:17   ` [dpdk-dev] [PATCH v3 0/8] baseband: add NXP LA12xx driver Hemant Agrawal
  8 siblings, 0 replies; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-10 17:02 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, Nipun Gupta

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

This patch adds two test vectors for transport block in network byte
order:
- LDPC encode for Transport Block
- LDPC decode for Transport block

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 app/test-bbdev/test_vectors/ldpc_dec_tb.data | 362 ++++++++++++++
 app/test-bbdev/test_vectors/ldpc_enc_tb.data | 482 +++++++++++++++++++
 2 files changed, 844 insertions(+)
 create mode 100644 app/test-bbdev/test_vectors/ldpc_dec_tb.data
 create mode 100644 app/test-bbdev/test_vectors/ldpc_enc_tb.data

diff --git a/app/test-bbdev/test_vectors/ldpc_dec_tb.data b/app/test-bbdev/test_vectors/ldpc_dec_tb.data
new file mode 100644
index 0000000000..76b5105966
--- /dev/null
+++ b/app/test-bbdev/test_vectors/ldpc_dec_tb.data
@@ -0,0 +1,362 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020 NXP
+
+op_type =
+RTE_BBDEV_OP_LDPC_DEC
+
+network_order =
+1
+
+input0 =
+0x817f7f81, 0x81817f7f, 0x7f7f8181, 0x81817f81, 0x8181817f, 0x7f817f81, 0x7f817f81, 0x7f817f7f,
+0x7f818181, 0x7f817f7f, 0x81817f81, 0x817f7f7f, 0x81817f81, 0x81818181, 0x7f818181, 0x81818181,
+0x7f7f7f7f, 0x81818181, 0x7f81817f, 0x817f7f7f, 0x81817f7f, 0x817f817f, 0x81817f81, 0x7f817f81,
+0x7f7f7f7f, 0x7f7f8181, 0x7f818181, 0x81817f81, 0x7f818181, 0x817f8181, 0x817f8181, 0x7f7f7f7f,
+0x7f7f817f, 0x817f8181, 0x8181817f, 0x817f7f81, 0x7f818181, 0x81817f7f, 0x7f81817f, 0x7f7f7f7f,
+0x7f817f7f, 0x81818181, 0x7f81817f, 0x7f7f817f, 0x8181817f, 0x8181817f, 0x817f8181, 0x7f817f81,
+0x7f7f8181, 0x7f7f7f7f, 0x81817f81, 0x7f7f7f81, 0x7f81817f, 0x81817f7f, 0x81817f7f, 0x7f7f8181,
+0x817f817f, 0x7f817f7f, 0x7f7f7f7f, 0x817f8181, 0x81818181, 0x7f7f7f7f, 0x7f7f8181, 0x7f7f7f7f,
+0x7f817f81, 0x7f81817f, 0x7f818181, 0x817f817f, 0x81817f7f, 0x7f7f7f81, 0x7f7f7f81, 0x7f817f81,
+0x817f7f7f, 0x7f817f7f, 0x817f7f81, 0x7f7f7f7f, 0x7f817f81, 0x81817f7f, 0x7f817f7f, 0x7f7f7f81,
+0x7f817f7f, 0x7f7f7f81, 0x7f817f7f, 0x7f81817f, 0x817f7f81, 0x7f7f7f7f, 0x81818181, 0x7f7f8181,
+0x817f7f7f, 0x817f7f81, 0x81817f81, 0x7f817f81, 0x7f818181, 0x817f7f81, 0x7f817f7f, 0x7f818181,
+0x7f7f8181, 0x81817f81, 0x7f7f8181, 0x8181817f, 0x8181817f, 0x817f7f81, 0x8181817f, 0x7f7f817f,
+0x7f817f81, 0x817f7f7f, 0x81818181, 0x817f7f7f, 0x81817f81, 0x7f7f7f7f, 0x8181817f, 0x7f81817f,
+0x8181817f, 0x7f818181, 0x7f817f7f, 0x817f7f7f, 0x7f817f7f, 0x817f8181, 0x7f7f8181, 0x7f81817f,
+0x7f7f7f7f, 0x7f7f817f, 0x81818181, 0x7f818181, 0x81818181, 0x7f7f817f, 0x817f817f, 0x817f817f,
+0x7f7f7f81, 0x7f7f817f, 0x7f7f7f7f, 0x7f7f8181, 0x7f817f81, 0x7f7f7f81, 0x81817f7f, 0x7f817f81,
+0x817f817f, 0x7f7f7f7f, 0x81817f81, 0x817f8181, 0x7f817f7f, 0x7f81817f, 0x7f818181, 0x817f8181,
+0x7f81817f, 0x7f818181, 0x817f817f, 0x8181817f, 0x817f817f, 0x81817f7f, 0x817f817f, 0x7f81817f,
+0x8181817f, 0x7f817f81, 0x7f817f7f, 0x81817f81, 0x7f81817f, 0x817f8181, 0x7f818181, 0x7f7f7f7f,
+0x817f8181, 0x7f817f7f, 0x7f7f8181, 0x817f8181, 0x7f7f7f81, 0x817f8181, 0x81817f7f, 0x817f7f7f,
+0x81817f81, 0x81818181, 0x7f818181, 0x7f818181, 0x8181817f, 0x7f7f8181, 0x7f7f817f, 0x7f7f8181,
+0x81817f7f, 0x7f817f7f, 0x7f7f817f, 0x81818181, 0x7f817f81, 0x817f8181, 0x7f81817f, 0x7f7f7f7f,
+0x7f7f8181, 0x817f7f81, 0x7f7f8181, 0x817f817f, 0x7f818181, 0x7f7f8181, 0x7f7f7f7f, 0x8181817f,
+0x817f7f81, 0x7f7f7f81, 0x817f7f81, 0x8181817f, 0x817f8181, 0x7f817f7f, 0x7f7f7f81, 0x817f817f,
+0x81817f7f, 0x817f8181, 0x7f7f7f81, 0x7f81817f, 0x7f7f8181, 0x7f817f7f, 0x817f8181, 0x7f7f7f81,
+0x8181817f, 0x817f8181, 0x7f817f7f, 0x817f7f81, 0x7f818181, 0x7f7f7f81, 0x81817f7f, 0x817f8181,
+0x7f7f817f, 0x7f81817f, 0x817f7f81, 0x7f7f7f81, 0x7f81817f, 0x817f8181, 0x81818181, 0x817f817f,
+0x7f81817f, 0x817f8181, 0x7f817f81, 0x7f817f7f, 0x7f81817f, 0x7f7f817f, 0x7f81817f, 0x81817f81,
+0x817f817f, 0x81818181, 0x7f817f7f, 0x817f8181, 0x817f7f7f, 0x7f7f7f81, 0x817f8181, 0x7f818181,
+0x7f7f7f7f, 0x817f8181, 0x817f7f7f, 0x7f817f7f, 0x81817f7f, 0x81818181, 0x7f7f817f, 0x8181817f,
+0x8181817f, 0x8181817f, 0x81817f7f, 0x7f817f81, 0x817f8181, 0x8181817f, 0x7f81817f, 0x7f817f7f,
+0x7f817f81, 0x81818181, 0x8181817f, 0x7f81817f, 0x81818181, 0x7f7f7f81, 0x7f818181, 0x7f7f7f81,
+0x7f7f7f7f, 0x7f7f7f7f, 0x817f7f7f, 0x8181817f, 0x8181817f, 0x817f7f7f, 0x7f817f7f, 0x817f8181,
+0x817f7f7f, 0x817f8181, 0x7f7f817f, 0x817f817f, 0x817f8181, 0x81817f81, 0x81817f81, 0x81817f7f,
+0x7f81817f, 0x7f7f7f7f, 0x81817f81, 0x7f7f8181, 0x7f817f7f, 0x81818181, 0x7f7f817f, 0x81817f7f,
+0x817f817f, 0x7f817f7f, 0x7f7f817f, 0x7f7f7f81, 0x817f7f81, 0x7f7f7f7f, 0x817f8181, 0x7f818181,
+0x817f8181, 0x7f817f81, 0x7f7f7f7f, 0x8181817f, 0x81818181, 0x81817f7f, 0x817f7f7f, 0x817f8181,
+0x817f8181, 0x7f818181, 0x81818181, 0x7f818181, 0x7f817f7f, 0x81817f81, 0x817f7f7f, 0x817f7f81,
+0x817f7f81, 0x81817f81, 0x8181817f, 0x81817f81, 0x81817f81, 0x817f8181, 0x81818181, 0x81818181,
+0x81818181, 0x817f817f, 0x8181817f, 0x8181817f, 0x81817f81, 0x817f7f81, 0x817f7f81, 0x817f7f7f,
+0x7f7f8181, 0x7f7f817f, 0x7f7f8181, 0x7f817f7f, 0x7f818181, 0x81817f81, 0x7f817f81, 0x817f7f81,
+0x7f817f81, 0x817f817f, 0x8181817f, 0x81817f81, 0x7f7f817f, 0x817f8181, 0x7f81817f, 0x7f817f81,
+0x81817f7f, 0x7f7f8181, 0x7f7f817f, 0x7f7f8181, 0x7f7f7f7f, 0x7f7f7f81, 0x7f817f7f, 0x7f7f817f,
+0x7f7f8181, 0x7f7f817f, 0x7f7f817f, 0x8181817f, 0x81817f7f, 0x7f7f817f, 0x7f817f81, 0x7f7f817f,
+0x8181817f, 0x7f7f8181, 0x81817f7f, 0x817f817f, 0x8181817f, 0x817f7f81, 0x8181817f, 0x7f81817f,
+0x7f81817f, 0x817f817f, 0x7f7f7f81, 0x7f7f8181, 0x81817f7f, 0x7f7f7f81, 0x7f818181, 0x7f818181,
+0x7f7f7f81, 0x7f7f7f7f, 0x7f818181, 0x8181817f, 0x8181817f, 0x8181817f, 0x7f81817f, 0x81818181,
+0x7f818181, 0x7f7f817f, 0x7f817f7f, 0x7f818181, 0x817f8181, 0x7f7f817f, 0x7f818181, 0x7f818181,
+0x81817f81, 0x7f7f817f, 0x7f81817f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f817f81, 0x81817f81, 0x7f7f817f,
+0x7f817f7f, 0x817f817f, 0x7f818181, 0x81817f81, 0x7f81817f, 0x7f817f7f, 0x7f817f7f, 0x7f7f7f81,
+0x7f818181, 0x7f818181, 0x817f817f, 0x81818181, 0x817f817f, 0x81818181, 0x7f818181, 0x7f818181,
+0x7f7f817f, 0x817f7f7f, 0x7f817f7f, 0x7f7f817f, 0x7f7f7f7f, 0x7f7f8181, 0x817f7f81, 0x7f81817f,
+0x81817f81, 0x817f7f81, 0x8181817f, 0x817f817f, 0x7f817f7f, 0x7f817f81, 0x7f81817f, 0x7f818181,
+0x817f8181, 0x81817f7f, 0x817f7f7f, 0x817f8181, 0x7f818181, 0x817f7f7f, 0x817f7f7f, 0x7f7f817f,
+0x817f817f, 0x81817f81, 0x81818181, 0x7f7f7f81, 0x817f7f81, 0x817f7f81, 0x7f7f8181, 0x81818181,
+0x7f7f7f7f, 0x7f7f8181, 0x81817f81, 0x7f817f7f, 0x817f817f, 0x817f8181, 0x81817f81, 0x7f7f817f,
+0x7f817f7f, 0x7f818181, 0x81818181, 0x7f81817f, 0x7f7f7f81, 0x7f81817f, 0x7f7f817f, 0x8181817f,
+0x817f7f81, 0x817f817f, 0x7f7f8181, 0x817f7f81, 0x7f7f8181, 0x817f7f81, 0x7f7f8181, 0x81817f81,
+0x7f7f817f, 0x81818181, 0x8181817f, 0x7f818181, 0x817f817f, 0x7f817f81, 0x7f817f7f, 0x7f81817f,
+0x7f7f7f81, 0x817f7f81, 0x817f7f7f, 0x7f7f7f81, 0x817f7f81, 0x817f8181, 0x817f8181, 0x7f818181,
+0x7f7f8181, 0x7f817f7f, 0x81818181, 0x8181817f, 0x7f7f817f, 0x81817f7f, 0x817f817f, 0x81817f81,
+0x7f817f81, 0x7f7f7f7f, 0x8181817f, 0x817f7f81, 0x81817f81, 0x7f818181, 0x81818181, 0x7f7f8181,
+0x817f7f7f, 0x7f817f7f, 0x7f7f817f, 0x817f817f, 0x7f817f7f, 0x817f7f81, 0x7f7f8181, 0x7f7f7f81,
+0x81818181, 0x7f7f8181, 0x81818181, 0x817f7f81, 0x81818181, 0x817f7f81, 0x81817f7f, 0x7f7f817f,
+0x817f7f7f, 0x8181817f, 0x817f7f81, 0x81818181, 0x81817f81, 0x81818181, 0x7f81817f, 0x7f817f81,
+0x7f81817f, 0x7f817f7f, 0x7f81817f, 0x7f818181, 0x81817f7f, 0x7f81817f, 0x81817f7f, 0x817f7f7f,
+0x817f8181, 0x7f7f8181, 0x8181817f, 0x8181817f, 0x81817f7f, 0x817f817f, 0x7f81817f, 0x8181817f,
+0x7f818181, 0x817f7f7f, 0x7f818181, 0x817f8181, 0x81818181, 0x7f7f7f81, 0x7f7f8181, 0x7f817f7f,
+0x817f8181, 0x7f817f7f, 0x7f818181, 0x7f7f7f7f, 0x7f7f817f, 0x817f817f, 0x817f8181, 0x7f81817f,
+0x7f817f7f, 0x7f7f7f7f, 0x7f7f8181, 0x7f818181, 0x7f817f7f, 0x7f7f8181, 0x7f817f81, 0x7f7f817f,
+0x817f8181, 0x81817f81, 0x7f7f8181, 0x81817f81, 0x81817f7f, 0x817f7f7f, 0x817f8181, 0x7f818181,
+0x81818181, 0x7f817f7f, 0x81817f81, 0x817f7f7f, 0x817f7f81, 0x81817f7f, 0x817f817f, 0x7f817f81,
+0x7f7f8181, 0x81817f7f, 0x7f818181, 0x7f7f7f7f, 0x7f7f7f81, 0x7f817f81, 0x7f7f7f81, 0x7f7f8181,
+0x81817f81, 0x817f817f, 0x817f7f81, 0x7f7f817f, 0x81817f7f, 0x81817f81, 0x817f7f81, 0x7f818181,
+0x817f817f, 0x7f81817f, 0x8181817f, 0x8181817f, 0x7f818181, 0x817f7f81, 0x81818181, 0x817f7f81,
+0x817f7f7f, 0x8181817f, 0x8181817f, 0x7f817f7f, 0x81818181, 0x7f7f7f81, 0x7f7f7f7f, 0x7f818181,
+0x817f7f7f, 0x7f7f817f, 0x7f7f7f81, 0x7f7f7f81, 0x7f817f81, 0x7f817f7f, 0x7f817f81, 0x817f7f81,
+0x81817f81, 0x8181817f, 0x7f81817f, 0x81818181, 0x7f7f7f7f, 0x817f7f81, 0x7f7f817f, 0x81818181,
+0x817f817f, 0x7f818181, 0x817f7f81, 0x817f817f, 0x817f8181, 0x7f7f7f7f, 0x81817f81, 0x7f7f8181,
+0x8181817f, 0x81817f7f, 0x7f818181, 0x81817f7f, 0x81817f81, 0x7f81817f, 0x7f81817f, 0x817f7f7f,
+0x7f817f81, 0x8181817f, 0x81817f81, 0x7f818181, 0x8181817f, 0x81817f81, 0x81817f81, 0x7f7f8181,
+0x7f818181, 0x817f8181, 0x81817f81, 0x7f818181, 0x7f818181, 0x81818181, 0x7f7f8181, 0x81817f7f,
+0x7f7f8181, 0x7f818181, 0x7f818181, 0x8181817f, 0x7f817f81, 0x8181817f, 0x7f817f7f, 0x817f817f,
+0x7f817f81, 0x81818181, 0x817f7f81, 0x8181817f, 0x7f7f817f, 0x7f7f7f81, 0x817f7f81, 0x7f7f8181,
+0x7f817f81, 0x81817f81, 0x81818181, 0x7f7f7f81, 0x817f8181, 0x81817f7f, 0x817f7f7f, 0x7f7f817f,
+0x8181817f, 0x7f817f81, 0x817f8181, 0x817f7f7f, 0x81817f81, 0x817f8181, 0x7f817f81, 0x8181817f,
+0x81817f81, 0x817f817f, 0x817f8181, 0x81817f81, 0x7f817f81, 0x7f818181, 0x7f7f7f81, 0x7f7f8181,
+0x7f7f817f, 0x8181817f, 0x7f817f7f, 0x817f8181, 0x817f8181, 0x817f817f, 0x7f7f817f, 0x81817f7f,
+0x817f7f81, 0x7f818181, 0x7f7f7f7f, 0x7f818181, 0x81818181, 0x7f818181, 0x7f818181, 0x8181817f,
+0x81817f81, 0x7f7f7f81, 0x817f7f81, 0x817f8181, 0x81817f7f, 0x7f81817f, 0x7f7f817f, 0x817f8181,
+0x81817f81, 0x817f7f7f, 0x817f817f, 0x7f81817f, 0x817f817f, 0x817f7f7f, 0x81817f7f, 0x817f7f81,
+0x817f817f, 0x7f7f7f7f, 0x8181817f, 0x7f817f81, 0x7f817f81, 0x81817f81, 0x7f817f7f, 0x7f817f7f,
+0x7f817f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x81817f81, 0x817f7f81, 0x7f7f7f81, 0x81817f81, 0x7f7f817f,
+0x817f8181, 0x7f817f81, 0x8181817f, 0x7f7f8181, 0x817f8181, 0x7f81817f, 0x8181817f, 0x7f7f8181,
+0x81817f81, 0x7f818181, 0x7f817f81, 0x7f7f7f7f, 0x7f7f8181, 0x7f818181, 0x8181817f, 0x7f7f7f7f,
+0x817f817f, 0x81817f7f, 0x7f81817f, 0x7f7f7f7f, 0x7f81817f, 0x7f81817f, 0x817f817f, 0x817f7f81,
+0x7f817f81, 0x7f817f7f, 0x81817f7f, 0x817f7f7f, 0x817f7f7f, 0x7f817f81, 0x7f7f817f, 0x7f81817f,
+0x81818181, 0x817f7f81, 0x7f7f8181, 0x7f7f7f7f, 0x7f7f8181, 0x7f7f817f, 0x817f7f7f, 0x7f817f81,
+0x7f817f7f, 0x7f7f817f, 0x81817f81, 0x7f817f81, 0x8181817f, 0x7f7f8181, 0x7f7f8181, 0x8181817f,
+0x7f7f7f81, 0x8181817f, 0x8181817f, 0x81817f81, 0x7f81817f, 0x7f7f817f, 0x7f7f817f, 0x7f7f817f,
+0x7f81817f, 0x7f818181, 0x7f817f7f, 0x81817f7f, 0x7f7f7f81, 0x81817f81, 0x817f8181, 0x817f7f81,
+0x817f817f, 0x7f818181, 0x7f817f7f, 0x817f7f81, 0x7f7f7f7f, 0x81817f7f, 0x7f81817f, 0x7f817f81,
+0x7f7f8181, 0x7f817f7f, 0x7f81817f, 0x7f81817f, 0x81817f81, 0x7f817f81, 0x817f817f, 0x817f817f,
+0x8181817f, 0x7f7f817f, 0x817f7f81, 0x81817f7f, 0x7f817f7f, 0x7f81817f, 0x7f7f8181, 0x8181817f,
+0x7f817f7f, 0x817f817f, 0x81817f7f, 0x817f7f7f, 0x817f7f81, 0x81818181, 0x7f7f7f81, 0x81817f7f,
+0x817f817f, 0x817f8181, 0x7f81817f, 0x7f7f8181, 0x817f7f81, 0x7f7f8181, 0x81817f7f, 0x81817f81,
+0x7f818181, 0x817f817f, 0x7f7f817f, 0x817f817f, 0x817f7f81, 0x7f7f8181, 0x7f7f8181, 0x7f7f7f7f,
+0x817f8181, 0x7f7f7f81, 0x817f7f7f, 0x7f7f8181, 0x7f7f7f7f, 0x7f817f7f, 0x7f817f7f, 0x7f7f817f,
+0x817f817f, 0x81818181, 0x7f81817f, 0x7f7f817f, 0x7f818181, 0x817f7f7f, 0x7f817f81, 0x81817f81,
+0x817f7f7f, 0x81817f7f, 0x81817f81, 0x7f7f8181, 0x7f7f817f, 0x7f7f7f81, 0x8181817f, 0x81817f7f,
+0x81817f81, 0x7f7f7f81, 0x7f817f7f, 0x817f7f7f, 0x817f7f7f, 0x81817f7f, 0x81817f81, 0x7f7f7f7f,
+0x7f817f81, 0x817f7f81, 0x7f817f81, 0x7f7f7f81, 0x81818181, 0x7f7f8181, 0x81817f7f, 0x81818181,
+0x7f7f8181, 0x7f7f817f, 0x817f7f7f, 0x7f818181, 0x817f8181, 0x81817f7f, 0x8181817f, 0x81817f7f,
+0x8181817f, 0x7f817f81, 0x81818181, 0x817f7f7f, 0x81818181, 0x7f818181, 0x7f7f8181, 0x7f7f817f,
+0x817f8181, 0x7f7f8181, 0x817f7f7f, 0x817f7f81, 0x7f81817f, 0x817f7f7f, 0x8181817f, 0x81817f81,
+0x817f7f81, 0x817f7f7f, 0x7f7f7f7f, 0x81817f7f, 0x817f7f7f, 0x7f818181, 0x7f81817f, 0x7f817f7f,
+0x817f8181, 0x7f7f7f81, 0x7f817f81, 0x817f8181, 0x817f7f7f, 0x7f818181, 0x7f7f7f81, 0x81817f7f,
+0x817f7f7f, 0x7f817f7f, 0x7f817f7f, 0x7f7f817f, 0x817f8181, 0x817f7f7f, 0x7f7f817f, 0x8181817f,
+0x817f7f7f, 0x8181817f, 0x7f7f8181, 0x7f817f7f, 0x7f817f81, 0x81818181, 0x7f7f817f, 0x81818181,
+0x817f7f7f, 0x7f7f7f81, 0x81817f7f, 0x817f8181, 0x7f7f7f81, 0x817f8181, 0x7f7f8181, 0x817f7f81,
+0x817f7f81, 0x7f817f7f, 0x7f7f817f, 0x7f7f8181, 0x7f7f7f81, 0x7f7f7f81, 0x7f81817f, 0x817f817f,
+0x7f817f7f, 0x81817f7f, 0x7f7f817f, 0x7f7f7f81, 0x817f8181, 0x7f7f8181, 0x7f7f7f81, 0x7f7f7f81,
+0x81818181, 0x7f7f7f7f, 0x817f8181, 0x7f7f8181, 0x7f817f7f, 0x7f817f7f, 0x817f7f7f, 0x8181817f,
+0x81818181, 0x7f817f81, 0x7f7f7f7f, 0x817f7f81, 0x817f7f81, 0x7f818181, 0x7f81817f, 0x7f818181,
+0x7f7f7f81, 0x7f81817f, 0x7f7f8181, 0x7f7f8181, 0x817f7f81, 0x7f817f81, 0x7f817f7f, 0x7f818181,
+0x7f7f817f, 0x7f818181, 0x7f817f7f, 0x81817f7f, 0x7f7f7f81, 0x7f818181, 0x817f7f7f, 0x817f817f,
+0x7f81817f, 0x817f7f81, 0x7f818181, 0x817f7f81, 0x7f7f7f81, 0x8181817f, 0x8181817f, 0x7f81817f,
+0x817f817f, 0x7f7f7f81, 0x81817f81, 0x7f7f8181, 0x7f7f7f81, 0x7f7f8181, 0x817f8181, 0x817f7f7f,
+0x7f817f81, 0x8181817f, 0x7f7f817f, 0x7f817f7f, 0x7f7f8181, 0x7f7f7f81, 0x8181817f, 0x7f7f8181,
+0x7f818181, 0x81817f7f, 0x8181817f, 0x817f7f81, 0x7f7f7f81, 0x817f7f7f, 0x7f817f81, 0x7f818181,
+0x81818181, 0x7f7f7f7f, 0x817f7f81, 0x7f817f7f, 0x7f817f7f, 0x7f81817f, 0x81818181, 0x817f7f81,
+0x817f7f81, 0x7f817f81, 0x7f7f8181, 0x7f818181, 0x7f818181, 0x7f818181, 0x7f7f7f81, 0x7f81817f,
+0x7f81817f, 0x7f818181, 0x7f7f7f81, 0x81817f81, 0x81818181, 0x817f7f7f, 0x817f7f7f, 0x817f817f,
+0x8181817f, 0x7f7f8181, 0x7f7f7f7f, 0x81818181, 0x817f8181, 0x7f7f8181, 0x81817f81, 0x7f817f81,
+0x7f818181, 0x7f7f817f, 0x817f7f81, 0x7f7f7f81, 0x7f7f7f81, 0x81817f81, 0x81817f81, 0x7f7f7f7f,
+0x817f7f81, 0x7f817f7f, 0x81817f81, 0x7f817f81, 0x817f817f, 0x7f7f8181, 0x81817f7f, 0x817f7f81,
+0x7f817f81, 0x7f7f7f81, 0x817f8181, 0x7f7f7f81, 0x817f7f7f, 0x7f7f7f81, 0x817f817f, 0x7f7f7f81,
+0x7f817f7f, 0x7f817f7f, 0x8181817f, 0x8181817f, 0x7f7f7f81, 0x7f7f7f81, 0x7f817f81, 0x81817f81,
+0x81817f7f, 0x7f7f7f7f, 0x81817f7f, 0x81818181, 0x817f817f, 0x81817f81, 0x81818181, 0x817f7f81,
+0x817f8181, 0x817f7f7f, 0x81817f7f, 0x81817f7f, 0x81818181, 0x7f7f7f7f, 0x7f817f7f, 0x7f81817f,
+0x7f7f817f, 0x8181817f, 0x817f8181, 0x817f8181, 0x8181817f, 0x7f7f7f81, 0x817f7f7f, 0x817f7f7f,
+0x817f8181, 0x7f817f81, 0x7f7f7f7f, 0x81817f7f, 0x81818181, 0x7f817f7f, 0x7f7f8181, 0x817f8181,
+0x817f7f7f, 0x817f7f81, 0x817f7f81, 0x81817f7f, 0x7f817f7f, 0x817f7f7f, 0x7f7f8181, 0x7f817f81,
+0x7f7f7f7f, 0x8181817f, 0x7f7f7f81, 0x81818181, 0x7f7f817f, 0x81817f81, 0x817f7f7f, 0x7f817f81,
+0x817f817f, 0x7f817f81, 0x817f7f7f, 0x7f7f8181, 0x7f81817f, 0x7f7f8181, 0x7f7f7f7f, 0x7f818181,
+0x81817f81, 0x7f7f817f, 0x7f7f817f, 0x7f7f817f, 0x817f7f7f, 0x81818181, 0x81817f7f, 0x7f817f81,
+0x7f7f817f, 0x7f7f7f7f, 0x81818181, 0x7f7f817f, 0x7f7f817f, 0x7f817f7f, 0x817f7f81, 0x7f817f7f,
+0x7f7f7f81, 0x7f7f817f, 0x817f817f, 0x81817f7f, 0x81818181, 0x817f8181, 0x7f817f7f, 0x817f8181,
+0x7f818181, 0x7f81817f, 0x817f7f81, 0x817f7f7f, 0x7f7f817f, 0x817f7f7f, 0x7f7f7f81, 0x81817f7f,
+0x7f7f817f, 0x817f7f81, 0x7f818181, 0x817f8181, 0x817f8181, 0x7f7f7f7f, 0x817f817f, 0x7f7f7f7f,
+0x7f7f7f7f, 0x7f7f7f7f, 0x817f8181, 0x81817f81, 0x817f7f7f, 0x7f818181, 0x7f81817f, 0x7f81817f,
+0x81818181, 0x817f8181, 0x817f7f81, 0x8181817f, 0x817f7f7f, 0x7f7f7f7f, 0x81817f81, 0x817f817f,
+0x817f817f, 0x817f7f81, 0x7f818181, 0x7f817f81, 0x81817f81, 0x7f81817f, 0x7f81817f, 0x7f817f7f,
+0x7f817f81, 0x7f7f7f81, 0x81817f81, 0x81817f81, 0x7f7f817f, 0x7f817f7f, 0x7f818181, 0x7f81817f,
+0x817f7f81, 0x817f7f81, 0x81817f81, 0x7f818181, 0x817f8181, 0x7f81817f, 0x7f7f7f7f, 0x817f7f7f,
+0x7f817f7f, 0x81817f7f, 0x7f7f8181, 0x7f7f8181, 0x7f7f8181, 0x817f8181, 0x7f81817f, 0x817f7f81,
+0x817f7f81, 0x7f7f817f, 0x7f817f81, 0x81817f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f8181, 0x817f7f81,
+0x8181817f, 0x8181817f, 0x7f7f8181, 0x7f7f817f, 0x817f7f81, 0x817f8181, 0x7f818181, 0x81818181,
+0x817f7f81, 0x7f7f817f, 0x7f7f817f, 0x7f7f8181, 0x7f7f7f7f, 0x817f7f81, 0x8181817f, 0x81818181,
+0x817f817f, 0x7f818181, 0x817f7f81, 0x81817f7f, 0x7f817f7f, 0x7f817f7f, 0x81818181, 0x817f817f,
+0x817f7f81, 0x7f7f8181, 0x7f7f8181, 0x8181817f, 0x7f817f7f, 0x7f81817f, 0x7f7f7f81, 0x7f7f7f81,
+0x8181817f, 0x7f817f7f, 0x817f7f81, 0x7f817f81, 0x7f817f81, 0x817f817f, 0x81818181, 0x817f817f,
+0x817f8181, 0x7f7f8181, 0x7f817f7f, 0x817f817f, 0x817f7f81, 0x8181817f, 0x7f7f7f81, 0x81817f81,
+0x817f7f81, 0x81818181, 0x7f818181, 0x7f7f7f81, 0x7f818181, 0x7f817f7f, 0x7f7f7f81, 0x7f7f7f81,
+0x817f817f, 0x81818181, 0x7f7f817f, 0x81818181, 0x8181817f, 0x7f7f817f, 0x7f7f7f7f, 0x7f818181,
+0x817f817f, 0x7f7f8181, 0x7f817f81, 0x817f8181, 0x7f817f81, 0x7f7f7f81, 0x7f818181, 0x8181817f,
+0x7f7f7f7f, 0x7f7f7f81, 0x7f7f7f81, 0x7f7f7f7f, 0x81817f7f, 0x7f7f8181, 0x817f817f, 0x817f8181,
+0x817f7f7f, 0x81817f81, 0x7f81817f, 0x7f7f8181, 0x7f7f8181, 0x7f7f7f7f, 0x817f817f, 0x81818181,
+0x7f7f8181, 0x7f818181, 0x7f81817f, 0x817f7f7f, 0x81817f7f, 0x81817f81, 0x7f81817f, 0x8181817f,
+0x81818181, 0x81817f7f, 0x7f818181, 0x7f817f81, 0x817f7f7f, 0x817f817f, 0x7f7f817f, 0x81818181,
+0x7f81817f, 0x7f7f7f81, 0x7f7f7f81, 0x81817f81, 0x81817f7f, 0x817f7f81, 0x7f817f81, 0x817f817f,
+0x817f817f, 0x7f7f7f7f, 0x7f817f7f, 0x7f7f7f81, 0x81817f7f, 0x817f7f81, 0x7f7f8181, 0x817f7f81,
+0x7f81817f, 0x817f7f81, 0x817f817f, 0x817f8181, 0x7f818181, 0x7f7f7f81, 0x7f7f8181, 0x817f7f7f,
+0x7f7f7f7f, 0x81817f7f, 0x81817f7f, 0x81817f7f, 0x7f817f81, 0x81818181, 0x817f817f, 0x81817f7f,
+0x7f7f7f7f, 0x7f7f7f7f, 0x7f818181, 0x7f7f7f81, 0x817f7f81, 0x7f817f7f, 0x7f817f81, 0x7f7f7f81,
+0x81817f7f, 0x81817f81, 0x81817f81, 0x81818181, 0x817f7f7f, 0x7f818181, 0x81818181, 0x7f7f7f7f,
+0x7f818181, 0x7f7f817f, 0x7f7f8181, 0x817f7f7f, 0x7f817f81, 0x817f7f7f, 0x81818181, 0x7f7f817f,
+0x817f7f81, 0x817f7f81, 0x7f81817f, 0x81817f81, 0x7f7f8181, 0x7f81817f, 0x7f7f8181, 0x817f7f7f,
+0x7f817f7f, 0x8181817f, 0x8181817f, 0x8181817f, 0x7f7f8181, 0x8181817f, 0x7f7f8181, 0x817f817f,
+0x7f817f7f, 0x7f7f8181, 0x7f7f7f81, 0x7f818181, 0x81817f7f, 0x7f818181, 0x817f7f81, 0x7f7f817f,
+0x7f7f7f7f, 0x7f817f81, 0x7f817f81, 0x7f7f8181, 0x7f7f817f, 0x7f817f7f, 0x81817f81, 0x7f7f8181,
+0x81818181, 0x7f7f817f, 0x7f817f81, 0x817f8181, 0x817f8181, 0x81817f81, 0x817f817f, 0x7f81817f,
+0x817f7f7f, 0x7f7f7f7f, 0x7f7f7f81, 0x817f8181, 0x7f7f7f81, 0x817f8181, 0x81818181, 0x7f817f81,
+0x81818181, 0x7f81817f, 0x7f7f7f7f, 0x81817f81, 0x7f818181, 0x7f7f7f7f, 0x7f81817f, 0x7f81817f,
+0x8181817f, 0x7f81817f, 0x81817f81, 0x7f7f7f7f, 0x817f7f81, 0x7f7f7f81, 0x7f817f81, 0x7f7f7f81,
+0x81818181, 0x81817f7f, 0x81817f81, 0x7f7f817f, 0x7f818181, 0x81817f81, 0x81817f7f, 0x81817f81,
+0x7f7f7f81, 0x81817f7f, 0x7f7f8181, 0x7f7f817f, 0x81817f7f, 0x817f7f81, 0x7f818181, 0x7f817f7f,
+0x7f817f81, 0x7f7f817f, 0x7f7f817f, 0x817f817f, 0x7f7f7f7f, 0x817f7f81, 0x7f7f7f81, 0x817f817f,
+0x7f7f8181, 0x7f818181, 0x817f817f, 0x7f817f81, 0x817f7f7f, 0x7f818181, 0x81818181, 0x81818181,
+0x81817f7f, 0x7f81817f, 0x7f817f7f, 0x7f7f817f, 0x7f7f8181, 0x817f817f, 0x817f8181, 0x7f7f817f,
+0x817f7f81, 0x81817f81, 0x817f7f81, 0x7f81817f, 0x817f7f81, 0x81817f7f, 0x7f817f7f, 0x7f817f81,
+0x817f7f7f, 0x7f7f817f, 0x7f817f81, 0x7f7f7f81, 0x81818181, 0x7f817f7f, 0x817f817f, 0x81818181,
+0x7f7f7f7f, 0x7f817f81, 0x7f817f81, 0x7f817f7f, 0x817f8181, 0x817f8181, 0x7f817f81, 0x81818181,
+0x7f818181, 0x81818181, 0x7f81817f, 0x7f818181, 0x7f7f817f, 0x7f7f817f, 0x7f7f7f81, 0x81817f7f,
+0x7f818181, 0x817f8181, 0x7f7f7f81, 0x7f7f817f, 0x7f7f817f, 0x7f817f81, 0x7f817f7f, 0x7f7f7f7f,
+0x81817f81, 0x81817f81, 0x7f7f7f81, 0x81818181, 0x7f817f7f, 0x81818181, 0x81817f7f, 0x7f7f8181,
+0x817f7f7f, 0x7f7f817f, 0x817f817f, 0x817f8181, 0x81818181, 0x7f817f81, 0x817f817f, 0x817f8181,
+0x817f8181, 0x817f817f, 0x81817f7f, 0x7f817f7f, 0x817f8181, 0x81817f7f, 0x81818181, 0x817f8181,
+0x7f817f7f, 0x7f817f7f, 0x7f7f8181, 0x817f817f, 0x7f7f817f, 0x7f817f81, 0x7f7f817f, 0x7f7f7f81,
+0x817f817f, 0x7f7f8181, 0x81817f7f, 0x7f7f7f7f, 0x7f818181, 0x7f818181, 0x7f817f81, 0x7f81817f,
+0x7f7f8181, 0x7f7f7f7f, 0x81817f81, 0x817f7f7f, 0x81817f7f, 0x817f7f7f, 0x8181817f, 0x7f818181,
+0x817f817f, 0x817f7f81, 0x81817f7f, 0x817f7f81, 0x7f817f81, 0x817f7f81, 0x817f817f, 0x7f7f7f7f,
+0x7f817f7f, 0x8181817f, 0x7f818181, 0x81817f81, 0x7f7f7f7f, 0x7f818181, 0x817f817f, 0x7f818181,
+0x7f818181, 0x817f7f7f, 0x81817f7f, 0x81817f81, 0x7f7f7f81, 0x7f7f817f, 0x81817f81, 0x7f81817f,
+0x817f8181, 0x7f81817f, 0x7f7f7f81, 0x7f818181, 0x81817f7f, 0x7f818181, 0x817f817f, 0x817f7f7f,
+0x817f7f7f, 0x817f817f, 0x817f7f7f, 0x7f81817f, 0x7f817f81, 0x7f7f8181, 0x817f817f, 0x817f817f,
+0x7f81817f, 0x7f817f7f, 0x7f7f817f, 0x81817f81, 0x817f8181, 0x81818181, 0x7f7f817f, 0x81818181,
+0x81817f7f, 0x7f818181, 0x7f7f8181, 0x7f7f8181, 0x81818181, 0x7f817f7f, 0x8181817f, 0x8181817f,
+0x817f7f7f, 0x817f7f7f, 0x81818181, 0x7f818181, 0x7f817f7f, 0x81817f81, 0x8181817f, 0x817f7f7f,
+0x7f7f7f7f, 0x7f7f7f81, 0x7f817f81, 0x7f7f817f, 0x81817f81, 0x7f7f817f, 0x7f818181, 0x7f817f7f,
+0x7f81817f, 0x7f7f817f, 0x81818181, 0x7f7f817f, 0x7f7f8181, 0x7f7f7f81, 0x81817f81, 0x817f817f,
+0x7f817f81, 0x7f817f7f, 0x8181817f, 0x7f7f7f81, 0x81818181, 0x817f7f7f, 0x81817f7f, 0x7f817f7f,
+0x817f7f7f, 0x817f817f, 0x7f817f7f, 0x817f8181, 0x81818181, 0x7f817f7f, 0x81817f81, 0x817f7f7f,
+0x817f8181, 0x7f81817f, 0x7f7f8181, 0x7f817f81, 0x81817f7f, 0x7f7f817f, 0x817f7f81, 0x817f817f,
+0x7f817f81, 0x817f8181, 0x81817f7f, 0x817f8181, 0x8181817f, 0x7f81817f, 0x81817f7f, 0x7f7f817f,
+0x7f81817f, 0x81817f7f, 0x7f818181, 0x817f7f81, 0x8181817f, 0x7f818181, 0x7f7f817f, 0x7f817f7f,
+0x7f817f7f, 0x8181817f, 0x7f81817f, 0x81817f81, 0x7f7f7f7f, 0x7f81817f, 0x817f7f7f, 0x817f7f7f,
+0x817f817f, 0x7f81817f, 0x7f818181, 0x7f7f7f81, 0x817f7f7f, 0x7f7f7f81, 0x7f7f8181, 0x7f7f817f,
+0x7f7f7f81, 0x817f7f81, 0x81817f81, 0x7f7f817f, 0x817f8181, 0x7f7f7f81, 0x7f7f817f, 0x817f817f,
+0x817f7f81, 0x817f817f, 0x7f817f7f, 0x7f7f817f, 0x81818181, 0x81817f81, 0x817f8181, 0x7f7f8181,
+0x7f7f8181, 0x817f8181, 0x7f7f7f7f, 0x8181817f, 0x7f7f7f7f, 0x7f81817f, 0x81817f81, 0x81817f7f,
+0x7f7f8181, 0x8181817f, 0x7f818181, 0x7f817f7f, 0x7f7f817f, 0x7f81817f, 0x7f817f81, 0x7f817f7f,
+0x7f7f8181, 0x81818181, 0x7f7f8181, 0x7f7f7f81, 0x817f7f7f, 0x7f7f8181, 0x81818181, 0x7f817f81,
+0x81818181, 0x7f818181, 0x7f818181, 0x817f8181, 0x81818181, 0x7f81817f, 0x7f7f8181, 0x7f7f8181,
+0x817f7f7f, 0x7f7f7f7f, 0x7f817f81, 0x7f81817f, 0x7f817f7f, 0x817f817f, 0x7f7f7f81, 0x817f7f81,
+0x7f818181, 0x8181817f, 0x817f7f81, 0x817f817f, 0x817f8181, 0x7f7f7f81, 0x7f817f7f, 0x81817f81,
+0x817f8181, 0x817f8181, 0x7f817f7f, 0x81817f7f, 0x817f7f81, 0x7f817f81, 0x817f7f7f, 0x817f8181,
+0x7f817f7f, 0x81817f7f, 0x81817f81, 0x7f817f81, 0x7f81817f, 0x7f7f7f81, 0x7f817f7f, 0x7f7f8181,
+0x8181817f, 0x7f7f7f7f, 0x7f7f8181, 0x7f817f7f, 0x817f8181, 0x817f7f81, 0x7f7f7f7f, 0x7f81817f,
+0x7f7f8181, 0x817f817f, 0x7f7f7f81, 0x81817f7f, 0x81818181, 0x817f7f81, 0x7f817f7f, 0x7f81817f,
+0x8181817f, 0x7f7f817f, 0x817f7f81, 0x81817f81, 0x8181817f, 0x7f7f8181, 0x817f7f81, 0x81817f81,
+0x817f8181, 0x817f8181, 0x817f817f, 0x817f8181, 0x817f7f81, 0x7f7f7f7f, 0x7f7f8181, 0x817f817f,
+0x7f817f7f, 0x817f7f81, 0x7f81817f, 0x81818181, 0x7f7f7f81, 0x7f818181, 0x7f7f8181, 0x81817f7f,
+0x817f7f81, 0x8181817f, 0x7f817f81, 0x7f7f7f7f, 0x7f817f7f, 0x7f818181, 0x8181817f, 0x817f7f81,
+0x817f7f7f, 0x7f817f81, 0x7f7f8181, 0x817f7f81, 0x817f7f7f, 0x817f8181, 0x7f817f81, 0x81817f7f,
+0x817f817f, 0x81817f81, 0x81817f7f, 0x8181817f, 0x817f8181, 0x817f7f7f, 0x81817f7f, 0x81817f81,
+0x817f7f81, 0x81818181, 0x81817f81, 0x7f817f7f, 0x7f817f7f, 0x8181817f, 0x7f818181, 0x7f7f7f7f,
+0x7f817f81, 0x81817f81, 0x7f7f817f, 0x817f7f81, 0x7f7f7f81, 0x7f818181, 0x7f7f7f7f, 0x7f817f7f,
+0x7f7f817f, 0x817f7f7f, 0x7f7f817f, 0x8181817f, 0x7f818181, 0x7f7f7f7f, 0x81817f7f, 0x7f81817f,
+0x817f7f7f, 0x7f7f7f7f, 0x7f81817f, 0x817f7f7f, 0x817f817f, 0x7f7f7f81, 0x81817f81, 0x817f7f7f,
+0x817f7f81, 0x81817f7f, 0x7f7f7f7f, 0x81818181, 0x81817f7f, 0x7f7f7f81, 0x81817f7f, 0x7f7f7f81,
+0x7f817f81, 0x817f7f7f, 0x7f817f7f, 0x7f81817f, 0x7f817f7f, 0x817f817f, 0x817f817f, 0x8181817f,
+0x817f8181, 0x81818181, 0x817f817f, 0x7f7f8181, 0x7f817f7f, 0x7f817f81, 0x817f7f7f, 0x7f7f8181,
+0x7f817f81, 0x81817f81, 0x817f817f, 0x7f818181, 0x7f7f7f81, 0x7f7f8181, 0x7f81817f, 0x8181817f,
+0x7f7f7f7f, 0x817f8181, 0x7f7f7f7f, 0x81817f81, 0x8181817f, 0x7f7f817f, 0x8181817f, 0x7f7f7f7f,
+0x7f817f7f, 0x7f81817f, 0x817f7f7f, 0x81817f7f, 0x7f7f7f7f, 0x81817f81, 0x81817f81, 0x7f81817f,
+0x7f7f7f81, 0x81817f81, 0x817f817f, 0x7f7f7f7f, 0x8181817f, 0x7f817f7f, 0x7f7f7f81, 0x7f817f7f,
+0x817f8181, 0x7f7f7f81, 0x7f81817f, 0x817f8181, 0x7f7f8181, 0x7f817f81, 0x8181817f, 0x81818181,
+0x7f7f8181, 0x817f817f, 0x817f7f81, 0x7f817f7f, 0x7f818181, 0x81818181, 0x7f817f81, 0x817f7f81,
+0x817f817f, 0x81817f7f, 0x81817f81, 0x817f7f7f, 0x7f7f7f81, 0x7f81817f, 0x7f7f8181, 0x7f7f817f,
+0x7f7f7f7f, 0x7f817f7f, 0x7f817f7f, 0x817f8181, 0x7f7f7f81, 0x8181817f, 0x817f8181, 0x7f7f7f7f,
+0x81817f81, 0x817f817f, 0x81818181, 0x7f817f7f, 0x817f817f, 0x817f817f, 0x81817f7f, 0x7f7f7f81,
+0x7f7f7f81, 0x81817f7f, 0x7f817f7f, 0x817f8181, 0x81817f7f, 0x81817f7f, 0x817f8181, 0x8181817f,
+0x7f81817f, 0x7f81817f, 0x817f7f81, 0x817f817f, 0x7f7f8181, 0x8181817f, 0x7f817f81, 0x817f817f,
+0x7f818181, 0x81818181, 0x7f7f7f7f, 0x817f8181, 0x7f817f7f, 0x7f7f817f, 0x7f7f7f81, 0x7f7f7f81,
+0x817f817f, 0x817f817f, 0x81818181, 0x81818181, 0x817f7f81, 0x7f81817f, 0x817f8181, 0x7f7f817f,
+0x817f8181, 0x7f7f7f81, 0x7f818181, 0x817f7f7f, 0x817f7f81, 0x817f8181, 0x817f817f, 0x817f817f,
+0x7f817f81, 0x817f7f7f, 0x81817f7f, 0x7f818181, 0x7f7f817f, 0x817f7f81, 0x817f7f81, 0x817f8181,
+0x7f7f817f, 0x8181817f, 0x8181817f, 0x7f7f817f, 0x81817f81, 0x7f7f7f7f, 0x7f81817f, 0x8181817f,
+0x7f7f817f, 0x7f7f8181, 0x8181817f, 0x817f817f, 0x7f817f81, 0x7f7f8181, 0x7f7f7f7f, 0x7f7f7f81,
+0x81817f81, 0x81818181, 0x7f7f7f81, 0x7f817f81, 0x817f7f7f, 0x7f81817f, 0x81817f7f, 0x7f817f81,
+0x7f818181, 0x7f7f7f81, 0x8181817f, 0x817f8181, 0x817f817f, 0x817f817f, 0x7f7f7f7f, 0x8181817f,
+0x7f81817f, 0x81818181, 0x7f7f8181, 0x817f7f7f, 0x81817f81, 0x817f817f, 0x817f7f81, 0x81818181
+
+output0 =
+0xfb26769b, 0xc79ba708, 0xf8635f11, 0xd7e4cfa4, 0xe3c5e7d7, 0xc02d1876, 0xe718a692, 0x09395387,
+0x9b38d4ad, 0x2cb9b3e9, 0xa975b0e1, 0x330bcede, 0x7b7550e4, 0x1f120789, 0x719ec767, 0x84e65e6f,
+0x8067338a, 0x2f38b6a5, 0xe1100cdc, 0x4129350a, 0xf42f39a8, 0x41ae51c4, 0xa916952f, 0xab6d7503,
+0xd0359b04, 0x97be8694, 0xee8effbe, 0x79b093ec, 0x57122f74, 0x73037ee7, 0x395a2f52, 0x73caae6b,
+0xc3eff955, 0xf9f1d126, 0x02432290, 0x7295881a, 0xdd24b3a4, 0x7b3473eb, 0x9d1dcbef, 0x3c990bfb,
+0xf280623b, 0x20c84e3b, 0x144c6d3a, 0x8ec60a92, 0x09737fc3, 0xeb399fd3, 0xfe46efae, 0x8bca3001,
+0x78ade416, 0xb84aea12, 0x43ca2a9e, 0x15fe0d33, 0xd7c16a39, 0xc42a34e8, 0x58df1eaa, 0xa4c437b8,
+0x155c3a34, 0xb76ffb85, 0x83762da1, 0x7a114abf, 0xa28f5f9a, 0xc5ea01a2, 0x2701d947, 0xf16083f2,
+0x3800ccfd, 0x9c7a9a6f, 0xf65e474d, 0xb143759a, 0xdaaac55c, 0x29950c88, 0xa47976ba, 0xe8335a4f,
+0x6a858152, 0x25a3a9f9, 0xc42def6b, 0x07a3ffe4, 0xeb949edb, 0x767e93a2, 0xe58b7e91, 0x02b0ceec,
+0x4a519ff0, 0x33091006, 0xa5300a4a, 0x2bcd45f6, 0xb83b264d, 0x22336f72, 0xa555c8d1, 0xeb4aa02c,
+0x700dd4a9, 0x6b8fc1e6, 0xd44ce0f3, 0xbb66e520, 0xbdb17016, 0xbebb013c, 0xe2a05d9a, 0x516f5605,
+0xac27f407, 0xbd05f488, 0x2ef5e8c2, 0x23a62cf8, 0x50f2f8a9, 0x45d6bda3, 0x9b6efd5a, 0x77cdc34b,
+0xb466da5a, 0x98b948f0, 0xb345dd43, 0x52ee8fdf, 0xc0596488, 0x73fab111, 0xf88a77d7, 0x36952151,
+0xe5c88df4, 0x05e4e05a, 0xfd68dff8, 0x33ce03ce, 0x181d38da, 0x1bd14663, 0xf3b0e86a, 0xb1d7900d,
+0x52165396, 0xa54e79ef, 0xbf1cda0d, 0xad1f7a2a, 0xebf4db32, 0xf049cd5d, 0xdcbe865f, 0xa1c31f6d,
+0xeba00e1d, 0xde8e2a87, 0x5e9c15de, 0x02ec68bd, 0xaad1a964, 0x95d3bd1c, 0xf7e7048d, 0x4e2c6243,
+0x7e675787, 0xd9811021, 0xec5c7341, 0x98d304da, 0xe68ea509, 0x6318d315, 0xe3570ce2, 0x594c4fad,
+0x840f01f5, 0xa9a2e403, 0x8e651529, 0x72c70e44, 0x9402e2f4, 0x9e1cd395, 0x890701ca, 0xe804887a,
+0xd209cae4, 0x0c344a3d, 0x8926ca86, 0x0f6debfa, 0x83323654, 0xd0d12b75, 0x7d73888c, 0xf95ce546,
+0x0b4fe312, 0x2582b52d, 0xcf10f7ff, 0x7bf385f5, 0x57dcaf9f, 0xcbb60aef, 0x64711e8f, 0x923571ec,
+0xfd90c78e, 0x85099f54, 0x63ae3fdf, 0xc683a0b3, 0x591e8102, 0xb6180e2d, 0x35ae7560, 0x94a4a536,
+0x97defd69, 0x92afc0b4, 0xebce8cf4, 0x4d2fc035, 0x9057a972, 0x30e204a6, 0xc5af64e8, 0x6c7fa059,
+0x40f043e6, 0xdcd8bc3f, 0x5bb3962b, 0xf0f1a38d, 0x99b2893e, 0xf77257c4, 0x60c59a02, 0xaedcaff2,
+0xe5a852c1, 0xea67ccb9, 0x150acbb7, 0xea2cb0bc, 0xfa64f623, 0x0d37fe47, 0x81643457, 0x3dcf1a62,
+0x5c6c4066, 0x66bdc50d, 0x20e45b88, 0x9746424f
+
+basegraph=
+1
+
+z_c=
+320
+
+n_cb=
+16000
+
+q_m=
+8
+
+n_filler=
+488
+
+ea =
+8448
+
+eb =
+8448
+
+iter_max=
+8
+
+expected_iter_count=
+2
+
+c =
+1
+
+r =
+0
+
+cab =
+1
+
+rv_index =
+0
+
+en_scramble =
+1
+
+q =
+0
+
+n_id =
+323
+
+n_rnti =
+2300
+
+code_block_mode =
+0
+
+op_flags =
+RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP
+
+expected_status =
+OK
diff --git a/app/test-bbdev/test_vectors/ldpc_enc_tb.data b/app/test-bbdev/test_vectors/ldpc_enc_tb.data
new file mode 100644
index 0000000000..00c8798995
--- /dev/null
+++ b/app/test-bbdev/test_vectors/ldpc_enc_tb.data
@@ -0,0 +1,482 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020 NXP
+
+op_type =
+RTE_BBDEV_OP_LDPC_ENC
+
+network_order =
+1
+
+input0 =
+0x4a5cf377, 0xc1be40f7, 0x0928020e, 0xb516db35, 0x6345a450, 0x58fff002, 0x2e7eb452, 0x8b11e1cd,
+0xad940424, 0xed9581f4, 0x786faf13, 0xa1a42fd8, 0xb4ae94ec, 0x3a495130, 0x870919cb, 0xce3e626b,
+0xd589a336, 0x89b9255d, 0x9827afc3, 0x4b115731, 0xffa129a4, 0xbc5c19fd, 0x8178422f, 0x2b1b1c4e,
+0x7260eea5, 0x815d0666, 0xa81b5713, 0xd16966b6, 0x6a2b38fb, 0xedb7af62, 0x1c4291c9, 0x344df3c4,
+0x76b00f5c, 0xdfde72db, 0x49b974d1, 0xe1c427fd, 0x119899ff, 0xe19ef236, 0xb29ed77e, 0xcfbe3574,
+0x5fb6601d, 0x4b01e2fa, 0xe672e5eb, 0xec2e1ddd, 0x7f4ce14e, 0x277b5543, 0x0cc6c1cd, 0x35207407,
+0xf581c04d, 0xf3911008, 0x1acce490, 0x7a2da390, 0xb2675739, 0xa6f59003, 0x5cdabfba, 0xea345736,
+0xf3855b42, 0xa5968e62, 0x7414e30f, 0xbf8379a7, 0x8e385fe2, 0x5578e2af, 0x7d8df3e4, 0x31baa8e5,
+0x3d5d1bfb, 0xaec1353f, 0x966a3c92, 0x3e470876, 0x2917ed68, 0x87080d6a, 0xa31b0f0c, 0x7f15205f,
+0x4a8f14ea, 0xaff808f8, 0x019ee1c4, 0xe15a3115, 0x34d00540, 0x820aef7e, 0xa77de257, 0xf4ae8ae3,
+0x20970e8e, 0xe7936af0, 0x8ca57d87, 0x274f72fe, 0xc6b737ad, 0xe90868e6, 0x83efc09e, 0x29edd24b,
+0x5c0c052b, 0x5fd00de7, 0x06bc61bc, 0x1b8cc48d, 0x4d44fe33, 0x5575407d, 0x1f81e81d, 0x62830c48,
+0xc901f0a8, 0xf996afa9, 0x54437c46, 0x61b851c2, 0xa4be2f55, 0xe4af1f09, 0x1007b036, 0x6ddc2bac,
+0xa22ab8bc, 0x22b2edc9, 0x5307c0de, 0x95a8bddf, 0x24a49d70, 0x26ac47a5, 0xccd21157, 0x748be14a,
+0xdc903d7f, 0x0fe261af, 0x3aeba7a5, 0x83a5ee5e, 0x44a19c9d, 0x7b5cb38c, 0x983741ea, 0xdd630d75,
+0x94ff02fb, 0x452f7ad7, 0xad6d63a2, 0x4d123a54, 0xcc48ec5d, 0x77aa559b, 0x059a31a2, 0xf352c2b2,
+0x6079f2c3, 0x6251689b, 0x66ad28ab, 0x045a92cd, 0xfbeee326, 0xa75e1acf, 0xbf0ec9a5, 0xb3ae6c75,
+0x631e787b, 0x527d5cae, 0x9b84fcef, 0x1e586a32, 0x89d3372a, 0x707b8cff, 0xc94583e2, 0xec47990f,
+0xdd80df30, 0x0c1d93ab, 0x7f1c8ebe, 0x658c9498, 0xa352198f, 0x51b2efe6, 0xfae8ca17, 0x895bad0e,
+0x707c66fd, 0x7d94e19d, 0x89b0b675, 0x1ea127f4, 0x40e4a629, 0xb63c89a1, 0x16157440, 0x07f051ad,
+0xb4cadb1b, 0xbf071feb, 0x3d3a286d, 0x8cba496a, 0x35031946, 0xd0908645, 0xa63893b5, 0x83f7dcb6,
+0xcd646355, 0x5a0098e5, 0x804dea3e, 0x5b68d32a, 0xe26f1b2f, 0x04afea8f, 0x9810a92c, 0xf9e830ea,
+0x6023ea6f, 0x4e24abc8, 0xe13f73b6, 0xb253b55b, 0xbb4d8c3b, 0xa1fc6529, 0x1cc16b79, 0x3e4e97c2,
+0x151e3bee, 0xb0b723fb, 0xa1d25067, 0x235766a7, 0x6682a381, 0x7339b658, 0xb1269ab0, 0x83ba2e11,
+0x8822900e, 0xed25e0a1, 0x83500011, 0x3ac7816e, 0xef1bb934, 0xf1f181f7, 0x813f09c1, 0x3062549a,
+0x8a848f2a, 0xbdbfd5dd, 0xb0b4a2da, 0xfe010280, 0xee27c73e, 0xa9e59ac9, 0x1839be41, 0x3e48115b,
+0x8236e038, 0x31acebf3, 0x65e6ca9e, 0xe60827bd, 0x1c769295, 0x78664313, 0x393b746d, 0xc514d330,
+0x745feccf, 0xf744bfde, 0xaec83f36, 0x68bb76e8, 0x8857a5d9, 0x955ee019, 0xdadc352d, 0x6258b61c,
+0x7f3162b9, 0xc8482836, 0x111eef64, 0xd8ad108e, 0x80fd48c5, 0xf55d1692, 0xfcac5450, 0xbfd17400,
+0x5c73ac96, 0xb3623e70, 0xb97a05db, 0x93324d75, 0x4f9b823c, 0xcbbea5f2, 0x895b9f80, 0xe784795b,
+0x33484231, 0x6468c911, 0x25f8c678, 0xfebd9963, 0xe36977c5, 0x29eeb096, 0x425070c2, 0x1d193fb4,
+0xa02c713a, 0xc5a32439, 0x7ccab8a7, 0xa74f2f43, 0x97e03e2b, 0xa9df9c82, 0x133fc0d5, 0x9940fb7b,
+0x385e4f60, 0x88428bfb, 0x79643726, 0x03db0aa8, 0xf6d4e3a5, 0xbd3b6f2e, 0xd24f3149, 0x20c36508,
+0xa52cbaf5, 0x515fbf81, 0x5048a565, 0x36813de9, 0xe15ff330, 0x40fc8d88, 0x7b2ebe5d, 0x54ba589d,
+0xe04722ed, 0x229ba4c6, 0xfe344c90, 0x308a24d6, 0xd70657f8, 0x7246e901, 0xf05c5e25, 0x77b23e02,
+0xe624c583, 0xb0cbd652, 0xc8351b48, 0x58df416a, 0xb36a5a8d, 0x25f40145, 0x0b9861b3, 0x7c4f6970,
+0x2f6c7e65, 0xc5d465eb, 0x4a38d2a2, 0x8732f621, 0xf4c71a36, 0x7920edcd, 0xb6168152, 0x5dbbb680,
+0xcc06d6c1, 0x40d8fd8f, 0x14f232ea, 0x23a42b46, 0xff077d0f, 0x103a835f, 0x96eceb0f, 0xe1a35d87,
+0x4d6c6b31, 0x7e7b4eaa, 0xc00938f0, 0x26d96851, 0x6ac7c02f, 0xd12f4223, 0x043b560d, 0xa8844b9d,
+0xf15b8c47, 0x9bc3ec92, 0x2fcead2a, 0xcdac5d0b, 0x71acf58a, 0xe7d0dc7e, 0x18b8724e, 0x595117ce,
+0x13396946, 0x0e23554d, 0x0f7fd3d1, 0x8a414726, 0xfb55545f, 0xbd4f4ac1, 0x4a0f0314, 0x4e21b01d,
+0xb6a7bfa2, 0x1df47f56, 0xfe337f3b, 0x9d35c666, 0x1edde4e3, 0x5bbc1776, 0xb1048246, 0xcd7fc90d,
+0x86c1c8a0, 0xc660f81e, 0x3dcb73ca, 0xa4b05317, 0xddb4c87e, 0xfc3c8529, 0x98fb46ac, 0x19d85c90,
+0x1f5ea4ea, 0x2b3dc0ef, 0x2566b8db, 0x915b1341, 0xedef8c0e, 0xc1f39458, 0x181b0f42, 0x1d6d0edb,
+0x5f0ba327, 0xc023c2c7, 0xaebd1eb8, 0x4a1f501d, 0xd88f2f8c, 0x841344c0, 0x63876b91, 0xaaa9ba10,
+0x817e0dfd, 0x7cf187f2, 0x018ac8ec, 0x7f5582af, 0x97b21eec, 0x05024214, 0x8a28c641, 0xcb9702ec,
+0x733454e8, 0xcce12e56, 0xc7a34c2e, 0xafa25f51, 0x09c5918b, 0x55aa877c, 0xdc75b2e1, 0x554893f3,
+0x0e6641a9, 0x8cefb7d6, 0xea97d30e, 0xc4a14b08, 0x18ba409b, 0xedd6788b, 0x429d54e2, 0xabf9fc15,
+0x801d79b0, 0x0927883c, 0xdd19f658, 0x95c30cda, 0x1041b752, 0x71e5cce7, 0xf87fd784, 0xcf8987c0,
+0x758f2204, 0xc53ab645, 0x36be3cf7, 0x64147343, 0xf5e381b5, 0x87f25b75, 0x5a5674f3, 0x4c85b2ba,
+0x0b556520, 0xccf2d372, 0x74577cff, 0xd80c3b15, 0x1b8f4c93, 0x44875781, 0xc1999a74, 0xf7bdca58,
+0x49d92d5e, 0xdcebe278, 0x36e14e25, 0x6a7637d5, 0xc77addcc, 0x040d017e, 0x2d4b023e, 0xc18bf4dc,
+0x9ddcfc5c, 0x58916407, 0xad6de074, 0x8957f6c8, 0x479f0edb, 0x3cd589dc, 0x07fa22e9, 0x559c3ac4,
+0xfffc7352, 0x029c85cf, 0xf4fffa1e, 0x5d48d9fb, 0x512107df, 0x4551a9d7, 0xdf6ecb8e, 0x0a59c951,
+0xdb1cfe74, 0x5806a944, 0x9e4d3cac, 0x2edae438, 0x948c5a59, 0xcf66c03c, 0x91405c32, 0x095a2f8a,
+0x1c8135e9, 0xd6905faa, 0xc4050296, 0x5d1d04d5, 0xbb2979d7, 0x73563363, 0x9a443aa6, 0x949bf7f5,
+0xb1f0e2f4, 0xdaa0b0ea, 0xfa3646b4, 0x212930f4, 0xe5428845, 0x91fd9fc0, 0xd1699b38, 0xe8f864c2,
+0x7a576c5f, 0x14b442ec, 0x1760a5be, 0x1185072d, 0xa11b6d2c, 0x7311c298, 0x49dbfac5, 0xfdfda3b7,
+0x181b843a, 0x04b5972f, 0x2e2201c3, 0xfbd9ceef, 0x08d4cd96, 0xeb037558, 0xcfc663a3, 0xc93ee237,
+0x5d16ab3c, 0x0406d649, 0x7a5509e7, 0xe70cc7a5, 0x46923c5e, 0xaf062ce6, 0x98962ac0, 0x73c47748,
+0x1d4a7632, 0x3612e1f1, 0xd3dfea53, 0x20b7aa3f, 0x5eb3f95e, 0x94dab3d8, 0x2a0b2e53, 0xf5b33740,
+0x9aa5a87b, 0xc8e074ac, 0xf91ef084, 0xfef4f361, 0x48491e92, 0x9bfabf66, 0x4a297c1a, 0xddd9db51,
+0xf7714a40, 0xbbd68d0d, 0xd23a4748, 0xa53081b0, 0xa950824b, 0x90bcef08, 0x11beda69, 0x224dc658,
+0x00643ed1, 0xcec8484c, 0x59f36e60, 0x47cda628, 0xe5cb95e5, 0x9a7cf8b5, 0x32822a3e, 0x72125dfc,
+0x139269c0, 0xf518eb45, 0x71940491, 0x41dd1151, 0x87eb49e1, 0x236fd08e, 0xaede66ae, 0xbfa037cc,
+0x3fab5641, 0xbb1294de, 0x58818646, 0xd63c09bb, 0x4b131a6d, 0x9419f9c4, 0x122fdb7a, 0xdde8a133,
+0x5c1e79f5, 0x3b2cb296, 0xaa3edc40, 0x18a93769, 0x149068e3, 0x96d8ac40, 0xdd90844d, 0x6a00d925,
+0x79092a60, 0x298fda82, 0xf31d8ac2, 0x57017fae, 0xc69a67c5, 0x63d7cc02, 0x28eae175, 0x9f5fed55,
+0x4199a1b6, 0x23ec0793, 0xba2283f3, 0x36385be7, 0x7a821e53, 0xa42b1ec3, 0xbf7a5b5e, 0x9e190f7d,
+0x5a4187ca, 0x9fc9b4b3, 0xf085e208, 0x4d37de1b, 0x269ead9d, 0xf5d13640, 0xf25f0f24, 0x0df44450,
+0xf73b6e75, 0x2b3c7b84, 0xe7774fc4, 0x69d6a142, 0x1677c63e, 0x2a0bfba3, 0x977f97ca, 0xd23ffb71,
+0x7cb2da58, 0xc49d9ced, 0x6897cd63, 0xd0032dd8, 0x6f8931e9, 0x5db54cbd, 0xc84997f6, 0xed5e9c75,
+0x9abce2d1, 0x801b207d, 0x11778617, 0x19e272fa, 0x597d9e0a, 0x9dddc95f, 0xe01f4ede, 0x31adbb70,
+0xf6d94ac7, 0xeb61a4eb, 0x23db31bd, 0xf4ead5e6, 0x6c013a45, 0x409bd6c6, 0xd776ca3b, 0x13a3278d,
+0x0a8cb1f0, 0x1aad0132, 0xca8f203f, 0xd3f54096, 0xfa603de5, 0x083ea863, 0xa19ede8e, 0x427f9ca7,
+0x16614e6a, 0x5b96dc1a, 0x51ec2543, 0x9dc9fee5, 0xb72c17aa, 0x34c3b64e, 0x36423449, 0xd62d3471,
+0x6173988e, 0x257c9276, 0xe2fd88d2, 0x6bf34424, 0x54376a7b, 0x1fa5f4bb, 0xcfbc4df7, 0xac2fc153,
+0xb9ab1046, 0x657292f7, 0xc457b315, 0xc5a8258c, 0x82688286, 0xf15c9a99, 0xdc647aff, 0x3d9cb19e,
+0x1d288d9b, 0xcbd4f57e, 0x068eff84, 0xb2f0bcff, 0x9517630c, 0x8d900ef9, 0x7f01765f, 0xc4c05266,
+0xbea656b5, 0x7fa29e7d, 0x1136d825, 0xb168fb65, 0xcfd9dbcd, 0x7bd4711a, 0x05585149, 0x8adb1a91,
+0x843f0b61, 0xcd2bab30, 0x854959ee, 0x402bb88d, 0xd99aab9b, 0xffa772e3, 0x4027d3a1, 0xcbecb315,
+0x5c4829f4, 0xdbf49e7f, 0x930d4e50, 0xa581e405, 0x4a4ecdb7, 0xbe33474d, 0x16532105, 0x4f07db5b,
+0x668a67d2, 0x9c0b48f3, 0xe4d209de, 0x48b5555c, 0x37c9efdc, 0xe84c71d1, 0x59dd0c28, 0x9965690e,
+0xd7725fb1, 0x484ade09, 0xa1193d06, 0x8142c1e8, 0x7d98fbad, 0x3780c8b7, 0xf278ef19, 0x76c68b4f,
+0x55102634, 0xf9ccd433, 0xf76048e7, 0x0f91e266, 0x72bd4374, 0x367a801a, 0xe06c6504, 0x0e423d01,
+0xc433a801, 0x5096caba, 0x1f6f1f10, 0xa052df85, 0x13de475f, 0xd1ed6388, 0x4917a88d, 0x868e7444,
+0xc09d2ce9, 0xd2202e51, 0x6ab8c2b2, 0x33b78c75, 0xed9f0e67, 0x1e6c1070, 0x58055e91, 0x53ec6812,
+0x49ea8f65, 0x935334eb, 0x6ee5d456, 0x027b369e, 0xd7987c92, 0xa37af483, 0xdd6c7fe1, 0xac46ef27,
+0x45fb01cd, 0x8cbb6c77, 0x03200efa, 0xb6858079, 0xcdf77fa6, 0x35d15166, 0x174c2c51, 0xfa7cddd2,
+0xa58f67c8, 0x971cfb6e, 0x76fcaa45, 0xd2627639, 0x0c514d34, 0xc2e0df49, 0x08227756, 0x11d83b0f,
+0x8ede6a62, 0x01077605, 0x4d0693dc, 0x39002295, 0xa0435c2b, 0x0c287667, 0x789dfd9c, 0xddf9b6d5,
+0x2b8ec1a4, 0x6540a4d2, 0xc94adef6, 0xa0c32239, 0x03c881a9, 0xe072faef, 0xe5286b31, 0x9252c82e,
+0xc793bd2f, 0xb0759397, 0x8fa7cba7, 0xd6457e8c, 0xd4f92a70, 0xfe55fde6, 0x795c1198, 0x5aa4b8d9,
+0x69c01ce8, 0x9ce26be6, 0x66aa4c90, 0x939ddbf4, 0xd83f8446, 0x32cd5896, 0xc1e56020, 0xf53ba633,
+0x071e02b5, 0x477659cc, 0xb1f095ca, 0xe405d981, 0x8f4a7c36, 0xdf5af3bb, 0x8f196533, 0xab949098,
+0x17110782, 0xb1e1c9cb, 0x2a1bb785, 0xdf0fcad7, 0x19996ea9, 0x76df052f, 0x2c9771e3, 0xc18a6846,
+0x0c65a52b, 0x9a93d7aa, 0xfcbfcf00, 0xfad99f83, 0x2abfd889, 0x62c40280, 0x005c028d, 0x472b997d,
+0xb2677a11, 0x01de466b, 0x3f2df4b6, 0xa9efa867, 0xa1d9287b, 0x4e9aa7d4, 0x172a3ab7, 0xa1997e4d,
+0x6c5a4c56, 0x66a95c78, 0x84156d88, 0xa572ccc2, 0x9ab97777, 0x6105e0b9, 0x4df0b15c, 0x9788cc29,
+0x66514f10, 0x4e30558c, 0x8e733cd6, 0x842760f5, 0x559c30d5, 0xdc95b2d8, 0xdbae163c, 0x5f19c251,
+0xac606ff7, 0x52daa417, 0x7f902f10, 0xbbe4b183, 0x57785bc3, 0x5987dd66, 0x99255e46, 0xf150658b,
+0x3033cc2a, 0x592ab8b7, 0x5f6e707e, 0xd1ddfa9e, 0xa45cd462, 0xe6489e26, 0xca55a06c, 0x4d5c71ea,
+0x4aa55d71, 0x0a24feb4, 0x3eea2fec, 0x50a978b5, 0xa61f8c27, 0x78a6f84b, 0x832b94d3, 0x40aa168c,
+0x7dc886b9, 0x3087caed, 0x3251ff31, 0xf1310a5b, 0xaf1cbe91, 0x765d2c0c, 0x93106316, 0x46f640fe,
+0x9869cc07, 0x760cc955, 0x9de120c9, 0xa86eb0e8, 0xc759e85c, 0x554d82d0, 0x21df0327, 0x34123e0c,
+0xd243e840, 0x32f0f044, 0xcba0fca5, 0x0b1381ae, 0xa03b8e22, 0xdec4117d, 0x96433a79, 0x3b73693a,
+0x74b3e3c5, 0xddf39acc, 0xf2a22639, 0xf2df9e0d, 0x0e6d10a9, 0x2c40d38a, 0xf226f4a1, 0xde87fc0a,
+0xb21a085e, 0x7e227f6d, 0xf2e60f38, 0x3eda9716, 0x1afdd4b4, 0x42c5fce3, 0x28727c95, 0x8c1fc6d6,
+0x364b2c89, 0xe0137482, 0x4ac72ebb, 0x48d8df4f, 0xc7ceb9fe, 0xe39eee90, 0xe7740554, 0x6d2369f1,
+0x97a6d50f, 0x481d6e36, 0xb7e04fdd, 0x32cfeddd, 0xc4d0ed26, 0x5246f89a, 0x47f08593, 0x493007dc,
+0xc3ba31d9, 0xe5e78edf, 0xaff18c41, 0xc40d5821, 0x3d35683d, 0x0ea1322d, 0xe172bfd0, 0x7b06468e,
+0x7a625685, 0x124e8296, 0x6c49da5e, 0xd04b5269, 0xe53f3d02, 0xab854f0d, 0x72512c9b, 0xad62dacf,
+0xc7bea192, 0x19c7f0ec, 0x9354cf38, 0xb786157f, 0x017c0192, 0x6b6ee48f, 0x39bad067, 0xb3d5b80b,
+0xc77888dd, 0xe4e48e7b, 0xa9b996b7, 0xccf28f1c, 0x35f28b7e, 0xb02f3bb0, 0x8c979d6c, 0x151f9cd9,
+0xb2d09833, 0xdc715b4e, 0x1ec864ed, 0x448d4bd4, 0xacccf2f3, 0x92020b0b, 0x90954d1e, 0x6dc704db,
+0xf8b87abe, 0xde91de07, 0xa030e9db, 0x3ab16581, 0x699d0ffe, 0x299eef93, 0xbffe0033, 0xf5d88cd5,
+0x71a60b82, 0xdd502485, 0x924686c2, 0x189216fe, 0x234ce451, 0xa1670c8b, 0x901dfd3c, 0xe32fea80,
+0xc1fa880e, 0x95eafb02, 0xd8ecb1a6, 0xc1b9a6f4, 0x74be4d2b, 0x13d0c91e, 0x877f66cf, 0x70650d13,
+0xd9028826, 0x6cff996c, 0xbd1a4530, 0xa0a96a6f, 0x0079b94f, 0x22e31a93, 0x35477a91, 0xbc173bd4,
+0xb3378428, 0xa975cffe, 0x81db2b64, 0x369ac6f3, 0xb1ca6503, 0x4169064d, 0xeea163ee, 0xb963ec66,
+0x5a7d2992, 0x199f009b, 0x8883c27a, 0x8862d6dc, 0xf9c25ab5, 0x7fcd696d, 0xe8e5c632, 0x5ca44740,
+0x4fe5eabc, 0x5b44bcaa, 0x76b7de71, 0x381eec39, 0x8aa57724, 0xacf86272, 0xe1eedd12, 0x6eb84604,
+0x6df6f041, 0x2e6f637a, 0x568f1dc6, 0xa2e1495d, 0xbf0a2e3e, 0xc97b2e41, 0xe904e14c, 0x502eb027,
+0x6852a350, 0x19e60e95, 0x51bbd6ad, 0x569a685a, 0x64680e1a, 0x6d32a9bc, 0xbb509f8c, 0xaec42bae,
+0x8a101773, 0x21b99a93, 0xd59011db, 0xa30249f3, 0xeb1ac94a, 0xcb457fb3, 0x658b58c9, 0x1149b336,
+0xd9b0ee3c, 0x5a305af1, 0xeceb5b7b, 0x2226b284, 0x4c73d0c3, 0x3a94d3ce, 0x4599f783, 0x7d6f9152,
+0x8ec2e622, 0x486fed19, 0xee50f510, 0xb9a1a7b7, 0x454c5ccd, 0xb734ae65, 0x27297233, 0xe6667965,
+0x18fb04b1, 0xaba41004, 0x82fecc8f, 0xfb1d0491, 0x90f5978e, 0xdcdf54ba, 0x3ec1be7b, 0x7cc16774,
+0x3af181e0, 0xf434ec16, 0xf6e1262d, 0xe701a7e9, 0x45921406, 0x4f8f4a61, 0x4b49dc88, 0x35293bb8,
+0x343a880e, 0x84a8a250, 0x05d1a204, 0xf7643c2a, 0x07464a2a, 0xd0c169f2, 0x1417e356, 0xc65e0235,
+0x2b752d57, 0x0cac0224, 0xc1d181b3, 0xc238252e, 0x0f39be31, 0x3255961c, 0x1fb417b6, 0x86b513f6,
+0x70fc0970, 0x01bf77e7, 0xf30717bf, 0xf2d40062, 0x34ac7c40, 0x24ac16fb, 0x6d93ce80, 0xfedc58ae,
+0x45aad2ee, 0xab77f41a, 0x3d7fc154, 0xe9f433da, 0x88f5601d, 0x6634253d, 0x853ced87, 0x0c7970f0,
+0xa707af5f, 0x2f2ea065, 0x28a3eeab, 0x05d2c9be, 0xdafe4dc9, 0x4c4564b3, 0xfe40a57e, 0x87201630,
+0xf4597342, 0xec7a66f8, 0x18751ca2, 0xbbf4a89e, 0x54eeba08, 0x5111bb2c, 0x5eb931b5, 0xa18d910a,
+0x6676657d, 0x59b25373, 0xec8120e4, 0x78f2ecf0, 0xbfe13273, 0x68120cf0, 0xc88ade76, 0x3f7ab4bb,
+0x0e2387e2, 0xb18b677e, 0x6719eb26, 0x271c0826, 0x5d6a04c8, 0xf1f2c3e5, 0x1ea0c781, 0xc8832dc1,
+0xd827c702, 0x078bf317, 0x263f16a8, 0xfad2d887, 0xdddf9212, 0xc03731f4, 0x41a47af1, 0xeaa5bf30,
+0xa4e101f9, 0xe2fcb6e3, 0xef3b11ab, 0x8e95480a, 0xd8a746e7, 0x9641270e, 0xd94ac667, 0x1e2fcc6e,
+0xce27f0a6, 0x47043e75, 0x0bd46362, 0x9f13ef57, 0x9efc4ca5, 0xbded0e35, 0x948869f3, 0xde802ab5,
+0xb0cf7ef7, 0x29de89c1, 0x58448faa, 0x13a3417f, 0x5fedb263, 0xb4c89d7a, 0x14ef2576, 0xed21a460,
+0x58dd447f, 0x53ba5166, 0xeec65ea4, 0xff19692f, 0x442aeceb, 0x021a2f28, 0x022f278d, 0xaeb82ed5,
+0x7fc40cfe, 0xfc445690, 0xffce246b, 0x9a3ea761, 0x9b68328b, 0xc447c51e, 0x40c2d96d, 0xf3e85390,
+0x80bc65af, 0x1e71cd49, 0xf2a01aab, 0x1b253584, 0xa3fcfa21, 0x92980769, 0x87b4634c, 0x4e53b761,
+0x1e7a771b, 0x1706c0ff, 0x4f4f6acf, 0x50c3cc9f, 0x10b981d9, 0x2a55b314, 0x15dac111, 0x15a056a9,
+0x3e37dab8, 0x31f93d30, 0x8d3dee0c, 0xd86c2cba, 0x3ab4afb6, 0x69ff517f, 0xe193630e, 0x35bfa7a5,
+0x23532dae, 0x92328095, 0xd2d0bf55, 0x1022eb09, 0xa99046b5, 0x379fc636, 0x1147ce38, 0x175d23dc,
+0xcd74a53c, 0x9610005d, 0x1460b6a9, 0x3adec55f, 0xfc410198, 0x9f38b6c7, 0x0f4f8879, 0xb92cc75f,
+0x068ab224, 0x12a7602e, 0x8f3529ff, 0x1aa4cba3, 0x7eacfbee, 0xd46b9e7e, 0xb61446f9, 0xfdd0cb49,
+0xa616e925, 0xdc74bc67, 0xd0557c0e, 0xb72df853, 0xc02b8a8f, 0xe6c4f704, 0x7229c5d2, 0x47faf983,
+0x4f4617d7, 0x6ecdc6e1, 0x572951c8, 0x7f5e154c, 0x1ca045b4, 0xe94c0a0d, 0xf06b3b9d, 0xc0996085,
+0x88c32dcf, 0x0aa43e8d, 0x26ac682f, 0xf6f777b8, 0xf03f0bcc, 0xfeee7b10, 0x97c3c504, 0x4467f80f,
+0xa47ceb82, 0x5281e1ce, 0x4af93c49, 0x20274ebc, 0x757e4cb5, 0x33ca3747, 0xb235fcc1, 0x5ab80583,
+0xe8620a7e, 0x8e2ca94e, 0xf412a366, 0x826df86a, 0x087c3fde, 0x9c012e9f, 0x5b941f46, 0xdd6b791e,
+0x7d56c82a, 0x51a291c7, 0xdbb35769, 0xeffb2f9f, 0xce50d179, 0x9dd16496, 0xc133c69a, 0x4503dc59,
+0xe0d734d3, 0x0e9ce6ea, 0x58c01cae, 0x51439d25, 0xadaa46a9, 0x3d3b3f4c, 0x682aa1cb, 0xafb2ad30,
+0x40d677ee, 0x8df78364, 0x4a44e1a8, 0x8355d3f8, 0xc3e7f0c4, 0xb12504e6, 0xe6c97091, 0x848141cb,
+0x58ad2a62, 0x96d14cb1, 0xd23a7f2b, 0x0429e769, 0x71d33728, 0xf3c7501c, 0xb78ef3e4, 0x40d508c0,
+0x59ea210c, 0x930e541b, 0x92f0bc03, 0x73b5b18d, 0xd150caa4, 0xe202edbe, 0xefc133c5, 0x1e32772a,
+0x42735269, 0x210fb4f1, 0x9f5cd3bf, 0xb67f0bb1, 0x73d8bef1, 0x8b601c6a, 0x789b964f, 0x25991711,
+0x86b2dd8a, 0xf1840525, 0xf4d58ce7, 0x04b5de46, 0x92b3c94c, 0x9759b713, 0xdbaadc38, 0x98cce4d5,
+0x5356e227, 0x07e460d3, 0xa0e67e42, 0x544925fd, 0x058f6de1, 0x9c7960dc, 0xd4da7425, 0x2a10ce0c,
+0x21f76736, 0x9ac0901d, 0x31c10e8b, 0xc8a85f15, 0x44b21872, 0xd9c52ee7, 0xa256c103, 0x60d3937f,
+0xbcfe4a7f, 0xe98812ea, 0xfd678bfc, 0x66fb8387, 0x8b93caf0, 0x37f4cb60, 0x1b16a977, 0x7330d534,
+0xa22bfc0f, 0xa5904ddf, 0xc5f5eed5, 0x69d25848, 0x5b640b65, 0x4e2edd80, 0xb8c96e17, 0xe4831dd5,
+0x98db3c53, 0x4cc62871, 0xc79772a8, 0xf1f55678, 0x7ae2115e, 0x0c560552, 0xa9ccf9bf, 0x74d74e7f,
+0xc6eec006, 0x2f4273fb, 0x8a81c910, 0x8e6cfdca, 0x82feb368, 0x2cddb635, 0x70051c65, 0xed99ad3b,
+0x2205ebdc, 0x7e9d6861, 0x427e44d0, 0xdc95d35a, 0x723cd9ad, 0x167a2dae, 0x4c5cda40, 0x7128dd3b,
+0xe84da9e9, 0x9c204997, 0x6c167ec3, 0x044eb65b, 0x1803bc7f, 0x766883f8, 0x3d74b4b0, 0x3bd0501c,
+0x98d65408, 0xa7fe2866, 0xc0162ed2, 0xc16e1075, 0x7ed20ea3, 0x359842eb, 0x279cda89, 0xb1546931,
+0xccecabee, 0x35e79927, 0xba890c11, 0x1fefc11b, 0x87d3a3a6, 0x33b331b8, 0xf95e9ee5, 0x1ba74676,
+0x6d1fa536, 0x8b3ea9b1, 0x65
+
+output0 =
+0xf690942a, 0x97bdb1e4, 0x09424ccd, 0x889e9e34, 0x31ab42d9, 0x64f6e870, 0x4d40bec9, 0xbe1ef1be,
+0x16931279, 0xf20b7fd3, 0x95c573f4, 0x31ffbe30, 0x688da438, 0x6b6007eb, 0x5a260e45, 0x7f7aa70c,
+0x763ef9a8, 0x88d7462d, 0xe5ff459f, 0x569aedd3, 0x2c6bdb69, 0x760ec5ca, 0xbf62878e, 0x387ed56f,
+0xe0684b83, 0x4349ffdd, 0x174aebb5, 0xf7b2f234, 0xd99a61bf, 0xc7545637, 0x2d7dd337, 0xdae6fc0e,
+0x6effdb34, 0xbc20c2ef, 0x2e798268, 0x3fb85d13, 0xbd3edc92, 0x3dc41751, 0xbfad303d, 0xc8e5456f,
+0xf4dda60d, 0x17e88c3d, 0x3ad6d451, 0xe4ce2e70, 0x0207a59e, 0x8d602dc7, 0x7844b2a2, 0xd6060ade,
+0xff66a3c0, 0x0d2084e7, 0x7ff2e162, 0xe8aa2801, 0x40330fa5, 0x1f0ee92a, 0xfe1bba67, 0xb3f26ba0,
+0x5118bcf4, 0xcc5e5a6b, 0x39bc7fe6, 0xe182aa52, 0x46afcfb1, 0xd3f7fb9b, 0x9fb3d086, 0xc4dc5a3c,
+0x77f8a14c, 0x6ef18e9a, 0x116463b6, 0x231f9692, 0x5486e22e, 0x17d8207f, 0xfb7583d0, 0x5ccb33de,
+0x0917da21, 0xe6df15b0, 0x6c6ed483, 0x97b89955, 0xde4703cf, 0x7dd81d04, 0x52e2d139, 0x3103974e,
+0xda6d46cf, 0x6a5b757b, 0x93bf2f42, 0x52cc52d5, 0x6914b439, 0xf82d4b98, 0x729f24fe, 0xa2abd634,
+0x38e342f6, 0x35451eab, 0xa956000b, 0xa8c79693, 0x19fa68d1, 0x80d52a87, 0x765f6246, 0x3a006cd7,
+0x8e19ab7f, 0xe02c37bb, 0x93ddd723, 0x0821fd01, 0xa068c39f, 0xbd40070e, 0xbd48ccbb, 0xfac0c066,
+0x5a066d82, 0xa86c8e00, 0x219aa8bb, 0x175d5495, 0x13767c65, 0xbf9ace5e, 0x570e9b3f, 0x09993d78,
+0xb8aa41f6, 0xaabf8b95, 0x1f5ccb78, 0x96915f8a, 0x018539c6, 0x7e6f09f6, 0x18f6acff, 0x7c185595,
+0xafbcf3fe, 0xf05eb9e7, 0x97c38881, 0x16abb79c, 0x09d035f5, 0x2d00c99f, 0x90e3154d, 0x451204f1,
+0x4caf2a85, 0x0acc10d9, 0xc4ffc5aa, 0xa847977c, 0xa236d10f, 0x16485325, 0x62d1230f, 0x2d8e2b45,
+0x86c78e24, 0xd5bfd27a, 0x4c64f6ee, 0x0602d6ef, 0xe075a9ea, 0x3509eae5, 0xb6ba837a, 0xa2052483,
+0x25e1a262, 0xff2abb89, 0xf7c9c91e, 0xb1fd3b41, 0x462406d8, 0xfc058416, 0x1c40d32b, 0x6e6aadb0,
+0x1324d11d, 0xbad5e44e, 0xb7049b55, 0xe0d70a43, 0xca08027c, 0x598a58b4, 0x14c74fa5, 0x98db9187,
+0xb910b813, 0xd903f18d, 0x12b2799a, 0x376da769, 0xc672807c, 0xa582679f, 0x494491ab, 0x5bed475d,
+0x32ac9126, 0xcbc77408, 0x909eb968, 0xd05ff8fb, 0xa5d46934, 0xe2930b07, 0x19127406, 0xa56d8591,
+0xc12f6abf, 0x3d58da57, 0x779ac440, 0x162a5701, 0xfbdb62c0, 0x153eaed0, 0x55d496aa, 0xd8dc8faf,
+0xa2f82af4, 0x160cbf11, 0xed7587d6, 0x9a5219df, 0x6bc11e7a, 0xb2ee98b4, 0x18a14f0c, 0x291c9cf8,
+0xcf84be87, 0x7bd37549, 0x513df1bb, 0x50b889cc, 0xb5304496, 0xb5f3a45a, 0x492de2dd, 0xe0c9fb57,
+0x4cf7be64, 0x58299e5e, 0x36b89425, 0x186d63ed, 0xacfc9181, 0x84ebf56d, 0xe200dae3, 0x3a430131,
+0xbe4f2b77, 0x32189609, 0x86c6a14e, 0xcc654220, 0x284877a5, 0xe0263e71, 0x96cdf8b2, 0xd194071e,
+0x9dff2560, 0x8fd65d33, 0x8f75043d, 0xa3936859, 0x16f2129d, 0x41b86611, 0x23ed2400, 0x05bc4e6a,
+0x7924908e, 0x3240c348, 0x1463ab1d, 0x10a4176d, 0xb688d5c5, 0xfd76b8c5, 0x595a4e41, 0xc02367e6,
+0x6cbe2b22, 0xb23cfa6b, 0x3e284a7a, 0xd4992177, 0xc93ec5bb, 0xdaaeaf1b, 0x7b2b69f1, 0x2d1e27fb,
+0xafc83a71, 0x553b31d0, 0x9f9408a4, 0xb2b1047b, 0xf0bfd411, 0x20af5a39, 0x6b09a021, 0xf79943db,
+0x45f001e3, 0xba39d592, 0xda038c55, 0x658f1f65, 0x3b27c92c, 0x3765469c, 0x1d97c758, 0x365aa095,
+0x9f0bdeff, 0x68692433, 0x267cda88, 0x4eb34d37, 0x2ef7e1da, 0x99c65582, 0x034e0e56, 0x81175ff1,
+0xb3af3ae7, 0x8d8bff1d, 0x9d0b7eae, 0x63aeca43, 0xa5296fcc, 0xcf4311eb, 0x6f633120, 0x192bbf00,
+0xc42d2db5, 0x96e5e39e, 0x9a058c61, 0xbb363125, 0x32821f9f, 0xa3f9812e, 0x1412008b, 0x332c02f2,
+0x53710e69, 0x56039aa1, 0x36aacf24, 0x22a2888c, 0x841d7bca, 0x9582ecd9, 0x51d9079c, 0x17b5ac6f,
+0x58a77687, 0x1628fc67, 0x9f080c5d, 0x25b0dcaa, 0x86af6889, 0x49441a16, 0x1b90bbe0, 0x12720d9b,
+0x337dbcff, 0x7fe6fef4, 0xb6ad124f, 0x38817314, 0xdb75030a, 0xa6021928, 0xfad32be9, 0x5f42075f,
+0xb93bde63, 0x169e7138, 0x2c9e081d, 0x14f7632a, 0x867dc112, 0x82ac4eb4, 0xbf8881cd, 0x7123001f,
+0x00a79cdb, 0xf2b37725, 0x4fe3f649, 0xf91ab3de, 0x594b21b8, 0x824b9dd7, 0x86f4c8e7, 0xbb843bc6,
+0x6c9fcac9, 0xeb8aa526, 0x05158637, 0x6dc5c8f3, 0x76600664, 0x508ead2d, 0x40e5e256, 0xdf7958f0,
+0x5747cfe2, 0x3877ffdc, 0x11f9d3b0, 0xa2550567, 0xc391129f, 0x4fc5fbbb, 0x9098626c, 0x17435e96,
+0x3e46ced4, 0xd10b829c, 0x569cd35c, 0x22cd04d9, 0x6c83e3bc, 0x3af817ba, 0xf931cb4f, 0xff612783,
+0x304ad058, 0x5f8daaed, 0x6ccbe124, 0x80fff3fe, 0x51fa21c4, 0x1d267d3c, 0xa02b8b84, 0x120bf3dd,
+0x53fc63be, 0x0e70dc18, 0xbe80d86d, 0xf3a2b3b1, 0x09579c67, 0x0eb7d831, 0x4e794d7a, 0x5314ff3a,
+0x97e51a2e, 0xf7f8e20c, 0x49baaa2d, 0xd8bc6420, 0x219364ba, 0x05d999d5, 0x6464ca46, 0x7d79fd03,
+0x4246a824, 0x81114cb4, 0xec729683, 0x68fa6517, 0x413542e6, 0x55fddafa, 0x0a0c88df, 0x8f81ef0b,
+0x897cf998, 0x37d3bd4e, 0x67c62c51, 0x99640163, 0x45372886, 0x7e923097, 0xc5389a43, 0xdb91a6a5,
+0xbeff35f2, 0x0c0eaf69, 0x0ad80229, 0x9310a6e5, 0x3e4dfc82, 0xb644f4df, 0x89d69826, 0x3c9dc18a,
+0x40d5aaec, 0x0746bdb0, 0xeefe5ef1, 0x30d23508, 0x981f9492, 0x8627eca9, 0xf0f3020f, 0xd9459ce6,
+0x102d297a, 0xe4eafbac, 0x0946a3c7, 0xfda640be, 0x937bd23c, 0x93cebb29, 0xc598ee7d, 0x8628c20c,
+0x6c8251c1, 0x0116c27b, 0x7adc872c, 0x779ce9de, 0x2832df36, 0x275e9f9e, 0x66ade6ef, 0x8436ee17,
+0xfb06b3d2, 0x014f9a31, 0x92a97678, 0x90ff14b8, 0xca578ca7, 0xf44299fa, 0xbcf6e11a, 0x2a97c505,
+0x4779346a, 0x3ca14066, 0x38c64d73, 0xdb599cab, 0xa2ad0720, 0x344dbeaf, 0xc004aa65, 0xa1756fa3,
+0xf54aa477, 0x12783a97, 0xb13ad2bb, 0x86185384, 0x96dffd80, 0xdcdcc58a, 0xf56a80f2, 0xb32170c4,
+0x7f613497, 0x871f7382, 0xd79f6a9b, 0xfa444729, 0x7e0ced9e, 0xa71e7978, 0x4adebd54, 0x53043dbb,
+0x11850000, 0xcbf20157, 0x0298346f, 0x4b968944, 0xe23eb1a7, 0xd6af0010, 0x5d456aba, 0x558c9210,
+0x70820458, 0x71e61ea0, 0xcf112929, 0x0e8c5bcb, 0xe577c26e, 0xf3a32fae, 0x74cbf9a7, 0x70bf8761,
+0x3010f7af, 0xbfb34732, 0xb327c739, 0x2d46ed0a, 0xf3fce891, 0x87f5e409, 0x3b1ffce7, 0x20efaf5e,
+0x1d6889f3, 0x037e9aa6, 0x9746c14c, 0x40cadc87, 0x9dc2da7a, 0xe9964b84, 0x9e28b792, 0x5ae6c4a4,
+0x45a27fd6, 0x7dc5f8ef, 0xc02b338e, 0x600cde92, 0x1cdd7b6e, 0x46e48e4c, 0x5df1ed0e, 0x7d0e13a5,
+0xe204910a, 0x5da27a6a, 0xae2c1dba, 0x4a53a8ca, 0x4f7934bb, 0x74f9df33, 0xb2eaef55, 0x06f4f544,
+0x167f9df0, 0x7074d5d0, 0x51c3cf7a, 0xec879c3c, 0x164a95ef, 0x47bfac95, 0x7a4ef159, 0x8de27e54,
+0x1cfb6a00, 0x860390a4, 0x3c0de75e, 0xf5876182, 0xed03beaf, 0xe8ad8bb3, 0x80259434, 0x08550962,
+0x885c3017, 0x460d88d3, 0xd1ea8f87, 0xef4a44da, 0x9178d2d2, 0xa3a4536b, 0x46fb423d, 0x094f70a8,
+0x7399f93d, 0x0bc9feed, 0x840cb076, 0x6096ae96, 0x126fec3e, 0x133bc8cd, 0x77f07640, 0xc516a5fb,
+0x81ce644e, 0xb2b20edf, 0xa785f0e1, 0xc14ba294, 0x9194f8d0, 0x73b5c5df, 0x64d93999, 0x64770c87,
+0x5af360b0, 0xa3469227, 0xb2881e32, 0x3fc1a290, 0x1c7f51dc, 0xc4499532, 0xb0652a33, 0xfce6cc52,
+0x033333d5, 0xbf7ef720, 0x4616a008, 0x744e151c, 0x0d2210ae, 0xe3171000, 0x7df8f60e, 0x9cdccf61,
+0x96126efc, 0xa2a5dafa, 0x1e8304c2, 0x2abc4565, 0x8e4185de, 0xebfc7078, 0x6bdfbd6a, 0x5d756c1f,
+0x42d2f01f, 0xb09c40fd, 0xaa424f36, 0x5a2f890b, 0xc85aea2e, 0x95b3ede1, 0x42866f91, 0xdd21f7f0,
+0xc5c7cb28, 0xe46a2f45, 0x28f5c77c, 0xab978ab4, 0x673c60f5, 0xa76194c7, 0x6d6e94c9, 0x464967f2,
+0x0dc5fa90, 0x423e253b, 0x9521126d, 0xce4e612c, 0x217250f8, 0x8fd10eef, 0x27cbcf40, 0x66c5f77a,
+0x7fdd1428, 0x5a803f25, 0xcc8eb41f, 0xd84df81a, 0x2667c030, 0xc0454e9f, 0x0a540a1c, 0x1e943641,
+0x45f26f1f, 0xd77eb2cb, 0x364010dc, 0xbc84f9c6, 0x5e7b5c70, 0xbb5d23c3, 0xb5a2edf1, 0xa94c7803,
+0xebe419e1, 0xc7a9c777, 0xe4744a65, 0x357b74dc, 0x5a884088, 0x70842a6c, 0xd5a979cc, 0xb2872021,
+0x5d79809c, 0x1ad5cfd0, 0x5c1276d4, 0xd4fad768, 0xd640beb0, 0x2ec4e920, 0xe2bddbcc, 0x7b7ea960,
+0x4f9a3a4c, 0xce57cf51, 0x3068683f, 0x740df2f9, 0x14855fd2, 0x6c1410de, 0x7e20e8dd, 0x35890b59,
+0x316cc694, 0x54203dd1, 0x60d0f75f, 0x55ca0fed, 0x06898039, 0x5e92627e, 0xd2f56f52, 0xf75737a1,
+0x5cebdcee, 0x10d29efc, 0xb76d842c, 0xa32e605f, 0xdecfc2cc, 0xac34b1fc, 0x46f5fc6f, 0xd1591a3d,
+0xd88bb24b, 0x3656986c, 0x26563e0f, 0xfcfad5c1, 0x6d6abe00, 0xc819134c, 0x6abafe6b, 0x7204fd38,
+0xf3207153, 0xbc7b698a, 0x1530c692, 0x70c0be43, 0xb674586d, 0x635b82aa, 0x75b08ee6, 0xaaea74a2,
+0x2501326e, 0x1e8b59bd, 0xb023f492, 0x00aee5f6, 0xbbfc6491, 0x8c42fc95, 0xbb796282, 0x600c2293,
+0xe4cb7406, 0xd4a4c8fa, 0x6e36bd85, 0x9bceb5fe, 0x6e4505e7, 0xecab0fcd, 0x2b1f3ce9, 0xea8a3739,
+0xc911c418, 0xb4f5c575, 0xe5342fdc, 0x2fd88173, 0x6f7a16b3, 0x0bb82572, 0xbbd11789, 0xefcb4899,
+0x4da28124, 0x9ba40d7a, 0xe7d8fa1e, 0xe23a9d68, 0xd7c0effa, 0xcff717b3, 0x6ed89228, 0xdb741b39,
+0x705d6e1f, 0x7bf87de3, 0x4c1de32e, 0x6db3d17a, 0x47893039, 0x22d31a3f, 0xcc725dcc, 0xd9d0d85e,
+0xac80413b, 0xbb661b21, 0x56d9050b, 0x9d007604, 0x312f7541, 0x4a37f702, 0x8b8effbd, 0x7d067750,
+0x9cc28409, 0x8c6bc23d, 0x43306b51, 0xf7317955, 0x3c160c99, 0xb0e3d60f, 0xc23b4f4d, 0xefc1c753,
+0x4c4aff7e, 0xd64a8cbb, 0x868273f9, 0xedbe83c5, 0x8865edba, 0xd2bba474, 0x868133ee, 0xd202a360,
+0xdb88b9c9, 0x6c8281b2, 0xacf3c102, 0xd3253f57, 0xa2894060, 0x79976f39, 0x34eb1a38, 0xae45af9c,
+0xcea1aaa8, 0x1626d035, 0x65622d1d, 0x2f0b2603, 0x0c07e443, 0x55dab61f, 0xb4822c56, 0x056fbb16,
+0x10893d6c, 0x07d9cb6e, 0xbd46cb33, 0x5e275703, 0x53c47a3a, 0x23129ab9, 0x58b75c32, 0x6a3066ed,
+0xf58f62d8, 0xeb32bce3, 0x0d2ad7c4, 0x40293ff1, 0xa4665c62, 0x4b26a80e, 0x69488ee8, 0xe74dc068,
+0x6ee221f4, 0xbdf32463, 0xb7ea30f2, 0x3e75c7aa, 0xa315b315, 0xe71fb414, 0x1317f977, 0x3188f27c,
+0xad075875, 0xb9d1ecbc, 0x8ecad97b, 0xc8926384, 0x6f97e481, 0x09c82916, 0x0694ef16, 0xd2250a4b,
+0x5bf124d3, 0x40d042bb, 0x9c67e10e, 0xc2635f49, 0x8f0cca9a, 0x10d56753, 0x56394fcd, 0x15a3396a,
+0xf0584405, 0xe29f7e61, 0x55e67a53, 0xb225f132, 0xe9b693b1, 0xd23f658d, 0x04084aa9, 0x91437ade,
+0x94c9e2ac, 0x63a81e0b, 0x3fdaeb14, 0xe58bb18f, 0xa608674f, 0xeb08ab8c, 0x266f9e91, 0x20a247c3,
+0x38c47ccb, 0xaac11899, 0x1c20b8cb, 0x2355e513, 0xa3b2d570, 0x40cf8111, 0x0fbac6fc, 0x2ac0dc55,
+0x9b3f2f3c, 0xc3139c54, 0x2d443470, 0x67f68f0d, 0x8830b8a3, 0x9511bdc2, 0x5c44e175, 0x66f79d4d,
+0x64eca6c0, 0xe3499348, 0xdb1e12d0, 0x370f88d6, 0xc3f2791b, 0xb832a3f2, 0x77d0521e, 0xf0036ef3,
+0x95fefc9b, 0x8b3ae29f, 0x4eda39a4, 0x12536897, 0x8ddad95f, 0x7c11cef3, 0xe4154b17, 0xc2e388dd,
+0x5ce5c69b, 0x064221d4, 0xaf1b617d, 0xaf4b7186, 0x53f8f582, 0x816e3f1a, 0x00a306ed, 0x52f6ef17,
+0x68d93236, 0x41173b4d, 0x61c5ffce, 0x4dc0d0be, 0xaca0ff32, 0xe4ff8277, 0x120e826f, 0xd52e262c,
+0x66827d76, 0xda5b1e9f, 0xfee6387b, 0x7005d47b, 0x0b049d56, 0xdcf6a4d7, 0x27ac9663, 0x453c93c0,
+0x2e38e234, 0x7cfe2736, 0xdab7b0b9, 0x00f1d773, 0x99da6b76, 0x5c171181, 0xc810c77d, 0x0e27a276,
+0xd1af39ea, 0x80fec544, 0x2205dc24, 0xdafa47d9, 0xc5e08f2b, 0x0cfdddfa, 0xcb843f9a, 0xa52f186b,
+0x27cd8efb, 0x74924771, 0x21f8a411, 0xda6f830e, 0xb9017c5a, 0x53ebf07d, 0xc50f59b4, 0xb7cca99a,
+0x5fc62c94, 0xe329d696, 0x8f692514, 0x0d83ae14, 0x0b697893, 0x85c69b36, 0xab3d1285, 0xb29d7e78,
+0x406a0fa6, 0x337f4bb0, 0x0c3de707, 0x4c7d71c8, 0xc0332445, 0xf61d16ab, 0x01862b19, 0x8b963de7,
+0xacf7b650, 0xfd8c511f, 0x6356f669, 0x757e29c9, 0x79b7fd6c, 0xabecd50b, 0x10b9fc5e, 0x784c1cb0,
+0x08ab8fa5, 0x1335e4b0, 0x44b75723, 0xa9317f1e, 0x3e1051a9, 0x7be42a04, 0xd9e86ba8, 0x04efc822,
+0xee824d97, 0xb0534b7a, 0x6ed250f1, 0xa38da157, 0x46dd1dd4, 0x73586bb6, 0x5270a77a, 0x31c460ca,
+0xf17a54cb, 0x7cbbc937, 0x19fdada0, 0x65c0e5fd, 0x7520c3be, 0x643560d6, 0x4bdfdf90, 0x1b903707,
+0x1ce06160, 0x5bb8a868, 0xc7f71a7d, 0xb5a092bd, 0x2d7bfd09, 0x610b2a13, 0xae0fef7c, 0xe72c8793,
+0xe7941bf5, 0xff8cccf2, 0x25ff3b32, 0x1a1ec5fb, 0x2886513e, 0xb8c7e05f, 0x16a7d161, 0x7df9727b,
+0xdec3115f, 0xd6b903b5, 0x10d22e00, 0x91f1a899, 0x3249d0c8, 0x4c5bbcda, 0xe692f82a, 0x2b5495e2,
+0xb405f241, 0x116654ee, 0x163c68a0, 0x33699a79, 0x506587a3, 0x0a6ef4d6, 0x68687151, 0x78f844e6,
+0xfcf0747d, 0xfd049f15, 0xce27160b, 0x8a067513, 0xd42c58c1, 0x5c6febbe, 0xbe9ab351, 0xa3cb004c,
+0x7a154bd3, 0xde1d43f2, 0x0757f5ba, 0x9eea9bcb, 0xad99600c, 0x79007225, 0x8b80bbc1, 0xa6494f49,
+0xd19c5576, 0x25169481, 0xb541333a, 0x05b934a6, 0x38089141, 0x35aad753, 0x9451bc05, 0x6fca2e2f,
+0xf7196eda, 0x2b603ccb, 0xe0b57c2d, 0xc1992e60, 0x5ad987e9, 0xcabe9391, 0x19f30b1e, 0xff43d8c5,
+0x77796bef, 0x08c18937, 0x50b39a59, 0x7af3b1c8, 0x0bce4ad0, 0xba0793ed, 0x9a606f19, 0x3f3f84d1,
+0xff96bacb, 0x02cb465b, 0x076070ac, 0x92f23af4, 0x33886f0a, 0xb00bc421, 0x7a6780dd, 0xf3fae0dd,
+0xfecc391c, 0x5d0ae0e1, 0xe834ffb7, 0x0cd74ae7, 0x95d832bf, 0xc7abe74a, 0x1c6bbd11, 0x313a220c,
+0xa79c695f, 0x786b49b1, 0x8314d497, 0x1f2d00e9, 0x480d17ca, 0x7592d08d, 0x0405ad3d, 0xec7431a1,
+0xb617a9b6, 0x0d55c4a8, 0x20f2c4af, 0x2ac7a905, 0xb9822be0, 0x25832c56, 0x99087a83, 0xa994f666,
+0x8e444309, 0x6e4fd02a, 0x7362a6f4, 0x1769d572, 0xf6f68631, 0xe33cd8e7, 0xc1f7b898, 0x4e255ef8,
+0x17e77be1, 0xe5535db2, 0x33cb4054, 0xaee92bc1, 0xc583178e, 0x58602446, 0x520465f8, 0x805b81f8,
+0x5ec51006, 0x122a2bc3, 0xc7456e09, 0x8654b402, 0x1725dabf, 0xda59d4c1, 0xb1630123, 0x202e42cf,
+0x6d03c0c4, 0x58044033, 0xa6ddd488, 0xbfae228a, 0x01914e16, 0x8bc20acd, 0x5e2a9b0d, 0x52aa9362,
+0xc7c9eb45, 0xb5925cd4, 0x7794d4da, 0x74f615b4, 0x455bc62c, 0x139f5871, 0xa8b643ca, 0xebcca0b2,
+0x4b502cd3, 0x1ae6b0f3, 0xf659ed9b, 0x8178a8af, 0x01013584, 0x0affb832, 0x02bc9176, 0x89602571,
+0xbff37bff, 0x4384b1e8, 0x39afafb4, 0x866906f3, 0x308853f9, 0x621d2617, 0xf784d13d, 0x25c0cd96,
+0x8e1546b7, 0x50bf63f5, 0x921f6b7f, 0x4661624c, 0xdfbb727a, 0xe652372c, 0x3b4b2d70, 0x55e1e45e,
+0xffd6c3cb, 0xbf4efe20, 0x041c3e6a, 0x96b9e930, 0x35f89446, 0x1b5c8222, 0x56529132, 0xfe700b4b,
+0x9b5fc3e9, 0x6b9911c3, 0xd8b00e12, 0xac975c76, 0x34f5c77a, 0x9622d735, 0xc2e862a1, 0xa7f352ec,
+0x341a447b, 0x80d4e366, 0xa18a2bf0, 0x4dac1dbd, 0x692b2787, 0x688fde0b, 0xa21b456c, 0xcac5c769,
+0x36547232, 0x0d7e85b8, 0x4cdc3a71, 0xe98ac05e, 0xbe1c2a16, 0xf2459a61, 0x7588ef51, 0xd6c71c73,
+0x873fbd17, 0x78af36ec, 0xe1a62f3f, 0xb9bfc692, 0x06301428, 0x648d8eac, 0xea9d0a91, 0x2dfca974,
+0x3a7cba0d, 0x938bb495, 0x6d176a5e, 0xdc2dd8f7, 0x92516e27, 0x3c361e4e, 0x5391b964, 0xe771760d,
+0xc2ac7307, 0x5118ccef, 0xa7dc0375, 0x201cba41, 0x916a4221, 0x78406994, 0x4bae1997, 0x1e99265f,
+0xec9f9971, 0xdf9a7755, 0xd8a7aada, 0x1f73b436, 0xde150a0f, 0xbbb357f5, 0xb6123aec, 0x29d94822,
+0x20b10220, 0x2ae2de80, 0x029b5aec, 0x408d331f, 0x9c6c75b4, 0x2f6b41cd, 0xb509868c, 0xaadef6c3,
+0x62c19305, 0xd50fd1fc, 0xcf926f1b, 0x11fc719f, 0x91eaebb5, 0xa3543ca4, 0x9168176d, 0x721316bb,
+0xebd56480, 0xeeaf330b, 0x3533453d, 0x893ebe6c, 0xff497844, 0x7342bec3, 0x78c2e6c3, 0x69911944,
+0xde42bfb2, 0xe802e446, 0x5b9e30b8, 0xcb6e8fd9, 0x7ad20299, 0x9499bfe6, 0xc767474f, 0x2306e85c,
+0x89b01dc6, 0xf0fc2d90, 0x2f467c98, 0x4e9f9a5a, 0xd828b94c, 0x6b690eee, 0xda058cea, 0xfa0b0fc2,
+0xccbc7890, 0x786b2507, 0x7d780c14, 0xf21f3f2e, 0x0e70e425, 0xc92bacd8, 0xb744dc1c, 0xe96bb8a1,
+0x7d7d4ba3, 0x5d216901, 0x0beeb8c5, 0x4fdc299f, 0xe4d7a429, 0x71f39835, 0xe9360a14, 0x86698189,
+0xd840ab53, 0xb252de53, 0xba0af67f, 0xa4ad7aac, 0x951c8078, 0xf9730896, 0x3c04bb39, 0xaf37dd22,
+0x49823e8c, 0xc7acdad4, 0xce837484, 0xb4f0b30f, 0xfda69a9d, 0x32b93116, 0xa7ca9609, 0x422a3f5d,
+0x2be869da, 0xc1b92841, 0xe2f70814, 0x3cc3b240, 0xf7a6980a, 0xc0e17c29, 0xd6033290, 0x16e4c508,
+0x5e154612, 0x09ee03eb, 0x2528efd6, 0xe4aac04d, 0xa7d66a68, 0xb4f59c12, 0x828bd31f, 0x0ff3b8c2,
+0xcbcdd28d, 0x416551e3, 0xfb2641ed, 0xf0934461, 0x77403f32, 0x15977dc1, 0x0d45beb6, 0x5e494ec8,
+0x427ae8a7, 0x5f61b4d5, 0x8ddf209e, 0x237cf236, 0xa3a34484, 0x4bb69022, 0xbc690766, 0x76e1c2d0,
+0x54194602, 0xb7572cda, 0xfdb5a8ee, 0x444ba245, 0xaa2c985f, 0xf07deac8, 0x725fd936, 0x5de1fc70,
+0x287649ad, 0x685fbe45, 0x0ed921fb, 0x82ef5e95, 0x1fb9641b, 0x306894b0, 0xdfbffe48, 0x6984f041,
+0xd01f24bb, 0x079400ff, 0x37709e53, 0x48711ac6, 0x4116a686, 0x7d822ae9, 0xd3332c40, 0x30c6be5a,
+0x43d6e44f, 0xb3a4948f, 0x3cf79b5c, 0x3ff0155e, 0x448df55d, 0x7ee00fdd, 0xf456068b, 0x5ef85991,
+0xa2ba3b3b, 0xd03463c0, 0x5306ff03, 0x8f794d50, 0x1cb90bf6, 0x110c823f, 0x7174e8d3, 0xee735d22,
+0xb8fc9f9f, 0xe349b47e, 0xd7b4b715, 0x3d381e23, 0xd6964b5a, 0x1a41b8fa, 0x5ea504e7, 0xb2f0fda9,
+0x8e3a0763, 0xbbae49a3, 0x28501717, 0xbc6aed6d, 0xcaa93fa5, 0x55b8f778, 0xa75416dd, 0x65fcd7ab,
+0xa7149228, 0xbf32883c, 0xbb8d6022, 0xe3b5eb31, 0x5b2cca37, 0x817eee8a, 0xeb6b4abe, 0xff0853c3,
+0x6c7dbda1, 0xf04da9f2, 0x32f0245e, 0x5a45d240, 0xb85baeb8, 0x09619854, 0x2ee82e51, 0x72b412a6,
+0xbf6712f5, 0x9e23ba44, 0xb341502e, 0xdd18e9dd, 0xc3b5a3c8, 0x466e8798, 0x31d4233c, 0x736b1083,
+0xeb960c67, 0xe53cfb48, 0xb4c794d6, 0xb752eff5, 0x6c82a7eb, 0x02a51f58, 0x7f09f694, 0xa449b1b1,
+0x9e54e12f, 0xc679adfa, 0x20995bd5, 0x03aa591f, 0x2a828763, 0x7266d954, 0xdcb0a47e, 0xcbadcfc5,
+0x16abd270, 0xe7e13511, 0x4faf024c, 0xb752db07, 0x0e8e1c9d, 0x7790dc90, 0xae565a6d, 0x65a4452d,
+0x85596c5b, 0x3d167e41, 0xacdca137, 0x6839fd43, 0x84667bf5, 0xee45a3b5, 0xa773c09b, 0xbc074a51,
+0xeb11bc77, 0x8476ac79, 0x15a6edb2, 0xf940d2e5, 0x802debe0, 0x1701def4, 0xff1c3625, 0xff7602b4,
+0x6e8847e8, 0x78c5c9a0, 0xb8818b12, 0x94bea57d, 0x5f6bc1bc, 0xad51e7e0, 0x3b8ee452, 0x2299a03b,
+0xc996313e, 0xd582a0d6, 0x69f1cb04, 0xf7b03037, 0xda6031c3, 0xdaf2c42e, 0x547c1bcb, 0xc85ba742,
+0xf67251c5, 0xac7bd05a, 0x742b2e18, 0x2b1343fe, 0x6407d757, 0x9501e8c7, 0x7b10d9bc, 0x0cf23c43,
+0x13051cfd, 0xd853682f, 0xb99ecea0, 0x70044abc, 0x4b00bc0e, 0x4d151f93, 0x6894f897, 0x37d9e99e,
+0x50bf8d94, 0xbc6419f4, 0xef984161, 0x9a60c3e1, 0xdda8aa61, 0x71a1a989, 0x7aad3274, 0x11a38bb4,
+0x30cfbce5, 0x27d7410f, 0xb866b15b, 0x6efef725, 0xed36eb9c, 0x67b7099f, 0xe42db6f8, 0x30ecad93,
+0x8c0e7426, 0x28acdf9d, 0xe695b151, 0x87eef9a6, 0x0cfba599, 0x91d6bc59, 0xfcef35f6, 0xca78a142,
+0x1f152d70, 0x6929bb33, 0x66567410, 0x04332777, 0x833cb07e, 0x10bd4837, 0xb54dcf4a, 0x383417d9,
+0xabac3628, 0x2c1e4d75, 0x3c55a006, 0x60183f9e, 0xdf3cf8f4, 0xbb4e3cab, 0xdfe0c707, 0xb499b83d,
+0x6a86436e, 0x6fd9f508, 0x3912b7f0, 0x3da741dc, 0xfb909f04, 0x42bfe9a0, 0x86b7e88e, 0x27ee8892,
+0x1dd12a32, 0x7c1e0b6e, 0x389bfa4e, 0x8ae84b3d, 0x94009549, 0x66eecaf1, 0xf9ef1c93, 0xe76e9c63,
+0x393e21cc, 0x31bc2c9e, 0x29201de2, 0x133e6d78, 0x1099415b, 0x27d15bec, 0x28435521, 0xafbb17a5,
+0x2e90d111, 0x15233948, 0x02e2767e, 0x5a18c2f9, 0x4b413b43, 0xd2ef6649, 0x226860cf, 0x5391da82,
+0x1a0c69dd, 0x72bf736a, 0x19ade906, 0xb325f926, 0x4c5edff9, 0x5abe6e2b, 0xf16e2387, 0xc1606a04,
+0xe353f85a, 0x1467c159, 0xa8151d58, 0xa54c33d8, 0x886c197f, 0xca3daf3f, 0x7964f9fe, 0xd9b8189a,
+0xbc73922b, 0x24ac27fe, 0x58c50007, 0xf8509bc1, 0x2467d28d, 0x1f0e44c1, 0xebd7d409, 0xd87ecd16,
+0x75414244, 0xba21372d, 0x1897b692, 0xb8a6831c, 0x579f4de8, 0xc19db76e, 0x0255cc42, 0x82fbe999,
+0xca935c73, 0x548e46ae, 0xa5e685af, 0xcdfb5ef2, 0x8e13b71e, 0xc630de10, 0x6354b0f2, 0xd03d3c96,
+0x1456eb16, 0x6e60ab57, 0x512aa67b, 0x68b3d913, 0x04e2808a, 0xaeabb2f7, 0xb5a7050b, 0x7f7d51c0,
+0xcf0a8ceb, 0x4ac10855, 0x6ce17403, 0x1d678fc7, 0x7fc6a65b, 0x31f83707, 0x42d995d6, 0xd1562de7,
+0x6c8355ab, 0xab0a2e61, 0x4c29b2c7, 0x77b46f73, 0xb87cc1c7, 0xa26857e5, 0x7103f34a, 0x4c0da95b,
+0xccc43b4c, 0x454f6436, 0x9d7fb501, 0xda0efc3b, 0xfdf7ab90, 0x31c14578, 0xbf893cf4, 0x714e6ae0,
+0x3f330f22, 0x58930f8f, 0xbe2b0493, 0xd45b0811, 0xfce1cf51, 0x2235ea01, 0x5f389de8, 0x1d6a8c1f,
+0x207dc635, 0xd9bdecbd, 0xec4f0e8a, 0x8f13e668, 0x0ed66fed, 0x4436a2d1, 0xb1cec1d0, 0x5c6fd3c4,
+0x552fcb59, 0x4bb0c90b, 0x01990769, 0x96f4df07, 0x0b488e99, 0x5dcf02bf, 0x8c223aa5, 0xbec03723,
+0x7bb0b5bc, 0xa36c4723, 0x558e0f65, 0xff88d022, 0x37135241, 0x26c4ded6, 0xb5e96e68, 0xf2071b6b,
+0xcd67fcac, 0x4a8a3130, 0x12d0d41c, 0x4429514f, 0x7e3236d0, 0x947b245a, 0x42f3b830, 0xc02e0787,
+0xbf878531, 0xf531f3d0, 0x3e0cbb94, 0x1df64dc9, 0x2a1206c2, 0x8d21dd6a, 0x374ce54b, 0x9d62fc7f,
+0x0d32940e, 0x9fbccd02, 0x38246063, 0x1560414a, 0xea6ed90f, 0x9fa55e17, 0xfdec9c69, 0xf43ee80f,
+0x067c88df, 0x076c9e72, 0x48360f1f, 0xdd0d2737, 0xd0f245b4, 0x04a50415, 0xd803e008, 0x0c2d713b,
+0x45242861, 0x61c8b578, 0x956c0954, 0x271158c5, 0x2c6289f7, 0x22da4bea, 0x2a34c673, 0xabd0d3a0,
+0x8efd21b5, 0xa80608dd, 0x40fc1f14, 0x123fac2f, 0xfc9d384f, 0xe64a5d6c, 0xb96479e2, 0x0a5f71f9,
+0x5b7f3a24, 0x98462b08, 0xbc9d3670, 0xbf0b09d2, 0xaca9f544, 0x1ffae7c4, 0x8e7bdc9f, 0xbe608661,
+0x279a80da, 0x77f82d66, 0xf7631447, 0xa55cc59d, 0xd6161250, 0x6e5c4acd, 0x981b6ba2, 0xe0c4dbca,
+0x2e9d29ed, 0xa7d51085, 0x89302615, 0x40e7fb38, 0x4b4621ad, 0x8f15702d, 0xeefd4189, 0xc7efc927,
+0xaedf1dc0, 0x0ca723bd, 0x0801de0d, 0x9713c0fe, 0x1181a73e, 0x27e47a37, 0x3a54473d, 0x315f58e5,
+0xd7a349cb, 0x8e5bdc59, 0xe51bc827, 0x9c511861, 0xc020e5fa, 0x9df6d9e7, 0x8280ce46, 0xb4791cc0,
+0xe1955dc7, 0x1735c478, 0xf3e5e25a, 0x23b85b00, 0x8169e275, 0x462ebafe, 0xa416a938, 0xff95db7d,
+0xe559940c, 0x2dfe9649, 0x49c0d033, 0x7dae9063, 0xc5b5ac39, 0xbfcdc599, 0x8ef2ae01, 0x8f225bc0,
+0x53b3818b, 0x5d37b35e, 0xf4ac1398, 0x25ed45cd, 0x2987fb6d, 0x0e6b571f, 0x523a6510, 0xcc3fab8b,
+0xceec45e1, 0x47362006, 0xd08c6c1f, 0xec80a22c, 0x4c1f067d, 0x62d164ed, 0xd4aa46cf, 0x3333f7df,
+0x0301c8e1, 0xfd4ff58b, 0xa989e981, 0x07f80bef, 0x3ed517c3, 0x3d610c23, 0x45860fdb, 0x1edb9324,
+0x2b8531a0, 0x10c65424, 0x53a4927d, 0xe7c48c26, 0x8889f999, 0x8f10943b, 0x9484c062, 0xbb4f044f,
+0x9dd65dc8, 0xa1c78b8c, 0xc4c0f55a, 0xab178246, 0xefd6a6a3, 0x5dd67272, 0xc6c530eb, 0x065f9264,
+0x892c2aaa, 0x62d48e66, 0x628130cf, 0x999ba495, 0xdb56dbc0, 0xc4d6ff7f, 0xe082862a, 0x1c1410f4,
+0x05359247, 0xf1ca87d0, 0xcfd29f18, 0xc035941d, 0xaef3f0ea, 0x4dfc27ca, 0x3b9a3ba5, 0x0be120ac,
+0x3be36789, 0x0a5119f0, 0x87c726b9, 0xfc5f253e, 0x316bfa18, 0xb781ed7d, 0x3151729d, 0x7d79f36c,
+0xe29b9f74, 0x6b5d1945, 0x814c4862, 0xd137fc75, 0xde2cf8ba, 0x6d981463, 0x89ec7133, 0x244b7e74,
+0xca67bad5, 0x42e1572c, 0xe0cc4edd, 0x22723b4d, 0x0f7b5637, 0xcaa4d7a8, 0x20939d38, 0xb3fa57c9,
+0xdb40d2c7, 0xa56842a7, 0x23b1dc4a, 0x76a6c142, 0x75957b95, 0x1c88efd2, 0x474aabec, 0xdd64c7d9,
+0x7b7af462, 0xfb8becc4, 0x253b460e, 0x5e30ea57, 0x6fde8164, 0x445880d4, 0x9aa1e840, 0x9647d819,
+0xce5aaa18, 0x2bfadc27, 0xc03125bf, 0xb7747c00, 0x38964e8b, 0x38c21e10, 0xfa82a5f1, 0x5c52051a,
+0x3349a05f, 0x137a8e49, 0x93534899, 0x8ad17547, 0x796fcded, 0x9597502d, 0x2a7d8732, 0xf7727077,
+0x5359e13d, 0x27041ae4, 0xdfa05d40, 0x2e4ac04a, 0x4041ff37, 0x2a729f49, 0xc27fd299, 0xbfa8e384,
+0x9ba85c81, 0x5c5a4992, 0xfb37a677, 0xca908601, 0x226947f2, 0x91d5c8cd, 0x6c77c172, 0xba6d0427,
+0x5d10a9ef, 0xedc2b707, 0x81e75cdd, 0xda2aee14, 0x131d2260, 0x3ea2ffb9, 0xc8898110, 0x63dd39fa,
+0x89d93abb, 0x4e58fb47, 0x220c9301, 0x65633322, 0xc9d3541f, 0xc01901ba, 0xca7fa0ff, 0x5ffcb976,
+0x0aa82473, 0xb3d4e716, 0xb546a254, 0xc748f3d4, 0x6419e517, 0x0e5e63d5, 0xcec671b8, 0x0a91e10e,
+0x14ab1ba6, 0xdce0d59c, 0xbf8fcdee, 0xe513fef3, 0x7d950f51, 0x95f4d55a, 0x4386f226, 0xcc373edc,
+0xdca46e63, 0x98e6d1a2, 0x8ca77f40, 0x193cc148, 0x8e2ad7fe, 0xc01ede01, 0xd2440ded, 0xda8c8d52,
+0x93dcd063, 0x53916334, 0xf8208a54, 0x92d94b0e, 0xeea097dc, 0x264916d1, 0xbcb943ca, 0x31938475,
+0x2ebfaf57, 0xef78e891, 0xa83931a3, 0xf6921ff3, 0x178f1373, 0xa48fe882, 0xda6cc367, 0x5759b350,
+0xfec71d2a, 0xef614290, 0xc96852ab, 0x3cb31a88, 0x6f66dc0e, 0xf72fccfc, 0x23adb282, 0x18693ad7,
+0x9b94938f, 0x96f658a9, 0x3ac6199f, 0x77305aae, 0x6366691f, 0x8c933c8e, 0xd9b98545, 0xd909411f,
+0xefc7663e, 0x35ea0dae, 0xa5bc1ef4, 0xb03c39b1, 0x69b3d1fc, 0xc040d02b, 0x5a7db8f0, 0x00bcebc7,
+0x0276f258, 0x5f904832, 0x3bba0c61, 0xba5f952b, 0x908f5ed3, 0x16572a07, 0xbff00fd3, 0xaab41f96,
+0x913cc7da, 0x13c010e3, 0xee82213c, 0xdea296c0, 0x8addd3d3, 0xd2615b26, 0x6536a0a4, 0x0b8295e1,
+0x0b9f820b, 0x7c86c4b7, 0x2ce62cba, 0x5fa391bb, 0xbae4c3a8, 0x0dd2e316, 0x853598eb, 0xfc7c72e5,
+0xe09259be, 0x0029c25b, 0x82b6c98d, 0x617175e7, 0xbf745f18, 0x6e72d7ff, 0xaca5248a, 0x495ece7c,
+0x3d73d20d, 0x64553f72, 0x52dcc787, 0xc0875aad, 0x6ca56335, 0xeefc0be8, 0x79df339c, 0xe4538a88,
+0xcfabfbe6, 0xa4d3735b, 0xcbe90994, 0x99c93144, 0xe2c0ec75, 0x1da85ee5, 0x10058338, 0x3c95dd37,
+0xb8dd19f5, 0x7cb41b59, 0x0cbfe332, 0x0db88c1a, 0xc75b1820, 0xcef99013, 0x7c68d434, 0xb50f28e6,
+0xad3e0cd3, 0xdea2fbfd, 0x32aee281, 0x1f97b387, 0x271467eb, 0x9fb04999, 0x34befaea, 0x0cd2833d,
+0x7a057371, 0x696c0476, 0x295d9119, 0xd37825d0, 0x4d5cca28, 0x0b19f782, 0x9c10f380, 0x389b63c6,
+0x8cb5145c, 0x076d5df1, 0x9b1ef391, 0xf6f27f9f, 0x7ad4763e, 0x282258ca, 0xd43b6a78, 0xe1dd4fa5,
+0xe6aca89f, 0xa68ba12e, 0xfcda14de, 0xb59fe4a4, 0xeafcd76c, 0xeb59a642, 0x96361d47, 0x59c8bb5b,
+0x8902ba21, 0x1fd038df, 0x142f2d4f, 0x3e6b6743, 0x6280987d, 0xc415b758, 0xd78497f3, 0x8cfaa21b,
+0xcad85f1a, 0x3a3e011e, 0xbfaeb19f, 0xe1bb6dd8, 0xc94a1f36, 0x056794a1, 0x73d04f6a, 0x36e57618,
+0x94ba1d36, 0xcdb808f0, 0x836b063c, 0xb743c5fd, 0x8e90bee5, 0x84d5260d, 0x35c22810, 0x0e2553fb,
+0x3c207370, 0xf516ea0b, 0xb898d4cc, 0xf3b06d89, 0x8d02c0ef, 0x97f2ff5b, 0x7b720eac, 0xcadda54a,
+0xbd5bb36e, 0x194c0962, 0x6f9dabb0, 0x09a8b7a6, 0x8d3cf3ba, 0x312024e4, 0x58757d48, 0xaeda503c,
+0x0a887160, 0x749c41be, 0x2ad1d602, 0x235ab171, 0xdd1ec388, 0x74c44261, 0x338d8fb2, 0x6a5e4ceb,
+0x70a59f94, 0x458c246f, 0xa991bbd2, 0x2e430135, 0x36fc3ee6, 0xc4d5d668, 0x13dff20f, 0x8de15ac7,
+0x6d860423, 0x1e08a389, 0xf55f5e95, 0xa02bcfa5, 0xda1f61e7, 0xca675a68, 0x616543e3, 0x83cdafd4
+
+basegraph=
+2
+
+z_c=
+384
+
+n_cb=
+19200
+
+q_m=
+2
+
+n_filler=
+160
+
+ea =
+5460
+
+eb =
+5462
+
+c =
+12
+
+r =
+0
+
+cab =
+4
+
+rv_index =
+0
+
+code_block_mode =
+0
+
+op_flags =
+RTE_BBDEV_LDPC_CRC_24B_ATTACH
+
+expected_status =
+OK
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v2 7/8] app/bbdev: add parameter to take input in network order
  2021-04-10 17:02   ` [dpdk-dev] [PATCH v2 7/8] app/bbdev: add parameter to take input in network order Hemant Agrawal
@ 2021-04-12  7:22     ` David Marchand
  2021-04-12  7:29       ` Hemant Agrawal
  0 siblings, 1 reply; 157+ messages in thread
From: David Marchand @ 2021-04-12  7:22 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, gakhil, Nicolas Chautru, Nipun Gupta, Tom Rix

On Sat, Apr 10, 2021 at 7:04 PM Hemant Agrawal <hemant.agrawal@nxp.com> wrote:
>
> From: Nipun Gupta <nipun.gupta@nxp.com>
>
> Test bbdev application is reading the input and output from the
> test vector files in the same endianness which is of the system.
> This patch adds an option to provide data in the network order
> i.e. big endian format

I did not look at the bbdev API, but something feels odd here.
Why should the test know about endianness?


-- 
David Marchand


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v2 7/8] app/bbdev: add parameter to take input in network order
  2021-04-12  7:22     ` David Marchand
@ 2021-04-12  7:29       ` Hemant Agrawal
  0 siblings, 0 replies; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-12  7:29 UTC (permalink / raw)
  To: David Marchand, Hemant Agrawal
  Cc: dev, gakhil, Nicolas Chautru, Nipun Gupta, Tom Rix


On 4/12/2021 12:52 PM, David Marchand wrote:
> On Sat, Apr 10, 2021 at 7:04 PM Hemant Agrawal <hemant.agrawal@nxp.com> wrote:
>> From: Nipun Gupta <nipun.gupta@nxp.com>
>>
>> Test bbdev application is reading the input and output from the
>> test vector files in the same endianness which is of the system.
>> This patch adds an option to provide data in the network order
>> i.e. big endian format
> I did not look at the bbdev API, but something feels odd here.
> Why should the test know about endianness?
>
This is baseband data, which need to be processed by the offload device. 
It is important for know the endianness of this data else the offload 
device will not be able to process it correctly.

The existing files only have data in little-endian format.  In the real 
world, the network data can come in big-endian format, so the drivers 
(running on Little-endian machine) shall be able to pass the big-endian 
data for processing to offload device.


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v3 0/8] baseband: add NXP LA12xx driver
  2021-04-10 17:02 ` [dpdk-dev] [PATCH v2 0/8] baseband: add " Hemant Agrawal
                     ` (7 preceding siblings ...)
  2021-04-10 17:02   ` [dpdk-dev] [PATCH v2 8/8] app/bbdev: add test vectors for transport blocks Hemant Agrawal
@ 2021-04-13  5:17   ` Hemant Agrawal
  2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 1/8] baseband: introduce " Hemant Agrawal
                       ` (8 more replies)
  8 siblings, 9 replies; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-13  5:17 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, Hemant Agrawal

This series introduces the BBDEV LA12xx poll mode driver (PMD) to support
an implementation for offloading High Phy processing functions like
LDPC Encode / Decode 5GNR wireless acceleration function, using PCI based
LA12xx Software defined radio.

Please check the documentation patch for more info.

The driver currently implements basic feature to offload only the 5G LDPC
encode/decode.

Modifications has been done in test vectors to optionally support input in
network byte order. Two test vectors are also added as an example with
input data in network byte.

v2: add test case changes
v3: fix 32 bit compilation

Hemant Agrawal (6):
  baseband: introduce NXP LA12xx driver
  baseband/la12xx: add devargs for max queues
  baseband/la12xx: add support for multiple modems
  baseband/la12xx: add queue and modem config support
  baseband/la12xx: add enqueue and dequeue support
  baseband/la12xx: add documentation support

Nipun Gupta (2):
  app/bbdev: add parameter to take input in network order
  app/bbdev: add test vectors for transport blocks

 MAINTAINERS                                   |    9 +
 app/test-bbdev/test_bbdev_vector.c            |   18 +-
 app/test-bbdev/test_bbdev_vector.h            |    2 +
 app/test-bbdev/test_vectors/ldpc_dec_tb.data  |  362 +++++
 app/test-bbdev/test_vectors/ldpc_enc_tb.data  |  482 +++++++
 doc/guides/bbdevs/features/la12xx.ini         |   14 +
 doc/guides/bbdevs/index.rst                   |    1 +
 doc/guides/bbdevs/la12xx.rst                  |  139 ++
 doc/guides/rel_notes/release_21_05.rst        |    5 +
 drivers/baseband/la12xx/bbdev_la12xx.c        | 1178 +++++++++++++++++
 drivers/baseband/la12xx/bbdev_la12xx.h        |   57 +
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h    |  237 ++++
 .../baseband/la12xx/bbdev_la12xx_pmd_logs.h   |   38 +
 drivers/baseband/la12xx/meson.build           |    6 +
 drivers/baseband/la12xx/version.map           |    3 +
 drivers/baseband/meson.build                  |    2 +-
 16 files changed, 2550 insertions(+), 3 deletions(-)
 create mode 100644 app/test-bbdev/test_vectors/ldpc_dec_tb.data
 create mode 100644 app/test-bbdev/test_vectors/ldpc_enc_tb.data
 create mode 100644 doc/guides/bbdevs/features/la12xx.ini
 create mode 100644 doc/guides/bbdevs/la12xx.rst
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.c
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_ipc.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
 create mode 100644 drivers/baseband/la12xx/meson.build
 create mode 100644 drivers/baseband/la12xx/version.map

-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v3 1/8] baseband: introduce NXP LA12xx driver
  2021-04-13  5:17   ` [dpdk-dev] [PATCH v3 0/8] baseband: add NXP LA12xx driver Hemant Agrawal
@ 2021-04-13  5:17     ` Hemant Agrawal
  2021-04-24 10:36       ` [dpdk-dev] [PATCH v4 0/8] baseband: add " Hemant Agrawal
  2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 2/8] baseband/la12xx: add devargs for max queues Hemant Agrawal
                       ` (7 subsequent siblings)
  8 siblings, 1 reply; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-13  5:17 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, Hemant Agrawal, Nipun Gupta

This patch introduce the baseband device drivers for NXP's
LA1200 series software defined baseband modem.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c        | 109 ++++++++++++++++++
 .../baseband/la12xx/bbdev_la12xx_pmd_logs.h   |  38 ++++++
 drivers/baseband/la12xx/meson.build           |   6 +
 drivers/baseband/la12xx/version.map           |   3 +
 drivers/baseband/meson.build                  |   2 +-
 5 files changed, 157 insertions(+), 1 deletion(-)
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.c
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
 create mode 100644 drivers/baseband/la12xx/meson.build
 create mode 100644 drivers/baseband/la12xx/version.map

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
new file mode 100644
index 0000000000..7050b17728
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -0,0 +1,109 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+
+#include <string.h>
+
+#include <rte_common.h>
+#include <rte_bus_vdev.h>
+#include <rte_malloc.h>
+#include <rte_ring.h>
+#include <rte_kvargs.h>
+
+#include <rte_bbdev.h>
+#include <rte_bbdev_pmd.h>
+
+#include <bbdev_la12xx_pmd_logs.h>
+
+#define DRIVER_NAME baseband_la12xx
+
+RTE_LOG_REGISTER(bbdev_la12xx_logtype, pmd.bb.la12xx, NOTICE);
+
+/* private data structure */
+struct bbdev_la12xx_private {
+	unsigned int max_nb_queues;  /**< Max number of queues */
+};
+/* Create device */
+static int
+la12xx_bbdev_create(struct rte_vdev_device *vdev)
+{
+	struct rte_bbdev *bbdev;
+	const char *name = rte_vdev_device_name(vdev);
+
+	PMD_INIT_FUNC_TRACE();
+
+	bbdev = rte_bbdev_allocate(name);
+	if (bbdev == NULL)
+		return -ENODEV;
+
+	bbdev->data->dev_private = rte_zmalloc(name,
+			sizeof(struct bbdev_la12xx_private),
+			RTE_CACHE_LINE_SIZE);
+	if (bbdev->data->dev_private == NULL) {
+		rte_bbdev_release(bbdev);
+		return -ENOMEM;
+	}
+
+	bbdev->dev_ops = NULL;
+	bbdev->device = &vdev->device;
+	bbdev->data->socket_id = 0;
+	bbdev->intr_handle = NULL;
+
+	/* register rx/tx burst functions for data path */
+	bbdev->dequeue_enc_ops = NULL;
+	bbdev->dequeue_dec_ops = NULL;
+	bbdev->enqueue_enc_ops = NULL;
+	bbdev->enqueue_dec_ops = NULL;
+
+	return 0;
+}
+
+/* Initialise device */
+static int
+la12xx_bbdev_probe(struct rte_vdev_device *vdev)
+{
+	const char *name;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (vdev == NULL)
+		return -EINVAL;
+
+	name = rte_vdev_device_name(vdev);
+	if (name == NULL)
+		return -EINVAL;
+
+	return la12xx_bbdev_create(vdev);
+}
+
+/* Uninitialise device */
+static int
+la12xx_bbdev_remove(struct rte_vdev_device *vdev)
+{
+	struct rte_bbdev *bbdev;
+	const char *name;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (vdev == NULL)
+		return -EINVAL;
+
+	name = rte_vdev_device_name(vdev);
+	if (name == NULL)
+		return -EINVAL;
+
+	bbdev = rte_bbdev_get_named_dev(name);
+	if (bbdev == NULL)
+		return -EINVAL;
+
+	rte_free(bbdev->data->dev_private);
+
+	return rte_bbdev_release(bbdev);
+}
+
+static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
+	.probe = la12xx_bbdev_probe,
+	.remove = la12xx_bbdev_remove
+};
+
+RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h b/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
new file mode 100644
index 0000000000..71613a5bac
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020 NXP
+ */
+
+#ifndef _BBDEV_LA12XX_PMD_LOGS_H_
+#define _BBDEV_LA12XX_PMD_LOGS_H_
+
+#define BBDEV_LA12XX_PMD_LOG(level, fmt, args...) \
+	rte_log(RTE_LOG_ ## level, bbdev_la12xx_logtype, "bbdev_la12xx: " \
+		fmt "\n", ##args)
+
+#define BBDEV_LA12XX_PMD_DEBUG(fmt, args...) \
+	rte_log(RTE_LOG_DEBUG, bbdev_la12xx_logtype, "bbdev_la12xx: %s(): "\
+		fmt "\n", __func__, ##args)
+
+#define PMD_INIT_FUNC_TRACE() BBDEV_LA12XX_PMD_DEBUG(">>")
+
+#define BBDEV_LA12XX_PMD_CRIT(fmt, args...) \
+	BBDEV_LA12XX_PMD_LOG(CRIT, fmt, ## args)
+#define BBDEV_LA12XX_PMD_INFO(fmt, args...) \
+	BBDEV_LA12XX_PMD_LOG(INFO, fmt, ## args)
+#define BBDEV_LA12XX_PMD_ERR(fmt, args...) \
+	BBDEV_LA12XX_PMD_LOG(ERR, fmt, ## args)
+#define BBDEV_LA12XX_PMD_WARN(fmt, args...) \
+	BBDEV_LA12XX_PMD_LOG(WARNING, fmt, ## args)
+
+/* DP Logs, toggled out at compile time if level lower than current level */
+#define BBDEV_LA12XX_PMD_DP_LOG(level, fmt, args...) \
+	RTE_LOG_DP(level, PMD, fmt, ## args)
+
+#define BBDEV_LA12XX_PMD_DP_DEBUG(fmt, args...) \
+	BBDEV_LA12XX_PMD_DP_LOG(DEBUG, fmt, ## args)
+#define BBDEV_LA12XX_PMD_DP_INFO(fmt, args...) \
+	BBDEV_LA12XX_PMD_DP_LOG(INFO, fmt, ## args)
+#define BBDEV_LA12XX_PMD_DP_WARN(fmt, args...) \
+	BBDEV_LA12XX_PMD_DP_LOG(WARNING, fmt, ## args)
+
+#endif /* _BBDEV_LA12XX_PMD_LOGS_H_ */
diff --git a/drivers/baseband/la12xx/meson.build b/drivers/baseband/la12xx/meson.build
new file mode 100644
index 0000000000..7a017dcffa
--- /dev/null
+++ b/drivers/baseband/la12xx/meson.build
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020-2021 NXP
+
+deps += ['bbdev', 'bus_vdev', 'ring']
+
+sources = files('bbdev_la12xx.c')
diff --git a/drivers/baseband/la12xx/version.map b/drivers/baseband/la12xx/version.map
new file mode 100644
index 0000000000..4a76d1d52d
--- /dev/null
+++ b/drivers/baseband/la12xx/version.map
@@ -0,0 +1,3 @@
+DPDK_21 {
+	local: *;
+};
diff --git a/drivers/baseband/meson.build b/drivers/baseband/meson.build
index 920e3b02ee..ba5b2e570a 100644
--- a/drivers/baseband/meson.build
+++ b/drivers/baseband/meson.build
@@ -5,4 +5,4 @@ if is_windows
 	subdir_done()
 endif
 
-drivers = ['null', 'turbo_sw', 'fpga_lte_fec', 'fpga_5gnr_fec', 'acc100']
+drivers = ['null', 'turbo_sw', 'fpga_lte_fec', 'fpga_5gnr_fec', 'acc100', 'la12xx']
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v3 2/8] baseband/la12xx: add devargs for max queues
  2021-04-13  5:17   ` [dpdk-dev] [PATCH v3 0/8] baseband: add NXP LA12xx driver Hemant Agrawal
  2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 1/8] baseband: introduce " Hemant Agrawal
@ 2021-04-13  5:17     ` Hemant Agrawal
  2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 3/8] baseband/la12xx: add support for multiple modems Hemant Agrawal
                       ` (6 subsequent siblings)
  8 siblings, 0 replies; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-13  5:17 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, Hemant Agrawal, Nipun Gupta

This patch adds dev args to take  max queues as input

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c | 72 +++++++++++++++++++++++++-
 1 file changed, 70 insertions(+), 2 deletions(-)

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 7050b17728..8d3041ce28 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -19,13 +19,72 @@
 
 RTE_LOG_REGISTER(bbdev_la12xx_logtype, pmd.bb.la12xx, NOTICE);
 
+/*  Initialisation params structure that can be used by LA12xx BBDEV driver */
+struct bbdev_la12xx_params {
+	uint8_t queues_num; /*< LA12xx BBDEV queues number */
+};
+
+#define BBDEV_LA12XX_MAX_NB_QUEUES_ARG  "max_nb_queues"
+
+static const char * const bbdev_la12xx_valid_params[] = {
+	BBDEV_LA12XX_MAX_NB_QUEUES_ARG,
+};
+
 /* private data structure */
 struct bbdev_la12xx_private {
 	unsigned int max_nb_queues;  /**< Max number of queues */
 };
+static inline int
+parse_u16_arg(const char *key, const char *value, void *extra_args)
+{
+	uint16_t *u16 = extra_args;
+
+	unsigned int long result;
+	if ((value == NULL) || (extra_args == NULL))
+		return -EINVAL;
+	errno = 0;
+	result = strtoul(value, NULL, 0);
+	if ((result >= (1 << 16)) || (errno != 0)) {
+		BBDEV_LA12XX_PMD_ERR("Invalid value %lu for %s", result, key);
+		return -ERANGE;
+	}
+	*u16 = (uint16_t)result;
+	return 0;
+}
+
+/* Parse parameters used to create device */
+static int
+parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
+		const char *input_args)
+{
+	struct rte_kvargs *kvlist = NULL;
+	int ret = 0;
+
+	if (params == NULL)
+		return -EINVAL;
+	if (input_args) {
+		kvlist = rte_kvargs_parse(input_args,
+				bbdev_la12xx_valid_params);
+		if (kvlist == NULL)
+			return -EFAULT;
+
+		ret = rte_kvargs_process(kvlist, bbdev_la12xx_valid_params[0],
+					&parse_u16_arg, &params->queues_num);
+		if (ret < 0)
+			goto exit;
+
+	}
+
+exit:
+	if (kvlist)
+		rte_kvargs_free(kvlist);
+	return ret;
+}
+
 /* Create device */
 static int
-la12xx_bbdev_create(struct rte_vdev_device *vdev)
+la12xx_bbdev_create(struct rte_vdev_device *vdev,
+		struct bbdev_la12xx_params *init_params)
 {
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
@@ -62,7 +121,11 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev)
 static int
 la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 {
+	struct bbdev_la12xx_params init_params = {
+		8, -1,
+	};
 	const char *name;
+	const char *input_args;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -73,7 +136,10 @@ la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 	if (name == NULL)
 		return -EINVAL;
 
-	return la12xx_bbdev_create(vdev);
+	input_args = rte_vdev_device_args(vdev);
+	parse_bbdev_la12xx_params(&init_params, input_args);
+
+	return la12xx_bbdev_create(vdev, &init_params);
 }
 
 /* Uninitialise device */
@@ -107,3 +173,5 @@ static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
 };
 
 RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
+RTE_PMD_REGISTER_PARAM_STRING(DRIVER_NAME,
+	BBDEV_LA12XX_MAX_NB_QUEUES_ARG"=<int>");
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v3 3/8] baseband/la12xx: add support for multiple modems
  2021-04-13  5:17   ` [dpdk-dev] [PATCH v3 0/8] baseband: add NXP LA12xx driver Hemant Agrawal
  2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 1/8] baseband: introduce " Hemant Agrawal
  2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 2/8] baseband/la12xx: add devargs for max queues Hemant Agrawal
@ 2021-04-13  5:17     ` Hemant Agrawal
  2021-04-14  0:02       ` Chautru, Nicolas
  2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 4/8] baseband/la12xx: add queue and modem config support Hemant Agrawal
                       ` (5 subsequent siblings)
  8 siblings, 1 reply; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-13  5:17 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, Hemant Agrawal

This patch add support for multiple modems by assigning
a modem id as dev args in vdev creation.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c     | 60 ++++++++++++++++++++--
 drivers/baseband/la12xx/bbdev_la12xx.h     | 56 ++++++++++++++++++++
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 20 ++++++++
 3 files changed, 131 insertions(+), 5 deletions(-)
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_ipc.h

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 8d3041ce28..7e9be74bb4 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -14,6 +14,8 @@
 #include <rte_bbdev_pmd.h>
 
 #include <bbdev_la12xx_pmd_logs.h>
+#include <bbdev_la12xx_ipc.h>
+#include <bbdev_la12xx.h>
 
 #define DRIVER_NAME baseband_la12xx
 
@@ -22,18 +24,18 @@ RTE_LOG_REGISTER(bbdev_la12xx_logtype, pmd.bb.la12xx, NOTICE);
 /*  Initialisation params structure that can be used by LA12xx BBDEV driver */
 struct bbdev_la12xx_params {
 	uint8_t queues_num; /*< LA12xx BBDEV queues number */
+	int8_t modem_id; /*< LA12xx modem instance id */
 };
 
 #define BBDEV_LA12XX_MAX_NB_QUEUES_ARG  "max_nb_queues"
+#define BBDEV_LA12XX_VDEV_MODEM_ID_ARG	"modem"
+#define LA12XX_MAX_MODEM 4
 
 static const char * const bbdev_la12xx_valid_params[] = {
 	BBDEV_LA12XX_MAX_NB_QUEUES_ARG,
+	BBDEV_LA12XX_VDEV_MODEM_ID_ARG,
 };
 
-/* private data structure */
-struct bbdev_la12xx_private {
-	unsigned int max_nb_queues;  /**< Max number of queues */
-};
 static inline int
 parse_u16_arg(const char *key, const char *value, void *extra_args)
 {
@@ -52,6 +54,28 @@ parse_u16_arg(const char *key, const char *value, void *extra_args)
 	return 0;
 }
 
+/* Parse integer from integer argument */
+static int
+parse_integer_arg(const char *key __rte_unused,
+		const char *value, void *extra_args)
+{
+	int i;
+	char *end;
+
+	errno = 0;
+
+	i = strtol(value, &end, 10);
+	if (*end != 0 || errno != 0 || i < 0 || i > LA12XX_MAX_MODEM) {
+		BBDEV_LA12XX_PMD_ERR("Supported Port IDS are 0 to %d",
+			LA12XX_MAX_MODEM - 1);
+		return -EINVAL;
+	}
+
+	*((uint32_t *)extra_args) = i;
+
+	return 0;
+}
+
 /* Parse parameters used to create device */
 static int
 parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
@@ -73,6 +97,16 @@ parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
 		if (ret < 0)
 			goto exit;
 
+		ret = rte_kvargs_process(kvlist,
+					bbdev_la12xx_valid_params[1],
+					&parse_integer_arg,
+					&params->modem_id);
+
+		if (params->modem_id >= LA12XX_MAX_MODEM) {
+			BBDEV_LA12XX_PMD_ERR("Invalid modem id, must be < %u",
+					LA12XX_MAX_MODEM);
+			goto exit;
+		}
 	}
 
 exit:
@@ -88,6 +122,7 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 {
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
+	struct bbdev_la12xx_private *priv;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -103,6 +138,20 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 		return -ENOMEM;
 	}
 
+	priv = bbdev->data->dev_private;
+	priv->modem_id = init_params->modem_id;
+	/* if modem id is not configured */
+	if (priv->modem_id == -1)
+		priv->modem_id = bbdev->data->dev_id;
+
+	/* Reset Global variables */
+	priv->num_ldpc_enc_queues = 0;
+	priv->num_ldpc_dec_queues = 0;
+	priv->num_valid_queues = 0;
+	priv->max_nb_queues = init_params->queues_num;
+
+	BBDEV_LA12XX_PMD_INFO("Setting Up %s: DevId=%d, ModemId=%d",
+				name, bbdev->data->dev_id, priv->modem_id);
 	bbdev->dev_ops = NULL;
 	bbdev->device = &vdev->device;
 	bbdev->data->socket_id = 0;
@@ -174,4 +223,5 @@ static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
 
 RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
 RTE_PMD_REGISTER_PARAM_STRING(DRIVER_NAME,
-	BBDEV_LA12XX_MAX_NB_QUEUES_ARG"=<int>");
+	BBDEV_LA12XX_MAX_NB_QUEUES_ARG"=<int>"
+	BBDEV_LA12XX_VDEV_MODEM_ID_ARG "=<int> ");
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.h b/drivers/baseband/la12xx/bbdev_la12xx.h
new file mode 100644
index 0000000000..5228502331
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx.h
@@ -0,0 +1,56 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+
+#ifndef __BBDEV_LA12XX_H__
+#define __BBDEV_LA12XX_H__
+
+#define BBDEV_IPC_ENC_OP_TYPE	1
+#define BBDEV_IPC_DEC_OP_TYPE	2
+
+#define MAX_LDPC_ENC_FECA_QUEUES	4
+#define MAX_LDPC_DEC_FECA_QUEUES	4
+
+#define MAX_CHANNEL_DEPTH 16
+/* private data structure */
+struct bbdev_la12xx_private {
+	void *ipc_priv;
+	uint8_t num_valid_queues;
+	uint8_t max_nb_queues;
+	uint8_t num_ldpc_enc_queues;
+	uint8_t num_ldpc_dec_queues;
+	int8_t modem_id;
+	struct bbdev_la12xx_q_priv *queues_priv[32];
+};
+
+struct hugepage_info {
+	void *vaddr;
+	phys_addr_t paddr;
+	size_t len;
+};
+
+struct bbdev_la12xx_q_priv {
+	struct bbdev_la12xx_private *bbdev_priv;
+	uint32_t q_id;	/**< Channel ID */
+	uint32_t feca_blk_id;	/** FECA block ID for processing */
+	uint32_t feca_blk_id_be32; /**< FECA Block ID for this queue */
+	uint8_t en_napi; /* 0: napi disabled, 1: napi enabled */
+	uint16_t queue_size;	/**< Queue depth */
+	int32_t eventfd;	/**< Event FD value */
+	enum rte_bbdev_op_type op_type; /**< Operation type */
+	uint32_t la12xx_core_id;
+		/* LA12xx core ID on which this will be scheduled */
+	struct rte_mempool *mp; /**< Pool from where buffers would be cut */
+	void *bbdev_op[MAX_CHANNEL_DEPTH];
+			/**< Stores bbdev op for each index */
+	void *msg_ch_vaddr[MAX_CHANNEL_DEPTH];
+			/**< Stores msg channel addr for modem->host */
+	uint32_t host_pi;	/**< Producer_Index for HOST->MODEM */
+	uint32_t host_ci;	/**< Consumer Index for MODEM->HOST */
+	host_ipc_params_t *host_params; /**< Host parameters */
+};
+
+#define lower_32_bits(x) ((uint32_t)((uint64_t)x))
+#define upper_32_bits(x) ((uint32_t)(((uint64_t)(x) >> 16) >> 16))
+
+#endif
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
new file mode 100644
index 0000000000..9aa5562981
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+#ifndef __BBDEV_LA12XX_IPC_H__
+#define __BBDEV_LA12XX_IPC_H__
+
+/** No. of max channel per instance */
+#define IPC_MAX_DEPTH	(16)
+
+/* This shared memory would be on the host side which have copy of some
+ * of the parameters which are also part of Shared BD ring. Read access
+ * of these parameters from the host side would not be over PCI.
+ */
+typedef struct host_ipc_params {
+	volatile uint32_t pi;
+	volatile uint32_t ci;
+	volatile uint32_t modem_ptr[IPC_MAX_DEPTH];
+} __rte_packed host_ipc_params_t;
+
+#endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v3 4/8] baseband/la12xx: add queue and modem config support
  2021-04-13  5:17   ` [dpdk-dev] [PATCH v3 0/8] baseband: add NXP LA12xx driver Hemant Agrawal
                       ` (2 preceding siblings ...)
  2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 3/8] baseband/la12xx: add support for multiple modems Hemant Agrawal
@ 2021-04-13  5:17     ` Hemant Agrawal
  2021-04-14  0:41       ` Chautru, Nicolas
  2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 5/8] baseband/la12xx: add enqueue and dequeue support Hemant Agrawal
                       ` (4 subsequent siblings)
  8 siblings, 1 reply; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-13  5:17 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, Hemant Agrawal, Nipun Gupta

This patch add support for connecting with modem
and creating the ipc channel as queues with modem
for the exchange of data.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c     | 564 ++++++++++++++++++++-
 drivers/baseband/la12xx/bbdev_la12xx.h     |   5 +-
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 180 +++++++
 3 files changed, 746 insertions(+), 3 deletions(-)

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 7e9be74bb4..0a68686205 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -3,6 +3,11 @@
  */
 
 #include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <dirent.h>
 
 #include <rte_common.h>
 #include <rte_bus_vdev.h>
@@ -31,11 +36,561 @@ struct bbdev_la12xx_params {
 #define BBDEV_LA12XX_VDEV_MODEM_ID_ARG	"modem"
 #define LA12XX_MAX_MODEM 4
 
+#define LA12XX_MAX_CORES	4
+#define BBDEV_LA12XX_LDPC_ENC_CORE	0
+#define BBDEV_LA12XX_LDPC_DEC_CORE	1
+
 static const char * const bbdev_la12xx_valid_params[] = {
 	BBDEV_LA12XX_MAX_NB_QUEUES_ARG,
 	BBDEV_LA12XX_VDEV_MODEM_ID_ARG,
 };
 
+static const struct rte_bbdev_op_cap bbdev_capabilities[] = {
+	{
+		.type   = RTE_BBDEV_OP_LDPC_ENC,
+		.cap.ldpc_enc = {
+			.capability_flags =
+					RTE_BBDEV_LDPC_CRC_24A_ATTACH |
+					RTE_BBDEV_LDPC_CRC_24B_ATTACH,
+			.num_buffers_src =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+			.num_buffers_dst =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+		}
+	},
+	{
+		.type   = RTE_BBDEV_OP_LDPC_DEC,
+		.cap.ldpc_dec = {
+			.capability_flags =
+				RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK |
+					RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK |
+					RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP,
+			.num_buffers_src =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+			.num_buffers_hard_out =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+		}
+	},
+	RTE_BBDEV_END_OF_CAPABILITIES_LIST()
+};
+
+static struct rte_bbdev_queue_conf default_queue_conf = {
+	.queue_size = MAX_CHANNEL_DEPTH,
+};
+
+/* Get device info */
+static void
+la12xx_info_get(struct rte_bbdev *dev,
+		struct rte_bbdev_driver_info *dev_info)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	dev_info->driver_name = RTE_STR(DRIVER_NAME);
+	dev_info->max_num_queues = LA12XX_MAX_QUEUES;
+	dev_info->queue_size_lim = MAX_CHANNEL_DEPTH;
+	dev_info->hardware_accelerated = true;
+	dev_info->max_dl_queue_priority = 0;
+	dev_info->max_ul_queue_priority = 0;
+	dev_info->default_queue_conf = default_queue_conf;
+	dev_info->capabilities = bbdev_capabilities;
+	dev_info->cpu_flag_reqs = NULL;
+	dev_info->min_alignment = 64;
+
+	BBDEV_LA12XX_PMD_DEBUG("got device info from %u", dev->data->dev_id);
+}
+
+/* Release queue */
+static int
+la12xx_queue_release(struct rte_bbdev *dev, uint16_t q_id)
+{
+	RTE_SET_USED(dev);
+	RTE_SET_USED(q_id);
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* TODO: Implement */
+
+	return 0;
+}
+
+#define HUGEPG_OFFSET(A) \
+		((uint64_t) ((unsigned long) (A) \
+		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
+
+static int ipc_queue_configure(uint32_t channel_id,
+		ipc_t instance, struct bbdev_la12xx_q_priv *q_priv)
+{
+	ipc_userspace_t *ipc_priv = (ipc_userspace_t *)instance;
+	ipc_instance_t *ipc_instance = ipc_priv->instance;
+	ipc_ch_t *ch;
+	void *vaddr;
+	uint32_t i = 0;
+	uint32_t msg_size = sizeof(struct bbdev_ipc_enqueue_op);
+
+	PMD_INIT_FUNC_TRACE();
+
+	BBDEV_LA12XX_PMD_DEBUG("%x %p", ipc_instance->initialized,
+		ipc_priv->instance);
+	ch = &(ipc_instance->ch_list[channel_id]);
+
+	BBDEV_LA12XX_PMD_DEBUG("channel: %u, depth: %u, msg size: %u",
+		channel_id, q_priv->queue_size, msg_size);
+
+	/* Start init of channel */
+	ch->md.ring_size = rte_cpu_to_be_32(q_priv->queue_size);
+	ch->md.pi = 0;
+	ch->md.ci = 0;
+	ch->md.msg_size = msg_size;
+	for (i = 0; i < q_priv->queue_size; i++) {
+		vaddr = rte_malloc(NULL, msg_size, RTE_CACHE_LINE_SIZE);
+		if (!vaddr)
+			return IPC_HOST_BUF_ALLOC_FAIL;
+		/* Only offset now */
+		ch->bd[i].modem_ptr =
+			rte_cpu_to_be_32(HUGEPG_OFFSET(vaddr));
+		ch->bd[i].host_virt_l = lower_32_bits(vaddr);
+		ch->bd[i].host_virt_h = upper_32_bits(vaddr);
+		q_priv->msg_ch_vaddr[i] = vaddr;
+		/* Not sure use of this len may be for CRC*/
+		ch->bd[i].len = 0;
+	}
+	ch->host_ipc_params =
+		rte_cpu_to_be_32(HUGEPG_OFFSET(q_priv->host_params));
+	ch->bl_initialized = 1;
+
+	BBDEV_LA12XX_PMD_DEBUG("Channel configured");
+	return IPC_SUCCESS;
+}
+
+static int
+la12xx_e200_queue_setup(struct rte_bbdev *dev,
+		struct bbdev_la12xx_q_priv *q_priv)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	struct gul_hif *mhif;
+	ipc_metadata_t *ipc_md;
+	ipc_ch_t *ch;
+	int instance_id = 0, i;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		q_priv->la12xx_core_id = BBDEV_LA12XX_LDPC_ENC_CORE;
+		break;
+	case RTE_BBDEV_OP_LDPC_DEC:
+		q_priv->la12xx_core_id = BBDEV_LA12XX_LDPC_DEC_CORE;
+		break;
+	default:
+		BBDEV_LA12XX_PMD_ERR("Unsupported op type\n");
+		return -1;
+	}
+
+	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+	/* offset is from start of PEB */
+	ipc_md = (ipc_metadata_t *)((size_t)ipc_priv->peb_start.host_vaddr +
+		mhif->ipc_regs.ipc_mdata_offset);
+	ch = &ipc_md->instance_list[instance_id].ch_list[q_priv->q_id];
+
+	if (q_priv->q_id < priv->num_valid_queues) {
+		ipc_br_md_t *md, *host_md;
+		ipc_ch_t *host_rx_ch;
+
+		host_rx_ch =
+			&ipc_md->instance_list[instance_id].ch_list[q_priv->q_id
+				+ HOST_RX_QUEUEID_OFFSET];
+		md = &(ch->md);
+		host_md = &(host_rx_ch->md);
+
+		q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
+		q_priv->feca_blk_id_be32 = ch->feca_blk_id;
+		q_priv->host_pi = rte_be_to_cpu_32(host_md->pi);
+		q_priv->host_ci = rte_be_to_cpu_32(md->ci);
+		q_priv->host_params = (host_ipc_params_t *)
+			(rte_be_to_cpu_32(ch->host_ipc_params) +
+			((size_t)ipc_priv->hugepg_start.host_vaddr));
+
+		for (i = 0; i < q_priv->queue_size; i++) {
+			uint32_t h, l;
+
+			h = host_rx_ch->bd[i].host_virt_h;
+			l = host_rx_ch->bd[i].host_virt_l;
+			q_priv->msg_ch_vaddr[i] = (void *)join_32_bits(h, l);
+		}
+
+		BBDEV_LA12XX_PMD_WARN(
+			"Queue [%d] already configured, not configuring again",
+			q_priv->q_id);
+		return 0;
+	}
+
+	BBDEV_LA12XX_PMD_DEBUG("setting up queue %d", q_priv->q_id);
+
+	q_priv->host_params = rte_zmalloc(NULL, sizeof(host_ipc_params_t),
+			RTE_CACHE_LINE_SIZE);
+	ch->host_ipc_params =
+		rte_cpu_to_be_32(HUGEPG_OFFSET(q_priv->host_params));
+
+	/* Call ipc_configure_channel */
+	ret = ipc_queue_configure((q_priv->q_id + HOST_RX_QUEUEID_OFFSET),
+				  ipc_priv, q_priv);
+	if (ret) {
+		BBDEV_LA12XX_PMD_ERR("Unable to setup queue (%d) (err=%d)",
+		       q_priv->q_id, ret);
+		return ret;
+	}
+
+	/* Set queue properties for LA12xx device */
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		if (priv->num_ldpc_enc_queues >= MAX_LDPC_ENC_FECA_QUEUES) {
+			BBDEV_LA12XX_PMD_ERR(
+				"num_ldpc_enc_queues reached max value");
+			return -1;
+		}
+		ch->la12xx_core_id =
+			rte_cpu_to_be_32(BBDEV_LA12XX_LDPC_ENC_CORE);
+		ch->feca_blk_id = rte_cpu_to_be_32(priv->num_ldpc_enc_queues++);
+		break;
+	case RTE_BBDEV_OP_LDPC_DEC:
+		if (priv->num_ldpc_dec_queues >= MAX_LDPC_DEC_FECA_QUEUES) {
+			BBDEV_LA12XX_PMD_ERR(
+				"num_ldpc_dec_queues reached max value");
+			return -1;
+		}
+		ch->la12xx_core_id =
+			rte_cpu_to_be_32(BBDEV_LA12XX_LDPC_DEC_CORE);
+		ch->feca_blk_id = rte_cpu_to_be_32(priv->num_ldpc_dec_queues++);
+		break;
+	default:
+		BBDEV_LA12XX_PMD_ERR("Not supported op type\n");
+		return -1;
+	}
+	ch->op_type = rte_cpu_to_be_32(q_priv->op_type);
+	ch->depth = rte_cpu_to_be_32(q_priv->queue_size);
+
+	/* Store queue config here */
+	q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
+	q_priv->feca_blk_id_be32 = ch->feca_blk_id;
+
+	return 0;
+}
+
+/* Setup a queue */
+static int
+la12xx_queue_setup(struct rte_bbdev *dev, uint16_t q_id,
+		const struct rte_bbdev_queue_conf *queue_conf)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	struct rte_bbdev_queue_data *q_data;
+	struct bbdev_la12xx_q_priv *q_priv;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* Move to setup_queues callback */
+	q_data = &dev->data->queues[q_id];
+	q_data->queue_private = rte_zmalloc(NULL,
+		sizeof(struct bbdev_la12xx_q_priv), 0);
+	if (!q_data->queue_private) {
+		BBDEV_LA12XX_PMD_ERR("Memory allocation failed for qpriv");
+		return -ENOMEM;
+	}
+	q_priv = q_data->queue_private;
+	q_priv->q_id = q_id;
+	q_priv->bbdev_priv = dev->data->dev_private;
+	q_priv->queue_size = queue_conf->queue_size;
+	q_priv->op_type = queue_conf->op_type;
+
+	ret = la12xx_e200_queue_setup(dev, q_priv);
+	if (ret) {
+		BBDEV_LA12XX_PMD_ERR("e200_queue_setup failed for qid: %d",
+				     q_id);
+		return ret;
+	}
+
+	/* Store queue config here */
+	priv->num_valid_queues++;
+
+	return 0;
+}
+
+static int
+la12xx_start(struct rte_bbdev *dev)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	int ready = 0;
+	struct gul_hif *hif_start;
+
+	PMD_INIT_FUNC_TRACE();
+
+	hif_start = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+
+	/* Set Host Read bit */
+	SET_HIF_HOST_RDY(hif_start, HIF_HOST_READY_IPC_APP);
+
+	/* Now wait for modem ready bit */
+	while (!ready)
+		ready = CHK_HIF_MOD_RDY(hif_start, HIF_MOD_READY_IPC_APP);
+
+	return 0;
+}
+
+static const struct rte_bbdev_ops pmd_ops = {
+	.info_get = la12xx_info_get,
+	.queue_setup = la12xx_queue_setup,
+	.queue_release = la12xx_queue_release,
+	.start = la12xx_start
+};
+static struct hugepage_info *
+get_hugepage_info(void)
+{
+	struct hugepage_info *hp_info;
+	struct rte_memseg *mseg;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* TODO - find a better way */
+	hp_info = rte_malloc(NULL, sizeof(struct hugepage_info), 0);
+	if (!hp_info) {
+		BBDEV_LA12XX_PMD_ERR("Unable to allocate on local heap");
+		return NULL;
+	}
+
+	mseg = rte_mem_virt2memseg(hp_info, NULL);
+	hp_info->vaddr = mseg->addr;
+	hp_info->paddr = rte_mem_virt2phy(mseg->addr);
+	hp_info->len = mseg->len;
+
+	return hp_info;
+}
+
+static int open_ipc_dev(int modem_id)
+{
+	char dev_initials[16], dev_path[PATH_MAX];
+	struct dirent *entry;
+	int dev_ipc = 0;
+	DIR *dir;
+
+	dir = opendir("/dev/");
+	if (!dir) {
+		BBDEV_LA12XX_PMD_ERR("Unable to open /dev/");
+		return -1;
+	}
+
+	sprintf(dev_initials, "gulipcgul%d", modem_id);
+
+	while ((entry = readdir(dir)) != NULL) {
+		if (!strncmp(dev_initials, entry->d_name,
+		    sizeof(dev_initials) - 1))
+			break;
+	}
+
+	if (!entry) {
+		BBDEV_LA12XX_PMD_ERR("Error: No gulipcgul%d device", modem_id);
+		return -1;
+	}
+
+	sprintf(dev_path, "/dev/%s", entry->d_name);
+	dev_ipc = open(dev_path, O_RDWR);
+	if (dev_ipc  < 0) {
+		BBDEV_LA12XX_PMD_ERR("Error: Cannot open %s", dev_path);
+		return -errno;
+	}
+
+	return dev_ipc;
+}
+
+static int
+setup_la12xx_dev(struct rte_bbdev *dev)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	struct hugepage_info *hp = NULL;
+	ipc_channel_us_t *ipc_priv_ch = NULL;
+	int dev_ipc = 0, dev_mem = 0, i;
+	ipc_metadata_t *ipc_md;
+	struct gul_hif *mhif;
+	uint32_t phy_align = 0;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (!ipc_priv) {
+		/* TODO - get a better way */
+		/* Get the hugepage info against it */
+		hp = get_hugepage_info();
+		if (!hp) {
+			BBDEV_LA12XX_PMD_ERR("Unable to get hugepage info");
+			ret = -ENOMEM;
+			goto err;
+		}
+
+		BBDEV_LA12XX_PMD_DEBUG("0x%" PRIx64 " %p %x",
+				hp->paddr, hp->vaddr, (int)hp->len);
+
+		ipc_priv = rte_zmalloc(0, sizeof(ipc_userspace_t), 0);
+		if (ipc_priv == NULL) {
+			BBDEV_LA12XX_PMD_ERR(
+				"Unable to allocate memory for ipc priv");
+			ret = -ENOMEM;
+			goto err;
+		}
+
+		for (i = 0; i < IPC_MAX_CHANNEL_COUNT; i++) {
+			ipc_priv_ch = rte_zmalloc(0,
+				sizeof(ipc_channel_us_t), 0);
+			if (ipc_priv_ch == NULL) {
+				BBDEV_LA12XX_PMD_ERR(
+					"Unable to allocate memory for channels");
+				ret = -ENOMEM;
+			}
+			ipc_priv->channels[i] = ipc_priv_ch;
+		}
+
+		dev_mem = open("/dev/mem", O_RDWR);
+		if (dev_mem < 0) {
+			BBDEV_LA12XX_PMD_ERR("Error: Cannot open /dev/mem");
+			ret = -errno;
+			goto err;
+		}
+
+		ipc_priv->instance_id = 0;
+		ipc_priv->dev_mem = dev_mem;
+
+		ipc_priv->sys_map.hugepg_start.host_phys = hp->paddr;
+		ipc_priv->sys_map.hugepg_start.size = hp->len;
+
+		ipc_priv->hugepg_start.host_phys = hp->paddr;
+		ipc_priv->hugepg_start.host_vaddr = hp->vaddr;
+		ipc_priv->hugepg_start.size = hp->len;
+
+		rte_free(hp);
+	}
+
+	dev_ipc = open_ipc_dev(priv->modem_id);
+	if (dev_ipc < 0) {
+		BBDEV_LA12XX_PMD_ERR("Error: open_ipc_dev failed");
+		goto err;
+	}
+	ipc_priv->dev_ipc = dev_ipc;
+
+	/* Send IOCTL to get system map */
+	/* Send IOCTL to put hugepg_start map */
+	ret = ioctl(ipc_priv->dev_ipc, IOCTL_GUL_IPC_GET_SYS_MAP,
+		    &ipc_priv->sys_map);
+	if (ret) {
+		BBDEV_LA12XX_PMD_ERR(
+			"IOCTL_GUL_IPC_GET_SYS_MAP ioctl failed");
+		goto err;
+	}
+
+	phy_align = (ipc_priv->sys_map.mhif_start.host_phys % 0x1000);
+	ipc_priv->mhif_start.host_vaddr =
+		mmap(0, ipc_priv->sys_map.mhif_start.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.mhif_start.host_phys - phy_align));
+	if (ipc_priv->mhif_start.host_vaddr == MAP_FAILED) {
+		BBDEV_LA12XX_PMD_ERR("MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->mhif_start.host_vaddr = (void *)((size_t)
+		(ipc_priv->mhif_start.host_vaddr) + phy_align);
+
+	phy_align = (ipc_priv->sys_map.peb_start.host_phys % 0x1000);
+	ipc_priv->peb_start.host_vaddr =
+		mmap(0, ipc_priv->sys_map.peb_start.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.peb_start.host_phys - phy_align));
+	if (ipc_priv->peb_start.host_vaddr == MAP_FAILED) {
+		BBDEV_LA12XX_PMD_ERR("MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->peb_start.host_vaddr = (void *)((size_t)
+		(ipc_priv->peb_start.host_vaddr) + phy_align);
+
+	phy_align = (ipc_priv->sys_map.modem_ccsrbar.host_phys % 0x1000);
+	ipc_priv->modem_ccsrbar.host_vaddr =
+		mmap(0, ipc_priv->sys_map.modem_ccsrbar.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.modem_ccsrbar.host_phys - phy_align));
+	if (ipc_priv->modem_ccsrbar.host_vaddr == MAP_FAILED) {
+		BBDEV_LA12XX_PMD_ERR("MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->modem_ccsrbar.host_vaddr = (void *)((size_t)
+		(ipc_priv->modem_ccsrbar.host_vaddr) + phy_align);
+
+	ipc_priv->hugepg_start.modem_phys =
+		ipc_priv->sys_map.hugepg_start.modem_phys;
+
+	ipc_priv->mhif_start.host_phys =
+		ipc_priv->sys_map.mhif_start.host_phys;
+	ipc_priv->mhif_start.size = ipc_priv->sys_map.mhif_start.size;
+	ipc_priv->peb_start.host_phys = ipc_priv->sys_map.peb_start.host_phys;
+	ipc_priv->peb_start.size = ipc_priv->sys_map.peb_start.size;
+
+	BBDEV_LA12XX_PMD_INFO("peb 0x%" PRIx64 " %p %x",
+			ipc_priv->peb_start.host_phys,
+			ipc_priv->peb_start.host_vaddr,
+			ipc_priv->peb_start.size);
+	BBDEV_LA12XX_PMD_INFO("hugepg 0x%" PRIx64 " %p %x",
+			ipc_priv->hugepg_start.host_phys,
+			ipc_priv->hugepg_start.host_vaddr,
+			ipc_priv->hugepg_start.size);
+	BBDEV_LA12XX_PMD_INFO("mhif 0x%" PRIx64 " %p %x",
+			ipc_priv->mhif_start.host_phys,
+			ipc_priv->mhif_start.host_vaddr,
+			ipc_priv->mhif_start.size);
+	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+
+	/* offset is from start of PEB */
+	ipc_md = (ipc_metadata_t *)((size_t)ipc_priv->peb_start.host_vaddr +
+			mhif->ipc_regs.ipc_mdata_offset);
+
+	if (sizeof(ipc_metadata_t) != mhif->ipc_regs.ipc_mdata_size) {
+		BBDEV_LA12XX_PMD_ERR(
+			"\n ipc_metadata_t=%d mhif->ipc_regs.ipc_mdata_size=%x",
+			(int)sizeof(ipc_metadata_t),
+			mhif->ipc_regs.ipc_mdata_size);
+		BBDEV_LA12XX_PMD_ERR(
+			"--> mhif->ipc_regs.ipc_mdata_offset= %x",
+			mhif->ipc_regs.ipc_mdata_offset);
+		BBDEV_LA12XX_PMD_ERR(
+			"gul_hif size=%d", (int)sizeof(struct gul_hif));
+		return IPC_MD_SZ_MISS_MATCH;
+	}
+
+	ipc_priv->instance = (ipc_instance_t *)
+		(&ipc_md->instance_list[ipc_priv->instance_id]);
+
+	BBDEV_LA12XX_PMD_DEBUG("finish host init");
+
+	priv->ipc_priv = ipc_priv;
+
+	return 0;
+
+err:
+	rte_free(hp);
+	rte_free(ipc_priv);
+	rte_free(ipc_priv_ch);
+	if (dev_mem)
+		close(dev_mem);
+	if (dev_ipc)
+		close(dev_ipc);
+
+	return ret;
+}
+
 static inline int
 parse_u16_arg(const char *key, const char *value, void *extra_args)
 {
@@ -123,6 +678,7 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
 	struct bbdev_la12xx_private *priv;
+	int ret;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -152,7 +708,13 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 
 	BBDEV_LA12XX_PMD_INFO("Setting Up %s: DevId=%d, ModemId=%d",
 				name, bbdev->data->dev_id, priv->modem_id);
-	bbdev->dev_ops = NULL;
+	ret = setup_la12xx_dev(bbdev);
+	if (ret) {
+		BBDEV_LA12XX_PMD_ERR("IPC Setup failed for %s", name);
+		rte_free(bbdev->data->dev_private);
+		return ret;
+	}
+	bbdev->dev_ops = &pmd_ops;
 	bbdev->device = &vdev->device;
 	bbdev->data->socket_id = 0;
 	bbdev->intr_handle = NULL;
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.h b/drivers/baseband/la12xx/bbdev_la12xx.h
index 5228502331..c94f08e059 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx.h
@@ -14,7 +14,7 @@
 #define MAX_CHANNEL_DEPTH 16
 /* private data structure */
 struct bbdev_la12xx_private {
-	void *ipc_priv;
+	ipc_userspace_t *ipc_priv;
 	uint8_t num_valid_queues;
 	uint8_t max_nb_queues;
 	uint8_t num_ldpc_enc_queues;
@@ -52,5 +52,6 @@ struct bbdev_la12xx_q_priv {
 
 #define lower_32_bits(x) ((uint32_t)((uint64_t)x))
 #define upper_32_bits(x) ((uint32_t)(((uint64_t)(x) >> 16) >> 16))
-
+#define join_32_bits(upper, lower) \
+	((size_t)(((uint64_t)(upper) << 32) | (uint32_t)(lower)))
 #endif
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
index 9aa5562981..9d5789f726 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -4,9 +4,175 @@
 #ifndef __BBDEV_LA12XX_IPC_H__
 #define __BBDEV_LA12XX_IPC_H__
 
+#define LA12XX_MAX_QUEUES 20
+
+/** No. of max channel per instance */
+#define IPC_MAX_CHANNEL_COUNT	(64)
+
 /** No. of max channel per instance */
 #define IPC_MAX_DEPTH	(16)
 
+/** No. of max IPC instance per modem */
+#define IPC_MAX_INSTANCE_COUNT	(1)
+
+#define HOST_RX_QUEUEID_OFFSET LA12XX_MAX_QUEUES
+
+#define MAX_MEM_POOL_COUNT 8
+
+/** Error codes */
+#define IPC_SUCCESS		(0) /** IPC operation success */
+#define IPC_INPUT_INVALID	(-1) /** Invalid input to API */
+#define IPC_CH_INVALID		(-2) /** Channel no is invalid */
+#define IPC_INSTANCE_INVALID	(-3) /** Instance no is invalid */
+#define IPC_MEM_INVALID		(-4) /** Insufficient memory */
+#define IPC_CH_FULL		(-5) /** Channel is full */
+#define IPC_CH_EMPTY		(-6) /** Channel is empty */
+#define IPC_BL_EMPTY		(-7) /** Free buffer list is empty */
+#define IPC_BL_FULL		(-8) /** Free buffer list is full */
+#define IPC_HOST_BUF_ALLOC_FAIL	(-9) /** DPDK malloc fail */
+#define IPC_MD_SZ_MISS_MATCH	(-10) /** META DATA sz in mhif miss matched*/
+#define IPC_MALLOC_FAIL		(-11) /** system malloc fail */
+#define IPC_IOCTL_FAIL		(-12) /** IOCTL call failed */
+#define IPC_MMAP_FAIL		(-14) /** MMAP fail */
+#define IPC_OPEN_FAIL		(-15) /** OPEN fail */
+#define IPC_EVENTFD_FAIL	(-16) /** eventfd initialization failed */
+#define IPC_NOT_IMPLEMENTED	(-17) /** IPC feature is not implemented yet*/
+
+#define SET_HIF_HOST_RDY(hif, RDY_MASK) (hif->host_ready |= RDY_MASK)
+#define CHK_HIF_MOD_RDY(hif, RDY_MASK) (hif->mod_ready & RDY_MASK)
+
+/* Host Ready bits */
+#define HIF_HOST_READY_HOST_REGIONS	(1 << 0)
+#define HIF_HOST_READY_IPC_LIB		(1 << 12)
+#define HIF_HOST_READY_IPC_APP		(1 << 13)
+#define HIF_HOST_READY_FECA		(1 << 14)
+
+/* Modem Ready bits */
+#define HIF_MOD_READY_IPC_LIB		(1 << 5)
+#define HIF_MOD_READY_IPC_APP		(1 << 6)
+#define HIF_MOD_READY_FECA		(1 << 7)
+
+typedef void *ipc_t;
+
+struct ipc_msg {
+	int chid;
+	void *addr;
+	uint32_t len;
+	uint8_t flags;
+};
+
+typedef struct {
+	uint64_t host_phys;
+	uint32_t modem_phys;
+	void    *host_vaddr;
+	uint32_t size;
+} mem_range_t;
+
+#define GUL_IPC_MAGIC	'R'
+
+#define IOCTL_GUL_IPC_GET_SYS_MAP _IOW(GUL_IPC_MAGIC, 1, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_REGISTER _IOWR(GUL_IPC_MAGIC, 4, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_DEREGISTER \
+	_IOWR(GUL_IPC_MAGIC, 5, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_RAISE_INTERRUPT _IOW(GUL_IPC_MAGIC, 6, int *)
+
+/** buffer ring common metadata */
+typedef struct ipc_bd_ring_md {
+	volatile uint32_t pi;		/**< Producer index and flag (MSB)
+					  *  which flip for each Ring wrapping
+					  */
+	volatile uint32_t ci;		/**< Consumer index and flag (MSB)
+					  *  which flip for each Ring wrapping
+					  */
+	uint32_t ring_size;	/**< depth (Used to roll-over pi/ci) */
+	uint32_t msg_size;	/**< Size of the each buffer */
+} __rte_packed ipc_br_md_t;
+
+/** IPC buffer descriptor */
+typedef struct ipc_buffer_desc {
+	union {
+		uint64_t host_virt;	/**< msg's host virtual address */
+		struct {
+			uint32_t host_virt_l;
+			uint32_t host_virt_h;
+		};
+	};
+	uint64_t host_phy;	/**< msg's host physical address */
+	uint32_t modem_ptr;	/**< msg's modem physical address */
+	uint32_t len;		/**< msg len */
+	uint64_t crc;		/**< crc */
+} __rte_packed ipc_bd_t;
+
+typedef struct ipc_channel {
+	uint32_t ch_id;		/**< Channel id */
+	uint32_t bl_initialized;/**< Set when buffer list is initialized */
+	ipc_br_md_t md;
+	ipc_bd_t bd[IPC_MAX_DEPTH];
+	uint32_t op_type;/* BBDEV operation supported on this channel */
+	uint32_t depth;	/* Channel depth */
+	uint32_t feca_blk_id;/* FECA Transport Block ID for processing */
+	uint32_t la12xx_core_id;/* LA12xx core ID to scheduled work for it*/
+	uint32_t host_ipc_params;/* Address for host IPC parameters */
+} __rte_packed ipc_ch_t;
+
+typedef struct ipc_instance {
+	uint32_t initialized;		/**< Set in ipc_init */
+	ipc_ch_t ch_list[IPC_MAX_CHANNEL_COUNT];
+		/**< Channel descriptors in this instance */
+} __rte_packed ipc_instance_t;
+
+typedef struct ipc_metadata {
+	ipc_instance_t instance_list[IPC_MAX_INSTANCE_COUNT];
+} __rte_packed ipc_metadata_t;
+
+typedef struct ipc_channel_us_priv {
+	int32_t		eventfd;
+	uint32_t	channel_id;
+	/* In flight packets status for buffer list. */
+	uint8_t		bufs_inflight[IPC_MAX_DEPTH];
+} ipc_channel_us_t;
+
+typedef struct {
+	uint64_t host_phys;
+	uint32_t modem_phys;
+	uint32_t size;
+} mem_strt_addr_t;
+
+typedef struct {
+	mem_strt_addr_t modem_ccsrbar;
+	mem_strt_addr_t peb_start; /* PEB meta data */
+	mem_strt_addr_t mhif_start; /* MHIF meta daat */
+	mem_strt_addr_t hugepg_start; /* Modem to access hugepage */
+} sys_map_t;
+
+typedef struct ipc_priv_t {
+	int instance_id;
+	int dev_ipc;
+	int dev_mem;
+	struct rte_mempool *rtemempool[MAX_MEM_POOL_COUNT];
+	sys_map_t sys_map;
+	mem_range_t modem_ccsrbar;
+	mem_range_t peb_start;
+	mem_range_t mhif_start;
+	mem_range_t hugepg_start;
+	ipc_channel_us_t *channels[IPC_MAX_CHANNEL_COUNT];
+	ipc_instance_t	*instance;
+} ipc_userspace_t;
+
+/** Structure specifying enqueue operation (enqueue at LA1224) */
+struct bbdev_ipc_enqueue_op {
+	/** Status of operation that was performed */
+	int32_t status;
+	/** CRC Status of SD operation that was performed */
+	int32_t crc_stat_addr;
+	/** HARQ Output buffer memory length for Shared Decode.
+	 * Filled by LA12xx.
+	 */
+	uint32_t out_len;
+	/** Reserved (for 8 byte alignment) */
+	uint32_t rsvd;
+};
+
 /* This shared memory would be on the host side which have copy of some
  * of the parameters which are also part of Shared BD ring. Read access
  * of these parameters from the host side would not be over PCI.
@@ -17,4 +183,18 @@ typedef struct host_ipc_params {
 	volatile uint32_t modem_ptr[IPC_MAX_DEPTH];
 } __rte_packed host_ipc_params_t;
 
+struct hif_ipc_regs {
+	uint32_t ipc_mdata_offset;
+	uint32_t ipc_mdata_size;
+} __rte_packed;
+
+struct gul_hif {
+	uint32_t ver;
+	uint32_t hif_ver;
+	uint32_t status;
+	volatile uint32_t host_ready;
+	volatile uint32_t mod_ready;
+	struct hif_ipc_regs ipc_regs;
+} __rte_packed;
+
 #endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v3 5/8] baseband/la12xx: add enqueue and dequeue support
  2021-04-13  5:17   ` [dpdk-dev] [PATCH v3 0/8] baseband: add NXP LA12xx driver Hemant Agrawal
                       ` (3 preceding siblings ...)
  2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 4/8] baseband/la12xx: add queue and modem config support Hemant Agrawal
@ 2021-04-13  5:17     ` Hemant Agrawal
  2021-04-14  0:53       ` Chautru, Nicolas
  2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 6/8] baseband/la12xx: add documentation support Hemant Agrawal
                       ` (3 subsequent siblings)
  8 siblings, 1 reply; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-13  5:17 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, Hemant Agrawal, Nipun Gupta

Add support for enqueue and dequeue the LDPC enc/dec
from the modem device.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c     | 397 ++++++++++++++++++++-
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h |  37 ++
 2 files changed, 430 insertions(+), 4 deletions(-)

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 0a68686205..d1040987b2 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -117,6 +117,10 @@ la12xx_queue_release(struct rte_bbdev *dev, uint16_t q_id)
 		((uint64_t) ((unsigned long) (A) \
 		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
 
+#define MODEM_P2V(A) \
+	((uint64_t) ((unsigned long) (A) \
+		+ (unsigned long)(ipc_priv->peb_start.host_vaddr)))
+
 static int ipc_queue_configure(uint32_t channel_id,
 		ipc_t instance, struct bbdev_la12xx_q_priv *q_priv)
 {
@@ -345,6 +349,387 @@ static const struct rte_bbdev_ops pmd_ops = {
 	.queue_release = la12xx_queue_release,
 	.start = la12xx_start
 };
+
+static int
+fill_feca_desc_enc(struct bbdev_la12xx_q_priv *q_priv,
+		   struct bbdev_ipc_dequeue_op *bbdev_ipc_op,
+		   struct rte_bbdev_enc_op *bbdev_enc_op,
+		   struct rte_bbdev_op_data *in_op_data)
+{
+	RTE_SET_USED(q_priv);
+	RTE_SET_USED(bbdev_ipc_op);
+	RTE_SET_USED(bbdev_enc_op);
+	RTE_SET_USED(in_op_data);
+
+	return 0;
+}
+
+static int
+fill_feca_desc_dec(struct bbdev_la12xx_q_priv *q_priv,
+		   struct bbdev_ipc_dequeue_op *bbdev_ipc_op,
+		   struct rte_bbdev_dec_op *bbdev_dec_op,
+		   struct rte_bbdev_op_data *out_op_data)
+{
+	RTE_SET_USED(q_priv);
+	RTE_SET_USED(bbdev_ipc_op);
+	RTE_SET_USED(bbdev_dec_op);
+	RTE_SET_USED(out_op_data);
+
+	return 0;
+}
+
+static inline int
+is_bd_ring_full(uint32_t ci, uint32_t ci_flag,
+		uint32_t pi, uint32_t pi_flag)
+{
+	if (pi == ci) {
+		if (pi_flag != ci_flag)
+			return 1; /* Ring is Full */
+	}
+	return 0;
+}
+
+static inline int
+prepare_ldpc_enc_op(struct rte_bbdev_enc_op *bbdev_enc_op,
+		    struct bbdev_ipc_dequeue_op *bbdev_ipc_op,
+		    struct bbdev_la12xx_q_priv *q_priv,
+		    struct rte_bbdev_op_data *in_op_data,
+		    struct rte_bbdev_op_data *out_op_data)
+{
+	struct rte_bbdev_op_ldpc_enc *ldpc_enc = &bbdev_enc_op->ldpc_enc;
+	uint32_t total_out_bits;
+	int ret;
+
+	total_out_bits = (ldpc_enc->tb_params.cab *
+		ldpc_enc->tb_params.ea) + (ldpc_enc->tb_params.c -
+		ldpc_enc->tb_params.cab) * ldpc_enc->tb_params.eb;
+
+	ldpc_enc->output.length = (total_out_bits + 7)/8;
+
+	ret = fill_feca_desc_enc(q_priv, bbdev_ipc_op,
+				 bbdev_enc_op, in_op_data);
+	if (ret) {
+		BBDEV_LA12XX_PMD_ERR(
+			"fill_feca_desc_enc failed, ret: %d", ret);
+		return ret;
+	}
+
+	rte_pktmbuf_append(out_op_data->data, ldpc_enc->output.length);
+
+	return 0;
+}
+
+static inline int
+prepare_ldpc_dec_op(struct rte_bbdev_dec_op *bbdev_dec_op,
+		    struct bbdev_ipc_dequeue_op *bbdev_ipc_op,
+		    struct bbdev_la12xx_q_priv *q_priv,
+		    struct rte_bbdev_op_data *out_op_data)
+{
+	struct rte_bbdev_op_ldpc_dec *ldpc_dec = &bbdev_dec_op->ldpc_dec;
+	uint32_t total_out_bits;
+	uint32_t num_code_blocks = 0;
+	uint16_t sys_cols;
+	int ret;
+
+	sys_cols = (ldpc_dec->basegraph == 1) ? 22 : 10;
+	if (ldpc_dec->tb_params.c == 1) {
+		total_out_bits = ((sys_cols * ldpc_dec->z_c) -
+				ldpc_dec->n_filler);
+		/* 5G-NR protocol uses 16 bit CRC when output packet
+		 * size <= 3824 (bits). Otherwise 24 bit CRC is used.
+		 * Adjust the output bits accordingly
+		 */
+		if (total_out_bits - 16 <= 3824)
+			total_out_bits -= 16;
+		else
+			total_out_bits -= 24;
+		ldpc_dec->hard_output.length = (total_out_bits / 8);
+	} else {
+		total_out_bits = (((sys_cols * ldpc_dec->z_c) -
+				ldpc_dec->n_filler - 24) *
+				ldpc_dec->tb_params.c);
+		ldpc_dec->hard_output.length = (total_out_bits / 8) - 3;
+	}
+
+	num_code_blocks = ldpc_dec->tb_params.c;
+
+	bbdev_ipc_op->num_code_blocks = rte_cpu_to_be_32(num_code_blocks);
+
+	ret = fill_feca_desc_dec(q_priv, bbdev_ipc_op,
+				 bbdev_dec_op, out_op_data);
+	if (ret) {
+		BBDEV_LA12XX_PMD_ERR("fill_feca_desc_dec failed, ret: %d", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+static int
+enqueue_single_op(struct bbdev_la12xx_q_priv *q_priv, void *bbdev_op)
+{
+	struct bbdev_la12xx_private *priv = q_priv->bbdev_priv;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	ipc_instance_t *ipc_instance = ipc_priv->instance;
+	struct bbdev_ipc_dequeue_op *bbdev_ipc_op;
+	struct rte_bbdev_op_ldpc_enc *ldpc_enc;
+	struct rte_bbdev_op_ldpc_dec *ldpc_dec;
+	uint32_t q_id = q_priv->q_id;
+	uint32_t ci, ci_flag, pi, pi_flag;
+	ipc_ch_t *ch = &(ipc_instance->ch_list[q_id]);
+	ipc_br_md_t *md = &(ch->md);
+	size_t virt;
+	char *huge_start_addr =
+		(char *)q_priv->bbdev_priv->ipc_priv->hugepg_start.host_vaddr;
+	struct rte_bbdev_op_data *in_op_data, *out_op_data;
+	char *data_ptr;
+	uint32_t l1_pcie_addr;
+	int ret;
+	uint32_t temp_ci;
+
+	temp_ci = q_priv->host_params->ci;
+	ci = IPC_GET_CI_INDEX(temp_ci);
+	ci_flag = IPC_GET_CI_FLAG(temp_ci);
+
+	pi = IPC_GET_PI_INDEX(q_priv->host_pi);
+	pi_flag = IPC_GET_PI_FLAG(q_priv->host_pi);
+
+	BBDEV_LA12XX_PMD_DP_DEBUG(
+		"before bd_ring_full: pi: %u, ci: %u, pi_flag: %u, ci_flag: %u, ring size: %u",
+		pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	if (is_bd_ring_full(ci, ci_flag, pi, pi_flag)) {
+		BBDEV_LA12XX_PMD_DP_DEBUG(
+				"bd ring full for queue id: %d", q_id);
+		return IPC_CH_FULL;
+	}
+
+	virt = MODEM_P2V(q_priv->host_params->modem_ptr[pi]);
+	bbdev_ipc_op = (struct bbdev_ipc_dequeue_op *)virt;
+	q_priv->bbdev_op[pi] = bbdev_op;
+
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		ldpc_enc = &(((struct rte_bbdev_enc_op *)bbdev_op)->ldpc_enc);
+		in_op_data = &ldpc_enc->input;
+		out_op_data = &ldpc_enc->output;
+
+		ret = prepare_ldpc_enc_op(bbdev_op, bbdev_ipc_op, q_priv,
+					  in_op_data, out_op_data);
+		if (ret) {
+			BBDEV_LA12XX_PMD_ERR(
+				"process_ldpc_enc_op failed, ret: %d", ret);
+			return ret;
+		}
+		break;
+
+	case RTE_BBDEV_OP_LDPC_DEC:
+		ldpc_dec = &(((struct rte_bbdev_dec_op *)bbdev_op)->ldpc_dec);
+		in_op_data = &ldpc_dec->input;
+
+			out_op_data = &ldpc_dec->hard_output;
+
+		ret = prepare_ldpc_dec_op(bbdev_op, bbdev_ipc_op,
+					  q_priv, out_op_data);
+		if (ret) {
+			BBDEV_LA12XX_PMD_ERR(
+				"process_ldpc_dec_op failed, ret: %d", ret);
+			return ret;
+		}
+		break;
+
+	default:
+		BBDEV_LA12XX_PMD_ERR("unsupported bbdev_ipc op type");
+		return -1;
+	}
+
+	if (in_op_data->data) {
+		data_ptr = rte_pktmbuf_mtod(in_op_data->data, char *);
+		l1_pcie_addr = (uint32_t)GUL_USER_HUGE_PAGE_ADDR +
+			       data_ptr - huge_start_addr;
+		bbdev_ipc_op->in_addr = l1_pcie_addr;
+		bbdev_ipc_op->in_len = in_op_data->length;
+	}
+
+	if (out_op_data->data) {
+		data_ptr = rte_pktmbuf_mtod(out_op_data->data, char *);
+		l1_pcie_addr = (uint32_t)GUL_USER_HUGE_PAGE_ADDR +
+				data_ptr - huge_start_addr;
+		bbdev_ipc_op->out_addr = rte_cpu_to_be_32(l1_pcie_addr);
+		bbdev_ipc_op->out_len = rte_cpu_to_be_32(out_op_data->length);
+	}
+
+	/* Move Producer Index forward */
+	pi++;
+	/* Flip the PI flag, if wrapping */
+	if (unlikely(q_priv->queue_size == pi)) {
+		pi = 0;
+		pi_flag = pi_flag ? 0 : 1;
+	}
+
+	if (pi_flag)
+		IPC_SET_PI_FLAG(pi);
+	else
+		IPC_RESET_PI_FLAG(pi);
+	/* Wait for Data Copy & pi_flag update to complete before updating pi */
+	rte_mb();
+	/* now update pi */
+	md->pi = rte_cpu_to_be_32(pi);
+	q_priv->host_pi = pi;
+
+	BBDEV_LA12XX_PMD_DP_DEBUG(
+			"enter: pi: %u, ci: %u, pi_flag: %u, ci_flag: %u, ring size: %u",
+			pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	return 0;
+}
+
+/* Enqueue decode burst */
+static uint16_t
+enqueue_dec_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_dec_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	int nb_enqueued, ret;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ret = enqueue_single_op(q_priv, ops[nb_enqueued]);
+		if (ret)
+			break;
+	}
+
+	q_data->queue_stats.enqueue_err_count += nb_ops - nb_enqueued;
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
+/* Enqueue encode burst */
+static uint16_t
+enqueue_enc_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_enc_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	int nb_enqueued, ret;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ret = enqueue_single_op(q_priv, ops[nb_enqueued]);
+		if (ret)
+			break;
+	}
+
+	q_data->queue_stats.enqueue_err_count += nb_ops - nb_enqueued;
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
+static inline int
+is_bd_ring_empty(uint32_t ci, uint32_t ci_flag,
+		 uint32_t pi, uint32_t pi_flag)
+{
+	if (ci == pi) {
+		if (ci_flag == pi_flag)
+			return 1; /* No more Buffer */
+	}
+	return 0;
+}
+
+/* Dequeue encode burst */
+static void *
+dequeue_single_op(struct bbdev_la12xx_q_priv *q_priv, void *dst)
+{
+	struct bbdev_la12xx_private *priv = q_priv->bbdev_priv;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	uint32_t q_id = q_priv->q_id + HOST_RX_QUEUEID_OFFSET;
+	ipc_instance_t *ipc_instance = ipc_priv->instance;
+	ipc_ch_t *ch = &(ipc_instance->ch_list[q_id]);
+	uint32_t ci, ci_flag, pi, pi_flag;
+	ipc_br_md_t *md;
+	void *op;
+	uint32_t temp_pi;
+
+	md = &(ch->md);
+	ci = IPC_GET_CI_INDEX(q_priv->host_ci);
+	ci_flag = IPC_GET_CI_FLAG(q_priv->host_ci);
+
+	temp_pi = q_priv->host_params->pi;
+	pi = IPC_GET_PI_INDEX(temp_pi);
+	pi_flag = IPC_GET_PI_FLAG(temp_pi);
+
+	if (is_bd_ring_empty(ci, ci_flag, pi, pi_flag))
+		return NULL;
+
+	BBDEV_LA12XX_PMD_DP_DEBUG(
+		"pi: %u, ci: %u, pi_flag: %u, ci_flag: %u, ring size: %u",
+		pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	op = q_priv->bbdev_op[ci];
+
+	rte_memcpy(dst, q_priv->msg_ch_vaddr[ci],
+		sizeof(struct bbdev_ipc_enqueue_op));
+
+	/* Move Consumer Index forward */
+	ci++;
+	/* Flip the CI flag, if wrapping */
+	if (q_priv->queue_size == ci) {
+		ci = 0;
+		ci_flag = ci_flag ? 0 : 1;
+	}
+	if (ci_flag)
+		IPC_SET_CI_FLAG(ci);
+	else
+		IPC_RESET_CI_FLAG(ci);
+	md->ci = rte_cpu_to_be_32(ci);
+	q_priv->host_ci = ci;
+
+	BBDEV_LA12XX_PMD_DP_DEBUG(
+		"exit: pi: %u, ci: %u, pi_flag: %u, ci_flag: %u, ring size: %u",
+		pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	return op;
+}
+
+/* Dequeue decode burst */
+static uint16_t
+dequeue_dec_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_dec_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	struct bbdev_ipc_enqueue_op bbdev_ipc_op;
+	int nb_dequeued;
+
+	for (nb_dequeued = 0; nb_dequeued < nb_ops; nb_dequeued++) {
+		ops[nb_dequeued] = dequeue_single_op(q_priv, &bbdev_ipc_op);
+		if (!ops[nb_dequeued])
+			break;
+		ops[nb_dequeued]->status = bbdev_ipc_op.status;
+	}
+	q_data->queue_stats.dequeued_count += nb_dequeued;
+
+	return nb_dequeued;
+}
+
+/* Dequeue encode burst */
+static uint16_t
+dequeue_enc_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_enc_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	struct bbdev_ipc_enqueue_op bbdev_ipc_op;
+	int nb_enqueued;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ops[nb_enqueued] = dequeue_single_op(q_priv, &bbdev_ipc_op);
+		if (!ops[nb_enqueued])
+			break;
+		ops[nb_enqueued]->status = bbdev_ipc_op.status;
+	}
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
 static struct hugepage_info *
 get_hugepage_info(void)
 {
@@ -720,10 +1105,14 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 	bbdev->intr_handle = NULL;
 
 	/* register rx/tx burst functions for data path */
-	bbdev->dequeue_enc_ops = NULL;
-	bbdev->dequeue_dec_ops = NULL;
-	bbdev->enqueue_enc_ops = NULL;
-	bbdev->enqueue_dec_ops = NULL;
+	bbdev->dequeue_enc_ops = dequeue_enc_ops;
+	bbdev->dequeue_dec_ops = dequeue_dec_ops;
+	bbdev->enqueue_enc_ops = enqueue_enc_ops;
+	bbdev->enqueue_dec_ops = enqueue_dec_ops;
+	bbdev->dequeue_ldpc_enc_ops = dequeue_enc_ops;
+	bbdev->dequeue_ldpc_dec_ops = dequeue_dec_ops;
+	bbdev->enqueue_ldpc_enc_ops = enqueue_enc_ops;
+	bbdev->enqueue_ldpc_dec_ops = enqueue_dec_ops;
 
 	return 0;
 }
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
index 9d5789f726..4e181e9254 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -76,6 +76,25 @@ typedef struct {
 	_IOWR(GUL_IPC_MAGIC, 5, struct ipc_msg *)
 #define IOCTL_GUL_IPC_CHANNEL_RAISE_INTERRUPT _IOW(GUL_IPC_MAGIC, 6, int *)
 
+#define GUL_USER_HUGE_PAGE_OFFSET	(0)
+#define GUL_PCI1_ADDR_BASE	(0x00000000ULL)
+
+#define GUL_USER_HUGE_PAGE_ADDR	(GUL_PCI1_ADDR_BASE + GUL_USER_HUGE_PAGE_OFFSET)
+
+/* IPC PI/CI index & flag manipulation helpers */
+#define IPC_PI_CI_FLAG_MASK	0x80000000 /*  (1<<31) */
+#define IPC_PI_CI_INDEX_MASK	0x7FFFFFFF /* ~(1<<31) */
+
+#define IPC_SET_PI_FLAG(x)	(x |= IPC_PI_CI_FLAG_MASK)
+#define IPC_RESET_PI_FLAG(x)	(x &= IPC_PI_CI_INDEX_MASK)
+#define IPC_GET_PI_FLAG(x)	(x >> 31)
+#define IPC_GET_PI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
+
+#define IPC_SET_CI_FLAG(x)	(x |= IPC_PI_CI_FLAG_MASK)
+#define IPC_RESET_CI_FLAG(x)	(x &= IPC_PI_CI_INDEX_MASK)
+#define IPC_GET_CI_FLAG(x)	(x >> 31)
+#define IPC_GET_CI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
+
 /** buffer ring common metadata */
 typedef struct ipc_bd_ring_md {
 	volatile uint32_t pi;		/**< Producer index and flag (MSB)
@@ -173,6 +192,24 @@ struct bbdev_ipc_enqueue_op {
 	uint32_t rsvd;
 };
 
+/** Structure specifying dequeue operation (dequeue at LA1224) */
+struct bbdev_ipc_dequeue_op {
+	/** Input buffer memory address */
+	uint32_t in_addr;
+	/** Input buffer memory length */
+	uint32_t in_len;
+	/** Output buffer memory address */
+	uint32_t out_addr;
+	/** Output buffer memory length */
+	uint32_t out_len;
+	/* Number of code blocks. Only set when HARQ is used */
+	uint32_t num_code_blocks;
+	/** Dequeue Operation flags */
+	uint32_t op_flags;
+	/** Shared metadata between L1 and L2 */
+	uint32_t shared_metadata;
+};
+
 /* This shared memory would be on the host side which have copy of some
  * of the parameters which are also part of Shared BD ring. Read access
  * of these parameters from the host side would not be over PCI.
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v3 6/8] baseband/la12xx: add documentation support
  2021-04-13  5:17   ` [dpdk-dev] [PATCH v3 0/8] baseband: add NXP LA12xx driver Hemant Agrawal
                       ` (4 preceding siblings ...)
  2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 5/8] baseband/la12xx: add enqueue and dequeue support Hemant Agrawal
@ 2021-04-13  5:17     ` Hemant Agrawal
  2021-04-14  0:57       ` Chautru, Nicolas
  2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 7/8] app/bbdev: add parameter to take input in network order Hemant Agrawal
                       ` (2 subsequent siblings)
  8 siblings, 1 reply; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-13  5:17 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, Hemant Agrawal, Nipun Gupta

This patch add documentation for LA12xx PMD.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 MAINTAINERS                            |   9 ++
 doc/guides/bbdevs/features/la12xx.ini  |  14 +++
 doc/guides/bbdevs/index.rst            |   1 +
 doc/guides/bbdevs/la12xx.rst           | 139 +++++++++++++++++++++++++
 doc/guides/rel_notes/release_21_05.rst |   5 +
 5 files changed, 168 insertions(+)
 create mode 100644 doc/guides/bbdevs/features/la12xx.ini
 create mode 100644 doc/guides/bbdevs/la12xx.rst

diff --git a/MAINTAINERS b/MAINTAINERS
index e746ef1d32..24081fceb3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1289,6 +1289,15 @@ F: doc/guides/rawdevs/ntb.rst
 F: examples/ntb/
 F: doc/guides/sample_app_ug/ntb.rst
 
+Baseband Drivers
+-------------------
+
+NXP LA12xx
+M: Hemant Agrawal <hemant.agrawal@nxp.com>
+M: Nipun Gupta <nipun.gupta@nxp.com>
+F: drivers/baseband/la12xx/
+F: doc/guides/bbdevs/la12xx.rst
+F: doc/guides/bbdevs/features/la12xx.ini
 
 Packet processing
 -----------------
diff --git a/doc/guides/bbdevs/features/la12xx.ini b/doc/guides/bbdevs/features/la12xx.ini
new file mode 100644
index 0000000000..979d9dd224
--- /dev/null
+++ b/doc/guides/bbdevs/features/la12xx.ini
@@ -0,0 +1,14 @@
+;
+; Supported features of the 'la12xx' bbdev driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Turbo Decoder (4G)     = N
+Turbo Encoder (4G)     = N
+LDPC Decoder (5G)      = Y
+LDPC Encoder (5G)      = Y
+LLR/HARQ Compression   = N
+External DDR Access    = Y
+HW Accelerated         = Y
+BBDEV API              = Y
diff --git a/doc/guides/bbdevs/index.rst b/doc/guides/bbdevs/index.rst
index 4445cbd1b0..cedd706fa6 100644
--- a/doc/guides/bbdevs/index.rst
+++ b/doc/guides/bbdevs/index.rst
@@ -14,3 +14,4 @@ Baseband Device Drivers
     fpga_lte_fec
     fpga_5gnr_fec
     acc100
+    la12xx
diff --git a/doc/guides/bbdevs/la12xx.rst b/doc/guides/bbdevs/la12xx.rst
new file mode 100644
index 0000000000..1cadd6f337
--- /dev/null
+++ b/doc/guides/bbdevs/la12xx.rst
@@ -0,0 +1,139 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright 2021 NXP
+
+NXP LA12xx Poll Mode Driver
+=======================================
+
+The BBDEV LA12xx poll mode driver (PMD) supports an implementation for
+offloading High Phy processing functions like LDPC Encode / Decode 5GNR wireless
+acceleration function, using PCI based LA12xx Software defined radio.
+
+More information can be found at `NXP Official Website
+<https://www.nxp.com/products/processors-and-microcontrollers/arm-processors/layerscape-processors/layerscape-access-la1200-programmable-baseband-processor:LA1200>`_.
+
+Features
+--------
+
+LA12xx PMD supports the following features:
+
+- LDPC Encode in the DL
+- LDPC Decode in the UL
+- Maximum of 8 UL queues
+- Maximum of 8 DL queues
+- PCIe Gen-3 x8 Interface
+- MSI-X
+
+LA12xx PMD supports the following BBDEV capabilities:
+
+* For the LDPC encode operation:
+   - ``RTE_BBDEV_LDPC_CRC_24B_ATTACH`` :  set to attach CRC24B to CB(s)
+   - ``RTE_BBDEV_LDPC_RATE_MATCH`` :  if set then do not do Rate Match bypass
+
+* For the LDPC decode operation:
+   - ``RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK`` :  check CRC24B from CB(s)
+   - ``RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP`` :  drops CRC24B bits appended while decoding
+   - ``RTE_BBDEV_LDPC_DEC_SCATTER_GATHER`` :  supports scatter-gather for input/output data
+
+Installation
+------------
+
+Section 3 of the DPDK manual provides instructions on installing and compiling DPDK.
+
+DPDK requires hugepages to be configured as detailed in section 2 of the DPDK manual.
+
+Initialization
+--------------
+
+The device can be listed on the host console with:
+
+
+Use the following lspci command to get the multiple LA12xx processor ids. The
+device ID of the LA12xx baseband processor is "1c30".
+
+.. code-block:: console
+
+  sudo lspci -nn
+
+...
+0001:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device [1957:1c30] (
+rev 10)
+...
+0002:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device [1957:1c30] (
+rev 10)
+
+
+Prerequisites
+-------------
+
+Currently supported by DPDK:
+
+- NXP LA1224 BSP **1.0+**.
+- NXP LA1224 PCIe Modem card connected to ARM host.
+
+- Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup the basic DPDK environment.
+
+* Use dev arg option ``modem=0`` to identify the modem instance for a given
+  device. This is required only if more than 1 modem cards are attached to host.
+  this is optional and the default value is 0.
+  e.g. ``--vdev=baseband_la12xx,modem=0``
+
+* Use dev arg option ``max_nb_queues=x`` to specify the maximum number of queues
+  to be used for communication with offload device i.e. modem. default is 16.
+  e.g. ``--vdev=baseband_la12xx,max_nb_queues=4``
+
+Enabling logs
+-------------
+
+For enabling logs, use the following EAL parameter:
+
+.. code-block:: console
+
+   ./your_bbdev_application <EAL args> --log-level=la12xx:<level>
+
+Using ``bb.la12xx`` as log matching criteria, all Baseband PMD logs can be
+enabled which are lower than logging ``level``.
+
+
+Test Application
+----------------
+
+BBDEV provides a test application, ``test-bbdev.py`` and range of test data for testing
+the functionality of LA12xx for FEC encode and decode, depending on the device
+capabilities. The test application is located under app->test-bbdev folder and has the
+following options:
+
+.. code-block:: console
+
+  "-p", "--testapp-path": specifies path to the bbdev test app.
+  "-e", "--eal-params"	: EAL arguments which are passed to the test app.
+  "-t", "--timeout"	: Timeout in seconds (default=300).
+  "-c", "--test-cases"	: Defines test cases to run. Run all if not specified.
+  "-v", "--test-vector"	: Test vector path (default=dpdk_path+/app/test-bbdev/test_vectors/bbdev_null.data).
+  "-n", "--num-ops"	: Number of operations to process on device (default=32).
+  "-b", "--burst-size"	: Operations enqueue/dequeue burst size (default=32).
+  "-s", "--snr"		: SNR in dB used when generating LLRs for bler tests.
+  "-s", "--iter_max"	: Number of iterations for LDPC decoder.
+  "-l", "--num-lcores"	: Number of lcores to run (default=16).
+  "-i", "--init-device" : Initialise PF device with default values.
+
+
+To execute the test application tool using simple decode or encode data,
+type one of the following:
+
+.. code-block:: console
+
+  ./test-bbdev.py -e="--vdev=baseband_la12xx,socket_id=0,max_nb_queues=8" -c validation -n 64 -b 1 -v ./ldpc_dec_default.data
+  ./test-bbdev.py -e="--vdev=baseband_la12xx,socket_id=0,max_nb_queues=8" -c validation -n 64 -b 1 -v ./ldpc_enc_default.data
+
+The test application ``test-bbdev.py``, supports the ability to configure the PF device with
+a default set of values, if the "-i" or "- -init-device" option is included. The default values
+are defined in test_bbdev_perf.c.
+
+
+Test Vectors
+~~~~~~~~~~~~
+
+In addition to the simple LDPC decoder and LDPC encoder tests, bbdev also provides
+a range of additional tests under the test_vectors folder, which may be useful. The results
+of these tests will depend on the LA12xx FEC capabilities which may cause some
+testcases to be skipped, but no failure should be reported.
diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
index 6f5858c8f6..61797e2a43 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -130,6 +130,11 @@ New Features
   * Added command to display Rx queue used descriptor count.
     ``show port (port_id) rxq (queue_id) desc used count``
 
+* **Added NXP LA12xx baseband PMD.**
+
+  Added a new baseband PMD driver for NXP LA12xx Software defined radio.
+
+  See the :doc:`../bbdevs/la12xx` for more details.
 
 Removed Items
 -------------
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v3 7/8] app/bbdev: add parameter to take input in network order
  2021-04-13  5:17   ` [dpdk-dev] [PATCH v3 0/8] baseband: add NXP LA12xx driver Hemant Agrawal
                       ` (5 preceding siblings ...)
  2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 6/8] baseband/la12xx: add documentation support Hemant Agrawal
@ 2021-04-13  5:17     ` Hemant Agrawal
  2021-04-14  1:00       ` Chautru, Nicolas
  2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 8/8] app/bbdev: add test vectors for transport blocks Hemant Agrawal
  2021-04-13 10:06     ` [dpdk-dev] [EXT] [PATCH v3 0/8] baseband: add NXP LA12xx driver Akhil Goyal
  8 siblings, 1 reply; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-13  5:17 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, Nipun Gupta

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

Test bbdev application is reading the input and output from the
test vector files in the same endianness which is of the system.
This patch adds an option to provide data in the network order
i.e. big endian format

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 app/test-bbdev/test_bbdev_vector.c | 18 ++++++++++++++++--
 app/test-bbdev/test_bbdev_vector.h |  2 ++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/app/test-bbdev/test_bbdev_vector.c b/app/test-bbdev/test_bbdev_vector.c
index 50d1da00f7..fe04bd6b95 100644
--- a/app/test-bbdev/test_bbdev_vector.c
+++ b/app/test-bbdev/test_bbdev_vector.c
@@ -53,7 +53,8 @@ starts_with(const char *str, const char *pre)
 
 /* tokenization test values separated by a comma */
 static int
-parse_values(char *tokens, uint32_t **data, uint32_t *data_length)
+parse_values(char *tokens, uint32_t **data, uint32_t *data_length,
+	     int network_order)
 {
 	uint32_t n_tokens = 0;
 	uint32_t data_size = 32;
@@ -94,6 +95,14 @@ parse_values(char *tokens, uint32_t **data, uint32_t *data_length)
 		}
 
 		*data_length = *data_length + (strlen(tok) - strlen("0x"))/2;
+		if (network_order) {
+			if ((strlen(tok) - strlen("0x"))/2 == 4)
+				values[n_tokens] =
+					rte_cpu_to_be_32(values[n_tokens]);
+			else if ((strlen(tok) - strlen("0x"))/2 == 2)
+				values[n_tokens] =
+					rte_cpu_to_be_16(values[n_tokens]);
+		}
 
 		tok = strtok(NULL, VALUE_DELIMITER);
 		if (tok == NULL)
@@ -416,7 +425,8 @@ parse_data_entry(const char *key_token, char *token,
 	/* Clear new op data struct */
 	memset(op_data + *nb_ops, 0, sizeof(struct op_data_buf));
 
-	ret = parse_values(token, &data, &data_length);
+	ret = parse_values(token, &data, &data_length,
+			vector->network_order);
 	if (!ret) {
 		op_data[*nb_ops].addr = data;
 		op_data[*nb_ops].length = data_length;
@@ -728,6 +738,10 @@ parse_ldpc_encoder_params(const char *key_token, char *token,
 		ret = parse_expected_status(token, &status, vector->op_type);
 		if (!ret)
 			vector->expected_status = status;
+	} else if (!strcmp(key_token, "network_order")) {
+		vector->mask |= TEST_BBDEV_VF_NETWORK_ORDER;
+		vector->network_order = (uint8_t) strtoul(token, &err, 0);
+		ret = ((err == NULL) || (*err != '\0')) ? -1 : 0;
 	} else {
 		printf("Not valid ldpc enc key: '%s'\n", key_token);
 		return -1;
diff --git a/app/test-bbdev/test_bbdev_vector.h b/app/test-bbdev/test_bbdev_vector.h
index 4e5dbf5d50..aa53f0bb0d 100644
--- a/app/test-bbdev/test_bbdev_vector.h
+++ b/app/test-bbdev/test_bbdev_vector.h
@@ -35,6 +35,7 @@ enum {
 	TEST_BBDEV_VF_CODE_BLOCK_MODE = (1ULL << 23),
 	TEST_BBDEV_VF_OP_FLAGS = (1ULL << 24),
 	TEST_BBDEV_VF_EXPECTED_STATUS = (1ULL << 25),
+	TEST_BBDEV_VF_NETWORK_ORDER = (1ULL << 26),
 };
 
 enum op_data_type {
@@ -60,6 +61,7 @@ struct test_bbdev_vector {
 	enum rte_bbdev_op_type op_type;
 	int expected_status;
 	int mask;
+	int network_order;
 	union {
 		struct rte_bbdev_op_turbo_dec turbo_dec;
 		struct rte_bbdev_op_turbo_enc turbo_enc;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v3 8/8] app/bbdev: add test vectors for transport blocks
  2021-04-13  5:17   ` [dpdk-dev] [PATCH v3 0/8] baseband: add NXP LA12xx driver Hemant Agrawal
                       ` (6 preceding siblings ...)
  2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 7/8] app/bbdev: add parameter to take input in network order Hemant Agrawal
@ 2021-04-13  5:17     ` Hemant Agrawal
  2021-04-14  1:09       ` Chautru, Nicolas
  2021-04-13 10:06     ` [dpdk-dev] [EXT] [PATCH v3 0/8] baseband: add NXP LA12xx driver Akhil Goyal
  8 siblings, 1 reply; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-13  5:17 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, Nipun Gupta

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

This patch adds two test vectors for transport block in network byte
order:
- LDPC encode for Transport Block
- LDPC decode for Transport block

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 app/test-bbdev/test_vectors/ldpc_dec_tb.data | 362 ++++++++++++++
 app/test-bbdev/test_vectors/ldpc_enc_tb.data | 482 +++++++++++++++++++
 2 files changed, 844 insertions(+)
 create mode 100644 app/test-bbdev/test_vectors/ldpc_dec_tb.data
 create mode 100644 app/test-bbdev/test_vectors/ldpc_enc_tb.data

diff --git a/app/test-bbdev/test_vectors/ldpc_dec_tb.data b/app/test-bbdev/test_vectors/ldpc_dec_tb.data
new file mode 100644
index 0000000000..76b5105966
--- /dev/null
+++ b/app/test-bbdev/test_vectors/ldpc_dec_tb.data
@@ -0,0 +1,362 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020 NXP
+
+op_type =
+RTE_BBDEV_OP_LDPC_DEC
+
+network_order =
+1
+
+input0 =
+0x817f7f81, 0x81817f7f, 0x7f7f8181, 0x81817f81, 0x8181817f, 0x7f817f81, 0x7f817f81, 0x7f817f7f,
+0x7f818181, 0x7f817f7f, 0x81817f81, 0x817f7f7f, 0x81817f81, 0x81818181, 0x7f818181, 0x81818181,
+0x7f7f7f7f, 0x81818181, 0x7f81817f, 0x817f7f7f, 0x81817f7f, 0x817f817f, 0x81817f81, 0x7f817f81,
+0x7f7f7f7f, 0x7f7f8181, 0x7f818181, 0x81817f81, 0x7f818181, 0x817f8181, 0x817f8181, 0x7f7f7f7f,
+0x7f7f817f, 0x817f8181, 0x8181817f, 0x817f7f81, 0x7f818181, 0x81817f7f, 0x7f81817f, 0x7f7f7f7f,
+0x7f817f7f, 0x81818181, 0x7f81817f, 0x7f7f817f, 0x8181817f, 0x8181817f, 0x817f8181, 0x7f817f81,
+0x7f7f8181, 0x7f7f7f7f, 0x81817f81, 0x7f7f7f81, 0x7f81817f, 0x81817f7f, 0x81817f7f, 0x7f7f8181,
+0x817f817f, 0x7f817f7f, 0x7f7f7f7f, 0x817f8181, 0x81818181, 0x7f7f7f7f, 0x7f7f8181, 0x7f7f7f7f,
+0x7f817f81, 0x7f81817f, 0x7f818181, 0x817f817f, 0x81817f7f, 0x7f7f7f81, 0x7f7f7f81, 0x7f817f81,
+0x817f7f7f, 0x7f817f7f, 0x817f7f81, 0x7f7f7f7f, 0x7f817f81, 0x81817f7f, 0x7f817f7f, 0x7f7f7f81,
+0x7f817f7f, 0x7f7f7f81, 0x7f817f7f, 0x7f81817f, 0x817f7f81, 0x7f7f7f7f, 0x81818181, 0x7f7f8181,
+0x817f7f7f, 0x817f7f81, 0x81817f81, 0x7f817f81, 0x7f818181, 0x817f7f81, 0x7f817f7f, 0x7f818181,
+0x7f7f8181, 0x81817f81, 0x7f7f8181, 0x8181817f, 0x8181817f, 0x817f7f81, 0x8181817f, 0x7f7f817f,
+0x7f817f81, 0x817f7f7f, 0x81818181, 0x817f7f7f, 0x81817f81, 0x7f7f7f7f, 0x8181817f, 0x7f81817f,
+0x8181817f, 0x7f818181, 0x7f817f7f, 0x817f7f7f, 0x7f817f7f, 0x817f8181, 0x7f7f8181, 0x7f81817f,
+0x7f7f7f7f, 0x7f7f817f, 0x81818181, 0x7f818181, 0x81818181, 0x7f7f817f, 0x817f817f, 0x817f817f,
+0x7f7f7f81, 0x7f7f817f, 0x7f7f7f7f, 0x7f7f8181, 0x7f817f81, 0x7f7f7f81, 0x81817f7f, 0x7f817f81,
+0x817f817f, 0x7f7f7f7f, 0x81817f81, 0x817f8181, 0x7f817f7f, 0x7f81817f, 0x7f818181, 0x817f8181,
+0x7f81817f, 0x7f818181, 0x817f817f, 0x8181817f, 0x817f817f, 0x81817f7f, 0x817f817f, 0x7f81817f,
+0x8181817f, 0x7f817f81, 0x7f817f7f, 0x81817f81, 0x7f81817f, 0x817f8181, 0x7f818181, 0x7f7f7f7f,
+0x817f8181, 0x7f817f7f, 0x7f7f8181, 0x817f8181, 0x7f7f7f81, 0x817f8181, 0x81817f7f, 0x817f7f7f,
+0x81817f81, 0x81818181, 0x7f818181, 0x7f818181, 0x8181817f, 0x7f7f8181, 0x7f7f817f, 0x7f7f8181,
+0x81817f7f, 0x7f817f7f, 0x7f7f817f, 0x81818181, 0x7f817f81, 0x817f8181, 0x7f81817f, 0x7f7f7f7f,
+0x7f7f8181, 0x817f7f81, 0x7f7f8181, 0x817f817f, 0x7f818181, 0x7f7f8181, 0x7f7f7f7f, 0x8181817f,
+0x817f7f81, 0x7f7f7f81, 0x817f7f81, 0x8181817f, 0x817f8181, 0x7f817f7f, 0x7f7f7f81, 0x817f817f,
+0x81817f7f, 0x817f8181, 0x7f7f7f81, 0x7f81817f, 0x7f7f8181, 0x7f817f7f, 0x817f8181, 0x7f7f7f81,
+0x8181817f, 0x817f8181, 0x7f817f7f, 0x817f7f81, 0x7f818181, 0x7f7f7f81, 0x81817f7f, 0x817f8181,
+0x7f7f817f, 0x7f81817f, 0x817f7f81, 0x7f7f7f81, 0x7f81817f, 0x817f8181, 0x81818181, 0x817f817f,
+0x7f81817f, 0x817f8181, 0x7f817f81, 0x7f817f7f, 0x7f81817f, 0x7f7f817f, 0x7f81817f, 0x81817f81,
+0x817f817f, 0x81818181, 0x7f817f7f, 0x817f8181, 0x817f7f7f, 0x7f7f7f81, 0x817f8181, 0x7f818181,
+0x7f7f7f7f, 0x817f8181, 0x817f7f7f, 0x7f817f7f, 0x81817f7f, 0x81818181, 0x7f7f817f, 0x8181817f,
+0x8181817f, 0x8181817f, 0x81817f7f, 0x7f817f81, 0x817f8181, 0x8181817f, 0x7f81817f, 0x7f817f7f,
+0x7f817f81, 0x81818181, 0x8181817f, 0x7f81817f, 0x81818181, 0x7f7f7f81, 0x7f818181, 0x7f7f7f81,
+0x7f7f7f7f, 0x7f7f7f7f, 0x817f7f7f, 0x8181817f, 0x8181817f, 0x817f7f7f, 0x7f817f7f, 0x817f8181,
+0x817f7f7f, 0x817f8181, 0x7f7f817f, 0x817f817f, 0x817f8181, 0x81817f81, 0x81817f81, 0x81817f7f,
+0x7f81817f, 0x7f7f7f7f, 0x81817f81, 0x7f7f8181, 0x7f817f7f, 0x81818181, 0x7f7f817f, 0x81817f7f,
+0x817f817f, 0x7f817f7f, 0x7f7f817f, 0x7f7f7f81, 0x817f7f81, 0x7f7f7f7f, 0x817f8181, 0x7f818181,
+0x817f8181, 0x7f817f81, 0x7f7f7f7f, 0x8181817f, 0x81818181, 0x81817f7f, 0x817f7f7f, 0x817f8181,
+0x817f8181, 0x7f818181, 0x81818181, 0x7f818181, 0x7f817f7f, 0x81817f81, 0x817f7f7f, 0x817f7f81,
+0x817f7f81, 0x81817f81, 0x8181817f, 0x81817f81, 0x81817f81, 0x817f8181, 0x81818181, 0x81818181,
+0x81818181, 0x817f817f, 0x8181817f, 0x8181817f, 0x81817f81, 0x817f7f81, 0x817f7f81, 0x817f7f7f,
+0x7f7f8181, 0x7f7f817f, 0x7f7f8181, 0x7f817f7f, 0x7f818181, 0x81817f81, 0x7f817f81, 0x817f7f81,
+0x7f817f81, 0x817f817f, 0x8181817f, 0x81817f81, 0x7f7f817f, 0x817f8181, 0x7f81817f, 0x7f817f81,
+0x81817f7f, 0x7f7f8181, 0x7f7f817f, 0x7f7f8181, 0x7f7f7f7f, 0x7f7f7f81, 0x7f817f7f, 0x7f7f817f,
+0x7f7f8181, 0x7f7f817f, 0x7f7f817f, 0x8181817f, 0x81817f7f, 0x7f7f817f, 0x7f817f81, 0x7f7f817f,
+0x8181817f, 0x7f7f8181, 0x81817f7f, 0x817f817f, 0x8181817f, 0x817f7f81, 0x8181817f, 0x7f81817f,
+0x7f81817f, 0x817f817f, 0x7f7f7f81, 0x7f7f8181, 0x81817f7f, 0x7f7f7f81, 0x7f818181, 0x7f818181,
+0x7f7f7f81, 0x7f7f7f7f, 0x7f818181, 0x8181817f, 0x8181817f, 0x8181817f, 0x7f81817f, 0x81818181,
+0x7f818181, 0x7f7f817f, 0x7f817f7f, 0x7f818181, 0x817f8181, 0x7f7f817f, 0x7f818181, 0x7f818181,
+0x81817f81, 0x7f7f817f, 0x7f81817f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f817f81, 0x81817f81, 0x7f7f817f,
+0x7f817f7f, 0x817f817f, 0x7f818181, 0x81817f81, 0x7f81817f, 0x7f817f7f, 0x7f817f7f, 0x7f7f7f81,
+0x7f818181, 0x7f818181, 0x817f817f, 0x81818181, 0x817f817f, 0x81818181, 0x7f818181, 0x7f818181,
+0x7f7f817f, 0x817f7f7f, 0x7f817f7f, 0x7f7f817f, 0x7f7f7f7f, 0x7f7f8181, 0x817f7f81, 0x7f81817f,
+0x81817f81, 0x817f7f81, 0x8181817f, 0x817f817f, 0x7f817f7f, 0x7f817f81, 0x7f81817f, 0x7f818181,
+0x817f8181, 0x81817f7f, 0x817f7f7f, 0x817f8181, 0x7f818181, 0x817f7f7f, 0x817f7f7f, 0x7f7f817f,
+0x817f817f, 0x81817f81, 0x81818181, 0x7f7f7f81, 0x817f7f81, 0x817f7f81, 0x7f7f8181, 0x81818181,
+0x7f7f7f7f, 0x7f7f8181, 0x81817f81, 0x7f817f7f, 0x817f817f, 0x817f8181, 0x81817f81, 0x7f7f817f,
+0x7f817f7f, 0x7f818181, 0x81818181, 0x7f81817f, 0x7f7f7f81, 0x7f81817f, 0x7f7f817f, 0x8181817f,
+0x817f7f81, 0x817f817f, 0x7f7f8181, 0x817f7f81, 0x7f7f8181, 0x817f7f81, 0x7f7f8181, 0x81817f81,
+0x7f7f817f, 0x81818181, 0x8181817f, 0x7f818181, 0x817f817f, 0x7f817f81, 0x7f817f7f, 0x7f81817f,
+0x7f7f7f81, 0x817f7f81, 0x817f7f7f, 0x7f7f7f81, 0x817f7f81, 0x817f8181, 0x817f8181, 0x7f818181,
+0x7f7f8181, 0x7f817f7f, 0x81818181, 0x8181817f, 0x7f7f817f, 0x81817f7f, 0x817f817f, 0x81817f81,
+0x7f817f81, 0x7f7f7f7f, 0x8181817f, 0x817f7f81, 0x81817f81, 0x7f818181, 0x81818181, 0x7f7f8181,
+0x817f7f7f, 0x7f817f7f, 0x7f7f817f, 0x817f817f, 0x7f817f7f, 0x817f7f81, 0x7f7f8181, 0x7f7f7f81,
+0x81818181, 0x7f7f8181, 0x81818181, 0x817f7f81, 0x81818181, 0x817f7f81, 0x81817f7f, 0x7f7f817f,
+0x817f7f7f, 0x8181817f, 0x817f7f81, 0x81818181, 0x81817f81, 0x81818181, 0x7f81817f, 0x7f817f81,
+0x7f81817f, 0x7f817f7f, 0x7f81817f, 0x7f818181, 0x81817f7f, 0x7f81817f, 0x81817f7f, 0x817f7f7f,
+0x817f8181, 0x7f7f8181, 0x8181817f, 0x8181817f, 0x81817f7f, 0x817f817f, 0x7f81817f, 0x8181817f,
+0x7f818181, 0x817f7f7f, 0x7f818181, 0x817f8181, 0x81818181, 0x7f7f7f81, 0x7f7f8181, 0x7f817f7f,
+0x817f8181, 0x7f817f7f, 0x7f818181, 0x7f7f7f7f, 0x7f7f817f, 0x817f817f, 0x817f8181, 0x7f81817f,
+0x7f817f7f, 0x7f7f7f7f, 0x7f7f8181, 0x7f818181, 0x7f817f7f, 0x7f7f8181, 0x7f817f81, 0x7f7f817f,
+0x817f8181, 0x81817f81, 0x7f7f8181, 0x81817f81, 0x81817f7f, 0x817f7f7f, 0x817f8181, 0x7f818181,
+0x81818181, 0x7f817f7f, 0x81817f81, 0x817f7f7f, 0x817f7f81, 0x81817f7f, 0x817f817f, 0x7f817f81,
+0x7f7f8181, 0x81817f7f, 0x7f818181, 0x7f7f7f7f, 0x7f7f7f81, 0x7f817f81, 0x7f7f7f81, 0x7f7f8181,
+0x81817f81, 0x817f817f, 0x817f7f81, 0x7f7f817f, 0x81817f7f, 0x81817f81, 0x817f7f81, 0x7f818181,
+0x817f817f, 0x7f81817f, 0x8181817f, 0x8181817f, 0x7f818181, 0x817f7f81, 0x81818181, 0x817f7f81,
+0x817f7f7f, 0x8181817f, 0x8181817f, 0x7f817f7f, 0x81818181, 0x7f7f7f81, 0x7f7f7f7f, 0x7f818181,
+0x817f7f7f, 0x7f7f817f, 0x7f7f7f81, 0x7f7f7f81, 0x7f817f81, 0x7f817f7f, 0x7f817f81, 0x817f7f81,
+0x81817f81, 0x8181817f, 0x7f81817f, 0x81818181, 0x7f7f7f7f, 0x817f7f81, 0x7f7f817f, 0x81818181,
+0x817f817f, 0x7f818181, 0x817f7f81, 0x817f817f, 0x817f8181, 0x7f7f7f7f, 0x81817f81, 0x7f7f8181,
+0x8181817f, 0x81817f7f, 0x7f818181, 0x81817f7f, 0x81817f81, 0x7f81817f, 0x7f81817f, 0x817f7f7f,
+0x7f817f81, 0x8181817f, 0x81817f81, 0x7f818181, 0x8181817f, 0x81817f81, 0x81817f81, 0x7f7f8181,
+0x7f818181, 0x817f8181, 0x81817f81, 0x7f818181, 0x7f818181, 0x81818181, 0x7f7f8181, 0x81817f7f,
+0x7f7f8181, 0x7f818181, 0x7f818181, 0x8181817f, 0x7f817f81, 0x8181817f, 0x7f817f7f, 0x817f817f,
+0x7f817f81, 0x81818181, 0x817f7f81, 0x8181817f, 0x7f7f817f, 0x7f7f7f81, 0x817f7f81, 0x7f7f8181,
+0x7f817f81, 0x81817f81, 0x81818181, 0x7f7f7f81, 0x817f8181, 0x81817f7f, 0x817f7f7f, 0x7f7f817f,
+0x8181817f, 0x7f817f81, 0x817f8181, 0x817f7f7f, 0x81817f81, 0x817f8181, 0x7f817f81, 0x8181817f,
+0x81817f81, 0x817f817f, 0x817f8181, 0x81817f81, 0x7f817f81, 0x7f818181, 0x7f7f7f81, 0x7f7f8181,
+0x7f7f817f, 0x8181817f, 0x7f817f7f, 0x817f8181, 0x817f8181, 0x817f817f, 0x7f7f817f, 0x81817f7f,
+0x817f7f81, 0x7f818181, 0x7f7f7f7f, 0x7f818181, 0x81818181, 0x7f818181, 0x7f818181, 0x8181817f,
+0x81817f81, 0x7f7f7f81, 0x817f7f81, 0x817f8181, 0x81817f7f, 0x7f81817f, 0x7f7f817f, 0x817f8181,
+0x81817f81, 0x817f7f7f, 0x817f817f, 0x7f81817f, 0x817f817f, 0x817f7f7f, 0x81817f7f, 0x817f7f81,
+0x817f817f, 0x7f7f7f7f, 0x8181817f, 0x7f817f81, 0x7f817f81, 0x81817f81, 0x7f817f7f, 0x7f817f7f,
+0x7f817f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x81817f81, 0x817f7f81, 0x7f7f7f81, 0x81817f81, 0x7f7f817f,
+0x817f8181, 0x7f817f81, 0x8181817f, 0x7f7f8181, 0x817f8181, 0x7f81817f, 0x8181817f, 0x7f7f8181,
+0x81817f81, 0x7f818181, 0x7f817f81, 0x7f7f7f7f, 0x7f7f8181, 0x7f818181, 0x8181817f, 0x7f7f7f7f,
+0x817f817f, 0x81817f7f, 0x7f81817f, 0x7f7f7f7f, 0x7f81817f, 0x7f81817f, 0x817f817f, 0x817f7f81,
+0x7f817f81, 0x7f817f7f, 0x81817f7f, 0x817f7f7f, 0x817f7f7f, 0x7f817f81, 0x7f7f817f, 0x7f81817f,
+0x81818181, 0x817f7f81, 0x7f7f8181, 0x7f7f7f7f, 0x7f7f8181, 0x7f7f817f, 0x817f7f7f, 0x7f817f81,
+0x7f817f7f, 0x7f7f817f, 0x81817f81, 0x7f817f81, 0x8181817f, 0x7f7f8181, 0x7f7f8181, 0x8181817f,
+0x7f7f7f81, 0x8181817f, 0x8181817f, 0x81817f81, 0x7f81817f, 0x7f7f817f, 0x7f7f817f, 0x7f7f817f,
+0x7f81817f, 0x7f818181, 0x7f817f7f, 0x81817f7f, 0x7f7f7f81, 0x81817f81, 0x817f8181, 0x817f7f81,
+0x817f817f, 0x7f818181, 0x7f817f7f, 0x817f7f81, 0x7f7f7f7f, 0x81817f7f, 0x7f81817f, 0x7f817f81,
+0x7f7f8181, 0x7f817f7f, 0x7f81817f, 0x7f81817f, 0x81817f81, 0x7f817f81, 0x817f817f, 0x817f817f,
+0x8181817f, 0x7f7f817f, 0x817f7f81, 0x81817f7f, 0x7f817f7f, 0x7f81817f, 0x7f7f8181, 0x8181817f,
+0x7f817f7f, 0x817f817f, 0x81817f7f, 0x817f7f7f, 0x817f7f81, 0x81818181, 0x7f7f7f81, 0x81817f7f,
+0x817f817f, 0x817f8181, 0x7f81817f, 0x7f7f8181, 0x817f7f81, 0x7f7f8181, 0x81817f7f, 0x81817f81,
+0x7f818181, 0x817f817f, 0x7f7f817f, 0x817f817f, 0x817f7f81, 0x7f7f8181, 0x7f7f8181, 0x7f7f7f7f,
+0x817f8181, 0x7f7f7f81, 0x817f7f7f, 0x7f7f8181, 0x7f7f7f7f, 0x7f817f7f, 0x7f817f7f, 0x7f7f817f,
+0x817f817f, 0x81818181, 0x7f81817f, 0x7f7f817f, 0x7f818181, 0x817f7f7f, 0x7f817f81, 0x81817f81,
+0x817f7f7f, 0x81817f7f, 0x81817f81, 0x7f7f8181, 0x7f7f817f, 0x7f7f7f81, 0x8181817f, 0x81817f7f,
+0x81817f81, 0x7f7f7f81, 0x7f817f7f, 0x817f7f7f, 0x817f7f7f, 0x81817f7f, 0x81817f81, 0x7f7f7f7f,
+0x7f817f81, 0x817f7f81, 0x7f817f81, 0x7f7f7f81, 0x81818181, 0x7f7f8181, 0x81817f7f, 0x81818181,
+0x7f7f8181, 0x7f7f817f, 0x817f7f7f, 0x7f818181, 0x817f8181, 0x81817f7f, 0x8181817f, 0x81817f7f,
+0x8181817f, 0x7f817f81, 0x81818181, 0x817f7f7f, 0x81818181, 0x7f818181, 0x7f7f8181, 0x7f7f817f,
+0x817f8181, 0x7f7f8181, 0x817f7f7f, 0x817f7f81, 0x7f81817f, 0x817f7f7f, 0x8181817f, 0x81817f81,
+0x817f7f81, 0x817f7f7f, 0x7f7f7f7f, 0x81817f7f, 0x817f7f7f, 0x7f818181, 0x7f81817f, 0x7f817f7f,
+0x817f8181, 0x7f7f7f81, 0x7f817f81, 0x817f8181, 0x817f7f7f, 0x7f818181, 0x7f7f7f81, 0x81817f7f,
+0x817f7f7f, 0x7f817f7f, 0x7f817f7f, 0x7f7f817f, 0x817f8181, 0x817f7f7f, 0x7f7f817f, 0x8181817f,
+0x817f7f7f, 0x8181817f, 0x7f7f8181, 0x7f817f7f, 0x7f817f81, 0x81818181, 0x7f7f817f, 0x81818181,
+0x817f7f7f, 0x7f7f7f81, 0x81817f7f, 0x817f8181, 0x7f7f7f81, 0x817f8181, 0x7f7f8181, 0x817f7f81,
+0x817f7f81, 0x7f817f7f, 0x7f7f817f, 0x7f7f8181, 0x7f7f7f81, 0x7f7f7f81, 0x7f81817f, 0x817f817f,
+0x7f817f7f, 0x81817f7f, 0x7f7f817f, 0x7f7f7f81, 0x817f8181, 0x7f7f8181, 0x7f7f7f81, 0x7f7f7f81,
+0x81818181, 0x7f7f7f7f, 0x817f8181, 0x7f7f8181, 0x7f817f7f, 0x7f817f7f, 0x817f7f7f, 0x8181817f,
+0x81818181, 0x7f817f81, 0x7f7f7f7f, 0x817f7f81, 0x817f7f81, 0x7f818181, 0x7f81817f, 0x7f818181,
+0x7f7f7f81, 0x7f81817f, 0x7f7f8181, 0x7f7f8181, 0x817f7f81, 0x7f817f81, 0x7f817f7f, 0x7f818181,
+0x7f7f817f, 0x7f818181, 0x7f817f7f, 0x81817f7f, 0x7f7f7f81, 0x7f818181, 0x817f7f7f, 0x817f817f,
+0x7f81817f, 0x817f7f81, 0x7f818181, 0x817f7f81, 0x7f7f7f81, 0x8181817f, 0x8181817f, 0x7f81817f,
+0x817f817f, 0x7f7f7f81, 0x81817f81, 0x7f7f8181, 0x7f7f7f81, 0x7f7f8181, 0x817f8181, 0x817f7f7f,
+0x7f817f81, 0x8181817f, 0x7f7f817f, 0x7f817f7f, 0x7f7f8181, 0x7f7f7f81, 0x8181817f, 0x7f7f8181,
+0x7f818181, 0x81817f7f, 0x8181817f, 0x817f7f81, 0x7f7f7f81, 0x817f7f7f, 0x7f817f81, 0x7f818181,
+0x81818181, 0x7f7f7f7f, 0x817f7f81, 0x7f817f7f, 0x7f817f7f, 0x7f81817f, 0x81818181, 0x817f7f81,
+0x817f7f81, 0x7f817f81, 0x7f7f8181, 0x7f818181, 0x7f818181, 0x7f818181, 0x7f7f7f81, 0x7f81817f,
+0x7f81817f, 0x7f818181, 0x7f7f7f81, 0x81817f81, 0x81818181, 0x817f7f7f, 0x817f7f7f, 0x817f817f,
+0x8181817f, 0x7f7f8181, 0x7f7f7f7f, 0x81818181, 0x817f8181, 0x7f7f8181, 0x81817f81, 0x7f817f81,
+0x7f818181, 0x7f7f817f, 0x817f7f81, 0x7f7f7f81, 0x7f7f7f81, 0x81817f81, 0x81817f81, 0x7f7f7f7f,
+0x817f7f81, 0x7f817f7f, 0x81817f81, 0x7f817f81, 0x817f817f, 0x7f7f8181, 0x81817f7f, 0x817f7f81,
+0x7f817f81, 0x7f7f7f81, 0x817f8181, 0x7f7f7f81, 0x817f7f7f, 0x7f7f7f81, 0x817f817f, 0x7f7f7f81,
+0x7f817f7f, 0x7f817f7f, 0x8181817f, 0x8181817f, 0x7f7f7f81, 0x7f7f7f81, 0x7f817f81, 0x81817f81,
+0x81817f7f, 0x7f7f7f7f, 0x81817f7f, 0x81818181, 0x817f817f, 0x81817f81, 0x81818181, 0x817f7f81,
+0x817f8181, 0x817f7f7f, 0x81817f7f, 0x81817f7f, 0x81818181, 0x7f7f7f7f, 0x7f817f7f, 0x7f81817f,
+0x7f7f817f, 0x8181817f, 0x817f8181, 0x817f8181, 0x8181817f, 0x7f7f7f81, 0x817f7f7f, 0x817f7f7f,
+0x817f8181, 0x7f817f81, 0x7f7f7f7f, 0x81817f7f, 0x81818181, 0x7f817f7f, 0x7f7f8181, 0x817f8181,
+0x817f7f7f, 0x817f7f81, 0x817f7f81, 0x81817f7f, 0x7f817f7f, 0x817f7f7f, 0x7f7f8181, 0x7f817f81,
+0x7f7f7f7f, 0x8181817f, 0x7f7f7f81, 0x81818181, 0x7f7f817f, 0x81817f81, 0x817f7f7f, 0x7f817f81,
+0x817f817f, 0x7f817f81, 0x817f7f7f, 0x7f7f8181, 0x7f81817f, 0x7f7f8181, 0x7f7f7f7f, 0x7f818181,
+0x81817f81, 0x7f7f817f, 0x7f7f817f, 0x7f7f817f, 0x817f7f7f, 0x81818181, 0x81817f7f, 0x7f817f81,
+0x7f7f817f, 0x7f7f7f7f, 0x81818181, 0x7f7f817f, 0x7f7f817f, 0x7f817f7f, 0x817f7f81, 0x7f817f7f,
+0x7f7f7f81, 0x7f7f817f, 0x817f817f, 0x81817f7f, 0x81818181, 0x817f8181, 0x7f817f7f, 0x817f8181,
+0x7f818181, 0x7f81817f, 0x817f7f81, 0x817f7f7f, 0x7f7f817f, 0x817f7f7f, 0x7f7f7f81, 0x81817f7f,
+0x7f7f817f, 0x817f7f81, 0x7f818181, 0x817f8181, 0x817f8181, 0x7f7f7f7f, 0x817f817f, 0x7f7f7f7f,
+0x7f7f7f7f, 0x7f7f7f7f, 0x817f8181, 0x81817f81, 0x817f7f7f, 0x7f818181, 0x7f81817f, 0x7f81817f,
+0x81818181, 0x817f8181, 0x817f7f81, 0x8181817f, 0x817f7f7f, 0x7f7f7f7f, 0x81817f81, 0x817f817f,
+0x817f817f, 0x817f7f81, 0x7f818181, 0x7f817f81, 0x81817f81, 0x7f81817f, 0x7f81817f, 0x7f817f7f,
+0x7f817f81, 0x7f7f7f81, 0x81817f81, 0x81817f81, 0x7f7f817f, 0x7f817f7f, 0x7f818181, 0x7f81817f,
+0x817f7f81, 0x817f7f81, 0x81817f81, 0x7f818181, 0x817f8181, 0x7f81817f, 0x7f7f7f7f, 0x817f7f7f,
+0x7f817f7f, 0x81817f7f, 0x7f7f8181, 0x7f7f8181, 0x7f7f8181, 0x817f8181, 0x7f81817f, 0x817f7f81,
+0x817f7f81, 0x7f7f817f, 0x7f817f81, 0x81817f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f8181, 0x817f7f81,
+0x8181817f, 0x8181817f, 0x7f7f8181, 0x7f7f817f, 0x817f7f81, 0x817f8181, 0x7f818181, 0x81818181,
+0x817f7f81, 0x7f7f817f, 0x7f7f817f, 0x7f7f8181, 0x7f7f7f7f, 0x817f7f81, 0x8181817f, 0x81818181,
+0x817f817f, 0x7f818181, 0x817f7f81, 0x81817f7f, 0x7f817f7f, 0x7f817f7f, 0x81818181, 0x817f817f,
+0x817f7f81, 0x7f7f8181, 0x7f7f8181, 0x8181817f, 0x7f817f7f, 0x7f81817f, 0x7f7f7f81, 0x7f7f7f81,
+0x8181817f, 0x7f817f7f, 0x817f7f81, 0x7f817f81, 0x7f817f81, 0x817f817f, 0x81818181, 0x817f817f,
+0x817f8181, 0x7f7f8181, 0x7f817f7f, 0x817f817f, 0x817f7f81, 0x8181817f, 0x7f7f7f81, 0x81817f81,
+0x817f7f81, 0x81818181, 0x7f818181, 0x7f7f7f81, 0x7f818181, 0x7f817f7f, 0x7f7f7f81, 0x7f7f7f81,
+0x817f817f, 0x81818181, 0x7f7f817f, 0x81818181, 0x8181817f, 0x7f7f817f, 0x7f7f7f7f, 0x7f818181,
+0x817f817f, 0x7f7f8181, 0x7f817f81, 0x817f8181, 0x7f817f81, 0x7f7f7f81, 0x7f818181, 0x8181817f,
+0x7f7f7f7f, 0x7f7f7f81, 0x7f7f7f81, 0x7f7f7f7f, 0x81817f7f, 0x7f7f8181, 0x817f817f, 0x817f8181,
+0x817f7f7f, 0x81817f81, 0x7f81817f, 0x7f7f8181, 0x7f7f8181, 0x7f7f7f7f, 0x817f817f, 0x81818181,
+0x7f7f8181, 0x7f818181, 0x7f81817f, 0x817f7f7f, 0x81817f7f, 0x81817f81, 0x7f81817f, 0x8181817f,
+0x81818181, 0x81817f7f, 0x7f818181, 0x7f817f81, 0x817f7f7f, 0x817f817f, 0x7f7f817f, 0x81818181,
+0x7f81817f, 0x7f7f7f81, 0x7f7f7f81, 0x81817f81, 0x81817f7f, 0x817f7f81, 0x7f817f81, 0x817f817f,
+0x817f817f, 0x7f7f7f7f, 0x7f817f7f, 0x7f7f7f81, 0x81817f7f, 0x817f7f81, 0x7f7f8181, 0x817f7f81,
+0x7f81817f, 0x817f7f81, 0x817f817f, 0x817f8181, 0x7f818181, 0x7f7f7f81, 0x7f7f8181, 0x817f7f7f,
+0x7f7f7f7f, 0x81817f7f, 0x81817f7f, 0x81817f7f, 0x7f817f81, 0x81818181, 0x817f817f, 0x81817f7f,
+0x7f7f7f7f, 0x7f7f7f7f, 0x7f818181, 0x7f7f7f81, 0x817f7f81, 0x7f817f7f, 0x7f817f81, 0x7f7f7f81,
+0x81817f7f, 0x81817f81, 0x81817f81, 0x81818181, 0x817f7f7f, 0x7f818181, 0x81818181, 0x7f7f7f7f,
+0x7f818181, 0x7f7f817f, 0x7f7f8181, 0x817f7f7f, 0x7f817f81, 0x817f7f7f, 0x81818181, 0x7f7f817f,
+0x817f7f81, 0x817f7f81, 0x7f81817f, 0x81817f81, 0x7f7f8181, 0x7f81817f, 0x7f7f8181, 0x817f7f7f,
+0x7f817f7f, 0x8181817f, 0x8181817f, 0x8181817f, 0x7f7f8181, 0x8181817f, 0x7f7f8181, 0x817f817f,
+0x7f817f7f, 0x7f7f8181, 0x7f7f7f81, 0x7f818181, 0x81817f7f, 0x7f818181, 0x817f7f81, 0x7f7f817f,
+0x7f7f7f7f, 0x7f817f81, 0x7f817f81, 0x7f7f8181, 0x7f7f817f, 0x7f817f7f, 0x81817f81, 0x7f7f8181,
+0x81818181, 0x7f7f817f, 0x7f817f81, 0x817f8181, 0x817f8181, 0x81817f81, 0x817f817f, 0x7f81817f,
+0x817f7f7f, 0x7f7f7f7f, 0x7f7f7f81, 0x817f8181, 0x7f7f7f81, 0x817f8181, 0x81818181, 0x7f817f81,
+0x81818181, 0x7f81817f, 0x7f7f7f7f, 0x81817f81, 0x7f818181, 0x7f7f7f7f, 0x7f81817f, 0x7f81817f,
+0x8181817f, 0x7f81817f, 0x81817f81, 0x7f7f7f7f, 0x817f7f81, 0x7f7f7f81, 0x7f817f81, 0x7f7f7f81,
+0x81818181, 0x81817f7f, 0x81817f81, 0x7f7f817f, 0x7f818181, 0x81817f81, 0x81817f7f, 0x81817f81,
+0x7f7f7f81, 0x81817f7f, 0x7f7f8181, 0x7f7f817f, 0x81817f7f, 0x817f7f81, 0x7f818181, 0x7f817f7f,
+0x7f817f81, 0x7f7f817f, 0x7f7f817f, 0x817f817f, 0x7f7f7f7f, 0x817f7f81, 0x7f7f7f81, 0x817f817f,
+0x7f7f8181, 0x7f818181, 0x817f817f, 0x7f817f81, 0x817f7f7f, 0x7f818181, 0x81818181, 0x81818181,
+0x81817f7f, 0x7f81817f, 0x7f817f7f, 0x7f7f817f, 0x7f7f8181, 0x817f817f, 0x817f8181, 0x7f7f817f,
+0x817f7f81, 0x81817f81, 0x817f7f81, 0x7f81817f, 0x817f7f81, 0x81817f7f, 0x7f817f7f, 0x7f817f81,
+0x817f7f7f, 0x7f7f817f, 0x7f817f81, 0x7f7f7f81, 0x81818181, 0x7f817f7f, 0x817f817f, 0x81818181,
+0x7f7f7f7f, 0x7f817f81, 0x7f817f81, 0x7f817f7f, 0x817f8181, 0x817f8181, 0x7f817f81, 0x81818181,
+0x7f818181, 0x81818181, 0x7f81817f, 0x7f818181, 0x7f7f817f, 0x7f7f817f, 0x7f7f7f81, 0x81817f7f,
+0x7f818181, 0x817f8181, 0x7f7f7f81, 0x7f7f817f, 0x7f7f817f, 0x7f817f81, 0x7f817f7f, 0x7f7f7f7f,
+0x81817f81, 0x81817f81, 0x7f7f7f81, 0x81818181, 0x7f817f7f, 0x81818181, 0x81817f7f, 0x7f7f8181,
+0x817f7f7f, 0x7f7f817f, 0x817f817f, 0x817f8181, 0x81818181, 0x7f817f81, 0x817f817f, 0x817f8181,
+0x817f8181, 0x817f817f, 0x81817f7f, 0x7f817f7f, 0x817f8181, 0x81817f7f, 0x81818181, 0x817f8181,
+0x7f817f7f, 0x7f817f7f, 0x7f7f8181, 0x817f817f, 0x7f7f817f, 0x7f817f81, 0x7f7f817f, 0x7f7f7f81,
+0x817f817f, 0x7f7f8181, 0x81817f7f, 0x7f7f7f7f, 0x7f818181, 0x7f818181, 0x7f817f81, 0x7f81817f,
+0x7f7f8181, 0x7f7f7f7f, 0x81817f81, 0x817f7f7f, 0x81817f7f, 0x817f7f7f, 0x8181817f, 0x7f818181,
+0x817f817f, 0x817f7f81, 0x81817f7f, 0x817f7f81, 0x7f817f81, 0x817f7f81, 0x817f817f, 0x7f7f7f7f,
+0x7f817f7f, 0x8181817f, 0x7f818181, 0x81817f81, 0x7f7f7f7f, 0x7f818181, 0x817f817f, 0x7f818181,
+0x7f818181, 0x817f7f7f, 0x81817f7f, 0x81817f81, 0x7f7f7f81, 0x7f7f817f, 0x81817f81, 0x7f81817f,
+0x817f8181, 0x7f81817f, 0x7f7f7f81, 0x7f818181, 0x81817f7f, 0x7f818181, 0x817f817f, 0x817f7f7f,
+0x817f7f7f, 0x817f817f, 0x817f7f7f, 0x7f81817f, 0x7f817f81, 0x7f7f8181, 0x817f817f, 0x817f817f,
+0x7f81817f, 0x7f817f7f, 0x7f7f817f, 0x81817f81, 0x817f8181, 0x81818181, 0x7f7f817f, 0x81818181,
+0x81817f7f, 0x7f818181, 0x7f7f8181, 0x7f7f8181, 0x81818181, 0x7f817f7f, 0x8181817f, 0x8181817f,
+0x817f7f7f, 0x817f7f7f, 0x81818181, 0x7f818181, 0x7f817f7f, 0x81817f81, 0x8181817f, 0x817f7f7f,
+0x7f7f7f7f, 0x7f7f7f81, 0x7f817f81, 0x7f7f817f, 0x81817f81, 0x7f7f817f, 0x7f818181, 0x7f817f7f,
+0x7f81817f, 0x7f7f817f, 0x81818181, 0x7f7f817f, 0x7f7f8181, 0x7f7f7f81, 0x81817f81, 0x817f817f,
+0x7f817f81, 0x7f817f7f, 0x8181817f, 0x7f7f7f81, 0x81818181, 0x817f7f7f, 0x81817f7f, 0x7f817f7f,
+0x817f7f7f, 0x817f817f, 0x7f817f7f, 0x817f8181, 0x81818181, 0x7f817f7f, 0x81817f81, 0x817f7f7f,
+0x817f8181, 0x7f81817f, 0x7f7f8181, 0x7f817f81, 0x81817f7f, 0x7f7f817f, 0x817f7f81, 0x817f817f,
+0x7f817f81, 0x817f8181, 0x81817f7f, 0x817f8181, 0x8181817f, 0x7f81817f, 0x81817f7f, 0x7f7f817f,
+0x7f81817f, 0x81817f7f, 0x7f818181, 0x817f7f81, 0x8181817f, 0x7f818181, 0x7f7f817f, 0x7f817f7f,
+0x7f817f7f, 0x8181817f, 0x7f81817f, 0x81817f81, 0x7f7f7f7f, 0x7f81817f, 0x817f7f7f, 0x817f7f7f,
+0x817f817f, 0x7f81817f, 0x7f818181, 0x7f7f7f81, 0x817f7f7f, 0x7f7f7f81, 0x7f7f8181, 0x7f7f817f,
+0x7f7f7f81, 0x817f7f81, 0x81817f81, 0x7f7f817f, 0x817f8181, 0x7f7f7f81, 0x7f7f817f, 0x817f817f,
+0x817f7f81, 0x817f817f, 0x7f817f7f, 0x7f7f817f, 0x81818181, 0x81817f81, 0x817f8181, 0x7f7f8181,
+0x7f7f8181, 0x817f8181, 0x7f7f7f7f, 0x8181817f, 0x7f7f7f7f, 0x7f81817f, 0x81817f81, 0x81817f7f,
+0x7f7f8181, 0x8181817f, 0x7f818181, 0x7f817f7f, 0x7f7f817f, 0x7f81817f, 0x7f817f81, 0x7f817f7f,
+0x7f7f8181, 0x81818181, 0x7f7f8181, 0x7f7f7f81, 0x817f7f7f, 0x7f7f8181, 0x81818181, 0x7f817f81,
+0x81818181, 0x7f818181, 0x7f818181, 0x817f8181, 0x81818181, 0x7f81817f, 0x7f7f8181, 0x7f7f8181,
+0x817f7f7f, 0x7f7f7f7f, 0x7f817f81, 0x7f81817f, 0x7f817f7f, 0x817f817f, 0x7f7f7f81, 0x817f7f81,
+0x7f818181, 0x8181817f, 0x817f7f81, 0x817f817f, 0x817f8181, 0x7f7f7f81, 0x7f817f7f, 0x81817f81,
+0x817f8181, 0x817f8181, 0x7f817f7f, 0x81817f7f, 0x817f7f81, 0x7f817f81, 0x817f7f7f, 0x817f8181,
+0x7f817f7f, 0x81817f7f, 0x81817f81, 0x7f817f81, 0x7f81817f, 0x7f7f7f81, 0x7f817f7f, 0x7f7f8181,
+0x8181817f, 0x7f7f7f7f, 0x7f7f8181, 0x7f817f7f, 0x817f8181, 0x817f7f81, 0x7f7f7f7f, 0x7f81817f,
+0x7f7f8181, 0x817f817f, 0x7f7f7f81, 0x81817f7f, 0x81818181, 0x817f7f81, 0x7f817f7f, 0x7f81817f,
+0x8181817f, 0x7f7f817f, 0x817f7f81, 0x81817f81, 0x8181817f, 0x7f7f8181, 0x817f7f81, 0x81817f81,
+0x817f8181, 0x817f8181, 0x817f817f, 0x817f8181, 0x817f7f81, 0x7f7f7f7f, 0x7f7f8181, 0x817f817f,
+0x7f817f7f, 0x817f7f81, 0x7f81817f, 0x81818181, 0x7f7f7f81, 0x7f818181, 0x7f7f8181, 0x81817f7f,
+0x817f7f81, 0x8181817f, 0x7f817f81, 0x7f7f7f7f, 0x7f817f7f, 0x7f818181, 0x8181817f, 0x817f7f81,
+0x817f7f7f, 0x7f817f81, 0x7f7f8181, 0x817f7f81, 0x817f7f7f, 0x817f8181, 0x7f817f81, 0x81817f7f,
+0x817f817f, 0x81817f81, 0x81817f7f, 0x8181817f, 0x817f8181, 0x817f7f7f, 0x81817f7f, 0x81817f81,
+0x817f7f81, 0x81818181, 0x81817f81, 0x7f817f7f, 0x7f817f7f, 0x8181817f, 0x7f818181, 0x7f7f7f7f,
+0x7f817f81, 0x81817f81, 0x7f7f817f, 0x817f7f81, 0x7f7f7f81, 0x7f818181, 0x7f7f7f7f, 0x7f817f7f,
+0x7f7f817f, 0x817f7f7f, 0x7f7f817f, 0x8181817f, 0x7f818181, 0x7f7f7f7f, 0x81817f7f, 0x7f81817f,
+0x817f7f7f, 0x7f7f7f7f, 0x7f81817f, 0x817f7f7f, 0x817f817f, 0x7f7f7f81, 0x81817f81, 0x817f7f7f,
+0x817f7f81, 0x81817f7f, 0x7f7f7f7f, 0x81818181, 0x81817f7f, 0x7f7f7f81, 0x81817f7f, 0x7f7f7f81,
+0x7f817f81, 0x817f7f7f, 0x7f817f7f, 0x7f81817f, 0x7f817f7f, 0x817f817f, 0x817f817f, 0x8181817f,
+0x817f8181, 0x81818181, 0x817f817f, 0x7f7f8181, 0x7f817f7f, 0x7f817f81, 0x817f7f7f, 0x7f7f8181,
+0x7f817f81, 0x81817f81, 0x817f817f, 0x7f818181, 0x7f7f7f81, 0x7f7f8181, 0x7f81817f, 0x8181817f,
+0x7f7f7f7f, 0x817f8181, 0x7f7f7f7f, 0x81817f81, 0x8181817f, 0x7f7f817f, 0x8181817f, 0x7f7f7f7f,
+0x7f817f7f, 0x7f81817f, 0x817f7f7f, 0x81817f7f, 0x7f7f7f7f, 0x81817f81, 0x81817f81, 0x7f81817f,
+0x7f7f7f81, 0x81817f81, 0x817f817f, 0x7f7f7f7f, 0x8181817f, 0x7f817f7f, 0x7f7f7f81, 0x7f817f7f,
+0x817f8181, 0x7f7f7f81, 0x7f81817f, 0x817f8181, 0x7f7f8181, 0x7f817f81, 0x8181817f, 0x81818181,
+0x7f7f8181, 0x817f817f, 0x817f7f81, 0x7f817f7f, 0x7f818181, 0x81818181, 0x7f817f81, 0x817f7f81,
+0x817f817f, 0x81817f7f, 0x81817f81, 0x817f7f7f, 0x7f7f7f81, 0x7f81817f, 0x7f7f8181, 0x7f7f817f,
+0x7f7f7f7f, 0x7f817f7f, 0x7f817f7f, 0x817f8181, 0x7f7f7f81, 0x8181817f, 0x817f8181, 0x7f7f7f7f,
+0x81817f81, 0x817f817f, 0x81818181, 0x7f817f7f, 0x817f817f, 0x817f817f, 0x81817f7f, 0x7f7f7f81,
+0x7f7f7f81, 0x81817f7f, 0x7f817f7f, 0x817f8181, 0x81817f7f, 0x81817f7f, 0x817f8181, 0x8181817f,
+0x7f81817f, 0x7f81817f, 0x817f7f81, 0x817f817f, 0x7f7f8181, 0x8181817f, 0x7f817f81, 0x817f817f,
+0x7f818181, 0x81818181, 0x7f7f7f7f, 0x817f8181, 0x7f817f7f, 0x7f7f817f, 0x7f7f7f81, 0x7f7f7f81,
+0x817f817f, 0x817f817f, 0x81818181, 0x81818181, 0x817f7f81, 0x7f81817f, 0x817f8181, 0x7f7f817f,
+0x817f8181, 0x7f7f7f81, 0x7f818181, 0x817f7f7f, 0x817f7f81, 0x817f8181, 0x817f817f, 0x817f817f,
+0x7f817f81, 0x817f7f7f, 0x81817f7f, 0x7f818181, 0x7f7f817f, 0x817f7f81, 0x817f7f81, 0x817f8181,
+0x7f7f817f, 0x8181817f, 0x8181817f, 0x7f7f817f, 0x81817f81, 0x7f7f7f7f, 0x7f81817f, 0x8181817f,
+0x7f7f817f, 0x7f7f8181, 0x8181817f, 0x817f817f, 0x7f817f81, 0x7f7f8181, 0x7f7f7f7f, 0x7f7f7f81,
+0x81817f81, 0x81818181, 0x7f7f7f81, 0x7f817f81, 0x817f7f7f, 0x7f81817f, 0x81817f7f, 0x7f817f81,
+0x7f818181, 0x7f7f7f81, 0x8181817f, 0x817f8181, 0x817f817f, 0x817f817f, 0x7f7f7f7f, 0x8181817f,
+0x7f81817f, 0x81818181, 0x7f7f8181, 0x817f7f7f, 0x81817f81, 0x817f817f, 0x817f7f81, 0x81818181
+
+output0 =
+0xfb26769b, 0xc79ba708, 0xf8635f11, 0xd7e4cfa4, 0xe3c5e7d7, 0xc02d1876, 0xe718a692, 0x09395387,
+0x9b38d4ad, 0x2cb9b3e9, 0xa975b0e1, 0x330bcede, 0x7b7550e4, 0x1f120789, 0x719ec767, 0x84e65e6f,
+0x8067338a, 0x2f38b6a5, 0xe1100cdc, 0x4129350a, 0xf42f39a8, 0x41ae51c4, 0xa916952f, 0xab6d7503,
+0xd0359b04, 0x97be8694, 0xee8effbe, 0x79b093ec, 0x57122f74, 0x73037ee7, 0x395a2f52, 0x73caae6b,
+0xc3eff955, 0xf9f1d126, 0x02432290, 0x7295881a, 0xdd24b3a4, 0x7b3473eb, 0x9d1dcbef, 0x3c990bfb,
+0xf280623b, 0x20c84e3b, 0x144c6d3a, 0x8ec60a92, 0x09737fc3, 0xeb399fd3, 0xfe46efae, 0x8bca3001,
+0x78ade416, 0xb84aea12, 0x43ca2a9e, 0x15fe0d33, 0xd7c16a39, 0xc42a34e8, 0x58df1eaa, 0xa4c437b8,
+0x155c3a34, 0xb76ffb85, 0x83762da1, 0x7a114abf, 0xa28f5f9a, 0xc5ea01a2, 0x2701d947, 0xf16083f2,
+0x3800ccfd, 0x9c7a9a6f, 0xf65e474d, 0xb143759a, 0xdaaac55c, 0x29950c88, 0xa47976ba, 0xe8335a4f,
+0x6a858152, 0x25a3a9f9, 0xc42def6b, 0x07a3ffe4, 0xeb949edb, 0x767e93a2, 0xe58b7e91, 0x02b0ceec,
+0x4a519ff0, 0x33091006, 0xa5300a4a, 0x2bcd45f6, 0xb83b264d, 0x22336f72, 0xa555c8d1, 0xeb4aa02c,
+0x700dd4a9, 0x6b8fc1e6, 0xd44ce0f3, 0xbb66e520, 0xbdb17016, 0xbebb013c, 0xe2a05d9a, 0x516f5605,
+0xac27f407, 0xbd05f488, 0x2ef5e8c2, 0x23a62cf8, 0x50f2f8a9, 0x45d6bda3, 0x9b6efd5a, 0x77cdc34b,
+0xb466da5a, 0x98b948f0, 0xb345dd43, 0x52ee8fdf, 0xc0596488, 0x73fab111, 0xf88a77d7, 0x36952151,
+0xe5c88df4, 0x05e4e05a, 0xfd68dff8, 0x33ce03ce, 0x181d38da, 0x1bd14663, 0xf3b0e86a, 0xb1d7900d,
+0x52165396, 0xa54e79ef, 0xbf1cda0d, 0xad1f7a2a, 0xebf4db32, 0xf049cd5d, 0xdcbe865f, 0xa1c31f6d,
+0xeba00e1d, 0xde8e2a87, 0x5e9c15de, 0x02ec68bd, 0xaad1a964, 0x95d3bd1c, 0xf7e7048d, 0x4e2c6243,
+0x7e675787, 0xd9811021, 0xec5c7341, 0x98d304da, 0xe68ea509, 0x6318d315, 0xe3570ce2, 0x594c4fad,
+0x840f01f5, 0xa9a2e403, 0x8e651529, 0x72c70e44, 0x9402e2f4, 0x9e1cd395, 0x890701ca, 0xe804887a,
+0xd209cae4, 0x0c344a3d, 0x8926ca86, 0x0f6debfa, 0x83323654, 0xd0d12b75, 0x7d73888c, 0xf95ce546,
+0x0b4fe312, 0x2582b52d, 0xcf10f7ff, 0x7bf385f5, 0x57dcaf9f, 0xcbb60aef, 0x64711e8f, 0x923571ec,
+0xfd90c78e, 0x85099f54, 0x63ae3fdf, 0xc683a0b3, 0x591e8102, 0xb6180e2d, 0x35ae7560, 0x94a4a536,
+0x97defd69, 0x92afc0b4, 0xebce8cf4, 0x4d2fc035, 0x9057a972, 0x30e204a6, 0xc5af64e8, 0x6c7fa059,
+0x40f043e6, 0xdcd8bc3f, 0x5bb3962b, 0xf0f1a38d, 0x99b2893e, 0xf77257c4, 0x60c59a02, 0xaedcaff2,
+0xe5a852c1, 0xea67ccb9, 0x150acbb7, 0xea2cb0bc, 0xfa64f623, 0x0d37fe47, 0x81643457, 0x3dcf1a62,
+0x5c6c4066, 0x66bdc50d, 0x20e45b88, 0x9746424f
+
+basegraph=
+1
+
+z_c=
+320
+
+n_cb=
+16000
+
+q_m=
+8
+
+n_filler=
+488
+
+ea =
+8448
+
+eb =
+8448
+
+iter_max=
+8
+
+expected_iter_count=
+2
+
+c =
+1
+
+r =
+0
+
+cab =
+1
+
+rv_index =
+0
+
+en_scramble =
+1
+
+q =
+0
+
+n_id =
+323
+
+n_rnti =
+2300
+
+code_block_mode =
+0
+
+op_flags =
+RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP
+
+expected_status =
+OK
diff --git a/app/test-bbdev/test_vectors/ldpc_enc_tb.data b/app/test-bbdev/test_vectors/ldpc_enc_tb.data
new file mode 100644
index 0000000000..00c8798995
--- /dev/null
+++ b/app/test-bbdev/test_vectors/ldpc_enc_tb.data
@@ -0,0 +1,482 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020 NXP
+
+op_type =
+RTE_BBDEV_OP_LDPC_ENC
+
+network_order =
+1
+
+input0 =
+0x4a5cf377, 0xc1be40f7, 0x0928020e, 0xb516db35, 0x6345a450, 0x58fff002, 0x2e7eb452, 0x8b11e1cd,
+0xad940424, 0xed9581f4, 0x786faf13, 0xa1a42fd8, 0xb4ae94ec, 0x3a495130, 0x870919cb, 0xce3e626b,
+0xd589a336, 0x89b9255d, 0x9827afc3, 0x4b115731, 0xffa129a4, 0xbc5c19fd, 0x8178422f, 0x2b1b1c4e,
+0x7260eea5, 0x815d0666, 0xa81b5713, 0xd16966b6, 0x6a2b38fb, 0xedb7af62, 0x1c4291c9, 0x344df3c4,
+0x76b00f5c, 0xdfde72db, 0x49b974d1, 0xe1c427fd, 0x119899ff, 0xe19ef236, 0xb29ed77e, 0xcfbe3574,
+0x5fb6601d, 0x4b01e2fa, 0xe672e5eb, 0xec2e1ddd, 0x7f4ce14e, 0x277b5543, 0x0cc6c1cd, 0x35207407,
+0xf581c04d, 0xf3911008, 0x1acce490, 0x7a2da390, 0xb2675739, 0xa6f59003, 0x5cdabfba, 0xea345736,
+0xf3855b42, 0xa5968e62, 0x7414e30f, 0xbf8379a7, 0x8e385fe2, 0x5578e2af, 0x7d8df3e4, 0x31baa8e5,
+0x3d5d1bfb, 0xaec1353f, 0x966a3c92, 0x3e470876, 0x2917ed68, 0x87080d6a, 0xa31b0f0c, 0x7f15205f,
+0x4a8f14ea, 0xaff808f8, 0x019ee1c4, 0xe15a3115, 0x34d00540, 0x820aef7e, 0xa77de257, 0xf4ae8ae3,
+0x20970e8e, 0xe7936af0, 0x8ca57d87, 0x274f72fe, 0xc6b737ad, 0xe90868e6, 0x83efc09e, 0x29edd24b,
+0x5c0c052b, 0x5fd00de7, 0x06bc61bc, 0x1b8cc48d, 0x4d44fe33, 0x5575407d, 0x1f81e81d, 0x62830c48,
+0xc901f0a8, 0xf996afa9, 0x54437c46, 0x61b851c2, 0xa4be2f55, 0xe4af1f09, 0x1007b036, 0x6ddc2bac,
+0xa22ab8bc, 0x22b2edc9, 0x5307c0de, 0x95a8bddf, 0x24a49d70, 0x26ac47a5, 0xccd21157, 0x748be14a,
+0xdc903d7f, 0x0fe261af, 0x3aeba7a5, 0x83a5ee5e, 0x44a19c9d, 0x7b5cb38c, 0x983741ea, 0xdd630d75,
+0x94ff02fb, 0x452f7ad7, 0xad6d63a2, 0x4d123a54, 0xcc48ec5d, 0x77aa559b, 0x059a31a2, 0xf352c2b2,
+0x6079f2c3, 0x6251689b, 0x66ad28ab, 0x045a92cd, 0xfbeee326, 0xa75e1acf, 0xbf0ec9a5, 0xb3ae6c75,
+0x631e787b, 0x527d5cae, 0x9b84fcef, 0x1e586a32, 0x89d3372a, 0x707b8cff, 0xc94583e2, 0xec47990f,
+0xdd80df30, 0x0c1d93ab, 0x7f1c8ebe, 0x658c9498, 0xa352198f, 0x51b2efe6, 0xfae8ca17, 0x895bad0e,
+0x707c66fd, 0x7d94e19d, 0x89b0b675, 0x1ea127f4, 0x40e4a629, 0xb63c89a1, 0x16157440, 0x07f051ad,
+0xb4cadb1b, 0xbf071feb, 0x3d3a286d, 0x8cba496a, 0x35031946, 0xd0908645, 0xa63893b5, 0x83f7dcb6,
+0xcd646355, 0x5a0098e5, 0x804dea3e, 0x5b68d32a, 0xe26f1b2f, 0x04afea8f, 0x9810a92c, 0xf9e830ea,
+0x6023ea6f, 0x4e24abc8, 0xe13f73b6, 0xb253b55b, 0xbb4d8c3b, 0xa1fc6529, 0x1cc16b79, 0x3e4e97c2,
+0x151e3bee, 0xb0b723fb, 0xa1d25067, 0x235766a7, 0x6682a381, 0x7339b658, 0xb1269ab0, 0x83ba2e11,
+0x8822900e, 0xed25e0a1, 0x83500011, 0x3ac7816e, 0xef1bb934, 0xf1f181f7, 0x813f09c1, 0x3062549a,
+0x8a848f2a, 0xbdbfd5dd, 0xb0b4a2da, 0xfe010280, 0xee27c73e, 0xa9e59ac9, 0x1839be41, 0x3e48115b,
+0x8236e038, 0x31acebf3, 0x65e6ca9e, 0xe60827bd, 0x1c769295, 0x78664313, 0x393b746d, 0xc514d330,
+0x745feccf, 0xf744bfde, 0xaec83f36, 0x68bb76e8, 0x8857a5d9, 0x955ee019, 0xdadc352d, 0x6258b61c,
+0x7f3162b9, 0xc8482836, 0x111eef64, 0xd8ad108e, 0x80fd48c5, 0xf55d1692, 0xfcac5450, 0xbfd17400,
+0x5c73ac96, 0xb3623e70, 0xb97a05db, 0x93324d75, 0x4f9b823c, 0xcbbea5f2, 0x895b9f80, 0xe784795b,
+0x33484231, 0x6468c911, 0x25f8c678, 0xfebd9963, 0xe36977c5, 0x29eeb096, 0x425070c2, 0x1d193fb4,
+0xa02c713a, 0xc5a32439, 0x7ccab8a7, 0xa74f2f43, 0x97e03e2b, 0xa9df9c82, 0x133fc0d5, 0x9940fb7b,
+0x385e4f60, 0x88428bfb, 0x79643726, 0x03db0aa8, 0xf6d4e3a5, 0xbd3b6f2e, 0xd24f3149, 0x20c36508,
+0xa52cbaf5, 0x515fbf81, 0x5048a565, 0x36813de9, 0xe15ff330, 0x40fc8d88, 0x7b2ebe5d, 0x54ba589d,
+0xe04722ed, 0x229ba4c6, 0xfe344c90, 0x308a24d6, 0xd70657f8, 0x7246e901, 0xf05c5e25, 0x77b23e02,
+0xe624c583, 0xb0cbd652, 0xc8351b48, 0x58df416a, 0xb36a5a8d, 0x25f40145, 0x0b9861b3, 0x7c4f6970,
+0x2f6c7e65, 0xc5d465eb, 0x4a38d2a2, 0x8732f621, 0xf4c71a36, 0x7920edcd, 0xb6168152, 0x5dbbb680,
+0xcc06d6c1, 0x40d8fd8f, 0x14f232ea, 0x23a42b46, 0xff077d0f, 0x103a835f, 0x96eceb0f, 0xe1a35d87,
+0x4d6c6b31, 0x7e7b4eaa, 0xc00938f0, 0x26d96851, 0x6ac7c02f, 0xd12f4223, 0x043b560d, 0xa8844b9d,
+0xf15b8c47, 0x9bc3ec92, 0x2fcead2a, 0xcdac5d0b, 0x71acf58a, 0xe7d0dc7e, 0x18b8724e, 0x595117ce,
+0x13396946, 0x0e23554d, 0x0f7fd3d1, 0x8a414726, 0xfb55545f, 0xbd4f4ac1, 0x4a0f0314, 0x4e21b01d,
+0xb6a7bfa2, 0x1df47f56, 0xfe337f3b, 0x9d35c666, 0x1edde4e3, 0x5bbc1776, 0xb1048246, 0xcd7fc90d,
+0x86c1c8a0, 0xc660f81e, 0x3dcb73ca, 0xa4b05317, 0xddb4c87e, 0xfc3c8529, 0x98fb46ac, 0x19d85c90,
+0x1f5ea4ea, 0x2b3dc0ef, 0x2566b8db, 0x915b1341, 0xedef8c0e, 0xc1f39458, 0x181b0f42, 0x1d6d0edb,
+0x5f0ba327, 0xc023c2c7, 0xaebd1eb8, 0x4a1f501d, 0xd88f2f8c, 0x841344c0, 0x63876b91, 0xaaa9ba10,
+0x817e0dfd, 0x7cf187f2, 0x018ac8ec, 0x7f5582af, 0x97b21eec, 0x05024214, 0x8a28c641, 0xcb9702ec,
+0x733454e8, 0xcce12e56, 0xc7a34c2e, 0xafa25f51, 0x09c5918b, 0x55aa877c, 0xdc75b2e1, 0x554893f3,
+0x0e6641a9, 0x8cefb7d6, 0xea97d30e, 0xc4a14b08, 0x18ba409b, 0xedd6788b, 0x429d54e2, 0xabf9fc15,
+0x801d79b0, 0x0927883c, 0xdd19f658, 0x95c30cda, 0x1041b752, 0x71e5cce7, 0xf87fd784, 0xcf8987c0,
+0x758f2204, 0xc53ab645, 0x36be3cf7, 0x64147343, 0xf5e381b5, 0x87f25b75, 0x5a5674f3, 0x4c85b2ba,
+0x0b556520, 0xccf2d372, 0x74577cff, 0xd80c3b15, 0x1b8f4c93, 0x44875781, 0xc1999a74, 0xf7bdca58,
+0x49d92d5e, 0xdcebe278, 0x36e14e25, 0x6a7637d5, 0xc77addcc, 0x040d017e, 0x2d4b023e, 0xc18bf4dc,
+0x9ddcfc5c, 0x58916407, 0xad6de074, 0x8957f6c8, 0x479f0edb, 0x3cd589dc, 0x07fa22e9, 0x559c3ac4,
+0xfffc7352, 0x029c85cf, 0xf4fffa1e, 0x5d48d9fb, 0x512107df, 0x4551a9d7, 0xdf6ecb8e, 0x0a59c951,
+0xdb1cfe74, 0x5806a944, 0x9e4d3cac, 0x2edae438, 0x948c5a59, 0xcf66c03c, 0x91405c32, 0x095a2f8a,
+0x1c8135e9, 0xd6905faa, 0xc4050296, 0x5d1d04d5, 0xbb2979d7, 0x73563363, 0x9a443aa6, 0x949bf7f5,
+0xb1f0e2f4, 0xdaa0b0ea, 0xfa3646b4, 0x212930f4, 0xe5428845, 0x91fd9fc0, 0xd1699b38, 0xe8f864c2,
+0x7a576c5f, 0x14b442ec, 0x1760a5be, 0x1185072d, 0xa11b6d2c, 0x7311c298, 0x49dbfac5, 0xfdfda3b7,
+0x181b843a, 0x04b5972f, 0x2e2201c3, 0xfbd9ceef, 0x08d4cd96, 0xeb037558, 0xcfc663a3, 0xc93ee237,
+0x5d16ab3c, 0x0406d649, 0x7a5509e7, 0xe70cc7a5, 0x46923c5e, 0xaf062ce6, 0x98962ac0, 0x73c47748,
+0x1d4a7632, 0x3612e1f1, 0xd3dfea53, 0x20b7aa3f, 0x5eb3f95e, 0x94dab3d8, 0x2a0b2e53, 0xf5b33740,
+0x9aa5a87b, 0xc8e074ac, 0xf91ef084, 0xfef4f361, 0x48491e92, 0x9bfabf66, 0x4a297c1a, 0xddd9db51,
+0xf7714a40, 0xbbd68d0d, 0xd23a4748, 0xa53081b0, 0xa950824b, 0x90bcef08, 0x11beda69, 0x224dc658,
+0x00643ed1, 0xcec8484c, 0x59f36e60, 0x47cda628, 0xe5cb95e5, 0x9a7cf8b5, 0x32822a3e, 0x72125dfc,
+0x139269c0, 0xf518eb45, 0x71940491, 0x41dd1151, 0x87eb49e1, 0x236fd08e, 0xaede66ae, 0xbfa037cc,
+0x3fab5641, 0xbb1294de, 0x58818646, 0xd63c09bb, 0x4b131a6d, 0x9419f9c4, 0x122fdb7a, 0xdde8a133,
+0x5c1e79f5, 0x3b2cb296, 0xaa3edc40, 0x18a93769, 0x149068e3, 0x96d8ac40, 0xdd90844d, 0x6a00d925,
+0x79092a60, 0x298fda82, 0xf31d8ac2, 0x57017fae, 0xc69a67c5, 0x63d7cc02, 0x28eae175, 0x9f5fed55,
+0x4199a1b6, 0x23ec0793, 0xba2283f3, 0x36385be7, 0x7a821e53, 0xa42b1ec3, 0xbf7a5b5e, 0x9e190f7d,
+0x5a4187ca, 0x9fc9b4b3, 0xf085e208, 0x4d37de1b, 0x269ead9d, 0xf5d13640, 0xf25f0f24, 0x0df44450,
+0xf73b6e75, 0x2b3c7b84, 0xe7774fc4, 0x69d6a142, 0x1677c63e, 0x2a0bfba3, 0x977f97ca, 0xd23ffb71,
+0x7cb2da58, 0xc49d9ced, 0x6897cd63, 0xd0032dd8, 0x6f8931e9, 0x5db54cbd, 0xc84997f6, 0xed5e9c75,
+0x9abce2d1, 0x801b207d, 0x11778617, 0x19e272fa, 0x597d9e0a, 0x9dddc95f, 0xe01f4ede, 0x31adbb70,
+0xf6d94ac7, 0xeb61a4eb, 0x23db31bd, 0xf4ead5e6, 0x6c013a45, 0x409bd6c6, 0xd776ca3b, 0x13a3278d,
+0x0a8cb1f0, 0x1aad0132, 0xca8f203f, 0xd3f54096, 0xfa603de5, 0x083ea863, 0xa19ede8e, 0x427f9ca7,
+0x16614e6a, 0x5b96dc1a, 0x51ec2543, 0x9dc9fee5, 0xb72c17aa, 0x34c3b64e, 0x36423449, 0xd62d3471,
+0x6173988e, 0x257c9276, 0xe2fd88d2, 0x6bf34424, 0x54376a7b, 0x1fa5f4bb, 0xcfbc4df7, 0xac2fc153,
+0xb9ab1046, 0x657292f7, 0xc457b315, 0xc5a8258c, 0x82688286, 0xf15c9a99, 0xdc647aff, 0x3d9cb19e,
+0x1d288d9b, 0xcbd4f57e, 0x068eff84, 0xb2f0bcff, 0x9517630c, 0x8d900ef9, 0x7f01765f, 0xc4c05266,
+0xbea656b5, 0x7fa29e7d, 0x1136d825, 0xb168fb65, 0xcfd9dbcd, 0x7bd4711a, 0x05585149, 0x8adb1a91,
+0x843f0b61, 0xcd2bab30, 0x854959ee, 0x402bb88d, 0xd99aab9b, 0xffa772e3, 0x4027d3a1, 0xcbecb315,
+0x5c4829f4, 0xdbf49e7f, 0x930d4e50, 0xa581e405, 0x4a4ecdb7, 0xbe33474d, 0x16532105, 0x4f07db5b,
+0x668a67d2, 0x9c0b48f3, 0xe4d209de, 0x48b5555c, 0x37c9efdc, 0xe84c71d1, 0x59dd0c28, 0x9965690e,
+0xd7725fb1, 0x484ade09, 0xa1193d06, 0x8142c1e8, 0x7d98fbad, 0x3780c8b7, 0xf278ef19, 0x76c68b4f,
+0x55102634, 0xf9ccd433, 0xf76048e7, 0x0f91e266, 0x72bd4374, 0x367a801a, 0xe06c6504, 0x0e423d01,
+0xc433a801, 0x5096caba, 0x1f6f1f10, 0xa052df85, 0x13de475f, 0xd1ed6388, 0x4917a88d, 0x868e7444,
+0xc09d2ce9, 0xd2202e51, 0x6ab8c2b2, 0x33b78c75, 0xed9f0e67, 0x1e6c1070, 0x58055e91, 0x53ec6812,
+0x49ea8f65, 0x935334eb, 0x6ee5d456, 0x027b369e, 0xd7987c92, 0xa37af483, 0xdd6c7fe1, 0xac46ef27,
+0x45fb01cd, 0x8cbb6c77, 0x03200efa, 0xb6858079, 0xcdf77fa6, 0x35d15166, 0x174c2c51, 0xfa7cddd2,
+0xa58f67c8, 0x971cfb6e, 0x76fcaa45, 0xd2627639, 0x0c514d34, 0xc2e0df49, 0x08227756, 0x11d83b0f,
+0x8ede6a62, 0x01077605, 0x4d0693dc, 0x39002295, 0xa0435c2b, 0x0c287667, 0x789dfd9c, 0xddf9b6d5,
+0x2b8ec1a4, 0x6540a4d2, 0xc94adef6, 0xa0c32239, 0x03c881a9, 0xe072faef, 0xe5286b31, 0x9252c82e,
+0xc793bd2f, 0xb0759397, 0x8fa7cba7, 0xd6457e8c, 0xd4f92a70, 0xfe55fde6, 0x795c1198, 0x5aa4b8d9,
+0x69c01ce8, 0x9ce26be6, 0x66aa4c90, 0x939ddbf4, 0xd83f8446, 0x32cd5896, 0xc1e56020, 0xf53ba633,
+0x071e02b5, 0x477659cc, 0xb1f095ca, 0xe405d981, 0x8f4a7c36, 0xdf5af3bb, 0x8f196533, 0xab949098,
+0x17110782, 0xb1e1c9cb, 0x2a1bb785, 0xdf0fcad7, 0x19996ea9, 0x76df052f, 0x2c9771e3, 0xc18a6846,
+0x0c65a52b, 0x9a93d7aa, 0xfcbfcf00, 0xfad99f83, 0x2abfd889, 0x62c40280, 0x005c028d, 0x472b997d,
+0xb2677a11, 0x01de466b, 0x3f2df4b6, 0xa9efa867, 0xa1d9287b, 0x4e9aa7d4, 0x172a3ab7, 0xa1997e4d,
+0x6c5a4c56, 0x66a95c78, 0x84156d88, 0xa572ccc2, 0x9ab97777, 0x6105e0b9, 0x4df0b15c, 0x9788cc29,
+0x66514f10, 0x4e30558c, 0x8e733cd6, 0x842760f5, 0x559c30d5, 0xdc95b2d8, 0xdbae163c, 0x5f19c251,
+0xac606ff7, 0x52daa417, 0x7f902f10, 0xbbe4b183, 0x57785bc3, 0x5987dd66, 0x99255e46, 0xf150658b,
+0x3033cc2a, 0x592ab8b7, 0x5f6e707e, 0xd1ddfa9e, 0xa45cd462, 0xe6489e26, 0xca55a06c, 0x4d5c71ea,
+0x4aa55d71, 0x0a24feb4, 0x3eea2fec, 0x50a978b5, 0xa61f8c27, 0x78a6f84b, 0x832b94d3, 0x40aa168c,
+0x7dc886b9, 0x3087caed, 0x3251ff31, 0xf1310a5b, 0xaf1cbe91, 0x765d2c0c, 0x93106316, 0x46f640fe,
+0x9869cc07, 0x760cc955, 0x9de120c9, 0xa86eb0e8, 0xc759e85c, 0x554d82d0, 0x21df0327, 0x34123e0c,
+0xd243e840, 0x32f0f044, 0xcba0fca5, 0x0b1381ae, 0xa03b8e22, 0xdec4117d, 0x96433a79, 0x3b73693a,
+0x74b3e3c5, 0xddf39acc, 0xf2a22639, 0xf2df9e0d, 0x0e6d10a9, 0x2c40d38a, 0xf226f4a1, 0xde87fc0a,
+0xb21a085e, 0x7e227f6d, 0xf2e60f38, 0x3eda9716, 0x1afdd4b4, 0x42c5fce3, 0x28727c95, 0x8c1fc6d6,
+0x364b2c89, 0xe0137482, 0x4ac72ebb, 0x48d8df4f, 0xc7ceb9fe, 0xe39eee90, 0xe7740554, 0x6d2369f1,
+0x97a6d50f, 0x481d6e36, 0xb7e04fdd, 0x32cfeddd, 0xc4d0ed26, 0x5246f89a, 0x47f08593, 0x493007dc,
+0xc3ba31d9, 0xe5e78edf, 0xaff18c41, 0xc40d5821, 0x3d35683d, 0x0ea1322d, 0xe172bfd0, 0x7b06468e,
+0x7a625685, 0x124e8296, 0x6c49da5e, 0xd04b5269, 0xe53f3d02, 0xab854f0d, 0x72512c9b, 0xad62dacf,
+0xc7bea192, 0x19c7f0ec, 0x9354cf38, 0xb786157f, 0x017c0192, 0x6b6ee48f, 0x39bad067, 0xb3d5b80b,
+0xc77888dd, 0xe4e48e7b, 0xa9b996b7, 0xccf28f1c, 0x35f28b7e, 0xb02f3bb0, 0x8c979d6c, 0x151f9cd9,
+0xb2d09833, 0xdc715b4e, 0x1ec864ed, 0x448d4bd4, 0xacccf2f3, 0x92020b0b, 0x90954d1e, 0x6dc704db,
+0xf8b87abe, 0xde91de07, 0xa030e9db, 0x3ab16581, 0x699d0ffe, 0x299eef93, 0xbffe0033, 0xf5d88cd5,
+0x71a60b82, 0xdd502485, 0x924686c2, 0x189216fe, 0x234ce451, 0xa1670c8b, 0x901dfd3c, 0xe32fea80,
+0xc1fa880e, 0x95eafb02, 0xd8ecb1a6, 0xc1b9a6f4, 0x74be4d2b, 0x13d0c91e, 0x877f66cf, 0x70650d13,
+0xd9028826, 0x6cff996c, 0xbd1a4530, 0xa0a96a6f, 0x0079b94f, 0x22e31a93, 0x35477a91, 0xbc173bd4,
+0xb3378428, 0xa975cffe, 0x81db2b64, 0x369ac6f3, 0xb1ca6503, 0x4169064d, 0xeea163ee, 0xb963ec66,
+0x5a7d2992, 0x199f009b, 0x8883c27a, 0x8862d6dc, 0xf9c25ab5, 0x7fcd696d, 0xe8e5c632, 0x5ca44740,
+0x4fe5eabc, 0x5b44bcaa, 0x76b7de71, 0x381eec39, 0x8aa57724, 0xacf86272, 0xe1eedd12, 0x6eb84604,
+0x6df6f041, 0x2e6f637a, 0x568f1dc6, 0xa2e1495d, 0xbf0a2e3e, 0xc97b2e41, 0xe904e14c, 0x502eb027,
+0x6852a350, 0x19e60e95, 0x51bbd6ad, 0x569a685a, 0x64680e1a, 0x6d32a9bc, 0xbb509f8c, 0xaec42bae,
+0x8a101773, 0x21b99a93, 0xd59011db, 0xa30249f3, 0xeb1ac94a, 0xcb457fb3, 0x658b58c9, 0x1149b336,
+0xd9b0ee3c, 0x5a305af1, 0xeceb5b7b, 0x2226b284, 0x4c73d0c3, 0x3a94d3ce, 0x4599f783, 0x7d6f9152,
+0x8ec2e622, 0x486fed19, 0xee50f510, 0xb9a1a7b7, 0x454c5ccd, 0xb734ae65, 0x27297233, 0xe6667965,
+0x18fb04b1, 0xaba41004, 0x82fecc8f, 0xfb1d0491, 0x90f5978e, 0xdcdf54ba, 0x3ec1be7b, 0x7cc16774,
+0x3af181e0, 0xf434ec16, 0xf6e1262d, 0xe701a7e9, 0x45921406, 0x4f8f4a61, 0x4b49dc88, 0x35293bb8,
+0x343a880e, 0x84a8a250, 0x05d1a204, 0xf7643c2a, 0x07464a2a, 0xd0c169f2, 0x1417e356, 0xc65e0235,
+0x2b752d57, 0x0cac0224, 0xc1d181b3, 0xc238252e, 0x0f39be31, 0x3255961c, 0x1fb417b6, 0x86b513f6,
+0x70fc0970, 0x01bf77e7, 0xf30717bf, 0xf2d40062, 0x34ac7c40, 0x24ac16fb, 0x6d93ce80, 0xfedc58ae,
+0x45aad2ee, 0xab77f41a, 0x3d7fc154, 0xe9f433da, 0x88f5601d, 0x6634253d, 0x853ced87, 0x0c7970f0,
+0xa707af5f, 0x2f2ea065, 0x28a3eeab, 0x05d2c9be, 0xdafe4dc9, 0x4c4564b3, 0xfe40a57e, 0x87201630,
+0xf4597342, 0xec7a66f8, 0x18751ca2, 0xbbf4a89e, 0x54eeba08, 0x5111bb2c, 0x5eb931b5, 0xa18d910a,
+0x6676657d, 0x59b25373, 0xec8120e4, 0x78f2ecf0, 0xbfe13273, 0x68120cf0, 0xc88ade76, 0x3f7ab4bb,
+0x0e2387e2, 0xb18b677e, 0x6719eb26, 0x271c0826, 0x5d6a04c8, 0xf1f2c3e5, 0x1ea0c781, 0xc8832dc1,
+0xd827c702, 0x078bf317, 0x263f16a8, 0xfad2d887, 0xdddf9212, 0xc03731f4, 0x41a47af1, 0xeaa5bf30,
+0xa4e101f9, 0xe2fcb6e3, 0xef3b11ab, 0x8e95480a, 0xd8a746e7, 0x9641270e, 0xd94ac667, 0x1e2fcc6e,
+0xce27f0a6, 0x47043e75, 0x0bd46362, 0x9f13ef57, 0x9efc4ca5, 0xbded0e35, 0x948869f3, 0xde802ab5,
+0xb0cf7ef7, 0x29de89c1, 0x58448faa, 0x13a3417f, 0x5fedb263, 0xb4c89d7a, 0x14ef2576, 0xed21a460,
+0x58dd447f, 0x53ba5166, 0xeec65ea4, 0xff19692f, 0x442aeceb, 0x021a2f28, 0x022f278d, 0xaeb82ed5,
+0x7fc40cfe, 0xfc445690, 0xffce246b, 0x9a3ea761, 0x9b68328b, 0xc447c51e, 0x40c2d96d, 0xf3e85390,
+0x80bc65af, 0x1e71cd49, 0xf2a01aab, 0x1b253584, 0xa3fcfa21, 0x92980769, 0x87b4634c, 0x4e53b761,
+0x1e7a771b, 0x1706c0ff, 0x4f4f6acf, 0x50c3cc9f, 0x10b981d9, 0x2a55b314, 0x15dac111, 0x15a056a9,
+0x3e37dab8, 0x31f93d30, 0x8d3dee0c, 0xd86c2cba, 0x3ab4afb6, 0x69ff517f, 0xe193630e, 0x35bfa7a5,
+0x23532dae, 0x92328095, 0xd2d0bf55, 0x1022eb09, 0xa99046b5, 0x379fc636, 0x1147ce38, 0x175d23dc,
+0xcd74a53c, 0x9610005d, 0x1460b6a9, 0x3adec55f, 0xfc410198, 0x9f38b6c7, 0x0f4f8879, 0xb92cc75f,
+0x068ab224, 0x12a7602e, 0x8f3529ff, 0x1aa4cba3, 0x7eacfbee, 0xd46b9e7e, 0xb61446f9, 0xfdd0cb49,
+0xa616e925, 0xdc74bc67, 0xd0557c0e, 0xb72df853, 0xc02b8a8f, 0xe6c4f704, 0x7229c5d2, 0x47faf983,
+0x4f4617d7, 0x6ecdc6e1, 0x572951c8, 0x7f5e154c, 0x1ca045b4, 0xe94c0a0d, 0xf06b3b9d, 0xc0996085,
+0x88c32dcf, 0x0aa43e8d, 0x26ac682f, 0xf6f777b8, 0xf03f0bcc, 0xfeee7b10, 0x97c3c504, 0x4467f80f,
+0xa47ceb82, 0x5281e1ce, 0x4af93c49, 0x20274ebc, 0x757e4cb5, 0x33ca3747, 0xb235fcc1, 0x5ab80583,
+0xe8620a7e, 0x8e2ca94e, 0xf412a366, 0x826df86a, 0x087c3fde, 0x9c012e9f, 0x5b941f46, 0xdd6b791e,
+0x7d56c82a, 0x51a291c7, 0xdbb35769, 0xeffb2f9f, 0xce50d179, 0x9dd16496, 0xc133c69a, 0x4503dc59,
+0xe0d734d3, 0x0e9ce6ea, 0x58c01cae, 0x51439d25, 0xadaa46a9, 0x3d3b3f4c, 0x682aa1cb, 0xafb2ad30,
+0x40d677ee, 0x8df78364, 0x4a44e1a8, 0x8355d3f8, 0xc3e7f0c4, 0xb12504e6, 0xe6c97091, 0x848141cb,
+0x58ad2a62, 0x96d14cb1, 0xd23a7f2b, 0x0429e769, 0x71d33728, 0xf3c7501c, 0xb78ef3e4, 0x40d508c0,
+0x59ea210c, 0x930e541b, 0x92f0bc03, 0x73b5b18d, 0xd150caa4, 0xe202edbe, 0xefc133c5, 0x1e32772a,
+0x42735269, 0x210fb4f1, 0x9f5cd3bf, 0xb67f0bb1, 0x73d8bef1, 0x8b601c6a, 0x789b964f, 0x25991711,
+0x86b2dd8a, 0xf1840525, 0xf4d58ce7, 0x04b5de46, 0x92b3c94c, 0x9759b713, 0xdbaadc38, 0x98cce4d5,
+0x5356e227, 0x07e460d3, 0xa0e67e42, 0x544925fd, 0x058f6de1, 0x9c7960dc, 0xd4da7425, 0x2a10ce0c,
+0x21f76736, 0x9ac0901d, 0x31c10e8b, 0xc8a85f15, 0x44b21872, 0xd9c52ee7, 0xa256c103, 0x60d3937f,
+0xbcfe4a7f, 0xe98812ea, 0xfd678bfc, 0x66fb8387, 0x8b93caf0, 0x37f4cb60, 0x1b16a977, 0x7330d534,
+0xa22bfc0f, 0xa5904ddf, 0xc5f5eed5, 0x69d25848, 0x5b640b65, 0x4e2edd80, 0xb8c96e17, 0xe4831dd5,
+0x98db3c53, 0x4cc62871, 0xc79772a8, 0xf1f55678, 0x7ae2115e, 0x0c560552, 0xa9ccf9bf, 0x74d74e7f,
+0xc6eec006, 0x2f4273fb, 0x8a81c910, 0x8e6cfdca, 0x82feb368, 0x2cddb635, 0x70051c65, 0xed99ad3b,
+0x2205ebdc, 0x7e9d6861, 0x427e44d0, 0xdc95d35a, 0x723cd9ad, 0x167a2dae, 0x4c5cda40, 0x7128dd3b,
+0xe84da9e9, 0x9c204997, 0x6c167ec3, 0x044eb65b, 0x1803bc7f, 0x766883f8, 0x3d74b4b0, 0x3bd0501c,
+0x98d65408, 0xa7fe2866, 0xc0162ed2, 0xc16e1075, 0x7ed20ea3, 0x359842eb, 0x279cda89, 0xb1546931,
+0xccecabee, 0x35e79927, 0xba890c11, 0x1fefc11b, 0x87d3a3a6, 0x33b331b8, 0xf95e9ee5, 0x1ba74676,
+0x6d1fa536, 0x8b3ea9b1, 0x65
+
+output0 =
+0xf690942a, 0x97bdb1e4, 0x09424ccd, 0x889e9e34, 0x31ab42d9, 0x64f6e870, 0x4d40bec9, 0xbe1ef1be,
+0x16931279, 0xf20b7fd3, 0x95c573f4, 0x31ffbe30, 0x688da438, 0x6b6007eb, 0x5a260e45, 0x7f7aa70c,
+0x763ef9a8, 0x88d7462d, 0xe5ff459f, 0x569aedd3, 0x2c6bdb69, 0x760ec5ca, 0xbf62878e, 0x387ed56f,
+0xe0684b83, 0x4349ffdd, 0x174aebb5, 0xf7b2f234, 0xd99a61bf, 0xc7545637, 0x2d7dd337, 0xdae6fc0e,
+0x6effdb34, 0xbc20c2ef, 0x2e798268, 0x3fb85d13, 0xbd3edc92, 0x3dc41751, 0xbfad303d, 0xc8e5456f,
+0xf4dda60d, 0x17e88c3d, 0x3ad6d451, 0xe4ce2e70, 0x0207a59e, 0x8d602dc7, 0x7844b2a2, 0xd6060ade,
+0xff66a3c0, 0x0d2084e7, 0x7ff2e162, 0xe8aa2801, 0x40330fa5, 0x1f0ee92a, 0xfe1bba67, 0xb3f26ba0,
+0x5118bcf4, 0xcc5e5a6b, 0x39bc7fe6, 0xe182aa52, 0x46afcfb1, 0xd3f7fb9b, 0x9fb3d086, 0xc4dc5a3c,
+0x77f8a14c, 0x6ef18e9a, 0x116463b6, 0x231f9692, 0x5486e22e, 0x17d8207f, 0xfb7583d0, 0x5ccb33de,
+0x0917da21, 0xe6df15b0, 0x6c6ed483, 0x97b89955, 0xde4703cf, 0x7dd81d04, 0x52e2d139, 0x3103974e,
+0xda6d46cf, 0x6a5b757b, 0x93bf2f42, 0x52cc52d5, 0x6914b439, 0xf82d4b98, 0x729f24fe, 0xa2abd634,
+0x38e342f6, 0x35451eab, 0xa956000b, 0xa8c79693, 0x19fa68d1, 0x80d52a87, 0x765f6246, 0x3a006cd7,
+0x8e19ab7f, 0xe02c37bb, 0x93ddd723, 0x0821fd01, 0xa068c39f, 0xbd40070e, 0xbd48ccbb, 0xfac0c066,
+0x5a066d82, 0xa86c8e00, 0x219aa8bb, 0x175d5495, 0x13767c65, 0xbf9ace5e, 0x570e9b3f, 0x09993d78,
+0xb8aa41f6, 0xaabf8b95, 0x1f5ccb78, 0x96915f8a, 0x018539c6, 0x7e6f09f6, 0x18f6acff, 0x7c185595,
+0xafbcf3fe, 0xf05eb9e7, 0x97c38881, 0x16abb79c, 0x09d035f5, 0x2d00c99f, 0x90e3154d, 0x451204f1,
+0x4caf2a85, 0x0acc10d9, 0xc4ffc5aa, 0xa847977c, 0xa236d10f, 0x16485325, 0x62d1230f, 0x2d8e2b45,
+0x86c78e24, 0xd5bfd27a, 0x4c64f6ee, 0x0602d6ef, 0xe075a9ea, 0x3509eae5, 0xb6ba837a, 0xa2052483,
+0x25e1a262, 0xff2abb89, 0xf7c9c91e, 0xb1fd3b41, 0x462406d8, 0xfc058416, 0x1c40d32b, 0x6e6aadb0,
+0x1324d11d, 0xbad5e44e, 0xb7049b55, 0xe0d70a43, 0xca08027c, 0x598a58b4, 0x14c74fa5, 0x98db9187,
+0xb910b813, 0xd903f18d, 0x12b2799a, 0x376da769, 0xc672807c, 0xa582679f, 0x494491ab, 0x5bed475d,
+0x32ac9126, 0xcbc77408, 0x909eb968, 0xd05ff8fb, 0xa5d46934, 0xe2930b07, 0x19127406, 0xa56d8591,
+0xc12f6abf, 0x3d58da57, 0x779ac440, 0x162a5701, 0xfbdb62c0, 0x153eaed0, 0x55d496aa, 0xd8dc8faf,
+0xa2f82af4, 0x160cbf11, 0xed7587d6, 0x9a5219df, 0x6bc11e7a, 0xb2ee98b4, 0x18a14f0c, 0x291c9cf8,
+0xcf84be87, 0x7bd37549, 0x513df1bb, 0x50b889cc, 0xb5304496, 0xb5f3a45a, 0x492de2dd, 0xe0c9fb57,
+0x4cf7be64, 0x58299e5e, 0x36b89425, 0x186d63ed, 0xacfc9181, 0x84ebf56d, 0xe200dae3, 0x3a430131,
+0xbe4f2b77, 0x32189609, 0x86c6a14e, 0xcc654220, 0x284877a5, 0xe0263e71, 0x96cdf8b2, 0xd194071e,
+0x9dff2560, 0x8fd65d33, 0x8f75043d, 0xa3936859, 0x16f2129d, 0x41b86611, 0x23ed2400, 0x05bc4e6a,
+0x7924908e, 0x3240c348, 0x1463ab1d, 0x10a4176d, 0xb688d5c5, 0xfd76b8c5, 0x595a4e41, 0xc02367e6,
+0x6cbe2b22, 0xb23cfa6b, 0x3e284a7a, 0xd4992177, 0xc93ec5bb, 0xdaaeaf1b, 0x7b2b69f1, 0x2d1e27fb,
+0xafc83a71, 0x553b31d0, 0x9f9408a4, 0xb2b1047b, 0xf0bfd411, 0x20af5a39, 0x6b09a021, 0xf79943db,
+0x45f001e3, 0xba39d592, 0xda038c55, 0x658f1f65, 0x3b27c92c, 0x3765469c, 0x1d97c758, 0x365aa095,
+0x9f0bdeff, 0x68692433, 0x267cda88, 0x4eb34d37, 0x2ef7e1da, 0x99c65582, 0x034e0e56, 0x81175ff1,
+0xb3af3ae7, 0x8d8bff1d, 0x9d0b7eae, 0x63aeca43, 0xa5296fcc, 0xcf4311eb, 0x6f633120, 0x192bbf00,
+0xc42d2db5, 0x96e5e39e, 0x9a058c61, 0xbb363125, 0x32821f9f, 0xa3f9812e, 0x1412008b, 0x332c02f2,
+0x53710e69, 0x56039aa1, 0x36aacf24, 0x22a2888c, 0x841d7bca, 0x9582ecd9, 0x51d9079c, 0x17b5ac6f,
+0x58a77687, 0x1628fc67, 0x9f080c5d, 0x25b0dcaa, 0x86af6889, 0x49441a16, 0x1b90bbe0, 0x12720d9b,
+0x337dbcff, 0x7fe6fef4, 0xb6ad124f, 0x38817314, 0xdb75030a, 0xa6021928, 0xfad32be9, 0x5f42075f,
+0xb93bde63, 0x169e7138, 0x2c9e081d, 0x14f7632a, 0x867dc112, 0x82ac4eb4, 0xbf8881cd, 0x7123001f,
+0x00a79cdb, 0xf2b37725, 0x4fe3f649, 0xf91ab3de, 0x594b21b8, 0x824b9dd7, 0x86f4c8e7, 0xbb843bc6,
+0x6c9fcac9, 0xeb8aa526, 0x05158637, 0x6dc5c8f3, 0x76600664, 0x508ead2d, 0x40e5e256, 0xdf7958f0,
+0x5747cfe2, 0x3877ffdc, 0x11f9d3b0, 0xa2550567, 0xc391129f, 0x4fc5fbbb, 0x9098626c, 0x17435e96,
+0x3e46ced4, 0xd10b829c, 0x569cd35c, 0x22cd04d9, 0x6c83e3bc, 0x3af817ba, 0xf931cb4f, 0xff612783,
+0x304ad058, 0x5f8daaed, 0x6ccbe124, 0x80fff3fe, 0x51fa21c4, 0x1d267d3c, 0xa02b8b84, 0x120bf3dd,
+0x53fc63be, 0x0e70dc18, 0xbe80d86d, 0xf3a2b3b1, 0x09579c67, 0x0eb7d831, 0x4e794d7a, 0x5314ff3a,
+0x97e51a2e, 0xf7f8e20c, 0x49baaa2d, 0xd8bc6420, 0x219364ba, 0x05d999d5, 0x6464ca46, 0x7d79fd03,
+0x4246a824, 0x81114cb4, 0xec729683, 0x68fa6517, 0x413542e6, 0x55fddafa, 0x0a0c88df, 0x8f81ef0b,
+0x897cf998, 0x37d3bd4e, 0x67c62c51, 0x99640163, 0x45372886, 0x7e923097, 0xc5389a43, 0xdb91a6a5,
+0xbeff35f2, 0x0c0eaf69, 0x0ad80229, 0x9310a6e5, 0x3e4dfc82, 0xb644f4df, 0x89d69826, 0x3c9dc18a,
+0x40d5aaec, 0x0746bdb0, 0xeefe5ef1, 0x30d23508, 0x981f9492, 0x8627eca9, 0xf0f3020f, 0xd9459ce6,
+0x102d297a, 0xe4eafbac, 0x0946a3c7, 0xfda640be, 0x937bd23c, 0x93cebb29, 0xc598ee7d, 0x8628c20c,
+0x6c8251c1, 0x0116c27b, 0x7adc872c, 0x779ce9de, 0x2832df36, 0x275e9f9e, 0x66ade6ef, 0x8436ee17,
+0xfb06b3d2, 0x014f9a31, 0x92a97678, 0x90ff14b8, 0xca578ca7, 0xf44299fa, 0xbcf6e11a, 0x2a97c505,
+0x4779346a, 0x3ca14066, 0x38c64d73, 0xdb599cab, 0xa2ad0720, 0x344dbeaf, 0xc004aa65, 0xa1756fa3,
+0xf54aa477, 0x12783a97, 0xb13ad2bb, 0x86185384, 0x96dffd80, 0xdcdcc58a, 0xf56a80f2, 0xb32170c4,
+0x7f613497, 0x871f7382, 0xd79f6a9b, 0xfa444729, 0x7e0ced9e, 0xa71e7978, 0x4adebd54, 0x53043dbb,
+0x11850000, 0xcbf20157, 0x0298346f, 0x4b968944, 0xe23eb1a7, 0xd6af0010, 0x5d456aba, 0x558c9210,
+0x70820458, 0x71e61ea0, 0xcf112929, 0x0e8c5bcb, 0xe577c26e, 0xf3a32fae, 0x74cbf9a7, 0x70bf8761,
+0x3010f7af, 0xbfb34732, 0xb327c739, 0x2d46ed0a, 0xf3fce891, 0x87f5e409, 0x3b1ffce7, 0x20efaf5e,
+0x1d6889f3, 0x037e9aa6, 0x9746c14c, 0x40cadc87, 0x9dc2da7a, 0xe9964b84, 0x9e28b792, 0x5ae6c4a4,
+0x45a27fd6, 0x7dc5f8ef, 0xc02b338e, 0x600cde92, 0x1cdd7b6e, 0x46e48e4c, 0x5df1ed0e, 0x7d0e13a5,
+0xe204910a, 0x5da27a6a, 0xae2c1dba, 0x4a53a8ca, 0x4f7934bb, 0x74f9df33, 0xb2eaef55, 0x06f4f544,
+0x167f9df0, 0x7074d5d0, 0x51c3cf7a, 0xec879c3c, 0x164a95ef, 0x47bfac95, 0x7a4ef159, 0x8de27e54,
+0x1cfb6a00, 0x860390a4, 0x3c0de75e, 0xf5876182, 0xed03beaf, 0xe8ad8bb3, 0x80259434, 0x08550962,
+0x885c3017, 0x460d88d3, 0xd1ea8f87, 0xef4a44da, 0x9178d2d2, 0xa3a4536b, 0x46fb423d, 0x094f70a8,
+0x7399f93d, 0x0bc9feed, 0x840cb076, 0x6096ae96, 0x126fec3e, 0x133bc8cd, 0x77f07640, 0xc516a5fb,
+0x81ce644e, 0xb2b20edf, 0xa785f0e1, 0xc14ba294, 0x9194f8d0, 0x73b5c5df, 0x64d93999, 0x64770c87,
+0x5af360b0, 0xa3469227, 0xb2881e32, 0x3fc1a290, 0x1c7f51dc, 0xc4499532, 0xb0652a33, 0xfce6cc52,
+0x033333d5, 0xbf7ef720, 0x4616a008, 0x744e151c, 0x0d2210ae, 0xe3171000, 0x7df8f60e, 0x9cdccf61,
+0x96126efc, 0xa2a5dafa, 0x1e8304c2, 0x2abc4565, 0x8e4185de, 0xebfc7078, 0x6bdfbd6a, 0x5d756c1f,
+0x42d2f01f, 0xb09c40fd, 0xaa424f36, 0x5a2f890b, 0xc85aea2e, 0x95b3ede1, 0x42866f91, 0xdd21f7f0,
+0xc5c7cb28, 0xe46a2f45, 0x28f5c77c, 0xab978ab4, 0x673c60f5, 0xa76194c7, 0x6d6e94c9, 0x464967f2,
+0x0dc5fa90, 0x423e253b, 0x9521126d, 0xce4e612c, 0x217250f8, 0x8fd10eef, 0x27cbcf40, 0x66c5f77a,
+0x7fdd1428, 0x5a803f25, 0xcc8eb41f, 0xd84df81a, 0x2667c030, 0xc0454e9f, 0x0a540a1c, 0x1e943641,
+0x45f26f1f, 0xd77eb2cb, 0x364010dc, 0xbc84f9c6, 0x5e7b5c70, 0xbb5d23c3, 0xb5a2edf1, 0xa94c7803,
+0xebe419e1, 0xc7a9c777, 0xe4744a65, 0x357b74dc, 0x5a884088, 0x70842a6c, 0xd5a979cc, 0xb2872021,
+0x5d79809c, 0x1ad5cfd0, 0x5c1276d4, 0xd4fad768, 0xd640beb0, 0x2ec4e920, 0xe2bddbcc, 0x7b7ea960,
+0x4f9a3a4c, 0xce57cf51, 0x3068683f, 0x740df2f9, 0x14855fd2, 0x6c1410de, 0x7e20e8dd, 0x35890b59,
+0x316cc694, 0x54203dd1, 0x60d0f75f, 0x55ca0fed, 0x06898039, 0x5e92627e, 0xd2f56f52, 0xf75737a1,
+0x5cebdcee, 0x10d29efc, 0xb76d842c, 0xa32e605f, 0xdecfc2cc, 0xac34b1fc, 0x46f5fc6f, 0xd1591a3d,
+0xd88bb24b, 0x3656986c, 0x26563e0f, 0xfcfad5c1, 0x6d6abe00, 0xc819134c, 0x6abafe6b, 0x7204fd38,
+0xf3207153, 0xbc7b698a, 0x1530c692, 0x70c0be43, 0xb674586d, 0x635b82aa, 0x75b08ee6, 0xaaea74a2,
+0x2501326e, 0x1e8b59bd, 0xb023f492, 0x00aee5f6, 0xbbfc6491, 0x8c42fc95, 0xbb796282, 0x600c2293,
+0xe4cb7406, 0xd4a4c8fa, 0x6e36bd85, 0x9bceb5fe, 0x6e4505e7, 0xecab0fcd, 0x2b1f3ce9, 0xea8a3739,
+0xc911c418, 0xb4f5c575, 0xe5342fdc, 0x2fd88173, 0x6f7a16b3, 0x0bb82572, 0xbbd11789, 0xefcb4899,
+0x4da28124, 0x9ba40d7a, 0xe7d8fa1e, 0xe23a9d68, 0xd7c0effa, 0xcff717b3, 0x6ed89228, 0xdb741b39,
+0x705d6e1f, 0x7bf87de3, 0x4c1de32e, 0x6db3d17a, 0x47893039, 0x22d31a3f, 0xcc725dcc, 0xd9d0d85e,
+0xac80413b, 0xbb661b21, 0x56d9050b, 0x9d007604, 0x312f7541, 0x4a37f702, 0x8b8effbd, 0x7d067750,
+0x9cc28409, 0x8c6bc23d, 0x43306b51, 0xf7317955, 0x3c160c99, 0xb0e3d60f, 0xc23b4f4d, 0xefc1c753,
+0x4c4aff7e, 0xd64a8cbb, 0x868273f9, 0xedbe83c5, 0x8865edba, 0xd2bba474, 0x868133ee, 0xd202a360,
+0xdb88b9c9, 0x6c8281b2, 0xacf3c102, 0xd3253f57, 0xa2894060, 0x79976f39, 0x34eb1a38, 0xae45af9c,
+0xcea1aaa8, 0x1626d035, 0x65622d1d, 0x2f0b2603, 0x0c07e443, 0x55dab61f, 0xb4822c56, 0x056fbb16,
+0x10893d6c, 0x07d9cb6e, 0xbd46cb33, 0x5e275703, 0x53c47a3a, 0x23129ab9, 0x58b75c32, 0x6a3066ed,
+0xf58f62d8, 0xeb32bce3, 0x0d2ad7c4, 0x40293ff1, 0xa4665c62, 0x4b26a80e, 0x69488ee8, 0xe74dc068,
+0x6ee221f4, 0xbdf32463, 0xb7ea30f2, 0x3e75c7aa, 0xa315b315, 0xe71fb414, 0x1317f977, 0x3188f27c,
+0xad075875, 0xb9d1ecbc, 0x8ecad97b, 0xc8926384, 0x6f97e481, 0x09c82916, 0x0694ef16, 0xd2250a4b,
+0x5bf124d3, 0x40d042bb, 0x9c67e10e, 0xc2635f49, 0x8f0cca9a, 0x10d56753, 0x56394fcd, 0x15a3396a,
+0xf0584405, 0xe29f7e61, 0x55e67a53, 0xb225f132, 0xe9b693b1, 0xd23f658d, 0x04084aa9, 0x91437ade,
+0x94c9e2ac, 0x63a81e0b, 0x3fdaeb14, 0xe58bb18f, 0xa608674f, 0xeb08ab8c, 0x266f9e91, 0x20a247c3,
+0x38c47ccb, 0xaac11899, 0x1c20b8cb, 0x2355e513, 0xa3b2d570, 0x40cf8111, 0x0fbac6fc, 0x2ac0dc55,
+0x9b3f2f3c, 0xc3139c54, 0x2d443470, 0x67f68f0d, 0x8830b8a3, 0x9511bdc2, 0x5c44e175, 0x66f79d4d,
+0x64eca6c0, 0xe3499348, 0xdb1e12d0, 0x370f88d6, 0xc3f2791b, 0xb832a3f2, 0x77d0521e, 0xf0036ef3,
+0x95fefc9b, 0x8b3ae29f, 0x4eda39a4, 0x12536897, 0x8ddad95f, 0x7c11cef3, 0xe4154b17, 0xc2e388dd,
+0x5ce5c69b, 0x064221d4, 0xaf1b617d, 0xaf4b7186, 0x53f8f582, 0x816e3f1a, 0x00a306ed, 0x52f6ef17,
+0x68d93236, 0x41173b4d, 0x61c5ffce, 0x4dc0d0be, 0xaca0ff32, 0xe4ff8277, 0x120e826f, 0xd52e262c,
+0x66827d76, 0xda5b1e9f, 0xfee6387b, 0x7005d47b, 0x0b049d56, 0xdcf6a4d7, 0x27ac9663, 0x453c93c0,
+0x2e38e234, 0x7cfe2736, 0xdab7b0b9, 0x00f1d773, 0x99da6b76, 0x5c171181, 0xc810c77d, 0x0e27a276,
+0xd1af39ea, 0x80fec544, 0x2205dc24, 0xdafa47d9, 0xc5e08f2b, 0x0cfdddfa, 0xcb843f9a, 0xa52f186b,
+0x27cd8efb, 0x74924771, 0x21f8a411, 0xda6f830e, 0xb9017c5a, 0x53ebf07d, 0xc50f59b4, 0xb7cca99a,
+0x5fc62c94, 0xe329d696, 0x8f692514, 0x0d83ae14, 0x0b697893, 0x85c69b36, 0xab3d1285, 0xb29d7e78,
+0x406a0fa6, 0x337f4bb0, 0x0c3de707, 0x4c7d71c8, 0xc0332445, 0xf61d16ab, 0x01862b19, 0x8b963de7,
+0xacf7b650, 0xfd8c511f, 0x6356f669, 0x757e29c9, 0x79b7fd6c, 0xabecd50b, 0x10b9fc5e, 0x784c1cb0,
+0x08ab8fa5, 0x1335e4b0, 0x44b75723, 0xa9317f1e, 0x3e1051a9, 0x7be42a04, 0xd9e86ba8, 0x04efc822,
+0xee824d97, 0xb0534b7a, 0x6ed250f1, 0xa38da157, 0x46dd1dd4, 0x73586bb6, 0x5270a77a, 0x31c460ca,
+0xf17a54cb, 0x7cbbc937, 0x19fdada0, 0x65c0e5fd, 0x7520c3be, 0x643560d6, 0x4bdfdf90, 0x1b903707,
+0x1ce06160, 0x5bb8a868, 0xc7f71a7d, 0xb5a092bd, 0x2d7bfd09, 0x610b2a13, 0xae0fef7c, 0xe72c8793,
+0xe7941bf5, 0xff8cccf2, 0x25ff3b32, 0x1a1ec5fb, 0x2886513e, 0xb8c7e05f, 0x16a7d161, 0x7df9727b,
+0xdec3115f, 0xd6b903b5, 0x10d22e00, 0x91f1a899, 0x3249d0c8, 0x4c5bbcda, 0xe692f82a, 0x2b5495e2,
+0xb405f241, 0x116654ee, 0x163c68a0, 0x33699a79, 0x506587a3, 0x0a6ef4d6, 0x68687151, 0x78f844e6,
+0xfcf0747d, 0xfd049f15, 0xce27160b, 0x8a067513, 0xd42c58c1, 0x5c6febbe, 0xbe9ab351, 0xa3cb004c,
+0x7a154bd3, 0xde1d43f2, 0x0757f5ba, 0x9eea9bcb, 0xad99600c, 0x79007225, 0x8b80bbc1, 0xa6494f49,
+0xd19c5576, 0x25169481, 0xb541333a, 0x05b934a6, 0x38089141, 0x35aad753, 0x9451bc05, 0x6fca2e2f,
+0xf7196eda, 0x2b603ccb, 0xe0b57c2d, 0xc1992e60, 0x5ad987e9, 0xcabe9391, 0x19f30b1e, 0xff43d8c5,
+0x77796bef, 0x08c18937, 0x50b39a59, 0x7af3b1c8, 0x0bce4ad0, 0xba0793ed, 0x9a606f19, 0x3f3f84d1,
+0xff96bacb, 0x02cb465b, 0x076070ac, 0x92f23af4, 0x33886f0a, 0xb00bc421, 0x7a6780dd, 0xf3fae0dd,
+0xfecc391c, 0x5d0ae0e1, 0xe834ffb7, 0x0cd74ae7, 0x95d832bf, 0xc7abe74a, 0x1c6bbd11, 0x313a220c,
+0xa79c695f, 0x786b49b1, 0x8314d497, 0x1f2d00e9, 0x480d17ca, 0x7592d08d, 0x0405ad3d, 0xec7431a1,
+0xb617a9b6, 0x0d55c4a8, 0x20f2c4af, 0x2ac7a905, 0xb9822be0, 0x25832c56, 0x99087a83, 0xa994f666,
+0x8e444309, 0x6e4fd02a, 0x7362a6f4, 0x1769d572, 0xf6f68631, 0xe33cd8e7, 0xc1f7b898, 0x4e255ef8,
+0x17e77be1, 0xe5535db2, 0x33cb4054, 0xaee92bc1, 0xc583178e, 0x58602446, 0x520465f8, 0x805b81f8,
+0x5ec51006, 0x122a2bc3, 0xc7456e09, 0x8654b402, 0x1725dabf, 0xda59d4c1, 0xb1630123, 0x202e42cf,
+0x6d03c0c4, 0x58044033, 0xa6ddd488, 0xbfae228a, 0x01914e16, 0x8bc20acd, 0x5e2a9b0d, 0x52aa9362,
+0xc7c9eb45, 0xb5925cd4, 0x7794d4da, 0x74f615b4, 0x455bc62c, 0x139f5871, 0xa8b643ca, 0xebcca0b2,
+0x4b502cd3, 0x1ae6b0f3, 0xf659ed9b, 0x8178a8af, 0x01013584, 0x0affb832, 0x02bc9176, 0x89602571,
+0xbff37bff, 0x4384b1e8, 0x39afafb4, 0x866906f3, 0x308853f9, 0x621d2617, 0xf784d13d, 0x25c0cd96,
+0x8e1546b7, 0x50bf63f5, 0x921f6b7f, 0x4661624c, 0xdfbb727a, 0xe652372c, 0x3b4b2d70, 0x55e1e45e,
+0xffd6c3cb, 0xbf4efe20, 0x041c3e6a, 0x96b9e930, 0x35f89446, 0x1b5c8222, 0x56529132, 0xfe700b4b,
+0x9b5fc3e9, 0x6b9911c3, 0xd8b00e12, 0xac975c76, 0x34f5c77a, 0x9622d735, 0xc2e862a1, 0xa7f352ec,
+0x341a447b, 0x80d4e366, 0xa18a2bf0, 0x4dac1dbd, 0x692b2787, 0x688fde0b, 0xa21b456c, 0xcac5c769,
+0x36547232, 0x0d7e85b8, 0x4cdc3a71, 0xe98ac05e, 0xbe1c2a16, 0xf2459a61, 0x7588ef51, 0xd6c71c73,
+0x873fbd17, 0x78af36ec, 0xe1a62f3f, 0xb9bfc692, 0x06301428, 0x648d8eac, 0xea9d0a91, 0x2dfca974,
+0x3a7cba0d, 0x938bb495, 0x6d176a5e, 0xdc2dd8f7, 0x92516e27, 0x3c361e4e, 0x5391b964, 0xe771760d,
+0xc2ac7307, 0x5118ccef, 0xa7dc0375, 0x201cba41, 0x916a4221, 0x78406994, 0x4bae1997, 0x1e99265f,
+0xec9f9971, 0xdf9a7755, 0xd8a7aada, 0x1f73b436, 0xde150a0f, 0xbbb357f5, 0xb6123aec, 0x29d94822,
+0x20b10220, 0x2ae2de80, 0x029b5aec, 0x408d331f, 0x9c6c75b4, 0x2f6b41cd, 0xb509868c, 0xaadef6c3,
+0x62c19305, 0xd50fd1fc, 0xcf926f1b, 0x11fc719f, 0x91eaebb5, 0xa3543ca4, 0x9168176d, 0x721316bb,
+0xebd56480, 0xeeaf330b, 0x3533453d, 0x893ebe6c, 0xff497844, 0x7342bec3, 0x78c2e6c3, 0x69911944,
+0xde42bfb2, 0xe802e446, 0x5b9e30b8, 0xcb6e8fd9, 0x7ad20299, 0x9499bfe6, 0xc767474f, 0x2306e85c,
+0x89b01dc6, 0xf0fc2d90, 0x2f467c98, 0x4e9f9a5a, 0xd828b94c, 0x6b690eee, 0xda058cea, 0xfa0b0fc2,
+0xccbc7890, 0x786b2507, 0x7d780c14, 0xf21f3f2e, 0x0e70e425, 0xc92bacd8, 0xb744dc1c, 0xe96bb8a1,
+0x7d7d4ba3, 0x5d216901, 0x0beeb8c5, 0x4fdc299f, 0xe4d7a429, 0x71f39835, 0xe9360a14, 0x86698189,
+0xd840ab53, 0xb252de53, 0xba0af67f, 0xa4ad7aac, 0x951c8078, 0xf9730896, 0x3c04bb39, 0xaf37dd22,
+0x49823e8c, 0xc7acdad4, 0xce837484, 0xb4f0b30f, 0xfda69a9d, 0x32b93116, 0xa7ca9609, 0x422a3f5d,
+0x2be869da, 0xc1b92841, 0xe2f70814, 0x3cc3b240, 0xf7a6980a, 0xc0e17c29, 0xd6033290, 0x16e4c508,
+0x5e154612, 0x09ee03eb, 0x2528efd6, 0xe4aac04d, 0xa7d66a68, 0xb4f59c12, 0x828bd31f, 0x0ff3b8c2,
+0xcbcdd28d, 0x416551e3, 0xfb2641ed, 0xf0934461, 0x77403f32, 0x15977dc1, 0x0d45beb6, 0x5e494ec8,
+0x427ae8a7, 0x5f61b4d5, 0x8ddf209e, 0x237cf236, 0xa3a34484, 0x4bb69022, 0xbc690766, 0x76e1c2d0,
+0x54194602, 0xb7572cda, 0xfdb5a8ee, 0x444ba245, 0xaa2c985f, 0xf07deac8, 0x725fd936, 0x5de1fc70,
+0x287649ad, 0x685fbe45, 0x0ed921fb, 0x82ef5e95, 0x1fb9641b, 0x306894b0, 0xdfbffe48, 0x6984f041,
+0xd01f24bb, 0x079400ff, 0x37709e53, 0x48711ac6, 0x4116a686, 0x7d822ae9, 0xd3332c40, 0x30c6be5a,
+0x43d6e44f, 0xb3a4948f, 0x3cf79b5c, 0x3ff0155e, 0x448df55d, 0x7ee00fdd, 0xf456068b, 0x5ef85991,
+0xa2ba3b3b, 0xd03463c0, 0x5306ff03, 0x8f794d50, 0x1cb90bf6, 0x110c823f, 0x7174e8d3, 0xee735d22,
+0xb8fc9f9f, 0xe349b47e, 0xd7b4b715, 0x3d381e23, 0xd6964b5a, 0x1a41b8fa, 0x5ea504e7, 0xb2f0fda9,
+0x8e3a0763, 0xbbae49a3, 0x28501717, 0xbc6aed6d, 0xcaa93fa5, 0x55b8f778, 0xa75416dd, 0x65fcd7ab,
+0xa7149228, 0xbf32883c, 0xbb8d6022, 0xe3b5eb31, 0x5b2cca37, 0x817eee8a, 0xeb6b4abe, 0xff0853c3,
+0x6c7dbda1, 0xf04da9f2, 0x32f0245e, 0x5a45d240, 0xb85baeb8, 0x09619854, 0x2ee82e51, 0x72b412a6,
+0xbf6712f5, 0x9e23ba44, 0xb341502e, 0xdd18e9dd, 0xc3b5a3c8, 0x466e8798, 0x31d4233c, 0x736b1083,
+0xeb960c67, 0xe53cfb48, 0xb4c794d6, 0xb752eff5, 0x6c82a7eb, 0x02a51f58, 0x7f09f694, 0xa449b1b1,
+0x9e54e12f, 0xc679adfa, 0x20995bd5, 0x03aa591f, 0x2a828763, 0x7266d954, 0xdcb0a47e, 0xcbadcfc5,
+0x16abd270, 0xe7e13511, 0x4faf024c, 0xb752db07, 0x0e8e1c9d, 0x7790dc90, 0xae565a6d, 0x65a4452d,
+0x85596c5b, 0x3d167e41, 0xacdca137, 0x6839fd43, 0x84667bf5, 0xee45a3b5, 0xa773c09b, 0xbc074a51,
+0xeb11bc77, 0x8476ac79, 0x15a6edb2, 0xf940d2e5, 0x802debe0, 0x1701def4, 0xff1c3625, 0xff7602b4,
+0x6e8847e8, 0x78c5c9a0, 0xb8818b12, 0x94bea57d, 0x5f6bc1bc, 0xad51e7e0, 0x3b8ee452, 0x2299a03b,
+0xc996313e, 0xd582a0d6, 0x69f1cb04, 0xf7b03037, 0xda6031c3, 0xdaf2c42e, 0x547c1bcb, 0xc85ba742,
+0xf67251c5, 0xac7bd05a, 0x742b2e18, 0x2b1343fe, 0x6407d757, 0x9501e8c7, 0x7b10d9bc, 0x0cf23c43,
+0x13051cfd, 0xd853682f, 0xb99ecea0, 0x70044abc, 0x4b00bc0e, 0x4d151f93, 0x6894f897, 0x37d9e99e,
+0x50bf8d94, 0xbc6419f4, 0xef984161, 0x9a60c3e1, 0xdda8aa61, 0x71a1a989, 0x7aad3274, 0x11a38bb4,
+0x30cfbce5, 0x27d7410f, 0xb866b15b, 0x6efef725, 0xed36eb9c, 0x67b7099f, 0xe42db6f8, 0x30ecad93,
+0x8c0e7426, 0x28acdf9d, 0xe695b151, 0x87eef9a6, 0x0cfba599, 0x91d6bc59, 0xfcef35f6, 0xca78a142,
+0x1f152d70, 0x6929bb33, 0x66567410, 0x04332777, 0x833cb07e, 0x10bd4837, 0xb54dcf4a, 0x383417d9,
+0xabac3628, 0x2c1e4d75, 0x3c55a006, 0x60183f9e, 0xdf3cf8f4, 0xbb4e3cab, 0xdfe0c707, 0xb499b83d,
+0x6a86436e, 0x6fd9f508, 0x3912b7f0, 0x3da741dc, 0xfb909f04, 0x42bfe9a0, 0x86b7e88e, 0x27ee8892,
+0x1dd12a32, 0x7c1e0b6e, 0x389bfa4e, 0x8ae84b3d, 0x94009549, 0x66eecaf1, 0xf9ef1c93, 0xe76e9c63,
+0x393e21cc, 0x31bc2c9e, 0x29201de2, 0x133e6d78, 0x1099415b, 0x27d15bec, 0x28435521, 0xafbb17a5,
+0x2e90d111, 0x15233948, 0x02e2767e, 0x5a18c2f9, 0x4b413b43, 0xd2ef6649, 0x226860cf, 0x5391da82,
+0x1a0c69dd, 0x72bf736a, 0x19ade906, 0xb325f926, 0x4c5edff9, 0x5abe6e2b, 0xf16e2387, 0xc1606a04,
+0xe353f85a, 0x1467c159, 0xa8151d58, 0xa54c33d8, 0x886c197f, 0xca3daf3f, 0x7964f9fe, 0xd9b8189a,
+0xbc73922b, 0x24ac27fe, 0x58c50007, 0xf8509bc1, 0x2467d28d, 0x1f0e44c1, 0xebd7d409, 0xd87ecd16,
+0x75414244, 0xba21372d, 0x1897b692, 0xb8a6831c, 0x579f4de8, 0xc19db76e, 0x0255cc42, 0x82fbe999,
+0xca935c73, 0x548e46ae, 0xa5e685af, 0xcdfb5ef2, 0x8e13b71e, 0xc630de10, 0x6354b0f2, 0xd03d3c96,
+0x1456eb16, 0x6e60ab57, 0x512aa67b, 0x68b3d913, 0x04e2808a, 0xaeabb2f7, 0xb5a7050b, 0x7f7d51c0,
+0xcf0a8ceb, 0x4ac10855, 0x6ce17403, 0x1d678fc7, 0x7fc6a65b, 0x31f83707, 0x42d995d6, 0xd1562de7,
+0x6c8355ab, 0xab0a2e61, 0x4c29b2c7, 0x77b46f73, 0xb87cc1c7, 0xa26857e5, 0x7103f34a, 0x4c0da95b,
+0xccc43b4c, 0x454f6436, 0x9d7fb501, 0xda0efc3b, 0xfdf7ab90, 0x31c14578, 0xbf893cf4, 0x714e6ae0,
+0x3f330f22, 0x58930f8f, 0xbe2b0493, 0xd45b0811, 0xfce1cf51, 0x2235ea01, 0x5f389de8, 0x1d6a8c1f,
+0x207dc635, 0xd9bdecbd, 0xec4f0e8a, 0x8f13e668, 0x0ed66fed, 0x4436a2d1, 0xb1cec1d0, 0x5c6fd3c4,
+0x552fcb59, 0x4bb0c90b, 0x01990769, 0x96f4df07, 0x0b488e99, 0x5dcf02bf, 0x8c223aa5, 0xbec03723,
+0x7bb0b5bc, 0xa36c4723, 0x558e0f65, 0xff88d022, 0x37135241, 0x26c4ded6, 0xb5e96e68, 0xf2071b6b,
+0xcd67fcac, 0x4a8a3130, 0x12d0d41c, 0x4429514f, 0x7e3236d0, 0x947b245a, 0x42f3b830, 0xc02e0787,
+0xbf878531, 0xf531f3d0, 0x3e0cbb94, 0x1df64dc9, 0x2a1206c2, 0x8d21dd6a, 0x374ce54b, 0x9d62fc7f,
+0x0d32940e, 0x9fbccd02, 0x38246063, 0x1560414a, 0xea6ed90f, 0x9fa55e17, 0xfdec9c69, 0xf43ee80f,
+0x067c88df, 0x076c9e72, 0x48360f1f, 0xdd0d2737, 0xd0f245b4, 0x04a50415, 0xd803e008, 0x0c2d713b,
+0x45242861, 0x61c8b578, 0x956c0954, 0x271158c5, 0x2c6289f7, 0x22da4bea, 0x2a34c673, 0xabd0d3a0,
+0x8efd21b5, 0xa80608dd, 0x40fc1f14, 0x123fac2f, 0xfc9d384f, 0xe64a5d6c, 0xb96479e2, 0x0a5f71f9,
+0x5b7f3a24, 0x98462b08, 0xbc9d3670, 0xbf0b09d2, 0xaca9f544, 0x1ffae7c4, 0x8e7bdc9f, 0xbe608661,
+0x279a80da, 0x77f82d66, 0xf7631447, 0xa55cc59d, 0xd6161250, 0x6e5c4acd, 0x981b6ba2, 0xe0c4dbca,
+0x2e9d29ed, 0xa7d51085, 0x89302615, 0x40e7fb38, 0x4b4621ad, 0x8f15702d, 0xeefd4189, 0xc7efc927,
+0xaedf1dc0, 0x0ca723bd, 0x0801de0d, 0x9713c0fe, 0x1181a73e, 0x27e47a37, 0x3a54473d, 0x315f58e5,
+0xd7a349cb, 0x8e5bdc59, 0xe51bc827, 0x9c511861, 0xc020e5fa, 0x9df6d9e7, 0x8280ce46, 0xb4791cc0,
+0xe1955dc7, 0x1735c478, 0xf3e5e25a, 0x23b85b00, 0x8169e275, 0x462ebafe, 0xa416a938, 0xff95db7d,
+0xe559940c, 0x2dfe9649, 0x49c0d033, 0x7dae9063, 0xc5b5ac39, 0xbfcdc599, 0x8ef2ae01, 0x8f225bc0,
+0x53b3818b, 0x5d37b35e, 0xf4ac1398, 0x25ed45cd, 0x2987fb6d, 0x0e6b571f, 0x523a6510, 0xcc3fab8b,
+0xceec45e1, 0x47362006, 0xd08c6c1f, 0xec80a22c, 0x4c1f067d, 0x62d164ed, 0xd4aa46cf, 0x3333f7df,
+0x0301c8e1, 0xfd4ff58b, 0xa989e981, 0x07f80bef, 0x3ed517c3, 0x3d610c23, 0x45860fdb, 0x1edb9324,
+0x2b8531a0, 0x10c65424, 0x53a4927d, 0xe7c48c26, 0x8889f999, 0x8f10943b, 0x9484c062, 0xbb4f044f,
+0x9dd65dc8, 0xa1c78b8c, 0xc4c0f55a, 0xab178246, 0xefd6a6a3, 0x5dd67272, 0xc6c530eb, 0x065f9264,
+0x892c2aaa, 0x62d48e66, 0x628130cf, 0x999ba495, 0xdb56dbc0, 0xc4d6ff7f, 0xe082862a, 0x1c1410f4,
+0x05359247, 0xf1ca87d0, 0xcfd29f18, 0xc035941d, 0xaef3f0ea, 0x4dfc27ca, 0x3b9a3ba5, 0x0be120ac,
+0x3be36789, 0x0a5119f0, 0x87c726b9, 0xfc5f253e, 0x316bfa18, 0xb781ed7d, 0x3151729d, 0x7d79f36c,
+0xe29b9f74, 0x6b5d1945, 0x814c4862, 0xd137fc75, 0xde2cf8ba, 0x6d981463, 0x89ec7133, 0x244b7e74,
+0xca67bad5, 0x42e1572c, 0xe0cc4edd, 0x22723b4d, 0x0f7b5637, 0xcaa4d7a8, 0x20939d38, 0xb3fa57c9,
+0xdb40d2c7, 0xa56842a7, 0x23b1dc4a, 0x76a6c142, 0x75957b95, 0x1c88efd2, 0x474aabec, 0xdd64c7d9,
+0x7b7af462, 0xfb8becc4, 0x253b460e, 0x5e30ea57, 0x6fde8164, 0x445880d4, 0x9aa1e840, 0x9647d819,
+0xce5aaa18, 0x2bfadc27, 0xc03125bf, 0xb7747c00, 0x38964e8b, 0x38c21e10, 0xfa82a5f1, 0x5c52051a,
+0x3349a05f, 0x137a8e49, 0x93534899, 0x8ad17547, 0x796fcded, 0x9597502d, 0x2a7d8732, 0xf7727077,
+0x5359e13d, 0x27041ae4, 0xdfa05d40, 0x2e4ac04a, 0x4041ff37, 0x2a729f49, 0xc27fd299, 0xbfa8e384,
+0x9ba85c81, 0x5c5a4992, 0xfb37a677, 0xca908601, 0x226947f2, 0x91d5c8cd, 0x6c77c172, 0xba6d0427,
+0x5d10a9ef, 0xedc2b707, 0x81e75cdd, 0xda2aee14, 0x131d2260, 0x3ea2ffb9, 0xc8898110, 0x63dd39fa,
+0x89d93abb, 0x4e58fb47, 0x220c9301, 0x65633322, 0xc9d3541f, 0xc01901ba, 0xca7fa0ff, 0x5ffcb976,
+0x0aa82473, 0xb3d4e716, 0xb546a254, 0xc748f3d4, 0x6419e517, 0x0e5e63d5, 0xcec671b8, 0x0a91e10e,
+0x14ab1ba6, 0xdce0d59c, 0xbf8fcdee, 0xe513fef3, 0x7d950f51, 0x95f4d55a, 0x4386f226, 0xcc373edc,
+0xdca46e63, 0x98e6d1a2, 0x8ca77f40, 0x193cc148, 0x8e2ad7fe, 0xc01ede01, 0xd2440ded, 0xda8c8d52,
+0x93dcd063, 0x53916334, 0xf8208a54, 0x92d94b0e, 0xeea097dc, 0x264916d1, 0xbcb943ca, 0x31938475,
+0x2ebfaf57, 0xef78e891, 0xa83931a3, 0xf6921ff3, 0x178f1373, 0xa48fe882, 0xda6cc367, 0x5759b350,
+0xfec71d2a, 0xef614290, 0xc96852ab, 0x3cb31a88, 0x6f66dc0e, 0xf72fccfc, 0x23adb282, 0x18693ad7,
+0x9b94938f, 0x96f658a9, 0x3ac6199f, 0x77305aae, 0x6366691f, 0x8c933c8e, 0xd9b98545, 0xd909411f,
+0xefc7663e, 0x35ea0dae, 0xa5bc1ef4, 0xb03c39b1, 0x69b3d1fc, 0xc040d02b, 0x5a7db8f0, 0x00bcebc7,
+0x0276f258, 0x5f904832, 0x3bba0c61, 0xba5f952b, 0x908f5ed3, 0x16572a07, 0xbff00fd3, 0xaab41f96,
+0x913cc7da, 0x13c010e3, 0xee82213c, 0xdea296c0, 0x8addd3d3, 0xd2615b26, 0x6536a0a4, 0x0b8295e1,
+0x0b9f820b, 0x7c86c4b7, 0x2ce62cba, 0x5fa391bb, 0xbae4c3a8, 0x0dd2e316, 0x853598eb, 0xfc7c72e5,
+0xe09259be, 0x0029c25b, 0x82b6c98d, 0x617175e7, 0xbf745f18, 0x6e72d7ff, 0xaca5248a, 0x495ece7c,
+0x3d73d20d, 0x64553f72, 0x52dcc787, 0xc0875aad, 0x6ca56335, 0xeefc0be8, 0x79df339c, 0xe4538a88,
+0xcfabfbe6, 0xa4d3735b, 0xcbe90994, 0x99c93144, 0xe2c0ec75, 0x1da85ee5, 0x10058338, 0x3c95dd37,
+0xb8dd19f5, 0x7cb41b59, 0x0cbfe332, 0x0db88c1a, 0xc75b1820, 0xcef99013, 0x7c68d434, 0xb50f28e6,
+0xad3e0cd3, 0xdea2fbfd, 0x32aee281, 0x1f97b387, 0x271467eb, 0x9fb04999, 0x34befaea, 0x0cd2833d,
+0x7a057371, 0x696c0476, 0x295d9119, 0xd37825d0, 0x4d5cca28, 0x0b19f782, 0x9c10f380, 0x389b63c6,
+0x8cb5145c, 0x076d5df1, 0x9b1ef391, 0xf6f27f9f, 0x7ad4763e, 0x282258ca, 0xd43b6a78, 0xe1dd4fa5,
+0xe6aca89f, 0xa68ba12e, 0xfcda14de, 0xb59fe4a4, 0xeafcd76c, 0xeb59a642, 0x96361d47, 0x59c8bb5b,
+0x8902ba21, 0x1fd038df, 0x142f2d4f, 0x3e6b6743, 0x6280987d, 0xc415b758, 0xd78497f3, 0x8cfaa21b,
+0xcad85f1a, 0x3a3e011e, 0xbfaeb19f, 0xe1bb6dd8, 0xc94a1f36, 0x056794a1, 0x73d04f6a, 0x36e57618,
+0x94ba1d36, 0xcdb808f0, 0x836b063c, 0xb743c5fd, 0x8e90bee5, 0x84d5260d, 0x35c22810, 0x0e2553fb,
+0x3c207370, 0xf516ea0b, 0xb898d4cc, 0xf3b06d89, 0x8d02c0ef, 0x97f2ff5b, 0x7b720eac, 0xcadda54a,
+0xbd5bb36e, 0x194c0962, 0x6f9dabb0, 0x09a8b7a6, 0x8d3cf3ba, 0x312024e4, 0x58757d48, 0xaeda503c,
+0x0a887160, 0x749c41be, 0x2ad1d602, 0x235ab171, 0xdd1ec388, 0x74c44261, 0x338d8fb2, 0x6a5e4ceb,
+0x70a59f94, 0x458c246f, 0xa991bbd2, 0x2e430135, 0x36fc3ee6, 0xc4d5d668, 0x13dff20f, 0x8de15ac7,
+0x6d860423, 0x1e08a389, 0xf55f5e95, 0xa02bcfa5, 0xda1f61e7, 0xca675a68, 0x616543e3, 0x83cdafd4
+
+basegraph=
+2
+
+z_c=
+384
+
+n_cb=
+19200
+
+q_m=
+2
+
+n_filler=
+160
+
+ea =
+5460
+
+eb =
+5462
+
+c =
+12
+
+r =
+0
+
+cab =
+4
+
+rv_index =
+0
+
+code_block_mode =
+0
+
+op_flags =
+RTE_BBDEV_LDPC_CRC_24B_ATTACH
+
+expected_status =
+OK
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [EXT] [PATCH v3 0/8] baseband: add NXP LA12xx driver
  2021-04-13  5:17   ` [dpdk-dev] [PATCH v3 0/8] baseband: add NXP LA12xx driver Hemant Agrawal
                       ` (7 preceding siblings ...)
  2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 8/8] app/bbdev: add test vectors for transport blocks Hemant Agrawal
@ 2021-04-13 10:06     ` Akhil Goyal
  8 siblings, 0 replies; 157+ messages in thread
From: Akhil Goyal @ 2021-04-13 10:06 UTC (permalink / raw)
  To: Hemant Agrawal, dev, nicolas.chautru; +Cc: david.marchand

Hi Nicholas,

Could you please review this series?

Regards,
Akhil

> This series introduces the BBDEV LA12xx poll mode driver (PMD) to support
> an implementation for offloading High Phy processing functions like
> LDPC Encode / Decode 5GNR wireless acceleration function, using PCI based
> LA12xx Software defined radio.
> 
> Please check the documentation patch for more info.
> 
> The driver currently implements basic feature to offload only the 5G LDPC
> encode/decode.
> 
> Modifications has been done in test vectors to optionally support input in
> network byte order. Two test vectors are also added as an example with
> input data in network byte.
> 
> v2: add test case changes
> v3: fix 32 bit compilation
> 
> Hemant Agrawal (6):
>   baseband: introduce NXP LA12xx driver
>   baseband/la12xx: add devargs for max queues
>   baseband/la12xx: add support for multiple modems
>   baseband/la12xx: add queue and modem config support
>   baseband/la12xx: add enqueue and dequeue support
>   baseband/la12xx: add documentation support
> 
> Nipun Gupta (2):
>   app/bbdev: add parameter to take input in network order
>   app/bbdev: add test vectors for transport blocks
> 
>  MAINTAINERS                                   |    9 +
>  app/test-bbdev/test_bbdev_vector.c            |   18 +-
>  app/test-bbdev/test_bbdev_vector.h            |    2 +
>  app/test-bbdev/test_vectors/ldpc_dec_tb.data  |  362 +++++
>  app/test-bbdev/test_vectors/ldpc_enc_tb.data  |  482 +++++++
>  doc/guides/bbdevs/features/la12xx.ini         |   14 +
>  doc/guides/bbdevs/index.rst                   |    1 +
>  doc/guides/bbdevs/la12xx.rst                  |  139 ++
>  doc/guides/rel_notes/release_21_05.rst        |    5 +
>  drivers/baseband/la12xx/bbdev_la12xx.c        | 1178 +++++++++++++++++
>  drivers/baseband/la12xx/bbdev_la12xx.h        |   57 +
>  drivers/baseband/la12xx/bbdev_la12xx_ipc.h    |  237 ++++
>  .../baseband/la12xx/bbdev_la12xx_pmd_logs.h   |   38 +
>  drivers/baseband/la12xx/meson.build           |    6 +
>  drivers/baseband/la12xx/version.map           |    3 +
>  drivers/baseband/meson.build                  |    2 +-
>  16 files changed, 2550 insertions(+), 3 deletions(-)
>  create mode 100644 app/test-bbdev/test_vectors/ldpc_dec_tb.data
>  create mode 100644 app/test-bbdev/test_vectors/ldpc_enc_tb.data
>  create mode 100644 doc/guides/bbdevs/features/la12xx.ini
>  create mode 100644 doc/guides/bbdevs/la12xx.rst
>  create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.c
>  create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.h
>  create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_ipc.h
>  create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
>  create mode 100644 drivers/baseband/la12xx/meson.build
>  create mode 100644 drivers/baseband/la12xx/version.map
> 
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v3 3/8] baseband/la12xx: add support for multiple modems
  2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 3/8] baseband/la12xx: add support for multiple modems Hemant Agrawal
@ 2021-04-14  0:02       ` Chautru, Nicolas
  2021-04-14 12:10         ` Hemant Agrawal
  0 siblings, 1 reply; 157+ messages in thread
From: Chautru, Nicolas @ 2021-04-14  0:02 UTC (permalink / raw)
  To: Hemant Agrawal, dev, gakhil; +Cc: david.marchand

> -----Original Message-----
> From: Hemant Agrawal <hemant.agrawal@nxp.com>
> Sent: Monday, April 12, 2021 10:17 PM
> 
> This patch add support for multiple modems by assigning a modem id as dev
> args in vdev creation.
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>  drivers/baseband/la12xx/bbdev_la12xx.c     | 60 ++++++++++++++++++++--
>  drivers/baseband/la12xx/bbdev_la12xx.h     | 56 ++++++++++++++++++++
>  drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 20 ++++++++
>  3 files changed, 131 insertions(+), 5 deletions(-)  create mode 100644
> drivers/baseband/la12xx/bbdev_la12xx.h
>  create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> 
> diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c
> b/drivers/baseband/la12xx/bbdev_la12xx.c
> index 8d3041ce28..7e9be74bb4 100644
> --- a/drivers/baseband/la12xx/bbdev_la12xx.c
> +++ b/drivers/baseband/la12xx/bbdev_la12xx.c
> @@ -14,6 +14,8 @@
>  #include <rte_bbdev_pmd.h>
> 
>  #include <bbdev_la12xx_pmd_logs.h>
> +#include <bbdev_la12xx_ipc.h>
> +#include <bbdev_la12xx.h>
> 
>  #define DRIVER_NAME baseband_la12xx
> 
> @@ -22,18 +24,18 @@ RTE_LOG_REGISTER(bbdev_la12xx_logtype,
> pmd.bb.la12xx, NOTICE);
>  /*  Initialisation params structure that can be used by LA12xx BBDEV driver
> */  struct bbdev_la12xx_params {
>  	uint8_t queues_num; /*< LA12xx BBDEV queues number */
> +	int8_t modem_id; /*< LA12xx modem instance id */
>  };
> 
>  #define BBDEV_LA12XX_MAX_NB_QUEUES_ARG  "max_nb_queues"
> +#define BBDEV_LA12XX_VDEV_MODEM_ID_ARG	"modem"
> +#define LA12XX_MAX_MODEM 4

Minor : best to be consistent with prefix used throught the PMD. A bit of a mix and match.

> 
>  static const char * const bbdev_la12xx_valid_params[] = {
>  	BBDEV_LA12XX_MAX_NB_QUEUES_ARG,
> +	BBDEV_LA12XX_VDEV_MODEM_ID_ARG,
>  };
> 
> -/* private data structure */
> -struct bbdev_la12xx_private {
> -	unsigned int max_nb_queues;  /**< Max number of queues */
> -};
>  static inline int
>  parse_u16_arg(const char *key, const char *value, void *extra_args)  { @@ -
> 52,6 +54,28 @@ parse_u16_arg(const char *key, const char *value, void
> *extra_args)
>  	return 0;
>  }
> 
> +/* Parse integer from integer argument */ static int
> +parse_integer_arg(const char *key __rte_unused,
> +		const char *value, void *extra_args)
> +{
> +	int i;
> +	char *end;
> +
> +	errno = 0;
> +
> +	i = strtol(value, &end, 10);
> +	if (*end != 0 || errno != 0 || i < 0 || i > LA12XX_MAX_MODEM) {
> +		BBDEV_LA12XX_PMD_ERR("Supported Port IDS are 0 to %d",
> +			LA12XX_MAX_MODEM - 1);
> +		return -EINVAL;
> +	}
> +
> +	*((uint32_t *)extra_args) = i;
> +
> +	return 0;
> +}
> +
>  /* Parse parameters used to create device */  static int
> parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params, @@ -
> 73,6 +97,16 @@ parse_bbdev_la12xx_params(struct bbdev_la12xx_params
> *params,
>  		if (ret < 0)
>  			goto exit;
> 
> +		ret = rte_kvargs_process(kvlist,
> +					bbdev_la12xx_valid_params[1],
> +					&parse_integer_arg,
> +					&params->modem_id);
> +
> +		if (params->modem_id >= LA12XX_MAX_MODEM) {
> +			BBDEV_LA12XX_PMD_ERR("Invalid modem id, must
> be < %u",
> +					LA12XX_MAX_MODEM);
> +			goto exit;
> +		}
>  	}
> 
>  exit:
> @@ -88,6 +122,7 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,  {
>  	struct rte_bbdev *bbdev;
>  	const char *name = rte_vdev_device_name(vdev);
> +	struct bbdev_la12xx_private *priv;
> 
>  	PMD_INIT_FUNC_TRACE();
> 
> @@ -103,6 +138,20 @@ la12xx_bbdev_create(struct rte_vdev_device
> *vdev,
>  		return -ENOMEM;
>  	}
> 
> +	priv = bbdev->data->dev_private;
> +	priv->modem_id = init_params->modem_id;
> +	/* if modem id is not configured */
> +	if (priv->modem_id == -1)
> +		priv->modem_id = bbdev->data->dev_id;
> +
> +	/* Reset Global variables */
> +	priv->num_ldpc_enc_queues = 0;
> +	priv->num_ldpc_dec_queues = 0;
> +	priv->num_valid_queues = 0;
> +	priv->max_nb_queues = init_params->queues_num;
> +
> +	BBDEV_LA12XX_PMD_INFO("Setting Up %s: DevId=%d,
> ModemId=%d",
> +				name, bbdev->data->dev_id, priv-
> >modem_id);
>  	bbdev->dev_ops = NULL;
>  	bbdev->device = &vdev->device;
>  	bbdev->data->socket_id = 0;
> @@ -174,4 +223,5 @@ static struct rte_vdev_driver bbdev_la12xx_pmd_drv
> = {
> 
>  RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
> RTE_PMD_REGISTER_PARAM_STRING(DRIVER_NAME,
> -	BBDEV_LA12XX_MAX_NB_QUEUES_ARG"=<int>");
> +	BBDEV_LA12XX_MAX_NB_QUEUES_ARG"=<int>"
> +	BBDEV_LA12XX_VDEV_MODEM_ID_ARG "=<int> ");
> diff --git a/drivers/baseband/la12xx/bbdev_la12xx.h
> b/drivers/baseband/la12xx/bbdev_la12xx.h
> new file mode 100644
> index 0000000000..5228502331
> --- /dev/null
> +++ b/drivers/baseband/la12xx/bbdev_la12xx.h
> @@ -0,0 +1,56 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright 2020-2021 NXP
> + */
> +
> +#ifndef __BBDEV_LA12XX_H__
> +#define __BBDEV_LA12XX_H__
> +
> +#define BBDEV_IPC_ENC_OP_TYPE	1
> +#define BBDEV_IPC_DEC_OP_TYPE	2
> +
> +#define MAX_LDPC_ENC_FECA_QUEUES	4
> +#define MAX_LDPC_DEC_FECA_QUEUES	4

Minor: What does FECA refers to through the serie? FEC accerator?

For consistency I would rename _ENC_OP_TYPE to _LDPC_ENC_OP_TYPE to distingish with 4G.
Same comment as above from prefix

> +
> +#define MAX_CHANNEL_DEPTH 16
> +/* private data structure */
> +struct bbdev_la12xx_private {
> +	void *ipc_priv;
> +	uint8_t num_valid_queues;
> +	uint8_t max_nb_queues;
> +	uint8_t num_ldpc_enc_queues;
> +	uint8_t num_ldpc_dec_queues;
> +	int8_t modem_id;
> +	struct bbdev_la12xx_q_priv *queues_priv[32]; };
> +
> +struct hugepage_info {
> +	void *vaddr;
> +	phys_addr_t paddr;
> +	size_t len;
> +};

This should be in the next commit I believe.
Notably as this hugepage_info usage is a bit odd.

> +
> +struct bbdev_la12xx_q_priv {
> +	struct bbdev_la12xx_private *bbdev_priv;
> +	uint32_t q_id;	/**< Channel ID */
> +	uint32_t feca_blk_id;	/** FECA block ID for processing */
> +	uint32_t feca_blk_id_be32; /**< FECA Block ID for this queue */
> +	uint8_t en_napi; /* 0: napi disabled, 1: napi enabled */
> +	uint16_t queue_size;	/**< Queue depth */
> +	int32_t eventfd;	/**< Event FD value */
> +	enum rte_bbdev_op_type op_type; /**< Operation type */
> +	uint32_t la12xx_core_id;
> +		/* LA12xx core ID on which this will be scheduled */
> +	struct rte_mempool *mp; /**< Pool from where buffers would be
> cut */
> +	void *bbdev_op[MAX_CHANNEL_DEPTH];
> +			/**< Stores bbdev op for each index */
> +	void *msg_ch_vaddr[MAX_CHANNEL_DEPTH];
> +			/**< Stores msg channel addr for modem->host */
> +	uint32_t host_pi;	/**< Producer_Index for HOST->MODEM */
> +	uint32_t host_ci;	/**< Consumer Index for MODEM->HOST */
> +	host_ipc_params_t *host_params; /**< Host parameters */ };
> +
> +#define lower_32_bits(x) ((uint32_t)((uint64_t)x)) #define
> +upper_32_bits(x) ((uint32_t)(((uint64_t)(x) >> 16) >> 16))
> +
> +#endif
> diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> new file mode 100644
> index 0000000000..9aa5562981
> --- /dev/null
> +++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> @@ -0,0 +1,20 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright 2020-2021 NXP
> + */
> +#ifndef __BBDEV_LA12XX_IPC_H__
> +#define __BBDEV_LA12XX_IPC_H__
> +
> +/** No. of max channel per instance */
> +#define IPC_MAX_DEPTH	(16)
> +
> +/* This shared memory would be on the host side which have copy of some
> + * of the parameters which are also part of Shared BD ring. Read access
> + * of these parameters from the host side would not be over PCI.
> + */
> +typedef struct host_ipc_params {
> +	volatile uint32_t pi;
> +	volatile uint32_t ci;
> +	volatile uint32_t modem_ptr[IPC_MAX_DEPTH]; } __rte_packed
> +host_ipc_params_t;
> +
> +#endif
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v3 4/8] baseband/la12xx: add queue and modem config support
  2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 4/8] baseband/la12xx: add queue and modem config support Hemant Agrawal
@ 2021-04-14  0:41       ` Chautru, Nicolas
  0 siblings, 0 replies; 157+ messages in thread
From: Chautru, Nicolas @ 2021-04-14  0:41 UTC (permalink / raw)
  To: Hemant Agrawal, dev, gakhil; +Cc: david.marchand, Nipun Gupta


> -----Original Message-----
> From: Hemant Agrawal <hemant.agrawal@nxp.com>
> Sent: Monday, April 12, 2021 10:17 PM
> 
> This patch add support for connecting with modem and creating the ipc
> channel as queues with modem for the exchange of data.
> 
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>  drivers/baseband/la12xx/bbdev_la12xx.c     | 564 ++++++++++++++++++++-
>  drivers/baseband/la12xx/bbdev_la12xx.h     |   5 +-
>  drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 180 +++++++
>  3 files changed, 746 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c
> b/drivers/baseband/la12xx/bbdev_la12xx.c
> index 7e9be74bb4..0a68686205 100644
> --- a/drivers/baseband/la12xx/bbdev_la12xx.c
> +++ b/drivers/baseband/la12xx/bbdev_la12xx.c
> @@ -3,6 +3,11 @@
>   */
> 
>  #include <string.h>
> +#include <unistd.h>
> +#include <fcntl.h>
> +#include <sys/ioctl.h>
> +#include <sys/mman.h>
> +#include <dirent.h>
> 
>  #include <rte_common.h>
>  #include <rte_bus_vdev.h>
> @@ -31,11 +36,561 @@ struct bbdev_la12xx_params {
>  #define BBDEV_LA12XX_VDEV_MODEM_ID_ARG	"modem"
>  #define LA12XX_MAX_MODEM 4
> 
> +#define LA12XX_MAX_CORES	4
> +#define BBDEV_LA12XX_LDPC_ENC_CORE	0
> +#define BBDEV_LA12XX_LDPC_DEC_CORE	1
> +
>  static const char * const bbdev_la12xx_valid_params[] = {
>  	BBDEV_LA12XX_MAX_NB_QUEUES_ARG,
>  	BBDEV_LA12XX_VDEV_MODEM_ID_ARG,
>  };
> 
> +static const struct rte_bbdev_op_cap bbdev_capabilities[] = {
> +	{
> +		.type   = RTE_BBDEV_OP_LDPC_ENC,
> +		.cap.ldpc_enc = {
> +			.capability_flags =
> +					RTE_BBDEV_LDPC_CRC_24A_ATTACH
> |
> +
> 	RTE_BBDEV_LDPC_CRC_24B_ATTACH,

I believe you also support RTE_BBDEV_LDPC_RATE_MATCH based on future commits.
Still in that very commit I dont believe support anything yet


> +			.num_buffers_src =
> +
> 	RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
> +			.num_buffers_dst =
> +
> 	RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
> +		}
> +	},
> +	{
> +		.type   = RTE_BBDEV_OP_LDPC_DEC,
> +		.cap.ldpc_dec = {
> +			.capability_flags =
> +				RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK |
> +
> 	RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK |
> +
> 	RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP,

Similar comment, on that very commit I dont believe you support anything yet.
Future commits and documentation suggests you support more than these.


> +			.num_buffers_src =
> +
> 	RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
> +			.num_buffers_hard_out =
> +
> 	RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
> +		}
> +	},
> +	RTE_BBDEV_END_OF_CAPABILITIES_LIST()
> +};
> +
> +static struct rte_bbdev_queue_conf default_queue_conf = {
> +	.queue_size = MAX_CHANNEL_DEPTH,
> +};
> +
> +/* Get device info */
> +static void
> +la12xx_info_get(struct rte_bbdev *dev,
> +		struct rte_bbdev_driver_info *dev_info) {
> +	PMD_INIT_FUNC_TRACE();
> +
> +	dev_info->driver_name = RTE_STR(DRIVER_NAME);
> +	dev_info->max_num_queues = LA12XX_MAX_QUEUES;
> +	dev_info->queue_size_lim = MAX_CHANNEL_DEPTH;
> +	dev_info->hardware_accelerated = true;
> +	dev_info->max_dl_queue_priority = 0;
> +	dev_info->max_ul_queue_priority = 0;
> +	dev_info->default_queue_conf = default_queue_conf;
> +	dev_info->capabilities = bbdev_capabilities;
> +	dev_info->cpu_flag_reqs = NULL;
> +	dev_info->min_alignment = 64;
> +
> +	BBDEV_LA12XX_PMD_DEBUG("got device info from %u", dev->data-
> >dev_id);
> +}
> +
> +/* Release queue */
> +static int
> +la12xx_queue_release(struct rte_bbdev *dev, uint16_t q_id) {
> +	RTE_SET_USED(dev);
> +	RTE_SET_USED(q_id);
> +
> +	PMD_INIT_FUNC_TRACE();
> +
> +	/* TODO: Implement */

I believe this should be implemented in that commit. Not added later in the serie from what I could see.

> +
> +	return 0;
> +}
> +
> +#define HUGEPG_OFFSET(A) \
> +		((uint64_t) ((unsigned long) (A) \
> +		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
> +
> +static int ipc_queue_configure(uint32_t channel_id,
> +		ipc_t instance, struct bbdev_la12xx_q_priv *q_priv) {
> +	ipc_userspace_t *ipc_priv = (ipc_userspace_t *)instance;
> +	ipc_instance_t *ipc_instance = ipc_priv->instance;
> +	ipc_ch_t *ch;
> +	void *vaddr;
> +	uint32_t i = 0;
> +	uint32_t msg_size = sizeof(struct bbdev_ipc_enqueue_op);
> +
> +	PMD_INIT_FUNC_TRACE();
> +
> +	BBDEV_LA12XX_PMD_DEBUG("%x %p", ipc_instance->initialized,
> +		ipc_priv->instance);
> +	ch = &(ipc_instance->ch_list[channel_id]);
> +
> +	BBDEV_LA12XX_PMD_DEBUG("channel: %u, depth: %u, msg size:
> %u",
> +		channel_id, q_priv->queue_size, msg_size);
> +
> +	/* Start init of channel */
> +	ch->md.ring_size = rte_cpu_to_be_32(q_priv->queue_size);
> +	ch->md.pi = 0;
> +	ch->md.ci = 0;
> +	ch->md.msg_size = msg_size;
> +	for (i = 0; i < q_priv->queue_size; i++) {
> +		vaddr = rte_malloc(NULL, msg_size, RTE_CACHE_LINE_SIZE);
> +		if (!vaddr)
> +			return IPC_HOST_BUF_ALLOC_FAIL;
> +		/* Only offset now */
> +		ch->bd[i].modem_ptr =
> +			rte_cpu_to_be_32(HUGEPG_OFFSET(vaddr));
> +		ch->bd[i].host_virt_l = lower_32_bits(vaddr);
> +		ch->bd[i].host_virt_h = upper_32_bits(vaddr);
> +		q_priv->msg_ch_vaddr[i] = vaddr;
> +		/* Not sure use of this len may be for CRC*/

What is that comment refering to? Is that a TODO? 

> +		ch->bd[i].len = 0;
> +	}
> +	ch->host_ipc_params =
> +		rte_cpu_to_be_32(HUGEPG_OFFSET(q_priv->host_params));
> +	ch->bl_initialized = 1;
> +
> +	BBDEV_LA12XX_PMD_DEBUG("Channel configured");
> +	return IPC_SUCCESS;
> +}
> +
> +static int
> +la12xx_e200_queue_setup(struct rte_bbdev *dev,
> +		struct bbdev_la12xx_q_priv *q_priv)
> +{
> +	struct bbdev_la12xx_private *priv = dev->data->dev_private;
> +	ipc_userspace_t *ipc_priv = priv->ipc_priv;
> +	struct gul_hif *mhif;
> +	ipc_metadata_t *ipc_md;
> +	ipc_ch_t *ch;
> +	int instance_id = 0, i;
> +	int ret;
> +
> +	PMD_INIT_FUNC_TRACE();
> +
> +	switch (q_priv->op_type) {
> +	case RTE_BBDEV_OP_LDPC_ENC:
> +		q_priv->la12xx_core_id = BBDEV_LA12XX_LDPC_ENC_CORE;
> +		break;
> +	case RTE_BBDEV_OP_LDPC_DEC:
> +		q_priv->la12xx_core_id = BBDEV_LA12XX_LDPC_DEC_CORE;
> +		break;
> +	default:
> +		BBDEV_LA12XX_PMD_ERR("Unsupported op type\n");
> +		return -1;
> +	}
> +
> +	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
> +	/* offset is from start of PEB */
> +	ipc_md = (ipc_metadata_t *)((size_t)ipc_priv->peb_start.host_vaddr
> +
> +		mhif->ipc_regs.ipc_mdata_offset);
> +	ch = &ipc_md->instance_list[instance_id].ch_list[q_priv->q_id];
> +
> +	if (q_priv->q_id < priv->num_valid_queues) {
> +		ipc_br_md_t *md, *host_md;
> +		ipc_ch_t *host_rx_ch;
> +
> +		host_rx_ch =
> +			&ipc_md->instance_list[instance_id].ch_list[q_priv-
> >q_id
> +				+ HOST_RX_QUEUEID_OFFSET];
> +		md = &(ch->md);
> +		host_md = &(host_rx_ch->md);
> +
> +		q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
> +		q_priv->feca_blk_id_be32 = ch->feca_blk_id;
> +		q_priv->host_pi = rte_be_to_cpu_32(host_md->pi);
> +		q_priv->host_ci = rte_be_to_cpu_32(md->ci);
> +		q_priv->host_params = (host_ipc_params_t *)
> +			(rte_be_to_cpu_32(ch->host_ipc_params) +
> +			((size_t)ipc_priv->hugepg_start.host_vaddr));
> +
> +		for (i = 0; i < q_priv->queue_size; i++) {
> +			uint32_t h, l;
> +
> +			h = host_rx_ch->bd[i].host_virt_h;
> +			l = host_rx_ch->bd[i].host_virt_l;
> +			q_priv->msg_ch_vaddr[i] = (void *)join_32_bits(h, l);
> +		}
> +
> +		BBDEV_LA12XX_PMD_WARN(
> +			"Queue [%d] already configured, not configuring
> again",
> +			q_priv->q_id);
> +		return 0;
> +	}
> +
> +	BBDEV_LA12XX_PMD_DEBUG("setting up queue %d", q_priv->q_id);
> +
> +	q_priv->host_params = rte_zmalloc(NULL,
> sizeof(host_ipc_params_t),
> +			RTE_CACHE_LINE_SIZE);
> +	ch->host_ipc_params =
> +		rte_cpu_to_be_32(HUGEPG_OFFSET(q_priv->host_params));
> +
> +	/* Call ipc_configure_channel */
> +	ret = ipc_queue_configure((q_priv->q_id +
> HOST_RX_QUEUEID_OFFSET),
> +				  ipc_priv, q_priv);
> +	if (ret) {
> +		BBDEV_LA12XX_PMD_ERR("Unable to setup queue (%d)
> (err=%d)",
> +		       q_priv->q_id, ret);
> +		return ret;
> +	}
> +
> +	/* Set queue properties for LA12xx device */
> +	switch (q_priv->op_type) {
> +	case RTE_BBDEV_OP_LDPC_ENC:
> +		if (priv->num_ldpc_enc_queues >=
> MAX_LDPC_ENC_FECA_QUEUES) {
> +			BBDEV_LA12XX_PMD_ERR(
> +				"num_ldpc_enc_queues reached max
> value");
> +			return -1;
> +		}
> +		ch->la12xx_core_id =
> +
> 	rte_cpu_to_be_32(BBDEV_LA12XX_LDPC_ENC_CORE);
> +		ch->feca_blk_id = rte_cpu_to_be_32(priv-
> >num_ldpc_enc_queues++);
> +		break;
> +	case RTE_BBDEV_OP_LDPC_DEC:
> +		if (priv->num_ldpc_dec_queues >=
> MAX_LDPC_DEC_FECA_QUEUES) {
> +			BBDEV_LA12XX_PMD_ERR(
> +				"num_ldpc_dec_queues reached max
> value");
> +			return -1;
> +		}
> +		ch->la12xx_core_id =
> +
> 	rte_cpu_to_be_32(BBDEV_LA12XX_LDPC_DEC_CORE);
> +		ch->feca_blk_id = rte_cpu_to_be_32(priv-
> >num_ldpc_dec_queues++);
> +		break;
> +	default:
> +		BBDEV_LA12XX_PMD_ERR("Not supported op type\n");
> +		return -1;
> +	}
> +	ch->op_type = rte_cpu_to_be_32(q_priv->op_type);
> +	ch->depth = rte_cpu_to_be_32(q_priv->queue_size);
> +
> +	/* Store queue config here */
> +	q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
> +	q_priv->feca_blk_id_be32 = ch->feca_blk_id;
> +
> +	return 0;
> +}
> +
> +/* Setup a queue */
> +static int
> +la12xx_queue_setup(struct rte_bbdev *dev, uint16_t q_id,
> +		const struct rte_bbdev_queue_conf *queue_conf) {
> +	struct bbdev_la12xx_private *priv = dev->data->dev_private;
> +	struct rte_bbdev_queue_data *q_data;
> +	struct bbdev_la12xx_q_priv *q_priv;
> +	int ret;
> +
> +	PMD_INIT_FUNC_TRACE();
> +
> +	/* Move to setup_queues callback */
> +	q_data = &dev->data->queues[q_id];
> +	q_data->queue_private = rte_zmalloc(NULL,
> +		sizeof(struct bbdev_la12xx_q_priv), 0);
> +	if (!q_data->queue_private) {
> +		BBDEV_LA12XX_PMD_ERR("Memory allocation failed for
> qpriv");
> +		return -ENOMEM;
> +	}
> +	q_priv = q_data->queue_private;
> +	q_priv->q_id = q_id;
> +	q_priv->bbdev_priv = dev->data->dev_private;
> +	q_priv->queue_size = queue_conf->queue_size;
> +	q_priv->op_type = queue_conf->op_type;
> +
> +	ret = la12xx_e200_queue_setup(dev, q_priv);
> +	if (ret) {
> +		BBDEV_LA12XX_PMD_ERR("e200_queue_setup failed for
> qid: %d",
> +				     q_id);
> +		return ret;
> +	}
> +
> +	/* Store queue config here */
> +	priv->num_valid_queues++;
> +
> +	return 0;
> +}
> +
> +static int
> +la12xx_start(struct rte_bbdev *dev)
> +{
> +	struct bbdev_la12xx_private *priv = dev->data->dev_private;
> +	ipc_userspace_t *ipc_priv = priv->ipc_priv;
> +	int ready = 0;
> +	struct gul_hif *hif_start;
> +
> +	PMD_INIT_FUNC_TRACE();
> +
> +	hif_start = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
> +
> +	/* Set Host Read bit */
> +	SET_HIF_HOST_RDY(hif_start, HIF_HOST_READY_IPC_APP);
> +
> +	/* Now wait for modem ready bit */
> +	while (!ready)
> +		ready = CHK_HIF_MOD_RDY(hif_start,
> HIF_MOD_READY_IPC_APP);
> +
> +	return 0;
> +}
> +
> +static const struct rte_bbdev_ops pmd_ops = {
> +	.info_get = la12xx_info_get,
> +	.queue_setup = la12xx_queue_setup,
> +	.queue_release = la12xx_queue_release,
> +	.start = la12xx_start
> +};
> +static struct hugepage_info *
> +get_hugepage_info(void)
> +{
> +	struct hugepage_info *hp_info;
> +	struct rte_memseg *mseg;
> +
> +	PMD_INIT_FUNC_TRACE();
> +
> +	/* TODO - find a better way */
> +	hp_info = rte_malloc(NULL, sizeof(struct hugepage_info), 0);
> +	if (!hp_info) {
> +		BBDEV_LA12XX_PMD_ERR("Unable to allocate on local
> heap");
> +		return NULL;
> +	}
> +
> +	mseg = rte_mem_virt2memseg(hp_info, NULL);
> +	hp_info->vaddr = mseg->addr;
> +	hp_info->paddr = rte_mem_virt2phy(mseg->addr);
> +	hp_info->len = mseg->len;
> +
> +	return hp_info;
> +}

I was not sure what this is trying to do. Is that assuming a single huge page being used and keep track of it for future DMA activity? Is that valid?


> +
> +static int open_ipc_dev(int modem_id)
> +{
> +	char dev_initials[16], dev_path[PATH_MAX];
> +	struct dirent *entry;
> +	int dev_ipc = 0;
> +	DIR *dir;
> +
> +	dir = opendir("/dev/");
> +	if (!dir) {
> +		BBDEV_LA12XX_PMD_ERR("Unable to open /dev/");
> +		return -1;
> +	}
> +
> +	sprintf(dev_initials, "gulipcgul%d", modem_id);
> +
> +	while ((entry = readdir(dir)) != NULL) {
> +		if (!strncmp(dev_initials, entry->d_name,
> +		    sizeof(dev_initials) - 1))
> +			break;
> +	}
> +
> +	if (!entry) {
> +		BBDEV_LA12XX_PMD_ERR("Error: No gulipcgul%d device",
> modem_id);
> +		return -1;
> +	}
> +
> +	sprintf(dev_path, "/dev/%s", entry->d_name);
> +	dev_ipc = open(dev_path, O_RDWR);
> +	if (dev_ipc  < 0) {
> +		BBDEV_LA12XX_PMD_ERR("Error: Cannot open %s",
> dev_path);
> +		return -errno;
> +	}
> +
> +	return dev_ipc;
> +}
> +
> +static int
> +setup_la12xx_dev(struct rte_bbdev *dev) {
> +	struct bbdev_la12xx_private *priv = dev->data->dev_private;
> +	ipc_userspace_t *ipc_priv = priv->ipc_priv;
> +	struct hugepage_info *hp = NULL;
> +	ipc_channel_us_t *ipc_priv_ch = NULL;
> +	int dev_ipc = 0, dev_mem = 0, i;
> +	ipc_metadata_t *ipc_md;
> +	struct gul_hif *mhif;
> +	uint32_t phy_align = 0;
> +	int ret;
> +
> +	PMD_INIT_FUNC_TRACE();
> +
> +	if (!ipc_priv) {
> +		/* TODO - get a better way */
> +		/* Get the hugepage info against it */
> +		hp = get_hugepage_info();
> +		if (!hp) {
> +			BBDEV_LA12XX_PMD_ERR("Unable to get hugepage
> info");
> +			ret = -ENOMEM;
> +			goto err;
> +		}
> +
> +		BBDEV_LA12XX_PMD_DEBUG("0x%" PRIx64 " %p %x",
> +				hp->paddr, hp->vaddr, (int)hp->len);
> +
> +		ipc_priv = rte_zmalloc(0, sizeof(ipc_userspace_t), 0);
> +		if (ipc_priv == NULL) {
> +			BBDEV_LA12XX_PMD_ERR(
> +				"Unable to allocate memory for ipc priv");
> +			ret = -ENOMEM;
> +			goto err;
> +		}
> +
> +		for (i = 0; i < IPC_MAX_CHANNEL_COUNT; i++) {
> +			ipc_priv_ch = rte_zmalloc(0,
> +				sizeof(ipc_channel_us_t), 0);
> +			if (ipc_priv_ch == NULL) {
> +				BBDEV_LA12XX_PMD_ERR(
> +					"Unable to allocate memory for
> channels");
> +				ret = -ENOMEM;
> +			}
> +			ipc_priv->channels[i] = ipc_priv_ch;
> +		}
> +
> +		dev_mem = open("/dev/mem", O_RDWR);
> +		if (dev_mem < 0) {
> +			BBDEV_LA12XX_PMD_ERR("Error: Cannot open
> /dev/mem");
> +			ret = -errno;
> +			goto err;
> +		}
> +
> +		ipc_priv->instance_id = 0;
> +		ipc_priv->dev_mem = dev_mem;
> +
> +		ipc_priv->sys_map.hugepg_start.host_phys = hp->paddr;
> +		ipc_priv->sys_map.hugepg_start.size = hp->len;
> +
> +		ipc_priv->hugepg_start.host_phys = hp->paddr;
> +		ipc_priv->hugepg_start.host_vaddr = hp->vaddr;
> +		ipc_priv->hugepg_start.size = hp->len;
> +
> +		rte_free(hp);
> +	}
> +
> +	dev_ipc = open_ipc_dev(priv->modem_id);
> +	if (dev_ipc < 0) {
> +		BBDEV_LA12XX_PMD_ERR("Error: open_ipc_dev failed");
> +		goto err;
> +	}
> +	ipc_priv->dev_ipc = dev_ipc;
> +
> +	/* Send IOCTL to get system map */
> +	/* Send IOCTL to put hugepg_start map */
> +	ret = ioctl(ipc_priv->dev_ipc, IOCTL_GUL_IPC_GET_SYS_MAP,
> +		    &ipc_priv->sys_map);
> +	if (ret) {
> +		BBDEV_LA12XX_PMD_ERR(
> +			"IOCTL_GUL_IPC_GET_SYS_MAP ioctl failed");
> +		goto err;
> +	}
> +
> +	phy_align = (ipc_priv->sys_map.mhif_start.host_phys % 0x1000);

I would replace the 0x1000 magic number used for alignment

> +	ipc_priv->mhif_start.host_vaddr =
> +		mmap(0, ipc_priv->sys_map.mhif_start.size + phy_align,
> +		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv-
> >dev_mem,
> +		     (ipc_priv->sys_map.mhif_start.host_phys - phy_align));
> +	if (ipc_priv->mhif_start.host_vaddr == MAP_FAILED) {
> +		BBDEV_LA12XX_PMD_ERR("MAP failed:");
> +		ret = -errno;
> +		goto err;
> +	}
> +
> +	ipc_priv->mhif_start.host_vaddr = (void *)((size_t)
> +		(ipc_priv->mhif_start.host_vaddr) + phy_align);
> +
> +	phy_align = (ipc_priv->sys_map.peb_start.host_phys % 0x1000);
> +	ipc_priv->peb_start.host_vaddr =
> +		mmap(0, ipc_priv->sys_map.peb_start.size + phy_align,
> +		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv-
> >dev_mem,
> +		     (ipc_priv->sys_map.peb_start.host_phys - phy_align));
> +	if (ipc_priv->peb_start.host_vaddr == MAP_FAILED) {
> +		BBDEV_LA12XX_PMD_ERR("MAP failed:");
> +		ret = -errno;
> +		goto err;
> +	}
> +
> +	ipc_priv->peb_start.host_vaddr = (void *)((size_t)
> +		(ipc_priv->peb_start.host_vaddr) + phy_align);
> +
> +	phy_align = (ipc_priv->sys_map.modem_ccsrbar.host_phys %
> 0x1000);
> +	ipc_priv->modem_ccsrbar.host_vaddr =
> +		mmap(0, ipc_priv->sys_map.modem_ccsrbar.size +
> phy_align,
> +		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv-
> >dev_mem,
> +		     (ipc_priv->sys_map.modem_ccsrbar.host_phys -
> phy_align));
> +	if (ipc_priv->modem_ccsrbar.host_vaddr == MAP_FAILED) {
> +		BBDEV_LA12XX_PMD_ERR("MAP failed:");
> +		ret = -errno;
> +		goto err;
> +	}
> +
> +	ipc_priv->modem_ccsrbar.host_vaddr = (void *)((size_t)
> +		(ipc_priv->modem_ccsrbar.host_vaddr) + phy_align);
> +
> +	ipc_priv->hugepg_start.modem_phys =
> +		ipc_priv->sys_map.hugepg_start.modem_phys;
> +
> +	ipc_priv->mhif_start.host_phys =
> +		ipc_priv->sys_map.mhif_start.host_phys;
> +	ipc_priv->mhif_start.size = ipc_priv->sys_map.mhif_start.size;
> +	ipc_priv->peb_start.host_phys = ipc_priv-
> >sys_map.peb_start.host_phys;
> +	ipc_priv->peb_start.size = ipc_priv->sys_map.peb_start.size;
> +
> +	BBDEV_LA12XX_PMD_INFO("peb 0x%" PRIx64 " %p %x",
> +			ipc_priv->peb_start.host_phys,
> +			ipc_priv->peb_start.host_vaddr,
> +			ipc_priv->peb_start.size);
> +	BBDEV_LA12XX_PMD_INFO("hugepg 0x%" PRIx64 " %p %x",
> +			ipc_priv->hugepg_start.host_phys,
> +			ipc_priv->hugepg_start.host_vaddr,
> +			ipc_priv->hugepg_start.size);
> +	BBDEV_LA12XX_PMD_INFO("mhif 0x%" PRIx64 " %p %x",
> +			ipc_priv->mhif_start.host_phys,
> +			ipc_priv->mhif_start.host_vaddr,
> +			ipc_priv->mhif_start.size);
> +	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
> +
> +	/* offset is from start of PEB */
> +	ipc_md = (ipc_metadata_t *)((size_t)ipc_priv->peb_start.host_vaddr
> +
> +			mhif->ipc_regs.ipc_mdata_offset);
> +
> +	if (sizeof(ipc_metadata_t) != mhif->ipc_regs.ipc_mdata_size) {
> +		BBDEV_LA12XX_PMD_ERR(
> +			"\n ipc_metadata_t=%d mhif-
> >ipc_regs.ipc_mdata_size=%x",
> +			(int)sizeof(ipc_metadata_t),
> +			mhif->ipc_regs.ipc_mdata_size);
> +		BBDEV_LA12XX_PMD_ERR(
> +			"--> mhif->ipc_regs.ipc_mdata_offset= %x",
> +			mhif->ipc_regs.ipc_mdata_offset);
> +		BBDEV_LA12XX_PMD_ERR(
> +			"gul_hif size=%d", (int)sizeof(struct gul_hif));
> +		return IPC_MD_SZ_MISS_MATCH;
> +	}
> +
> +	ipc_priv->instance = (ipc_instance_t *)
> +		(&ipc_md->instance_list[ipc_priv->instance_id]);
> +
> +	BBDEV_LA12XX_PMD_DEBUG("finish host init");
> +
> +	priv->ipc_priv = ipc_priv;
> +
> +	return 0;
> +
> +err:
> +	rte_free(hp);
> +	rte_free(ipc_priv);
> +	rte_free(ipc_priv_ch);
> +	if (dev_mem)
> +		close(dev_mem);
> +	if (dev_ipc)
> +		close(dev_ipc);
> +
> +	return ret;
> +}
> +
>  static inline int
>  parse_u16_arg(const char *key, const char *value, void *extra_args)  { @@ -
> 123,6 +678,7 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
>  	struct rte_bbdev *bbdev;
>  	const char *name = rte_vdev_device_name(vdev);
>  	struct bbdev_la12xx_private *priv;
> +	int ret;
> 
>  	PMD_INIT_FUNC_TRACE();
> 
> @@ -152,7 +708,13 @@ la12xx_bbdev_create(struct rte_vdev_device
> *vdev,
> 
>  	BBDEV_LA12XX_PMD_INFO("Setting Up %s: DevId=%d,
> ModemId=%d",
>  				name, bbdev->data->dev_id, priv-
> >modem_id);
> -	bbdev->dev_ops = NULL;
> +	ret = setup_la12xx_dev(bbdev);
> +	if (ret) {
> +		BBDEV_LA12XX_PMD_ERR("IPC Setup failed for %s", name);
> +		rte_free(bbdev->data->dev_private);
> +		return ret;
> +	}
> +	bbdev->dev_ops = &pmd_ops;
>  	bbdev->device = &vdev->device;
>  	bbdev->data->socket_id = 0;
>  	bbdev->intr_handle = NULL;
> diff --git a/drivers/baseband/la12xx/bbdev_la12xx.h
> b/drivers/baseband/la12xx/bbdev_la12xx.h
> index 5228502331..c94f08e059 100644
> --- a/drivers/baseband/la12xx/bbdev_la12xx.h
> +++ b/drivers/baseband/la12xx/bbdev_la12xx.h
> @@ -14,7 +14,7 @@
>  #define MAX_CHANNEL_DEPTH 16
>  /* private data structure */
>  struct bbdev_la12xx_private {
> -	void *ipc_priv;
> +	ipc_userspace_t *ipc_priv;
>  	uint8_t num_valid_queues;
>  	uint8_t max_nb_queues;
>  	uint8_t num_ldpc_enc_queues;
> @@ -52,5 +52,6 @@ struct bbdev_la12xx_q_priv {
> 
>  #define lower_32_bits(x) ((uint32_t)((uint64_t)x))  #define upper_32_bits(x)
> ((uint32_t)(((uint64_t)(x) >> 16) >> 16))
> -
> +#define join_32_bits(upper, lower) \
> +	((size_t)(((uint64_t)(upper) << 32) | (uint32_t)(lower)))
>  #endif
> diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> index 9aa5562981..9d5789f726 100644
> --- a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> +++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> @@ -4,9 +4,175 @@
>  #ifndef __BBDEV_LA12XX_IPC_H__
>  #define __BBDEV_LA12XX_IPC_H__
> 
> +#define LA12XX_MAX_QUEUES 20
> +
> +/** No. of max channel per instance */
> +#define IPC_MAX_CHANNEL_COUNT	(64)
> +
>  /** No. of max channel per instance */
>  #define IPC_MAX_DEPTH	(16)
> 
> +/** No. of max IPC instance per modem */
> +#define IPC_MAX_INSTANCE_COUNT	(1)
> +
> +#define HOST_RX_QUEUEID_OFFSET LA12XX_MAX_QUEUES
> +
> +#define MAX_MEM_POOL_COUNT 8
> +
> +/** Error codes */
> +#define IPC_SUCCESS		(0) /** IPC operation success */
> +#define IPC_INPUT_INVALID	(-1) /** Invalid input to API */
> +#define IPC_CH_INVALID		(-2) /** Channel no is invalid */
> +#define IPC_INSTANCE_INVALID	(-3) /** Instance no is invalid */
> +#define IPC_MEM_INVALID		(-4) /** Insufficient memory */
> +#define IPC_CH_FULL		(-5) /** Channel is full */
> +#define IPC_CH_EMPTY		(-6) /** Channel is empty */
> +#define IPC_BL_EMPTY		(-7) /** Free buffer list is empty */
> +#define IPC_BL_FULL		(-8) /** Free buffer list is full */
> +#define IPC_HOST_BUF_ALLOC_FAIL	(-9) /** DPDK malloc fail */
> +#define IPC_MD_SZ_MISS_MATCH	(-10) /** META DATA sz in mhif miss
> matched*/
> +#define IPC_MALLOC_FAIL		(-11) /** system malloc fail */
> +#define IPC_IOCTL_FAIL		(-12) /** IOCTL call failed */
> +#define IPC_MMAP_FAIL		(-14) /** MMAP fail */
> +#define IPC_OPEN_FAIL		(-15) /** OPEN fail */
> +#define IPC_EVENTFD_FAIL	(-16) /** eventfd initialization failed */
> +#define IPC_NOT_IMPLEMENTED	(-17) /** IPC feature is not
> implemented yet*/
> +
> +#define SET_HIF_HOST_RDY(hif, RDY_MASK) (hif->host_ready |=
> RDY_MASK)
> +#define CHK_HIF_MOD_RDY(hif, RDY_MASK) (hif->mod_ready &
> RDY_MASK)
> +
> +/* Host Ready bits */
> +#define HIF_HOST_READY_HOST_REGIONS	(1 << 0)
> +#define HIF_HOST_READY_IPC_LIB		(1 << 12)
> +#define HIF_HOST_READY_IPC_APP		(1 << 13)
> +#define HIF_HOST_READY_FECA		(1 << 14)
> +
> +/* Modem Ready bits */
> +#define HIF_MOD_READY_IPC_LIB		(1 << 5)
> +#define HIF_MOD_READY_IPC_APP		(1 << 6)
> +#define HIF_MOD_READY_FECA		(1 << 7)
> +
> +typedef void *ipc_t;
> +
> +struct ipc_msg {
> +	int chid;
> +	void *addr;
> +	uint32_t len;
> +	uint8_t flags;
> +};
> +
> +typedef struct {
> +	uint64_t host_phys;
> +	uint32_t modem_phys;
> +	void    *host_vaddr;
> +	uint32_t size;
> +} mem_range_t;
> +
> +#define GUL_IPC_MAGIC	'R'
> +
> +#define IOCTL_GUL_IPC_GET_SYS_MAP _IOW(GUL_IPC_MAGIC, 1, struct
> ipc_msg
> +*) #define IOCTL_GUL_IPC_CHANNEL_REGISTER _IOWR(GUL_IPC_MAGIC, 4,
> +struct ipc_msg *) #define IOCTL_GUL_IPC_CHANNEL_DEREGISTER \
> +	_IOWR(GUL_IPC_MAGIC, 5, struct ipc_msg *) #define
> +IOCTL_GUL_IPC_CHANNEL_RAISE_INTERRUPT _IOW(GUL_IPC_MAGIC, 6, int
> *)
> +
> +/** buffer ring common metadata */
> +typedef struct ipc_bd_ring_md {
> +	volatile uint32_t pi;		/**< Producer index and flag (MSB)
> +					  *  which flip for each Ring wrapping
> +					  */
> +	volatile uint32_t ci;		/**< Consumer index and flag (MSB)
> +					  *  which flip for each Ring wrapping
> +					  */
> +	uint32_t ring_size;	/**< depth (Used to roll-over pi/ci) */
> +	uint32_t msg_size;	/**< Size of the each buffer */
> +} __rte_packed ipc_br_md_t;
> +
> +/** IPC buffer descriptor */
> +typedef struct ipc_buffer_desc {
> +	union {
> +		uint64_t host_virt;	/**< msg's host virtual address */
> +		struct {
> +			uint32_t host_virt_l;
> +			uint32_t host_virt_h;
> +		};
> +	};
> +	uint64_t host_phy;	/**< msg's host physical address */

No intention to use rte_iova_t here? 

> +	uint32_t modem_ptr;	/**< msg's modem physical address */
> +	uint32_t len;		/**< msg len */
> +	uint64_t crc;		/**< crc */
> +} __rte_packed ipc_bd_t;
> +
> +typedef struct ipc_channel {
> +	uint32_t ch_id;		/**< Channel id */
> +	uint32_t bl_initialized;/**< Set when buffer list is initialized */
> +	ipc_br_md_t md;
> +	ipc_bd_t bd[IPC_MAX_DEPTH];
> +	uint32_t op_type;/* BBDEV operation supported on this channel */
> +	uint32_t depth;	/* Channel depth */
> +	uint32_t feca_blk_id;/* FECA Transport Block ID for processing */
> +	uint32_t la12xx_core_id;/* LA12xx core ID to scheduled work for it*/
> +	uint32_t host_ipc_params;/* Address for host IPC parameters */ }
> +__rte_packed ipc_ch_t;
> +
> +typedef struct ipc_instance {
> +	uint32_t initialized;		/**< Set in ipc_init */
> +	ipc_ch_t ch_list[IPC_MAX_CHANNEL_COUNT];
> +		/**< Channel descriptors in this instance */ } __rte_packed
> +ipc_instance_t;
> +
> +typedef struct ipc_metadata {
> +	ipc_instance_t instance_list[IPC_MAX_INSTANCE_COUNT];
> +} __rte_packed ipc_metadata_t;
> +
> +typedef struct ipc_channel_us_priv {
> +	int32_t		eventfd;
> +	uint32_t	channel_id;
> +	/* In flight packets status for buffer list. */
> +	uint8_t		bufs_inflight[IPC_MAX_DEPTH];
> +} ipc_channel_us_t;
> +
> +typedef struct {
> +	uint64_t host_phys;
> +	uint32_t modem_phys;
> +	uint32_t size;
> +} mem_strt_addr_t;
> +
> +typedef struct {
> +	mem_strt_addr_t modem_ccsrbar;
> +	mem_strt_addr_t peb_start; /* PEB meta data */
> +	mem_strt_addr_t mhif_start; /* MHIF meta daat */
> +	mem_strt_addr_t hugepg_start; /* Modem to access hugepage */ }
> +sys_map_t;
> +
> +typedef struct ipc_priv_t {
> +	int instance_id;
> +	int dev_ipc;
> +	int dev_mem;
> +	struct rte_mempool *rtemempool[MAX_MEM_POOL_COUNT];
> +	sys_map_t sys_map;
> +	mem_range_t modem_ccsrbar;
> +	mem_range_t peb_start;
> +	mem_range_t mhif_start;
> +	mem_range_t hugepg_start;
> +	ipc_channel_us_t *channels[IPC_MAX_CHANNEL_COUNT];
> +	ipc_instance_t	*instance;
> +} ipc_userspace_t;
> +
> +/** Structure specifying enqueue operation (enqueue at LA1224) */
> +struct bbdev_ipc_enqueue_op {
> +	/** Status of operation that was performed */
> +	int32_t status;
> +	/** CRC Status of SD operation that was performed */
> +	int32_t crc_stat_addr;
> +	/** HARQ Output buffer memory length for Shared Decode.
> +	 * Filled by LA12xx.
> +	 */

What is this? Is HARQ supported or not? Is this memory accessible.

> +	uint32_t out_len;
> +	/** Reserved (for 8 byte alignment) */
> +	uint32_t rsvd;
> +};
> +
>  /* This shared memory would be on the host side which have copy of some
>   * of the parameters which are also part of Shared BD ring. Read access
>   * of these parameters from the host side would not be over PCI.
> @@ -17,4 +183,18 @@ typedef struct host_ipc_params {
>  	volatile uint32_t modem_ptr[IPC_MAX_DEPTH];  } __rte_packed
> host_ipc_params_t;
> 
> +struct hif_ipc_regs {
> +	uint32_t ipc_mdata_offset;
> +	uint32_t ipc_mdata_size;
> +} __rte_packed;
> +
> +struct gul_hif {
> +	uint32_t ver;
> +	uint32_t hif_ver;
> +	uint32_t status;
> +	volatile uint32_t host_ready;
> +	volatile uint32_t mod_ready;
> +	struct hif_ipc_regs ipc_regs;
> +} __rte_packed;
> +
>  #endif
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v3 5/8] baseband/la12xx: add enqueue and dequeue support
  2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 5/8] baseband/la12xx: add enqueue and dequeue support Hemant Agrawal
@ 2021-04-14  0:53       ` Chautru, Nicolas
  2021-04-14 12:06         ` Hemant Agrawal
  0 siblings, 1 reply; 157+ messages in thread
From: Chautru, Nicolas @ 2021-04-14  0:53 UTC (permalink / raw)
  To: Hemant Agrawal, dev, gakhil; +Cc: david.marchand, Nipun Gupta

Add support for enqueue and dequeue the LDPC enc/dec from the modem device.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c     | 397 ++++++++++++++++++++-
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h |  37 ++
 2 files changed, 430 insertions(+), 4 deletions(-)

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 0a68686205..d1040987b2 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -117,6 +117,10 @@ la12xx_queue_release(struct rte_bbdev *dev, uint16_t q_id)
 		((uint64_t) ((unsigned long) (A) \
 		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
 
+#define MODEM_P2V(A) \
+	((uint64_t) ((unsigned long) (A) \
+		+ (unsigned long)(ipc_priv->peb_start.host_vaddr)))
+
 static int ipc_queue_configure(uint32_t channel_id,
 		ipc_t instance, struct bbdev_la12xx_q_priv *q_priv)  { @@ -345,6 +349,387 @@ static const struct rte_bbdev_ops pmd_ops = {
 	.queue_release = la12xx_queue_release,
 	.start = la12xx_start
 };
+
+static int
+fill_feca_desc_enc(struct bbdev_la12xx_q_priv *q_priv,
+		   struct bbdev_ipc_dequeue_op *bbdev_ipc_op,
+		   struct rte_bbdev_enc_op *bbdev_enc_op,
+		   struct rte_bbdev_op_data *in_op_data) {
+	RTE_SET_USED(q_priv);
+	RTE_SET_USED(bbdev_ipc_op);
+	RTE_SET_USED(bbdev_enc_op);
+	RTE_SET_USED(in_op_data);
+
+	return 0;
+}

I miss why these functions are here.
Is that contribution supposed to work or a placeholder?

+
+static int
+fill_feca_desc_dec(struct bbdev_la12xx_q_priv *q_priv,
+		   struct bbdev_ipc_dequeue_op *bbdev_ipc_op,
+		   struct rte_bbdev_dec_op *bbdev_dec_op,
+		   struct rte_bbdev_op_data *out_op_data) {
+	RTE_SET_USED(q_priv);
+	RTE_SET_USED(bbdev_ipc_op);
+	RTE_SET_USED(bbdev_dec_op);
+	RTE_SET_USED(out_op_data);
+
+	return 0;
+}
+
+static inline int
+is_bd_ring_full(uint32_t ci, uint32_t ci_flag,
+		uint32_t pi, uint32_t pi_flag)
+{
+	if (pi == ci) {
+		if (pi_flag != ci_flag)
+			return 1; /* Ring is Full */
+	}
+	return 0;
+}
+
+static inline int
+prepare_ldpc_enc_op(struct rte_bbdev_enc_op *bbdev_enc_op,
+		    struct bbdev_ipc_dequeue_op *bbdev_ipc_op,
+		    struct bbdev_la12xx_q_priv *q_priv,
+		    struct rte_bbdev_op_data *in_op_data,
+		    struct rte_bbdev_op_data *out_op_data) {
+	struct rte_bbdev_op_ldpc_enc *ldpc_enc = &bbdev_enc_op->ldpc_enc;
+	uint32_t total_out_bits;
+	int ret;
+
+	total_out_bits = (ldpc_enc->tb_params.cab *
+		ldpc_enc->tb_params.ea) + (ldpc_enc->tb_params.c -
+		ldpc_enc->tb_params.cab) * ldpc_enc->tb_params.eb;
+

This includes ratematching, see previous comment on capability

Also I see it would not support the partial TB as defined in documentation and API (r != 0)

+	ldpc_enc->output.length = (total_out_bits + 7)/8;
+
+	ret = fill_feca_desc_enc(q_priv, bbdev_ipc_op,
+				 bbdev_enc_op, in_op_data);
+	if (ret) {
+		BBDEV_LA12XX_PMD_ERR(
+			"fill_feca_desc_enc failed, ret: %d", ret);
+		return ret;
+	}
+
+	rte_pktmbuf_append(out_op_data->data, ldpc_enc->output.length);
+
+	return 0;
+}
+
+static inline int
+prepare_ldpc_dec_op(struct rte_bbdev_dec_op *bbdev_dec_op,
+		    struct bbdev_ipc_dequeue_op *bbdev_ipc_op,
+		    struct bbdev_la12xx_q_priv *q_priv,
+		    struct rte_bbdev_op_data *out_op_data) {
+	struct rte_bbdev_op_ldpc_dec *ldpc_dec = &bbdev_dec_op->ldpc_dec;
+	uint32_t total_out_bits;
+	uint32_t num_code_blocks = 0;
+	uint16_t sys_cols;
+	int ret;
+
+	sys_cols = (ldpc_dec->basegraph == 1) ? 22 : 10;
+	if (ldpc_dec->tb_params.c == 1) {
+		total_out_bits = ((sys_cols * ldpc_dec->z_c) -
+				ldpc_dec->n_filler);
+		/* 5G-NR protocol uses 16 bit CRC when output packet
+		 * size <= 3824 (bits). Otherwise 24 bit CRC is used.
+		 * Adjust the output bits accordingly
+		 */
+		if (total_out_bits - 16 <= 3824)
+			total_out_bits -= 16;
+		else
+			total_out_bits -= 24;
+		ldpc_dec->hard_output.length = (total_out_bits / 8);
+	} else {
+		total_out_bits = (((sys_cols * ldpc_dec->z_c) -
+				ldpc_dec->n_filler - 24) *
+				ldpc_dec->tb_params.c);
+		ldpc_dec->hard_output.length = (total_out_bits / 8) - 3;

Probably good to remove magic number for 24 and 3 here.

+	}
+
+	num_code_blocks = ldpc_dec->tb_params.c;
+
+	bbdev_ipc_op->num_code_blocks = rte_cpu_to_be_32(num_code_blocks);
+
+	ret = fill_feca_desc_dec(q_priv, bbdev_ipc_op,
+				 bbdev_dec_op, out_op_data);
+	if (ret) {
+		BBDEV_LA12XX_PMD_ERR("fill_feca_desc_dec failed, ret: %d", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+static int
+enqueue_single_op(struct bbdev_la12xx_q_priv *q_priv, void *bbdev_op) {
+	struct bbdev_la12xx_private *priv = q_priv->bbdev_priv;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	ipc_instance_t *ipc_instance = ipc_priv->instance;
+	struct bbdev_ipc_dequeue_op *bbdev_ipc_op;
+	struct rte_bbdev_op_ldpc_enc *ldpc_enc;
+	struct rte_bbdev_op_ldpc_dec *ldpc_dec;
+	uint32_t q_id = q_priv->q_id;
+	uint32_t ci, ci_flag, pi, pi_flag;
+	ipc_ch_t *ch = &(ipc_instance->ch_list[q_id]);
+	ipc_br_md_t *md = &(ch->md);
+	size_t virt;
+	char *huge_start_addr =
+		(char *)q_priv->bbdev_priv->ipc_priv->hugepg_start.host_vaddr;
+	struct rte_bbdev_op_data *in_op_data, *out_op_data;
+	char *data_ptr;
+	uint32_t l1_pcie_addr;
+	int ret;
+	uint32_t temp_ci;
+
+	temp_ci = q_priv->host_params->ci;
+	ci = IPC_GET_CI_INDEX(temp_ci);
+	ci_flag = IPC_GET_CI_FLAG(temp_ci);
+
+	pi = IPC_GET_PI_INDEX(q_priv->host_pi);
+	pi_flag = IPC_GET_PI_FLAG(q_priv->host_pi);
+
+	BBDEV_LA12XX_PMD_DP_DEBUG(
+		"before bd_ring_full: pi: %u, ci: %u, pi_flag: %u, ci_flag: %u, ring size: %u",
+		pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	if (is_bd_ring_full(ci, ci_flag, pi, pi_flag)) {
+		BBDEV_LA12XX_PMD_DP_DEBUG(
+				"bd ring full for queue id: %d", q_id);
+		return IPC_CH_FULL;
+	}
+
+	virt = MODEM_P2V(q_priv->host_params->modem_ptr[pi]);
+	bbdev_ipc_op = (struct bbdev_ipc_dequeue_op *)virt;
+	q_priv->bbdev_op[pi] = bbdev_op;
+
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		ldpc_enc = &(((struct rte_bbdev_enc_op *)bbdev_op)->ldpc_enc);
+		in_op_data = &ldpc_enc->input;
+		out_op_data = &ldpc_enc->output;
+
+		ret = prepare_ldpc_enc_op(bbdev_op, bbdev_ipc_op, q_priv,
+					  in_op_data, out_op_data);
+		if (ret) {
+			BBDEV_LA12XX_PMD_ERR(
+				"process_ldpc_enc_op failed, ret: %d", ret);
+			return ret;
+		}
+		break;
+
+	case RTE_BBDEV_OP_LDPC_DEC:
+		ldpc_dec = &(((struct rte_bbdev_dec_op *)bbdev_op)->ldpc_dec);
+		in_op_data = &ldpc_dec->input;
+
+			out_op_data = &ldpc_dec->hard_output;
+
+		ret = prepare_ldpc_dec_op(bbdev_op, bbdev_ipc_op,
+					  q_priv, out_op_data);
+		if (ret) {
+			BBDEV_LA12XX_PMD_ERR(
+				"process_ldpc_dec_op failed, ret: %d", ret);
+			return ret;
+		}
+		break;
+
+	default:
+		BBDEV_LA12XX_PMD_ERR("unsupported bbdev_ipc op type");
+		return -1;
+	}
+
+	if (in_op_data->data) {
+		data_ptr = rte_pktmbuf_mtod(in_op_data->data, char *);
+		l1_pcie_addr = (uint32_t)GUL_USER_HUGE_PAGE_ADDR +
+			       data_ptr - huge_start_addr;
+		bbdev_ipc_op->in_addr = l1_pcie_addr;
+		bbdev_ipc_op->in_len = in_op_data->length;
+	}
+
+	if (out_op_data->data) {
+		data_ptr = rte_pktmbuf_mtod(out_op_data->data, char *);
+		l1_pcie_addr = (uint32_t)GUL_USER_HUGE_PAGE_ADDR +
+				data_ptr - huge_start_addr;
+		bbdev_ipc_op->out_addr = rte_cpu_to_be_32(l1_pcie_addr);
+		bbdev_ipc_op->out_len = rte_cpu_to_be_32(out_op_data->length);
+	}
+
+	/* Move Producer Index forward */
+	pi++;
+	/* Flip the PI flag, if wrapping */
+	if (unlikely(q_priv->queue_size == pi)) {
+		pi = 0;
+		pi_flag = pi_flag ? 0 : 1;
+	}
+
+	if (pi_flag)
+		IPC_SET_PI_FLAG(pi);
+	else
+		IPC_RESET_PI_FLAG(pi);
+	/* Wait for Data Copy & pi_flag update to complete before updating pi */
+	rte_mb();
+	/* now update pi */
+	md->pi = rte_cpu_to_be_32(pi);
+	q_priv->host_pi = pi;
+
+	BBDEV_LA12XX_PMD_DP_DEBUG(
+			"enter: pi: %u, ci: %u, pi_flag: %u, ci_flag: %u, ring size: %u",
+			pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	return 0;
+}
+
+/* Enqueue decode burst */
+static uint16_t
+enqueue_dec_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_dec_op **ops, uint16_t nb_ops) {
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	int nb_enqueued, ret;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ret = enqueue_single_op(q_priv, ops[nb_enqueued]);
+		if (ret)
+			break;
+	}
+
+	q_data->queue_stats.enqueue_err_count += nb_ops - nb_enqueued;
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
+/* Enqueue encode burst */
+static uint16_t
+enqueue_enc_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_enc_op **ops, uint16_t nb_ops) {
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	int nb_enqueued, ret;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ret = enqueue_single_op(q_priv, ops[nb_enqueued]);
+		if (ret)
+			break;
+	}
+
+	q_data->queue_stats.enqueue_err_count += nb_ops - nb_enqueued;
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
+static inline int
+is_bd_ring_empty(uint32_t ci, uint32_t ci_flag,
+		 uint32_t pi, uint32_t pi_flag)
+{
+	if (ci == pi) {
+		if (ci_flag == pi_flag)
+			return 1; /* No more Buffer */
+	}
+	return 0;
+}
+
+/* Dequeue encode burst */
+static void *
+dequeue_single_op(struct bbdev_la12xx_q_priv *q_priv, void *dst) {
+	struct bbdev_la12xx_private *priv = q_priv->bbdev_priv;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	uint32_t q_id = q_priv->q_id + HOST_RX_QUEUEID_OFFSET;
+	ipc_instance_t *ipc_instance = ipc_priv->instance;
+	ipc_ch_t *ch = &(ipc_instance->ch_list[q_id]);
+	uint32_t ci, ci_flag, pi, pi_flag;
+	ipc_br_md_t *md;
+	void *op;
+	uint32_t temp_pi;
+
+	md = &(ch->md);
+	ci = IPC_GET_CI_INDEX(q_priv->host_ci);
+	ci_flag = IPC_GET_CI_FLAG(q_priv->host_ci);
+
+	temp_pi = q_priv->host_params->pi;
+	pi = IPC_GET_PI_INDEX(temp_pi);
+	pi_flag = IPC_GET_PI_FLAG(temp_pi);
+
+	if (is_bd_ring_empty(ci, ci_flag, pi, pi_flag))
+		return NULL;
+
+	BBDEV_LA12XX_PMD_DP_DEBUG(
+		"pi: %u, ci: %u, pi_flag: %u, ci_flag: %u, ring size: %u",
+		pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	op = q_priv->bbdev_op[ci];
+
+	rte_memcpy(dst, q_priv->msg_ch_vaddr[ci],
+		sizeof(struct bbdev_ipc_enqueue_op));
+
+	/* Move Consumer Index forward */
+	ci++;
+	/* Flip the CI flag, if wrapping */
+	if (q_priv->queue_size == ci) {
+		ci = 0;
+		ci_flag = ci_flag ? 0 : 1;
+	}
+	if (ci_flag)
+		IPC_SET_CI_FLAG(ci);
+	else
+		IPC_RESET_CI_FLAG(ci);
+	md->ci = rte_cpu_to_be_32(ci);
+	q_priv->host_ci = ci;
+
+	BBDEV_LA12XX_PMD_DP_DEBUG(
+		"exit: pi: %u, ci: %u, pi_flag: %u, ci_flag: %u, ring size: %u",
+		pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+

So you don't use any of the BBDEV flags to report CRC and syndrome parity check in the response?

+	return op;
+}
+
+/* Dequeue decode burst */
+static uint16_t
+dequeue_dec_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_dec_op **ops, uint16_t nb_ops) {
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	struct bbdev_ipc_enqueue_op bbdev_ipc_op;
+	int nb_dequeued;
+
+	for (nb_dequeued = 0; nb_dequeued < nb_ops; nb_dequeued++) {
+		ops[nb_dequeued] = dequeue_single_op(q_priv, &bbdev_ipc_op);
+		if (!ops[nb_dequeued])
+			break;
+		ops[nb_dequeued]->status = bbdev_ipc_op.status;
+	}
+	q_data->queue_stats.dequeued_count += nb_dequeued;
+
+	return nb_dequeued;
+}
+
+/* Dequeue encode burst */
+static uint16_t
+dequeue_enc_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_enc_op **ops, uint16_t nb_ops) {
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	struct bbdev_ipc_enqueue_op bbdev_ipc_op;
+	int nb_enqueued;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ops[nb_enqueued] = dequeue_single_op(q_priv, &bbdev_ipc_op);
+		if (!ops[nb_enqueued])
+			break;
+		ops[nb_enqueued]->status = bbdev_ipc_op.status;
+	}
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
 static struct hugepage_info *
 get_hugepage_info(void)
 {
@@ -720,10 +1105,14 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 	bbdev->intr_handle = NULL;
 
 	/* register rx/tx burst functions for data path */
-	bbdev->dequeue_enc_ops = NULL;
-	bbdev->dequeue_dec_ops = NULL;
-	bbdev->enqueue_enc_ops = NULL;
-	bbdev->enqueue_dec_ops = NULL;
+	bbdev->dequeue_enc_ops = dequeue_enc_ops;
+	bbdev->dequeue_dec_ops = dequeue_dec_ops;
+	bbdev->enqueue_enc_ops = enqueue_enc_ops;
+	bbdev->enqueue_dec_ops = enqueue_dec_ops;

These above are used for 4G operations, since the capability is not there thet can be null.

+	bbdev->dequeue_ldpc_enc_ops = dequeue_enc_ops;
+	bbdev->dequeue_ldpc_dec_ops = dequeue_dec_ops;
+	bbdev->enqueue_ldpc_enc_ops = enqueue_enc_ops;
+	bbdev->enqueue_ldpc_dec_ops = enqueue_dec_ops;
 
 	return 0;
 }
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
index 9d5789f726..4e181e9254 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -76,6 +76,25 @@ typedef struct {
 	_IOWR(GUL_IPC_MAGIC, 5, struct ipc_msg *)  #define IOCTL_GUL_IPC_CHANNEL_RAISE_INTERRUPT _IOW(GUL_IPC_MAGIC, 6, int *)
 
+#define GUL_USER_HUGE_PAGE_OFFSET	(0)
+#define GUL_PCI1_ADDR_BASE	(0x00000000ULL)
+
+#define GUL_USER_HUGE_PAGE_ADDR	(GUL_PCI1_ADDR_BASE + GUL_USER_HUGE_PAGE_OFFSET)
+
+/* IPC PI/CI index & flag manipulation helpers */
+#define IPC_PI_CI_FLAG_MASK	0x80000000 /*  (1<<31) */
+#define IPC_PI_CI_INDEX_MASK	0x7FFFFFFF /* ~(1<<31) */
+
+#define IPC_SET_PI_FLAG(x)	(x |= IPC_PI_CI_FLAG_MASK)
+#define IPC_RESET_PI_FLAG(x)	(x &= IPC_PI_CI_INDEX_MASK)
+#define IPC_GET_PI_FLAG(x)	(x >> 31)
+#define IPC_GET_PI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
+
+#define IPC_SET_CI_FLAG(x)	(x |= IPC_PI_CI_FLAG_MASK)
+#define IPC_RESET_CI_FLAG(x)	(x &= IPC_PI_CI_INDEX_MASK)
+#define IPC_GET_CI_FLAG(x)	(x >> 31)
+#define IPC_GET_CI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
+
 /** buffer ring common metadata */
 typedef struct ipc_bd_ring_md {
 	volatile uint32_t pi;		/**< Producer index and flag (MSB)
@@ -173,6 +192,24 @@ struct bbdev_ipc_enqueue_op {
 	uint32_t rsvd;
 };
 
+/** Structure specifying dequeue operation (dequeue at LA1224) */ 
+struct bbdev_ipc_dequeue_op {
+	/** Input buffer memory address */
+	uint32_t in_addr;
+	/** Input buffer memory length */
+	uint32_t in_len;
+	/** Output buffer memory address */
+	uint32_t out_addr;
+	/** Output buffer memory length */
+	uint32_t out_len;
+	/* Number of code blocks. Only set when HARQ is used */
+	uint32_t num_code_blocks;
+	/** Dequeue Operation flags */
+	uint32_t op_flags;
+	/** Shared metadata between L1 and L2 */
+	uint32_t shared_metadata;
+};
+
 /* This shared memory would be on the host side which have copy of some
  * of the parameters which are also part of Shared BD ring. Read access
  * of these parameters from the host side would not be over PCI.
--
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v3 6/8] baseband/la12xx: add documentation support
  2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 6/8] baseband/la12xx: add documentation support Hemant Agrawal
@ 2021-04-14  0:57       ` Chautru, Nicolas
  2021-04-14 11:59         ` Hemant Agrawal
  0 siblings, 1 reply; 157+ messages in thread
From: Chautru, Nicolas @ 2021-04-14  0:57 UTC (permalink / raw)
  To: Hemant Agrawal, dev, gakhil; +Cc: david.marchand, Nipun Gupta


Documentation should be ideally embedded within the related commits to go hand in hand when feature are being added, not as a separate commit. Other comments below

> -----Original Message-----
> From: Hemant Agrawal <hemant.agrawal@nxp.com>
> Sent: Monday, April 12, 2021 10:17 PM
> To: dev@dpdk.org; gakhil@marvell.com; Chautru, Nicolas
> <nicolas.chautru@intel.com>
> Cc: david.marchand@redhat.com; Hemant Agrawal
> <hemant.agrawal@nxp.com>; Nipun Gupta <nipun.gupta@nxp.com>
> Subject: [PATCH v3 6/8] baseband/la12xx: add documentation support
> 
> This patch add documentation for LA12xx PMD.
> 
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>  MAINTAINERS                            |   9 ++
>  doc/guides/bbdevs/features/la12xx.ini  |  14 +++
>  doc/guides/bbdevs/index.rst            |   1 +
>  doc/guides/bbdevs/la12xx.rst           | 139 +++++++++++++++++++++++++
>  doc/guides/rel_notes/release_21_05.rst |   5 +
>  5 files changed, 168 insertions(+)
>  create mode 100644 doc/guides/bbdevs/features/la12xx.ini
>  create mode 100644 doc/guides/bbdevs/la12xx.rst
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index e746ef1d32..24081fceb3 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1289,6 +1289,15 @@ F: doc/guides/rawdevs/ntb.rst
>  F: examples/ntb/
>  F: doc/guides/sample_app_ug/ntb.rst
> 
> +Baseband Drivers
> +-------------------
> +
> +NXP LA12xx
> +M: Hemant Agrawal <hemant.agrawal@nxp.com>
> +M: Nipun Gupta <nipun.gupta@nxp.com>
> +F: drivers/baseband/la12xx/
> +F: doc/guides/bbdevs/la12xx.rst
> +F: doc/guides/bbdevs/features/la12xx.ini
> 
>  Packet processing
>  -----------------
> diff --git a/doc/guides/bbdevs/features/la12xx.ini
> b/doc/guides/bbdevs/features/la12xx.ini
> new file mode 100644
> index 0000000000..979d9dd224
> --- /dev/null
> +++ b/doc/guides/bbdevs/features/la12xx.ini
> @@ -0,0 +1,14 @@
> +;
> +; Supported features of the 'la12xx' bbdev driver.
> +;
> +; Refer to default.ini for the full list of available PMD features.
> +;
> +[Features]
> +Turbo Decoder (4G)     = N
> +Turbo Encoder (4G)     = N
> +LDPC Decoder (5G)      = Y
> +LDPC Encoder (5G)      = Y
> +LLR/HARQ Compression   = N
> +External DDR Access    = Y

What is the external DDR access capability here? This was not exposed in BBDEV. 

> +HW Accelerated         = Y
> +BBDEV API              = Y
> diff --git a/doc/guides/bbdevs/index.rst b/doc/guides/bbdevs/index.rst index
> 4445cbd1b0..cedd706fa6 100644
> --- a/doc/guides/bbdevs/index.rst
> +++ b/doc/guides/bbdevs/index.rst
> @@ -14,3 +14,4 @@ Baseband Device Drivers
>      fpga_lte_fec
>      fpga_5gnr_fec
>      acc100
> +    la12xx
> diff --git a/doc/guides/bbdevs/la12xx.rst b/doc/guides/bbdevs/la12xx.rst
> new file mode 100644 index 0000000000..1cadd6f337
> --- /dev/null
> +++ b/doc/guides/bbdevs/la12xx.rst
> @@ -0,0 +1,139 @@
> +..  SPDX-License-Identifier: BSD-3-Clause
> +    Copyright 2021 NXP
> +
> +NXP LA12xx Poll Mode Driver
> +=======================================
> +
> +The BBDEV LA12xx poll mode driver (PMD) supports an implementation for
> +offloading High Phy processing functions like LDPC Encode / Decode 5GNR
> +wireless acceleration function, using PCI based LA12xx Software defined
> radio.
> +
> +More information can be found at `NXP Official Website
> +<https://www.nxp.com/products/processors-and-microcontrollers/arm-
> processors/layerscape-processors/layerscape-access-la1200-programmable-
> baseband-processor:LA1200>`_.
> +
> +Features
> +--------
> +
> +LA12xx PMD supports the following features:
> +
> +- LDPC Encode in the DL
> +- LDPC Decode in the UL
> +- Maximum of 8 UL queues
> +- Maximum of 8 DL queues
> +- PCIe Gen-3 x8 Interface
> +- MSI-X

Capability was not exposed in the commit

> +
> +LA12xx PMD supports the following BBDEV capabilities:
> +
> +* For the LDPC encode operation:
> +   - ``RTE_BBDEV_LDPC_CRC_24B_ATTACH`` :  set to attach CRC24B to CB(s)
> +   - ``RTE_BBDEV_LDPC_RATE_MATCH`` :  if set then do not do Rate Match
> +bypass

mismatch with the code

> +
> +* For the LDPC decode operation:
> +   - ``RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK`` :  check CRC24B from CB(s)
> +   - ``RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP`` :  drops CRC24B bits
> appended while decoding
> +   - ``RTE_BBDEV_LDPC_DEC_SCATTER_GATHER`` :  supports scatter-gather
> +for input/output data
> +
> +Installation
> +------------
> +
> +Section 3 of the DPDK manual provides instructions on installing and
> compiling DPDK.
> +
> +DPDK requires hugepages to be configured as detailed in section 2 of the
> DPDK manual.
> +
> +Initialization
> +--------------
> +
> +The device can be listed on the host console with:
> +
> +
> +Use the following lspci command to get the multiple LA12xx processor
> +ids. The device ID of the LA12xx baseband processor is "1c30".
> +

There is no SRIOV? Single device id? 

> +.. code-block:: console
> +
> +  sudo lspci -nn
> +
> +...
> +0001:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device
> +[1957:1c30] ( rev 10) ...
> +0002:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device
> +[1957:1c30] ( rev 10)
> +
> +
> +Prerequisites
> +-------------
> +
> +Currently supported by DPDK:
> +
> +- NXP LA1224 BSP **1.0+**.
> +- NXP LA1224 PCIe Modem card connected to ARM host.
> +
> +- Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to
> setup the basic DPDK environment.
> +
> +* Use dev arg option ``modem=0`` to identify the modem instance for a
> +given
> +  device. This is required only if more than 1 modem cards are attached to
> host.
> +  this is optional and the default value is 0.
> +  e.g. ``--vdev=baseband_la12xx,modem=0``
> +
> +* Use dev arg option ``max_nb_queues=x`` to specify the maximum
> number
> +of queues
> +  to be used for communication with offload device i.e. modem. default is
> 16.
> +  e.g. ``--vdev=baseband_la12xx,max_nb_queues=4``
> +
> +Enabling logs
> +-------------
> +
> +For enabling logs, use the following EAL parameter:
> +
> +.. code-block:: console
> +
> +   ./your_bbdev_application <EAL args> --log-level=la12xx:<level>
> +
> +Using ``bb.la12xx`` as log matching criteria, all Baseband PMD logs can
> +be enabled which are lower than logging ``level``.
> +
> +
> +Test Application
> +----------------
> +
> +BBDEV provides a test application, ``test-bbdev.py`` and range of test
> +data for testing the functionality of LA12xx for FEC encode and decode,
> +depending on the device capabilities. The test application is located
> +under app->test-bbdev folder and has the following options:
> +
> +.. code-block:: console
> +
> +  "-p", "--testapp-path": specifies path to the bbdev test app.
> +  "-e", "--eal-params"	: EAL arguments which are passed to the test app.
> +  "-t", "--timeout"	: Timeout in seconds (default=300).
> +  "-c", "--test-cases"	: Defines test cases to run. Run all if not specified.
> +  "-v", "--test-vector"	: Test vector path (default=dpdk_path+/app/test-
> bbdev/test_vectors/bbdev_null.data).
> +  "-n", "--num-ops"	: Number of operations to process on device
> (default=32).
> +  "-b", "--burst-size"	: Operations enqueue/dequeue burst size
> (default=32).
> +  "-s", "--snr"		: SNR in dB used when generating LLRs for bler tests.
> +  "-s", "--iter_max"	: Number of iterations for LDPC decoder.
> +  "-l", "--num-lcores"	: Number of lcores to run (default=16).
> +  "-i", "--init-device" : Initialise PF device with default values.
> +
> +
> +To execute the test application tool using simple decode or encode
> +data, type one of the following:
> +
> +.. code-block:: console
> +
> +  ./test-bbdev.py
> + -e="--vdev=baseband_la12xx,socket_id=0,max_nb_queues=8" -c validation
> + -n 64 -b 1 -v ./ldpc_dec_default.data  ./test-bbdev.py
> + -e="--vdev=baseband_la12xx,socket_id=0,max_nb_queues=8" -c validation
> + -n 64 -b 1 -v ./ldpc_enc_default.data
> +
> +The test application ``test-bbdev.py``, supports the ability to
> +configure the PF device with a default set of values, if the "-i" or "-
> +-init-device" option is included. The default values are defined in
> test_bbdev_perf.c.
> +
> +
> +Test Vectors
> +~~~~~~~~~~~~
> +
> +In addition to the simple LDPC decoder and LDPC encoder tests, bbdev
> +also provides a range of additional tests under the test_vectors
> +folder, which may be useful. The results of these tests will depend on
> +the LA12xx FEC capabilities which may cause some testcases to be skipped,
> but no failure should be reported.
> diff --git a/doc/guides/rel_notes/release_21_05.rst
> b/doc/guides/rel_notes/release_21_05.rst
> index 6f5858c8f6..61797e2a43 100644
> --- a/doc/guides/rel_notes/release_21_05.rst
> +++ b/doc/guides/rel_notes/release_21_05.rst
> @@ -130,6 +130,11 @@ New Features
>    * Added command to display Rx queue used descriptor count.
>      ``show port (port_id) rxq (queue_id) desc used count``
> 
> +* **Added NXP LA12xx baseband PMD.**
> +
> +  Added a new baseband PMD driver for NXP LA12xx Software defined
> radio.
> +
> +  See the :doc:`../bbdevs/la12xx` for more details.
> 
>  Removed Items
>  -------------
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v3 7/8] app/bbdev: add parameter to take input in network order
  2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 7/8] app/bbdev: add parameter to take input in network order Hemant Agrawal
@ 2021-04-14  1:00       ` Chautru, Nicolas
  2021-04-14 12:15         ` Nipun Gupta
  0 siblings, 1 reply; 157+ messages in thread
From: Chautru, Nicolas @ 2021-04-14  1:00 UTC (permalink / raw)
  To: Hemant Agrawal, dev, gakhil; +Cc: david.marchand, Nipun Gupta

If you want this, should this be a new BBDEV capability option?
If not how can you enforce compatibility if you just bypass this in the test vector parsing?

> -----Original Message-----
> From: Hemant Agrawal <hemant.agrawal@nxp.com>
> Sent: Monday, April 12, 2021 10:17 PM
> To: dev@dpdk.org; gakhil@marvell.com; Chautru, Nicolas
> <nicolas.chautru@intel.com>
> Cc: david.marchand@redhat.com; Nipun Gupta <nipun.gupta@nxp.com>
> Subject: [PATCH v3 7/8] app/bbdev: add parameter to take input in network
> order
> 
> From: Nipun Gupta <nipun.gupta@nxp.com>
> 
> Test bbdev application is reading the input and output from the test vector
> files in the same endianness which is of the system.
> This patch adds an option to provide data in the network order i.e. big
> endian format
> 
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---
>  app/test-bbdev/test_bbdev_vector.c | 18 ++++++++++++++++--  app/test-
> bbdev/test_bbdev_vector.h |  2 ++
>  2 files changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/app/test-bbdev/test_bbdev_vector.c b/app/test-
> bbdev/test_bbdev_vector.c
> index 50d1da00f7..fe04bd6b95 100644
> --- a/app/test-bbdev/test_bbdev_vector.c
> +++ b/app/test-bbdev/test_bbdev_vector.c
> @@ -53,7 +53,8 @@ starts_with(const char *str, const char *pre)
> 
>  /* tokenization test values separated by a comma */  static int -
> parse_values(char *tokens, uint32_t **data, uint32_t *data_length)
> +parse_values(char *tokens, uint32_t **data, uint32_t *data_length,
> +	     int network_order)
>  {
>  	uint32_t n_tokens = 0;
>  	uint32_t data_size = 32;
> @@ -94,6 +95,14 @@ parse_values(char *tokens, uint32_t **data, uint32_t
> *data_length)
>  		}
> 
>  		*data_length = *data_length + (strlen(tok) - strlen("0x"))/2;
> +		if (network_order) {
> +			if ((strlen(tok) - strlen("0x"))/2 == 4)
> +				values[n_tokens] =
> +					rte_cpu_to_be_32(values[n_tokens]);
> +			else if ((strlen(tok) - strlen("0x"))/2 == 2)
> +				values[n_tokens] =
> +					rte_cpu_to_be_16(values[n_tokens]);
> +		}
> 
>  		tok = strtok(NULL, VALUE_DELIMITER);
>  		if (tok == NULL)
> @@ -416,7 +425,8 @@ parse_data_entry(const char *key_token, char
> *token,
>  	/* Clear new op data struct */
>  	memset(op_data + *nb_ops, 0, sizeof(struct op_data_buf));
> 
> -	ret = parse_values(token, &data, &data_length);
> +	ret = parse_values(token, &data, &data_length,
> +			vector->network_order);
>  	if (!ret) {
>  		op_data[*nb_ops].addr = data;
>  		op_data[*nb_ops].length = data_length; @@ -728,6 +738,10
> @@ parse_ldpc_encoder_params(const char *key_token, char *token,
>  		ret = parse_expected_status(token, &status, vector-
> >op_type);
>  		if (!ret)
>  			vector->expected_status = status;
> +	} else if (!strcmp(key_token, "network_order")) {
> +		vector->mask |= TEST_BBDEV_VF_NETWORK_ORDER;
> +		vector->network_order = (uint8_t) strtoul(token, &err, 0);
> +		ret = ((err == NULL) || (*err != '\0')) ? -1 : 0;
>  	} else {
>  		printf("Not valid ldpc enc key: '%s'\n", key_token);
>  		return -1;
> diff --git a/app/test-bbdev/test_bbdev_vector.h b/app/test-
> bbdev/test_bbdev_vector.h
> index 4e5dbf5d50..aa53f0bb0d 100644
> --- a/app/test-bbdev/test_bbdev_vector.h
> +++ b/app/test-bbdev/test_bbdev_vector.h
> @@ -35,6 +35,7 @@ enum {
>  	TEST_BBDEV_VF_CODE_BLOCK_MODE = (1ULL << 23),
>  	TEST_BBDEV_VF_OP_FLAGS = (1ULL << 24),
>  	TEST_BBDEV_VF_EXPECTED_STATUS = (1ULL << 25),
> +	TEST_BBDEV_VF_NETWORK_ORDER = (1ULL << 26),
>  };
> 
>  enum op_data_type {
> @@ -60,6 +61,7 @@ struct test_bbdev_vector {
>  	enum rte_bbdev_op_type op_type;
>  	int expected_status;
>  	int mask;
> +	int network_order;
>  	union {
>  		struct rte_bbdev_op_turbo_dec turbo_dec;
>  		struct rte_bbdev_op_turbo_enc turbo_enc;
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v3 8/8] app/bbdev: add test vectors for transport blocks
  2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 8/8] app/bbdev: add test vectors for transport blocks Hemant Agrawal
@ 2021-04-14  1:09       ` Chautru, Nicolas
  2021-04-14 12:16         ` Nipun Gupta
  0 siblings, 1 reply; 157+ messages in thread
From: Chautru, Nicolas @ 2021-04-14  1:09 UTC (permalink / raw)
  To: Hemant Agrawal, dev, gakhil; +Cc: david.marchand, Nipun Gupta


> -----Original Message-----
> From: Hemant Agrawal <hemant.agrawal@nxp.com>
> Sent: Monday, April 12, 2021 10:17 PM
> 
> From: Nipun Gupta <nipun.gupta@nxp.com>
> 
> This patch adds two test vectors for transport block in network byte
> order:
> - LDPC encode for Transport Block
> - LDPC decode for Transport block
> 
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---
>  app/test-bbdev/test_vectors/ldpc_dec_tb.data | 362 ++++++++++++++
>  app/test-bbdev/test_vectors/ldpc_enc_tb.data | 482
> +++++++++++++++++++
>  2 files changed, 844 insertions(+)
>  create mode 100644 app/test-bbdev/test_vectors/ldpc_dec_tb.data
>  create mode 100644 app/test-bbdev/test_vectors/ldpc_enc_tb.data


Do we get anything new from these additional vectors?
How does this help to change the network order in vector then change it again when it is parsed? This is the same data going into bbdev api. 
Also these vectors would be quite big (relatively large C). 
Ideally you want all existing vectors matching your PMD capability to be run seamlessly.
Let me know what I may miss, this looks unrequired. 

(...)

> --
> 2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v3 6/8] baseband/la12xx: add documentation support
  2021-04-14  0:57       ` Chautru, Nicolas
@ 2021-04-14 11:59         ` Hemant Agrawal
  0 siblings, 0 replies; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-14 11:59 UTC (permalink / raw)
  To: Chautru, Nicolas, Hemant Agrawal, dev, gakhil; +Cc: david.marchand, Nipun Gupta


On 4/14/2021 6:27 AM, Chautru, Nicolas wrote:
> Documentation should be ideally embedded within the related commits to go hand in hand when feature are being added, not as a separate commit. Other comments below
ok
>
>> -----Original Message-----
>> From: Hemant Agrawal <hemant.agrawal@nxp.com>
>> Sent: Monday, April 12, 2021 10:17 PM
>> To: dev@dpdk.org; gakhil@marvell.com; Chautru, Nicolas
>> <nicolas.chautru@intel.com>
>> Cc: david.marchand@redhat.com; Hemant Agrawal
>> <hemant.agrawal@nxp.com>; Nipun Gupta <nipun.gupta@nxp.com>
>> Subject: [PATCH v3 6/8] baseband/la12xx: add documentation support
>>
>> This patch add documentation for LA12xx PMD.
>>
>> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
>> ---
>>   MAINTAINERS                            |   9 ++
>>   doc/guides/bbdevs/features/la12xx.ini  |  14 +++
>>   doc/guides/bbdevs/index.rst            |   1 +
>>   doc/guides/bbdevs/la12xx.rst           | 139 +++++++++++++++++++++++++
>>   doc/guides/rel_notes/release_21_05.rst |   5 +
>>   5 files changed, 168 insertions(+)
>>   create mode 100644 doc/guides/bbdevs/features/la12xx.ini
>>   create mode 100644 doc/guides/bbdevs/la12xx.rst
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index e746ef1d32..24081fceb3 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -1289,6 +1289,15 @@ F: doc/guides/rawdevs/ntb.rst
>>   F: examples/ntb/
>>   F: doc/guides/sample_app_ug/ntb.rst
>>
>> +Baseband Drivers
>> +-------------------
>> +
>> +NXP LA12xx
>> +M: Hemant Agrawal <hemant.agrawal@nxp.com>
>> +M: Nipun Gupta <nipun.gupta@nxp.com>
>> +F: drivers/baseband/la12xx/
>> +F: doc/guides/bbdevs/la12xx.rst
>> +F: doc/guides/bbdevs/features/la12xx.ini
>>
>>   Packet processing
>>   -----------------
>> diff --git a/doc/guides/bbdevs/features/la12xx.ini
>> b/doc/guides/bbdevs/features/la12xx.ini
>> new file mode 100644
>> index 0000000000..979d9dd224
>> --- /dev/null
>> +++ b/doc/guides/bbdevs/features/la12xx.ini
>> @@ -0,0 +1,14 @@
>> +;
>> +; Supported features of the 'la12xx' bbdev driver.
>> +;
>> +; Refer to default.ini for the full list of available PMD features.
>> +;
>> +[Features]
>> +Turbo Decoder (4G)     = N
>> +Turbo Encoder (4G)     = N
>> +LDPC Decoder (5G)      = Y
>> +LDPC Encoder (5G)      = Y
>> +LLR/HARQ Compression   = N
>> +External DDR Access    = Y
> What is the external DDR access capability here? This was not exposed in BBDEV.
ok. we will remove it
>
>> +HW Accelerated         = Y
>> +BBDEV API              = Y
>> diff --git a/doc/guides/bbdevs/index.rst b/doc/guides/bbdevs/index.rst index
>> 4445cbd1b0..cedd706fa6 100644
>> --- a/doc/guides/bbdevs/index.rst
>> +++ b/doc/guides/bbdevs/index.rst
>> @@ -14,3 +14,4 @@ Baseband Device Drivers
>>       fpga_lte_fec
>>       fpga_5gnr_fec
>>       acc100
>> +    la12xx
>> diff --git a/doc/guides/bbdevs/la12xx.rst b/doc/guides/bbdevs/la12xx.rst
>> new file mode 100644 index 0000000000..1cadd6f337
>> --- /dev/null
>> +++ b/doc/guides/bbdevs/la12xx.rst
>> @@ -0,0 +1,139 @@
>> +..  SPDX-License-Identifier: BSD-3-Clause
>> +    Copyright 2021 NXP
>> +
>> +NXP LA12xx Poll Mode Driver
>> +=======================================
>> +
>> +The BBDEV LA12xx poll mode driver (PMD) supports an implementation for
>> +offloading High Phy processing functions like LDPC Encode / Decode 5GNR
>> +wireless acceleration function, using PCI based LA12xx Software defined
>> radio.
>> +
>> +More information can be found at `NXP Official Website
>> +<https://www.nxp.com/products/processors-and-microcontrollers/arm-
>> processors/layerscape-processors/layerscape-access-la1200-programmable-
>> baseband-processor:LA1200>`_.
>> +
>> +Features
>> +--------
>> +
>> +LA12xx PMD supports the following features:
>> +
>> +- LDPC Encode in the DL
>> +- LDPC Decode in the UL
>> +- Maximum of 8 UL queues
>> +- Maximum of 8 DL queues
>> +- PCIe Gen-3 x8 Interface
>> +- MSI-X
> Capability was not exposed in the commit
>
>> +
>> +LA12xx PMD supports the following BBDEV capabilities:
>> +
>> +* For the LDPC encode operation:
>> +   - ``RTE_BBDEV_LDPC_CRC_24B_ATTACH`` :  set to attach CRC24B to CB(s)
>> +   - ``RTE_BBDEV_LDPC_RATE_MATCH`` :  if set then do not do Rate Match
>> +bypass
> mismatch with the code
ok
>
>> +
>> +* For the LDPC decode operation:
>> +   - ``RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK`` :  check CRC24B from CB(s)
>> +   - ``RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP`` :  drops CRC24B bits
>> appended while decoding
>> +   - ``RTE_BBDEV_LDPC_DEC_SCATTER_GATHER`` :  supports scatter-gather
>> +for input/output data
>> +
>> +Installation
>> +------------
>> +
>> +Section 3 of the DPDK manual provides instructions on installing and
>> compiling DPDK.
>> +
>> +DPDK requires hugepages to be configured as detailed in section 2 of the
>> DPDK manual.
>> +
>> +Initialization
>> +--------------
>> +
>> +The device can be listed on the host console with:
>> +
>> +
>> +Use the following lspci command to get the multiple LA12xx processor
>> +ids. The device ID of the LA12xx baseband processor is "1c30".
>> +
> There is no SRIOV? Single device id?
yes, we don't support SRIOV.
>
>> +.. code-block:: console
>> +
>> +  sudo lspci -nn
>> +
>> +...
>> +0001:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device
>> +[1957:1c30] ( rev 10) ...
>> +0002:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device
>> +[1957:1c30] ( rev 10)
>> +
>> +
>> +Prerequisites
>> +-------------
>> +
>> +Currently supported by DPDK:
>> +
>> +- NXP LA1224 BSP **1.0+**.
>> +- NXP LA1224 PCIe Modem card connected to ARM host.
>> +
>> +- Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to
>> setup the basic DPDK environment.
>> +
>> +* Use dev arg option ``modem=0`` to identify the modem instance for a
>> +given
>> +  device. This is required only if more than 1 modem cards are attached to
>> host.
>> +  this is optional and the default value is 0.
>> +  e.g. ``--vdev=baseband_la12xx,modem=0``
>> +
>> +* Use dev arg option ``max_nb_queues=x`` to specify the maximum
>> number
>> +of queues
>> +  to be used for communication with offload device i.e. modem. default is
>> 16.
>> +  e.g. ``--vdev=baseband_la12xx,max_nb_queues=4``
>> +
>> +Enabling logs
>> +-------------
>> +
>> +For enabling logs, use the following EAL parameter:
>> +
>> +.. code-block:: console
>> +
>> +   ./your_bbdev_application <EAL args> --log-level=la12xx:<level>
>> +
>> +Using ``bb.la12xx`` as log matching criteria, all Baseband PMD logs can
>> +be enabled which are lower than logging ``level``.
>> +
>> +
>> +Test Application
>> +----------------
>> +
>> +BBDEV provides a test application, ``test-bbdev.py`` and range of test
>> +data for testing the functionality of LA12xx for FEC encode and decode,
>> +depending on the device capabilities. The test application is located
>> +under app->test-bbdev folder and has the following options:
>> +
>> +.. code-block:: console
>> +
>> +  "-p", "--testapp-path": specifies path to the bbdev test app.
>> +  "-e", "--eal-params"	: EAL arguments which are passed to the test app.
>> +  "-t", "--timeout"	: Timeout in seconds (default=300).
>> +  "-c", "--test-cases"	: Defines test cases to run. Run all if not specified.
>> +  "-v", "--test-vector"	: Test vector path (default=dpdk_path+/app/test-
>> bbdev/test_vectors/bbdev_null.data).
>> +  "-n", "--num-ops"	: Number of operations to process on device
>> (default=32).
>> +  "-b", "--burst-size"	: Operations enqueue/dequeue burst size
>> (default=32).
>> +  "-s", "--snr"		: SNR in dB used when generating LLRs for bler tests.
>> +  "-s", "--iter_max"	: Number of iterations for LDPC decoder.
>> +  "-l", "--num-lcores"	: Number of lcores to run (default=16).
>> +  "-i", "--init-device" : Initialise PF device with default values.
>> +
>> +
>> +To execute the test application tool using simple decode or encode
>> +data, type one of the following:
>> +
>> +.. code-block:: console
>> +
>> +  ./test-bbdev.py
>> + -e="--vdev=baseband_la12xx,socket_id=0,max_nb_queues=8" -c validation
>> + -n 64 -b 1 -v ./ldpc_dec_default.data  ./test-bbdev.py
>> + -e="--vdev=baseband_la12xx,socket_id=0,max_nb_queues=8" -c validation
>> + -n 64 -b 1 -v ./ldpc_enc_default.data
>> +
>> +The test application ``test-bbdev.py``, supports the ability to
>> +configure the PF device with a default set of values, if the "-i" or "-
>> +-init-device" option is included. The default values are defined in
>> test_bbdev_perf.c.
>> +
>> +
>> +Test Vectors
>> +~~~~~~~~~~~~
>> +
>> +In addition to the simple LDPC decoder and LDPC encoder tests, bbdev
>> +also provides a range of additional tests under the test_vectors
>> +folder, which may be useful. The results of these tests will depend on
>> +the LA12xx FEC capabilities which may cause some testcases to be skipped,
>> but no failure should be reported.
>> diff --git a/doc/guides/rel_notes/release_21_05.rst
>> b/doc/guides/rel_notes/release_21_05.rst
>> index 6f5858c8f6..61797e2a43 100644
>> --- a/doc/guides/rel_notes/release_21_05.rst
>> +++ b/doc/guides/rel_notes/release_21_05.rst
>> @@ -130,6 +130,11 @@ New Features
>>     * Added command to display Rx queue used descriptor count.
>>       ``show port (port_id) rxq (queue_id) desc used count``
>>
>> +* **Added NXP LA12xx baseband PMD.**
>> +
>> +  Added a new baseband PMD driver for NXP LA12xx Software defined
>> radio.
>> +
>> +  See the :doc:`../bbdevs/la12xx` for more details.
>>
>>   Removed Items
>>   -------------
>> --
>> 2.17.1

^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v3 5/8] baseband/la12xx: add enqueue and dequeue support
  2021-04-14  0:53       ` Chautru, Nicolas
@ 2021-04-14 12:06         ` Hemant Agrawal
  0 siblings, 0 replies; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-14 12:06 UTC (permalink / raw)
  To: Chautru, Nicolas, Hemant Agrawal, dev, gakhil; +Cc: david.marchand, Nipun Gupta


On 4/14/2021 6:23 AM, Chautru, Nicolas wrote:
> Add support for enqueue and dequeue the LDPC enc/dec from the modem device.
>
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>   drivers/baseband/la12xx/bbdev_la12xx.c     | 397 ++++++++++++++++++++-
>   drivers/baseband/la12xx/bbdev_la12xx_ipc.h |  37 ++
>   2 files changed, 430 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
> index 0a68686205..d1040987b2 100644
> --- a/drivers/baseband/la12xx/bbdev_la12xx.c
> +++ b/drivers/baseband/la12xx/bbdev_la12xx.c
> @@ -117,6 +117,10 @@ la12xx_queue_release(struct rte_bbdev *dev, uint16_t q_id)
>   		((uint64_t) ((unsigned long) (A) \
>   		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
>   
> +#define MODEM_P2V(A) \
> +	((uint64_t) ((unsigned long) (A) \
> +		+ (unsigned long)(ipc_priv->peb_start.host_vaddr)))
> +
>   static int ipc_queue_configure(uint32_t channel_id,
>   		ipc_t instance, struct bbdev_la12xx_q_priv *q_priv)  { @@ -345,6 +349,387 @@ static const struct rte_bbdev_ops pmd_ops = {
>   	.queue_release = la12xx_queue_release,
>   	.start = la12xx_start
>   };
> +
> +static int
> +fill_feca_desc_enc(struct bbdev_la12xx_q_priv *q_priv,
> +		   struct bbdev_ipc_dequeue_op *bbdev_ipc_op,
> +		   struct rte_bbdev_enc_op *bbdev_enc_op,
> +		   struct rte_bbdev_op_data *in_op_data) {
> +	RTE_SET_USED(q_priv);
> +	RTE_SET_USED(bbdev_ipc_op);
> +	RTE_SET_USED(bbdev_enc_op);
> +	RTE_SET_USED(in_op_data);
> +
> +	return 0;
> +}
>
> I miss why these functions are here.
> Is that contribution supposed to work or a placeholder?

it is currently a placeholder for some optimization work we are doing.

i.e. to covert the bbdev params to our hardware format at host side itself.

We will remove these for now.

>
> +
> +static int
> +fill_feca_desc_dec(struct bbdev_la12xx_q_priv *q_priv,
> +		   struct bbdev_ipc_dequeue_op *bbdev_ipc_op,
> +		   struct rte_bbdev_dec_op *bbdev_dec_op,
> +		   struct rte_bbdev_op_data *out_op_data) {
> +	RTE_SET_USED(q_priv);
> +	RTE_SET_USED(bbdev_ipc_op);
> +	RTE_SET_USED(bbdev_dec_op);
> +	RTE_SET_USED(out_op_data);
> +
> +	return 0;
> +}
> +
> +static inline int
> +is_bd_ring_full(uint32_t ci, uint32_t ci_flag,
> +		uint32_t pi, uint32_t pi_flag)
> +{
> +	if (pi == ci) {
> +		if (pi_flag != ci_flag)
> +			return 1; /* Ring is Full */
> +	}
> +	return 0;
> +}
> +
> +static inline int
> +prepare_ldpc_enc_op(struct rte_bbdev_enc_op *bbdev_enc_op,
> +		    struct bbdev_ipc_dequeue_op *bbdev_ipc_op,
> +		    struct bbdev_la12xx_q_priv *q_priv,
> +		    struct rte_bbdev_op_data *in_op_data,
> +		    struct rte_bbdev_op_data *out_op_data) {
> +	struct rte_bbdev_op_ldpc_enc *ldpc_enc = &bbdev_enc_op->ldpc_enc;
> +	uint32_t total_out_bits;
> +	int ret;
> +
> +	total_out_bits = (ldpc_enc->tb_params.cab *
> +		ldpc_enc->tb_params.ea) + (ldpc_enc->tb_params.c -
> +		ldpc_enc->tb_params.cab) * ldpc_enc->tb_params.eb;
> +
>
> This includes ratematching, see previous comment on capability
>
> Also I see it would not support the partial TB as defined in documentation and API (r != 0)
Not yet.
>
> +	ldpc_enc->output.length = (total_out_bits + 7)/8;
> +
> +	ret = fill_feca_desc_enc(q_priv, bbdev_ipc_op,
> +				 bbdev_enc_op, in_op_data);
> +	if (ret) {
> +		BBDEV_LA12XX_PMD_ERR(
> +			"fill_feca_desc_enc failed, ret: %d", ret);
> +		return ret;
> +	}
> +
> +	rte_pktmbuf_append(out_op_data->data, ldpc_enc->output.length);
> +
> +	return 0;
> +}
> +
> +static inline int
> +prepare_ldpc_dec_op(struct rte_bbdev_dec_op *bbdev_dec_op,
> +		    struct bbdev_ipc_dequeue_op *bbdev_ipc_op,
> +		    struct bbdev_la12xx_q_priv *q_priv,
> +		    struct rte_bbdev_op_data *out_op_data) {
> +	struct rte_bbdev_op_ldpc_dec *ldpc_dec = &bbdev_dec_op->ldpc_dec;
> +	uint32_t total_out_bits;
> +	uint32_t num_code_blocks = 0;
> +	uint16_t sys_cols;
> +	int ret;
> +
> +	sys_cols = (ldpc_dec->basegraph == 1) ? 22 : 10;
> +	if (ldpc_dec->tb_params.c == 1) {
> +		total_out_bits = ((sys_cols * ldpc_dec->z_c) -
> +				ldpc_dec->n_filler);
> +		/* 5G-NR protocol uses 16 bit CRC when output packet
> +		 * size <= 3824 (bits). Otherwise 24 bit CRC is used.
> +		 * Adjust the output bits accordingly
> +		 */
> +		if (total_out_bits - 16 <= 3824)
> +			total_out_bits -= 16;
> +		else
> +			total_out_bits -= 24;
> +		ldpc_dec->hard_output.length = (total_out_bits / 8);
> +	} else {
> +		total_out_bits = (((sys_cols * ldpc_dec->z_c) -
> +				ldpc_dec->n_filler - 24) *
> +				ldpc_dec->tb_params.c);
> +		ldpc_dec->hard_output.length = (total_out_bits / 8) - 3;
>
> Probably good to remove magic number for 24 and 3 here.
ok
>
> +	}
> +
> +	num_code_blocks = ldpc_dec->tb_params.c;
> +
> +	bbdev_ipc_op->num_code_blocks = rte_cpu_to_be_32(num_code_blocks);
> +
> +	ret = fill_feca_desc_dec(q_priv, bbdev_ipc_op,
> +				 bbdev_dec_op, out_op_data);
> +	if (ret) {
> +		BBDEV_LA12XX_PMD_ERR("fill_feca_desc_dec failed, ret: %d", ret);
> +		return ret;
> +	}
> +
> +	return 0;
> +}
> +
> +static int
> +enqueue_single_op(struct bbdev_la12xx_q_priv *q_priv, void *bbdev_op) {
> +	struct bbdev_la12xx_private *priv = q_priv->bbdev_priv;
> +	ipc_userspace_t *ipc_priv = priv->ipc_priv;
> +	ipc_instance_t *ipc_instance = ipc_priv->instance;
> +	struct bbdev_ipc_dequeue_op *bbdev_ipc_op;
> +	struct rte_bbdev_op_ldpc_enc *ldpc_enc;
> +	struct rte_bbdev_op_ldpc_dec *ldpc_dec;
> +	uint32_t q_id = q_priv->q_id;
> +	uint32_t ci, ci_flag, pi, pi_flag;
> +	ipc_ch_t *ch = &(ipc_instance->ch_list[q_id]);
> +	ipc_br_md_t *md = &(ch->md);
> +	size_t virt;
> +	char *huge_start_addr =
> +		(char *)q_priv->bbdev_priv->ipc_priv->hugepg_start.host_vaddr;
> +	struct rte_bbdev_op_data *in_op_data, *out_op_data;
> +	char *data_ptr;
> +	uint32_t l1_pcie_addr;
> +	int ret;
> +	uint32_t temp_ci;
> +
> +	temp_ci = q_priv->host_params->ci;
> +	ci = IPC_GET_CI_INDEX(temp_ci);
> +	ci_flag = IPC_GET_CI_FLAG(temp_ci);
> +
> +	pi = IPC_GET_PI_INDEX(q_priv->host_pi);
> +	pi_flag = IPC_GET_PI_FLAG(q_priv->host_pi);
> +
> +	BBDEV_LA12XX_PMD_DP_DEBUG(
> +		"before bd_ring_full: pi: %u, ci: %u, pi_flag: %u, ci_flag: %u, ring size: %u",
> +		pi, ci, pi_flag, ci_flag, q_priv->queue_size);
> +
> +	if (is_bd_ring_full(ci, ci_flag, pi, pi_flag)) {
> +		BBDEV_LA12XX_PMD_DP_DEBUG(
> +				"bd ring full for queue id: %d", q_id);
> +		return IPC_CH_FULL;
> +	}
> +
> +	virt = MODEM_P2V(q_priv->host_params->modem_ptr[pi]);
> +	bbdev_ipc_op = (struct bbdev_ipc_dequeue_op *)virt;
> +	q_priv->bbdev_op[pi] = bbdev_op;
> +
> +	switch (q_priv->op_type) {
> +	case RTE_BBDEV_OP_LDPC_ENC:
> +		ldpc_enc = &(((struct rte_bbdev_enc_op *)bbdev_op)->ldpc_enc);
> +		in_op_data = &ldpc_enc->input;
> +		out_op_data = &ldpc_enc->output;
> +
> +		ret = prepare_ldpc_enc_op(bbdev_op, bbdev_ipc_op, q_priv,
> +					  in_op_data, out_op_data);
> +		if (ret) {
> +			BBDEV_LA12XX_PMD_ERR(
> +				"process_ldpc_enc_op failed, ret: %d", ret);
> +			return ret;
> +		}
> +		break;
> +
> +	case RTE_BBDEV_OP_LDPC_DEC:
> +		ldpc_dec = &(((struct rte_bbdev_dec_op *)bbdev_op)->ldpc_dec);
> +		in_op_data = &ldpc_dec->input;
> +
> +			out_op_data = &ldpc_dec->hard_output;
> +
> +		ret = prepare_ldpc_dec_op(bbdev_op, bbdev_ipc_op,
> +					  q_priv, out_op_data);
> +		if (ret) {
> +			BBDEV_LA12XX_PMD_ERR(
> +				"process_ldpc_dec_op failed, ret: %d", ret);
> +			return ret;
> +		}
> +		break;
> +
> +	default:
> +		BBDEV_LA12XX_PMD_ERR("unsupported bbdev_ipc op type");
> +		return -1;
> +	}
> +
> +	if (in_op_data->data) {
> +		data_ptr = rte_pktmbuf_mtod(in_op_data->data, char *);
> +		l1_pcie_addr = (uint32_t)GUL_USER_HUGE_PAGE_ADDR +
> +			       data_ptr - huge_start_addr;
> +		bbdev_ipc_op->in_addr = l1_pcie_addr;
> +		bbdev_ipc_op->in_len = in_op_data->length;
> +	}
> +
> +	if (out_op_data->data) {
> +		data_ptr = rte_pktmbuf_mtod(out_op_data->data, char *);
> +		l1_pcie_addr = (uint32_t)GUL_USER_HUGE_PAGE_ADDR +
> +				data_ptr - huge_start_addr;
> +		bbdev_ipc_op->out_addr = rte_cpu_to_be_32(l1_pcie_addr);
> +		bbdev_ipc_op->out_len = rte_cpu_to_be_32(out_op_data->length);
> +	}
> +
> +	/* Move Producer Index forward */
> +	pi++;
> +	/* Flip the PI flag, if wrapping */
> +	if (unlikely(q_priv->queue_size == pi)) {
> +		pi = 0;
> +		pi_flag = pi_flag ? 0 : 1;
> +	}
> +
> +	if (pi_flag)
> +		IPC_SET_PI_FLAG(pi);
> +	else
> +		IPC_RESET_PI_FLAG(pi);
> +	/* Wait for Data Copy & pi_flag update to complete before updating pi */
> +	rte_mb();
> +	/* now update pi */
> +	md->pi = rte_cpu_to_be_32(pi);
> +	q_priv->host_pi = pi;
> +
> +	BBDEV_LA12XX_PMD_DP_DEBUG(
> +			"enter: pi: %u, ci: %u, pi_flag: %u, ci_flag: %u, ring size: %u",
> +			pi, ci, pi_flag, ci_flag, q_priv->queue_size);
> +
> +	return 0;
> +}
> +
> +/* Enqueue decode burst */
> +static uint16_t
> +enqueue_dec_ops(struct rte_bbdev_queue_data *q_data,
> +		struct rte_bbdev_dec_op **ops, uint16_t nb_ops) {
> +	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
> +	int nb_enqueued, ret;
> +
> +	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
> +		ret = enqueue_single_op(q_priv, ops[nb_enqueued]);
> +		if (ret)
> +			break;
> +	}
> +
> +	q_data->queue_stats.enqueue_err_count += nb_ops - nb_enqueued;
> +	q_data->queue_stats.enqueued_count += nb_enqueued;
> +
> +	return nb_enqueued;
> +}
> +
> +/* Enqueue encode burst */
> +static uint16_t
> +enqueue_enc_ops(struct rte_bbdev_queue_data *q_data,
> +		struct rte_bbdev_enc_op **ops, uint16_t nb_ops) {
> +	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
> +	int nb_enqueued, ret;
> +
> +	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
> +		ret = enqueue_single_op(q_priv, ops[nb_enqueued]);
> +		if (ret)
> +			break;
> +	}
> +
> +	q_data->queue_stats.enqueue_err_count += nb_ops - nb_enqueued;
> +	q_data->queue_stats.enqueued_count += nb_enqueued;
> +
> +	return nb_enqueued;
> +}
> +
> +static inline int
> +is_bd_ring_empty(uint32_t ci, uint32_t ci_flag,
> +		 uint32_t pi, uint32_t pi_flag)
> +{
> +	if (ci == pi) {
> +		if (ci_flag == pi_flag)
> +			return 1; /* No more Buffer */
> +	}
> +	return 0;
> +}
> +
> +/* Dequeue encode burst */
> +static void *
> +dequeue_single_op(struct bbdev_la12xx_q_priv *q_priv, void *dst) {
> +	struct bbdev_la12xx_private *priv = q_priv->bbdev_priv;
> +	ipc_userspace_t *ipc_priv = priv->ipc_priv;
> +	uint32_t q_id = q_priv->q_id + HOST_RX_QUEUEID_OFFSET;
> +	ipc_instance_t *ipc_instance = ipc_priv->instance;
> +	ipc_ch_t *ch = &(ipc_instance->ch_list[q_id]);
> +	uint32_t ci, ci_flag, pi, pi_flag;
> +	ipc_br_md_t *md;
> +	void *op;
> +	uint32_t temp_pi;
> +
> +	md = &(ch->md);
> +	ci = IPC_GET_CI_INDEX(q_priv->host_ci);
> +	ci_flag = IPC_GET_CI_FLAG(q_priv->host_ci);
> +
> +	temp_pi = q_priv->host_params->pi;
> +	pi = IPC_GET_PI_INDEX(temp_pi);
> +	pi_flag = IPC_GET_PI_FLAG(temp_pi);
> +
> +	if (is_bd_ring_empty(ci, ci_flag, pi, pi_flag))
> +		return NULL;
> +
> +	BBDEV_LA12XX_PMD_DP_DEBUG(
> +		"pi: %u, ci: %u, pi_flag: %u, ci_flag: %u, ring size: %u",
> +		pi, ci, pi_flag, ci_flag, q_priv->queue_size);
> +
> +	op = q_priv->bbdev_op[ci];
> +
> +	rte_memcpy(dst, q_priv->msg_ch_vaddr[ci],
> +		sizeof(struct bbdev_ipc_enqueue_op));
> +
> +	/* Move Consumer Index forward */
> +	ci++;
> +	/* Flip the CI flag, if wrapping */
> +	if (q_priv->queue_size == ci) {
> +		ci = 0;
> +		ci_flag = ci_flag ? 0 : 1;
> +	}
> +	if (ci_flag)
> +		IPC_SET_CI_FLAG(ci);
> +	else
> +		IPC_RESET_CI_FLAG(ci);
> +	md->ci = rte_cpu_to_be_32(ci);
> +	q_priv->host_ci = ci;
> +
> +	BBDEV_LA12XX_PMD_DP_DEBUG(
> +		"exit: pi: %u, ci: %u, pi_flag: %u, ci_flag: %u, ring size: %u",
> +		pi, ci, pi_flag, ci_flag, q_priv->queue_size);
> +
>
> So you don't use any of the BBDEV flags to report CRC and syndrome parity check in the response?
that will be supported in next version.
>
> +	return op;
> +}
> +
> +/* Dequeue decode burst */
> +static uint16_t
> +dequeue_dec_ops(struct rte_bbdev_queue_data *q_data,
> +		struct rte_bbdev_dec_op **ops, uint16_t nb_ops) {
> +	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
> +	struct bbdev_ipc_enqueue_op bbdev_ipc_op;
> +	int nb_dequeued;
> +
> +	for (nb_dequeued = 0; nb_dequeued < nb_ops; nb_dequeued++) {
> +		ops[nb_dequeued] = dequeue_single_op(q_priv, &bbdev_ipc_op);
> +		if (!ops[nb_dequeued])
> +			break;
> +		ops[nb_dequeued]->status = bbdev_ipc_op.status;
> +	}
> +	q_data->queue_stats.dequeued_count += nb_dequeued;
> +
> +	return nb_dequeued;
> +}
> +
> +/* Dequeue encode burst */
> +static uint16_t
> +dequeue_enc_ops(struct rte_bbdev_queue_data *q_data,
> +		struct rte_bbdev_enc_op **ops, uint16_t nb_ops) {
> +	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
> +	struct bbdev_ipc_enqueue_op bbdev_ipc_op;
> +	int nb_enqueued;
> +
> +	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
> +		ops[nb_enqueued] = dequeue_single_op(q_priv, &bbdev_ipc_op);
> +		if (!ops[nb_enqueued])
> +			break;
> +		ops[nb_enqueued]->status = bbdev_ipc_op.status;
> +	}
> +	q_data->queue_stats.enqueued_count += nb_enqueued;
> +
> +	return nb_enqueued;
> +}
> +
>   static struct hugepage_info *
>   get_hugepage_info(void)
>   {
> @@ -720,10 +1105,14 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
>   	bbdev->intr_handle = NULL;
>   
>   	/* register rx/tx burst functions for data path */
> -	bbdev->dequeue_enc_ops = NULL;
> -	bbdev->dequeue_dec_ops = NULL;
> -	bbdev->enqueue_enc_ops = NULL;
> -	bbdev->enqueue_dec_ops = NULL;
> +	bbdev->dequeue_enc_ops = dequeue_enc_ops;
> +	bbdev->dequeue_dec_ops = dequeue_dec_ops;
> +	bbdev->enqueue_enc_ops = enqueue_enc_ops;
> +	bbdev->enqueue_dec_ops = enqueue_dec_ops;
>
> These above are used for 4G operations, since the capability is not there thet can be null.
>
> +	bbdev->dequeue_ldpc_enc_ops = dequeue_enc_ops;
> +	bbdev->dequeue_ldpc_dec_ops = dequeue_dec_ops;
> +	bbdev->enqueue_ldpc_enc_ops = enqueue_enc_ops;
> +	bbdev->enqueue_ldpc_dec_ops = enqueue_dec_ops;
>   
>   	return 0;
>   }
> diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> index 9d5789f726..4e181e9254 100644
> --- a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> +++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> @@ -76,6 +76,25 @@ typedef struct {
>   	_IOWR(GUL_IPC_MAGIC, 5, struct ipc_msg *)  #define IOCTL_GUL_IPC_CHANNEL_RAISE_INTERRUPT _IOW(GUL_IPC_MAGIC, 6, int *)
>   
> +#define GUL_USER_HUGE_PAGE_OFFSET	(0)
> +#define GUL_PCI1_ADDR_BASE	(0x00000000ULL)
> +
> +#define GUL_USER_HUGE_PAGE_ADDR	(GUL_PCI1_ADDR_BASE + GUL_USER_HUGE_PAGE_OFFSET)
> +
> +/* IPC PI/CI index & flag manipulation helpers */
> +#define IPC_PI_CI_FLAG_MASK	0x80000000 /*  (1<<31) */
> +#define IPC_PI_CI_INDEX_MASK	0x7FFFFFFF /* ~(1<<31) */
> +
> +#define IPC_SET_PI_FLAG(x)	(x |= IPC_PI_CI_FLAG_MASK)
> +#define IPC_RESET_PI_FLAG(x)	(x &= IPC_PI_CI_INDEX_MASK)
> +#define IPC_GET_PI_FLAG(x)	(x >> 31)
> +#define IPC_GET_PI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
> +
> +#define IPC_SET_CI_FLAG(x)	(x |= IPC_PI_CI_FLAG_MASK)
> +#define IPC_RESET_CI_FLAG(x)	(x &= IPC_PI_CI_INDEX_MASK)
> +#define IPC_GET_CI_FLAG(x)	(x >> 31)
> +#define IPC_GET_CI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
> +
>   /** buffer ring common metadata */
>   typedef struct ipc_bd_ring_md {
>   	volatile uint32_t pi;		/**< Producer index and flag (MSB)
> @@ -173,6 +192,24 @@ struct bbdev_ipc_enqueue_op {
>   	uint32_t rsvd;
>   };
>   
> +/** Structure specifying dequeue operation (dequeue at LA1224) */
> +struct bbdev_ipc_dequeue_op {
> +	/** Input buffer memory address */
> +	uint32_t in_addr;
> +	/** Input buffer memory length */
> +	uint32_t in_len;
> +	/** Output buffer memory address */
> +	uint32_t out_addr;
> +	/** Output buffer memory length */
> +	uint32_t out_len;
> +	/* Number of code blocks. Only set when HARQ is used */
> +	uint32_t num_code_blocks;
> +	/** Dequeue Operation flags */
> +	uint32_t op_flags;
> +	/** Shared metadata between L1 and L2 */
> +	uint32_t shared_metadata;
> +};
> +
>   /* This shared memory would be on the host side which have copy of some
>    * of the parameters which are also part of Shared BD ring. Read access
>    * of these parameters from the host side would not be over PCI.
> --
> 2.17.1
>

^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v3 3/8] baseband/la12xx: add support for multiple modems
  2021-04-14  0:02       ` Chautru, Nicolas
@ 2021-04-14 12:10         ` Hemant Agrawal
  0 siblings, 0 replies; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-14 12:10 UTC (permalink / raw)
  To: Chautru, Nicolas, Hemant Agrawal, dev, gakhil; +Cc: david.marchand


On 4/14/2021 5:32 AM, Chautru, Nicolas wrote:
>> -----Original Message-----
>> From: Hemant Agrawal <hemant.agrawal@nxp.com>
>> Sent: Monday, April 12, 2021 10:17 PM
>>
>> This patch add support for multiple modems by assigning a modem id as dev
>> args in vdev creation.
>>
>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
>> ---
>>   drivers/baseband/la12xx/bbdev_la12xx.c     | 60 ++++++++++++++++++++--
>>   drivers/baseband/la12xx/bbdev_la12xx.h     | 56 ++++++++++++++++++++
>>   drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 20 ++++++++
>>   3 files changed, 131 insertions(+), 5 deletions(-)  create mode 100644
>> drivers/baseband/la12xx/bbdev_la12xx.h
>>   create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_ipc.h
>>
>> diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c
>> b/drivers/baseband/la12xx/bbdev_la12xx.c
>> index 8d3041ce28..7e9be74bb4 100644
>> --- a/drivers/baseband/la12xx/bbdev_la12xx.c
>> +++ b/drivers/baseband/la12xx/bbdev_la12xx.c
>> @@ -14,6 +14,8 @@
>>   #include <rte_bbdev_pmd.h>
>>
>>   #include <bbdev_la12xx_pmd_logs.h>
>> +#include <bbdev_la12xx_ipc.h>
>> +#include <bbdev_la12xx.h>
>>
>>   #define DRIVER_NAME baseband_la12xx
>>
>> @@ -22,18 +24,18 @@ RTE_LOG_REGISTER(bbdev_la12xx_logtype,
>> pmd.bb.la12xx, NOTICE);
>>   /*  Initialisation params structure that can be used by LA12xx BBDEV driver
>> */  struct bbdev_la12xx_params {
>>   	uint8_t queues_num; /*< LA12xx BBDEV queues number */
>> +	int8_t modem_id; /*< LA12xx modem instance id */
>>   };
>>
>>   #define BBDEV_LA12XX_MAX_NB_QUEUES_ARG  "max_nb_queues"
>> +#define BBDEV_LA12XX_VDEV_MODEM_ID_ARG	"modem"
>> +#define LA12XX_MAX_MODEM 4
> Minor : best to be consistent with prefix used throught the PMD. A bit of a mix and match.
ok
>
>>   static const char * const bbdev_la12xx_valid_params[] = {
>>   	BBDEV_LA12XX_MAX_NB_QUEUES_ARG,
>> +	BBDEV_LA12XX_VDEV_MODEM_ID_ARG,
>>   };
>>
>> -/* private data structure */
>> -struct bbdev_la12xx_private {
>> -	unsigned int max_nb_queues;  /**< Max number of queues */
>> -};
>>   static inline int
>>   parse_u16_arg(const char *key, const char *value, void *extra_args)  { @@ -
>> 52,6 +54,28 @@ parse_u16_arg(const char *key, const char *value, void
>> *extra_args)
>>   	return 0;
>>   }
>>
>> +/* Parse integer from integer argument */ static int
>> +parse_integer_arg(const char *key __rte_unused,
>> +		const char *value, void *extra_args)
>> +{
>> +	int i;
>> +	char *end;
>> +
>> +	errno = 0;
>> +
>> +	i = strtol(value, &end, 10);
>> +	if (*end != 0 || errno != 0 || i < 0 || i > LA12XX_MAX_MODEM) {
>> +		BBDEV_LA12XX_PMD_ERR("Supported Port IDS are 0 to %d",
>> +			LA12XX_MAX_MODEM - 1);
>> +		return -EINVAL;
>> +	}
>> +
>> +	*((uint32_t *)extra_args) = i;
>> +
>> +	return 0;
>> +}
>> +
>>   /* Parse parameters used to create device */  static int
>> parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params, @@ -
>> 73,6 +97,16 @@ parse_bbdev_la12xx_params(struct bbdev_la12xx_params
>> *params,
>>   		if (ret < 0)
>>   			goto exit;
>>
>> +		ret = rte_kvargs_process(kvlist,
>> +					bbdev_la12xx_valid_params[1],
>> +					&parse_integer_arg,
>> +					&params->modem_id);
>> +
>> +		if (params->modem_id >= LA12XX_MAX_MODEM) {
>> +			BBDEV_LA12XX_PMD_ERR("Invalid modem id, must
>> be < %u",
>> +					LA12XX_MAX_MODEM);
>> +			goto exit;
>> +		}
>>   	}
>>
>>   exit:
>> @@ -88,6 +122,7 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,  {
>>   	struct rte_bbdev *bbdev;
>>   	const char *name = rte_vdev_device_name(vdev);
>> +	struct bbdev_la12xx_private *priv;
>>
>>   	PMD_INIT_FUNC_TRACE();
>>
>> @@ -103,6 +138,20 @@ la12xx_bbdev_create(struct rte_vdev_device
>> *vdev,
>>   		return -ENOMEM;
>>   	}
>>
>> +	priv = bbdev->data->dev_private;
>> +	priv->modem_id = init_params->modem_id;
>> +	/* if modem id is not configured */
>> +	if (priv->modem_id == -1)
>> +		priv->modem_id = bbdev->data->dev_id;
>> +
>> +	/* Reset Global variables */
>> +	priv->num_ldpc_enc_queues = 0;
>> +	priv->num_ldpc_dec_queues = 0;
>> +	priv->num_valid_queues = 0;
>> +	priv->max_nb_queues = init_params->queues_num;
>> +
>> +	BBDEV_LA12XX_PMD_INFO("Setting Up %s: DevId=%d,
>> ModemId=%d",
>> +				name, bbdev->data->dev_id, priv-
>>> modem_id);
>>   	bbdev->dev_ops = NULL;
>>   	bbdev->device = &vdev->device;
>>   	bbdev->data->socket_id = 0;
>> @@ -174,4 +223,5 @@ static struct rte_vdev_driver bbdev_la12xx_pmd_drv
>> = {
>>
>>   RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
>> RTE_PMD_REGISTER_PARAM_STRING(DRIVER_NAME,
>> -	BBDEV_LA12XX_MAX_NB_QUEUES_ARG"=<int>");
>> +	BBDEV_LA12XX_MAX_NB_QUEUES_ARG"=<int>"
>> +	BBDEV_LA12XX_VDEV_MODEM_ID_ARG "=<int> ");
>> diff --git a/drivers/baseband/la12xx/bbdev_la12xx.h
>> b/drivers/baseband/la12xx/bbdev_la12xx.h
>> new file mode 100644
>> index 0000000000..5228502331
>> --- /dev/null
>> +++ b/drivers/baseband/la12xx/bbdev_la12xx.h
>> @@ -0,0 +1,56 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause
>> + * Copyright 2020-2021 NXP
>> + */
>> +
>> +#ifndef __BBDEV_LA12XX_H__
>> +#define __BBDEV_LA12XX_H__
>> +
>> +#define BBDEV_IPC_ENC_OP_TYPE	1
>> +#define BBDEV_IPC_DEC_OP_TYPE	2
>> +
>> +#define MAX_LDPC_ENC_FECA_QUEUES	4
>> +#define MAX_LDPC_DEC_FECA_QUEUES	4
> Minor: What does FECA refers to through the serie? FEC accerator?
>
> For consistency I would rename _ENC_OP_TYPE to _LDPC_ENC_OP_TYPE to distingish with 4G.
> Same comment as above from prefix

No, I disagree

IPC has nothing to do with LDPC. It is abstract. It can be used of LDPC, 
Polar etc.


We will add prefix as suggested.

>> +
>> +#define MAX_CHANNEL_DEPTH 16
>> +/* private data structure */
>> +struct bbdev_la12xx_private {
>> +	void *ipc_priv;
>> +	uint8_t num_valid_queues;
>> +	uint8_t max_nb_queues;
>> +	uint8_t num_ldpc_enc_queues;
>> +	uint8_t num_ldpc_dec_queues;
>> +	int8_t modem_id;
>> +	struct bbdev_la12xx_q_priv *queues_priv[32]; };
>> +
>> +struct hugepage_info {
>> +	void *vaddr;
>> +	phys_addr_t paddr;
>> +	size_t len;
>> +};
> This should be in the next commit I believe.
> Notably as this hugepage_info usage is a bit odd.
Ya, we need to do some manual work w.r.t phy to virt conversions etc. So 
this is needed.
>
>> +
>> +struct bbdev_la12xx_q_priv {
>> +	struct bbdev_la12xx_private *bbdev_priv;
>> +	uint32_t q_id;	/**< Channel ID */
>> +	uint32_t feca_blk_id;	/** FECA block ID for processing */
>> +	uint32_t feca_blk_id_be32; /**< FECA Block ID for this queue */
>> +	uint8_t en_napi; /* 0: napi disabled, 1: napi enabled */
>> +	uint16_t queue_size;	/**< Queue depth */
>> +	int32_t eventfd;	/**< Event FD value */
>> +	enum rte_bbdev_op_type op_type; /**< Operation type */
>> +	uint32_t la12xx_core_id;
>> +		/* LA12xx core ID on which this will be scheduled */
>> +	struct rte_mempool *mp; /**< Pool from where buffers would be
>> cut */
>> +	void *bbdev_op[MAX_CHANNEL_DEPTH];
>> +			/**< Stores bbdev op for each index */
>> +	void *msg_ch_vaddr[MAX_CHANNEL_DEPTH];
>> +			/**< Stores msg channel addr for modem->host */
>> +	uint32_t host_pi;	/**< Producer_Index for HOST->MODEM */
>> +	uint32_t host_ci;	/**< Consumer Index for MODEM->HOST */
>> +	host_ipc_params_t *host_params; /**< Host parameters */ };
>> +
>> +#define lower_32_bits(x) ((uint32_t)((uint64_t)x)) #define
>> +upper_32_bits(x) ((uint32_t)(((uint64_t)(x) >> 16) >> 16))
>> +
>> +#endif
>> diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
>> b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
>> new file mode 100644
>> index 0000000000..9aa5562981
>> --- /dev/null
>> +++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
>> @@ -0,0 +1,20 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause
>> + * Copyright 2020-2021 NXP
>> + */
>> +#ifndef __BBDEV_LA12XX_IPC_H__
>> +#define __BBDEV_LA12XX_IPC_H__
>> +
>> +/** No. of max channel per instance */
>> +#define IPC_MAX_DEPTH	(16)
>> +
>> +/* This shared memory would be on the host side which have copy of some
>> + * of the parameters which are also part of Shared BD ring. Read access
>> + * of these parameters from the host side would not be over PCI.
>> + */
>> +typedef struct host_ipc_params {
>> +	volatile uint32_t pi;
>> +	volatile uint32_t ci;
>> +	volatile uint32_t modem_ptr[IPC_MAX_DEPTH]; } __rte_packed
>> +host_ipc_params_t;
>> +
>> +#endif
>> --
>> 2.17.1

^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v3 7/8] app/bbdev: add parameter to take input in network order
  2021-04-14  1:00       ` Chautru, Nicolas
@ 2021-04-14 12:15         ` Nipun Gupta
  0 siblings, 0 replies; 157+ messages in thread
From: Nipun Gupta @ 2021-04-14 12:15 UTC (permalink / raw)
  To: Chautru, Nicolas, Hemant Agrawal, dev, gakhil; +Cc: david.marchand



> -----Original Message-----
> From: Chautru, Nicolas <nicolas.chautru@intel.com>
> Sent: Wednesday, April 14, 2021 6:30 AM
> To: Hemant Agrawal <hemant.agrawal@nxp.com>; dev@dpdk.org;
> gakhil@marvell.com
> Cc: david.marchand@redhat.com; Nipun Gupta <nipun.gupta@nxp.com>
> Subject: RE: [PATCH v3 7/8] app/bbdev: add parameter to take input in network
> order
> 
> If you want this, should this be a new BBDEV capability option?
> If not how can you enforce compatibility if you just bypass this in the test vector
> parsing?

Agree, we can add BBDEV capability option.

> 
> > -----Original Message-----
> > From: Hemant Agrawal <hemant.agrawal@nxp.com>
> > Sent: Monday, April 12, 2021 10:17 PM
> > To: dev@dpdk.org; gakhil@marvell.com; Chautru, Nicolas
> > <nicolas.chautru@intel.com>
> > Cc: david.marchand@redhat.com; Nipun Gupta <nipun.gupta@nxp.com>
> > Subject: [PATCH v3 7/8] app/bbdev: add parameter to take input in network
> > order
> >
> > From: Nipun Gupta <nipun.gupta@nxp.com>
> >
> > Test bbdev application is reading the input and output from the test vector
> > files in the same endianness which is of the system.
> > This patch adds an option to provide data in the network order i.e. big
> > endian format
> >
> > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > ---
> >  app/test-bbdev/test_bbdev_vector.c | 18 ++++++++++++++++--  app/test-
> > bbdev/test_bbdev_vector.h |  2 ++
> >  2 files changed, 18 insertions(+), 2 deletions(-)
> >
> > diff --git a/app/test-bbdev/test_bbdev_vector.c b/app/test-
> > bbdev/test_bbdev_vector.c
> > index 50d1da00f7..fe04bd6b95 100644
> > --- a/app/test-bbdev/test_bbdev_vector.c
> > +++ b/app/test-bbdev/test_bbdev_vector.c
> > @@ -53,7 +53,8 @@ starts_with(const char *str, const char *pre)
> >
> >  /* tokenization test values separated by a comma */  static int -
> > parse_values(char *tokens, uint32_t **data, uint32_t *data_length)
> > +parse_values(char *tokens, uint32_t **data, uint32_t *data_length,
> > +	     int network_order)
> >  {
> >  	uint32_t n_tokens = 0;
> >  	uint32_t data_size = 32;
> > @@ -94,6 +95,14 @@ parse_values(char *tokens, uint32_t **data, uint32_t
> > *data_length)
> >  		}
> >
> >  		*data_length = *data_length + (strlen(tok) - strlen("0x"))/2;
> > +		if (network_order) {
> > +			if ((strlen(tok) - strlen("0x"))/2 == 4)
> > +				values[n_tokens] =
> > +					rte_cpu_to_be_32(values[n_tokens]);
> > +			else if ((strlen(tok) - strlen("0x"))/2 == 2)
> > +				values[n_tokens] =
> > +					rte_cpu_to_be_16(values[n_tokens]);
> > +		}
> >
> >  		tok = strtok(NULL, VALUE_DELIMITER);
> >  		if (tok == NULL)
> > @@ -416,7 +425,8 @@ parse_data_entry(const char *key_token, char
> > *token,
> >  	/* Clear new op data struct */
> >  	memset(op_data + *nb_ops, 0, sizeof(struct op_data_buf));
> >
> > -	ret = parse_values(token, &data, &data_length);
> > +	ret = parse_values(token, &data, &data_length,
> > +			vector->network_order);
> >  	if (!ret) {
> >  		op_data[*nb_ops].addr = data;
> >  		op_data[*nb_ops].length = data_length; @@ -728,6 +738,10
> > @@ parse_ldpc_encoder_params(const char *key_token, char *token,
> >  		ret = parse_expected_status(token, &status, vector-
> > >op_type);
> >  		if (!ret)
> >  			vector->expected_status = status;
> > +	} else if (!strcmp(key_token, "network_order")) {
> > +		vector->mask |= TEST_BBDEV_VF_NETWORK_ORDER;
> > +		vector->network_order = (uint8_t) strtoul(token, &err, 0);
> > +		ret = ((err == NULL) || (*err != '\0')) ? -1 : 0;
> >  	} else {
> >  		printf("Not valid ldpc enc key: '%s'\n", key_token);
> >  		return -1;
> > diff --git a/app/test-bbdev/test_bbdev_vector.h b/app/test-
> > bbdev/test_bbdev_vector.h
> > index 4e5dbf5d50..aa53f0bb0d 100644
> > --- a/app/test-bbdev/test_bbdev_vector.h
> > +++ b/app/test-bbdev/test_bbdev_vector.h
> > @@ -35,6 +35,7 @@ enum {
> >  	TEST_BBDEV_VF_CODE_BLOCK_MODE = (1ULL << 23),
> >  	TEST_BBDEV_VF_OP_FLAGS = (1ULL << 24),
> >  	TEST_BBDEV_VF_EXPECTED_STATUS = (1ULL << 25),
> > +	TEST_BBDEV_VF_NETWORK_ORDER = (1ULL << 26),
> >  };
> >
> >  enum op_data_type {
> > @@ -60,6 +61,7 @@ struct test_bbdev_vector {
> >  	enum rte_bbdev_op_type op_type;
> >  	int expected_status;
> >  	int mask;
> > +	int network_order;
> >  	union {
> >  		struct rte_bbdev_op_turbo_dec turbo_dec;
> >  		struct rte_bbdev_op_turbo_enc turbo_enc;
> > --
> > 2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v3 8/8] app/bbdev: add test vectors for transport blocks
  2021-04-14  1:09       ` Chautru, Nicolas
@ 2021-04-14 12:16         ` Nipun Gupta
  2021-04-14 15:48           ` Chautru, Nicolas
  0 siblings, 1 reply; 157+ messages in thread
From: Nipun Gupta @ 2021-04-14 12:16 UTC (permalink / raw)
  To: Chautru, Nicolas, Hemant Agrawal, dev, gakhil; +Cc: david.marchand

Hi,

Apart from network order, these test vectors also add Transport Block modes.
SO these seems legitimate to be added to the test cases.

Regards,
Nipun

> -----Original Message-----
> From: Chautru, Nicolas <nicolas.chautru@intel.com>
> Sent: Wednesday, April 14, 2021 6:40 AM
> To: Hemant Agrawal <hemant.agrawal@nxp.com>; dev@dpdk.org;
> gakhil@marvell.com
> Cc: david.marchand@redhat.com; Nipun Gupta <nipun.gupta@nxp.com>
> Subject: RE: [PATCH v3 8/8] app/bbdev: add test vectors for transport blocks
> 
> 
> > -----Original Message-----
> > From: Hemant Agrawal <hemant.agrawal@nxp.com>
> > Sent: Monday, April 12, 2021 10:17 PM
> >
> > From: Nipun Gupta <nipun.gupta@nxp.com>
> >
> > This patch adds two test vectors for transport block in network byte
> > order:
> > - LDPC encode for Transport Block
> > - LDPC decode for Transport block
> >
> > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > ---
> >  app/test-bbdev/test_vectors/ldpc_dec_tb.data | 362 ++++++++++++++
> >  app/test-bbdev/test_vectors/ldpc_enc_tb.data | 482
> > +++++++++++++++++++
> >  2 files changed, 844 insertions(+)
> >  create mode 100644 app/test-bbdev/test_vectors/ldpc_dec_tb.data
> >  create mode 100644 app/test-bbdev/test_vectors/ldpc_enc_tb.data
> 
> 
> Do we get anything new from these additional vectors?
> How does this help to change the network order in vector then change it again
> when it is parsed? This is the same data going into bbdev api.
> Also these vectors would be quite big (relatively large C).
> Ideally you want all existing vectors matching your PMD capability to be run
> seamlessly.
> Let me know what I may miss, this looks unrequired.
> 
> (...)
> 
> > --
> > 2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v3 8/8] app/bbdev: add test vectors for transport blocks
  2021-04-14 12:16         ` Nipun Gupta
@ 2021-04-14 15:48           ` Chautru, Nicolas
  0 siblings, 0 replies; 157+ messages in thread
From: Chautru, Nicolas @ 2021-04-14 15:48 UTC (permalink / raw)
  To: Nipun Gupta, Hemant Agrawal, dev, gakhil; +Cc: david.marchand


> -----Original Message-----
> From: Nipun Gupta <nipun.gupta@nxp.com>
> Sent: Wednesday, April 14, 2021 5:16 AM
> 
> Hi,
> 
> Apart from network order, these test vectors also add Transport Block
> modes.
> SO these seems legitimate to be added to the test cases.
> 

Hi

In other commit response you are saying you would look into adding this into a capability. In that case the network order should not be relevant in the actual test vector, purely a matter of processing the data differently in the related test component based on the PMD capability.
If you want to add a couple of new vectors, please reduce the size (C ~ 3 for instance) as Thomas was mindful to limit the size of these. 

Talking about capability I did not see the LDPC decoder LLR representation exposed. More generally are the current unit test able to pass with your PMD on your HW? 

> Regards,
> Nipun
> 
> > -----Original Message-----
> > From: Chautru, Nicolas <nicolas.chautru@intel.com>
> > Sent: Wednesday, April 14, 2021 6:40 AM
> > To: Hemant Agrawal <hemant.agrawal@nxp.com>; dev@dpdk.org;
> > gakhil@marvell.com
> > Cc: david.marchand@redhat.com; Nipun Gupta <nipun.gupta@nxp.com>
> > Subject: RE: [PATCH v3 8/8] app/bbdev: add test vectors for transport
> > blocks
> >
> >
> > > -----Original Message-----
> > > From: Hemant Agrawal <hemant.agrawal@nxp.com>
> > > Sent: Monday, April 12, 2021 10:17 PM
> > >
> > > From: Nipun Gupta <nipun.gupta@nxp.com>
> > >
> > > This patch adds two test vectors for transport block in network byte
> > > order:
> > > - LDPC encode for Transport Block
> > > - LDPC decode for Transport block
> > >
> > > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > > ---
> > >  app/test-bbdev/test_vectors/ldpc_dec_tb.data | 362 ++++++++++++++
> > > app/test-bbdev/test_vectors/ldpc_enc_tb.data | 482
> > > +++++++++++++++++++
> > >  2 files changed, 844 insertions(+)
> > >  create mode 100644 app/test-bbdev/test_vectors/ldpc_dec_tb.data
> > >  create mode 100644 app/test-bbdev/test_vectors/ldpc_enc_tb.data
> >
> >
> > Do we get anything new from these additional vectors?
> > How does this help to change the network order in vector then change
> > it again when it is parsed? This is the same data going into bbdev api.
> > Also these vectors would be quite big (relatively large C).
> > Ideally you want all existing vectors matching your PMD capability to
> > be run seamlessly.
> > Let me know what I may miss, this looks unrequired.
> >
> > (...)
> >
> > > --
> > > 2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v4 0/8] baseband: add NXP LA12xx driver
  2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 1/8] baseband: introduce " Hemant Agrawal
@ 2021-04-24 10:36       ` Hemant Agrawal
  2021-04-24 10:36         ` [dpdk-dev] [PATCH v4 1/8] bbdev: add network order data capability Hemant Agrawal
                           ` (8 more replies)
  0 siblings, 9 replies; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-24 10:36 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, Hemant Agrawal

This series introduces the BBDEV LA12xx poll mode driver (PMD) to support
an implementation for offloading High Phy processing functions like
LDPC Encode / Decode 5GNR wireless acceleration function, using PCI based
LA12xx Software defined radio.

Please check the documentation patch for more info.

The driver currently implements basic feature to offload only the 5G LDPC
encode/decode.

A new capability has been added to check if the driver can support the
input data in network byte order. Two test vectors are also added as an
example with input data in network byte.

v2: add test case changes
v3: fix 32 bit compilation
v4: capability for network byte order, doc patch merged inline. 

Hemant Agrawal (7):
  bbdev: add network order data capability
  baseband: introduce NXP LA12xx driver
  baseband/la12xx: add devargs for max queues
  baseband/la12xx: add support for multiple modems
  baseband/la12xx: add queue and modem config support
  baseband/la12xx: add enqueue and dequeue support
  app/bbdev: enable la12xx for bbdev

Nipun Gupta (1):
  app/bbdev: add test vectors for transport blocks

 app/test-bbdev/meson.build                    |    3 +
 app/test-bbdev/test_vectors/ldpc_dec_tb.data  |  122 ++
 app/test-bbdev/test_vectors/ldpc_enc_tb.data  |   60 +
 doc/guides/bbdevs/features/default.ini        |    1 +
 doc/guides/bbdevs/features/la12xx.ini         |   14 +
 doc/guides/bbdevs/index.rst                   |    1 +
 doc/guides/bbdevs/la12xx.rst                  |  127 ++
 doc/guides/prog_guide/bbdev.rst               |    6 +
 doc/guides/rel_notes/release_21_05.rst        |    5 +
 drivers/baseband/la12xx/bbdev_la12xx.c        | 1099 +++++++++++++++++
 drivers/baseband/la12xx/bbdev_la12xx.h        |   51 +
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h    |  244 ++++
 .../baseband/la12xx/bbdev_la12xx_pmd_logs.h   |   26 +
 drivers/baseband/la12xx/meson.build           |    6 +
 drivers/baseband/la12xx/version.map           |    3 +
 drivers/baseband/meson.build                  |    1 +
 lib/bbdev/rte_bbdev_op.h                      |    8 +-
 17 files changed, 1775 insertions(+), 2 deletions(-)
 create mode 100644 app/test-bbdev/test_vectors/ldpc_dec_tb.data
 create mode 100644 app/test-bbdev/test_vectors/ldpc_enc_tb.data
 create mode 100644 doc/guides/bbdevs/features/la12xx.ini
 create mode 100644 doc/guides/bbdevs/la12xx.rst
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.c
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_ipc.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
 create mode 100644 drivers/baseband/la12xx/meson.build
 create mode 100644 drivers/baseband/la12xx/version.map

-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v4 1/8] bbdev: add network order data capability
  2021-04-24 10:36       ` [dpdk-dev] [PATCH v4 0/8] baseband: add " Hemant Agrawal
@ 2021-04-24 10:36         ` Hemant Agrawal
  2021-04-24 21:59           ` Chautru, Nicolas
  2021-04-26 17:01           ` Dave Burley
  2021-04-24 10:36         ` [dpdk-dev] [PATCH v4 2/8] baseband: introduce NXP LA12xx driver Hemant Agrawal
                           ` (7 subsequent siblings)
  8 siblings, 2 replies; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-24 10:36 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, Hemant Agrawal

This patch intoduces a new capability of the bbdev device
to process the LDPC data in network byte order.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 doc/guides/bbdevs/features/default.ini | 1 +
 doc/guides/prog_guide/bbdev.rst        | 6 ++++++
 lib/bbdev/rte_bbdev_op.h               | 8 ++++++--
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/doc/guides/bbdevs/features/default.ini b/doc/guides/bbdevs/features/default.ini
index 5fe267a625..e5da644099 100644
--- a/doc/guides/bbdevs/features/default.ini
+++ b/doc/guides/bbdevs/features/default.ini
@@ -14,3 +14,4 @@ LLR/HARQ Compression   =
 External DDR Access    =
 HW Accelerated         =
 BBDEV API              =
+Network Order Data     =
diff --git a/doc/guides/prog_guide/bbdev.rst b/doc/guides/prog_guide/bbdev.rst
index 6b2bd54e1a..89a86d10fb 100644
--- a/doc/guides/prog_guide/bbdev.rst
+++ b/doc/guides/prog_guide/bbdev.rst
@@ -747,6 +747,9 @@ given below.
 |RTE_BBDEV_LDPC_ENC_CONCATENATION                                    |
 | Set if a device supports concatenation of non byte aligned output  |
 +--------------------------------------------------------------------+
+|RTE_BBDEV_LDPC_ENC_NETWORK_ORDER                                    |
+| Set if a device supports network order data processing             |
++--------------------------------------------------------------------+
 
 The structure passed for each LDPC encode operation is given below,
 with the operation flags forming a bitmask in the ``op_flags`` field.
@@ -942,6 +945,9 @@ given below.
 |RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_LOOPBACK                        |
 | Set if a device supports loopback access to HARQ internal memory   |
 +--------------------------------------------------------------------+
+|RTE_BBDEV_LDPC_DEC_NETWORK_ORDER                                    |
+| Set if a device supports network order data processing             |
++--------------------------------------------------------------------+
 
 The structure passed for each LDPC decode operation is given below,
 with the operation flags forming a bitmask in the ``op_flags`` field.
diff --git a/lib/bbdev/rte_bbdev_op.h b/lib/bbdev/rte_bbdev_op.h
index f946842727..8fab617768 100644
--- a/lib/bbdev/rte_bbdev_op.h
+++ b/lib/bbdev/rte_bbdev_op.h
@@ -186,7 +186,9 @@ enum rte_bbdev_op_ldpcdec_flag_bitmasks {
 	 *  for HARQ memory. If not set, it is assumed the filler bits are not
 	 *  in HARQ memory and handled directly by the LDPC decoder.
 	 */
-	RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS = (1ULL << 18)
+	RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS = (1ULL << 18),
+	/** Set if a device supports network order data processing */
+	RTE_BBDEV_LDPC_DEC_NETWORK_ORDER = (1ULL << 19)
 };
 
 /** Flags for LDPC encoder operation and capability structure */
@@ -206,7 +208,9 @@ enum rte_bbdev_op_ldpcenc_flag_bitmasks {
 	/** Set if a device supports scatter-gather functionality. */
 	RTE_BBDEV_LDPC_ENC_SCATTER_GATHER = (1ULL << 6),
 	/** Set if a device supports concatenation of non byte aligned output */
-	RTE_BBDEV_LDPC_ENC_CONCATENATION = (1ULL << 7)
+	RTE_BBDEV_LDPC_ENC_CONCATENATION = (1ULL << 7),
+	/** Set if a device supports network order data processing */
+	RTE_BBDEV_LDPC_ENC_NETWORK_ORDER = (1ULL << 8)
 };
 
 /** Flags for the Code Block/Transport block mode  */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v4 2/8] baseband: introduce NXP LA12xx driver
  2021-04-24 10:36       ` [dpdk-dev] [PATCH v4 0/8] baseband: add " Hemant Agrawal
  2021-04-24 10:36         ` [dpdk-dev] [PATCH v4 1/8] bbdev: add network order data capability Hemant Agrawal
@ 2021-04-24 10:36         ` Hemant Agrawal
  2021-04-24 10:36         ` [dpdk-dev] [PATCH v4 3/8] baseband/la12xx: add devargs for max queues Hemant Agrawal
                           ` (6 subsequent siblings)
  8 siblings, 0 replies; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-24 10:36 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, Hemant Agrawal, Nipun Gupta

This patch introduce the baseband device drivers for NXP's
LA1200 series software defined baseband modem.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c        | 109 ++++++++++++++++++
 .../baseband/la12xx/bbdev_la12xx_pmd_logs.h   |  26 +++++
 drivers/baseband/la12xx/meson.build           |   6 +
 drivers/baseband/la12xx/version.map           |   3 +
 drivers/baseband/meson.build                  |   1 +
 5 files changed, 145 insertions(+)
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.c
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
 create mode 100644 drivers/baseband/la12xx/meson.build
 create mode 100644 drivers/baseband/la12xx/version.map

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
new file mode 100644
index 0000000000..7050b17728
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -0,0 +1,109 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+
+#include <string.h>
+
+#include <rte_common.h>
+#include <rte_bus_vdev.h>
+#include <rte_malloc.h>
+#include <rte_ring.h>
+#include <rte_kvargs.h>
+
+#include <rte_bbdev.h>
+#include <rte_bbdev_pmd.h>
+
+#include <bbdev_la12xx_pmd_logs.h>
+
+#define DRIVER_NAME baseband_la12xx
+
+RTE_LOG_REGISTER(bbdev_la12xx_logtype, pmd.bb.la12xx, NOTICE);
+
+/* private data structure */
+struct bbdev_la12xx_private {
+	unsigned int max_nb_queues;  /**< Max number of queues */
+};
+/* Create device */
+static int
+la12xx_bbdev_create(struct rte_vdev_device *vdev)
+{
+	struct rte_bbdev *bbdev;
+	const char *name = rte_vdev_device_name(vdev);
+
+	PMD_INIT_FUNC_TRACE();
+
+	bbdev = rte_bbdev_allocate(name);
+	if (bbdev == NULL)
+		return -ENODEV;
+
+	bbdev->data->dev_private = rte_zmalloc(name,
+			sizeof(struct bbdev_la12xx_private),
+			RTE_CACHE_LINE_SIZE);
+	if (bbdev->data->dev_private == NULL) {
+		rte_bbdev_release(bbdev);
+		return -ENOMEM;
+	}
+
+	bbdev->dev_ops = NULL;
+	bbdev->device = &vdev->device;
+	bbdev->data->socket_id = 0;
+	bbdev->intr_handle = NULL;
+
+	/* register rx/tx burst functions for data path */
+	bbdev->dequeue_enc_ops = NULL;
+	bbdev->dequeue_dec_ops = NULL;
+	bbdev->enqueue_enc_ops = NULL;
+	bbdev->enqueue_dec_ops = NULL;
+
+	return 0;
+}
+
+/* Initialise device */
+static int
+la12xx_bbdev_probe(struct rte_vdev_device *vdev)
+{
+	const char *name;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (vdev == NULL)
+		return -EINVAL;
+
+	name = rte_vdev_device_name(vdev);
+	if (name == NULL)
+		return -EINVAL;
+
+	return la12xx_bbdev_create(vdev);
+}
+
+/* Uninitialise device */
+static int
+la12xx_bbdev_remove(struct rte_vdev_device *vdev)
+{
+	struct rte_bbdev *bbdev;
+	const char *name;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (vdev == NULL)
+		return -EINVAL;
+
+	name = rte_vdev_device_name(vdev);
+	if (name == NULL)
+		return -EINVAL;
+
+	bbdev = rte_bbdev_get_named_dev(name);
+	if (bbdev == NULL)
+		return -EINVAL;
+
+	rte_free(bbdev->data->dev_private);
+
+	return rte_bbdev_release(bbdev);
+}
+
+static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
+	.probe = la12xx_bbdev_probe,
+	.remove = la12xx_bbdev_remove
+};
+
+RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h b/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
new file mode 100644
index 0000000000..9dfa1cc458
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020 NXP
+ */
+
+#ifndef _BBDEV_LA12XX_PMD_LOGS_H_
+#define _BBDEV_LA12XX_PMD_LOGS_H_
+
+#define rte_bbdev_log(level, fmt, ...) \
+	rte_log(RTE_LOG_ ## level, bbdev_la12xx_logtype, fmt "\n", \
+		##__VA_ARGS__)
+
+#ifdef RTE_LIBRTE_BBDEV_DEBUG
+#define rte_bbdev_log_debug(fmt, ...) \
+		rte_bbdev_log(DEBUG, "la12xx_pmd: " fmt, \
+		##__VA_ARGS__)
+#else
+#define rte_bbdev_log_debug(fmt, ...)
+#endif
+
+#define PMD_INIT_FUNC_TRACE() rte_bbdev_log_debug(">>")
+
+/* DP Logs, toggled out at compile time if level lower than current level */
+#define rte_bbdev_dp_log(level, fmt, args...) \
+	RTE_LOG_DP(level, PMD, fmt, ## args)
+
+#endif /* _BBDEV_LA12XX_PMD_LOGS_H_ */
diff --git a/drivers/baseband/la12xx/meson.build b/drivers/baseband/la12xx/meson.build
new file mode 100644
index 0000000000..7a017dcffa
--- /dev/null
+++ b/drivers/baseband/la12xx/meson.build
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020-2021 NXP
+
+deps += ['bbdev', 'bus_vdev', 'ring']
+
+sources = files('bbdev_la12xx.c')
diff --git a/drivers/baseband/la12xx/version.map b/drivers/baseband/la12xx/version.map
new file mode 100644
index 0000000000..4a76d1d52d
--- /dev/null
+++ b/drivers/baseband/la12xx/version.map
@@ -0,0 +1,3 @@
+DPDK_21 {
+	local: *;
+};
diff --git a/drivers/baseband/meson.build b/drivers/baseband/meson.build
index c98ebd9024..fbc9c7e9ab 100644
--- a/drivers/baseband/meson.build
+++ b/drivers/baseband/meson.build
@@ -11,4 +11,5 @@ drivers = [
         'fpga_lte_fec',
         'null',
         'turbo_sw',
+        'la12xx',
 ]
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v4 3/8] baseband/la12xx: add devargs for max queues
  2021-04-24 10:36       ` [dpdk-dev] [PATCH v4 0/8] baseband: add " Hemant Agrawal
  2021-04-24 10:36         ` [dpdk-dev] [PATCH v4 1/8] bbdev: add network order data capability Hemant Agrawal
  2021-04-24 10:36         ` [dpdk-dev] [PATCH v4 2/8] baseband: introduce NXP LA12xx driver Hemant Agrawal
@ 2021-04-24 10:36         ` Hemant Agrawal
  2021-04-24 10:36         ` [dpdk-dev] [PATCH v4 4/8] baseband/la12xx: add support for multiple modems Hemant Agrawal
                           ` (5 subsequent siblings)
  8 siblings, 0 replies; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-24 10:36 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, Hemant Agrawal, Nipun Gupta

This patch adds dev args to take  max queues as input

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c | 72 +++++++++++++++++++++++++-
 1 file changed, 70 insertions(+), 2 deletions(-)

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 7050b17728..8886b35429 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -19,13 +19,72 @@
 
 RTE_LOG_REGISTER(bbdev_la12xx_logtype, pmd.bb.la12xx, NOTICE);
 
+/*  Initialisation params structure that can be used by LA12xx BBDEV driver */
+struct bbdev_la12xx_params {
+	uint8_t queues_num; /*< LA12xx BBDEV queues number */
+};
+
+#define LA12XX_MAX_NB_QUEUES_ARG	"max_nb_queues"
+
+static const char * const bbdev_la12xx_valid_params[] = {
+	LA12XX_MAX_NB_QUEUES_ARG,
+};
+
 /* private data structure */
 struct bbdev_la12xx_private {
 	unsigned int max_nb_queues;  /**< Max number of queues */
 };
+static inline int
+parse_u16_arg(const char *key, const char *value, void *extra_args)
+{
+	uint16_t *u16 = extra_args;
+
+	unsigned int long result;
+	if ((value == NULL) || (extra_args == NULL))
+		return -EINVAL;
+	errno = 0;
+	result = strtoul(value, NULL, 0);
+	if ((result >= (1 << 16)) || (errno != 0)) {
+		rte_bbdev_log(ERR, "Invalid value %lu for %s", result, key);
+		return -ERANGE;
+	}
+	*u16 = (uint16_t)result;
+	return 0;
+}
+
+/* Parse parameters used to create device */
+static int
+parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
+		const char *input_args)
+{
+	struct rte_kvargs *kvlist = NULL;
+	int ret = 0;
+
+	if (params == NULL)
+		return -EINVAL;
+	if (input_args) {
+		kvlist = rte_kvargs_parse(input_args,
+				bbdev_la12xx_valid_params);
+		if (kvlist == NULL)
+			return -EFAULT;
+
+		ret = rte_kvargs_process(kvlist, bbdev_la12xx_valid_params[0],
+					&parse_u16_arg, &params->queues_num);
+		if (ret < 0)
+			goto exit;
+
+	}
+
+exit:
+	if (kvlist)
+		rte_kvargs_free(kvlist);
+	return ret;
+}
+
 /* Create device */
 static int
-la12xx_bbdev_create(struct rte_vdev_device *vdev)
+la12xx_bbdev_create(struct rte_vdev_device *vdev,
+		struct bbdev_la12xx_params *init_params __rte_unused)
 {
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
@@ -62,7 +121,11 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev)
 static int
 la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 {
+	struct bbdev_la12xx_params init_params = {
+		8
+	};
 	const char *name;
+	const char *input_args;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -73,7 +136,10 @@ la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 	if (name == NULL)
 		return -EINVAL;
 
-	return la12xx_bbdev_create(vdev);
+	input_args = rte_vdev_device_args(vdev);
+	parse_bbdev_la12xx_params(&init_params, input_args);
+
+	return la12xx_bbdev_create(vdev, &init_params);
 }
 
 /* Uninitialise device */
@@ -107,3 +173,5 @@ static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
 };
 
 RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
+RTE_PMD_REGISTER_PARAM_STRING(DRIVER_NAME,
+	LA12XX_MAX_NB_QUEUES_ARG"=<int>");
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v4 4/8] baseband/la12xx: add support for multiple modems
  2021-04-24 10:36       ` [dpdk-dev] [PATCH v4 0/8] baseband: add " Hemant Agrawal
                           ` (2 preceding siblings ...)
  2021-04-24 10:36         ` [dpdk-dev] [PATCH v4 3/8] baseband/la12xx: add devargs for max queues Hemant Agrawal
@ 2021-04-24 10:36         ` Hemant Agrawal
  2021-04-24 10:36         ` [dpdk-dev] [PATCH v4 5/8] baseband/la12xx: add queue and modem config support Hemant Agrawal
                           ` (4 subsequent siblings)
  8 siblings, 0 replies; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-24 10:36 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, Hemant Agrawal

This patch add support for multiple modems by assigning
a modem id as dev args in vdev creation.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c     | 64 +++++++++++++++++++---
 drivers/baseband/la12xx/bbdev_la12xx.h     | 56 +++++++++++++++++++
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 20 +++++++
 3 files changed, 133 insertions(+), 7 deletions(-)
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_ipc.h

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 8886b35429..f26f3f2a08 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -14,6 +14,8 @@
 #include <rte_bbdev_pmd.h>
 
 #include <bbdev_la12xx_pmd_logs.h>
+#include <bbdev_la12xx_ipc.h>
+#include <bbdev_la12xx.h>
 
 #define DRIVER_NAME baseband_la12xx
 
@@ -22,18 +24,18 @@ RTE_LOG_REGISTER(bbdev_la12xx_logtype, pmd.bb.la12xx, NOTICE);
 /*  Initialisation params structure that can be used by LA12xx BBDEV driver */
 struct bbdev_la12xx_params {
 	uint8_t queues_num; /*< LA12xx BBDEV queues number */
+	int8_t modem_id; /*< LA12xx modem instance id */
 };
 
 #define LA12XX_MAX_NB_QUEUES_ARG	"max_nb_queues"
+#define LA12XX_VDEV_MODEM_ID_ARG	"modem"
+#define LA12XX_MAX_MODEM 4
 
 static const char * const bbdev_la12xx_valid_params[] = {
 	LA12XX_MAX_NB_QUEUES_ARG,
+	LA12XX_VDEV_MODEM_ID_ARG,
 };
 
-/* private data structure */
-struct bbdev_la12xx_private {
-	unsigned int max_nb_queues;  /**< Max number of queues */
-};
 static inline int
 parse_u16_arg(const char *key, const char *value, void *extra_args)
 {
@@ -52,6 +54,28 @@ parse_u16_arg(const char *key, const char *value, void *extra_args)
 	return 0;
 }
 
+/* Parse integer from integer argument */
+static int
+parse_integer_arg(const char *key __rte_unused,
+		const char *value, void *extra_args)
+{
+	int i;
+	char *end;
+
+	errno = 0;
+
+	i = strtol(value, &end, 10);
+	if (*end != 0 || errno != 0 || i < 0 || i > LA12XX_MAX_MODEM) {
+		rte_bbdev_log(ERR, "Supported Port IDS are 0 to %d",
+			LA12XX_MAX_MODEM - 1);
+		return -EINVAL;
+	}
+
+	*((uint32_t *)extra_args) = i;
+
+	return 0;
+}
+
 /* Parse parameters used to create device */
 static int
 parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
@@ -73,6 +97,16 @@ parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
 		if (ret < 0)
 			goto exit;
 
+		ret = rte_kvargs_process(kvlist,
+					bbdev_la12xx_valid_params[1],
+					&parse_integer_arg,
+					&params->modem_id);
+
+		if (params->modem_id >= LA12XX_MAX_MODEM) {
+			rte_bbdev_log(ERR, "Invalid modem id, must be < %u",
+					LA12XX_MAX_MODEM);
+			goto exit;
+		}
 	}
 
 exit:
@@ -84,10 +118,11 @@ parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
 /* Create device */
 static int
 la12xx_bbdev_create(struct rte_vdev_device *vdev,
-		struct bbdev_la12xx_params *init_params __rte_unused)
+		struct bbdev_la12xx_params *init_params)
 {
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
+	struct bbdev_la12xx_private *priv;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -103,6 +138,20 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 		return -ENOMEM;
 	}
 
+	priv = bbdev->data->dev_private;
+	priv->modem_id = init_params->modem_id;
+	/* if modem id is not configured */
+	if (priv->modem_id == -1)
+		priv->modem_id = bbdev->data->dev_id;
+
+	/* Reset Global variables */
+	priv->num_ldpc_enc_queues = 0;
+	priv->num_ldpc_dec_queues = 0;
+	priv->num_valid_queues = 0;
+	priv->max_nb_queues = init_params->queues_num;
+
+	rte_bbdev_log(INFO, "Setting Up %s: DevId=%d, ModemId=%d",
+				name, bbdev->data->dev_id, priv->modem_id);
 	bbdev->dev_ops = NULL;
 	bbdev->device = &vdev->device;
 	bbdev->data->socket_id = 0;
@@ -122,7 +171,7 @@ static int
 la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 {
 	struct bbdev_la12xx_params init_params = {
-		8
+		8, -1,
 	};
 	const char *name;
 	const char *input_args;
@@ -174,4 +223,5 @@ static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
 
 RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
 RTE_PMD_REGISTER_PARAM_STRING(DRIVER_NAME,
-	LA12XX_MAX_NB_QUEUES_ARG"=<int>");
+	LA12XX_MAX_NB_QUEUES_ARG"=<int>"
+	LA12XX_VDEV_MODEM_ID_ARG "=<int> ");
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.h b/drivers/baseband/la12xx/bbdev_la12xx.h
new file mode 100644
index 0000000000..5228502331
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx.h
@@ -0,0 +1,56 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+
+#ifndef __BBDEV_LA12XX_H__
+#define __BBDEV_LA12XX_H__
+
+#define BBDEV_IPC_ENC_OP_TYPE	1
+#define BBDEV_IPC_DEC_OP_TYPE	2
+
+#define MAX_LDPC_ENC_FECA_QUEUES	4
+#define MAX_LDPC_DEC_FECA_QUEUES	4
+
+#define MAX_CHANNEL_DEPTH 16
+/* private data structure */
+struct bbdev_la12xx_private {
+	void *ipc_priv;
+	uint8_t num_valid_queues;
+	uint8_t max_nb_queues;
+	uint8_t num_ldpc_enc_queues;
+	uint8_t num_ldpc_dec_queues;
+	int8_t modem_id;
+	struct bbdev_la12xx_q_priv *queues_priv[32];
+};
+
+struct hugepage_info {
+	void *vaddr;
+	phys_addr_t paddr;
+	size_t len;
+};
+
+struct bbdev_la12xx_q_priv {
+	struct bbdev_la12xx_private *bbdev_priv;
+	uint32_t q_id;	/**< Channel ID */
+	uint32_t feca_blk_id;	/** FECA block ID for processing */
+	uint32_t feca_blk_id_be32; /**< FECA Block ID for this queue */
+	uint8_t en_napi; /* 0: napi disabled, 1: napi enabled */
+	uint16_t queue_size;	/**< Queue depth */
+	int32_t eventfd;	/**< Event FD value */
+	enum rte_bbdev_op_type op_type; /**< Operation type */
+	uint32_t la12xx_core_id;
+		/* LA12xx core ID on which this will be scheduled */
+	struct rte_mempool *mp; /**< Pool from where buffers would be cut */
+	void *bbdev_op[MAX_CHANNEL_DEPTH];
+			/**< Stores bbdev op for each index */
+	void *msg_ch_vaddr[MAX_CHANNEL_DEPTH];
+			/**< Stores msg channel addr for modem->host */
+	uint32_t host_pi;	/**< Producer_Index for HOST->MODEM */
+	uint32_t host_ci;	/**< Consumer Index for MODEM->HOST */
+	host_ipc_params_t *host_params; /**< Host parameters */
+};
+
+#define lower_32_bits(x) ((uint32_t)((uint64_t)x))
+#define upper_32_bits(x) ((uint32_t)(((uint64_t)(x) >> 16) >> 16))
+
+#endif
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
new file mode 100644
index 0000000000..9aa5562981
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+#ifndef __BBDEV_LA12XX_IPC_H__
+#define __BBDEV_LA12XX_IPC_H__
+
+/** No. of max channel per instance */
+#define IPC_MAX_DEPTH	(16)
+
+/* This shared memory would be on the host side which have copy of some
+ * of the parameters which are also part of Shared BD ring. Read access
+ * of these parameters from the host side would not be over PCI.
+ */
+typedef struct host_ipc_params {
+	volatile uint32_t pi;
+	volatile uint32_t ci;
+	volatile uint32_t modem_ptr[IPC_MAX_DEPTH];
+} __rte_packed host_ipc_params_t;
+
+#endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v4 5/8] baseband/la12xx: add queue and modem config support
  2021-04-24 10:36       ` [dpdk-dev] [PATCH v4 0/8] baseband: add " Hemant Agrawal
                           ` (3 preceding siblings ...)
  2021-04-24 10:36         ` [dpdk-dev] [PATCH v4 4/8] baseband/la12xx: add support for multiple modems Hemant Agrawal
@ 2021-04-24 10:36         ` Hemant Agrawal
  2021-04-24 22:12           ` Chautru, Nicolas
  2021-04-24 10:36         ` [dpdk-dev] [PATCH v4 6/8] baseband/la12xx: add enqueue and dequeue support Hemant Agrawal
                           ` (3 subsequent siblings)
  8 siblings, 1 reply; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-24 10:36 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, Hemant Agrawal, Nipun Gupta

This patch add support for connecting with modem
and creating the ipc channel as queues with modem
for the exchange of data.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 doc/guides/bbdevs/index.rst                |   1 +
 doc/guides/bbdevs/la12xx.rst               |  81 +++
 doc/guides/rel_notes/release_21_05.rst     |   5 +
 drivers/baseband/la12xx/bbdev_la12xx.c     | 552 ++++++++++++++++++++-
 drivers/baseband/la12xx/bbdev_la12xx.h     |  11 +-
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 189 ++++++-
 6 files changed, 829 insertions(+), 10 deletions(-)
 create mode 100644 doc/guides/bbdevs/la12xx.rst

diff --git a/doc/guides/bbdevs/index.rst b/doc/guides/bbdevs/index.rst
index 4445cbd1b0..cedd706fa6 100644
--- a/doc/guides/bbdevs/index.rst
+++ b/doc/guides/bbdevs/index.rst
@@ -14,3 +14,4 @@ Baseband Device Drivers
     fpga_lte_fec
     fpga_5gnr_fec
     acc100
+    la12xx
diff --git a/doc/guides/bbdevs/la12xx.rst b/doc/guides/bbdevs/la12xx.rst
new file mode 100644
index 0000000000..3c9ac5c047
--- /dev/null
+++ b/doc/guides/bbdevs/la12xx.rst
@@ -0,0 +1,81 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright 2021 NXP
+
+NXP LA12xx Poll Mode Driver
+=======================================
+
+The BBDEV LA12xx poll mode driver (PMD) supports an implementation for
+offloading High Phy processing functions like LDPC Encode / Decode 5GNR wireless
+acceleration function, using PCI based LA12xx Software defined radio.
+
+More information can be found at `NXP Official Website
+<https://www.nxp.com/products/processors-and-microcontrollers/arm-processors/layerscape-processors/layerscape-access-la1200-programmable-baseband-processor:LA1200>`_.
+
+Features
+--------
+
+LA12xx PMD supports the following features:
+
+- Maximum of 8 UL queues
+- Maximum of 8 DL queues
+- PCIe Gen-3 x8 Interface
+- MSI-X
+
+Installation
+------------
+
+Section 3 of the DPDK manual provides instructions on installing and compiling DPDK.
+
+DPDK requires hugepages to be configured as detailed in section 2 of the DPDK manual.
+
+Initialization
+--------------
+
+The device can be listed on the host console with:
+
+
+Use the following lspci command to get the multiple LA12xx processor ids. The
+device ID of the LA12xx baseband processor is "1c30".
+
+.. code-block:: console
+
+  sudo lspci -nn
+
+...
+0001:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device [1957:1c30] (
+rev 10)
+...
+0002:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device [1957:1c30] (
+rev 10)
+
+
+Prerequisites
+-------------
+
+Currently supported by DPDK:
+
+- NXP LA1224 BSP **1.0+**.
+- NXP LA1224 PCIe Modem card connected to ARM host.
+
+- Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup the basic DPDK environment.
+
+* Use dev arg option ``modem=0`` to identify the modem instance for a given
+  device. This is required only if more than 1 modem cards are attached to host.
+  this is optional and the default value is 0.
+  e.g. ``--vdev=baseband_la12xx,modem=0``
+
+* Use dev arg option ``max_nb_queues=x`` to specify the maximum number of queues
+  to be used for communication with offload device i.e. modem. default is 16.
+  e.g. ``--vdev=baseband_la12xx,max_nb_queues=4``
+
+Enabling logs
+-------------
+
+For enabling logs, use the following EAL parameter:
+
+.. code-block:: console
+
+   ./your_bbdev_application <EAL args> --log-level=la12xx:<level>
+
+Using ``bb.la12xx`` as log matching criteria, all Baseband PMD logs can be
+enabled which are lower than logging ``level``.
diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
index b3224dc332..4e0b62debb 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -236,6 +236,11 @@ New Features
   the hash function used in NICs to spread the traffic among the queues.
   It can be used to get predictable mapping of the flows.
 
+* **Added NXP LA12xx baseband PMD.**
+
+  * Added a new baseband PMD driver for NXP LA12xx Software defined radio.
+  * See the :doc:`../bbdevs/la12xx` for more details.
+
 * **Updated testpmd.**
 
   * Added a command line option to configure forced speed for Ethernet port.
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index f26f3f2a08..1fdeca279e 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -3,6 +3,11 @@
  */
 
 #include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <dirent.h>
 
 #include <rte_common.h>
 #include <rte_bus_vdev.h>
@@ -31,11 +36,549 @@ struct bbdev_la12xx_params {
 #define LA12XX_VDEV_MODEM_ID_ARG	"modem"
 #define LA12XX_MAX_MODEM 4
 
+#define LA12XX_MAX_CORES	4
+#define LA12XX_LDPC_ENC_CORE	0
+#define LA12XX_LDPC_DEC_CORE	1
+
+#define LA12XX_MAX_LDPC_ENC_QUEUES	4
+#define LA12XX_MAX_LDPC_DEC_QUEUES	4
+
 static const char * const bbdev_la12xx_valid_params[] = {
 	LA12XX_MAX_NB_QUEUES_ARG,
 	LA12XX_VDEV_MODEM_ID_ARG,
 };
 
+static const struct rte_bbdev_op_cap bbdev_capabilities[] = {
+	{
+		.type   = RTE_BBDEV_OP_LDPC_ENC,
+		.cap.ldpc_enc = {
+			.capability_flags =
+					RTE_BBDEV_LDPC_CRC_24A_ATTACH |
+					RTE_BBDEV_LDPC_CRC_24B_ATTACH,
+			.num_buffers_src =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+			.num_buffers_dst =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+		}
+	},
+	{
+		.type   = RTE_BBDEV_OP_LDPC_DEC,
+		.cap.ldpc_dec = {
+			.capability_flags =
+				RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK |
+				RTE_BBDEV_LDPC_LLR_COMPRESSION |
+					RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK |
+					RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP,
+			.num_buffers_src =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+			.num_buffers_hard_out =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+		}
+	},
+	RTE_BBDEV_END_OF_CAPABILITIES_LIST()
+};
+
+static struct rte_bbdev_queue_conf default_queue_conf = {
+	.queue_size = MAX_CHANNEL_DEPTH,
+};
+
+/* Get device info */
+static void
+la12xx_info_get(struct rte_bbdev *dev __rte_unused,
+		struct rte_bbdev_driver_info *dev_info)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	dev_info->driver_name = RTE_STR(DRIVER_NAME);
+	dev_info->max_num_queues = LA12XX_MAX_QUEUES;
+	dev_info->queue_size_lim = MAX_CHANNEL_DEPTH;
+	dev_info->hardware_accelerated = true;
+	dev_info->max_dl_queue_priority = 0;
+	dev_info->max_ul_queue_priority = 0;
+	dev_info->default_queue_conf = default_queue_conf;
+	dev_info->capabilities = bbdev_capabilities;
+	dev_info->cpu_flag_reqs = NULL;
+	dev_info->min_alignment = 64;
+
+	rte_bbdev_log_debug("got device info from %u", dev->data->dev_id);
+}
+
+/* Release queue */
+static int
+la12xx_queue_release(struct rte_bbdev *dev, uint16_t q_id)
+{
+	RTE_SET_USED(dev);
+	RTE_SET_USED(q_id);
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* TODO: Implement */
+
+	return 0;
+}
+
+#define HUGEPG_OFFSET(A) \
+		((uint64_t) ((unsigned long) (A) \
+		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
+
+static int ipc_queue_configure(uint32_t channel_id,
+		ipc_t instance, struct bbdev_la12xx_q_priv *q_priv)
+{
+	ipc_userspace_t *ipc_priv = (ipc_userspace_t *)instance;
+	ipc_instance_t *ipc_instance = ipc_priv->instance;
+	ipc_ch_t *ch;
+	void *vaddr;
+	uint32_t i = 0;
+	uint32_t msg_size = sizeof(struct bbdev_ipc_enqueue_op);
+
+	PMD_INIT_FUNC_TRACE();
+
+	rte_bbdev_log_debug("%x %p", ipc_instance->initialized,
+		ipc_priv->instance);
+	ch = &(ipc_instance->ch_list[channel_id]);
+
+	rte_bbdev_log_debug("channel: %u, depth: %u, msg size: %u",
+		channel_id, q_priv->queue_size, msg_size);
+
+	/* Start init of channel */
+	ch->md.ring_size = rte_cpu_to_be_32(q_priv->queue_size);
+	ch->md.pi = 0;
+	ch->md.ci = 0;
+	ch->md.msg_size = msg_size;
+	for (i = 0; i < q_priv->queue_size; i++) {
+		vaddr = rte_malloc(NULL, msg_size, RTE_CACHE_LINE_SIZE);
+		if (!vaddr)
+			return IPC_HOST_BUF_ALLOC_FAIL;
+		/* Only offset now */
+		ch->bd_h[i].modem_ptr =
+			rte_cpu_to_be_32(HUGEPG_OFFSET(vaddr));
+		ch->bd_h[i].host_virt_l = lower_32_bits(vaddr);
+		ch->bd_h[i].host_virt_h = upper_32_bits(vaddr);
+		q_priv->msg_ch_vaddr[i] = vaddr;
+		/* Not sure use of this len may be for CRC*/
+		ch->bd_h[i].len = 0;
+	}
+	ch->host_ipc_params =
+		rte_cpu_to_be_32(HUGEPG_OFFSET(q_priv->host_params));
+
+	rte_bbdev_log_debug("Channel configured");
+	return IPC_SUCCESS;
+}
+
+static int
+la12xx_e200_queue_setup(struct rte_bbdev *dev,
+		struct bbdev_la12xx_q_priv *q_priv)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	struct gul_hif *mhif;
+	ipc_metadata_t *ipc_md;
+	ipc_ch_t *ch;
+	int instance_id = 0, i;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		q_priv->la12xx_core_id = LA12XX_LDPC_ENC_CORE;
+		break;
+	case RTE_BBDEV_OP_LDPC_DEC:
+		q_priv->la12xx_core_id = LA12XX_LDPC_DEC_CORE;
+		break;
+	default:
+		rte_bbdev_log(ERR, "Unsupported op type\n");
+		return -1;
+	}
+
+	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+	/* offset is from start of PEB */
+	ipc_md = (ipc_metadata_t *)((uint64_t)ipc_priv->peb_start.host_vaddr +
+		mhif->ipc_regs.ipc_mdata_offset);
+	ch = &ipc_md->instance_list[instance_id].ch_list[q_priv->q_id];
+
+	if (q_priv->q_id < priv->num_valid_queues) {
+		ipc_br_md_t *md = &(ch->md);
+
+		q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
+		q_priv->feca_blk_id_be32 = ch->feca_blk_id;
+		q_priv->host_pi = rte_be_to_cpu_32(md->pi);
+		q_priv->host_ci = rte_be_to_cpu_32(md->ci);
+		q_priv->host_params = (host_ipc_params_t *)
+			(rte_be_to_cpu_32(ch->host_ipc_params) +
+			((uint64_t)ipc_priv->hugepg_start.host_vaddr));
+
+		for (i = 0; i < q_priv->queue_size; i++) {
+			uint32_t h, l;
+
+			h = ch->bd_h[i].host_virt_h;
+			l = ch->bd_h[i].host_virt_l;
+			q_priv->msg_ch_vaddr[i] = (void *)join_32_bits(h, l);
+		}
+
+		rte_bbdev_log(WARNING,
+			"Queue [%d] already configured, not configuring again",
+			q_priv->q_id);
+		return 0;
+	}
+
+	rte_bbdev_log_debug("setting up queue %d", q_priv->q_id);
+
+	/* Call ipc_configure_channel */
+	ret = ipc_queue_configure(q_priv->q_id, ipc_priv, q_priv);
+	if (ret) {
+		rte_bbdev_log(ERR, "Unable to setup queue (%d) (err=%d)",
+		       q_priv->q_id, ret);
+		return ret;
+	}
+
+	/* Set queue properties for LA12xx device */
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		if (priv->num_ldpc_enc_queues >= LA12XX_MAX_LDPC_ENC_QUEUES) {
+			rte_bbdev_log(ERR,
+				"num_ldpc_enc_queues reached max value");
+			return -1;
+		}
+		ch->la12xx_core_id =
+			rte_cpu_to_be_32(LA12XX_LDPC_ENC_CORE);
+		ch->feca_blk_id = rte_cpu_to_be_32(priv->num_ldpc_enc_queues++);
+		break;
+	case RTE_BBDEV_OP_LDPC_DEC:
+		if (priv->num_ldpc_dec_queues >= LA12XX_MAX_LDPC_DEC_QUEUES) {
+			rte_bbdev_log(ERR,
+				"num_ldpc_dec_queues reached max value");
+			return -1;
+		}
+		ch->la12xx_core_id =
+			rte_cpu_to_be_32(LA12XX_LDPC_DEC_CORE);
+		ch->feca_blk_id = rte_cpu_to_be_32(priv->num_ldpc_dec_queues++);
+		break;
+	default:
+		rte_bbdev_log(ERR, "Not supported op type\n");
+		return -1;
+	}
+	ch->op_type = rte_cpu_to_be_32(q_priv->op_type);
+	ch->depth = rte_cpu_to_be_32(q_priv->queue_size);
+
+	/* Store queue config here */
+	q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
+	q_priv->feca_blk_id_be32 = ch->feca_blk_id;
+
+	return 0;
+}
+
+/* Setup a queue */
+static int
+la12xx_queue_setup(struct rte_bbdev *dev, uint16_t q_id,
+		const struct rte_bbdev_queue_conf *queue_conf)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	struct rte_bbdev_queue_data *q_data;
+	struct bbdev_la12xx_q_priv *q_priv;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* Move to setup_queues callback */
+	q_data = &dev->data->queues[q_id];
+	q_data->queue_private = rte_zmalloc(NULL,
+		sizeof(struct bbdev_la12xx_q_priv), 0);
+	if (!q_data->queue_private) {
+		rte_bbdev_log(ERR, "Memory allocation failed for qpriv");
+		return -ENOMEM;
+	}
+	q_priv = q_data->queue_private;
+	q_priv->q_id = q_id;
+	q_priv->bbdev_priv = dev->data->dev_private;
+	q_priv->queue_size = queue_conf->queue_size;
+	q_priv->op_type = queue_conf->op_type;
+
+	ret = la12xx_e200_queue_setup(dev, q_priv);
+	if (ret) {
+		rte_bbdev_log(ERR, "e200_queue_setup failed for qid: %d",
+				     q_id);
+		return ret;
+	}
+
+	/* Store queue config here */
+	priv->num_valid_queues++;
+
+	return 0;
+}
+
+static int
+la12xx_start(struct rte_bbdev *dev)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	int ready = 0;
+	struct gul_hif *hif_start;
+
+	PMD_INIT_FUNC_TRACE();
+
+	hif_start = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+
+	/* Set Host Read bit */
+	SET_HIF_HOST_RDY(hif_start, HIF_HOST_READY_IPC_APP);
+
+	/* Now wait for modem ready bit */
+	while (!ready)
+		ready = CHK_HIF_MOD_RDY(hif_start, HIF_MOD_READY_IPC_APP);
+
+	return 0;
+}
+
+static const struct rte_bbdev_ops pmd_ops = {
+	.info_get = la12xx_info_get,
+	.queue_setup = la12xx_queue_setup,
+	.queue_release = la12xx_queue_release,
+	.start = la12xx_start
+};
+static struct hugepage_info *
+get_hugepage_info(void)
+{
+	struct hugepage_info *hp_info;
+	struct rte_memseg *mseg;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* TODO - find a better way */
+	hp_info = rte_malloc(NULL, sizeof(struct hugepage_info), 0);
+	if (!hp_info) {
+		rte_bbdev_log(ERR, "Unable to allocate on local heap");
+		return NULL;
+	}
+
+	mseg = rte_mem_virt2memseg(hp_info, NULL);
+	hp_info->vaddr = mseg->addr;
+	hp_info->paddr = rte_mem_virt2phy(mseg->addr);
+	hp_info->len = mseg->len;
+
+	return hp_info;
+}
+
+static int open_ipc_dev(int modem_id)
+{
+	char dev_initials[16], dev_path[PATH_MAX];
+	struct dirent *entry;
+	int dev_ipc = 0;
+	DIR *dir;
+
+	dir = opendir("/dev/");
+	if (!dir) {
+		rte_bbdev_log(ERR, "Unable to open /dev/");
+		return -1;
+	}
+
+	sprintf(dev_initials, "gulipcgul%d", modem_id);
+
+	while ((entry = readdir(dir)) != NULL) {
+		if (!strncmp(dev_initials, entry->d_name,
+		    sizeof(dev_initials) - 1))
+			break;
+	}
+
+	if (!entry) {
+		rte_bbdev_log(ERR, "Error: No gulipcgul%d device", modem_id);
+		return -1;
+	}
+
+	sprintf(dev_path, "/dev/%s", entry->d_name);
+	dev_ipc = open(dev_path, O_RDWR);
+	if (dev_ipc  < 0) {
+		rte_bbdev_log(ERR, "Error: Cannot open %s", dev_path);
+		return -errno;
+	}
+
+	return dev_ipc;
+}
+
+static int
+setup_la12xx_dev(struct rte_bbdev *dev)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	struct hugepage_info *hp = NULL;
+	ipc_channel_us_t *ipc_priv_ch = NULL;
+	int dev_ipc = 0, dev_mem = 0, i;
+	ipc_metadata_t *ipc_md;
+	struct gul_hif *mhif;
+	uint32_t phy_align = 0;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (!ipc_priv) {
+		/* TODO - get a better way */
+		/* Get the hugepage info against it */
+		hp = get_hugepage_info();
+		if (!hp) {
+			rte_bbdev_log(ERR, "Unable to get hugepage info");
+			ret = -ENOMEM;
+			goto err;
+		}
+
+		rte_bbdev_log_debug("%lx %p %lx",
+				hp->paddr, hp->vaddr, hp->len);
+
+		ipc_priv = rte_zmalloc(0, sizeof(ipc_userspace_t), 0);
+		if (ipc_priv == NULL) {
+			rte_bbdev_log(ERR,
+				"Unable to allocate memory for ipc priv");
+			ret = -ENOMEM;
+			goto err;
+		}
+
+		for (i = 0; i < IPC_MAX_CHANNEL_COUNT; i++) {
+			ipc_priv_ch = rte_zmalloc(0,
+				sizeof(ipc_channel_us_t), 0);
+			if (ipc_priv_ch == NULL) {
+				rte_bbdev_log(ERR,
+					"Unable to allocate memory for channels");
+				ret = -ENOMEM;
+			}
+			ipc_priv->channels[i] = ipc_priv_ch;
+		}
+
+		dev_mem = open("/dev/mem", O_RDWR);
+		if (dev_mem < 0) {
+			rte_bbdev_log(ERR, "Error: Cannot open /dev/mem");
+			ret = -errno;
+			goto err;
+		}
+
+		ipc_priv->instance_id = 0;
+		ipc_priv->dev_mem = dev_mem;
+
+		rte_bbdev_log_debug("hugepg input %lx %p %lx",
+			hp->paddr, hp->vaddr, hp->len);
+
+		ipc_priv->sys_map.hugepg_start.host_phys = hp->paddr;
+		ipc_priv->sys_map.hugepg_start.size = hp->len;
+
+		ipc_priv->hugepg_start.host_phys = hp->paddr;
+		ipc_priv->hugepg_start.host_vaddr = hp->vaddr;
+		ipc_priv->hugepg_start.size = hp->len;
+
+		rte_free(hp);
+	}
+
+	dev_ipc = open_ipc_dev(priv->modem_id);
+	if (dev_ipc < 0) {
+		rte_bbdev_log(ERR, "Error: open_ipc_dev failed");
+		goto err;
+	}
+	ipc_priv->dev_ipc = dev_ipc;
+
+	ret = ioctl(ipc_priv->dev_ipc, IOCTL_GUL_IPC_GET_SYS_MAP,
+		    &ipc_priv->sys_map);
+	if (ret) {
+		rte_bbdev_log(ERR,
+			"IOCTL_GUL_IPC_GET_SYS_MAP ioctl failed");
+		goto err;
+	}
+
+	phy_align = (ipc_priv->sys_map.mhif_start.host_phys % 0x1000);
+	ipc_priv->mhif_start.host_vaddr =
+		mmap(0, ipc_priv->sys_map.mhif_start.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.mhif_start.host_phys - phy_align));
+	if (ipc_priv->mhif_start.host_vaddr == MAP_FAILED) {
+		rte_bbdev_log(ERR, "MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->mhif_start.host_vaddr = (void *) ((uint64_t)
+		(ipc_priv->mhif_start.host_vaddr) + phy_align);
+
+	phy_align = (ipc_priv->sys_map.peb_start.host_phys % 0x1000);
+	ipc_priv->peb_start.host_vaddr =
+		mmap(0, ipc_priv->sys_map.peb_start.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.peb_start.host_phys - phy_align));
+	if (ipc_priv->peb_start.host_vaddr == MAP_FAILED) {
+		rte_bbdev_log(ERR, "MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->peb_start.host_vaddr = (void *)((uint64_t)
+		(ipc_priv->peb_start.host_vaddr) + phy_align);
+
+	phy_align = (ipc_priv->sys_map.modem_ccsrbar.host_phys % 0x1000);
+	ipc_priv->modem_ccsrbar.host_vaddr =
+		mmap(0, ipc_priv->sys_map.modem_ccsrbar.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.modem_ccsrbar.host_phys - phy_align));
+	if (ipc_priv->modem_ccsrbar.host_vaddr == MAP_FAILED) {
+		rte_bbdev_log(ERR, "MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->modem_ccsrbar.host_vaddr = (void *)((uint64_t)
+		(ipc_priv->modem_ccsrbar.host_vaddr) + phy_align);
+
+	ipc_priv->hugepg_start.modem_phys =
+		ipc_priv->sys_map.hugepg_start.modem_phys;
+
+	ipc_priv->mhif_start.host_phys =
+		ipc_priv->sys_map.mhif_start.host_phys;
+	ipc_priv->mhif_start.size = ipc_priv->sys_map.mhif_start.size;
+	ipc_priv->peb_start.host_phys = ipc_priv->sys_map.peb_start.host_phys;
+	ipc_priv->peb_start.size = ipc_priv->sys_map.peb_start.size;
+
+	rte_bbdev_log(INFO, "peb %lx %p %x",
+			ipc_priv->peb_start.host_phys,
+			ipc_priv->peb_start.host_vaddr,
+			ipc_priv->peb_start.size);
+	rte_bbdev_log(INFO, "hugepg %lx %p %x",
+			ipc_priv->hugepg_start.host_phys,
+			ipc_priv->hugepg_start.host_vaddr,
+			ipc_priv->hugepg_start.size);
+	rte_bbdev_log(INFO, "mhif %lx %p %x",
+			ipc_priv->mhif_start.host_phys,
+			ipc_priv->mhif_start.host_vaddr,
+			ipc_priv->mhif_start.size);
+	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+
+	/* offset is from start of PEB */
+	ipc_md = (ipc_metadata_t *)((uint64_t)ipc_priv->peb_start.host_vaddr +
+			mhif->ipc_regs.ipc_mdata_offset);
+
+	if (sizeof(ipc_metadata_t) != mhif->ipc_regs.ipc_mdata_size) {
+		rte_bbdev_log(ERR,
+			"ipc_metadata_t =%lx, mhif->ipc_regs.ipc_mdata_size=%x",
+			sizeof(ipc_metadata_t), mhif->ipc_regs.ipc_mdata_size);
+		rte_bbdev_log(ERR, "--> mhif->ipc_regs.ipc_mdata_offset= %x",
+			mhif->ipc_regs.ipc_mdata_offset);
+		rte_bbdev_log(ERR, "gul_hif size=%lx", sizeof(struct gul_hif));
+		return IPC_MD_SZ_MISS_MATCH;
+	}
+
+	ipc_priv->instance = (ipc_instance_t *)
+		(&ipc_md->instance_list[ipc_priv->instance_id]);
+
+	rte_bbdev_log_debug("finish host init");
+
+	priv->ipc_priv = ipc_priv;
+
+	return 0;
+
+err:
+	rte_free(hp);
+	rte_free(ipc_priv);
+	rte_free(ipc_priv_ch);
+	if (dev_mem)
+		close(dev_mem);
+	if (dev_ipc)
+		close(dev_ipc);
+
+	return ret;
+}
+
 static inline int
 parse_u16_arg(const char *key, const char *value, void *extra_args)
 {
@@ -123,6 +666,7 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
 	struct bbdev_la12xx_private *priv;
+	int ret;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -152,7 +696,13 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 
 	rte_bbdev_log(INFO, "Setting Up %s: DevId=%d, ModemId=%d",
 				name, bbdev->data->dev_id, priv->modem_id);
-	bbdev->dev_ops = NULL;
+	ret = setup_la12xx_dev(bbdev);
+	if (ret) {
+		rte_bbdev_log(ERR, "IPC Setup failed for %s", name);
+		rte_free(bbdev->data->dev_private);
+		return ret;
+	}
+	bbdev->dev_ops = &pmd_ops;
 	bbdev->device = &vdev->device;
 	bbdev->data->socket_id = 0;
 	bbdev->intr_handle = NULL;
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.h b/drivers/baseband/la12xx/bbdev_la12xx.h
index 5228502331..49c37fe2fe 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx.h
@@ -5,16 +5,10 @@
 #ifndef __BBDEV_LA12XX_H__
 #define __BBDEV_LA12XX_H__
 
-#define BBDEV_IPC_ENC_OP_TYPE	1
-#define BBDEV_IPC_DEC_OP_TYPE	2
-
-#define MAX_LDPC_ENC_FECA_QUEUES	4
-#define MAX_LDPC_DEC_FECA_QUEUES	4
-
 #define MAX_CHANNEL_DEPTH 16
 /* private data structure */
 struct bbdev_la12xx_private {
-	void *ipc_priv;
+	ipc_userspace_t *ipc_priv;
 	uint8_t num_valid_queues;
 	uint8_t max_nb_queues;
 	uint8_t num_ldpc_enc_queues;
@@ -52,5 +46,6 @@ struct bbdev_la12xx_q_priv {
 
 #define lower_32_bits(x) ((uint32_t)((uint64_t)x))
 #define upper_32_bits(x) ((uint32_t)(((uint64_t)(x) >> 16) >> 16))
-
+#define join_32_bits(upper, lower) \
+	((size_t)(((uint64_t)(upper) << 32) | (uint32_t)(lower)))
 #endif
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
index 9aa5562981..5f613fb087 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -4,9 +4,182 @@
 #ifndef __BBDEV_LA12XX_IPC_H__
 #define __BBDEV_LA12XX_IPC_H__
 
+#define LA12XX_MAX_QUEUES 20
+#define HOST_RX_QUEUEID_OFFSET LA12XX_MAX_QUEUES
+
+/** No. of max channel per instance */
+#define IPC_MAX_CHANNEL_COUNT	(64)
+
 /** No. of max channel per instance */
 #define IPC_MAX_DEPTH	(16)
 
+/** No. of max IPC instance per modem */
+#define IPC_MAX_INSTANCE_COUNT	(1)
+
+/** Error codes */
+#define IPC_SUCCESS		(0) /** IPC operation success */
+#define IPC_INPUT_INVALID	(-1) /** Invalid input to API */
+#define IPC_CH_INVALID		(-2) /** Channel no is invalid */
+#define IPC_INSTANCE_INVALID	(-3) /** Instance no is invalid */
+#define IPC_MEM_INVALID		(-4) /** Insufficient memory */
+#define IPC_CH_FULL		(-5) /** Channel is full */
+#define IPC_CH_EMPTY		(-6) /** Channel is empty */
+#define IPC_BL_EMPTY		(-7) /** Free buffer list is empty */
+#define IPC_BL_FULL		(-8) /** Free buffer list is full */
+#define IPC_HOST_BUF_ALLOC_FAIL	(-9) /** DPDK malloc fail */
+#define IPC_MD_SZ_MISS_MATCH	(-10) /** META DATA size in mhif miss matched*/
+#define IPC_MALLOC_FAIL		(-11) /** system malloc fail */
+#define IPC_IOCTL_FAIL		(-12) /** IOCTL call failed */
+#define IPC_MMAP_FAIL		(-14) /** MMAP fail */
+#define IPC_OPEN_FAIL		(-15) /** OPEN fail */
+#define IPC_EVENTFD_FAIL	(-16) /** eventfd initialization failed */
+#define IPC_NOT_IMPLEMENTED	(-17) /** IPC feature is not implemented yet*/
+
+#define SET_HIF_HOST_RDY(hif, RDY_MASK) (hif->host_ready |= RDY_MASK)
+#define CHK_HIF_MOD_RDY(hif, RDY_MASK) (hif->mod_ready & RDY_MASK)
+
+/* Host Ready bits */
+#define HIF_HOST_READY_HOST_REGIONS	(1 << 0)
+#define HIF_HOST_READY_IPC_LIB		(1 << 12)
+#define HIF_HOST_READY_IPC_APP		(1 << 13)
+#define HIF_HOST_READY_FECA		(1 << 14)
+
+/* Modem Ready bits */
+#define HIF_MOD_READY_IPC_LIB		(1 << 5)
+#define HIF_MOD_READY_IPC_APP		(1 << 6)
+#define HIF_MOD_READY_FECA		(1 << 7)
+
+typedef void *ipc_t;
+
+struct ipc_msg {
+	int chid;
+	void *addr;
+	uint32_t len;
+	uint8_t flags;
+};
+
+typedef struct {
+	uint64_t host_phys;
+	uint32_t modem_phys;
+	void    *host_vaddr;
+	uint32_t size;
+} mem_range_t;
+
+#define GUL_IPC_MAGIC	'R'
+
+#define IOCTL_GUL_IPC_GET_SYS_MAP _IOW(GUL_IPC_MAGIC, 1, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_REGISTER _IOWR(GUL_IPC_MAGIC, 4, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_DEREGISTER \
+	_IOWR(GUL_IPC_MAGIC, 5, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_RAISE_INTERRUPT _IOW(GUL_IPC_MAGIC, 6, int *)
+
+/** buffer ring common metadata */
+typedef struct ipc_bd_ring_md {
+	volatile uint32_t pi;		/**< Producer index and flag (MSB)
+					  *  which flip for each Ring wrapping
+					  */
+	volatile uint32_t ci;		/**< Consumer index and flag (MSB)
+					  *  which flip for each Ring wrapping
+					  */
+	uint32_t ring_size;	/**< depth (Used to roll-over pi/ci) */
+	uint32_t msg_size;	/**< Size of the each buffer */
+} __rte_packed ipc_br_md_t;
+
+/** IPC buffer descriptor */
+typedef struct ipc_buffer_desc {
+	union {
+		uint64_t host_virt;	/**< msg's host virtual address */
+		struct {
+			uint32_t host_virt_l;
+			uint32_t host_virt_h;
+		};
+	};
+	uint32_t modem_ptr;	/**< msg's modem physical address */
+	uint32_t len;		/**< msg len */
+} __rte_packed ipc_bd_t;
+
+typedef struct ipc_channel {
+	uint32_t ch_id;		/**< Channel id */
+	ipc_br_md_t md;			/**< Metadata for BD ring */
+	ipc_bd_t bd_h[IPC_MAX_DEPTH];	/**< Buffer Descriptor on Host */
+	ipc_bd_t bd_m[IPC_MAX_DEPTH];	/**< Buffer Descriptor on Modem */
+	uint32_t op_type;		/**< Type of the BBDEV operation
+					  * supported on this channel
+					  */
+	uint32_t depth;			/**< Channel depth */
+	uint32_t feca_blk_id;	/**< FECA Transport Block ID for processing */
+	uint32_t la12xx_core_id;/**< LA12xx core ID on which this will be
+				  * scheduled
+				  */
+	uint32_t feca_input_circ_size;	/**< FECA transport block input
+					  * circular buffer size
+					  */
+	uint32_t host_ipc_params;	/**< Address for host IPC parameters */
+} __rte_packed ipc_ch_t;
+
+typedef struct ipc_instance {
+	uint32_t instance_id;		/**< instance id, use to init this
+					  * instance by ipc_init API
+					  */
+	uint32_t initialized;		/**< Set in ipc_init */
+	ipc_ch_t ch_list[IPC_MAX_CHANNEL_COUNT];
+		/**< Channel descriptors in this instance */
+} __rte_packed ipc_instance_t;
+
+typedef struct ipc_metadata {
+	uint32_t ipc_host_signature; /**< IPC host signature, Set by host/L2 */
+	uint32_t ipc_geul_signature; /**< IPC geul signature, Set by modem */
+	ipc_instance_t instance_list[IPC_MAX_INSTANCE_COUNT];
+} __rte_packed ipc_metadata_t;
+
+typedef struct ipc_channel_us_priv {
+	int32_t		eventfd;
+	uint32_t	channel_id;
+	/* In flight packets status for buffer list. */
+	uint8_t		bufs_inflight[IPC_MAX_DEPTH];
+} ipc_channel_us_t;
+
+typedef struct {
+	uint64_t host_phys;
+	uint32_t modem_phys;
+	uint32_t size;
+} mem_strt_addr_t;
+
+typedef struct {
+	mem_strt_addr_t modem_ccsrbar;
+	mem_strt_addr_t peb_start; /* PEB meta data */
+	mem_strt_addr_t mhif_start; /* MHIF meta daat */
+	mem_strt_addr_t hugepg_start; /* Modem to access hugepage */
+} sys_map_t;
+
+typedef struct ipc_priv_t {
+	int instance_id;
+	int dev_ipc;
+	int dev_mem;
+	sys_map_t sys_map;
+	mem_range_t modem_ccsrbar;
+	mem_range_t peb_start;
+	mem_range_t mhif_start;
+	mem_range_t hugepg_start;
+	ipc_channel_us_t *channels[IPC_MAX_CHANNEL_COUNT];
+	ipc_instance_t	*instance;
+	ipc_instance_t	*instance_bk;
+} ipc_userspace_t;
+
+/** Structure specifying enqueue operation (enqueue at LA1224) */
+struct bbdev_ipc_enqueue_op {
+	/** Status of operation that was performed */
+	int32_t status;
+	/** CRC Status of SD operation that was performed */
+	int32_t crc_stat_addr;
+	/** HARQ Output buffer memory length for Shared Decode.
+	 * Filled by LA12xx.
+	 */
+	uint32_t out_len;
+	/** Reserved (for 8 byte alignment) */
+	uint32_t rsvd;
+};
+
 /* This shared memory would be on the host side which have copy of some
  * of the parameters which are also part of Shared BD ring. Read access
  * of these parameters from the host side would not be over PCI.
@@ -14,7 +187,21 @@
 typedef struct host_ipc_params {
 	volatile uint32_t pi;
 	volatile uint32_t ci;
-	volatile uint32_t modem_ptr[IPC_MAX_DEPTH];
+	volatile uint32_t bd_m_modem_ptr[IPC_MAX_DEPTH];
 } __rte_packed host_ipc_params_t;
 
+struct hif_ipc_regs {
+	uint32_t ipc_mdata_offset;
+	uint32_t ipc_mdata_size;
+} __rte_packed;
+
+struct gul_hif {
+	uint32_t ver;
+	uint32_t hif_ver;
+	uint32_t status;
+	volatile uint32_t host_ready;
+	volatile uint32_t mod_ready;
+	struct hif_ipc_regs ipc_regs;
+} __rte_packed;
+
 #endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v4 6/8] baseband/la12xx: add enqueue and dequeue support
  2021-04-24 10:36       ` [dpdk-dev] [PATCH v4 0/8] baseband: add " Hemant Agrawal
                           ` (4 preceding siblings ...)
  2021-04-24 10:36         ` [dpdk-dev] [PATCH v4 5/8] baseband/la12xx: add queue and modem config support Hemant Agrawal
@ 2021-04-24 10:36         ` Hemant Agrawal
  2021-04-24 10:36         ` [dpdk-dev] [PATCH v4 7/8] app/bbdev: enable la12xx for bbdev Hemant Agrawal
                           ` (2 subsequent siblings)
  8 siblings, 0 replies; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-24 10:36 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, Hemant Agrawal, Nipun Gupta

Add support for enqueue and dequeue the LDPC enc/dec
from the modem device.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 doc/guides/bbdevs/features/la12xx.ini      |  14 +
 doc/guides/bbdevs/la12xx.rst               |  46 +++
 drivers/baseband/la12xx/bbdev_la12xx.c     | 334 ++++++++++++++++++++-
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h |  37 +++
 4 files changed, 425 insertions(+), 6 deletions(-)
 create mode 100644 doc/guides/bbdevs/features/la12xx.ini

diff --git a/doc/guides/bbdevs/features/la12xx.ini b/doc/guides/bbdevs/features/la12xx.ini
new file mode 100644
index 0000000000..d184914b10
--- /dev/null
+++ b/doc/guides/bbdevs/features/la12xx.ini
@@ -0,0 +1,14 @@
+;
+; Supported features of the 'la12xx' bbdev driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Turbo Decoder (4G)     = N
+Turbo Encoder (4G)     = N
+LDPC Decoder (5G)      = Y
+LDPC Encoder (5G)      = Y
+LLR/HARQ Compression   = N
+HW Accelerated         = Y
+BBDEV API              = Y
+Network Order Data     = Y
\ No newline at end of file
diff --git a/doc/guides/bbdevs/la12xx.rst b/doc/guides/bbdevs/la12xx.rst
index 3c9ac5c047..c39be0e51f 100644
--- a/doc/guides/bbdevs/la12xx.rst
+++ b/doc/guides/bbdevs/la12xx.rst
@@ -16,6 +16,8 @@ Features
 
 LA12xx PMD supports the following features:
 
+- LDPC Encode in the DL
+- LDPC Decode in the UL
 - Maximum of 8 UL queues
 - Maximum of 8 DL queues
 - PCIe Gen-3 x8 Interface
@@ -79,3 +81,47 @@ For enabling logs, use the following EAL parameter:
 
 Using ``bb.la12xx`` as log matching criteria, all Baseband PMD logs can be
 enabled which are lower than logging ``level``.
+
+Test Application
+----------------
+
+BBDEV provides a test application, ``test-bbdev.py`` and range of test data for testing
+the functionality of LA12xx for FEC encode and decode, depending on the device
+capabilities. The test application is located under app->test-bbdev folder and has the
+following options:
+
+.. code-block:: console
+
+  "-p", "--testapp-path": specifies path to the bbdev test app.
+  "-e", "--eal-params"	: EAL arguments which are passed to the test app.
+  "-t", "--timeout"	: Timeout in seconds (default=300).
+  "-c", "--test-cases"	: Defines test cases to run. Run all if not specified.
+  "-v", "--test-vector"	: Test vector path (default=dpdk_path+/app/test-bbdev/test_vectors/bbdev_null.data).
+  "-n", "--num-ops"	: Number of operations to process on device (default=32).
+  "-b", "--burst-size"	: Operations enqueue/dequeue burst size (default=32).
+  "-s", "--snr"		: SNR in dB used when generating LLRs for bler tests.
+  "-s", "--iter_max"	: Number of iterations for LDPC decoder.
+  "-l", "--num-lcores"	: Number of lcores to run (default=16).
+  "-i", "--init-device" : Initialise PF device with default values.
+
+
+To execute the test application tool using simple decode or encode data,
+type one of the following:
+
+.. code-block:: console
+
+  ./test-bbdev.py -e="--vdev=baseband_la12xx,socket_id=0,max_nb_queues=8" -c validation -n 64 -b 1 -v ./ldpc_dec_default.data
+  ./test-bbdev.py -e="--vdev=baseband_la12xx,socket_id=0,max_nb_queues=8" -c validation -n 64 -b 1 -v ./ldpc_enc_default.data
+
+The test application ``test-bbdev.py``, supports the ability to configure the PF device with
+a default set of values, if the "-i" or "- -init-device" option is included. The default values
+are defined in test_bbdev_perf.c.
+
+
+Test Vectors
+~~~~~~~~~~~~
+
+In addition to the simple LDPC decoder and LDPC encoder tests, bbdev also provides
+a range of additional tests under the test_vectors folder, which may be useful. The results
+of these tests will depend on the LA12xx FEC capabilities which may cause some
+testcases to be skipped, but no failure should be reported.
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 1fdeca279e..50e3284622 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -54,7 +54,8 @@ static const struct rte_bbdev_op_cap bbdev_capabilities[] = {
 		.cap.ldpc_enc = {
 			.capability_flags =
 					RTE_BBDEV_LDPC_CRC_24A_ATTACH |
-					RTE_BBDEV_LDPC_CRC_24B_ATTACH,
+					RTE_BBDEV_LDPC_CRC_24B_ATTACH |
+					RTE_BBDEV_LDPC_ENC_NETWORK_ORDER,
 			.num_buffers_src =
 					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
 			.num_buffers_dst =
@@ -68,7 +69,8 @@ static const struct rte_bbdev_op_cap bbdev_capabilities[] = {
 				RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK |
 				RTE_BBDEV_LDPC_LLR_COMPRESSION |
 					RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK |
-					RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP,
+					RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP |
+					RTE_BBDEV_LDPC_DEC_NETWORK_ORDER,
 			.num_buffers_src =
 					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
 			.num_buffers_hard_out =
@@ -121,6 +123,10 @@ la12xx_queue_release(struct rte_bbdev *dev, uint16_t q_id)
 		((uint64_t) ((unsigned long) (A) \
 		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
 
+#define MODEM_P2V(A) \
+	((uint64_t) ((unsigned long) (A) \
+		+ (unsigned long)(ipc_priv->peb_start.host_vaddr)))
+
 static int ipc_queue_configure(uint32_t channel_id,
 		ipc_t instance, struct bbdev_la12xx_q_priv *q_priv)
 {
@@ -335,6 +341,318 @@ static const struct rte_bbdev_ops pmd_ops = {
 	.queue_release = la12xx_queue_release,
 	.start = la12xx_start
 };
+
+static inline int
+is_bd_ring_full(uint32_t ci, uint32_t ci_flag,
+		uint32_t pi, uint32_t pi_flag)
+{
+	if (pi == ci) {
+		if (pi_flag != ci_flag)
+			return 1; /* Ring is Full */
+	}
+	return 0;
+}
+
+static inline int
+prepare_ldpc_enc_op(struct rte_bbdev_enc_op *bbdev_enc_op,
+		    struct bbdev_la12xx_q_priv *q_priv __rte_unused,
+		    struct rte_bbdev_op_data *in_op_data __rte_unused,
+		    struct rte_bbdev_op_data *out_op_data)
+{
+	struct rte_bbdev_op_ldpc_enc *ldpc_enc = &bbdev_enc_op->ldpc_enc;
+	uint32_t total_out_bits;
+
+	total_out_bits = (ldpc_enc->tb_params.cab *
+		ldpc_enc->tb_params.ea) + (ldpc_enc->tb_params.c -
+		ldpc_enc->tb_params.cab) * ldpc_enc->tb_params.eb;
+
+	ldpc_enc->output.length = (total_out_bits + 7)/8;
+
+	rte_pktmbuf_append(out_op_data->data, ldpc_enc->output.length);
+
+	return 0;
+}
+
+static inline int
+prepare_ldpc_dec_op(struct rte_bbdev_dec_op *bbdev_dec_op,
+		    struct bbdev_ipc_dequeue_op *bbdev_ipc_op,
+		    struct bbdev_la12xx_q_priv *q_priv  __rte_unused,
+		    struct rte_bbdev_op_data *out_op_data  __rte_unused)
+{
+	struct rte_bbdev_op_ldpc_dec *ldpc_dec = &bbdev_dec_op->ldpc_dec;
+	uint32_t total_out_bits;
+	uint32_t num_code_blocks = 0;
+	uint16_t sys_cols;
+
+	sys_cols = (ldpc_dec->basegraph == 1) ? 22 : 10;
+	if (ldpc_dec->tb_params.c == 1) {
+		total_out_bits = ((sys_cols * ldpc_dec->z_c) -
+				ldpc_dec->n_filler);
+		/* 5G-NR protocol uses 16 bit CRC when output packet
+		 * size <= 3824 (bits). Otherwise 24 bit CRC is used.
+		 * Adjust the output bits accordingly
+		 */
+		if (total_out_bits - 16 <= 3824)
+			total_out_bits -= 16;
+		else
+			total_out_bits -= 24;
+		ldpc_dec->hard_output.length = (total_out_bits / 8);
+	} else {
+		total_out_bits = (((sys_cols * ldpc_dec->z_c) -
+				ldpc_dec->n_filler - 24) *
+				ldpc_dec->tb_params.c);
+		ldpc_dec->hard_output.length = (total_out_bits / 8) - 3;
+	}
+
+	num_code_blocks = ldpc_dec->tb_params.c;
+
+	bbdev_ipc_op->num_code_blocks = rte_cpu_to_be_32(num_code_blocks);
+
+	return 0;
+}
+
+static int
+enqueue_single_op(struct bbdev_la12xx_q_priv *q_priv, void *bbdev_op)
+{
+	struct bbdev_la12xx_private *priv = q_priv->bbdev_priv;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	ipc_instance_t *ipc_instance = ipc_priv->instance;
+	struct bbdev_ipc_dequeue_op *bbdev_ipc_op;
+	struct rte_bbdev_op_ldpc_enc *ldpc_enc;
+	struct rte_bbdev_op_ldpc_dec *ldpc_dec;
+	uint32_t q_id = q_priv->q_id;
+	uint32_t ci, ci_flag, pi, pi_flag;
+	ipc_ch_t *ch = &(ipc_instance->ch_list[q_id]);
+	ipc_br_md_t *md = &(ch->md);
+	size_t virt;
+	char *huge_start_addr =
+		(char *)q_priv->bbdev_priv->ipc_priv->hugepg_start.host_vaddr;
+	struct rte_bbdev_op_data *in_op_data, *out_op_data;
+	char *data_ptr;
+	uint32_t l1_pcie_addr;
+	int ret;
+
+	ci = IPC_GET_CI_INDEX(q_priv->host_ci);
+	ci_flag = IPC_GET_CI_FLAG(q_priv->host_ci);
+
+	pi = IPC_GET_PI_INDEX(q_priv->host_pi);
+	pi_flag = IPC_GET_PI_FLAG(q_priv->host_pi);
+
+	rte_bbdev_dp_log(DEBUG, "before bd_ring_full: pi: %u, ci: %u,"
+		"pi_flag: %u, ci_flag: %u, ring size: %u",
+		pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	if (is_bd_ring_full(ci, ci_flag, pi, pi_flag)) {
+		rte_bbdev_dp_log(DEBUG, "bd ring full for queue id: %d", q_id);
+		return IPC_CH_FULL;
+	}
+
+	virt = MODEM_P2V(q_priv->host_params->bd_m_modem_ptr[pi]);
+	bbdev_ipc_op = (struct bbdev_ipc_dequeue_op *)virt;
+	q_priv->bbdev_op[pi] = bbdev_op;
+
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		ldpc_enc = &(((struct rte_bbdev_enc_op *)bbdev_op)->ldpc_enc);
+		in_op_data = &ldpc_enc->input;
+		out_op_data = &ldpc_enc->output;
+
+		ret = prepare_ldpc_enc_op(bbdev_op, q_priv,
+					  in_op_data, out_op_data);
+		if (ret) {
+			rte_bbdev_log(ERR, "process_ldpc_enc_op fail, ret: %d",
+				ret);
+			return ret;
+		}
+		break;
+
+	case RTE_BBDEV_OP_LDPC_DEC:
+		ldpc_dec = &(((struct rte_bbdev_dec_op *)bbdev_op)->ldpc_dec);
+		in_op_data = &ldpc_dec->input;
+
+		out_op_data = &ldpc_dec->hard_output;
+
+		ret = prepare_ldpc_dec_op(bbdev_op, bbdev_ipc_op,
+					  q_priv, out_op_data);
+		if (ret) {
+			rte_bbdev_log(ERR, "process_ldpc_dec_op fail, ret: %d",
+				ret);
+			return ret;
+		}
+		break;
+
+	default:
+		rte_bbdev_log(ERR, "unsupported bbdev_ipc op type");
+		return -1;
+	}
+
+	if (in_op_data->data) {
+		data_ptr = rte_pktmbuf_mtod(in_op_data->data, char *);
+		l1_pcie_addr = (uint32_t)GUL_USER_HUGE_PAGE_ADDR +
+			       data_ptr - huge_start_addr;
+		bbdev_ipc_op->in_addr = l1_pcie_addr;
+		bbdev_ipc_op->in_len = in_op_data->length;
+	}
+
+	if (out_op_data->data) {
+		data_ptr = rte_pktmbuf_mtod(out_op_data->data, char *);
+		l1_pcie_addr = (uint32_t)GUL_USER_HUGE_PAGE_ADDR +
+				data_ptr - huge_start_addr;
+		bbdev_ipc_op->out_addr = rte_cpu_to_be_32(l1_pcie_addr);
+		bbdev_ipc_op->out_len = rte_cpu_to_be_32(out_op_data->length);
+	}
+
+	/* Move Producer Index forward */
+	pi++;
+	/* Flip the PI flag, if wrapping */
+	if (unlikely(q_priv->queue_size == pi)) {
+		pi = 0;
+		pi_flag = pi_flag ? 0 : 1;
+	}
+
+	if (pi_flag)
+		IPC_SET_PI_FLAG(pi);
+	else
+		IPC_RESET_PI_FLAG(pi);
+	q_priv->host_pi = pi;
+
+	/* Wait for Data Copy & pi_flag update to complete before updating pi */
+	rte_mb();
+	/* now update pi */
+	md->pi = rte_cpu_to_be_32(pi);
+
+	rte_bbdev_dp_log(DEBUG, "enter: pi: %u, ci: %u,"
+			"pi_flag: %u, ci_flag: %u, ring size: %u",
+			pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	return 0;
+}
+
+/* Enqueue decode burst */
+static uint16_t
+enqueue_dec_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_dec_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	int nb_enqueued, ret;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ret = enqueue_single_op(q_priv, ops[nb_enqueued]);
+		if (ret)
+			break;
+	}
+
+	q_data->queue_stats.enqueue_err_count += nb_ops - nb_enqueued;
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
+/* Enqueue encode burst */
+static uint16_t
+enqueue_enc_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_enc_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	int nb_enqueued, ret;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ret = enqueue_single_op(q_priv, ops[nb_enqueued]);
+		if (ret)
+			break;
+	}
+
+	q_data->queue_stats.enqueue_err_count += nb_ops - nb_enqueued;
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
+/* Dequeue encode burst */
+static void *
+dequeue_single_op(struct bbdev_la12xx_q_priv *q_priv, void *dst)
+{
+	void *op;
+	uint32_t ci, ci_flag;
+	uint32_t temp_ci;
+
+	temp_ci = q_priv->host_params->ci;
+	if (temp_ci == q_priv->host_ci)
+		return NULL;
+
+	ci = IPC_GET_CI_INDEX(q_priv->host_ci);
+	ci_flag = IPC_GET_CI_FLAG(q_priv->host_ci);
+
+	rte_bbdev_dp_log(DEBUG,
+		"ci: %u, ci_flag: %u, ring size: %u",
+		ci, ci_flag, q_priv->queue_size);
+
+	op = q_priv->bbdev_op[ci];
+
+	rte_memcpy(dst, q_priv->msg_ch_vaddr[ci],
+		sizeof(struct bbdev_ipc_enqueue_op));
+
+	/* Move Consumer Index forward */
+	ci++;
+	/* Flip the CI flag, if wrapping */
+	if (q_priv->queue_size == ci) {
+		ci = 0;
+		ci_flag = ci_flag ? 0 : 1;
+	}
+	if (ci_flag)
+		IPC_SET_CI_FLAG(ci);
+	else
+		IPC_RESET_CI_FLAG(ci);
+
+	q_priv->host_ci = ci;
+
+	rte_bbdev_dp_log(DEBUG,
+		"exit: ci: %u, ci_flag: %u, ring size: %u",
+		ci, ci_flag, q_priv->queue_size);
+
+	return op;
+}
+
+/* Dequeue decode burst */
+static uint16_t
+dequeue_dec_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_dec_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	struct bbdev_ipc_enqueue_op bbdev_ipc_op;
+	int nb_dequeued;
+
+	for (nb_dequeued = 0; nb_dequeued < nb_ops; nb_dequeued++) {
+		ops[nb_dequeued] = dequeue_single_op(q_priv, &bbdev_ipc_op);
+		if (!ops[nb_dequeued])
+			break;
+		ops[nb_dequeued]->status = bbdev_ipc_op.status;
+	}
+	q_data->queue_stats.dequeued_count += nb_dequeued;
+
+	return nb_dequeued;
+}
+
+/* Dequeue encode burst */
+static uint16_t
+dequeue_enc_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_enc_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	struct bbdev_ipc_enqueue_op bbdev_ipc_op;
+	int nb_enqueued;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ops[nb_enqueued] = dequeue_single_op(q_priv, &bbdev_ipc_op);
+		if (!ops[nb_enqueued])
+			break;
+		ops[nb_enqueued]->status = bbdev_ipc_op.status;
+	}
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
 static struct hugepage_info *
 get_hugepage_info(void)
 {
@@ -708,10 +1026,14 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 	bbdev->intr_handle = NULL;
 
 	/* register rx/tx burst functions for data path */
-	bbdev->dequeue_enc_ops = NULL;
-	bbdev->dequeue_dec_ops = NULL;
-	bbdev->enqueue_enc_ops = NULL;
-	bbdev->enqueue_dec_ops = NULL;
+	bbdev->dequeue_enc_ops = dequeue_enc_ops;
+	bbdev->dequeue_dec_ops = dequeue_dec_ops;
+	bbdev->enqueue_enc_ops = enqueue_enc_ops;
+	bbdev->enqueue_dec_ops = enqueue_dec_ops;
+	bbdev->dequeue_ldpc_enc_ops = dequeue_enc_ops;
+	bbdev->dequeue_ldpc_dec_ops = dequeue_dec_ops;
+	bbdev->enqueue_ldpc_enc_ops = enqueue_enc_ops;
+	bbdev->enqueue_ldpc_dec_ops = enqueue_dec_ops;
 
 	return 0;
 }
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
index 5f613fb087..b6a7f677d0 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -73,6 +73,25 @@ typedef struct {
 	_IOWR(GUL_IPC_MAGIC, 5, struct ipc_msg *)
 #define IOCTL_GUL_IPC_CHANNEL_RAISE_INTERRUPT _IOW(GUL_IPC_MAGIC, 6, int *)
 
+#define GUL_USER_HUGE_PAGE_OFFSET	(0)
+#define GUL_PCI1_ADDR_BASE	(0x00000000ULL)
+
+#define GUL_USER_HUGE_PAGE_ADDR	(GUL_PCI1_ADDR_BASE + GUL_USER_HUGE_PAGE_OFFSET)
+
+/* IPC PI/CI index & flag manipulation helpers */
+#define IPC_PI_CI_FLAG_MASK	0x80000000 /*  (1<<31) */
+#define IPC_PI_CI_INDEX_MASK	0x7FFFFFFF /* ~(1<<31) */
+
+#define IPC_SET_PI_FLAG(x)	(x |= IPC_PI_CI_FLAG_MASK)
+#define IPC_RESET_PI_FLAG(x)	(x &= IPC_PI_CI_INDEX_MASK)
+#define IPC_GET_PI_FLAG(x)	(x >> 31)
+#define IPC_GET_PI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
+
+#define IPC_SET_CI_FLAG(x)	(x |= IPC_PI_CI_FLAG_MASK)
+#define IPC_RESET_CI_FLAG(x)	(x &= IPC_PI_CI_INDEX_MASK)
+#define IPC_GET_CI_FLAG(x)	(x >> 31)
+#define IPC_GET_CI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
+
 /** buffer ring common metadata */
 typedef struct ipc_bd_ring_md {
 	volatile uint32_t pi;		/**< Producer index and flag (MSB)
@@ -180,6 +199,24 @@ struct bbdev_ipc_enqueue_op {
 	uint32_t rsvd;
 };
 
+/** Structure specifying dequeue operation (dequeue at LA1224) */
+struct bbdev_ipc_dequeue_op {
+	/** Input buffer memory address */
+	uint32_t in_addr;
+	/** Input buffer memory length */
+	uint32_t in_len;
+	/** Output buffer memory address */
+	uint32_t out_addr;
+	/** Output buffer memory length */
+	uint32_t out_len;
+	/* Number of code blocks. Only set when HARQ is used */
+	uint32_t num_code_blocks;
+	/** Dequeue Operation flags */
+	uint32_t op_flags;
+	/** Shared metadata between L1 and L2 */
+	uint32_t shared_metadata;
+};
+
 /* This shared memory would be on the host side which have copy of some
  * of the parameters which are also part of Shared BD ring. Read access
  * of these parameters from the host side would not be over PCI.
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v4 7/8] app/bbdev: enable la12xx for bbdev
  2021-04-24 10:36       ` [dpdk-dev] [PATCH v4 0/8] baseband: add " Hemant Agrawal
                           ` (5 preceding siblings ...)
  2021-04-24 10:36         ` [dpdk-dev] [PATCH v4 6/8] baseband/la12xx: add enqueue and dequeue support Hemant Agrawal
@ 2021-04-24 10:36         ` Hemant Agrawal
  2021-04-24 10:37         ` [dpdk-dev] [PATCH v4 8/8] app/bbdev: add test vectors for transport blocks Hemant Agrawal
  2021-05-05 12:31         ` [dpdk-dev] [EXT] [PATCH v4 0/8] baseband: add NXP LA12xx driver Akhil Goyal
  8 siblings, 0 replies; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-24 10:36 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, Hemant Agrawal

this patch adds la12xx driver in test bbdev

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/test-bbdev/meson.build | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/app/test-bbdev/meson.build b/app/test-bbdev/meson.build
index 57335641f0..75fd87ae2d 100644
--- a/app/test-bbdev/meson.build
+++ b/app/test-bbdev/meson.build
@@ -17,3 +17,6 @@ endif
 if dpdk_conf.has('RTE_BASEBAND_ACC100')
     deps += ['baseband_acc100']
 endif
+if dpdk_conf.has('RTE_LIBRTE_PMD_BBDEV_LA12XX')
+	deps += ['baseband_la12xx']
+endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v4 8/8] app/bbdev: add test vectors for transport blocks
  2021-04-24 10:36       ` [dpdk-dev] [PATCH v4 0/8] baseband: add " Hemant Agrawal
                           ` (6 preceding siblings ...)
  2021-04-24 10:36         ` [dpdk-dev] [PATCH v4 7/8] app/bbdev: enable la12xx for bbdev Hemant Agrawal
@ 2021-04-24 10:37         ` Hemant Agrawal
  2021-04-24 22:05           ` Chautru, Nicolas
  2021-05-05 12:31         ` [dpdk-dev] [EXT] [PATCH v4 0/8] baseband: add NXP LA12xx driver Akhil Goyal
  8 siblings, 1 reply; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-24 10:37 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, Nipun Gupta

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

This patch adds two test vectors for transport block in network byte
order:
- LDPC encode for Transport Block
- LDPC decode for Transport block

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 app/test-bbdev/test_vectors/ldpc_dec_tb.data | 122 +++++++++++++++++++
 app/test-bbdev/test_vectors/ldpc_enc_tb.data |  60 +++++++++
 2 files changed, 182 insertions(+)
 create mode 100644 app/test-bbdev/test_vectors/ldpc_dec_tb.data
 create mode 100644 app/test-bbdev/test_vectors/ldpc_enc_tb.data

diff --git a/app/test-bbdev/test_vectors/ldpc_dec_tb.data b/app/test-bbdev/test_vectors/ldpc_dec_tb.data
new file mode 100644
index 0000000000..4ec5020d04
--- /dev/null
+++ b/app/test-bbdev/test_vectors/ldpc_dec_tb.data
@@ -0,0 +1,122 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020 NXP
+
+op_type =
+RTE_BBDEV_OP_LDPC_DEC
+
+input0 =
+0x817f8181, 0x7f7f8181, 0x817f7f81, 0x81817f81, 0x81817f81, 0x817f7f81, 0x7f7f7f7f, 0x7f7f7f81,
+0x817f7f81, 0x817f7f81, 0x7f7f817f, 0x7f7f7f81, 0x81817f7f, 0x81818181, 0x817f8181, 0x7f817f81,
+0x81817f7f, 0x7f7f817f, 0x81817f81, 0x817f8181, 0x7f7f7f81, 0x817f817f, 0x7f817f7f, 0x7f817f7f,
+0x7f817f7f, 0x81817f7f, 0x7f818181, 0x817f7f7f, 0x8181817f, 0x81817f7f, 0x7f817f81, 0x7f7f7f7f,
+0x7f817f7f, 0x81817f7f, 0x81818181, 0x817f817f, 0x81817f7f, 0x7f81817f, 0x7f7f7f7f, 0x7f7f7f7f,
+0x7f818181, 0x7f7f7f81, 0x81817f81, 0x7f817f7f, 0x7f7f7f7f, 0x817f817f, 0x817f817f, 0x7f7f817f,
+0x81817f81, 0x7f7f7f7f, 0x7f81817f, 0x817f817f, 0x7f7f8181, 0x7f7f7f7f, 0x817f7f7f, 0x81818181,
+0x817f8181, 0x7f7f817f, 0x7f7f8181, 0x7f7f7f7f, 0x7f818181, 0x817f8181, 0x817f7f81, 0x817f8181,
+0x817f7f81, 0x81817f7f, 0x7f7f8181, 0x81818181, 0x817f817f, 0x817f7f7f, 0x81818181, 0x7f817f81,
+0x7f7f7f81, 0x81817f81, 0x7f817f7f, 0x7f818181, 0x7f7f7f81, 0x817f817f, 0x81818181, 0x81818181,
+0x81817f81, 0x81817f81, 0x7f7f8181, 0x817f7f7f, 0x7f81817f, 0x817f817f, 0x81817f7f, 0x817f7f81,
+0x81817f7f, 0x7f7f7f81, 0x7f817f81, 0x7f817f81, 0x817f7f7f, 0x7f818181, 0x81818181, 0x7f7f7f7f,
+0x7f7f7f7f, 0x8181817f, 0x7f7f7f81, 0x7f817f81, 0x81817f81, 0x7f7f817f, 0x7f81817f, 0x817f8181,
+0x7f81817f, 0x7f81817f, 0x817f7f7f, 0x7f81817f, 0x817f7f81, 0x817f7f81, 0x7f817f7f, 0x8181817f,
+0x7f81817f, 0x7f7f8181, 0x817f8181, 0x817f7f7f, 0x817f7f81, 0x7f81817f, 0x7f7f817f, 0x7f817f7f,
+0x7f7f8181, 0x81818181, 0x7f818181, 0x7f7f817f, 0x7f818181, 0x81818181, 0x7f817f7f, 0x817f817f,
+0x817f817f, 0x817f7f7f, 0x81817f81, 0x81817f7f, 0x81817f81, 0x7f817f81, 0x7f817f7f, 0x7f817f7f,
+0x817f7f7f, 0x817f7f7f, 0x7f7f7f7f, 0x7f7f7f81, 0x7f7f8181, 0x7f817f81, 0x7f817f7f, 0x817f7f7f,
+0x7f7f8181, 0x8181817f, 0x7f7f8181, 0x7f7f7f81, 0x817f7f7f, 0x7f7f7f81, 0x817f8181, 0x7f7f817f,
+0x7f81817f, 0x817f817f, 0x7f817f81, 0x7f7f8181, 0x7f818181, 0x7f817f81, 0x81818181, 0x81817f7f,
+0x7f81817f, 0x7f81817f, 0x7f7f8181, 0x81818181, 0x817f8181, 0x7f7f817f, 0x7f817f7f, 0x7f7f8181,
+0x7f81817f, 0x7f7f817f, 0x7f7f7f7f, 0x7f818181, 0x81817f7f, 0x8181817f, 0x7f81817f, 0x8181817f,
+0x81817f81, 0x7f7f7f7f, 0x81818181, 0x7f7f817f, 0x7f81817f, 0x7f7f7f7f, 0x81817f81, 0x817f7f81,
+0x817f7f81, 0x817f7f81, 0x81818181, 0x7f7f7f7f, 0x81817f81, 0x817f7f7f, 0x8181817f, 0x7f7f7f81,
+0x81817f81, 0x817f7f81, 0x81818181, 0x7f7f7f7f, 0x81817f7f, 0x81817f81, 0x7f7f7f81, 0x7f7f7f7f,
+0x817f817f, 0x7f818181, 0x8181817f, 0x81817f81, 0x7f7f7f81, 0x7f817f7f, 0x7f7f7f7f, 0x7f817f81,
+0x8181817f, 0x7f7f7f7f, 0x81817f7f, 0x7f7f7f81, 0x7f81817f, 0x7f7f7f7f, 0x7f7f7f81, 0x817f8181,
+0x7f7f8181, 0x7f7f7f81, 0x7f7f8181, 0x7f817f7f, 0x81818181, 0x7f81817f, 0x7f818181, 0x7f818181,
+0x7f818181, 0x817f7f81, 0x7f7f8181, 0x81818181, 0x7f7f7f7f, 0x7f7f7f7f, 0x817f8181, 0x81818181,
+0x7f7f817f, 0x817f8181, 0x81817f7f, 0x817f817f, 0x7f7f817f, 0x7f7f7f7f, 0x817f8181, 0x817f8181,
+0x817f8181, 0x81818181, 0x7f7f817f, 0x7f817f81, 0x817f7f81, 0x7f7f7f81, 0x81817f81, 0x7f818181,
+0x81817f7f, 0x7f818181, 0x81818181, 0x817f817f, 0x7f817f7f, 0x81818181, 0x817f8181, 0x7f7f7f7f,
+0x7f817f81, 0x817f7f7f, 0x7f818181, 0x8181817f, 0x817f817f, 0x7f817f7f, 0x817f7f81, 0x7f818181,
+0x817f7f7f, 0x817f7f81, 0x7f7f7f81, 0x81817f81, 0x7f81817f, 0x7f818181, 0x81817f7f, 0x817f7f81,
+0x81817f81, 0x7f7f8181, 0x7f7f8181, 0x7f817f81, 0x7f7f817f, 0x817f7f7f, 0x7f7f7f7f, 0x817f7f7f,
+0x7f7f8181, 0x817f8181, 0x817f8181, 0x7f817f81, 0x817f8181, 0x8181817f, 0x81817f7f, 0x7f817f7f,
+0x7f817f7f, 0x7f817f81, 0x817f817f, 0x817f7f7f, 0x8181817f, 0x817f817f, 0x817f7f81, 0x81817f7f,
+0x7f817f7f, 0x7f7f7f7f, 0x7f817f7f, 0x7f7f817f, 0x7f818181, 0x8181817f, 0x817f7f7f, 0x7f817f81,
+0x7f7f8181, 0x81817f7f, 0x7f7f817f, 0x7f7f817f, 0x7f817f7f, 0x7f7f817f, 0x7f818181, 0x7f817f7f,
+0x817f7f7f, 0x7f817f81, 0x81818181, 0x7f818181, 0x817f8181, 0x8181817f, 0x8181817f, 0x817f7f7f,
+0x81817f81, 0x817f7f7f, 0x7f81817f, 0x817f8181, 0x7f818181, 0x7f817f7f, 0x81817f7f, 0x7f81817f,
+0x81817f81, 0x7f7f7f81, 0x7f7f7f7f, 0x81818181, 0x817f7f7f, 0x81817f81, 0x817f7f81, 0x81817f7f,
+0x81818181, 0x7f7f7f7f, 0x817f817f, 0x7f817f81, 0x817f7f7f, 0x7f817f81, 0x817f8181, 0x7f81817f,
+0x7f818181, 0x7f7f8181, 0x817f817f, 0x7f7f7f7f, 0x81818181, 0x7f817f81, 0x81817f81, 0x7f81817f,
+0x81818181, 0x7f7f817f, 0x81818181, 0x7f7f7f81, 0x817f7f81, 0x8181817f, 0x7f818181, 0x7f7f7f7f,
+0x7f7f7f7f, 0x8181817f, 0x81817f81, 0x81818181, 0x7f7f817f, 0x81817f7f, 0x7f817f81, 0x817f8181,
+0x81817f7f, 0x7f817f7f, 0x817f7f7f, 0x7f81817f, 0x817f7f7f, 0x7f7f7f7f, 0x7f7f8181, 0x7f7f8181,
+0x7f81817f, 0x7f7f8181, 0x7f7f8181, 0x817f7f81, 0x8181817f, 0x81817f7f, 0x817f8181, 0x817f817f,
+0x8181817f, 0x7f7f8181, 0x7f81817f, 0x817f817f, 0x7f817f81, 0x7f817f7f, 0x7f7f8181, 0x81818181,
+0x7f817f81, 0x7f7f8181, 0x81817f7f, 0x7f7f7f81, 0x7f7f7f81, 0x7f7f7f7f, 0x7f81817f, 0x7f7f8181,
+0x7f7f817f, 0x817f817f, 0x7f7f7f7f, 0x817f8181, 0x7f818181, 0x7f7f817f, 0x8181817f, 0x8181817f,
+0x817f7f81, 0x8181817f, 0x817f8181, 0x7f817f7f, 0x81817f7f, 0x81818181, 0x7f7f8181, 0x7f817f81,
+0x817f8181, 0x7f817f7f, 0x81818181, 0x81817f81, 0x7f817f81, 0x81817f7f, 0x7f818181, 0x8181817f,
+0x7f7f7f81, 0x7f81817f, 0x7f7f8181, 0x81818181, 0x81817f7f, 0x817f8181, 0x81817f7f, 0x7f7f817f,
+0x81818181, 0x7f7f8181, 0x7f7f817f, 0x817f817f, 0x7f817f81, 0x7f7f7f7f, 0x7f817f81, 0x7f817f7f,
+0x7f81817f, 0x7f7f8181, 0x7f7f817f, 0x81818181, 0x7f7f8181, 0x817f7f81, 0x81817f81, 0x81817f7f,
+0x81817f81, 0x81818181, 0x7f817f81, 0x7f7f7f7f, 0x81817f7f, 0x7f817f7f, 0x7f7f817f, 0x81817f7f,
+0x81817f7f, 0x7f7f7f7f, 0x817f7f7f, 0x7f817f81, 0x81818181, 0x81817f7f, 0x7f817f7f, 0x8181817f,
+0x7f81817f, 0x817f7f81, 0x7f817f7f, 0x7f7f7f7f, 0x817f7f81, 0x7f817f81, 0x81818181, 0x81817f81,
+0x7f817f81, 0x81818181, 0x81818181, 0x8181817f, 0x7f7f817f, 0x817f7f7f, 0x817f7f7f, 0x7f7f7f7f,
+0x81818181, 0x7f817f7f, 0x817f7f81, 0x7f7f8181, 0x817f8181, 0x81817f7f, 0x81817f7f, 0x817f7f7f,
+0x817f817f, 0x7f818181, 0x7f817f7f, 0x817f8181, 0x7f817f7f, 0x817f8181, 0x7f7f817f, 0x81817f7f,
+0x8181817f, 0x7f817f81, 0x7f7f7f81, 0x81818181, 0x7f7f7f81, 0x81818181, 0x7f7f817f, 0x817f7f7f,
+0x817f817f, 0x7f7f8181, 0x7f7f7f81, 0x7f817f7f, 0x817f8181, 0x817f817f, 0x81818181, 0x81817f7f,
+
+output0 =
+0xea7bdad9, 0xabd8311a, 0x4e7ba2e2, 0x5c5c5c85, 0xc400ed50, 0x9bea8883, 0xb7f0
+
+basegraph=
+2
+
+z_c=
+28
+
+n_cb=
+1400
+
+q_m=
+2
+
+n_filler=
+56
+
+ea =
+2048
+
+eb =
+2048
+
+iter_max=
+8
+
+expected_iter_count=
+2
+
+c =
+1
+
+r =
+0
+
+cab =
+0
+
+rv_index =
+0
+
+code_block_mode =
+0
+
+op_flags =
+RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP, RTE_BBDEV_LDPC_LLR_COMPRESSION, RTE_BBDEV_LDPC_DEC_NETWORK_ORDER
+
+expected_status =
+OK
diff --git a/app/test-bbdev/test_vectors/ldpc_enc_tb.data b/app/test-bbdev/test_vectors/ldpc_enc_tb.data
new file mode 100644
index 0000000000..f3e883584a
--- /dev/null
+++ b/app/test-bbdev/test_vectors/ldpc_enc_tb.data
@@ -0,0 +1,60 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020 NXP
+
+op_type =
+RTE_BBDEV_OP_LDPC_ENC
+
+input0 =
+0xea7bdad9, 0xabd8311a, 0x4e7ba2e2, 0x5c5c5c85, 0xc400ed50, 0x9bea8883, 0xb7f0
+
+output0 =
+0x109dd93b, 0x5bfc1299, 0x44a1bd2c, 0x05ce87c4, 0x006cafc4, 0x2aa04d17, 0xf803a60d, 0xb9b7032b,
+0x5f8af3c9, 0xffa174d1, 0x9ca683dd, 0x0f78551c, 0xb62d51e0, 0xe4996866, 0x42698b36, 0xa4f727f3,
+0x445dcd8a, 0x84531088, 0x2b1813e3, 0xcf5735a6, 0x342bf366, 0xe6ec7026, 0x9d062f0d, 0x1e8d0f99,
+0x01dc0f9d, 0x5041de7a, 0xb1061c0e, 0x776f4313, 0xfb00f397, 0xbb02acb2, 0x7d1952fb, 0x0bf4af7c,
+0x794ae785, 0x9c76d198, 0x8082533d, 0x4ceb5bb3, 0xc9ae8a54, 0x58e72404, 0x472422c3, 0x8eeb7f58,
+0x6c47b68d, 0xc9d8f01d, 0x6b585a0f, 0x6d5f0a37, 0x07e91f2f, 0xb5c2fde0, 0x3308684c, 0xabce9336,
+0xf345a63e, 0x36011c35, 0xee27b0a2, 0x53fc4be9, 0xe7c5df4b, 0x2cbcf361, 0x4505a23f, 0xcd93f236,
+0xc24c05fd, 0xe4cf580c, 0xdf590496, 0x0882eff5, 0x8ccb394f, 0xc2b4b47a, 0x82f1f15e, 0xcfab413a
+
+basegraph=
+2
+
+z_c=
+28
+
+n_cb=
+1400
+
+q_m=
+2
+
+n_filler=
+56
+
+ea =
+2048
+
+eb =
+2048
+
+c =
+1
+
+r =
+0
+
+cab =
+0
+
+rv_index =
+0
+
+code_block_mode =
+0
+
+op_flags =
+RTE_BBDEV_LDPC_CRC_24B_ATTACH, RTE_BBDEV_LDPC_ENC_NETWORK_ORDER
+
+expected_status =
+OK
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v4 1/8] bbdev: add network order data capability
  2021-04-24 10:36         ` [dpdk-dev] [PATCH v4 1/8] bbdev: add network order data capability Hemant Agrawal
@ 2021-04-24 21:59           ` Chautru, Nicolas
  2021-04-25 16:14             ` Thomas Monjalon
  2021-04-26 17:01           ` Dave Burley
  1 sibling, 1 reply; 157+ messages in thread
From: Chautru, Nicolas @ 2021-04-24 21:59 UTC (permalink / raw)
  To: Hemant Agrawal, dev, gakhil, thomas; +Cc: david.marchand, Tom Rix, Dave Burley

+ Thomas, Akhil

In case this is for release 21.05 isn't it a bit late for introducing a new API change?


> -----Original Message-----
> From: Hemant Agrawal <hemant.agrawal@nxp.com>
> Sent: Saturday, April 24, 2021 3:37 AM
> To: dev@dpdk.org; gakhil@marvell.com; Chautru, Nicolas
> <nicolas.chautru@intel.com>
> Cc: david.marchand@redhat.com; Hemant Agrawal
> <hemant.agrawal@nxp.com>
> Subject: [PATCH v4 1/8] bbdev: add network order data capability
> 
> This patch intoduces a new capability of the bbdev device to process the
> LDPC data in network byte order.
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>  doc/guides/bbdevs/features/default.ini | 1 +
>  doc/guides/prog_guide/bbdev.rst        | 6 ++++++
>  lib/bbdev/rte_bbdev_op.h               | 8 ++++++--
>  3 files changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/doc/guides/bbdevs/features/default.ini
> b/doc/guides/bbdevs/features/default.ini
> index 5fe267a625..e5da644099 100644
> --- a/doc/guides/bbdevs/features/default.ini
> +++ b/doc/guides/bbdevs/features/default.ini
> @@ -14,3 +14,4 @@ LLR/HARQ Compression   =
>  External DDR Access    =
>  HW Accelerated         =
>  BBDEV API              =
> +Network Order Data     =
> diff --git a/doc/guides/prog_guide/bbdev.rst
> b/doc/guides/prog_guide/bbdev.rst index 6b2bd54e1a..89a86d10fb 100644
> --- a/doc/guides/prog_guide/bbdev.rst
> +++ b/doc/guides/prog_guide/bbdev.rst
> @@ -747,6 +747,9 @@ given below.
>  |RTE_BBDEV_LDPC_ENC_CONCATENATION                                    |
>  | Set if a device supports concatenation of non byte aligned output  |  +------
> --------------------------------------------------------------+
> +|RTE_BBDEV_LDPC_ENC_NETWORK_ORDER                                    |
> +| Set if a device supports network order data processing             |
> ++--------------------------------------------------------------------+

I don't believe this is an extra capability extension per se here, but actually a different assumption. Tell me if I misinterpret the intent of your serie. 
From looking at the PMD I assume that you may mean " Set when a device `requires` network order data processing"
Basically the distinction I am trying to highlight is that it depends whether we want to expose this as an incremental dynamic operation flag that you can set at run time (enqueue ...), or whether this is more of distinct assumption that may be different for each PMD (either one of the other). 
I assume this is the later, please confirm. Ie I assume that your PMD would not be able to process the data in case this is presented with other endianness (ie you don't check ever that flag in the op_flag in your driver), in that case your driver would fail many existing unit test if considered as an additional capability on top of default one. You probably see such failures if you have tried to run the regression which would confirm the issue. 
In that case we may want discuss whether this is not actually more something to be capture under `struct rte_bbdev_driver_info` as a bool endianness. Both arguably may work but later arguably closer to the suggested intent and less convoluted.  Worth discussing further/
But basically if as this under that structure that would be exposed the same way as different LLR numerical assumption and that can be handled gracefulyl in the application/bbdev-test. 
+ Tom Rix, Dave Burley 


> 
>  The structure passed for each LDPC encode operation is given below,  with
> the operation flags forming a bitmask in the ``op_flags`` field.
> @@ -942,6 +945,9 @@ given below.
>  |RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_LOOPBACK                        |
>  | Set if a device supports loopback access to HARQ internal memory   |
>  +--------------------------------------------------------------------+
> +|RTE_BBDEV_LDPC_DEC_NETWORK_ORDER                                    |
> +| Set if a device supports network order data processing             |
> ++--------------------------------------------------------------------+
> 
>  The structure passed for each LDPC decode operation is given below,  with
> the operation flags forming a bitmask in the ``op_flags`` field.
> diff --git a/lib/bbdev/rte_bbdev_op.h b/lib/bbdev/rte_bbdev_op.h index
> f946842727..8fab617768 100644
> --- a/lib/bbdev/rte_bbdev_op.h
> +++ b/lib/bbdev/rte_bbdev_op.h
> @@ -186,7 +186,9 @@ enum rte_bbdev_op_ldpcdec_flag_bitmasks {
>  	 *  for HARQ memory. If not set, it is assumed the filler bits are not
>  	 *  in HARQ memory and handled directly by the LDPC decoder.
>  	 */
> -	RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS = (1ULL <<
> 18)
> +	RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS = (1ULL <<
> 18),
> +	/** Set if a device supports network order data processing */
> +	RTE_BBDEV_LDPC_DEC_NETWORK_ORDER = (1ULL << 19)
>  };
> 
>  /** Flags for LDPC encoder operation and capability structure */ @@ -206,7
> +208,9 @@ enum rte_bbdev_op_ldpcenc_flag_bitmasks {
>  	/** Set if a device supports scatter-gather functionality. */
>  	RTE_BBDEV_LDPC_ENC_SCATTER_GATHER = (1ULL << 6),
>  	/** Set if a device supports concatenation of non byte aligned output
> */
> -	RTE_BBDEV_LDPC_ENC_CONCATENATION = (1ULL << 7)
> +	RTE_BBDEV_LDPC_ENC_CONCATENATION = (1ULL << 7),
> +	/** Set if a device supports network order data processing */
> +	RTE_BBDEV_LDPC_ENC_NETWORK_ORDER = (1ULL << 8)
>  };
> 
>  /** Flags for the Code Block/Transport block mode  */
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v4 8/8] app/bbdev: add test vectors for transport blocks
  2021-04-24 10:37         ` [dpdk-dev] [PATCH v4 8/8] app/bbdev: add test vectors for transport blocks Hemant Agrawal
@ 2021-04-24 22:05           ` Chautru, Nicolas
  0 siblings, 0 replies; 157+ messages in thread
From: Chautru, Nicolas @ 2021-04-24 22:05 UTC (permalink / raw)
  To: Hemant Agrawal, dev, gakhil; +Cc: david.marchand, Nipun Gupta, Tom Rix



> -----Original Message-----
> From: Hemant Agrawal <hemant.agrawal@nxp.com>
> Sent: Saturday, April 24, 2021 3:37 AM
> 
> From: Nipun Gupta <nipun.gupta@nxp.com>
> 
> This patch adds two test vectors for transport block in network byte
> order:
> - LDPC encode for Transport Block
> - LDPC decode for Transport block
> 
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---

See related comment on patch 1. 
Assuming this is a different PMD assumption (not an incremental one) then this should not require new vectors with the op_flag  RTE_BBDEV_LDPC_ENC_NETWORK_ORDER. 
These would artificially create non-compatible vectors for no reason.
But all existing vectors should be able to run on any PMD, the test framework will just change order endianness based on what is supported by the device so that all unit test can be run successfully on any PMD. See how it is done for LLR numerical assumptions which can differ between PMDs. 
Let me know if unclear

>  app/test-bbdev/test_vectors/ldpc_dec_tb.data | 122
> +++++++++++++++++++  app/test-bbdev/test_vectors/ldpc_enc_tb.data |
> 60 +++++++++
>  2 files changed, 182 insertions(+)
>  create mode 100644 app/test-bbdev/test_vectors/ldpc_dec_tb.data
>  create mode 100644 app/test-bbdev/test_vectors/ldpc_enc_tb.data
> 
> diff --git a/app/test-bbdev/test_vectors/ldpc_dec_tb.data b/app/test-
> bbdev/test_vectors/ldpc_dec_tb.data
> new file mode 100644
> index 0000000000..4ec5020d04
> --- /dev/null
> +++ b/app/test-bbdev/test_vectors/ldpc_dec_tb.data
> @@ -0,0 +1,122 @@
> +# SPDX-License-Identifier: BSD-3-Clause # Copyright 2020 NXP
> +
> +op_type =
> +RTE_BBDEV_OP_LDPC_DEC
> +
> +input0 =
> +0x817f8181, 0x7f7f8181, 0x817f7f81, 0x81817f81, 0x81817f81, 0x817f7f81,
> +0x7f7f7f7f, 0x7f7f7f81, 0x817f7f81, 0x817f7f81, 0x7f7f817f, 0x7f7f7f81,
> +0x81817f7f, 0x81818181, 0x817f8181, 0x7f817f81, 0x81817f7f, 0x7f7f817f,
> +0x81817f81, 0x817f8181, 0x7f7f7f81, 0x817f817f, 0x7f817f7f, 0x7f817f7f,
> +0x7f817f7f, 0x81817f7f, 0x7f818181, 0x817f7f7f, 0x8181817f, 0x81817f7f,
> +0x7f817f81, 0x7f7f7f7f, 0x7f817f7f, 0x81817f7f, 0x81818181, 0x817f817f,
> +0x81817f7f, 0x7f81817f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f818181, 0x7f7f7f81,
> +0x81817f81, 0x7f817f7f, 0x7f7f7f7f, 0x817f817f, 0x817f817f, 0x7f7f817f,
> +0x81817f81, 0x7f7f7f7f, 0x7f81817f, 0x817f817f, 0x7f7f8181, 0x7f7f7f7f,
> +0x817f7f7f, 0x81818181, 0x817f8181, 0x7f7f817f, 0x7f7f8181, 0x7f7f7f7f,
> +0x7f818181, 0x817f8181, 0x817f7f81, 0x817f8181, 0x817f7f81, 0x81817f7f,
> +0x7f7f8181, 0x81818181, 0x817f817f, 0x817f7f7f, 0x81818181, 0x7f817f81,
> +0x7f7f7f81, 0x81817f81, 0x7f817f7f, 0x7f818181, 0x7f7f7f81, 0x817f817f,
> +0x81818181, 0x81818181, 0x81817f81, 0x81817f81, 0x7f7f8181, 0x817f7f7f,
> +0x7f81817f, 0x817f817f, 0x81817f7f, 0x817f7f81, 0x81817f7f, 0x7f7f7f81,
> +0x7f817f81, 0x7f817f81, 0x817f7f7f, 0x7f818181, 0x81818181, 0x7f7f7f7f,
> +0x7f7f7f7f, 0x8181817f, 0x7f7f7f81, 0x7f817f81, 0x81817f81, 0x7f7f817f,
> +0x7f81817f, 0x817f8181, 0x7f81817f, 0x7f81817f, 0x817f7f7f, 0x7f81817f,
> +0x817f7f81, 0x817f7f81, 0x7f817f7f, 0x8181817f, 0x7f81817f, 0x7f7f8181,
> +0x817f8181, 0x817f7f7f, 0x817f7f81, 0x7f81817f, 0x7f7f817f, 0x7f817f7f,
> +0x7f7f8181, 0x81818181, 0x7f818181, 0x7f7f817f, 0x7f818181, 0x81818181,
> +0x7f817f7f, 0x817f817f, 0x817f817f, 0x817f7f7f, 0x81817f81, 0x81817f7f,
> +0x81817f81, 0x7f817f81, 0x7f817f7f, 0x7f817f7f, 0x817f7f7f, 0x817f7f7f,
> +0x7f7f7f7f, 0x7f7f7f81, 0x7f7f8181, 0x7f817f81, 0x7f817f7f, 0x817f7f7f,
> +0x7f7f8181, 0x8181817f, 0x7f7f8181, 0x7f7f7f81, 0x817f7f7f, 0x7f7f7f81,
> +0x817f8181, 0x7f7f817f, 0x7f81817f, 0x817f817f, 0x7f817f81, 0x7f7f8181,
> +0x7f818181, 0x7f817f81, 0x81818181, 0x81817f7f, 0x7f81817f, 0x7f81817f,
> +0x7f7f8181, 0x81818181, 0x817f8181, 0x7f7f817f, 0x7f817f7f, 0x7f7f8181,
> +0x7f81817f, 0x7f7f817f, 0x7f7f7f7f, 0x7f818181, 0x81817f7f, 0x8181817f,
> +0x7f81817f, 0x8181817f, 0x81817f81, 0x7f7f7f7f, 0x81818181, 0x7f7f817f,
> +0x7f81817f, 0x7f7f7f7f, 0x81817f81, 0x817f7f81, 0x817f7f81, 0x817f7f81,
> +0x81818181, 0x7f7f7f7f, 0x81817f81, 0x817f7f7f, 0x8181817f, 0x7f7f7f81,
> +0x81817f81, 0x817f7f81, 0x81818181, 0x7f7f7f7f, 0x81817f7f, 0x81817f81,
> +0x7f7f7f81, 0x7f7f7f7f, 0x817f817f, 0x7f818181, 0x8181817f, 0x81817f81,
> +0x7f7f7f81, 0x7f817f7f, 0x7f7f7f7f, 0x7f817f81, 0x8181817f, 0x7f7f7f7f,
> +0x81817f7f, 0x7f7f7f81, 0x7f81817f, 0x7f7f7f7f, 0x7f7f7f81, 0x817f8181,
> +0x7f7f8181, 0x7f7f7f81, 0x7f7f8181, 0x7f817f7f, 0x81818181, 0x7f81817f,
> +0x7f818181, 0x7f818181, 0x7f818181, 0x817f7f81, 0x7f7f8181, 0x81818181,
> +0x7f7f7f7f, 0x7f7f7f7f, 0x817f8181, 0x81818181, 0x7f7f817f, 0x817f8181,
> +0x81817f7f, 0x817f817f, 0x7f7f817f, 0x7f7f7f7f, 0x817f8181, 0x817f8181,
> +0x817f8181, 0x81818181, 0x7f7f817f, 0x7f817f81, 0x817f7f81, 0x7f7f7f81,
> +0x81817f81, 0x7f818181, 0x81817f7f, 0x7f818181, 0x81818181, 0x817f817f,
> +0x7f817f7f, 0x81818181, 0x817f8181, 0x7f7f7f7f, 0x7f817f81, 0x817f7f7f,
> +0x7f818181, 0x8181817f, 0x817f817f, 0x7f817f7f, 0x817f7f81, 0x7f818181,
> +0x817f7f7f, 0x817f7f81, 0x7f7f7f81, 0x81817f81, 0x7f81817f, 0x7f818181,
> +0x81817f7f, 0x817f7f81, 0x81817f81, 0x7f7f8181, 0x7f7f8181, 0x7f817f81,
> +0x7f7f817f, 0x817f7f7f, 0x7f7f7f7f, 0x817f7f7f, 0x7f7f8181, 0x817f8181,
> +0x817f8181, 0x7f817f81, 0x817f8181, 0x8181817f, 0x81817f7f, 0x7f817f7f,
> +0x7f817f7f, 0x7f817f81, 0x817f817f, 0x817f7f7f, 0x8181817f, 0x817f817f,
> +0x817f7f81, 0x81817f7f, 0x7f817f7f, 0x7f7f7f7f, 0x7f817f7f, 0x7f7f817f,
> +0x7f818181, 0x8181817f, 0x817f7f7f, 0x7f817f81, 0x7f7f8181, 0x81817f7f,
> +0x7f7f817f, 0x7f7f817f, 0x7f817f7f, 0x7f7f817f, 0x7f818181, 0x7f817f7f,
> +0x817f7f7f, 0x7f817f81, 0x81818181, 0x7f818181, 0x817f8181, 0x8181817f,
> +0x8181817f, 0x817f7f7f, 0x81817f81, 0x817f7f7f, 0x7f81817f, 0x817f8181,
> +0x7f818181, 0x7f817f7f, 0x81817f7f, 0x7f81817f, 0x81817f81, 0x7f7f7f81,
> +0x7f7f7f7f, 0x81818181, 0x817f7f7f, 0x81817f81, 0x817f7f81, 0x81817f7f,
> +0x81818181, 0x7f7f7f7f, 0x817f817f, 0x7f817f81, 0x817f7f7f, 0x7f817f81,
> +0x817f8181, 0x7f81817f, 0x7f818181, 0x7f7f8181, 0x817f817f, 0x7f7f7f7f,
> +0x81818181, 0x7f817f81, 0x81817f81, 0x7f81817f, 0x81818181, 0x7f7f817f,
> +0x81818181, 0x7f7f7f81, 0x817f7f81, 0x8181817f, 0x7f818181, 0x7f7f7f7f,
> +0x7f7f7f7f, 0x8181817f, 0x81817f81, 0x81818181, 0x7f7f817f, 0x81817f7f,
> +0x7f817f81, 0x817f8181, 0x81817f7f, 0x7f817f7f, 0x817f7f7f, 0x7f81817f,
> +0x817f7f7f, 0x7f7f7f7f, 0x7f7f8181, 0x7f7f8181, 0x7f81817f, 0x7f7f8181,
> +0x7f7f8181, 0x817f7f81, 0x8181817f, 0x81817f7f, 0x817f8181, 0x817f817f,
> +0x8181817f, 0x7f7f8181, 0x7f81817f, 0x817f817f, 0x7f817f81, 0x7f817f7f,
> +0x7f7f8181, 0x81818181, 0x7f817f81, 0x7f7f8181, 0x81817f7f, 0x7f7f7f81,
> +0x7f7f7f81, 0x7f7f7f7f, 0x7f81817f, 0x7f7f8181, 0x7f7f817f, 0x817f817f,
> +0x7f7f7f7f, 0x817f8181, 0x7f818181, 0x7f7f817f, 0x8181817f, 0x8181817f,
> +0x817f7f81, 0x8181817f, 0x817f8181, 0x7f817f7f, 0x81817f7f, 0x81818181,
> +0x7f7f8181, 0x7f817f81, 0x817f8181, 0x7f817f7f, 0x81818181, 0x81817f81,
> +0x7f817f81, 0x81817f7f, 0x7f818181, 0x8181817f, 0x7f7f7f81, 0x7f81817f,
> +0x7f7f8181, 0x81818181, 0x81817f7f, 0x817f8181, 0x81817f7f, 0x7f7f817f,
> +0x81818181, 0x7f7f8181, 0x7f7f817f, 0x817f817f, 0x7f817f81, 0x7f7f7f7f,
> +0x7f817f81, 0x7f817f7f, 0x7f81817f, 0x7f7f8181, 0x7f7f817f, 0x81818181,
> +0x7f7f8181, 0x817f7f81, 0x81817f81, 0x81817f7f, 0x81817f81, 0x81818181,
> +0x7f817f81, 0x7f7f7f7f, 0x81817f7f, 0x7f817f7f, 0x7f7f817f, 0x81817f7f,
> +0x81817f7f, 0x7f7f7f7f, 0x817f7f7f, 0x7f817f81, 0x81818181, 0x81817f7f,
> +0x7f817f7f, 0x8181817f, 0x7f81817f, 0x817f7f81, 0x7f817f7f, 0x7f7f7f7f,
> +0x817f7f81, 0x7f817f81, 0x81818181, 0x81817f81, 0x7f817f81, 0x81818181,
> +0x81818181, 0x8181817f, 0x7f7f817f, 0x817f7f7f, 0x817f7f7f, 0x7f7f7f7f,
> +0x81818181, 0x7f817f7f, 0x817f7f81, 0x7f7f8181, 0x817f8181, 0x81817f7f,
> +0x81817f7f, 0x817f7f7f, 0x817f817f, 0x7f818181, 0x7f817f7f, 0x817f8181,
> +0x7f817f7f, 0x817f8181, 0x7f7f817f, 0x81817f7f, 0x8181817f, 0x7f817f81,
> +0x7f7f7f81, 0x81818181, 0x7f7f7f81, 0x81818181, 0x7f7f817f, 0x817f7f7f,
> +0x817f817f, 0x7f7f8181, 0x7f7f7f81, 0x7f817f7f, 0x817f8181, 0x817f817f,
> +0x81818181, 0x81817f7f,
> +
> +output0 =
> +0xea7bdad9, 0xabd8311a, 0x4e7ba2e2, 0x5c5c5c85, 0xc400ed50,
> 0x9bea8883,
> +0xb7f0
> +
> +basegraph=
> +2
> +
> +z_c=
> +28
> +
> +n_cb=
> +1400
> +
> +q_m=
> +2
> +
> +n_filler=
> +56
> +
> +ea =
> +2048
> +
> +eb =
> +2048
> +
> +iter_max=
> +8
> +
> +expected_iter_count=
> +2
> +
> +c =
> +1
> +
> +r =
> +0
> +
> +cab =
> +0
> +
> +rv_index =
> +0
> +
> +code_block_mode =
> +0
> +
> +op_flags =
> +RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP,
> RTE_BBDEV_LDPC_LLR_COMPRESSION,

Is there really LLR compression in that vector? It doesn't look like it from looking at the data. It looks like saturated S8 integer format. 

> +RTE_BBDEV_LDPC_DEC_NETWORK_ORDER
> +
> +expected_status =
> +OK
> diff --git a/app/test-bbdev/test_vectors/ldpc_enc_tb.data b/app/test-
> bbdev/test_vectors/ldpc_enc_tb.data
> new file mode 100644
> index 0000000000..f3e883584a
> --- /dev/null
> +++ b/app/test-bbdev/test_vectors/ldpc_enc_tb.data
> @@ -0,0 +1,60 @@
> +# SPDX-License-Identifier: BSD-3-Clause # Copyright 2020 NXP
> +
> +op_type =
> +RTE_BBDEV_OP_LDPC_ENC
> +
> +input0 =
> +0xea7bdad9, 0xabd8311a, 0x4e7ba2e2, 0x5c5c5c85, 0xc400ed50,
> 0x9bea8883,
> +0xb7f0
> +
> +output0 =
> +0x109dd93b, 0x5bfc1299, 0x44a1bd2c, 0x05ce87c4, 0x006cafc4, 0x2aa04d17,
> +0xf803a60d, 0xb9b7032b, 0x5f8af3c9, 0xffa174d1, 0x9ca683dd, 0x0f78551c,
> +0xb62d51e0, 0xe4996866, 0x42698b36, 0xa4f727f3, 0x445dcd8a, 0x84531088,
> +0x2b1813e3, 0xcf5735a6, 0x342bf366, 0xe6ec7026, 0x9d062f0d, 0x1e8d0f99,
> +0x01dc0f9d, 0x5041de7a, 0xb1061c0e, 0x776f4313, 0xfb00f397, 0xbb02acb2,
> +0x7d1952fb, 0x0bf4af7c, 0x794ae785, 0x9c76d198, 0x8082533d, 0x4ceb5bb3,
> +0xc9ae8a54, 0x58e72404, 0x472422c3, 0x8eeb7f58, 0x6c47b68d, 0xc9d8f01d,
> +0x6b585a0f, 0x6d5f0a37, 0x07e91f2f, 0xb5c2fde0, 0x3308684c, 0xabce9336,
> +0xf345a63e, 0x36011c35, 0xee27b0a2, 0x53fc4be9, 0xe7c5df4b, 0x2cbcf361,
> +0x4505a23f, 0xcd93f236, 0xc24c05fd, 0xe4cf580c, 0xdf590496, 0x0882eff5,
> +0x8ccb394f, 0xc2b4b47a, 0x82f1f15e, 0xcfab413a
> +
> +basegraph=
> +2
> +
> +z_c=
> +28
> +
> +n_cb=
> +1400
> +
> +q_m=
> +2
> +
> +n_filler=
> +56
> +
> +ea =
> +2048
> +
> +eb =
> +2048
> +
> +c =
> +1
> +
> +r =
> +0
> +
> +cab =
> +0
> +
> +rv_index =
> +0
> +
> +code_block_mode =
> +0
> +
> +op_flags =
> +RTE_BBDEV_LDPC_CRC_24B_ATTACH,
> RTE_BBDEV_LDPC_ENC_NETWORK_ORDER
> +
> +expected_status =
> +OK
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v4 5/8] baseband/la12xx: add queue and modem config support
  2021-04-24 10:36         ` [dpdk-dev] [PATCH v4 5/8] baseband/la12xx: add queue and modem config support Hemant Agrawal
@ 2021-04-24 22:12           ` Chautru, Nicolas
  2021-05-13 11:01             ` Nipun Gupta
  0 siblings, 1 reply; 157+ messages in thread
From: Chautru, Nicolas @ 2021-04-24 22:12 UTC (permalink / raw)
  To: Hemant Agrawal, dev, gakhil; +Cc: david.marchand, Nipun Gupta



> -----Original Message-----
> From: Hemant Agrawal <hemant.agrawal@nxp.com>
> Sent: Saturday, April 24, 2021 3:37 AM
> Subject: [PATCH v4 5/8] baseband/la12xx: add queue and modem config
> support
> 
> This patch add support for connecting with modem and creating the ipc
> channel as queues with modem for the exchange of data.
> 
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>  doc/guides/bbdevs/index.rst                |   1 +
>  doc/guides/bbdevs/la12xx.rst               |  81 +++
>  doc/guides/rel_notes/release_21_05.rst     |   5 +
>  drivers/baseband/la12xx/bbdev_la12xx.c     | 552 ++++++++++++++++++++-
>  drivers/baseband/la12xx/bbdev_la12xx.h     |  11 +-
>  drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 189 ++++++-
>  6 files changed, 829 insertions(+), 10 deletions(-)  create mode 100644
> doc/guides/bbdevs/la12xx.rst
> 
> diff --git a/doc/guides/bbdevs/index.rst b/doc/guides/bbdevs/index.rst
> index 4445cbd1b0..cedd706fa6 100644
> --- a/doc/guides/bbdevs/index.rst
> +++ b/doc/guides/bbdevs/index.rst
> @@ -14,3 +14,4 @@ Baseband Device Drivers
>      fpga_lte_fec
>      fpga_5gnr_fec
>      acc100
> +    la12xx
> diff --git a/doc/guides/bbdevs/la12xx.rst b/doc/guides/bbdevs/la12xx.rst
> new file mode 100644 index 0000000000..3c9ac5c047
> --- /dev/null
> +++ b/doc/guides/bbdevs/la12xx.rst
> @@ -0,0 +1,81 @@
> +..  SPDX-License-Identifier: BSD-3-Clause
> +    Copyright 2021 NXP
> +
> +NXP LA12xx Poll Mode Driver
> +=======================================
> +
> +The BBDEV LA12xx poll mode driver (PMD) supports an implementation for
> +offloading High Phy processing functions like LDPC Encode / Decode 5GNR
> +wireless acceleration function, using PCI based LA12xx Software defined
> radio.
> +
> +More information can be found at `NXP Official Website
> +<https://www.nxp.com/products/processors-and-microcontrollers/arm-
> processors/layerscape-processors/layerscape-access-la1200-programmable-
> baseband-processor:LA1200>`_.
> +
> +Features
> +--------
> +
> +LA12xx PMD supports the following features:
> +
> +- Maximum of 8 UL queues
> +- Maximum of 8 DL queues
> +- PCIe Gen-3 x8 Interface
> +- MSI-X
> +
> +Installation
> +------------
> +
> +Section 3 of the DPDK manual provides instructions on installing and
> compiling DPDK.
> +
> +DPDK requires hugepages to be configured as detailed in section 2 of the
> DPDK manual.
> +
> +Initialization
> +--------------
> +
> +The device can be listed on the host console with:
> +
> +
> +Use the following lspci command to get the multiple LA12xx processor
> +ids. The device ID of the LA12xx baseband processor is "1c30".
> +
> +.. code-block:: console
> +
> +  sudo lspci -nn
> +
> +...
> +0001:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device
> +[1957:1c30] ( rev 10) ...
> +0002:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device
> +[1957:1c30] ( rev 10)
> +
> +
> +Prerequisites
> +-------------
> +
> +Currently supported by DPDK:
> +
> +- NXP LA1224 BSP **1.0+**.
> +- NXP LA1224 PCIe Modem card connected to ARM host.
> +
> +- Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to
> setup the basic DPDK environment.
> +
> +* Use dev arg option ``modem=0`` to identify the modem instance for a
> +given
> +  device. This is required only if more than 1 modem cards are attached to
> host.
> +  this is optional and the default value is 0.
> +  e.g. ``--vdev=baseband_la12xx,modem=0``
> +
> +* Use dev arg option ``max_nb_queues=x`` to specify the maximum
> number
> +of queues
> +  to be used for communication with offload device i.e. modem. default is
> 16.
> +  e.g. ``--vdev=baseband_la12xx,max_nb_queues=4``
> +
> +Enabling logs
> +-------------
> +
> +For enabling logs, use the following EAL parameter:
> +
> +.. code-block:: console
> +
> +   ./your_bbdev_application <EAL args> --log-level=la12xx:<level>
> +
> +Using ``bb.la12xx`` as log matching criteria, all Baseband PMD logs can
> +be enabled which are lower than logging ``level``.
> diff --git a/doc/guides/rel_notes/release_21_05.rst
> b/doc/guides/rel_notes/release_21_05.rst
> index b3224dc332..4e0b62debb 100644
> --- a/doc/guides/rel_notes/release_21_05.rst
> +++ b/doc/guides/rel_notes/release_21_05.rst
> @@ -236,6 +236,11 @@ New Features
>    the hash function used in NICs to spread the traffic among the queues.
>    It can be used to get predictable mapping of the flows.
> 
> +* **Added NXP LA12xx baseband PMD.**
> +
> +  * Added a new baseband PMD driver for NXP LA12xx Software defined
> radio.
> +  * See the :doc:`../bbdevs/la12xx` for more details.
> +
>  * **Updated testpmd.**
> 
>    * Added a command line option to configure forced speed for Ethernet
> port.
> diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c
> b/drivers/baseband/la12xx/bbdev_la12xx.c
> index f26f3f2a08..1fdeca279e 100644
> --- a/drivers/baseband/la12xx/bbdev_la12xx.c
> +++ b/drivers/baseband/la12xx/bbdev_la12xx.c
> @@ -3,6 +3,11 @@
>   */
> 
>  #include <string.h>
> +#include <unistd.h>
> +#include <fcntl.h>
> +#include <sys/ioctl.h>
> +#include <sys/mman.h>
> +#include <dirent.h>
> 
>  #include <rte_common.h>
>  #include <rte_bus_vdev.h>
> @@ -31,11 +36,549 @@ struct bbdev_la12xx_params {
>  #define LA12XX_VDEV_MODEM_ID_ARG	"modem"
>  #define LA12XX_MAX_MODEM 4
> 
> +#define LA12XX_MAX_CORES	4
> +#define LA12XX_LDPC_ENC_CORE	0
> +#define LA12XX_LDPC_DEC_CORE	1
> +
> +#define LA12XX_MAX_LDPC_ENC_QUEUES	4
> +#define LA12XX_MAX_LDPC_DEC_QUEUES	4
> +
>  static const char * const bbdev_la12xx_valid_params[] = {
>  	LA12XX_MAX_NB_QUEUES_ARG,
>  	LA12XX_VDEV_MODEM_ID_ARG,
>  };
> 
> +static const struct rte_bbdev_op_cap bbdev_capabilities[] = {
> +	{
> +		.type   = RTE_BBDEV_OP_LDPC_ENC,
> +		.cap.ldpc_enc = {
> +			.capability_flags =
> +					RTE_BBDEV_LDPC_CRC_24A_ATTACH
> |
> +
> 	RTE_BBDEV_LDPC_CRC_24B_ATTACH,
> +			.num_buffers_src =
> +
> 	RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
> +			.num_buffers_dst =
> +
> 	RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
> +		}
> +	},
> +	{
> +		.type   = RTE_BBDEV_OP_LDPC_DEC,
> +		.cap.ldpc_dec = {
> +			.capability_flags =
> +				RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK |
> +				RTE_BBDEV_LDPC_LLR_COMPRESSION |

Are you sure you support the 6bits LLR compression option? I don't see it being used in the PMD below. Nor in doc. 
Let me know if you are unclear what that flag really mean.  

> +
> 	RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK |
> +
> 	RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP,
> +			.num_buffers_src =
> +
> 	RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
> +			.num_buffers_hard_out =
> +
> 	RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
> +		}
> +	},
> +	RTE_BBDEV_END_OF_CAPABILITIES_LIST()
> +};
> +
> +static struct rte_bbdev_queue_conf default_queue_conf = {
> +	.queue_size = MAX_CHANNEL_DEPTH,
> +};
> +
> +/* Get device info */
> +static void
> +la12xx_info_get(struct rte_bbdev *dev __rte_unused,
> +		struct rte_bbdev_driver_info *dev_info) {
> +	PMD_INIT_FUNC_TRACE();
> +
> +	dev_info->driver_name = RTE_STR(DRIVER_NAME);
> +	dev_info->max_num_queues = LA12XX_MAX_QUEUES;
> +	dev_info->queue_size_lim = MAX_CHANNEL_DEPTH;
> +	dev_info->hardware_accelerated = true;
> +	dev_info->max_dl_queue_priority = 0;
> +	dev_info->max_ul_queue_priority = 0;
> +	dev_info->default_queue_conf = default_queue_conf;
> +	dev_info->capabilities = bbdev_capabilities;
> +	dev_info->cpu_flag_reqs = NULL;
> +	dev_info->min_alignment = 64;
> +
> +	rte_bbdev_log_debug("got device info from %u", dev->data-
> >dev_id); }
> +
> +/* Release queue */
> +static int
> +la12xx_queue_release(struct rte_bbdev *dev, uint16_t q_id) {
> +	RTE_SET_USED(dev);
> +	RTE_SET_USED(q_id);
> +
> +	PMD_INIT_FUNC_TRACE();
> +
> +	/* TODO: Implement */

There is still a TODO here? You mentioned it previous patch you would add now, right?

> +
> +	return 0;
> +}
> +
> +#define HUGEPG_OFFSET(A) \
> +		((uint64_t) ((unsigned long) (A) \
> +		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
> +
> +static int ipc_queue_configure(uint32_t channel_id,
> +		ipc_t instance, struct bbdev_la12xx_q_priv *q_priv) {
> +	ipc_userspace_t *ipc_priv = (ipc_userspace_t *)instance;
> +	ipc_instance_t *ipc_instance = ipc_priv->instance;
> +	ipc_ch_t *ch;
> +	void *vaddr;
> +	uint32_t i = 0;
> +	uint32_t msg_size = sizeof(struct bbdev_ipc_enqueue_op);
> +
> +	PMD_INIT_FUNC_TRACE();
> +
> +	rte_bbdev_log_debug("%x %p", ipc_instance->initialized,
> +		ipc_priv->instance);
> +	ch = &(ipc_instance->ch_list[channel_id]);
> +
> +	rte_bbdev_log_debug("channel: %u, depth: %u, msg size: %u",
> +		channel_id, q_priv->queue_size, msg_size);
> +
> +	/* Start init of channel */
> +	ch->md.ring_size = rte_cpu_to_be_32(q_priv->queue_size);
> +	ch->md.pi = 0;
> +	ch->md.ci = 0;
> +	ch->md.msg_size = msg_size;
> +	for (i = 0; i < q_priv->queue_size; i++) {
> +		vaddr = rte_malloc(NULL, msg_size, RTE_CACHE_LINE_SIZE);
> +		if (!vaddr)
> +			return IPC_HOST_BUF_ALLOC_FAIL;
> +		/* Only offset now */
> +		ch->bd_h[i].modem_ptr =
> +			rte_cpu_to_be_32(HUGEPG_OFFSET(vaddr));
> +		ch->bd_h[i].host_virt_l = lower_32_bits(vaddr);
> +		ch->bd_h[i].host_virt_h = upper_32_bits(vaddr);
> +		q_priv->msg_ch_vaddr[i] = vaddr;
> +		/* Not sure use of this len may be for CRC*/
> +		ch->bd_h[i].len = 0;
> +	}
> +	ch->host_ipc_params =
> +		rte_cpu_to_be_32(HUGEPG_OFFSET(q_priv-
> >host_params));
> +
> +	rte_bbdev_log_debug("Channel configured");
> +	return IPC_SUCCESS;
> +}
> +
> +static int
> +la12xx_e200_queue_setup(struct rte_bbdev *dev,
> +		struct bbdev_la12xx_q_priv *q_priv)
> +{
> +	struct bbdev_la12xx_private *priv = dev->data->dev_private;
> +	ipc_userspace_t *ipc_priv = priv->ipc_priv;
> +	struct gul_hif *mhif;
> +	ipc_metadata_t *ipc_md;
> +	ipc_ch_t *ch;
> +	int instance_id = 0, i;
> +	int ret;
> +
> +	PMD_INIT_FUNC_TRACE();
> +
> +	switch (q_priv->op_type) {
> +	case RTE_BBDEV_OP_LDPC_ENC:
> +		q_priv->la12xx_core_id = LA12XX_LDPC_ENC_CORE;
> +		break;
> +	case RTE_BBDEV_OP_LDPC_DEC:
> +		q_priv->la12xx_core_id = LA12XX_LDPC_DEC_CORE;
> +		break;
> +	default:
> +		rte_bbdev_log(ERR, "Unsupported op type\n");
> +		return -1;
> +	}
> +
> +	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
> +	/* offset is from start of PEB */
> +	ipc_md = (ipc_metadata_t *)((uint64_t)ipc_priv-
> >peb_start.host_vaddr +
> +		mhif->ipc_regs.ipc_mdata_offset);
> +	ch = &ipc_md->instance_list[instance_id].ch_list[q_priv->q_id];
> +
> +	if (q_priv->q_id < priv->num_valid_queues) {
> +		ipc_br_md_t *md = &(ch->md);
> +
> +		q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
> +		q_priv->feca_blk_id_be32 = ch->feca_blk_id;
> +		q_priv->host_pi = rte_be_to_cpu_32(md->pi);
> +		q_priv->host_ci = rte_be_to_cpu_32(md->ci);
> +		q_priv->host_params = (host_ipc_params_t *)
> +			(rte_be_to_cpu_32(ch->host_ipc_params) +
> +			((uint64_t)ipc_priv->hugepg_start.host_vaddr));
> +
> +		for (i = 0; i < q_priv->queue_size; i++) {
> +			uint32_t h, l;
> +
> +			h = ch->bd_h[i].host_virt_h;
> +			l = ch->bd_h[i].host_virt_l;
> +			q_priv->msg_ch_vaddr[i] = (void *)join_32_bits(h, l);
> +		}
> +
> +		rte_bbdev_log(WARNING,
> +			"Queue [%d] already configured, not configuring
> again",
> +			q_priv->q_id);
> +		return 0;
> +	}
> +
> +	rte_bbdev_log_debug("setting up queue %d", q_priv->q_id);
> +
> +	/* Call ipc_configure_channel */
> +	ret = ipc_queue_configure(q_priv->q_id, ipc_priv, q_priv);
> +	if (ret) {
> +		rte_bbdev_log(ERR, "Unable to setup queue (%d) (err=%d)",
> +		       q_priv->q_id, ret);
> +		return ret;
> +	}
> +
> +	/* Set queue properties for LA12xx device */
> +	switch (q_priv->op_type) {
> +	case RTE_BBDEV_OP_LDPC_ENC:
> +		if (priv->num_ldpc_enc_queues >=
> LA12XX_MAX_LDPC_ENC_QUEUES) {
> +			rte_bbdev_log(ERR,
> +				"num_ldpc_enc_queues reached max
> value");
> +			return -1;
> +		}
> +		ch->la12xx_core_id =
> +			rte_cpu_to_be_32(LA12XX_LDPC_ENC_CORE);
> +		ch->feca_blk_id = rte_cpu_to_be_32(priv-
> >num_ldpc_enc_queues++);
> +		break;
> +	case RTE_BBDEV_OP_LDPC_DEC:
> +		if (priv->num_ldpc_dec_queues >=
> LA12XX_MAX_LDPC_DEC_QUEUES) {
> +			rte_bbdev_log(ERR,
> +				"num_ldpc_dec_queues reached max
> value");
> +			return -1;
> +		}
> +		ch->la12xx_core_id =
> +			rte_cpu_to_be_32(LA12XX_LDPC_DEC_CORE);
> +		ch->feca_blk_id = rte_cpu_to_be_32(priv-
> >num_ldpc_dec_queues++);
> +		break;
> +	default:
> +		rte_bbdev_log(ERR, "Not supported op type\n");
> +		return -1;
> +	}
> +	ch->op_type = rte_cpu_to_be_32(q_priv->op_type);
> +	ch->depth = rte_cpu_to_be_32(q_priv->queue_size);
> +
> +	/* Store queue config here */
> +	q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
> +	q_priv->feca_blk_id_be32 = ch->feca_blk_id;
> +
> +	return 0;
> +}
> +
> +/* Setup a queue */
> +static int
> +la12xx_queue_setup(struct rte_bbdev *dev, uint16_t q_id,
> +		const struct rte_bbdev_queue_conf *queue_conf) {
> +	struct bbdev_la12xx_private *priv = dev->data->dev_private;
> +	struct rte_bbdev_queue_data *q_data;
> +	struct bbdev_la12xx_q_priv *q_priv;
> +	int ret;
> +
> +	PMD_INIT_FUNC_TRACE();
> +
> +	/* Move to setup_queues callback */
> +	q_data = &dev->data->queues[q_id];
> +	q_data->queue_private = rte_zmalloc(NULL,
> +		sizeof(struct bbdev_la12xx_q_priv), 0);
> +	if (!q_data->queue_private) {
> +		rte_bbdev_log(ERR, "Memory allocation failed for qpriv");
> +		return -ENOMEM;
> +	}
> +	q_priv = q_data->queue_private;
> +	q_priv->q_id = q_id;
> +	q_priv->bbdev_priv = dev->data->dev_private;
> +	q_priv->queue_size = queue_conf->queue_size;
> +	q_priv->op_type = queue_conf->op_type;
> +
> +	ret = la12xx_e200_queue_setup(dev, q_priv);
> +	if (ret) {
> +		rte_bbdev_log(ERR, "e200_queue_setup failed for qid: %d",
> +				     q_id);
> +		return ret;
> +	}
> +
> +	/* Store queue config here */
> +	priv->num_valid_queues++;
> +
> +	return 0;
> +}
> +
> +static int
> +la12xx_start(struct rte_bbdev *dev)
> +{
> +	struct bbdev_la12xx_private *priv = dev->data->dev_private;
> +	ipc_userspace_t *ipc_priv = priv->ipc_priv;
> +	int ready = 0;
> +	struct gul_hif *hif_start;
> +
> +	PMD_INIT_FUNC_TRACE();
> +
> +	hif_start = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
> +
> +	/* Set Host Read bit */
> +	SET_HIF_HOST_RDY(hif_start, HIF_HOST_READY_IPC_APP);
> +
> +	/* Now wait for modem ready bit */
> +	while (!ready)
> +		ready = CHK_HIF_MOD_RDY(hif_start,
> HIF_MOD_READY_IPC_APP);
> +
> +	return 0;
> +}
> +
> +static const struct rte_bbdev_ops pmd_ops = {
> +	.info_get = la12xx_info_get,
> +	.queue_setup = la12xx_queue_setup,
> +	.queue_release = la12xx_queue_release,
> +	.start = la12xx_start
> +};
> +static struct hugepage_info *
> +get_hugepage_info(void)
> +{
> +	struct hugepage_info *hp_info;
> +	struct rte_memseg *mseg;
> +
> +	PMD_INIT_FUNC_TRACE();
> +
> +	/* TODO - find a better way */

See previous comment

> +	hp_info = rte_malloc(NULL, sizeof(struct hugepage_info), 0);
> +	if (!hp_info) {
> +		rte_bbdev_log(ERR, "Unable to allocate on local heap");
> +		return NULL;
> +	}
> +
> +	mseg = rte_mem_virt2memseg(hp_info, NULL);
> +	hp_info->vaddr = mseg->addr;
> +	hp_info->paddr = rte_mem_virt2phy(mseg->addr);
> +	hp_info->len = mseg->len;
> +
> +	return hp_info;
> +}
> +
> +static int open_ipc_dev(int modem_id)
> +{
> +	char dev_initials[16], dev_path[PATH_MAX];
> +	struct dirent *entry;
> +	int dev_ipc = 0;
> +	DIR *dir;
> +
> +	dir = opendir("/dev/");
> +	if (!dir) {
> +		rte_bbdev_log(ERR, "Unable to open /dev/");
> +		return -1;
> +	}
> +
> +	sprintf(dev_initials, "gulipcgul%d", modem_id);
> +
> +	while ((entry = readdir(dir)) != NULL) {
> +		if (!strncmp(dev_initials, entry->d_name,
> +		    sizeof(dev_initials) - 1))
> +			break;
> +	}
> +
> +	if (!entry) {
> +		rte_bbdev_log(ERR, "Error: No gulipcgul%d device",
> modem_id);
> +		return -1;
> +	}
> +
> +	sprintf(dev_path, "/dev/%s", entry->d_name);
> +	dev_ipc = open(dev_path, O_RDWR);
> +	if (dev_ipc  < 0) {
> +		rte_bbdev_log(ERR, "Error: Cannot open %s", dev_path);
> +		return -errno;
> +	}
> +
> +	return dev_ipc;
> +}
> +
> +static int
> +setup_la12xx_dev(struct rte_bbdev *dev) {
> +	struct bbdev_la12xx_private *priv = dev->data->dev_private;
> +	ipc_userspace_t *ipc_priv = priv->ipc_priv;
> +	struct hugepage_info *hp = NULL;
> +	ipc_channel_us_t *ipc_priv_ch = NULL;
> +	int dev_ipc = 0, dev_mem = 0, i;
> +	ipc_metadata_t *ipc_md;
> +	struct gul_hif *mhif;
> +	uint32_t phy_align = 0;
> +	int ret;
> +
> +	PMD_INIT_FUNC_TRACE();
> +
> +	if (!ipc_priv) {
> +		/* TODO - get a better way */
> +		/* Get the hugepage info against it */
> +		hp = get_hugepage_info();
> +		if (!hp) {
> +			rte_bbdev_log(ERR, "Unable to get hugepage info");
> +			ret = -ENOMEM;
> +			goto err;
> +		}
> +
> +		rte_bbdev_log_debug("%lx %p %lx",
> +				hp->paddr, hp->vaddr, hp->len);
> +
> +		ipc_priv = rte_zmalloc(0, sizeof(ipc_userspace_t), 0);
> +		if (ipc_priv == NULL) {
> +			rte_bbdev_log(ERR,
> +				"Unable to allocate memory for ipc priv");
> +			ret = -ENOMEM;
> +			goto err;
> +		}
> +
> +		for (i = 0; i < IPC_MAX_CHANNEL_COUNT; i++) {
> +			ipc_priv_ch = rte_zmalloc(0,
> +				sizeof(ipc_channel_us_t), 0);
> +			if (ipc_priv_ch == NULL) {
> +				rte_bbdev_log(ERR,
> +					"Unable to allocate memory for
> channels");
> +				ret = -ENOMEM;
> +			}
> +			ipc_priv->channels[i] = ipc_priv_ch;
> +		}
> +
> +		dev_mem = open("/dev/mem", O_RDWR);
> +		if (dev_mem < 0) {
> +			rte_bbdev_log(ERR, "Error: Cannot open
> /dev/mem");
> +			ret = -errno;
> +			goto err;
> +		}
> +
> +		ipc_priv->instance_id = 0;
> +		ipc_priv->dev_mem = dev_mem;
> +
> +		rte_bbdev_log_debug("hugepg input %lx %p %lx",
> +			hp->paddr, hp->vaddr, hp->len);
> +
> +		ipc_priv->sys_map.hugepg_start.host_phys = hp->paddr;
> +		ipc_priv->sys_map.hugepg_start.size = hp->len;
> +
> +		ipc_priv->hugepg_start.host_phys = hp->paddr;
> +		ipc_priv->hugepg_start.host_vaddr = hp->vaddr;
> +		ipc_priv->hugepg_start.size = hp->len;
> +
> +		rte_free(hp);
> +	}
> +
> +	dev_ipc = open_ipc_dev(priv->modem_id);
> +	if (dev_ipc < 0) {
> +		rte_bbdev_log(ERR, "Error: open_ipc_dev failed");
> +		goto err;
> +	}
> +	ipc_priv->dev_ipc = dev_ipc;
> +
> +	ret = ioctl(ipc_priv->dev_ipc, IOCTL_GUL_IPC_GET_SYS_MAP,
> +		    &ipc_priv->sys_map);
> +	if (ret) {
> +		rte_bbdev_log(ERR,
> +			"IOCTL_GUL_IPC_GET_SYS_MAP ioctl failed");
> +		goto err;
> +	}
> +
> +	phy_align = (ipc_priv->sys_map.mhif_start.host_phys % 0x1000);
> +	ipc_priv->mhif_start.host_vaddr =
> +		mmap(0, ipc_priv->sys_map.mhif_start.size + phy_align,
> +		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv-
> >dev_mem,
> +		     (ipc_priv->sys_map.mhif_start.host_phys - phy_align));
> +	if (ipc_priv->mhif_start.host_vaddr == MAP_FAILED) {
> +		rte_bbdev_log(ERR, "MAP failed:");
> +		ret = -errno;
> +		goto err;
> +	}
> +
> +	ipc_priv->mhif_start.host_vaddr = (void *) ((uint64_t)
> +		(ipc_priv->mhif_start.host_vaddr) + phy_align);
> +
> +	phy_align = (ipc_priv->sys_map.peb_start.host_phys % 0x1000);
> +	ipc_priv->peb_start.host_vaddr =
> +		mmap(0, ipc_priv->sys_map.peb_start.size + phy_align,
> +		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv-
> >dev_mem,
> +		     (ipc_priv->sys_map.peb_start.host_phys - phy_align));
> +	if (ipc_priv->peb_start.host_vaddr == MAP_FAILED) {
> +		rte_bbdev_log(ERR, "MAP failed:");
> +		ret = -errno;
> +		goto err;
> +	}
> +
> +	ipc_priv->peb_start.host_vaddr = (void *)((uint64_t)
> +		(ipc_priv->peb_start.host_vaddr) + phy_align);
> +
> +	phy_align = (ipc_priv->sys_map.modem_ccsrbar.host_phys %
> 0x1000);
> +	ipc_priv->modem_ccsrbar.host_vaddr =
> +		mmap(0, ipc_priv->sys_map.modem_ccsrbar.size +
> phy_align,
> +		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv-
> >dev_mem,
> +		     (ipc_priv->sys_map.modem_ccsrbar.host_phys -
> phy_align));
> +	if (ipc_priv->modem_ccsrbar.host_vaddr == MAP_FAILED) {
> +		rte_bbdev_log(ERR, "MAP failed:");
> +		ret = -errno;
> +		goto err;
> +	}
> +
> +	ipc_priv->modem_ccsrbar.host_vaddr = (void *)((uint64_t)
> +		(ipc_priv->modem_ccsrbar.host_vaddr) + phy_align);
> +
> +	ipc_priv->hugepg_start.modem_phys =
> +		ipc_priv->sys_map.hugepg_start.modem_phys;
> +
> +	ipc_priv->mhif_start.host_phys =
> +		ipc_priv->sys_map.mhif_start.host_phys;
> +	ipc_priv->mhif_start.size = ipc_priv->sys_map.mhif_start.size;
> +	ipc_priv->peb_start.host_phys = ipc_priv-
> >sys_map.peb_start.host_phys;
> +	ipc_priv->peb_start.size = ipc_priv->sys_map.peb_start.size;
> +
> +	rte_bbdev_log(INFO, "peb %lx %p %x",
> +			ipc_priv->peb_start.host_phys,
> +			ipc_priv->peb_start.host_vaddr,
> +			ipc_priv->peb_start.size);
> +	rte_bbdev_log(INFO, "hugepg %lx %p %x",
> +			ipc_priv->hugepg_start.host_phys,
> +			ipc_priv->hugepg_start.host_vaddr,
> +			ipc_priv->hugepg_start.size);
> +	rte_bbdev_log(INFO, "mhif %lx %p %x",
> +			ipc_priv->mhif_start.host_phys,
> +			ipc_priv->mhif_start.host_vaddr,
> +			ipc_priv->mhif_start.size);
> +	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
> +
> +	/* offset is from start of PEB */
> +	ipc_md = (ipc_metadata_t *)((uint64_t)ipc_priv-
> >peb_start.host_vaddr +
> +			mhif->ipc_regs.ipc_mdata_offset);
> +
> +	if (sizeof(ipc_metadata_t) != mhif->ipc_regs.ipc_mdata_size) {
> +		rte_bbdev_log(ERR,
> +			"ipc_metadata_t =%lx, mhif-
> >ipc_regs.ipc_mdata_size=%x",
> +			sizeof(ipc_metadata_t), mhif-
> >ipc_regs.ipc_mdata_size);
> +		rte_bbdev_log(ERR, "--> mhif->ipc_regs.ipc_mdata_offset=
> %x",
> +			mhif->ipc_regs.ipc_mdata_offset);
> +		rte_bbdev_log(ERR, "gul_hif size=%lx", sizeof(struct
> gul_hif));
> +		return IPC_MD_SZ_MISS_MATCH;
> +	}
> +
> +	ipc_priv->instance = (ipc_instance_t *)
> +		(&ipc_md->instance_list[ipc_priv->instance_id]);
> +
> +	rte_bbdev_log_debug("finish host init");
> +
> +	priv->ipc_priv = ipc_priv;
> +
> +	return 0;
> +
> +err:
> +	rte_free(hp);
> +	rte_free(ipc_priv);
> +	rte_free(ipc_priv_ch);
> +	if (dev_mem)
> +		close(dev_mem);
> +	if (dev_ipc)
> +		close(dev_ipc);
> +
> +	return ret;
> +}
> +
>  static inline int
>  parse_u16_arg(const char *key, const char *value, void *extra_args)  { @@ -
> 123,6 +666,7 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
>  	struct rte_bbdev *bbdev;
>  	const char *name = rte_vdev_device_name(vdev);
>  	struct bbdev_la12xx_private *priv;
> +	int ret;
> 
>  	PMD_INIT_FUNC_TRACE();
> 
> @@ -152,7 +696,13 @@ la12xx_bbdev_create(struct rte_vdev_device
> *vdev,
> 
>  	rte_bbdev_log(INFO, "Setting Up %s: DevId=%d, ModemId=%d",
>  				name, bbdev->data->dev_id, priv-
> >modem_id);
> -	bbdev->dev_ops = NULL;
> +	ret = setup_la12xx_dev(bbdev);
> +	if (ret) {
> +		rte_bbdev_log(ERR, "IPC Setup failed for %s", name);
> +		rte_free(bbdev->data->dev_private);
> +		return ret;
> +	}
> +	bbdev->dev_ops = &pmd_ops;
>  	bbdev->device = &vdev->device;
>  	bbdev->data->socket_id = 0;
>  	bbdev->intr_handle = NULL;
> diff --git a/drivers/baseband/la12xx/bbdev_la12xx.h
> b/drivers/baseband/la12xx/bbdev_la12xx.h
> index 5228502331..49c37fe2fe 100644
> --- a/drivers/baseband/la12xx/bbdev_la12xx.h
> +++ b/drivers/baseband/la12xx/bbdev_la12xx.h
> @@ -5,16 +5,10 @@
>  #ifndef __BBDEV_LA12XX_H__
>  #define __BBDEV_LA12XX_H__
> 
> -#define BBDEV_IPC_ENC_OP_TYPE	1
> -#define BBDEV_IPC_DEC_OP_TYPE	2
> -
> -#define MAX_LDPC_ENC_FECA_QUEUES	4
> -#define MAX_LDPC_DEC_FECA_QUEUES	4
> -
>  #define MAX_CHANNEL_DEPTH 16
>  /* private data structure */
>  struct bbdev_la12xx_private {
> -	void *ipc_priv;
> +	ipc_userspace_t *ipc_priv;
>  	uint8_t num_valid_queues;
>  	uint8_t max_nb_queues;
>  	uint8_t num_ldpc_enc_queues;
> @@ -52,5 +46,6 @@ struct bbdev_la12xx_q_priv {
> 
>  #define lower_32_bits(x) ((uint32_t)((uint64_t)x))  #define
> upper_32_bits(x) ((uint32_t)(((uint64_t)(x) >> 16) >> 16))
> -
> +#define join_32_bits(upper, lower) \
> +	((size_t)(((uint64_t)(upper) << 32) | (uint32_t)(lower)))
>  #endif
> diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> index 9aa5562981..5f613fb087 100644
> --- a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> +++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> @@ -4,9 +4,182 @@
>  #ifndef __BBDEV_LA12XX_IPC_H__
>  #define __BBDEV_LA12XX_IPC_H__
> 
> +#define LA12XX_MAX_QUEUES 20
> +#define HOST_RX_QUEUEID_OFFSET LA12XX_MAX_QUEUES
> +
> +/** No. of max channel per instance */
> +#define IPC_MAX_CHANNEL_COUNT	(64)
> +
>  /** No. of max channel per instance */
>  #define IPC_MAX_DEPTH	(16)
> 
> +/** No. of max IPC instance per modem */
> +#define IPC_MAX_INSTANCE_COUNT	(1)
> +
> +/** Error codes */
> +#define IPC_SUCCESS		(0) /** IPC operation success */
> +#define IPC_INPUT_INVALID	(-1) /** Invalid input to API */
> +#define IPC_CH_INVALID		(-2) /** Channel no is invalid */
> +#define IPC_INSTANCE_INVALID	(-3) /** Instance no is invalid */
> +#define IPC_MEM_INVALID		(-4) /** Insufficient memory */
> +#define IPC_CH_FULL		(-5) /** Channel is full */
> +#define IPC_CH_EMPTY		(-6) /** Channel is empty */
> +#define IPC_BL_EMPTY		(-7) /** Free buffer list is empty */
> +#define IPC_BL_FULL		(-8) /** Free buffer list is full */
> +#define IPC_HOST_BUF_ALLOC_FAIL	(-9) /** DPDK malloc fail */
> +#define IPC_MD_SZ_MISS_MATCH	(-10) /** META DATA size in mhif
> miss matched*/
> +#define IPC_MALLOC_FAIL		(-11) /** system malloc fail */
> +#define IPC_IOCTL_FAIL		(-12) /** IOCTL call failed */
> +#define IPC_MMAP_FAIL		(-14) /** MMAP fail */
> +#define IPC_OPEN_FAIL		(-15) /** OPEN fail */
> +#define IPC_EVENTFD_FAIL	(-16) /** eventfd initialization failed */
> +#define IPC_NOT_IMPLEMENTED	(-17) /** IPC feature is not
> implemented yet*/
> +
> +#define SET_HIF_HOST_RDY(hif, RDY_MASK) (hif->host_ready |=
> RDY_MASK)
> +#define CHK_HIF_MOD_RDY(hif, RDY_MASK) (hif->mod_ready &
> RDY_MASK)
> +
> +/* Host Ready bits */
> +#define HIF_HOST_READY_HOST_REGIONS	(1 << 0)
> +#define HIF_HOST_READY_IPC_LIB		(1 << 12)
> +#define HIF_HOST_READY_IPC_APP		(1 << 13)
> +#define HIF_HOST_READY_FECA		(1 << 14)
> +
> +/* Modem Ready bits */
> +#define HIF_MOD_READY_IPC_LIB		(1 << 5)
> +#define HIF_MOD_READY_IPC_APP		(1 << 6)
> +#define HIF_MOD_READY_FECA		(1 << 7)
> +
> +typedef void *ipc_t;
> +
> +struct ipc_msg {
> +	int chid;
> +	void *addr;
> +	uint32_t len;
> +	uint8_t flags;
> +};
> +
> +typedef struct {
> +	uint64_t host_phys;
> +	uint32_t modem_phys;
> +	void    *host_vaddr;
> +	uint32_t size;
> +} mem_range_t;
> +
> +#define GUL_IPC_MAGIC	'R'
> +
> +#define IOCTL_GUL_IPC_GET_SYS_MAP _IOW(GUL_IPC_MAGIC, 1, struct
> ipc_msg
> +*) #define IOCTL_GUL_IPC_CHANNEL_REGISTER _IOWR(GUL_IPC_MAGIC,
> 4,
> +struct ipc_msg *) #define IOCTL_GUL_IPC_CHANNEL_DEREGISTER \
> +	_IOWR(GUL_IPC_MAGIC, 5, struct ipc_msg *) #define
> +IOCTL_GUL_IPC_CHANNEL_RAISE_INTERRUPT _IOW(GUL_IPC_MAGIC, 6,
> int *)
> +
> +/** buffer ring common metadata */
> +typedef struct ipc_bd_ring_md {
> +	volatile uint32_t pi;		/**< Producer index and flag (MSB)
> +					  *  which flip for each Ring wrapping
> +					  */
> +	volatile uint32_t ci;		/**< Consumer index and flag (MSB)
> +					  *  which flip for each Ring wrapping
> +					  */
> +	uint32_t ring_size;	/**< depth (Used to roll-over pi/ci) */
> +	uint32_t msg_size;	/**< Size of the each buffer */
> +} __rte_packed ipc_br_md_t;
> +
> +/** IPC buffer descriptor */
> +typedef struct ipc_buffer_desc {
> +	union {
> +		uint64_t host_virt;	/**< msg's host virtual address */
> +		struct {
> +			uint32_t host_virt_l;
> +			uint32_t host_virt_h;
> +		};
> +	};
> +	uint32_t modem_ptr;	/**< msg's modem physical address */
> +	uint32_t len;		/**< msg len */
> +} __rte_packed ipc_bd_t;
> +
> +typedef struct ipc_channel {
> +	uint32_t ch_id;		/**< Channel id */
> +	ipc_br_md_t md;			/**< Metadata for BD ring */
> +	ipc_bd_t bd_h[IPC_MAX_DEPTH];	/**< Buffer Descriptor on
> Host */
> +	ipc_bd_t bd_m[IPC_MAX_DEPTH];	/**< Buffer Descriptor on
> Modem */
> +	uint32_t op_type;		/**< Type of the BBDEV operation
> +					  * supported on this channel
> +					  */
> +	uint32_t depth;			/**< Channel depth */
> +	uint32_t feca_blk_id;	/**< FECA Transport Block ID for processing
> */
> +	uint32_t la12xx_core_id;/**< LA12xx core ID on which this will be
> +				  * scheduled
> +				  */
> +	uint32_t feca_input_circ_size;	/**< FECA transport block input
> +					  * circular buffer size
> +					  */
> +	uint32_t host_ipc_params;	/**< Address for host IPC
> parameters */
> +} __rte_packed ipc_ch_t;
> +
> +typedef struct ipc_instance {
> +	uint32_t instance_id;		/**< instance id, use to init this
> +					  * instance by ipc_init API
> +					  */
> +	uint32_t initialized;		/**< Set in ipc_init */
> +	ipc_ch_t ch_list[IPC_MAX_CHANNEL_COUNT];
> +		/**< Channel descriptors in this instance */ } __rte_packed
> +ipc_instance_t;
> +
> +typedef struct ipc_metadata {
> +	uint32_t ipc_host_signature; /**< IPC host signature, Set by host/L2
> */
> +	uint32_t ipc_geul_signature; /**< IPC geul signature, Set by modem
> */
> +	ipc_instance_t instance_list[IPC_MAX_INSTANCE_COUNT];
> +} __rte_packed ipc_metadata_t;
> +
> +typedef struct ipc_channel_us_priv {
> +	int32_t		eventfd;
> +	uint32_t	channel_id;
> +	/* In flight packets status for buffer list. */
> +	uint8_t		bufs_inflight[IPC_MAX_DEPTH];
> +} ipc_channel_us_t;
> +
> +typedef struct {
> +	uint64_t host_phys;
> +	uint32_t modem_phys;
> +	uint32_t size;
> +} mem_strt_addr_t;
> +
> +typedef struct {
> +	mem_strt_addr_t modem_ccsrbar;
> +	mem_strt_addr_t peb_start; /* PEB meta data */
> +	mem_strt_addr_t mhif_start; /* MHIF meta daat */
> +	mem_strt_addr_t hugepg_start; /* Modem to access hugepage */ }
> +sys_map_t;
> +
> +typedef struct ipc_priv_t {
> +	int instance_id;
> +	int dev_ipc;
> +	int dev_mem;
> +	sys_map_t sys_map;
> +	mem_range_t modem_ccsrbar;
> +	mem_range_t peb_start;
> +	mem_range_t mhif_start;
> +	mem_range_t hugepg_start;
> +	ipc_channel_us_t *channels[IPC_MAX_CHANNEL_COUNT];
> +	ipc_instance_t	*instance;
> +	ipc_instance_t	*instance_bk;
> +} ipc_userspace_t;
> +
> +/** Structure specifying enqueue operation (enqueue at LA1224) */
> +struct bbdev_ipc_enqueue_op {
> +	/** Status of operation that was performed */
> +	int32_t status;
> +	/** CRC Status of SD operation that was performed */
> +	int32_t crc_stat_addr;
> +	/** HARQ Output buffer memory length for Shared Decode.
> +	 * Filled by LA12xx.
> +	 */
> +	uint32_t out_len;
> +	/** Reserved (for 8 byte alignment) */
> +	uint32_t rsvd;
> +};
> +
>  /* This shared memory would be on the host side which have copy of some
>   * of the parameters which are also part of Shared BD ring. Read access
>   * of these parameters from the host side would not be over PCI.
> @@ -14,7 +187,21 @@
>  typedef struct host_ipc_params {
>  	volatile uint32_t pi;
>  	volatile uint32_t ci;
> -	volatile uint32_t modem_ptr[IPC_MAX_DEPTH];
> +	volatile uint32_t bd_m_modem_ptr[IPC_MAX_DEPTH];
>  } __rte_packed host_ipc_params_t;
> 
> +struct hif_ipc_regs {
> +	uint32_t ipc_mdata_offset;
> +	uint32_t ipc_mdata_size;
> +} __rte_packed;
> +
> +struct gul_hif {
> +	uint32_t ver;
> +	uint32_t hif_ver;
> +	uint32_t status;
> +	volatile uint32_t host_ready;
> +	volatile uint32_t mod_ready;
> +	struct hif_ipc_regs ipc_regs;
> +} __rte_packed;
> +
>  #endif
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v4 1/8] bbdev: add network order data capability
  2021-04-24 21:59           ` Chautru, Nicolas
@ 2021-04-25 16:14             ` Thomas Monjalon
  0 siblings, 0 replies; 157+ messages in thread
From: Thomas Monjalon @ 2021-04-25 16:14 UTC (permalink / raw)
  To: Chautru, Nicolas, Hemant Agrawal, dev, gakhil
  Cc: David Marchand, Tom Rix, Dave Burley

Sam 24 avr 2021, à 23:59, Chautru, Nicolas a écrit :
> + Thomas, Akhil
> 
> In case this is for release 21.05 isn't it a bit late for introducing a 
> new API change?

Yes API change should be in -rc1.
Of course there is a bit of flexibility if you are sure an exception can be done without hurting other drivers, testing, etc.

^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v4 1/8] bbdev: add network order data capability
  2021-04-24 10:36         ` [dpdk-dev] [PATCH v4 1/8] bbdev: add network order data capability Hemant Agrawal
  2021-04-24 21:59           ` Chautru, Nicolas
@ 2021-04-26 17:01           ` Dave Burley
  2021-04-28 13:03             ` Hemant Agrawal
  2021-04-28 13:34             ` Hemant Agrawal
  1 sibling, 2 replies; 157+ messages in thread
From: Dave Burley @ 2021-04-26 17:01 UTC (permalink / raw)
  To: Hemant Agrawal, dev, gakhil, nicolas.chautru; +Cc: david.marchand

Hi Hemant

Can I ask what the usage case is for RTE_BBDEV_LDPC_ENC_NETWORK_ORDER/RTE_BBDEV_LDPC_DEC_NETWORK_ORDER ?

Thanks

Dave



________________________________
From: dev <dev-bounces@dpdk.org> on behalf of Hemant Agrawal <hemant.agrawal@nxp.com>
Sent: 24 April 2021 11:36
To: dev@dpdk.org <dev@dpdk.org>; gakhil@marvell.com <gakhil@marvell.com>; nicolas.chautru@intel.com <nicolas.chautru@intel.com>
Cc: david.marchand@redhat.com <david.marchand@redhat.com>; Hemant Agrawal <hemant.agrawal@nxp.com>
Subject: [dpdk-dev] [PATCH v4 1/8] bbdev: add network order data capability

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

This patch intoduces a new capability of the bbdev device
to process the LDPC data in network byte order.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 doc/guides/bbdevs/features/default.ini | 1 +
 doc/guides/prog_guide/bbdev.rst        | 6 ++++++
 lib/bbdev/rte_bbdev_op.h               | 8 ++++++--
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/doc/guides/bbdevs/features/default.ini b/doc/guides/bbdevs/features/default.ini
index 5fe267a625..e5da644099 100644
--- a/doc/guides/bbdevs/features/default.ini
+++ b/doc/guides/bbdevs/features/default.ini
@@ -14,3 +14,4 @@ LLR/HARQ Compression   =
 External DDR Access    =
 HW Accelerated         =
 BBDEV API              =
+Network Order Data     =
diff --git a/doc/guides/prog_guide/bbdev.rst b/doc/guides/prog_guide/bbdev.rst
index 6b2bd54e1a..89a86d10fb 100644
--- a/doc/guides/prog_guide/bbdev.rst
+++ b/doc/guides/prog_guide/bbdev.rst
@@ -747,6 +747,9 @@ given below.
 |RTE_BBDEV_LDPC_ENC_CONCATENATION                                    |
 | Set if a device supports concatenation of non byte aligned output  |
 +--------------------------------------------------------------------+
+|RTE_BBDEV_LDPC_ENC_NETWORK_ORDER                                    |
+| Set if a device supports network order data processing             |
++--------------------------------------------------------------------+

 The structure passed for each LDPC encode operation is given below,
 with the operation flags forming a bitmask in the ``op_flags`` field.
@@ -942,6 +945,9 @@ given below.
 |RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_LOOPBACK                        |
 | Set if a device supports loopback access to HARQ internal memory   |
 +--------------------------------------------------------------------+
+|RTE_BBDEV_LDPC_DEC_NETWORK_ORDER                                    |
+| Set if a device supports network order data processing             |
++--------------------------------------------------------------------+

 The structure passed for each LDPC decode operation is given below,
 with the operation flags forming a bitmask in the ``op_flags`` field.
diff --git a/lib/bbdev/rte_bbdev_op.h b/lib/bbdev/rte_bbdev_op.h
index f946842727..8fab617768 100644
--- a/lib/bbdev/rte_bbdev_op.h
+++ b/lib/bbdev/rte_bbdev_op.h
@@ -186,7 +186,9 @@ enum rte_bbdev_op_ldpcdec_flag_bitmasks {
         *  for HARQ memory. If not set, it is assumed the filler bits are not
         *  in HARQ memory and handled directly by the LDPC decoder.
         */
-       RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS = (1ULL << 18)
+       RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS = (1ULL << 18),
+       /** Set if a device supports network order data processing */
+       RTE_BBDEV_LDPC_DEC_NETWORK_ORDER = (1ULL << 19)
 };

 /** Flags for LDPC encoder operation and capability structure */
@@ -206,7 +208,9 @@ enum rte_bbdev_op_ldpcenc_flag_bitmasks {
        /** Set if a device supports scatter-gather functionality. */
        RTE_BBDEV_LDPC_ENC_SCATTER_GATHER = (1ULL << 6),
        /** Set if a device supports concatenation of non byte aligned output */
-       RTE_BBDEV_LDPC_ENC_CONCATENATION = (1ULL << 7)
+       RTE_BBDEV_LDPC_ENC_CONCATENATION = (1ULL << 7),
+       /** Set if a device supports network order data processing */
+       RTE_BBDEV_LDPC_ENC_NETWORK_ORDER = (1ULL << 8)
 };

 /** Flags for the Code Block/Transport block mode  */
--
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v4 1/8] bbdev: add network order data capability
  2021-04-26 17:01           ` Dave Burley
@ 2021-04-28 13:03             ` Hemant Agrawal
  2021-04-28 13:34             ` Hemant Agrawal
  1 sibling, 0 replies; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-28 13:03 UTC (permalink / raw)
  To: Dave Burley, Hemant Agrawal, dev, gakhil, nicolas.chautru; +Cc: david.marchand

Hi Dave,

If we go back to the data providing source i.e. FAPI interface, it is 
implementation specific. As per SCF222:

Our customers do use BE data in network and at FAPI interface.

In LA12xx, at present, we use u8 Big-endian data for processing to FECA 
engine.  We do see that other drivers in DPDK are using Little Endian 
*(with u32 data)* but standards is open for both.

Regards,

Hemant

On 4/26/2021 10:31 PM, Dave Burley wrote:
> Hi Hemant
>
> Can I ask what the usage case is for RTE_BBDEV_LDPC_ENC_NETWORK_ORDER/RTE_BBDEV_LDPC_DEC_NETWORK_ORDER ?
>
> Thanks
>
> Dave
>
>
>
> ________________________________
> From: dev <dev-bounces@dpdk.org> on behalf of Hemant Agrawal <hemant.agrawal@nxp.com>
> Sent: 24 April 2021 11:36
> To: dev@dpdk.org <dev@dpdk.org>; gakhil@marvell.com <gakhil@marvell.com>; nicolas.chautru@intel.com <nicolas.chautru@intel.com>
> Cc: david.marchand@redhat.com <david.marchand@redhat.com>; Hemant Agrawal <hemant.agrawal@nxp.com>
> Subject: [dpdk-dev] [PATCH v4 1/8] bbdev: add network order data capability
>
> CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> This patch intoduces a new capability of the bbdev device
> to process the LDPC data in network byte order.
>
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>   doc/guides/bbdevs/features/default.ini | 1 +
>   doc/guides/prog_guide/bbdev.rst        | 6 ++++++
>   lib/bbdev/rte_bbdev_op.h               | 8 ++++++--
>   3 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/doc/guides/bbdevs/features/default.ini b/doc/guides/bbdevs/features/default.ini
> index 5fe267a625..e5da644099 100644
> --- a/doc/guides/bbdevs/features/default.ini
> +++ b/doc/guides/bbdevs/features/default.ini
> @@ -14,3 +14,4 @@ LLR/HARQ Compression   =
>   External DDR Access    =
>   HW Accelerated         =
>   BBDEV API              =
> +Network Order Data     =
> diff --git a/doc/guides/prog_guide/bbdev.rst b/doc/guides/prog_guide/bbdev.rst
> index 6b2bd54e1a..89a86d10fb 100644
> --- a/doc/guides/prog_guide/bbdev.rst
> +++ b/doc/guides/prog_guide/bbdev.rst
> @@ -747,6 +747,9 @@ given below.
>   |RTE_BBDEV_LDPC_ENC_CONCATENATION                                    |
>   | Set if a device supports concatenation of non byte aligned output  |
>   +--------------------------------------------------------------------+
> +|RTE_BBDEV_LDPC_ENC_NETWORK_ORDER                                    |
> +| Set if a device supports network order data processing             |
> ++--------------------------------------------------------------------+
>
>   The structure passed for each LDPC encode operation is given below,
>   with the operation flags forming a bitmask in the ``op_flags`` field.
> @@ -942,6 +945,9 @@ given below.
>   |RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_LOOPBACK                        |
>   | Set if a device supports loopback access to HARQ internal memory   |
>   +--------------------------------------------------------------------+
> +|RTE_BBDEV_LDPC_DEC_NETWORK_ORDER                                    |
> +| Set if a device supports network order data processing             |
> ++--------------------------------------------------------------------+
>
>   The structure passed for each LDPC decode operation is given below,
>   with the operation flags forming a bitmask in the ``op_flags`` field.
> diff --git a/lib/bbdev/rte_bbdev_op.h b/lib/bbdev/rte_bbdev_op.h
> index f946842727..8fab617768 100644
> --- a/lib/bbdev/rte_bbdev_op.h
> +++ b/lib/bbdev/rte_bbdev_op.h
> @@ -186,7 +186,9 @@ enum rte_bbdev_op_ldpcdec_flag_bitmasks {
>           *  for HARQ memory. If not set, it is assumed the filler bits are not
>           *  in HARQ memory and handled directly by the LDPC decoder.
>           */
> -       RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS = (1ULL << 18)
> +       RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS = (1ULL << 18),
> +       /** Set if a device supports network order data processing */
> +       RTE_BBDEV_LDPC_DEC_NETWORK_ORDER = (1ULL << 19)
>   };
>
>   /** Flags for LDPC encoder operation and capability structure */
> @@ -206,7 +208,9 @@ enum rte_bbdev_op_ldpcenc_flag_bitmasks {
>          /** Set if a device supports scatter-gather functionality. */
>          RTE_BBDEV_LDPC_ENC_SCATTER_GATHER = (1ULL << 6),
>          /** Set if a device supports concatenation of non byte aligned output */
> -       RTE_BBDEV_LDPC_ENC_CONCATENATION = (1ULL << 7)
> +       RTE_BBDEV_LDPC_ENC_CONCATENATION = (1ULL << 7),
> +       /** Set if a device supports network order data processing */
> +       RTE_BBDEV_LDPC_ENC_NETWORK_ORDER = (1ULL << 8)
>   };
>
>   /** Flags for the Code Block/Transport block mode  */
> --
> 2.17.1
>

^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v4 1/8] bbdev: add network order data capability
  2021-04-26 17:01           ` Dave Burley
  2021-04-28 13:03             ` Hemant Agrawal
@ 2021-04-28 13:34             ` Hemant Agrawal
  2021-04-28 15:19               ` Chautru, Nicolas
  1 sibling, 1 reply; 157+ messages in thread
From: Hemant Agrawal @ 2021-04-28 13:34 UTC (permalink / raw)
  To: Dave Burley, Hemant Agrawal, dev, gakhil, nicolas.chautru; +Cc: david.marchand

Hi,

     My mail with photo snippets were rejected by dpdk mailing list. So, 
just sending the summary of it.

     My understanding is that in ORAN, typically network order is used 
between CU-DU or DU-RU communication. In FAPI interface as well, both LE 
and BE are allowed types, however few places do explicitly state BE type.

    Our customers/partners are typically using BE and LA12xx is 
configured to process BE data.

Regards,

Hemant


On 4/26/2021 10:31 PM, Dave Burley wrote:
> Hi Hemant
>
> Can I ask what the usage case is for RTE_BBDEV_LDPC_ENC_NETWORK_ORDER/RTE_BBDEV_LDPC_DEC_NETWORK_ORDER ?
>
> Thanks
>
> Dave
>
>
>
> ________________________________
> From: dev <dev-bounces@dpdk.org> on behalf of Hemant Agrawal <hemant.agrawal@nxp.com>
> Sent: 24 April 2021 11:36
> To: dev@dpdk.org <dev@dpdk.org>; gakhil@marvell.com <gakhil@marvell.com>; nicolas.chautru@intel.com <nicolas.chautru@intel.com>
> Cc: david.marchand@redhat.com <david.marchand@redhat.com>; Hemant Agrawal <hemant.agrawal@nxp.com>
> Subject: [dpdk-dev] [PATCH v4 1/8] bbdev: add network order data capability
>
> CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> This patch intoduces a new capability of the bbdev device
> to process the LDPC data in network byte order.
>
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>   doc/guides/bbdevs/features/default.ini | 1 +
>   doc/guides/prog_guide/bbdev.rst        | 6 ++++++
>   lib/bbdev/rte_bbdev_op.h               | 8 ++++++--
>   3 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/doc/guides/bbdevs/features/default.ini b/doc/guides/bbdevs/features/default.ini
> index 5fe267a625..e5da644099 100644
> --- a/doc/guides/bbdevs/features/default.ini
> +++ b/doc/guides/bbdevs/features/default.ini
> @@ -14,3 +14,4 @@ LLR/HARQ Compression   =
>   External DDR Access    =
>   HW Accelerated         =
>   BBDEV API              =
> +Network Order Data     =
> diff --git a/doc/guides/prog_guide/bbdev.rst b/doc/guides/prog_guide/bbdev.rst
> index 6b2bd54e1a..89a86d10fb 100644
> --- a/doc/guides/prog_guide/bbdev.rst
> +++ b/doc/guides/prog_guide/bbdev.rst
> @@ -747,6 +747,9 @@ given below.
>   |RTE_BBDEV_LDPC_ENC_CONCATENATION                                    |
>   | Set if a device supports concatenation of non byte aligned output  |
>   +--------------------------------------------------------------------+
> +|RTE_BBDEV_LDPC_ENC_NETWORK_ORDER                                    |
> +| Set if a device supports network order data processing             |
> ++--------------------------------------------------------------------+
>
>   The structure passed for each LDPC encode operation is given below,
>   with the operation flags forming a bitmask in the ``op_flags`` field.
> @@ -942,6 +945,9 @@ given below.
>   |RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_LOOPBACK                        |
>   | Set if a device supports loopback access to HARQ internal memory   |
>   +--------------------------------------------------------------------+
> +|RTE_BBDEV_LDPC_DEC_NETWORK_ORDER                                    |
> +| Set if a device supports network order data processing             |
> ++--------------------------------------------------------------------+
>
>   The structure passed for each LDPC decode operation is given below,
>   with the operation flags forming a bitmask in the ``op_flags`` field.
> diff --git a/lib/bbdev/rte_bbdev_op.h b/lib/bbdev/rte_bbdev_op.h
> index f946842727..8fab617768 100644
> --- a/lib/bbdev/rte_bbdev_op.h
> +++ b/lib/bbdev/rte_bbdev_op.h
> @@ -186,7 +186,9 @@ enum rte_bbdev_op_ldpcdec_flag_bitmasks {
>           *  for HARQ memory. If not set, it is assumed the filler bits are not
>           *  in HARQ memory and handled directly by the LDPC decoder.
>           */
> -       RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS = (1ULL << 18)
> +       RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS = (1ULL << 18),
> +       /** Set if a device supports network order data processing */
> +       RTE_BBDEV_LDPC_DEC_NETWORK_ORDER = (1ULL << 19)
>   };
>
>   /** Flags for LDPC encoder operation and capability structure */
> @@ -206,7 +208,9 @@ enum rte_bbdev_op_ldpcenc_flag_bitmasks {
>          /** Set if a device supports scatter-gather functionality. */
>          RTE_BBDEV_LDPC_ENC_SCATTER_GATHER = (1ULL << 6),
>          /** Set if a device supports concatenation of non byte aligned output */
> -       RTE_BBDEV_LDPC_ENC_CONCATENATION = (1ULL << 7)
> +       RTE_BBDEV_LDPC_ENC_CONCATENATION = (1ULL << 7),
> +       /** Set if a device supports network order data processing */
> +       RTE_BBDEV_LDPC_ENC_NETWORK_ORDER = (1ULL << 8)
>   };
>
>   /** Flags for the Code Block/Transport block mode  */
> --
> 2.17.1
>

^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v4 1/8] bbdev: add network order data capability
  2021-04-28 13:34             ` Hemant Agrawal
@ 2021-04-28 15:19               ` Chautru, Nicolas
  0 siblings, 0 replies; 157+ messages in thread
From: Chautru, Nicolas @ 2021-04-28 15:19 UTC (permalink / raw)
  To: hemant.agrawal, Dave Burley, dev, gakhil; +Cc: david.marchand

Hi Hemant, 

As mentioned earlier I have no problem adding such an option in the API, but that would still be a late API change (arguably too tight for 21.05 so that everyone has time to comment back). 
Based on description below this should not be an operation specific flag (again see my previous comment, not dynamic nor tied to operation type).
This can be done by adding a bool big_endianess to the `struct rte_bbdev_driver_info` as suggested earlier. This would be set in each PMD accordingly to their expectation/design. This can be used then in bbdev-test and application to ensure the data is present with the correct assumption. 
Any concern with that approach? Please check that you can run successfully the existing unit-test with such a set of changes for your device. 

Nic


> -----Original Message-----
> From: Hemant Agrawal <hemant.agrawal@oss.nxp.com>
> Sent: Wednesday, April 28, 2021 6:35 AM
> To: Dave Burley <dave.burley@accelercomm.com>; Hemant Agrawal
> <hemant.agrawal@nxp.com>; dev@dpdk.org; gakhil@marvell.com; Chautru,
> Nicolas <nicolas.chautru@intel.com>
> Cc: david.marchand@redhat.com
> Subject: Re: [dpdk-dev] [PATCH v4 1/8] bbdev: add network order data
> capability
> 
> Hi,
> 
>      My mail with photo snippets were rejected by dpdk mailing list. So, just
> sending the summary of it.
> 
>      My understanding is that in ORAN, typically network order is used
> between CU-DU or DU-RU communication. In FAPI interface as well, both LE
> and BE are allowed types, however few places do explicitly state BE type.
> 
>     Our customers/partners are typically using BE and LA12xx is configured to
> process BE data.
> 
> Regards,
> 
> Hemant
> 
> 
> On 4/26/2021 10:31 PM, Dave Burley wrote:
> > Hi Hemant
> >
> > Can I ask what the usage case is for
> RTE_BBDEV_LDPC_ENC_NETWORK_ORDER/RTE_BBDEV_LDPC_DEC_NETWO
> RK_ORDER ?
> >
> > Thanks
> >
> > Dave
> >
> >
> >
> > ________________________________
> > From: dev <dev-bounces@dpdk.org> on behalf of Hemant Agrawal
> > <hemant.agrawal@nxp.com>
> > Sent: 24 April 2021 11:36
> > To: dev@dpdk.org <dev@dpdk.org>; gakhil@marvell.com
> > <gakhil@marvell.com>; nicolas.chautru@intel.com
> > <nicolas.chautru@intel.com>
> > Cc: david.marchand@redhat.com <david.marchand@redhat.com>;
> Hemant
> > Agrawal <hemant.agrawal@nxp.com>
> > Subject: [dpdk-dev] [PATCH v4 1/8] bbdev: add network order data
> > capability
> >
> > CAUTION: This email originated from outside of the organization. Do not
> click links or open attachments unless you recognize the sender and know
> the content is safe.
> >
> > This patch intoduces a new capability of the bbdev device to process
> > the LDPC data in network byte order.
> >
> > Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> > ---
> >   doc/guides/bbdevs/features/default.ini | 1 +
> >   doc/guides/prog_guide/bbdev.rst        | 6 ++++++
> >   lib/bbdev/rte_bbdev_op.h               | 8 ++++++--
> >   3 files changed, 13 insertions(+), 2 deletions(-)
> >
> > diff --git a/doc/guides/bbdevs/features/default.ini
> > b/doc/guides/bbdevs/features/default.ini
> > index 5fe267a625..e5da644099 100644
> > --- a/doc/guides/bbdevs/features/default.ini
> > +++ b/doc/guides/bbdevs/features/default.ini
> > @@ -14,3 +14,4 @@ LLR/HARQ Compression   =
> >   External DDR Access    =
> >   HW Accelerated         =
> >   BBDEV API              =
> > +Network Order Data     =
> > diff --git a/doc/guides/prog_guide/bbdev.rst
> > b/doc/guides/prog_guide/bbdev.rst index 6b2bd54e1a..89a86d10fb
> 100644
> > --- a/doc/guides/prog_guide/bbdev.rst
> > +++ b/doc/guides/prog_guide/bbdev.rst
> > @@ -747,6 +747,9 @@ given below.
> >   |RTE_BBDEV_LDPC_ENC_CONCATENATION                                    |
> >   | Set if a device supports concatenation of non byte aligned output  |
> >
> > +--------------------------------------------------------------------+
> > +|RTE_BBDEV_LDPC_ENC_NETWORK_ORDER                                    |
> > +| Set if a device supports network order data processing             |
> > ++--------------------------------------------------------------------+
> >
> >   The structure passed for each LDPC encode operation is given below,
> >   with the operation flags forming a bitmask in the ``op_flags`` field.
> > @@ -942,6 +945,9 @@ given below.
> >   |RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_LOOPBACK                        |
> >   | Set if a device supports loopback access to HARQ internal memory   |
> >
> > +--------------------------------------------------------------------+
> > +|RTE_BBDEV_LDPC_DEC_NETWORK_ORDER                                    |
> > +| Set if a device supports network order data processing             |
> > ++--------------------------------------------------------------------+
> >
> >   The structure passed for each LDPC decode operation is given below,
> >   with the operation flags forming a bitmask in the ``op_flags`` field.
> > diff --git a/lib/bbdev/rte_bbdev_op.h b/lib/bbdev/rte_bbdev_op.h index
> > f946842727..8fab617768 100644
> > --- a/lib/bbdev/rte_bbdev_op.h
> > +++ b/lib/bbdev/rte_bbdev_op.h
> > @@ -186,7 +186,9 @@ enum rte_bbdev_op_ldpcdec_flag_bitmasks {
> >           *  for HARQ memory. If not set, it is assumed the filler bits are not
> >           *  in HARQ memory and handled directly by the LDPC decoder.
> >           */
> > -       RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS = (1ULL << 18)
> > +       RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS = (1ULL <<
> 18),
> > +       /** Set if a device supports network order data processing */
> > +       RTE_BBDEV_LDPC_DEC_NETWORK_ORDER = (1ULL << 19)
> >   };
> >
> >   /** Flags for LDPC encoder operation and capability structure */ @@
> > -206,7 +208,9 @@ enum rte_bbdev_op_ldpcenc_flag_bitmasks {
> >          /** Set if a device supports scatter-gather functionality. */
> >          RTE_BBDEV_LDPC_ENC_SCATTER_GATHER = (1ULL << 6),
> >          /** Set if a device supports concatenation of non byte aligned output
> */
> > -       RTE_BBDEV_LDPC_ENC_CONCATENATION = (1ULL << 7)
> > +       RTE_BBDEV_LDPC_ENC_CONCATENATION = (1ULL << 7),
> > +       /** Set if a device supports network order data processing */
> > +       RTE_BBDEV_LDPC_ENC_NETWORK_ORDER = (1ULL << 8)
> >   };
> >
> >   /** Flags for the Code Block/Transport block mode  */
> > --
> > 2.17.1
> >

^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [EXT] [PATCH v4 0/8] baseband: add NXP LA12xx driver
  2021-04-24 10:36       ` [dpdk-dev] [PATCH v4 0/8] baseband: add " Hemant Agrawal
                           ` (7 preceding siblings ...)
  2021-04-24 10:37         ` [dpdk-dev] [PATCH v4 8/8] app/bbdev: add test vectors for transport blocks Hemant Agrawal
@ 2021-05-05 12:31         ` Akhil Goyal
  2021-06-16 20:35           ` Akhil Goyal
  8 siblings, 1 reply; 157+ messages in thread
From: Akhil Goyal @ 2021-05-05 12:31 UTC (permalink / raw)
  To: Hemant Agrawal, dev, nicolas.chautru; +Cc: david.marchand

> Subject: [EXT] [PATCH v4 0/8] baseband: add NXP LA12xx driver
> 
> This series introduces the BBDEV LA12xx poll mode driver (PMD) to support
> an implementation for offloading High Phy processing functions like
> LDPC Encode / Decode 5GNR wireless acceleration function, using PCI based
> LA12xx Software defined radio.
> 
> Please check the documentation patch for more info.
> 
> The driver currently implements basic feature to offload only the 5G LDPC
> encode/decode.
> 
> A new capability has been added to check if the driver can support the
> input data in network byte order. Two test vectors are also added as an
> example with input data in network byte.
> 
> v2: add test case changes
> v3: fix 32 bit compilation
> v4: capability for network byte order, doc patch merged inline.
> 
> Hemant Agrawal (7):
>   bbdev: add network order data capability
>   baseband: introduce NXP LA12xx driver
>   baseband/la12xx: add devargs for max queues
>   baseband/la12xx: add support for multiple modems
>   baseband/la12xx: add queue and modem config support
>   baseband/la12xx: add enqueue and dequeue support
>   app/bbdev: enable la12xx for bbdev
> 
> Nipun Gupta (1):
>   app/bbdev: add test vectors for transport blocks
> 
This PMD is deferred for next release. Marked as deferred in patchworks.


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v4 5/8] baseband/la12xx: add queue and modem config support
  2021-04-24 22:12           ` Chautru, Nicolas
@ 2021-05-13 11:01             ` Nipun Gupta
  2021-05-13 14:51               ` Chautru, Nicolas
  0 siblings, 1 reply; 157+ messages in thread
From: Nipun Gupta @ 2021-05-13 11:01 UTC (permalink / raw)
  To: Chautru, Nicolas, Hemant Agrawal, dev, gakhil; +Cc: david.marchand



> > +		.type   = RTE_BBDEV_OP_LDPC_DEC,
> > +		.cap.ldpc_dec = {
> > +			.capability_flags =
> > +				RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK |
> > +				RTE_BBDEV_LDPC_LLR_COMPRESSION |
> 
> Are you sure you support the 6bits LLR compression option? I don't see it being
> used in the PMD below. Nor in doc.
> Let me know if you are unclear what that flag really mean.

We support LLR compression in the Hardware by default.
We do not need to call ' ldpc_input_llr_scaling' API in testbbdev.

Regards,
Nipun

^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v4 5/8] baseband/la12xx: add queue and modem config support
  2021-05-13 11:01             ` Nipun Gupta
@ 2021-05-13 14:51               ` Chautru, Nicolas
  2021-05-17 17:00                 ` Nipun Gupta
  0 siblings, 1 reply; 157+ messages in thread
From: Chautru, Nicolas @ 2021-05-13 14:51 UTC (permalink / raw)
  To: Nipun Gupta, Hemant Agrawal, dev, gakhil; +Cc: david.marchand

Hi Nipun, 

> -----Original Message-----
> From: Nipun Gupta <nipun.gupta@nxp.com>
> Sent: Thursday, May 13, 2021 4:02 AM
> To: Chautru, Nicolas <nicolas.chautru@intel.com>; Hemant Agrawal
> <hemant.agrawal@nxp.com>; dev@dpdk.org; gakhil@marvell.com
> Cc: david.marchand@redhat.com
> Subject: RE: [PATCH v4 5/8] baseband/la12xx: add queue and modem config
> support
> 
> 
> 
> > > +		.type   = RTE_BBDEV_OP_LDPC_DEC,
> > > +		.cap.ldpc_dec = {
> > > +			.capability_flags =
> > > +				RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK |
> > > +				RTE_BBDEV_LDPC_LLR_COMPRESSION |
> >
> > Are you sure you support the 6bits LLR compression option? I don't see
> > it being used in the PMD below. Nor in doc.
> > Let me know if you are unclear what that flag really mean.
> 
> We support LLR compression in the Hardware by default.
> We do not need to call ' ldpc_input_llr_scaling' API in testbbdev.
> 

So you always assume to pack up the input data as 6 bits back-to-back? You understand what that feature mean?
My concern is that you would not support current API and many unit test would fail then for you PMD. 
Are you able to run the bbdev-test and see failures (all tests should be either skipped : missing capability) or passing


> Regards,
> Nipun

^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v4 5/8] baseband/la12xx: add queue and modem config support
  2021-05-13 14:51               ` Chautru, Nicolas
@ 2021-05-17 17:00                 ` Nipun Gupta
  2021-05-17 17:53                   ` Chautru, Nicolas
  0 siblings, 1 reply; 157+ messages in thread
From: Nipun Gupta @ 2021-05-17 17:00 UTC (permalink / raw)
  To: Chautru, Nicolas, Hemant Agrawal, dev, gakhil; +Cc: david.marchand

Hi,

> -----Original Message-----
> From: Chautru, Nicolas <nicolas.chautru@intel.com>
> Sent: Thursday, May 13, 2021 8:21 PM
> To: Nipun Gupta <nipun.gupta@nxp.com>; Hemant Agrawal
> <hemant.agrawal@nxp.com>; dev@dpdk.org; gakhil@marvell.com
> Cc: david.marchand@redhat.com
> Subject: RE: [PATCH v4 5/8] baseband/la12xx: add queue and modem config
> support
> 
> Hi Nipun,
> 
> > -----Original Message-----
> > From: Nipun Gupta <nipun.gupta@nxp.com>
> > Sent: Thursday, May 13, 2021 4:02 AM
> > To: Chautru, Nicolas <nicolas.chautru@intel.com>; Hemant Agrawal
> > <hemant.agrawal@nxp.com>; dev@dpdk.org; gakhil@marvell.com
> > Cc: david.marchand@redhat.com
> > Subject: RE: [PATCH v4 5/8] baseband/la12xx: add queue and modem config
> > support
> >
> >
> >
> > > > +		.type   = RTE_BBDEV_OP_LDPC_DEC,
> > > > +		.cap.ldpc_dec = {
> > > > +			.capability_flags =
> > > > +				RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK |
> > > > +				RTE_BBDEV_LDPC_LLR_COMPRESSION |
> > >
> > > Are you sure you support the 6bits LLR compression option? I don't see
> > > it being used in the PMD below. Nor in doc.
> > > Let me know if you are unclear what that flag really mean.
> >
> > We support LLR compression in the Hardware by default.
> > We do not need to call ' ldpc_input_llr_scaling' API in testbbdev.
> >
> 
> So you always assume to pack up the input data as 6 bits back-to-back? You
> understand what that feature mean?
> My concern is that you would not support current API and many unit test would
> fail then for you PMD.
> Are you able to run the bbdev-test and see failures (all tests should be either
> skipped : missing capability) or passing

Our test vectors pass with our driver (Performance, validation, Latency and offload
cost tests), provided we do not call 'ldpc_input_llr_scaling' API.
I am not sure why this API is being called in testbbdev. Can you provide more
insight on why this API is doing and why does it modifies the input data?

> 
> 
> > Regards,
> > Nipun

^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v4 5/8] baseband/la12xx: add queue and modem config support
  2021-05-17 17:00                 ` Nipun Gupta
@ 2021-05-17 17:53                   ` Chautru, Nicolas
  2021-05-19 18:43                     ` Nipun Gupta
  0 siblings, 1 reply; 157+ messages in thread
From: Chautru, Nicolas @ 2021-05-17 17:53 UTC (permalink / raw)
  To: Nipun Gupta, Hemant Agrawal, dev, gakhil; +Cc: david.marchand



> -----Original Message-----
> From: Nipun Gupta <nipun.gupta@nxp.com>
> Sent: Monday, May 17, 2021 10:00 AM
> 
> Hi,
> 
> > -----Original Message-----
> > From: Chautru, Nicolas <nicolas.chautru@intel.com>
> > Sent: Thursday, May 13, 2021 8:21 PM
> > To: Nipun Gupta <nipun.gupta@nxp.com>; Hemant Agrawal
> > <hemant.agrawal@nxp.com>; dev@dpdk.org; gakhil@marvell.com
> > Cc: david.marchand@redhat.com
> > Subject: RE: [PATCH v4 5/8] baseband/la12xx: add queue and modem
> > config support
> >
> > Hi Nipun,
> >
> > > -----Original Message-----
> > > From: Nipun Gupta <nipun.gupta@nxp.com>
> > > Sent: Thursday, May 13, 2021 4:02 AM
> > > To: Chautru, Nicolas <nicolas.chautru@intel.com>; Hemant Agrawal
> > > <hemant.agrawal@nxp.com>; dev@dpdk.org; gakhil@marvell.com
> > > Cc: david.marchand@redhat.com
> > > Subject: RE: [PATCH v4 5/8] baseband/la12xx: add queue and modem
> > > config support
> > >
> > >
> > >
> > > > > +		.type   = RTE_BBDEV_OP_LDPC_DEC,
> > > > > +		.cap.ldpc_dec = {
> > > > > +			.capability_flags =
> > > > > +
> 	RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK |
> > > > > +
> 	RTE_BBDEV_LDPC_LLR_COMPRESSION |
> > > >
> > > > Are you sure you support the 6bits LLR compression option? I don't
> > > > see it being used in the PMD below. Nor in doc.
> > > > Let me know if you are unclear what that flag really mean.
> > >
> > > We support LLR compression in the Hardware by default.
> > > We do not need to call ' ldpc_input_llr_scaling' API in testbbdev.
> > >
> >
> > So you always assume to pack up the input data as 6 bits back-to-back?
> > You understand what that feature mean?
> > My concern is that you would not support current API and many unit
> > test would fail then for you PMD.
> > Are you able to run the bbdev-test and see failures (all tests should
> > be either skipped : missing capability) or passing
> 
> Our test vectors pass with our driver (Performance, validation, Latency and
> offload cost tests), provided we do not call 'ldpc_input_llr_scaling' API.
> I am not sure why this API is being called in testbbdev. Can you provide more
> insight on why this API is doing and why does it modifies the input data?

What LLR numerical representation are you doing for your PMD/HW.
Ie how many integer bits, how many decimals bits. 
This is to be able to support seamless different decoder implementation which have different assumptions or implementation. 

> 
> >
> >
> > > Regards,
> > > Nipun

^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v4 5/8] baseband/la12xx: add queue and modem config support
  2021-05-17 17:53                   ` Chautru, Nicolas
@ 2021-05-19 18:43                     ` Nipun Gupta
  0 siblings, 0 replies; 157+ messages in thread
From: Nipun Gupta @ 2021-05-19 18:43 UTC (permalink / raw)
  To: Chautru, Nicolas, Hemant Agrawal, dev, gakhil; +Cc: david.marchand



> -----Original Message-----
> From: Chautru, Nicolas <nicolas.chautru@intel.com>
> Sent: Monday, May 17, 2021 11:23 PM
> To: Nipun Gupta <nipun.gupta@nxp.com>; Hemant Agrawal
> <hemant.agrawal@nxp.com>; dev@dpdk.org; gakhil@marvell.com
> Cc: david.marchand@redhat.com
> Subject: RE: [PATCH v4 5/8] baseband/la12xx: add queue and modem config
> support
> 
> 
> 
> > -----Original Message-----
> > From: Nipun Gupta <nipun.gupta@nxp.com>
> > Sent: Monday, May 17, 2021 10:00 AM
> >
> > Hi,
> >
> > > -----Original Message-----
> > > From: Chautru, Nicolas <nicolas.chautru@intel.com>
> > > Sent: Thursday, May 13, 2021 8:21 PM
> > > To: Nipun Gupta <nipun.gupta@nxp.com>; Hemant Agrawal
> > > <hemant.agrawal@nxp.com>; dev@dpdk.org; gakhil@marvell.com
> > > Cc: david.marchand@redhat.com
> > > Subject: RE: [PATCH v4 5/8] baseband/la12xx: add queue and modem
> > > config support
> > >
> > > Hi Nipun,
> > >
> > > > -----Original Message-----
> > > > From: Nipun Gupta <nipun.gupta@nxp.com>
> > > > Sent: Thursday, May 13, 2021 4:02 AM
> > > > To: Chautru, Nicolas <nicolas.chautru@intel.com>; Hemant Agrawal
> > > > <hemant.agrawal@nxp.com>; dev@dpdk.org; gakhil@marvell.com
> > > > Cc: david.marchand@redhat.com
> > > > Subject: RE: [PATCH v4 5/8] baseband/la12xx: add queue and modem
> > > > config support
> > > >
> > > >
> > > >
> > > > > > +		.type   = RTE_BBDEV_OP_LDPC_DEC,
> > > > > > +		.cap.ldpc_dec = {
> > > > > > +			.capability_flags =
> > > > > > +
> > 	RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK |
> > > > > > +
> > 	RTE_BBDEV_LDPC_LLR_COMPRESSION |
> > > > >
> > > > > Are you sure you support the 6bits LLR compression option? I don't
> > > > > see it being used in the PMD below. Nor in doc.
> > > > > Let me know if you are unclear what that flag really mean.
> > > >
> > > > We support LLR compression in the Hardware by default.
> > > > We do not need to call ' ldpc_input_llr_scaling' API in testbbdev.
> > > >
> > >
> > > So you always assume to pack up the input data as 6 bits back-to-back?
> > > You understand what that feature mean?
> > > My concern is that you would not support current API and many unit
> > > test would fail then for you PMD.
> > > Are you able to run the bbdev-test and see failures (all tests should
> > > be either skipped : missing capability) or passing
> >
> > Our test vectors pass with our driver (Performance, validation, Latency and
> > offload cost tests), provided we do not call 'ldpc_input_llr_scaling' API.
> > I am not sure why this API is being called in testbbdev. Can you provide more
> > insight on why this API is doing and why does it modifies the input data?
> 
> What LLR numerical representation are you doing for your PMD/HW.
> Ie how many integer bits, how many decimals bits.
> This is to be able to support seamless different decoder implementation which
> have different assumptions or implementation.

It is 8 integer bits and 1 decimal bit for our hardware. Will fix our code.

Thanks,
Nipun

> 
> >
> > >
> > >
> > > > Regards,
> > > > Nipun

^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [EXT] [PATCH v4 0/8] baseband: add NXP LA12xx driver
  2021-05-05 12:31         ` [dpdk-dev] [EXT] [PATCH v4 0/8] baseband: add NXP LA12xx driver Akhil Goyal
@ 2021-06-16 20:35           ` Akhil Goyal
  2021-06-26  9:59             ` Hemant Agrawal
  0 siblings, 1 reply; 157+ messages in thread
From: Akhil Goyal @ 2021-06-16 20:35 UTC (permalink / raw)
  To: Hemant Agrawal, dev, nicolas.chautru; +Cc: david.marchand

> > Subject: [EXT] [PATCH v4 0/8] baseband: add NXP LA12xx driver
> >
> > This series introduces the BBDEV LA12xx poll mode driver (PMD) to support
> > an implementation for offloading High Phy processing functions like
> > LDPC Encode / Decode 5GNR wireless acceleration function, using PCI
> based
> > LA12xx Software defined radio.
> >
> > Please check the documentation patch for more info.
> >
> > The driver currently implements basic feature to offload only the 5G LDPC
> > encode/decode.
> >
> > A new capability has been added to check if the driver can support the
> > input data in network byte order. Two test vectors are also added as an
> > example with input data in network byte.
> >
> > v2: add test case changes
> > v3: fix 32 bit compilation
> > v4: capability for network byte order, doc patch merged inline.
> >
> > Hemant Agrawal (7):
> >   bbdev: add network order data capability
> >   baseband: introduce NXP LA12xx driver
> >   baseband/la12xx: add devargs for max queues
> >   baseband/la12xx: add support for multiple modems
> >   baseband/la12xx: add queue and modem config support
> >   baseband/la12xx: add enqueue and dequeue support
> >   app/bbdev: enable la12xx for bbdev
> >
> > Nipun Gupta (1):
> >   app/bbdev: add test vectors for transport blocks
> >
> This PMD is deferred for next release. Marked as deferred in patchworks.
Hi Hemant,

Any update on this PMD? Is it still planned for 21.08?

Regards,
Akhil

^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [EXT] [PATCH v4 0/8] baseband: add NXP LA12xx driver
  2021-06-16 20:35           ` Akhil Goyal
@ 2021-06-26  9:59             ` Hemant Agrawal
  0 siblings, 0 replies; 157+ messages in thread
From: Hemant Agrawal @ 2021-06-26  9:59 UTC (permalink / raw)
  To: Akhil Goyal, dev, nicolas.chautru; +Cc: david.marchand

Hi Akhil,
> > > Subject: [EXT] [PATCH v4 0/8] baseband: add NXP LA12xx driver
> > >
> > > This series introduces the BBDEV LA12xx poll mode driver (PMD) to
> > > support an implementation for offloading High Phy processing
> > > functions like LDPC Encode / Decode 5GNR wireless acceleration
> > > function, using PCI
> > based
> > > LA12xx Software defined radio.
> > >
> > > Please check the documentation patch for more info.
> > >
> > > The driver currently implements basic feature to offload only the 5G
> > > LDPC encode/decode.
> > >
> > > A new capability has been added to check if the driver can support
> > > the input data in network byte order. Two test vectors are also
> > > added as an example with input data in network byte.
> > >
> > > v2: add test case changes
> > > v3: fix 32 bit compilation
> > > v4: capability for network byte order, doc patch merged inline.
> > >
> > > Hemant Agrawal (7):
> > >   bbdev: add network order data capability
> > >   baseband: introduce NXP LA12xx driver
> > >   baseband/la12xx: add devargs for max queues
> > >   baseband/la12xx: add support for multiple modems
> > >   baseband/la12xx: add queue and modem config support
> > >   baseband/la12xx: add enqueue and dequeue support
> > >   app/bbdev: enable la12xx for bbdev
> > >
> > > Nipun Gupta (1):
> > >   app/bbdev: add test vectors for transport blocks
> > >
> > This PMD is deferred for next release. Marked as deferred in patchworks.
> Hi Hemant,
> 
> Any update on this PMD? Is it still planned for 21.08?
[Hemant] 
Yes, we will be sending the update shortly

> 
> Regards,
> Akhil

^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v5 0/9] baseband: add NXP LA12xx driver
  2021-03-18  6:34 [dpdk-dev] [PATCH 1/6] baseband: introduce NXP LA12xx driver Hemant Agrawal
                   ` (6 preceding siblings ...)
  2021-04-10 17:02 ` [dpdk-dev] [PATCH v2 0/8] baseband: add " Hemant Agrawal
@ 2021-09-12 12:15 ` Nipun Gupta
  2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 1/9] bbdev: add big endian processing data capability Nipun Gupta
                     ` (8 more replies)
  2021-09-24  4:37 ` [dpdk-dev] [PATCH v6 0/9] baseband: add NXP LA12xx driver nipun.gupta
                   ` (5 subsequent siblings)
  13 siblings, 9 replies; 157+ messages in thread
From: Nipun Gupta @ 2021-09-12 12:15 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

This series introduces the BBDEV LA12xx poll mode driver (PMD) to support
an implementation for offloading High Phy processing functions like
LDPC Encode / Decode 5GNR wireless acceleration function, using PCI based
LA12xx Software defined radio.

Please check the documentation patch for more info.

The driver currently implements basic feature to offload only the 5G LDPC
encode/decode.

A new capability has been added to check if the driver can support the
input data in network byte order. Two test vectors are also added as an
example with input data in network byte.

v2: add test case changes
v3: fix 32 bit compilation
v4: capability for network byte order, doc patch merged inline.
v5: add llr_size and llr_decimals, removed LLR compression flag,
    update testbbdev to handle endianness, rebased on top of 20.08

Hemant Agrawal (6):
  baseband: introduce NXP LA12xx driver
  baseband/la12xx: add devargs for max queues
  baseband/la12xx: add support for multiple modems
  baseband/la12xx: add queue and modem config support
  baseband/la12xx: add enqueue and dequeue support
  app/bbdev: enable la12xx for bbdev

Nipun Gupta (3):
  bbdev: add big endian processing data capability
  app/bbdev: handle endianness of test data
  app/bbdev: add test vectors for transport blocks

 MAINTAINERS                                   |   10 +
 app/test-bbdev/meson.build                    |    3 +
 app/test-bbdev/test_bbdev_perf.c              |   84 ++
 app/test-bbdev/test_bbdev_vector.c            |    4 +
 app/test-bbdev/test_vectors/ldpc_dec_tb.data  |  122 ++
 app/test-bbdev/test_vectors/ldpc_enc_tb.data  |   60 +
 doc/guides/bbdevs/features/default.ini        |    1 +
 doc/guides/bbdevs/features/la12xx.ini         |   14 +
 doc/guides/bbdevs/index.rst                   |    1 +
 doc/guides/bbdevs/la12xx.rst                  |  127 ++
 doc/guides/prog_guide/bbdev.rst               |    6 +
 doc/guides/rel_notes/release_21_11.rst        |    5 +
 drivers/baseband/la12xx/bbdev_la12xx.c        | 1100 +++++++++++++++++
 drivers/baseband/la12xx/bbdev_la12xx.h        |   51 +
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h    |  244 ++++
 .../baseband/la12xx/bbdev_la12xx_pmd_logs.h   |   26 +
 drivers/baseband/la12xx/meson.build           |    6 +
 drivers/baseband/la12xx/version.map           |    3 +
 drivers/baseband/meson.build                  |    1 +
 lib/bbdev/rte_bbdev_op.h                      |   14 +-
 20 files changed, 1880 insertions(+), 2 deletions(-)
 create mode 100644 app/test-bbdev/test_vectors/ldpc_dec_tb.data
 create mode 100644 app/test-bbdev/test_vectors/ldpc_enc_tb.data
 create mode 100644 doc/guides/bbdevs/features/la12xx.ini
 create mode 100644 doc/guides/bbdevs/la12xx.rst
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.c
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_ipc.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
 create mode 100644 drivers/baseband/la12xx/meson.build
 create mode 100644 drivers/baseband/la12xx/version.map

-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v5 1/9] bbdev: add big endian processing data capability
  2021-09-12 12:15 ` [dpdk-dev] [PATCH v5 0/9] " Nipun Gupta
@ 2021-09-12 12:15   ` Nipun Gupta
  2021-09-13 18:39     ` Chautru, Nicolas
  2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 2/9] baseband: introduce NXP LA12xx driver Nipun Gupta
                     ` (7 subsequent siblings)
  8 siblings, 1 reply; 157+ messages in thread
From: Nipun Gupta @ 2021-09-12 12:15 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

This patch intoduces a new capability of the bbdev device
to process the LDPC data in big endian order.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 doc/guides/bbdevs/features/default.ini |  1 +
 doc/guides/prog_guide/bbdev.rst        |  6 ++++++
 lib/bbdev/rte_bbdev_op.h               | 14 ++++++++++++--
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/doc/guides/bbdevs/features/default.ini b/doc/guides/bbdevs/features/default.ini
index 5fe267a625..ae5aacf8f7 100644
--- a/doc/guides/bbdevs/features/default.ini
+++ b/doc/guides/bbdevs/features/default.ini
@@ -14,3 +14,4 @@ LLR/HARQ Compression   =
 External DDR Access    =
 HW Accelerated         =
 BBDEV API              =
+Big Endian Processing  =
diff --git a/doc/guides/prog_guide/bbdev.rst b/doc/guides/prog_guide/bbdev.rst
index 9619280ffc..6540b514bb 100644
--- a/doc/guides/prog_guide/bbdev.rst
+++ b/doc/guides/prog_guide/bbdev.rst
@@ -747,6 +747,9 @@ given below.
 |RTE_BBDEV_LDPC_ENC_CONCATENATION                                    |
 | Set if a device supports concatenation of non byte aligned output  |
 +--------------------------------------------------------------------+
+|RTE_BBDEV_LDPC_ENC_BIG_ENDIAN                                       |
+| Set if a device supports Big Endian data processing                |
++--------------------------------------------------------------------+
 
 The structure passed for each LDPC encode operation is given below,
 with the operation flags forming a bitmask in the ``op_flags`` field.
@@ -942,6 +945,9 @@ given below.
 |RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_LOOPBACK                        |
 | Set if a device supports loopback access to HARQ internal memory   |
 +--------------------------------------------------------------------+
+|RTE_BBDEV_LDPC_DEC_BIG_ENDIAN                                       |
+| Set if a device supports Big Endian data processing                |
++--------------------------------------------------------------------+
 
 The structure passed for each LDPC decode operation is given below,
 with the operation flags forming a bitmask in the ``op_flags`` field.
diff --git a/lib/bbdev/rte_bbdev_op.h b/lib/bbdev/rte_bbdev_op.h
index f946842727..9e9b5be81f 100644
--- a/lib/bbdev/rte_bbdev_op.h
+++ b/lib/bbdev/rte_bbdev_op.h
@@ -186,7 +186,12 @@ enum rte_bbdev_op_ldpcdec_flag_bitmasks {
 	 *  for HARQ memory. If not set, it is assumed the filler bits are not
 	 *  in HARQ memory and handled directly by the LDPC decoder.
 	 */
-	RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS = (1ULL << 18)
+	RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS = (1ULL << 18),
+	/** Set if a device supports Big Endian data processing.
+	 *  If not set Little Endian data processing is supported by
+	 *  default.
+	 */
+	RTE_BBDEV_LDPC_DEC_BIG_ENDIAN = (1ULL << 8)
 };
 
 /** Flags for LDPC encoder operation and capability structure */
@@ -206,7 +211,12 @@ enum rte_bbdev_op_ldpcenc_flag_bitmasks {
 	/** Set if a device supports scatter-gather functionality. */
 	RTE_BBDEV_LDPC_ENC_SCATTER_GATHER = (1ULL << 6),
 	/** Set if a device supports concatenation of non byte aligned output */
-	RTE_BBDEV_LDPC_ENC_CONCATENATION = (1ULL << 7)
+	RTE_BBDEV_LDPC_ENC_CONCATENATION = (1ULL << 7),
+	/** Set if a device supports Big Endian data processing
+	 *  If not set Little Endian data processing is supported by
+	 *  default.
+	 */
+	RTE_BBDEV_LDPC_ENC_BIG_ENDIAN = (1ULL << 8)
 };
 
 /** Flags for the Code Block/Transport block mode  */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v5 2/9] baseband: introduce NXP LA12xx driver
  2021-09-12 12:15 ` [dpdk-dev] [PATCH v5 0/9] " Nipun Gupta
  2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 1/9] bbdev: add big endian processing data capability Nipun Gupta
@ 2021-09-12 12:15   ` Nipun Gupta
  2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 3/9] baseband/la12xx: add devargs for max queues Nipun Gupta
                     ` (6 subsequent siblings)
  8 siblings, 0 replies; 157+ messages in thread
From: Nipun Gupta @ 2021-09-12 12:15 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This patch introduce the baseband device drivers for NXP's
LA1200 series software defined baseband modem.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 MAINTAINERS                                   |   9 ++
 drivers/baseband/la12xx/bbdev_la12xx.c        | 109 ++++++++++++++++++
 .../baseband/la12xx/bbdev_la12xx_pmd_logs.h   |  26 +++++
 drivers/baseband/la12xx/meson.build           |   6 +
 drivers/baseband/la12xx/version.map           |   3 +
 drivers/baseband/meson.build                  |   1 +
 6 files changed, 154 insertions(+)
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.c
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
 create mode 100644 drivers/baseband/la12xx/meson.build
 create mode 100644 drivers/baseband/la12xx/version.map

diff --git a/MAINTAINERS b/MAINTAINERS
index 266f5ac1da..a63e672c9e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1288,6 +1288,15 @@ F: drivers/event/opdl/
 F: doc/guides/eventdevs/opdl.rst
 
 
+Baseband Drivers
+----------------
+
+NXP LA12xx driver
+M: Hemant Agrawal <hemant.agrawal@nxp.com>
+M: Nipun Gupta <nipun.gupta@nxp.com>
+F: drivers/baseband/la12xx/
+
+
 Rawdev Drivers
 --------------
 
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
new file mode 100644
index 0000000000..7050b17728
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -0,0 +1,109 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+
+#include <string.h>
+
+#include <rte_common.h>
+#include <rte_bus_vdev.h>
+#include <rte_malloc.h>
+#include <rte_ring.h>
+#include <rte_kvargs.h>
+
+#include <rte_bbdev.h>
+#include <rte_bbdev_pmd.h>
+
+#include <bbdev_la12xx_pmd_logs.h>
+
+#define DRIVER_NAME baseband_la12xx
+
+RTE_LOG_REGISTER(bbdev_la12xx_logtype, pmd.bb.la12xx, NOTICE);
+
+/* private data structure */
+struct bbdev_la12xx_private {
+	unsigned int max_nb_queues;  /**< Max number of queues */
+};
+/* Create device */
+static int
+la12xx_bbdev_create(struct rte_vdev_device *vdev)
+{
+	struct rte_bbdev *bbdev;
+	const char *name = rte_vdev_device_name(vdev);
+
+	PMD_INIT_FUNC_TRACE();
+
+	bbdev = rte_bbdev_allocate(name);
+	if (bbdev == NULL)
+		return -ENODEV;
+
+	bbdev->data->dev_private = rte_zmalloc(name,
+			sizeof(struct bbdev_la12xx_private),
+			RTE_CACHE_LINE_SIZE);
+	if (bbdev->data->dev_private == NULL) {
+		rte_bbdev_release(bbdev);
+		return -ENOMEM;
+	}
+
+	bbdev->dev_ops = NULL;
+	bbdev->device = &vdev->device;
+	bbdev->data->socket_id = 0;
+	bbdev->intr_handle = NULL;
+
+	/* register rx/tx burst functions for data path */
+	bbdev->dequeue_enc_ops = NULL;
+	bbdev->dequeue_dec_ops = NULL;
+	bbdev->enqueue_enc_ops = NULL;
+	bbdev->enqueue_dec_ops = NULL;
+
+	return 0;
+}
+
+/* Initialise device */
+static int
+la12xx_bbdev_probe(struct rte_vdev_device *vdev)
+{
+	const char *name;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (vdev == NULL)
+		return -EINVAL;
+
+	name = rte_vdev_device_name(vdev);
+	if (name == NULL)
+		return -EINVAL;
+
+	return la12xx_bbdev_create(vdev);
+}
+
+/* Uninitialise device */
+static int
+la12xx_bbdev_remove(struct rte_vdev_device *vdev)
+{
+	struct rte_bbdev *bbdev;
+	const char *name;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (vdev == NULL)
+		return -EINVAL;
+
+	name = rte_vdev_device_name(vdev);
+	if (name == NULL)
+		return -EINVAL;
+
+	bbdev = rte_bbdev_get_named_dev(name);
+	if (bbdev == NULL)
+		return -EINVAL;
+
+	rte_free(bbdev->data->dev_private);
+
+	return rte_bbdev_release(bbdev);
+}
+
+static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
+	.probe = la12xx_bbdev_probe,
+	.remove = la12xx_bbdev_remove
+};
+
+RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h b/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
new file mode 100644
index 0000000000..9dfa1cc458
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020 NXP
+ */
+
+#ifndef _BBDEV_LA12XX_PMD_LOGS_H_
+#define _BBDEV_LA12XX_PMD_LOGS_H_
+
+#define rte_bbdev_log(level, fmt, ...) \
+	rte_log(RTE_LOG_ ## level, bbdev_la12xx_logtype, fmt "\n", \
+		##__VA_ARGS__)
+
+#ifdef RTE_LIBRTE_BBDEV_DEBUG
+#define rte_bbdev_log_debug(fmt, ...) \
+		rte_bbdev_log(DEBUG, "la12xx_pmd: " fmt, \
+		##__VA_ARGS__)
+#else
+#define rte_bbdev_log_debug(fmt, ...)
+#endif
+
+#define PMD_INIT_FUNC_TRACE() rte_bbdev_log_debug(">>")
+
+/* DP Logs, toggled out at compile time if level lower than current level */
+#define rte_bbdev_dp_log(level, fmt, args...) \
+	RTE_LOG_DP(level, PMD, fmt, ## args)
+
+#endif /* _BBDEV_LA12XX_PMD_LOGS_H_ */
diff --git a/drivers/baseband/la12xx/meson.build b/drivers/baseband/la12xx/meson.build
new file mode 100644
index 0000000000..7a017dcffa
--- /dev/null
+++ b/drivers/baseband/la12xx/meson.build
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020-2021 NXP
+
+deps += ['bbdev', 'bus_vdev', 'ring']
+
+sources = files('bbdev_la12xx.c')
diff --git a/drivers/baseband/la12xx/version.map b/drivers/baseband/la12xx/version.map
new file mode 100644
index 0000000000..4a76d1d52d
--- /dev/null
+++ b/drivers/baseband/la12xx/version.map
@@ -0,0 +1,3 @@
+DPDK_21 {
+	local: *;
+};
diff --git a/drivers/baseband/meson.build b/drivers/baseband/meson.build
index 5ee61d5323..ccd1eebc3b 100644
--- a/drivers/baseband/meson.build
+++ b/drivers/baseband/meson.build
@@ -11,6 +11,7 @@ drivers = [
         'fpga_lte_fec',
         'null',
         'turbo_sw',
+        'la12xx',
 ]
 
 log_prefix = 'pmd.bb'
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v5 3/9] baseband/la12xx: add devargs for max queues
  2021-09-12 12:15 ` [dpdk-dev] [PATCH v5 0/9] " Nipun Gupta
  2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 1/9] bbdev: add big endian processing data capability Nipun Gupta
  2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 2/9] baseband: introduce NXP LA12xx driver Nipun Gupta
@ 2021-09-12 12:15   ` Nipun Gupta
  2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 4/9] baseband/la12xx: add support for multiple modems Nipun Gupta
                     ` (5 subsequent siblings)
  8 siblings, 0 replies; 157+ messages in thread
From: Nipun Gupta @ 2021-09-12 12:15 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This patch adds dev args to take  max queues as input

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c | 72 +++++++++++++++++++++++++-
 1 file changed, 70 insertions(+), 2 deletions(-)

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 7050b17728..8886b35429 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -19,13 +19,72 @@
 
 RTE_LOG_REGISTER(bbdev_la12xx_logtype, pmd.bb.la12xx, NOTICE);
 
+/*  Initialisation params structure that can be used by LA12xx BBDEV driver */
+struct bbdev_la12xx_params {
+	uint8_t queues_num; /*< LA12xx BBDEV queues number */
+};
+
+#define LA12XX_MAX_NB_QUEUES_ARG	"max_nb_queues"
+
+static const char * const bbdev_la12xx_valid_params[] = {
+	LA12XX_MAX_NB_QUEUES_ARG,
+};
+
 /* private data structure */
 struct bbdev_la12xx_private {
 	unsigned int max_nb_queues;  /**< Max number of queues */
 };
+static inline int
+parse_u16_arg(const char *key, const char *value, void *extra_args)
+{
+	uint16_t *u16 = extra_args;
+
+	unsigned int long result;
+	if ((value == NULL) || (extra_args == NULL))
+		return -EINVAL;
+	errno = 0;
+	result = strtoul(value, NULL, 0);
+	if ((result >= (1 << 16)) || (errno != 0)) {
+		rte_bbdev_log(ERR, "Invalid value %lu for %s", result, key);
+		return -ERANGE;
+	}
+	*u16 = (uint16_t)result;
+	return 0;
+}
+
+/* Parse parameters used to create device */
+static int
+parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
+		const char *input_args)
+{
+	struct rte_kvargs *kvlist = NULL;
+	int ret = 0;
+
+	if (params == NULL)
+		return -EINVAL;
+	if (input_args) {
+		kvlist = rte_kvargs_parse(input_args,
+				bbdev_la12xx_valid_params);
+		if (kvlist == NULL)
+			return -EFAULT;
+
+		ret = rte_kvargs_process(kvlist, bbdev_la12xx_valid_params[0],
+					&parse_u16_arg, &params->queues_num);
+		if (ret < 0)
+			goto exit;
+
+	}
+
+exit:
+	if (kvlist)
+		rte_kvargs_free(kvlist);
+	return ret;
+}
+
 /* Create device */
 static int
-la12xx_bbdev_create(struct rte_vdev_device *vdev)
+la12xx_bbdev_create(struct rte_vdev_device *vdev,
+		struct bbdev_la12xx_params *init_params __rte_unused)
 {
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
@@ -62,7 +121,11 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev)
 static int
 la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 {
+	struct bbdev_la12xx_params init_params = {
+		8
+	};
 	const char *name;
+	const char *input_args;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -73,7 +136,10 @@ la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 	if (name == NULL)
 		return -EINVAL;
 
-	return la12xx_bbdev_create(vdev);
+	input_args = rte_vdev_device_args(vdev);
+	parse_bbdev_la12xx_params(&init_params, input_args);
+
+	return la12xx_bbdev_create(vdev, &init_params);
 }
 
 /* Uninitialise device */
@@ -107,3 +173,5 @@ static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
 };
 
 RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
+RTE_PMD_REGISTER_PARAM_STRING(DRIVER_NAME,
+	LA12XX_MAX_NB_QUEUES_ARG"=<int>");
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v5 4/9] baseband/la12xx: add support for multiple modems
  2021-09-12 12:15 ` [dpdk-dev] [PATCH v5 0/9] " Nipun Gupta
                     ` (2 preceding siblings ...)
  2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 3/9] baseband/la12xx: add devargs for max queues Nipun Gupta
@ 2021-09-12 12:15   ` Nipun Gupta
  2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 5/9] baseband/la12xx: add queue and modem config support Nipun Gupta
                     ` (4 subsequent siblings)
  8 siblings, 0 replies; 157+ messages in thread
From: Nipun Gupta @ 2021-09-12 12:15 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This patch add support for multiple modems by assigning
a modem id as dev args in vdev creation.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c     | 64 +++++++++++++++++++---
 drivers/baseband/la12xx/bbdev_la12xx.h     | 56 +++++++++++++++++++
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 20 +++++++
 3 files changed, 133 insertions(+), 7 deletions(-)
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_ipc.h

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 8886b35429..f26f3f2a08 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -14,6 +14,8 @@
 #include <rte_bbdev_pmd.h>
 
 #include <bbdev_la12xx_pmd_logs.h>
+#include <bbdev_la12xx_ipc.h>
+#include <bbdev_la12xx.h>
 
 #define DRIVER_NAME baseband_la12xx
 
@@ -22,18 +24,18 @@ RTE_LOG_REGISTER(bbdev_la12xx_logtype, pmd.bb.la12xx, NOTICE);
 /*  Initialisation params structure that can be used by LA12xx BBDEV driver */
 struct bbdev_la12xx_params {
 	uint8_t queues_num; /*< LA12xx BBDEV queues number */
+	int8_t modem_id; /*< LA12xx modem instance id */
 };
 
 #define LA12XX_MAX_NB_QUEUES_ARG	"max_nb_queues"
+#define LA12XX_VDEV_MODEM_ID_ARG	"modem"
+#define LA12XX_MAX_MODEM 4
 
 static const char * const bbdev_la12xx_valid_params[] = {
 	LA12XX_MAX_NB_QUEUES_ARG,
+	LA12XX_VDEV_MODEM_ID_ARG,
 };
 
-/* private data structure */
-struct bbdev_la12xx_private {
-	unsigned int max_nb_queues;  /**< Max number of queues */
-};
 static inline int
 parse_u16_arg(const char *key, const char *value, void *extra_args)
 {
@@ -52,6 +54,28 @@ parse_u16_arg(const char *key, const char *value, void *extra_args)
 	return 0;
 }
 
+/* Parse integer from integer argument */
+static int
+parse_integer_arg(const char *key __rte_unused,
+		const char *value, void *extra_args)
+{
+	int i;
+	char *end;
+
+	errno = 0;
+
+	i = strtol(value, &end, 10);
+	if (*end != 0 || errno != 0 || i < 0 || i > LA12XX_MAX_MODEM) {
+		rte_bbdev_log(ERR, "Supported Port IDS are 0 to %d",
+			LA12XX_MAX_MODEM - 1);
+		return -EINVAL;
+	}
+
+	*((uint32_t *)extra_args) = i;
+
+	return 0;
+}
+
 /* Parse parameters used to create device */
 static int
 parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
@@ -73,6 +97,16 @@ parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
 		if (ret < 0)
 			goto exit;
 
+		ret = rte_kvargs_process(kvlist,
+					bbdev_la12xx_valid_params[1],
+					&parse_integer_arg,
+					&params->modem_id);
+
+		if (params->modem_id >= LA12XX_MAX_MODEM) {
+			rte_bbdev_log(ERR, "Invalid modem id, must be < %u",
+					LA12XX_MAX_MODEM);
+			goto exit;
+		}
 	}
 
 exit:
@@ -84,10 +118,11 @@ parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
 /* Create device */
 static int
 la12xx_bbdev_create(struct rte_vdev_device *vdev,
-		struct bbdev_la12xx_params *init_params __rte_unused)
+		struct bbdev_la12xx_params *init_params)
 {
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
+	struct bbdev_la12xx_private *priv;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -103,6 +138,20 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 		return -ENOMEM;
 	}
 
+	priv = bbdev->data->dev_private;
+	priv->modem_id = init_params->modem_id;
+	/* if modem id is not configured */
+	if (priv->modem_id == -1)
+		priv->modem_id = bbdev->data->dev_id;
+
+	/* Reset Global variables */
+	priv->num_ldpc_enc_queues = 0;
+	priv->num_ldpc_dec_queues = 0;
+	priv->num_valid_queues = 0;
+	priv->max_nb_queues = init_params->queues_num;
+
+	rte_bbdev_log(INFO, "Setting Up %s: DevId=%d, ModemId=%d",
+				name, bbdev->data->dev_id, priv->modem_id);
 	bbdev->dev_ops = NULL;
 	bbdev->device = &vdev->device;
 	bbdev->data->socket_id = 0;
@@ -122,7 +171,7 @@ static int
 la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 {
 	struct bbdev_la12xx_params init_params = {
-		8
+		8, -1,
 	};
 	const char *name;
 	const char *input_args;
@@ -174,4 +223,5 @@ static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
 
 RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
 RTE_PMD_REGISTER_PARAM_STRING(DRIVER_NAME,
-	LA12XX_MAX_NB_QUEUES_ARG"=<int>");
+	LA12XX_MAX_NB_QUEUES_ARG"=<int>"
+	LA12XX_VDEV_MODEM_ID_ARG "=<int> ");
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.h b/drivers/baseband/la12xx/bbdev_la12xx.h
new file mode 100644
index 0000000000..5228502331
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx.h
@@ -0,0 +1,56 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+
+#ifndef __BBDEV_LA12XX_H__
+#define __BBDEV_LA12XX_H__
+
+#define BBDEV_IPC_ENC_OP_TYPE	1
+#define BBDEV_IPC_DEC_OP_TYPE	2
+
+#define MAX_LDPC_ENC_FECA_QUEUES	4
+#define MAX_LDPC_DEC_FECA_QUEUES	4
+
+#define MAX_CHANNEL_DEPTH 16
+/* private data structure */
+struct bbdev_la12xx_private {
+	void *ipc_priv;
+	uint8_t num_valid_queues;
+	uint8_t max_nb_queues;
+	uint8_t num_ldpc_enc_queues;
+	uint8_t num_ldpc_dec_queues;
+	int8_t modem_id;
+	struct bbdev_la12xx_q_priv *queues_priv[32];
+};
+
+struct hugepage_info {
+	void *vaddr;
+	phys_addr_t paddr;
+	size_t len;
+};
+
+struct bbdev_la12xx_q_priv {
+	struct bbdev_la12xx_private *bbdev_priv;
+	uint32_t q_id;	/**< Channel ID */
+	uint32_t feca_blk_id;	/** FECA block ID for processing */
+	uint32_t feca_blk_id_be32; /**< FECA Block ID for this queue */
+	uint8_t en_napi; /* 0: napi disabled, 1: napi enabled */
+	uint16_t queue_size;	/**< Queue depth */
+	int32_t eventfd;	/**< Event FD value */
+	enum rte_bbdev_op_type op_type; /**< Operation type */
+	uint32_t la12xx_core_id;
+		/* LA12xx core ID on which this will be scheduled */
+	struct rte_mempool *mp; /**< Pool from where buffers would be cut */
+	void *bbdev_op[MAX_CHANNEL_DEPTH];
+			/**< Stores bbdev op for each index */
+	void *msg_ch_vaddr[MAX_CHANNEL_DEPTH];
+			/**< Stores msg channel addr for modem->host */
+	uint32_t host_pi;	/**< Producer_Index for HOST->MODEM */
+	uint32_t host_ci;	/**< Consumer Index for MODEM->HOST */
+	host_ipc_params_t *host_params; /**< Host parameters */
+};
+
+#define lower_32_bits(x) ((uint32_t)((uint64_t)x))
+#define upper_32_bits(x) ((uint32_t)(((uint64_t)(x) >> 16) >> 16))
+
+#endif
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
new file mode 100644
index 0000000000..9aa5562981
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+#ifndef __BBDEV_LA12XX_IPC_H__
+#define __BBDEV_LA12XX_IPC_H__
+
+/** No. of max channel per instance */
+#define IPC_MAX_DEPTH	(16)
+
+/* This shared memory would be on the host side which have copy of some
+ * of the parameters which are also part of Shared BD ring. Read access
+ * of these parameters from the host side would not be over PCI.
+ */
+typedef struct host_ipc_params {
+	volatile uint32_t pi;
+	volatile uint32_t ci;
+	volatile uint32_t modem_ptr[IPC_MAX_DEPTH];
+} __rte_packed host_ipc_params_t;
+
+#endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v5 5/9] baseband/la12xx: add queue and modem config support
  2021-09-12 12:15 ` [dpdk-dev] [PATCH v5 0/9] " Nipun Gupta
                     ` (3 preceding siblings ...)
  2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 4/9] baseband/la12xx: add support for multiple modems Nipun Gupta
@ 2021-09-12 12:15   ` Nipun Gupta
  2021-09-13 18:56     ` Chautru, Nicolas
  2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 6/9] baseband/la12xx: add enqueue and dequeue support Nipun Gupta
                     ` (3 subsequent siblings)
  8 siblings, 1 reply; 157+ messages in thread
From: Nipun Gupta @ 2021-09-12 12:15 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This patch add support for connecting with modem
and creating the ipc channel as queues with modem
for the exchange of data.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 MAINTAINERS                                |   1 +
 doc/guides/bbdevs/index.rst                |   1 +
 doc/guides/bbdevs/la12xx.rst               |  81 +++
 doc/guides/rel_notes/release_21_11.rst     |   5 +
 drivers/baseband/la12xx/bbdev_la12xx.c     | 553 ++++++++++++++++++++-
 drivers/baseband/la12xx/bbdev_la12xx.h     |  11 +-
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 189 ++++++-
 7 files changed, 831 insertions(+), 10 deletions(-)
 create mode 100644 doc/guides/bbdevs/la12xx.rst

diff --git a/MAINTAINERS b/MAINTAINERS
index a63e672c9e..2c243c10fe 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1295,6 +1295,7 @@ NXP LA12xx driver
 M: Hemant Agrawal <hemant.agrawal@nxp.com>
 M: Nipun Gupta <nipun.gupta@nxp.com>
 F: drivers/baseband/la12xx/
+F: doc/guides/bbdevs/la12xx.rst
 
 
 Rawdev Drivers
diff --git a/doc/guides/bbdevs/index.rst b/doc/guides/bbdevs/index.rst
index 4445cbd1b0..cedd706fa6 100644
--- a/doc/guides/bbdevs/index.rst
+++ b/doc/guides/bbdevs/index.rst
@@ -14,3 +14,4 @@ Baseband Device Drivers
     fpga_lte_fec
     fpga_5gnr_fec
     acc100
+    la12xx
diff --git a/doc/guides/bbdevs/la12xx.rst b/doc/guides/bbdevs/la12xx.rst
new file mode 100644
index 0000000000..3c9ac5c047
--- /dev/null
+++ b/doc/guides/bbdevs/la12xx.rst
@@ -0,0 +1,81 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright 2021 NXP
+
+NXP LA12xx Poll Mode Driver
+=======================================
+
+The BBDEV LA12xx poll mode driver (PMD) supports an implementation for
+offloading High Phy processing functions like LDPC Encode / Decode 5GNR wireless
+acceleration function, using PCI based LA12xx Software defined radio.
+
+More information can be found at `NXP Official Website
+<https://www.nxp.com/products/processors-and-microcontrollers/arm-processors/layerscape-processors/layerscape-access-la1200-programmable-baseband-processor:LA1200>`_.
+
+Features
+--------
+
+LA12xx PMD supports the following features:
+
+- Maximum of 8 UL queues
+- Maximum of 8 DL queues
+- PCIe Gen-3 x8 Interface
+- MSI-X
+
+Installation
+------------
+
+Section 3 of the DPDK manual provides instructions on installing and compiling DPDK.
+
+DPDK requires hugepages to be configured as detailed in section 2 of the DPDK manual.
+
+Initialization
+--------------
+
+The device can be listed on the host console with:
+
+
+Use the following lspci command to get the multiple LA12xx processor ids. The
+device ID of the LA12xx baseband processor is "1c30".
+
+.. code-block:: console
+
+  sudo lspci -nn
+
+...
+0001:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device [1957:1c30] (
+rev 10)
+...
+0002:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device [1957:1c30] (
+rev 10)
+
+
+Prerequisites
+-------------
+
+Currently supported by DPDK:
+
+- NXP LA1224 BSP **1.0+**.
+- NXP LA1224 PCIe Modem card connected to ARM host.
+
+- Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup the basic DPDK environment.
+
+* Use dev arg option ``modem=0`` to identify the modem instance for a given
+  device. This is required only if more than 1 modem cards are attached to host.
+  this is optional and the default value is 0.
+  e.g. ``--vdev=baseband_la12xx,modem=0``
+
+* Use dev arg option ``max_nb_queues=x`` to specify the maximum number of queues
+  to be used for communication with offload device i.e. modem. default is 16.
+  e.g. ``--vdev=baseband_la12xx,max_nb_queues=4``
+
+Enabling logs
+-------------
+
+For enabling logs, use the following EAL parameter:
+
+.. code-block:: console
+
+   ./your_bbdev_application <EAL args> --log-level=la12xx:<level>
+
+Using ``bb.la12xx`` as log matching criteria, all Baseband PMD logs can be
+enabled which are lower than logging ``level``.
diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst
index 675b573834..a0e0ebbeb8 100644
--- a/doc/guides/rel_notes/release_21_11.rst
+++ b/doc/guides/rel_notes/release_21_11.rst
@@ -62,6 +62,11 @@ New Features
   * Added bus-level parsing of the devargs syntax.
   * Kept compatibility with the legacy syntax as parsing fallback.
 
+* **Added NXP LA12xx baseband PMD.**
+
+  * Added a new baseband PMD driver for NXP LA12xx Software defined radio.
+  * See the :doc:`../bbdevs/la12xx` for more details.
+
 
 Removed Items
 -------------
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index f26f3f2a08..57e957a93a 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -3,6 +3,11 @@
  */
 
 #include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <dirent.h>
 
 #include <rte_common.h>
 #include <rte_bus_vdev.h>
@@ -31,11 +36,550 @@ struct bbdev_la12xx_params {
 #define LA12XX_VDEV_MODEM_ID_ARG	"modem"
 #define LA12XX_MAX_MODEM 4
 
+#define LA12XX_MAX_CORES	4
+#define LA12XX_LDPC_ENC_CORE	0
+#define LA12XX_LDPC_DEC_CORE	1
+
+#define LA12XX_MAX_LDPC_ENC_QUEUES	4
+#define LA12XX_MAX_LDPC_DEC_QUEUES	4
+
 static const char * const bbdev_la12xx_valid_params[] = {
 	LA12XX_MAX_NB_QUEUES_ARG,
 	LA12XX_VDEV_MODEM_ID_ARG,
 };
 
+static const struct rte_bbdev_op_cap bbdev_capabilities[] = {
+	{
+		.type   = RTE_BBDEV_OP_LDPC_ENC,
+		.cap.ldpc_enc = {
+			.capability_flags =
+					RTE_BBDEV_LDPC_CRC_24A_ATTACH |
+					RTE_BBDEV_LDPC_CRC_24B_ATTACH,
+			.num_buffers_src =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+			.num_buffers_dst =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+		}
+	},
+	{
+		.type   = RTE_BBDEV_OP_LDPC_DEC,
+		.cap.ldpc_dec = {
+			.capability_flags =
+				RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK |
+					RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK |
+					RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP,
+			.num_buffers_src =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+			.num_buffers_hard_out =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+			.llr_size = 8,
+			.llr_decimals = 1,
+		}
+	},
+	RTE_BBDEV_END_OF_CAPABILITIES_LIST()
+};
+
+static struct rte_bbdev_queue_conf default_queue_conf = {
+	.queue_size = MAX_CHANNEL_DEPTH,
+};
+
+/* Get device info */
+static void
+la12xx_info_get(struct rte_bbdev *dev __rte_unused,
+		struct rte_bbdev_driver_info *dev_info)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	dev_info->driver_name = RTE_STR(DRIVER_NAME);
+	dev_info->max_num_queues = LA12XX_MAX_QUEUES;
+	dev_info->queue_size_lim = MAX_CHANNEL_DEPTH;
+	dev_info->hardware_accelerated = true;
+	dev_info->max_dl_queue_priority = 0;
+	dev_info->max_ul_queue_priority = 0;
+	dev_info->default_queue_conf = default_queue_conf;
+	dev_info->capabilities = bbdev_capabilities;
+	dev_info->cpu_flag_reqs = NULL;
+	dev_info->min_alignment = 64;
+
+	rte_bbdev_log_debug("got device info from %u", dev->data->dev_id);
+}
+
+/* Release queue */
+static int
+la12xx_queue_release(struct rte_bbdev *dev, uint16_t q_id)
+{
+	RTE_SET_USED(dev);
+	RTE_SET_USED(q_id);
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* TODO: Implement */
+
+	return 0;
+}
+
+#define HUGEPG_OFFSET(A) \
+		((uint64_t) ((unsigned long) (A) \
+		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
+
+static int ipc_queue_configure(uint32_t channel_id,
+		ipc_t instance, struct bbdev_la12xx_q_priv *q_priv)
+{
+	ipc_userspace_t *ipc_priv = (ipc_userspace_t *)instance;
+	ipc_instance_t *ipc_instance = ipc_priv->instance;
+	ipc_ch_t *ch;
+	void *vaddr;
+	uint32_t i = 0;
+	uint32_t msg_size = sizeof(struct bbdev_ipc_enqueue_op);
+
+	PMD_INIT_FUNC_TRACE();
+
+	rte_bbdev_log_debug("%x %p", ipc_instance->initialized,
+		ipc_priv->instance);
+	ch = &(ipc_instance->ch_list[channel_id]);
+
+	rte_bbdev_log_debug("channel: %u, depth: %u, msg size: %u",
+		channel_id, q_priv->queue_size, msg_size);
+
+	/* Start init of channel */
+	ch->md.ring_size = rte_cpu_to_be_32(q_priv->queue_size);
+	ch->md.pi = 0;
+	ch->md.ci = 0;
+	ch->md.msg_size = msg_size;
+	for (i = 0; i < q_priv->queue_size; i++) {
+		vaddr = rte_malloc(NULL, msg_size, RTE_CACHE_LINE_SIZE);
+		if (!vaddr)
+			return IPC_HOST_BUF_ALLOC_FAIL;
+		/* Only offset now */
+		ch->bd_h[i].modem_ptr =
+			rte_cpu_to_be_32(HUGEPG_OFFSET(vaddr));
+		ch->bd_h[i].host_virt_l = lower_32_bits(vaddr);
+		ch->bd_h[i].host_virt_h = upper_32_bits(vaddr);
+		q_priv->msg_ch_vaddr[i] = vaddr;
+		/* Not sure use of this len may be for CRC*/
+		ch->bd_h[i].len = 0;
+	}
+	ch->host_ipc_params =
+		rte_cpu_to_be_32(HUGEPG_OFFSET(q_priv->host_params));
+
+	rte_bbdev_log_debug("Channel configured");
+	return IPC_SUCCESS;
+}
+
+static int
+la12xx_e200_queue_setup(struct rte_bbdev *dev,
+		struct bbdev_la12xx_q_priv *q_priv)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	struct gul_hif *mhif;
+	ipc_metadata_t *ipc_md;
+	ipc_ch_t *ch;
+	int instance_id = 0, i;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		q_priv->la12xx_core_id = LA12XX_LDPC_ENC_CORE;
+		break;
+	case RTE_BBDEV_OP_LDPC_DEC:
+		q_priv->la12xx_core_id = LA12XX_LDPC_DEC_CORE;
+		break;
+	default:
+		rte_bbdev_log(ERR, "Unsupported op type\n");
+		return -1;
+	}
+
+	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+	/* offset is from start of PEB */
+	ipc_md = (ipc_metadata_t *)((uint64_t)ipc_priv->peb_start.host_vaddr +
+		mhif->ipc_regs.ipc_mdata_offset);
+	ch = &ipc_md->instance_list[instance_id].ch_list[q_priv->q_id];
+
+	if (q_priv->q_id < priv->num_valid_queues) {
+		ipc_br_md_t *md = &(ch->md);
+
+		q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
+		q_priv->feca_blk_id_be32 = ch->feca_blk_id;
+		q_priv->host_pi = rte_be_to_cpu_32(md->pi);
+		q_priv->host_ci = rte_be_to_cpu_32(md->ci);
+		q_priv->host_params = (host_ipc_params_t *)
+			(rte_be_to_cpu_32(ch->host_ipc_params) +
+			((uint64_t)ipc_priv->hugepg_start.host_vaddr));
+
+		for (i = 0; i < q_priv->queue_size; i++) {
+			uint32_t h, l;
+
+			h = ch->bd_h[i].host_virt_h;
+			l = ch->bd_h[i].host_virt_l;
+			q_priv->msg_ch_vaddr[i] = (void *)join_32_bits(h, l);
+		}
+
+		rte_bbdev_log(WARNING,
+			"Queue [%d] already configured, not configuring again",
+			q_priv->q_id);
+		return 0;
+	}
+
+	rte_bbdev_log_debug("setting up queue %d", q_priv->q_id);
+
+	/* Call ipc_configure_channel */
+	ret = ipc_queue_configure(q_priv->q_id, ipc_priv, q_priv);
+	if (ret) {
+		rte_bbdev_log(ERR, "Unable to setup queue (%d) (err=%d)",
+		       q_priv->q_id, ret);
+		return ret;
+	}
+
+	/* Set queue properties for LA12xx device */
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		if (priv->num_ldpc_enc_queues >= LA12XX_MAX_LDPC_ENC_QUEUES) {
+			rte_bbdev_log(ERR,
+				"num_ldpc_enc_queues reached max value");
+			return -1;
+		}
+		ch->la12xx_core_id =
+			rte_cpu_to_be_32(LA12XX_LDPC_ENC_CORE);
+		ch->feca_blk_id = rte_cpu_to_be_32(priv->num_ldpc_enc_queues++);
+		break;
+	case RTE_BBDEV_OP_LDPC_DEC:
+		if (priv->num_ldpc_dec_queues >= LA12XX_MAX_LDPC_DEC_QUEUES) {
+			rte_bbdev_log(ERR,
+				"num_ldpc_dec_queues reached max value");
+			return -1;
+		}
+		ch->la12xx_core_id =
+			rte_cpu_to_be_32(LA12XX_LDPC_DEC_CORE);
+		ch->feca_blk_id = rte_cpu_to_be_32(priv->num_ldpc_dec_queues++);
+		break;
+	default:
+		rte_bbdev_log(ERR, "Not supported op type\n");
+		return -1;
+	}
+	ch->op_type = rte_cpu_to_be_32(q_priv->op_type);
+	ch->depth = rte_cpu_to_be_32(q_priv->queue_size);
+
+	/* Store queue config here */
+	q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
+	q_priv->feca_blk_id_be32 = ch->feca_blk_id;
+
+	return 0;
+}
+
+/* Setup a queue */
+static int
+la12xx_queue_setup(struct rte_bbdev *dev, uint16_t q_id,
+		const struct rte_bbdev_queue_conf *queue_conf)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	struct rte_bbdev_queue_data *q_data;
+	struct bbdev_la12xx_q_priv *q_priv;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* Move to setup_queues callback */
+	q_data = &dev->data->queues[q_id];
+	q_data->queue_private = rte_zmalloc(NULL,
+		sizeof(struct bbdev_la12xx_q_priv), 0);
+	if (!q_data->queue_private) {
+		rte_bbdev_log(ERR, "Memory allocation failed for qpriv");
+		return -ENOMEM;
+	}
+	q_priv = q_data->queue_private;
+	q_priv->q_id = q_id;
+	q_priv->bbdev_priv = dev->data->dev_private;
+	q_priv->queue_size = queue_conf->queue_size;
+	q_priv->op_type = queue_conf->op_type;
+
+	ret = la12xx_e200_queue_setup(dev, q_priv);
+	if (ret) {
+		rte_bbdev_log(ERR, "e200_queue_setup failed for qid: %d",
+				     q_id);
+		return ret;
+	}
+
+	/* Store queue config here */
+	priv->num_valid_queues++;
+
+	return 0;
+}
+
+static int
+la12xx_start(struct rte_bbdev *dev)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	int ready = 0;
+	struct gul_hif *hif_start;
+
+	PMD_INIT_FUNC_TRACE();
+
+	hif_start = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+
+	/* Set Host Read bit */
+	SET_HIF_HOST_RDY(hif_start, HIF_HOST_READY_IPC_APP);
+
+	/* Now wait for modem ready bit */
+	while (!ready)
+		ready = CHK_HIF_MOD_RDY(hif_start, HIF_MOD_READY_IPC_APP);
+
+	return 0;
+}
+
+static const struct rte_bbdev_ops pmd_ops = {
+	.info_get = la12xx_info_get,
+	.queue_setup = la12xx_queue_setup,
+	.queue_release = la12xx_queue_release,
+	.start = la12xx_start
+};
+static struct hugepage_info *
+get_hugepage_info(void)
+{
+	struct hugepage_info *hp_info;
+	struct rte_memseg *mseg;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* TODO - find a better way */
+	hp_info = rte_malloc(NULL, sizeof(struct hugepage_info), 0);
+	if (!hp_info) {
+		rte_bbdev_log(ERR, "Unable to allocate on local heap");
+		return NULL;
+	}
+
+	mseg = rte_mem_virt2memseg(hp_info, NULL);
+	hp_info->vaddr = mseg->addr;
+	hp_info->paddr = rte_mem_virt2phy(mseg->addr);
+	hp_info->len = mseg->len;
+
+	return hp_info;
+}
+
+static int open_ipc_dev(int modem_id)
+{
+	char dev_initials[16], dev_path[PATH_MAX];
+	struct dirent *entry;
+	int dev_ipc = 0;
+	DIR *dir;
+
+	dir = opendir("/dev/");
+	if (!dir) {
+		rte_bbdev_log(ERR, "Unable to open /dev/");
+		return -1;
+	}
+
+	sprintf(dev_initials, "gulipcgul%d", modem_id);
+
+	while ((entry = readdir(dir)) != NULL) {
+		if (!strncmp(dev_initials, entry->d_name,
+		    sizeof(dev_initials) - 1))
+			break;
+	}
+
+	if (!entry) {
+		rte_bbdev_log(ERR, "Error: No gulipcgul%d device", modem_id);
+		return -1;
+	}
+
+	sprintf(dev_path, "/dev/%s", entry->d_name);
+	dev_ipc = open(dev_path, O_RDWR);
+	if (dev_ipc  < 0) {
+		rte_bbdev_log(ERR, "Error: Cannot open %s", dev_path);
+		return -errno;
+	}
+
+	return dev_ipc;
+}
+
+static int
+setup_la12xx_dev(struct rte_bbdev *dev)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	struct hugepage_info *hp = NULL;
+	ipc_channel_us_t *ipc_priv_ch = NULL;
+	int dev_ipc = 0, dev_mem = 0, i;
+	ipc_metadata_t *ipc_md;
+	struct gul_hif *mhif;
+	uint32_t phy_align = 0;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (!ipc_priv) {
+		/* TODO - get a better way */
+		/* Get the hugepage info against it */
+		hp = get_hugepage_info();
+		if (!hp) {
+			rte_bbdev_log(ERR, "Unable to get hugepage info");
+			ret = -ENOMEM;
+			goto err;
+		}
+
+		rte_bbdev_log_debug("%lx %p %lx",
+				hp->paddr, hp->vaddr, hp->len);
+
+		ipc_priv = rte_zmalloc(0, sizeof(ipc_userspace_t), 0);
+		if (ipc_priv == NULL) {
+			rte_bbdev_log(ERR,
+				"Unable to allocate memory for ipc priv");
+			ret = -ENOMEM;
+			goto err;
+		}
+
+		for (i = 0; i < IPC_MAX_CHANNEL_COUNT; i++) {
+			ipc_priv_ch = rte_zmalloc(0,
+				sizeof(ipc_channel_us_t), 0);
+			if (ipc_priv_ch == NULL) {
+				rte_bbdev_log(ERR,
+					"Unable to allocate memory for channels");
+				ret = -ENOMEM;
+			}
+			ipc_priv->channels[i] = ipc_priv_ch;
+		}
+
+		dev_mem = open("/dev/mem", O_RDWR);
+		if (dev_mem < 0) {
+			rte_bbdev_log(ERR, "Error: Cannot open /dev/mem");
+			ret = -errno;
+			goto err;
+		}
+
+		ipc_priv->instance_id = 0;
+		ipc_priv->dev_mem = dev_mem;
+
+		rte_bbdev_log_debug("hugepg input %lx %p %lx",
+			hp->paddr, hp->vaddr, hp->len);
+
+		ipc_priv->sys_map.hugepg_start.host_phys = hp->paddr;
+		ipc_priv->sys_map.hugepg_start.size = hp->len;
+
+		ipc_priv->hugepg_start.host_phys = hp->paddr;
+		ipc_priv->hugepg_start.host_vaddr = hp->vaddr;
+		ipc_priv->hugepg_start.size = hp->len;
+
+		rte_free(hp);
+	}
+
+	dev_ipc = open_ipc_dev(priv->modem_id);
+	if (dev_ipc < 0) {
+		rte_bbdev_log(ERR, "Error: open_ipc_dev failed");
+		goto err;
+	}
+	ipc_priv->dev_ipc = dev_ipc;
+
+	ret = ioctl(ipc_priv->dev_ipc, IOCTL_GUL_IPC_GET_SYS_MAP,
+		    &ipc_priv->sys_map);
+	if (ret) {
+		rte_bbdev_log(ERR,
+			"IOCTL_GUL_IPC_GET_SYS_MAP ioctl failed");
+		goto err;
+	}
+
+	phy_align = (ipc_priv->sys_map.mhif_start.host_phys % 0x1000);
+	ipc_priv->mhif_start.host_vaddr =
+		mmap(0, ipc_priv->sys_map.mhif_start.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.mhif_start.host_phys - phy_align));
+	if (ipc_priv->mhif_start.host_vaddr == MAP_FAILED) {
+		rte_bbdev_log(ERR, "MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->mhif_start.host_vaddr = (void *) ((uint64_t)
+		(ipc_priv->mhif_start.host_vaddr) + phy_align);
+
+	phy_align = (ipc_priv->sys_map.peb_start.host_phys % 0x1000);
+	ipc_priv->peb_start.host_vaddr =
+		mmap(0, ipc_priv->sys_map.peb_start.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.peb_start.host_phys - phy_align));
+	if (ipc_priv->peb_start.host_vaddr == MAP_FAILED) {
+		rte_bbdev_log(ERR, "MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->peb_start.host_vaddr = (void *)((uint64_t)
+		(ipc_priv->peb_start.host_vaddr) + phy_align);
+
+	phy_align = (ipc_priv->sys_map.modem_ccsrbar.host_phys % 0x1000);
+	ipc_priv->modem_ccsrbar.host_vaddr =
+		mmap(0, ipc_priv->sys_map.modem_ccsrbar.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.modem_ccsrbar.host_phys - phy_align));
+	if (ipc_priv->modem_ccsrbar.host_vaddr == MAP_FAILED) {
+		rte_bbdev_log(ERR, "MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->modem_ccsrbar.host_vaddr = (void *)((uint64_t)
+		(ipc_priv->modem_ccsrbar.host_vaddr) + phy_align);
+
+	ipc_priv->hugepg_start.modem_phys =
+		ipc_priv->sys_map.hugepg_start.modem_phys;
+
+	ipc_priv->mhif_start.host_phys =
+		ipc_priv->sys_map.mhif_start.host_phys;
+	ipc_priv->mhif_start.size = ipc_priv->sys_map.mhif_start.size;
+	ipc_priv->peb_start.host_phys = ipc_priv->sys_map.peb_start.host_phys;
+	ipc_priv->peb_start.size = ipc_priv->sys_map.peb_start.size;
+
+	rte_bbdev_log(INFO, "peb %lx %p %x",
+			ipc_priv->peb_start.host_phys,
+			ipc_priv->peb_start.host_vaddr,
+			ipc_priv->peb_start.size);
+	rte_bbdev_log(INFO, "hugepg %lx %p %x",
+			ipc_priv->hugepg_start.host_phys,
+			ipc_priv->hugepg_start.host_vaddr,
+			ipc_priv->hugepg_start.size);
+	rte_bbdev_log(INFO, "mhif %lx %p %x",
+			ipc_priv->mhif_start.host_phys,
+			ipc_priv->mhif_start.host_vaddr,
+			ipc_priv->mhif_start.size);
+	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+
+	/* offset is from start of PEB */
+	ipc_md = (ipc_metadata_t *)((uint64_t)ipc_priv->peb_start.host_vaddr +
+			mhif->ipc_regs.ipc_mdata_offset);
+
+	if (sizeof(ipc_metadata_t) != mhif->ipc_regs.ipc_mdata_size) {
+		rte_bbdev_log(ERR,
+			"ipc_metadata_t =%lx, mhif->ipc_regs.ipc_mdata_size=%x",
+			sizeof(ipc_metadata_t), mhif->ipc_regs.ipc_mdata_size);
+		rte_bbdev_log(ERR, "--> mhif->ipc_regs.ipc_mdata_offset= %x",
+			mhif->ipc_regs.ipc_mdata_offset);
+		rte_bbdev_log(ERR, "gul_hif size=%lx", sizeof(struct gul_hif));
+		return IPC_MD_SZ_MISS_MATCH;
+	}
+
+	ipc_priv->instance = (ipc_instance_t *)
+		(&ipc_md->instance_list[ipc_priv->instance_id]);
+
+	rte_bbdev_log_debug("finish host init");
+
+	priv->ipc_priv = ipc_priv;
+
+	return 0;
+
+err:
+	rte_free(hp);
+	rte_free(ipc_priv);
+	rte_free(ipc_priv_ch);
+	if (dev_mem)
+		close(dev_mem);
+	if (dev_ipc)
+		close(dev_ipc);
+
+	return ret;
+}
+
 static inline int
 parse_u16_arg(const char *key, const char *value, void *extra_args)
 {
@@ -123,6 +667,7 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
 	struct bbdev_la12xx_private *priv;
+	int ret;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -152,7 +697,13 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 
 	rte_bbdev_log(INFO, "Setting Up %s: DevId=%d, ModemId=%d",
 				name, bbdev->data->dev_id, priv->modem_id);
-	bbdev->dev_ops = NULL;
+	ret = setup_la12xx_dev(bbdev);
+	if (ret) {
+		rte_bbdev_log(ERR, "IPC Setup failed for %s", name);
+		rte_free(bbdev->data->dev_private);
+		return ret;
+	}
+	bbdev->dev_ops = &pmd_ops;
 	bbdev->device = &vdev->device;
 	bbdev->data->socket_id = 0;
 	bbdev->intr_handle = NULL;
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.h b/drivers/baseband/la12xx/bbdev_la12xx.h
index 5228502331..49c37fe2fe 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx.h
@@ -5,16 +5,10 @@
 #ifndef __BBDEV_LA12XX_H__
 #define __BBDEV_LA12XX_H__
 
-#define BBDEV_IPC_ENC_OP_TYPE	1
-#define BBDEV_IPC_DEC_OP_TYPE	2
-
-#define MAX_LDPC_ENC_FECA_QUEUES	4
-#define MAX_LDPC_DEC_FECA_QUEUES	4
-
 #define MAX_CHANNEL_DEPTH 16
 /* private data structure */
 struct bbdev_la12xx_private {
-	void *ipc_priv;
+	ipc_userspace_t *ipc_priv;
 	uint8_t num_valid_queues;
 	uint8_t max_nb_queues;
 	uint8_t num_ldpc_enc_queues;
@@ -52,5 +46,6 @@ struct bbdev_la12xx_q_priv {
 
 #define lower_32_bits(x) ((uint32_t)((uint64_t)x))
 #define upper_32_bits(x) ((uint32_t)(((uint64_t)(x) >> 16) >> 16))
-
+#define join_32_bits(upper, lower) \
+	((size_t)(((uint64_t)(upper) << 32) | (uint32_t)(lower)))
 #endif
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
index 9aa5562981..5f613fb087 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -4,9 +4,182 @@
 #ifndef __BBDEV_LA12XX_IPC_H__
 #define __BBDEV_LA12XX_IPC_H__
 
+#define LA12XX_MAX_QUEUES 20
+#define HOST_RX_QUEUEID_OFFSET LA12XX_MAX_QUEUES
+
+/** No. of max channel per instance */
+#define IPC_MAX_CHANNEL_COUNT	(64)
+
 /** No. of max channel per instance */
 #define IPC_MAX_DEPTH	(16)
 
+/** No. of max IPC instance per modem */
+#define IPC_MAX_INSTANCE_COUNT	(1)
+
+/** Error codes */
+#define IPC_SUCCESS		(0) /** IPC operation success */
+#define IPC_INPUT_INVALID	(-1) /** Invalid input to API */
+#define IPC_CH_INVALID		(-2) /** Channel no is invalid */
+#define IPC_INSTANCE_INVALID	(-3) /** Instance no is invalid */
+#define IPC_MEM_INVALID		(-4) /** Insufficient memory */
+#define IPC_CH_FULL		(-5) /** Channel is full */
+#define IPC_CH_EMPTY		(-6) /** Channel is empty */
+#define IPC_BL_EMPTY		(-7) /** Free buffer list is empty */
+#define IPC_BL_FULL		(-8) /** Free buffer list is full */
+#define IPC_HOST_BUF_ALLOC_FAIL	(-9) /** DPDK malloc fail */
+#define IPC_MD_SZ_MISS_MATCH	(-10) /** META DATA size in mhif miss matched*/
+#define IPC_MALLOC_FAIL		(-11) /** system malloc fail */
+#define IPC_IOCTL_FAIL		(-12) /** IOCTL call failed */
+#define IPC_MMAP_FAIL		(-14) /** MMAP fail */
+#define IPC_OPEN_FAIL		(-15) /** OPEN fail */
+#define IPC_EVENTFD_FAIL	(-16) /** eventfd initialization failed */
+#define IPC_NOT_IMPLEMENTED	(-17) /** IPC feature is not implemented yet*/
+
+#define SET_HIF_HOST_RDY(hif, RDY_MASK) (hif->host_ready |= RDY_MASK)
+#define CHK_HIF_MOD_RDY(hif, RDY_MASK) (hif->mod_ready & RDY_MASK)
+
+/* Host Ready bits */
+#define HIF_HOST_READY_HOST_REGIONS	(1 << 0)
+#define HIF_HOST_READY_IPC_LIB		(1 << 12)
+#define HIF_HOST_READY_IPC_APP		(1 << 13)
+#define HIF_HOST_READY_FECA		(1 << 14)
+
+/* Modem Ready bits */
+#define HIF_MOD_READY_IPC_LIB		(1 << 5)
+#define HIF_MOD_READY_IPC_APP		(1 << 6)
+#define HIF_MOD_READY_FECA		(1 << 7)
+
+typedef void *ipc_t;
+
+struct ipc_msg {
+	int chid;
+	void *addr;
+	uint32_t len;
+	uint8_t flags;
+};
+
+typedef struct {
+	uint64_t host_phys;
+	uint32_t modem_phys;
+	void    *host_vaddr;
+	uint32_t size;
+} mem_range_t;
+
+#define GUL_IPC_MAGIC	'R'
+
+#define IOCTL_GUL_IPC_GET_SYS_MAP _IOW(GUL_IPC_MAGIC, 1, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_REGISTER _IOWR(GUL_IPC_MAGIC, 4, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_DEREGISTER \
+	_IOWR(GUL_IPC_MAGIC, 5, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_RAISE_INTERRUPT _IOW(GUL_IPC_MAGIC, 6, int *)
+
+/** buffer ring common metadata */
+typedef struct ipc_bd_ring_md {
+	volatile uint32_t pi;		/**< Producer index and flag (MSB)
+					  *  which flip for each Ring wrapping
+					  */
+	volatile uint32_t ci;		/**< Consumer index and flag (MSB)
+					  *  which flip for each Ring wrapping
+					  */
+	uint32_t ring_size;	/**< depth (Used to roll-over pi/ci) */
+	uint32_t msg_size;	/**< Size of the each buffer */
+} __rte_packed ipc_br_md_t;
+
+/** IPC buffer descriptor */
+typedef struct ipc_buffer_desc {
+	union {
+		uint64_t host_virt;	/**< msg's host virtual address */
+		struct {
+			uint32_t host_virt_l;
+			uint32_t host_virt_h;
+		};
+	};
+	uint32_t modem_ptr;	/**< msg's modem physical address */
+	uint32_t len;		/**< msg len */
+} __rte_packed ipc_bd_t;
+
+typedef struct ipc_channel {
+	uint32_t ch_id;		/**< Channel id */
+	ipc_br_md_t md;			/**< Metadata for BD ring */
+	ipc_bd_t bd_h[IPC_MAX_DEPTH];	/**< Buffer Descriptor on Host */
+	ipc_bd_t bd_m[IPC_MAX_DEPTH];	/**< Buffer Descriptor on Modem */
+	uint32_t op_type;		/**< Type of the BBDEV operation
+					  * supported on this channel
+					  */
+	uint32_t depth;			/**< Channel depth */
+	uint32_t feca_blk_id;	/**< FECA Transport Block ID for processing */
+	uint32_t la12xx_core_id;/**< LA12xx core ID on which this will be
+				  * scheduled
+				  */
+	uint32_t feca_input_circ_size;	/**< FECA transport block input
+					  * circular buffer size
+					  */
+	uint32_t host_ipc_params;	/**< Address for host IPC parameters */
+} __rte_packed ipc_ch_t;
+
+typedef struct ipc_instance {
+	uint32_t instance_id;		/**< instance id, use to init this
+					  * instance by ipc_init API
+					  */
+	uint32_t initialized;		/**< Set in ipc_init */
+	ipc_ch_t ch_list[IPC_MAX_CHANNEL_COUNT];
+		/**< Channel descriptors in this instance */
+} __rte_packed ipc_instance_t;
+
+typedef struct ipc_metadata {
+	uint32_t ipc_host_signature; /**< IPC host signature, Set by host/L2 */
+	uint32_t ipc_geul_signature; /**< IPC geul signature, Set by modem */
+	ipc_instance_t instance_list[IPC_MAX_INSTANCE_COUNT];
+} __rte_packed ipc_metadata_t;
+
+typedef struct ipc_channel_us_priv {
+	int32_t		eventfd;
+	uint32_t	channel_id;
+	/* In flight packets status for buffer list. */
+	uint8_t		bufs_inflight[IPC_MAX_DEPTH];
+} ipc_channel_us_t;
+
+typedef struct {
+	uint64_t host_phys;
+	uint32_t modem_phys;
+	uint32_t size;
+} mem_strt_addr_t;
+
+typedef struct {
+	mem_strt_addr_t modem_ccsrbar;
+	mem_strt_addr_t peb_start; /* PEB meta data */
+	mem_strt_addr_t mhif_start; /* MHIF meta daat */
+	mem_strt_addr_t hugepg_start; /* Modem to access hugepage */
+} sys_map_t;
+
+typedef struct ipc_priv_t {
+	int instance_id;
+	int dev_ipc;
+	int dev_mem;
+	sys_map_t sys_map;
+	mem_range_t modem_ccsrbar;
+	mem_range_t peb_start;
+	mem_range_t mhif_start;
+	mem_range_t hugepg_start;
+	ipc_channel_us_t *channels[IPC_MAX_CHANNEL_COUNT];
+	ipc_instance_t	*instance;
+	ipc_instance_t	*instance_bk;
+} ipc_userspace_t;
+
+/** Structure specifying enqueue operation (enqueue at LA1224) */
+struct bbdev_ipc_enqueue_op {
+	/** Status of operation that was performed */
+	int32_t status;
+	/** CRC Status of SD operation that was performed */
+	int32_t crc_stat_addr;
+	/** HARQ Output buffer memory length for Shared Decode.
+	 * Filled by LA12xx.
+	 */
+	uint32_t out_len;
+	/** Reserved (for 8 byte alignment) */
+	uint32_t rsvd;
+};
+
 /* This shared memory would be on the host side which have copy of some
  * of the parameters which are also part of Shared BD ring. Read access
  * of these parameters from the host side would not be over PCI.
@@ -14,7 +187,21 @@
 typedef struct host_ipc_params {
 	volatile uint32_t pi;
 	volatile uint32_t ci;
-	volatile uint32_t modem_ptr[IPC_MAX_DEPTH];
+	volatile uint32_t bd_m_modem_ptr[IPC_MAX_DEPTH];
 } __rte_packed host_ipc_params_t;
 
+struct hif_ipc_regs {
+	uint32_t ipc_mdata_offset;
+	uint32_t ipc_mdata_size;
+} __rte_packed;
+
+struct gul_hif {
+	uint32_t ver;
+	uint32_t hif_ver;
+	uint32_t status;
+	volatile uint32_t host_ready;
+	volatile uint32_t mod_ready;
+	struct hif_ipc_regs ipc_regs;
+} __rte_packed;
+
 #endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v5 6/9] baseband/la12xx: add enqueue and dequeue support
  2021-09-12 12:15 ` [dpdk-dev] [PATCH v5 0/9] " Nipun Gupta
                     ` (4 preceding siblings ...)
  2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 5/9] baseband/la12xx: add queue and modem config support Nipun Gupta
@ 2021-09-12 12:15   ` Nipun Gupta
  2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 7/9] app/bbdev: enable la12xx for bbdev Nipun Gupta
                     ` (2 subsequent siblings)
  8 siblings, 0 replies; 157+ messages in thread
From: Nipun Gupta @ 2021-09-12 12:15 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

From: Hemant Agrawal <hemant.agrawal@nxp.com>

Add support for enqueue and dequeue the LDPC enc/dec
from the modem device.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 doc/guides/bbdevs/features/la12xx.ini      |  14 +
 doc/guides/bbdevs/la12xx.rst               |  46 +++
 drivers/baseband/la12xx/bbdev_la12xx.c     | 334 ++++++++++++++++++++-
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h |  37 +++
 4 files changed, 425 insertions(+), 6 deletions(-)
 create mode 100644 doc/guides/bbdevs/features/la12xx.ini

diff --git a/doc/guides/bbdevs/features/la12xx.ini b/doc/guides/bbdevs/features/la12xx.ini
new file mode 100644
index 0000000000..412af99bad
--- /dev/null
+++ b/doc/guides/bbdevs/features/la12xx.ini
@@ -0,0 +1,14 @@
+;
+; Supported features of the 'la12xx' bbdev driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Turbo Decoder (4G)     = N
+Turbo Encoder (4G)     = N
+LDPC Decoder (5G)      = Y
+LDPC Encoder (5G)      = Y
+LLR/HARQ Compression   = N
+HW Accelerated         = Y
+BBDEV API              = Y
+Big Endian Processing  = Y
diff --git a/doc/guides/bbdevs/la12xx.rst b/doc/guides/bbdevs/la12xx.rst
index 3c9ac5c047..c39be0e51f 100644
--- a/doc/guides/bbdevs/la12xx.rst
+++ b/doc/guides/bbdevs/la12xx.rst
@@ -16,6 +16,8 @@ Features
 
 LA12xx PMD supports the following features:
 
+- LDPC Encode in the DL
+- LDPC Decode in the UL
 - Maximum of 8 UL queues
 - Maximum of 8 DL queues
 - PCIe Gen-3 x8 Interface
@@ -79,3 +81,47 @@ For enabling logs, use the following EAL parameter:
 
 Using ``bb.la12xx`` as log matching criteria, all Baseband PMD logs can be
 enabled which are lower than logging ``level``.
+
+Test Application
+----------------
+
+BBDEV provides a test application, ``test-bbdev.py`` and range of test data for testing
+the functionality of LA12xx for FEC encode and decode, depending on the device
+capabilities. The test application is located under app->test-bbdev folder and has the
+following options:
+
+.. code-block:: console
+
+  "-p", "--testapp-path": specifies path to the bbdev test app.
+  "-e", "--eal-params"	: EAL arguments which are passed to the test app.
+  "-t", "--timeout"	: Timeout in seconds (default=300).
+  "-c", "--test-cases"	: Defines test cases to run. Run all if not specified.
+  "-v", "--test-vector"	: Test vector path (default=dpdk_path+/app/test-bbdev/test_vectors/bbdev_null.data).
+  "-n", "--num-ops"	: Number of operations to process on device (default=32).
+  "-b", "--burst-size"	: Operations enqueue/dequeue burst size (default=32).
+  "-s", "--snr"		: SNR in dB used when generating LLRs for bler tests.
+  "-s", "--iter_max"	: Number of iterations for LDPC decoder.
+  "-l", "--num-lcores"	: Number of lcores to run (default=16).
+  "-i", "--init-device" : Initialise PF device with default values.
+
+
+To execute the test application tool using simple decode or encode data,
+type one of the following:
+
+.. code-block:: console
+
+  ./test-bbdev.py -e="--vdev=baseband_la12xx,socket_id=0,max_nb_queues=8" -c validation -n 64 -b 1 -v ./ldpc_dec_default.data
+  ./test-bbdev.py -e="--vdev=baseband_la12xx,socket_id=0,max_nb_queues=8" -c validation -n 64 -b 1 -v ./ldpc_enc_default.data
+
+The test application ``test-bbdev.py``, supports the ability to configure the PF device with
+a default set of values, if the "-i" or "- -init-device" option is included. The default values
+are defined in test_bbdev_perf.c.
+
+
+Test Vectors
+~~~~~~~~~~~~
+
+In addition to the simple LDPC decoder and LDPC encoder tests, bbdev also provides
+a range of additional tests under the test_vectors folder, which may be useful. The results
+of these tests will depend on the LA12xx FEC capabilities which may cause some
+testcases to be skipped, but no failure should be reported.
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 57e957a93a..1f64ee9b1e 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -54,7 +54,8 @@ static const struct rte_bbdev_op_cap bbdev_capabilities[] = {
 		.cap.ldpc_enc = {
 			.capability_flags =
 					RTE_BBDEV_LDPC_CRC_24A_ATTACH |
-					RTE_BBDEV_LDPC_CRC_24B_ATTACH,
+					RTE_BBDEV_LDPC_CRC_24B_ATTACH |
+					RTE_BBDEV_LDPC_ENC_BIG_ENDIAN,
 			.num_buffers_src =
 					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
 			.num_buffers_dst =
@@ -67,7 +68,8 @@ static const struct rte_bbdev_op_cap bbdev_capabilities[] = {
 			.capability_flags =
 				RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK |
 					RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK |
-					RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP,
+					RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP |
+					RTE_BBDEV_LDPC_DEC_BIG_ENDIAN,
 			.num_buffers_src =
 					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
 			.num_buffers_hard_out =
@@ -122,6 +124,10 @@ la12xx_queue_release(struct rte_bbdev *dev, uint16_t q_id)
 		((uint64_t) ((unsigned long) (A) \
 		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
 
+#define MODEM_P2V(A) \
+	((uint64_t) ((unsigned long) (A) \
+		+ (unsigned long)(ipc_priv->peb_start.host_vaddr)))
+
 static int ipc_queue_configure(uint32_t channel_id,
 		ipc_t instance, struct bbdev_la12xx_q_priv *q_priv)
 {
@@ -336,6 +342,318 @@ static const struct rte_bbdev_ops pmd_ops = {
 	.queue_release = la12xx_queue_release,
 	.start = la12xx_start
 };
+
+static inline int
+is_bd_ring_full(uint32_t ci, uint32_t ci_flag,
+		uint32_t pi, uint32_t pi_flag)
+{
+	if (pi == ci) {
+		if (pi_flag != ci_flag)
+			return 1; /* Ring is Full */
+	}
+	return 0;
+}
+
+static inline int
+prepare_ldpc_enc_op(struct rte_bbdev_enc_op *bbdev_enc_op,
+		    struct bbdev_la12xx_q_priv *q_priv __rte_unused,
+		    struct rte_bbdev_op_data *in_op_data __rte_unused,
+		    struct rte_bbdev_op_data *out_op_data)
+{
+	struct rte_bbdev_op_ldpc_enc *ldpc_enc = &bbdev_enc_op->ldpc_enc;
+	uint32_t total_out_bits;
+
+	total_out_bits = (ldpc_enc->tb_params.cab *
+		ldpc_enc->tb_params.ea) + (ldpc_enc->tb_params.c -
+		ldpc_enc->tb_params.cab) * ldpc_enc->tb_params.eb;
+
+	ldpc_enc->output.length = (total_out_bits + 7)/8;
+
+	rte_pktmbuf_append(out_op_data->data, ldpc_enc->output.length);
+
+	return 0;
+}
+
+static inline int
+prepare_ldpc_dec_op(struct rte_bbdev_dec_op *bbdev_dec_op,
+		    struct bbdev_ipc_dequeue_op *bbdev_ipc_op,
+		    struct bbdev_la12xx_q_priv *q_priv  __rte_unused,
+		    struct rte_bbdev_op_data *out_op_data  __rte_unused)
+{
+	struct rte_bbdev_op_ldpc_dec *ldpc_dec = &bbdev_dec_op->ldpc_dec;
+	uint32_t total_out_bits;
+	uint32_t num_code_blocks = 0;
+	uint16_t sys_cols;
+
+	sys_cols = (ldpc_dec->basegraph == 1) ? 22 : 10;
+	if (ldpc_dec->tb_params.c == 1) {
+		total_out_bits = ((sys_cols * ldpc_dec->z_c) -
+				ldpc_dec->n_filler);
+		/* 5G-NR protocol uses 16 bit CRC when output packet
+		 * size <= 3824 (bits). Otherwise 24 bit CRC is used.
+		 * Adjust the output bits accordingly
+		 */
+		if (total_out_bits - 16 <= 3824)
+			total_out_bits -= 16;
+		else
+			total_out_bits -= 24;
+		ldpc_dec->hard_output.length = (total_out_bits / 8);
+	} else {
+		total_out_bits = (((sys_cols * ldpc_dec->z_c) -
+				ldpc_dec->n_filler - 24) *
+				ldpc_dec->tb_params.c);
+		ldpc_dec->hard_output.length = (total_out_bits / 8) - 3;
+	}
+
+	num_code_blocks = ldpc_dec->tb_params.c;
+
+	bbdev_ipc_op->num_code_blocks = rte_cpu_to_be_32(num_code_blocks);
+
+	return 0;
+}
+
+static int
+enqueue_single_op(struct bbdev_la12xx_q_priv *q_priv, void *bbdev_op)
+{
+	struct bbdev_la12xx_private *priv = q_priv->bbdev_priv;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	ipc_instance_t *ipc_instance = ipc_priv->instance;
+	struct bbdev_ipc_dequeue_op *bbdev_ipc_op;
+	struct rte_bbdev_op_ldpc_enc *ldpc_enc;
+	struct rte_bbdev_op_ldpc_dec *ldpc_dec;
+	uint32_t q_id = q_priv->q_id;
+	uint32_t ci, ci_flag, pi, pi_flag;
+	ipc_ch_t *ch = &(ipc_instance->ch_list[q_id]);
+	ipc_br_md_t *md = &(ch->md);
+	size_t virt;
+	char *huge_start_addr =
+		(char *)q_priv->bbdev_priv->ipc_priv->hugepg_start.host_vaddr;
+	struct rte_bbdev_op_data *in_op_data, *out_op_data;
+	char *data_ptr;
+	uint32_t l1_pcie_addr;
+	int ret;
+
+	ci = IPC_GET_CI_INDEX(q_priv->host_ci);
+	ci_flag = IPC_GET_CI_FLAG(q_priv->host_ci);
+
+	pi = IPC_GET_PI_INDEX(q_priv->host_pi);
+	pi_flag = IPC_GET_PI_FLAG(q_priv->host_pi);
+
+	rte_bbdev_dp_log(DEBUG, "before bd_ring_full: pi: %u, ci: %u,"
+		"pi_flag: %u, ci_flag: %u, ring size: %u",
+		pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	if (is_bd_ring_full(ci, ci_flag, pi, pi_flag)) {
+		rte_bbdev_dp_log(DEBUG, "bd ring full for queue id: %d", q_id);
+		return IPC_CH_FULL;
+	}
+
+	virt = MODEM_P2V(q_priv->host_params->bd_m_modem_ptr[pi]);
+	bbdev_ipc_op = (struct bbdev_ipc_dequeue_op *)virt;
+	q_priv->bbdev_op[pi] = bbdev_op;
+
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		ldpc_enc = &(((struct rte_bbdev_enc_op *)bbdev_op)->ldpc_enc);
+		in_op_data = &ldpc_enc->input;
+		out_op_data = &ldpc_enc->output;
+
+		ret = prepare_ldpc_enc_op(bbdev_op, q_priv,
+					  in_op_data, out_op_data);
+		if (ret) {
+			rte_bbdev_log(ERR, "process_ldpc_enc_op fail, ret: %d",
+				ret);
+			return ret;
+		}
+		break;
+
+	case RTE_BBDEV_OP_LDPC_DEC:
+		ldpc_dec = &(((struct rte_bbdev_dec_op *)bbdev_op)->ldpc_dec);
+		in_op_data = &ldpc_dec->input;
+
+		out_op_data = &ldpc_dec->hard_output;
+
+		ret = prepare_ldpc_dec_op(bbdev_op, bbdev_ipc_op,
+					  q_priv, out_op_data);
+		if (ret) {
+			rte_bbdev_log(ERR, "process_ldpc_dec_op fail, ret: %d",
+				ret);
+			return ret;
+		}
+		break;
+
+	default:
+		rte_bbdev_log(ERR, "unsupported bbdev_ipc op type");
+		return -1;
+	}
+
+	if (in_op_data->data) {
+		data_ptr = rte_pktmbuf_mtod(in_op_data->data, char *);
+		l1_pcie_addr = (uint32_t)GUL_USER_HUGE_PAGE_ADDR +
+			       data_ptr - huge_start_addr;
+		bbdev_ipc_op->in_addr = l1_pcie_addr;
+		bbdev_ipc_op->in_len = in_op_data->length;
+	}
+
+	if (out_op_data->data) {
+		data_ptr = rte_pktmbuf_mtod(out_op_data->data, char *);
+		l1_pcie_addr = (uint32_t)GUL_USER_HUGE_PAGE_ADDR +
+				data_ptr - huge_start_addr;
+		bbdev_ipc_op->out_addr = rte_cpu_to_be_32(l1_pcie_addr);
+		bbdev_ipc_op->out_len = rte_cpu_to_be_32(out_op_data->length);
+	}
+
+	/* Move Producer Index forward */
+	pi++;
+	/* Flip the PI flag, if wrapping */
+	if (unlikely(q_priv->queue_size == pi)) {
+		pi = 0;
+		pi_flag = pi_flag ? 0 : 1;
+	}
+
+	if (pi_flag)
+		IPC_SET_PI_FLAG(pi);
+	else
+		IPC_RESET_PI_FLAG(pi);
+	q_priv->host_pi = pi;
+
+	/* Wait for Data Copy & pi_flag update to complete before updating pi */
+	rte_mb();
+	/* now update pi */
+	md->pi = rte_cpu_to_be_32(pi);
+
+	rte_bbdev_dp_log(DEBUG, "enter: pi: %u, ci: %u,"
+			"pi_flag: %u, ci_flag: %u, ring size: %u",
+			pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	return 0;
+}
+
+/* Enqueue decode burst */
+static uint16_t
+enqueue_dec_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_dec_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	int nb_enqueued, ret;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ret = enqueue_single_op(q_priv, ops[nb_enqueued]);
+		if (ret)
+			break;
+	}
+
+	q_data->queue_stats.enqueue_err_count += nb_ops - nb_enqueued;
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
+/* Enqueue encode burst */
+static uint16_t
+enqueue_enc_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_enc_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	int nb_enqueued, ret;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ret = enqueue_single_op(q_priv, ops[nb_enqueued]);
+		if (ret)
+			break;
+	}
+
+	q_data->queue_stats.enqueue_err_count += nb_ops - nb_enqueued;
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
+/* Dequeue encode burst */
+static void *
+dequeue_single_op(struct bbdev_la12xx_q_priv *q_priv, void *dst)
+{
+	void *op;
+	uint32_t ci, ci_flag;
+	uint32_t temp_ci;
+
+	temp_ci = q_priv->host_params->ci;
+	if (temp_ci == q_priv->host_ci)
+		return NULL;
+
+	ci = IPC_GET_CI_INDEX(q_priv->host_ci);
+	ci_flag = IPC_GET_CI_FLAG(q_priv->host_ci);
+
+	rte_bbdev_dp_log(DEBUG,
+		"ci: %u, ci_flag: %u, ring size: %u",
+		ci, ci_flag, q_priv->queue_size);
+
+	op = q_priv->bbdev_op[ci];
+
+	rte_memcpy(dst, q_priv->msg_ch_vaddr[ci],
+		sizeof(struct bbdev_ipc_enqueue_op));
+
+	/* Move Consumer Index forward */
+	ci++;
+	/* Flip the CI flag, if wrapping */
+	if (q_priv->queue_size == ci) {
+		ci = 0;
+		ci_flag = ci_flag ? 0 : 1;
+	}
+	if (ci_flag)
+		IPC_SET_CI_FLAG(ci);
+	else
+		IPC_RESET_CI_FLAG(ci);
+
+	q_priv->host_ci = ci;
+
+	rte_bbdev_dp_log(DEBUG,
+		"exit: ci: %u, ci_flag: %u, ring size: %u",
+		ci, ci_flag, q_priv->queue_size);
+
+	return op;
+}
+
+/* Dequeue decode burst */
+static uint16_t
+dequeue_dec_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_dec_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	struct bbdev_ipc_enqueue_op bbdev_ipc_op;
+	int nb_dequeued;
+
+	for (nb_dequeued = 0; nb_dequeued < nb_ops; nb_dequeued++) {
+		ops[nb_dequeued] = dequeue_single_op(q_priv, &bbdev_ipc_op);
+		if (!ops[nb_dequeued])
+			break;
+		ops[nb_dequeued]->status = bbdev_ipc_op.status;
+	}
+	q_data->queue_stats.dequeued_count += nb_dequeued;
+
+	return nb_dequeued;
+}
+
+/* Dequeue encode burst */
+static uint16_t
+dequeue_enc_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_enc_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	struct bbdev_ipc_enqueue_op bbdev_ipc_op;
+	int nb_enqueued;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ops[nb_enqueued] = dequeue_single_op(q_priv, &bbdev_ipc_op);
+		if (!ops[nb_enqueued])
+			break;
+		ops[nb_enqueued]->status = bbdev_ipc_op.status;
+	}
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
 static struct hugepage_info *
 get_hugepage_info(void)
 {
@@ -709,10 +1027,14 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 	bbdev->intr_handle = NULL;
 
 	/* register rx/tx burst functions for data path */
-	bbdev->dequeue_enc_ops = NULL;
-	bbdev->dequeue_dec_ops = NULL;
-	bbdev->enqueue_enc_ops = NULL;
-	bbdev->enqueue_dec_ops = NULL;
+	bbdev->dequeue_enc_ops = dequeue_enc_ops;
+	bbdev->dequeue_dec_ops = dequeue_dec_ops;
+	bbdev->enqueue_enc_ops = enqueue_enc_ops;
+	bbdev->enqueue_dec_ops = enqueue_dec_ops;
+	bbdev->dequeue_ldpc_enc_ops = dequeue_enc_ops;
+	bbdev->dequeue_ldpc_dec_ops = dequeue_dec_ops;
+	bbdev->enqueue_ldpc_enc_ops = enqueue_enc_ops;
+	bbdev->enqueue_ldpc_dec_ops = enqueue_dec_ops;
 
 	return 0;
 }
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
index 5f613fb087..b6a7f677d0 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -73,6 +73,25 @@ typedef struct {
 	_IOWR(GUL_IPC_MAGIC, 5, struct ipc_msg *)
 #define IOCTL_GUL_IPC_CHANNEL_RAISE_INTERRUPT _IOW(GUL_IPC_MAGIC, 6, int *)
 
+#define GUL_USER_HUGE_PAGE_OFFSET	(0)
+#define GUL_PCI1_ADDR_BASE	(0x00000000ULL)
+
+#define GUL_USER_HUGE_PAGE_ADDR	(GUL_PCI1_ADDR_BASE + GUL_USER_HUGE_PAGE_OFFSET)
+
+/* IPC PI/CI index & flag manipulation helpers */
+#define IPC_PI_CI_FLAG_MASK	0x80000000 /*  (1<<31) */
+#define IPC_PI_CI_INDEX_MASK	0x7FFFFFFF /* ~(1<<31) */
+
+#define IPC_SET_PI_FLAG(x)	(x |= IPC_PI_CI_FLAG_MASK)
+#define IPC_RESET_PI_FLAG(x)	(x &= IPC_PI_CI_INDEX_MASK)
+#define IPC_GET_PI_FLAG(x)	(x >> 31)
+#define IPC_GET_PI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
+
+#define IPC_SET_CI_FLAG(x)	(x |= IPC_PI_CI_FLAG_MASK)
+#define IPC_RESET_CI_FLAG(x)	(x &= IPC_PI_CI_INDEX_MASK)
+#define IPC_GET_CI_FLAG(x)	(x >> 31)
+#define IPC_GET_CI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
+
 /** buffer ring common metadata */
 typedef struct ipc_bd_ring_md {
 	volatile uint32_t pi;		/**< Producer index and flag (MSB)
@@ -180,6 +199,24 @@ struct bbdev_ipc_enqueue_op {
 	uint32_t rsvd;
 };
 
+/** Structure specifying dequeue operation (dequeue at LA1224) */
+struct bbdev_ipc_dequeue_op {
+	/** Input buffer memory address */
+	uint32_t in_addr;
+	/** Input buffer memory length */
+	uint32_t in_len;
+	/** Output buffer memory address */
+	uint32_t out_addr;
+	/** Output buffer memory length */
+	uint32_t out_len;
+	/* Number of code blocks. Only set when HARQ is used */
+	uint32_t num_code_blocks;
+	/** Dequeue Operation flags */
+	uint32_t op_flags;
+	/** Shared metadata between L1 and L2 */
+	uint32_t shared_metadata;
+};
+
 /* This shared memory would be on the host side which have copy of some
  * of the parameters which are also part of Shared BD ring. Read access
  * of these parameters from the host side would not be over PCI.
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v5 7/9] app/bbdev: enable la12xx for bbdev
  2021-09-12 12:15 ` [dpdk-dev] [PATCH v5 0/9] " Nipun Gupta
                     ` (5 preceding siblings ...)
  2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 6/9] baseband/la12xx: add enqueue and dequeue support Nipun Gupta
@ 2021-09-12 12:15   ` Nipun Gupta
  2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 8/9] app/bbdev: handle endianness of test data Nipun Gupta
  2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 9/9] app/bbdev: add test vectors for transport blocks Nipun Gupta
  8 siblings, 0 replies; 157+ messages in thread
From: Nipun Gupta @ 2021-09-12 12:15 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal

From: Hemant Agrawal <hemant.agrawal@nxp.com>

this patch adds la12xx driver in test bbdev

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/test-bbdev/meson.build | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/app/test-bbdev/meson.build b/app/test-bbdev/meson.build
index edb9deef84..a726a5b3fa 100644
--- a/app/test-bbdev/meson.build
+++ b/app/test-bbdev/meson.build
@@ -23,3 +23,6 @@ endif
 if dpdk_conf.has('RTE_BASEBAND_ACC100')
     deps += ['baseband_acc100']
 endif
+if dpdk_conf.has('RTE_LIBRTE_PMD_BBDEV_LA12XX')
+	deps += ['baseband_la12xx']
+endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v5 8/9] app/bbdev: handle endianness of test data
  2021-09-12 12:15 ` [dpdk-dev] [PATCH v5 0/9] " Nipun Gupta
                     ` (6 preceding siblings ...)
  2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 7/9] app/bbdev: enable la12xx for bbdev Nipun Gupta
@ 2021-09-12 12:15   ` Nipun Gupta
  2021-09-13 18:45     ` Chautru, Nicolas
  2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 9/9] app/bbdev: add test vectors for transport blocks Nipun Gupta
  8 siblings, 1 reply; 157+ messages in thread
From: Nipun Gupta @ 2021-09-12 12:15 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

With data input, output and harq also supported in big
endian format, this patch updates the testbbdev application
to handle the endianness conversion as directed by the
test vector and the driver being used.

For instance, if the driver supports big endian data
processing, but the test vector does not mention the data
as a big endian format, conversion from little endian to big
will be handled by the testbbdev application.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 app/test-bbdev/test_bbdev_perf.c   | 84 ++++++++++++++++++++++++++++++
 app/test-bbdev/test_bbdev_vector.c |  4 ++
 2 files changed, 88 insertions(+)

diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c
index 469597b8b3..836e07d747 100644
--- a/app/test-bbdev/test_bbdev_perf.c
+++ b/app/test-bbdev/test_bbdev_perf.c
@@ -227,6 +227,71 @@ clear_soft_out_cap(uint32_t *op_flags)
 	*op_flags &= ~RTE_BBDEV_TURBO_NEG_LLR_1_BIT_SOFT_OUT;
 }
 
+static void
+clear_ldpc_endianness_flag(uint32_t *op_flags)
+{
+	*op_flags &= ~RTE_BBDEV_LDPC_ENC_BIG_ENDIAN;
+	*op_flags &= ~RTE_BBDEV_LDPC_DEC_BIG_ENDIAN;
+}
+
+static inline void
+reverse_op(struct op_data_entries *op)
+{
+	uint8_t nb_segs = op->nb_segments;
+	uint32_t *data, len;
+	int complete, rem, i, j;
+	uint8_t *rem_data, temp;
+
+	/* Validate each mbuf segment length */
+	for (i = 0; i < nb_segs; ++i) {
+		len = op->segments[i].length;
+		data = op->segments[i].addr;
+
+		/* Swap complete u32 bytes */
+		complete = len / 4;
+		for (j = 0; j < complete; j++)
+			data[j] = rte_bswap32(data[j]);
+
+		/* Swap any remaining data for last seg */
+		if (i == (nb_segs - 1)) {
+			rem = len % 4;
+			rem_data = (uint8_t *)&data[j];
+			for (j = 0; j < rem/2; j++) {
+				temp = rem_data[j];
+				rem_data[j] = rem_data[rem - j - 1];
+				rem_data[rem - j - 1] = temp;
+			}
+		}
+	}
+}
+
+static inline void
+reverse_all_ops(void)
+{
+	unsigned int nb_inputs, nb_soft_outputs, nb_hard_outputs,
+		nb_harq_inputs, nb_harq_outputs;
+
+	nb_inputs = test_vector.entries[DATA_INPUT].nb_segments;
+	if (nb_inputs)
+		reverse_op(&test_vector.entries[DATA_INPUT]);
+
+	nb_soft_outputs = test_vector.entries[DATA_SOFT_OUTPUT].nb_segments;
+	if (nb_soft_outputs)
+		reverse_op(&test_vector.entries[DATA_SOFT_OUTPUT]);
+
+	nb_hard_outputs = test_vector.entries[DATA_HARD_OUTPUT].nb_segments;
+	if (nb_hard_outputs)
+		reverse_op(&test_vector.entries[DATA_HARD_OUTPUT]);
+
+	nb_harq_inputs  = test_vector.entries[DATA_HARQ_INPUT].nb_segments;
+	if (nb_harq_inputs)
+		reverse_op(&test_vector.entries[DATA_HARQ_INPUT]);
+
+	nb_harq_outputs = test_vector.entries[DATA_HARQ_OUTPUT].nb_segments;
+	if (nb_harq_outputs)
+		reverse_op(&test_vector.entries[DATA_HARQ_OUTPUT]);
+}
+
 static int
 check_dev_cap(const struct rte_bbdev_info *dev_info)
 {
@@ -324,6 +389,16 @@ check_dev_cap(const struct rte_bbdev_info *dev_info)
 			const struct rte_bbdev_op_cap_ldpc_enc *cap =
 					&op_cap->cap.ldpc_enc;
 
+			if ((test_vector.ldpc_enc.op_flags &
+					RTE_BBDEV_LDPC_ENC_BIG_ENDIAN) !=
+					(cap->capability_flags &
+					RTE_BBDEV_LDPC_ENC_BIG_ENDIAN)) {
+				reverse_all_ops();
+				clear_ldpc_endianness_flag(
+					&test_vector.ldpc_enc.op_flags);
+
+			}
+
 			if (!flags_match(test_vector.ldpc_enc.op_flags,
 					cap->capability_flags)){
 				printf("Flag Mismatch\n");
@@ -352,6 +427,15 @@ check_dev_cap(const struct rte_bbdev_info *dev_info)
 			const struct rte_bbdev_op_cap_ldpc_dec *cap =
 					&op_cap->cap.ldpc_dec;
 
+			if ((test_vector.ldpc_dec.op_flags &
+					RTE_BBDEV_LDPC_DEC_BIG_ENDIAN) !=
+					(cap->capability_flags &
+					RTE_BBDEV_LDPC_DEC_BIG_ENDIAN)) {
+				reverse_all_ops();
+				clear_ldpc_endianness_flag(
+					&test_vector.ldpc_dec.op_flags);
+			}
+
 			if (!flags_match(test_vector.ldpc_dec.op_flags,
 					cap->capability_flags)){
 				printf("Flag Mismatch\n");
diff --git a/app/test-bbdev/test_bbdev_vector.c b/app/test-bbdev/test_bbdev_vector.c
index 614dbd1a6d..b2e7a9008d 100644
--- a/app/test-bbdev/test_bbdev_vector.c
+++ b/app/test-bbdev/test_bbdev_vector.c
@@ -191,6 +191,8 @@ op_ldpc_decoder_flag_strtoul(char *token, uint32_t *op_flag_value)
 		*op_flag_value = RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSION;
 	else if (!strcmp(token, "RTE_BBDEV_LDPC_LLR_COMPRESSION"))
 		*op_flag_value = RTE_BBDEV_LDPC_LLR_COMPRESSION;
+	else if (!strcmp(token, "RTE_BBDEV_LDPC_DEC_BIG_ENDIAN"))
+		*op_flag_value = RTE_BBDEV_LDPC_DEC_BIG_ENDIAN;
 	else if (!strcmp(token,
 			"RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_IN_ENABLE"))
 		*op_flag_value = RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_IN_ENABLE;
@@ -248,6 +250,8 @@ op_ldpc_encoder_flag_strtoul(char *token, uint32_t *op_flag_value)
 		*op_flag_value = RTE_BBDEV_LDPC_ENC_INTERRUPTS;
 	else if (!strcmp(token, "RTE_BBDEV_LDPC_ENC_SCATTER_GATHER"))
 		*op_flag_value = RTE_BBDEV_LDPC_ENC_SCATTER_GATHER;
+	else if (!strcmp(token, "RTE_BBDEV_LDPC_ENC_BIG_ENDIAN"))
+		*op_flag_value = RTE_BBDEV_LDPC_ENC_BIG_ENDIAN;
 	else {
 		printf("The given value is not a turbo encoder flag\n");
 		return -1;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v5 9/9] app/bbdev: add test vectors for transport blocks
  2021-09-12 12:15 ` [dpdk-dev] [PATCH v5 0/9] " Nipun Gupta
                     ` (7 preceding siblings ...)
  2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 8/9] app/bbdev: handle endianness of test data Nipun Gupta
@ 2021-09-12 12:15   ` Nipun Gupta
  2021-09-13 19:01     ` Chautru, Nicolas
  8 siblings, 1 reply; 157+ messages in thread
From: Nipun Gupta @ 2021-09-12 12:15 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

This patch adds two test vectors for transport block in network byte
order:
- LDPC encode for Transport Block
- LDPC decode for Transport block

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 app/test-bbdev/test_vectors/ldpc_dec_tb.data | 122 +++++++++++++++++++
 app/test-bbdev/test_vectors/ldpc_enc_tb.data |  60 +++++++++
 2 files changed, 182 insertions(+)
 create mode 100644 app/test-bbdev/test_vectors/ldpc_dec_tb.data
 create mode 100644 app/test-bbdev/test_vectors/ldpc_enc_tb.data

diff --git a/app/test-bbdev/test_vectors/ldpc_dec_tb.data b/app/test-bbdev/test_vectors/ldpc_dec_tb.data
new file mode 100644
index 0000000000..b991e8f305
--- /dev/null
+++ b/app/test-bbdev/test_vectors/ldpc_dec_tb.data
@@ -0,0 +1,122 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020 NXP
+
+op_type =
+RTE_BBDEV_OP_LDPC_DEC
+
+input0 =
+0x817f8181, 0x7f7f8181, 0x817f7f81, 0x81817f81, 0x81817f81, 0x817f7f81, 0x7f7f7f7f, 0x7f7f7f81,
+0x817f7f81, 0x817f7f81, 0x7f7f817f, 0x7f7f7f81, 0x81817f7f, 0x81818181, 0x817f8181, 0x7f817f81,
+0x81817f7f, 0x7f7f817f, 0x81817f81, 0x817f8181, 0x7f7f7f81, 0x817f817f, 0x7f817f7f, 0x7f817f7f,
+0x7f817f7f, 0x81817f7f, 0x7f818181, 0x817f7f7f, 0x8181817f, 0x81817f7f, 0x7f817f81, 0x7f7f7f7f,
+0x7f817f7f, 0x81817f7f, 0x81818181, 0x817f817f, 0x81817f7f, 0x7f81817f, 0x7f7f7f7f, 0x7f7f7f7f,
+0x7f818181, 0x7f7f7f81, 0x81817f81, 0x7f817f7f, 0x7f7f7f7f, 0x817f817f, 0x817f817f, 0x7f7f817f,
+0x81817f81, 0x7f7f7f7f, 0x7f81817f, 0x817f817f, 0x7f7f8181, 0x7f7f7f7f, 0x817f7f7f, 0x81818181,
+0x817f8181, 0x7f7f817f, 0x7f7f8181, 0x7f7f7f7f, 0x7f818181, 0x817f8181, 0x817f7f81, 0x817f8181,
+0x817f7f81, 0x81817f7f, 0x7f7f8181, 0x81818181, 0x817f817f, 0x817f7f7f, 0x81818181, 0x7f817f81,
+0x7f7f7f81, 0x81817f81, 0x7f817f7f, 0x7f818181, 0x7f7f7f81, 0x817f817f, 0x81818181, 0x81818181,
+0x81817f81, 0x81817f81, 0x7f7f8181, 0x817f7f7f, 0x7f81817f, 0x817f817f, 0x81817f7f, 0x817f7f81,
+0x81817f7f, 0x7f7f7f81, 0x7f817f81, 0x7f817f81, 0x817f7f7f, 0x7f818181, 0x81818181, 0x7f7f7f7f,
+0x7f7f7f7f, 0x8181817f, 0x7f7f7f81, 0x7f817f81, 0x81817f81, 0x7f7f817f, 0x7f81817f, 0x817f8181,
+0x7f81817f, 0x7f81817f, 0x817f7f7f, 0x7f81817f, 0x817f7f81, 0x817f7f81, 0x7f817f7f, 0x8181817f,
+0x7f81817f, 0x7f7f8181, 0x817f8181, 0x817f7f7f, 0x817f7f81, 0x7f81817f, 0x7f7f817f, 0x7f817f7f,
+0x7f7f8181, 0x81818181, 0x7f818181, 0x7f7f817f, 0x7f818181, 0x81818181, 0x7f817f7f, 0x817f817f,
+0x817f817f, 0x817f7f7f, 0x81817f81, 0x81817f7f, 0x81817f81, 0x7f817f81, 0x7f817f7f, 0x7f817f7f,
+0x817f7f7f, 0x817f7f7f, 0x7f7f7f7f, 0x7f7f7f81, 0x7f7f8181, 0x7f817f81, 0x7f817f7f, 0x817f7f7f,
+0x7f7f8181, 0x8181817f, 0x7f7f8181, 0x7f7f7f81, 0x817f7f7f, 0x7f7f7f81, 0x817f8181, 0x7f7f817f,
+0x7f81817f, 0x817f817f, 0x7f817f81, 0x7f7f8181, 0x7f818181, 0x7f817f81, 0x81818181, 0x81817f7f,
+0x7f81817f, 0x7f81817f, 0x7f7f8181, 0x81818181, 0x817f8181, 0x7f7f817f, 0x7f817f7f, 0x7f7f8181,
+0x7f81817f, 0x7f7f817f, 0x7f7f7f7f, 0x7f818181, 0x81817f7f, 0x8181817f, 0x7f81817f, 0x8181817f,
+0x81817f81, 0x7f7f7f7f, 0x81818181, 0x7f7f817f, 0x7f81817f, 0x7f7f7f7f, 0x81817f81, 0x817f7f81,
+0x817f7f81, 0x817f7f81, 0x81818181, 0x7f7f7f7f, 0x81817f81, 0x817f7f7f, 0x8181817f, 0x7f7f7f81,
+0x81817f81, 0x817f7f81, 0x81818181, 0x7f7f7f7f, 0x81817f7f, 0x81817f81, 0x7f7f7f81, 0x7f7f7f7f,
+0x817f817f, 0x7f818181, 0x8181817f, 0x81817f81, 0x7f7f7f81, 0x7f817f7f, 0x7f7f7f7f, 0x7f817f81,
+0x8181817f, 0x7f7f7f7f, 0x81817f7f, 0x7f7f7f81, 0x7f81817f, 0x7f7f7f7f, 0x7f7f7f81, 0x817f8181,
+0x7f7f8181, 0x7f7f7f81, 0x7f7f8181, 0x7f817f7f, 0x81818181, 0x7f81817f, 0x7f818181, 0x7f818181,
+0x7f818181, 0x817f7f81, 0x7f7f8181, 0x81818181, 0x7f7f7f7f, 0x7f7f7f7f, 0x817f8181, 0x81818181,
+0x7f7f817f, 0x817f8181, 0x81817f7f, 0x817f817f, 0x7f7f817f, 0x7f7f7f7f, 0x817f8181, 0x817f8181,
+0x817f8181, 0x81818181, 0x7f7f817f, 0x7f817f81, 0x817f7f81, 0x7f7f7f81, 0x81817f81, 0x7f818181,
+0x81817f7f, 0x7f818181, 0x81818181, 0x817f817f, 0x7f817f7f, 0x81818181, 0x817f8181, 0x7f7f7f7f,
+0x7f817f81, 0x817f7f7f, 0x7f818181, 0x8181817f, 0x817f817f, 0x7f817f7f, 0x817f7f81, 0x7f818181,
+0x817f7f7f, 0x817f7f81, 0x7f7f7f81, 0x81817f81, 0x7f81817f, 0x7f818181, 0x81817f7f, 0x817f7f81,
+0x81817f81, 0x7f7f8181, 0x7f7f8181, 0x7f817f81, 0x7f7f817f, 0x817f7f7f, 0x7f7f7f7f, 0x817f7f7f,
+0x7f7f8181, 0x817f8181, 0x817f8181, 0x7f817f81, 0x817f8181, 0x8181817f, 0x81817f7f, 0x7f817f7f,
+0x7f817f7f, 0x7f817f81, 0x817f817f, 0x817f7f7f, 0x8181817f, 0x817f817f, 0x817f7f81, 0x81817f7f,
+0x7f817f7f, 0x7f7f7f7f, 0x7f817f7f, 0x7f7f817f, 0x7f818181, 0x8181817f, 0x817f7f7f, 0x7f817f81,
+0x7f7f8181, 0x81817f7f, 0x7f7f817f, 0x7f7f817f, 0x7f817f7f, 0x7f7f817f, 0x7f818181, 0x7f817f7f,
+0x817f7f7f, 0x7f817f81, 0x81818181, 0x7f818181, 0x817f8181, 0x8181817f, 0x8181817f, 0x817f7f7f,
+0x81817f81, 0x817f7f7f, 0x7f81817f, 0x817f8181, 0x7f818181, 0x7f817f7f, 0x81817f7f, 0x7f81817f,
+0x81817f81, 0x7f7f7f81, 0x7f7f7f7f, 0x81818181, 0x817f7f7f, 0x81817f81, 0x817f7f81, 0x81817f7f,
+0x81818181, 0x7f7f7f7f, 0x817f817f, 0x7f817f81, 0x817f7f7f, 0x7f817f81, 0x817f8181, 0x7f81817f,
+0x7f818181, 0x7f7f8181, 0x817f817f, 0x7f7f7f7f, 0x81818181, 0x7f817f81, 0x81817f81, 0x7f81817f,
+0x81818181, 0x7f7f817f, 0x81818181, 0x7f7f7f81, 0x817f7f81, 0x8181817f, 0x7f818181, 0x7f7f7f7f,
+0x7f7f7f7f, 0x8181817f, 0x81817f81, 0x81818181, 0x7f7f817f, 0x81817f7f, 0x7f817f81, 0x817f8181,
+0x81817f7f, 0x7f817f7f, 0x817f7f7f, 0x7f81817f, 0x817f7f7f, 0x7f7f7f7f, 0x7f7f8181, 0x7f7f8181,
+0x7f81817f, 0x7f7f8181, 0x7f7f8181, 0x817f7f81, 0x8181817f, 0x81817f7f, 0x817f8181, 0x817f817f,
+0x8181817f, 0x7f7f8181, 0x7f81817f, 0x817f817f, 0x7f817f81, 0x7f817f7f, 0x7f7f8181, 0x81818181,
+0x7f817f81, 0x7f7f8181, 0x81817f7f, 0x7f7f7f81, 0x7f7f7f81, 0x7f7f7f7f, 0x7f81817f, 0x7f7f8181,
+0x7f7f817f, 0x817f817f, 0x7f7f7f7f, 0x817f8181, 0x7f818181, 0x7f7f817f, 0x8181817f, 0x8181817f,
+0x817f7f81, 0x8181817f, 0x817f8181, 0x7f817f7f, 0x81817f7f, 0x81818181, 0x7f7f8181, 0x7f817f81,
+0x817f8181, 0x7f817f7f, 0x81818181, 0x81817f81, 0x7f817f81, 0x81817f7f, 0x7f818181, 0x8181817f,
+0x7f7f7f81, 0x7f81817f, 0x7f7f8181, 0x81818181, 0x81817f7f, 0x817f8181, 0x81817f7f, 0x7f7f817f,
+0x81818181, 0x7f7f8181, 0x7f7f817f, 0x817f817f, 0x7f817f81, 0x7f7f7f7f, 0x7f817f81, 0x7f817f7f,
+0x7f81817f, 0x7f7f8181, 0x7f7f817f, 0x81818181, 0x7f7f8181, 0x817f7f81, 0x81817f81, 0x81817f7f,
+0x81817f81, 0x81818181, 0x7f817f81, 0x7f7f7f7f, 0x81817f7f, 0x7f817f7f, 0x7f7f817f, 0x81817f7f,
+0x81817f7f, 0x7f7f7f7f, 0x817f7f7f, 0x7f817f81, 0x81818181, 0x81817f7f, 0x7f817f7f, 0x8181817f,
+0x7f81817f, 0x817f7f81, 0x7f817f7f, 0x7f7f7f7f, 0x817f7f81, 0x7f817f81, 0x81818181, 0x81817f81,
+0x7f817f81, 0x81818181, 0x81818181, 0x8181817f, 0x7f7f817f, 0x817f7f7f, 0x817f7f7f, 0x7f7f7f7f,
+0x81818181, 0x7f817f7f, 0x817f7f81, 0x7f7f8181, 0x817f8181, 0x81817f7f, 0x81817f7f, 0x817f7f7f,
+0x817f817f, 0x7f818181, 0x7f817f7f, 0x817f8181, 0x7f817f7f, 0x817f8181, 0x7f7f817f, 0x81817f7f,
+0x8181817f, 0x7f817f81, 0x7f7f7f81, 0x81818181, 0x7f7f7f81, 0x81818181, 0x7f7f817f, 0x817f7f7f,
+0x817f817f, 0x7f7f8181, 0x7f7f7f81, 0x7f817f7f, 0x817f8181, 0x817f817f, 0x81818181, 0x81817f7f
+
+output0 =
+0xea7bdad9, 0xabd8311a, 0x4e7ba2e2, 0x5c5c5c85, 0xc400ed50, 0x9bea8883, 0xb7f0
+
+basegraph=
+2
+
+z_c=
+28
+
+n_cb=
+1400
+
+q_m=
+2
+
+n_filler=
+56
+
+ea =
+2048
+
+eb =
+2048
+
+iter_max=
+8
+
+expected_iter_count=
+2
+
+c =
+1
+
+r =
+0
+
+cab =
+0
+
+rv_index =
+0
+
+code_block_mode =
+0
+
+op_flags =
+RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP, RTE_BBDEV_LDPC_DEC_BIG_ENDIAN
+
+expected_status =
+OK
diff --git a/app/test-bbdev/test_vectors/ldpc_enc_tb.data b/app/test-bbdev/test_vectors/ldpc_enc_tb.data
new file mode 100644
index 0000000000..277db673c8
--- /dev/null
+++ b/app/test-bbdev/test_vectors/ldpc_enc_tb.data
@@ -0,0 +1,60 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020 NXP
+
+op_type =
+RTE_BBDEV_OP_LDPC_ENC
+
+input0 =
+0xea7bdad9, 0xabd8311a, 0x4e7ba2e2, 0x5c5c5c85, 0xc400ed50, 0x9bea8883, 0xb7f0
+
+output0 =
+0x109dd93b, 0x5bfc1299, 0x44a1bd2c, 0x05ce87c4, 0x006cafc4, 0x2aa04d17, 0xf803a60d, 0xb9b7032b,
+0x5f8af3c9, 0xffa174d1, 0x9ca683dd, 0x0f78551c, 0xb62d51e0, 0xe4996866, 0x42698b36, 0xa4f727f3,
+0x445dcd8a, 0x84531088, 0x2b1813e3, 0xcf5735a6, 0x342bf366, 0xe6ec7026, 0x9d062f0d, 0x1e8d0f99,
+0x01dc0f9d, 0x5041de7a, 0xb1061c0e, 0x776f4313, 0xfb00f397, 0xbb02acb2, 0x7d1952fb, 0x0bf4af7c,
+0x794ae785, 0x9c76d198, 0x8082533d, 0x4ceb5bb3, 0xc9ae8a54, 0x58e72404, 0x472422c3, 0x8eeb7f58,
+0x6c47b68d, 0xc9d8f01d, 0x6b585a0f, 0x6d5f0a37, 0x07e91f2f, 0xb5c2fde0, 0x3308684c, 0xabce9336,
+0xf345a63e, 0x36011c35, 0xee27b0a2, 0x53fc4be9, 0xe7c5df4b, 0x2cbcf361, 0x4505a23f, 0xcd93f236,
+0xc24c05fd, 0xe4cf580c, 0xdf590496, 0x0882eff5, 0x8ccb394f, 0xc2b4b47a, 0x82f1f15e, 0xcfab413a
+
+basegraph=
+2
+
+z_c=
+28
+
+n_cb=
+1400
+
+q_m=
+2
+
+n_filler=
+56
+
+ea =
+2048
+
+eb =
+2048
+
+c =
+1
+
+r =
+0
+
+cab =
+0
+
+rv_index =
+0
+
+code_block_mode =
+0
+
+op_flags =
+RTE_BBDEV_LDPC_CRC_24B_ATTACH, RTE_BBDEV_LDPC_ENC_BIG_ENDIAN
+
+expected_status =
+OK
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v5 1/9] bbdev: add big endian processing data capability
  2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 1/9] bbdev: add big endian processing data capability Nipun Gupta
@ 2021-09-13 18:39     ` Chautru, Nicolas
  2021-09-17  8:30       ` Nipun Gupta
  0 siblings, 1 reply; 157+ messages in thread
From: Chautru, Nicolas @ 2021-09-13 18:39 UTC (permalink / raw)
  To: Nipun Gupta, dev, gakhil; +Cc: david.marchand, hemant.agrawal, Tom Rix



> -----Original Message-----
> From: Nipun Gupta <nipun.gupta@nxp.com>
> Sent: Sunday, September 12, 2021 5:15 AM
> To: dev@dpdk.org; gakhil@marvell.com; Chautru, Nicolas
> <nicolas.chautru@intel.com>
> Cc: david.marchand@redhat.com; hemant.agrawal@nxp.com; Nipun Gupta
> <nipun.gupta@nxp.com>
> Subject: [PATCH v5 1/9] bbdev: add big endian processing data capability
> 
> This patch intoduces a new capability of the bbdev device to process the
> LDPC data in big endian order.

Hi Gupta, 

As mentioned in previous patch iteration earlier this year I believe this is not really an operation flag but more a different device capability. 
ie. you would have the same formalism for all operation (5GDL, 5GUL, 4GDL, ...) for that PMD/hw and that is not something you will change dynamically as an option.
I would suggest to add this under "struct rte_bbdev_driver_info" which can be used to capture device specific capability and information. In term of processing and operation, everything is the same except endianness assumption for the input/output data. 


> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---
>  doc/guides/bbdevs/features/default.ini |  1 +
>  doc/guides/prog_guide/bbdev.rst        |  6 ++++++
>  lib/bbdev/rte_bbdev_op.h               | 14 ++++++++++++--
>  3 files changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/doc/guides/bbdevs/features/default.ini
> b/doc/guides/bbdevs/features/default.ini
> index 5fe267a625..ae5aacf8f7 100644
> --- a/doc/guides/bbdevs/features/default.ini
> +++ b/doc/guides/bbdevs/features/default.ini
> @@ -14,3 +14,4 @@ LLR/HARQ Compression   =
>  External DDR Access    =
>  HW Accelerated         =
>  BBDEV API              =
> +Big Endian Processing  =
> diff --git a/doc/guides/prog_guide/bbdev.rst
> b/doc/guides/prog_guide/bbdev.rst index 9619280ffc..6540b514bb 100644
> --- a/doc/guides/prog_guide/bbdev.rst
> +++ b/doc/guides/prog_guide/bbdev.rst
> @@ -747,6 +747,9 @@ given below.
>  |RTE_BBDEV_LDPC_ENC_CONCATENATION                                    |
>  | Set if a device supports concatenation of non byte aligned output  |  +------
> --------------------------------------------------------------+
> +|RTE_BBDEV_LDPC_ENC_BIG_ENDIAN                                       |
> +| Set if a device supports Big Endian data processing                |
> ++--------------------------------------------------------------------+
> 
>  The structure passed for each LDPC encode operation is given below,  with
> the operation flags forming a bitmask in the ``op_flags`` field.
> @@ -942,6 +945,9 @@ given below.
>  |RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_LOOPBACK                        |
>  | Set if a device supports loopback access to HARQ internal memory   |
>  +--------------------------------------------------------------------+
> +|RTE_BBDEV_LDPC_DEC_BIG_ENDIAN                                       |
> +| Set if a device supports Big Endian data processing                |
> ++--------------------------------------------------------------------+
> 
>  The structure passed for each LDPC decode operation is given below,  with
> the operation flags forming a bitmask in the ``op_flags`` field.
> diff --git a/lib/bbdev/rte_bbdev_op.h b/lib/bbdev/rte_bbdev_op.h index
> f946842727..9e9b5be81f 100644
> --- a/lib/bbdev/rte_bbdev_op.h
> +++ b/lib/bbdev/rte_bbdev_op.h
> @@ -186,7 +186,12 @@ enum rte_bbdev_op_ldpcdec_flag_bitmasks {
>  	 *  for HARQ memory. If not set, it is assumed the filler bits are not
>  	 *  in HARQ memory and handled directly by the LDPC decoder.
>  	 */
> -	RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS = (1ULL <<
> 18)
> +	RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS = (1ULL <<
> 18),
> +	/** Set if a device supports Big Endian data processing.
> +	 *  If not set Little Endian data processing is supported by
> +	 *  default.
> +	 */
> +	RTE_BBDEV_LDPC_DEC_BIG_ENDIAN = (1ULL << 8)
>  };
> 
>  /** Flags for LDPC encoder operation and capability structure */ @@ -206,7
> +211,12 @@ enum rte_bbdev_op_ldpcenc_flag_bitmasks {
>  	/** Set if a device supports scatter-gather functionality. */
>  	RTE_BBDEV_LDPC_ENC_SCATTER_GATHER = (1ULL << 6),
>  	/** Set if a device supports concatenation of non byte aligned output
> */
> -	RTE_BBDEV_LDPC_ENC_CONCATENATION = (1ULL << 7)
> +	RTE_BBDEV_LDPC_ENC_CONCATENATION = (1ULL << 7),
> +	/** Set if a device supports Big Endian data processing
> +	 *  If not set Little Endian data processing is supported by
> +	 *  default.
> +	 */
> +	RTE_BBDEV_LDPC_ENC_BIG_ENDIAN = (1ULL << 8)
>  };
> 
>  /** Flags for the Code Block/Transport block mode  */
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v5 8/9] app/bbdev: handle endianness of test data
  2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 8/9] app/bbdev: handle endianness of test data Nipun Gupta
@ 2021-09-13 18:45     ` Chautru, Nicolas
  0 siblings, 0 replies; 157+ messages in thread
From: Chautru, Nicolas @ 2021-09-13 18:45 UTC (permalink / raw)
  To: Nipun Gupta, dev, gakhil; +Cc: david.marchand, hemant.agrawal



> -----Original Message-----
> From: Nipun Gupta <nipun.gupta@nxp.com>
> Sent: Sunday, September 12, 2021 5:15 AM
> To: dev@dpdk.org; gakhil@marvell.com; Chautru, Nicolas
> <nicolas.chautru@intel.com>
> Cc: david.marchand@redhat.com; hemant.agrawal@nxp.com; Nipun Gupta
> <nipun.gupta@nxp.com>
> Subject: [PATCH v5 8/9] app/bbdev: handle endianness of test data
> 
> With data input, output and harq also supported in big endian format, this
> patch updates the testbbdev application to handle the endianness
> conversion as directed by the test vector and the driver being used.
> 
> For instance, if the driver supports big endian data processing, but the test
> vector does not mention the data as a big endian format, conversion from
> little endian to big will be handled by the testbbdev application.

See command on the 1/9 with regards to how to expose the endianness. This will also simplify some of that code, as same vectors can be used any variant of PMD.

> 
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---
>  app/test-bbdev/test_bbdev_perf.c   | 84
> ++++++++++++++++++++++++++++++
>  app/test-bbdev/test_bbdev_vector.c |  4 ++
>  2 files changed, 88 insertions(+)
> 
> diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-
> bbdev/test_bbdev_perf.c
> index 469597b8b3..836e07d747 100644
> --- a/app/test-bbdev/test_bbdev_perf.c
> +++ b/app/test-bbdev/test_bbdev_perf.c
> @@ -227,6 +227,71 @@ clear_soft_out_cap(uint32_t *op_flags)
>  	*op_flags &= ~RTE_BBDEV_TURBO_NEG_LLR_1_BIT_SOFT_OUT;
>  }
> 
> +static void
> +clear_ldpc_endianness_flag(uint32_t *op_flags) {
> +	*op_flags &= ~RTE_BBDEV_LDPC_ENC_BIG_ENDIAN;
> +	*op_flags &= ~RTE_BBDEV_LDPC_DEC_BIG_ENDIAN; }
> +
> +static inline void
> +reverse_op(struct op_data_entries *op)
> +{
> +	uint8_t nb_segs = op->nb_segments;
> +	uint32_t *data, len;
> +	int complete, rem, i, j;
> +	uint8_t *rem_data, temp;
> +
> +	/* Validate each mbuf segment length */
> +	for (i = 0; i < nb_segs; ++i) {
> +		len = op->segments[i].length;
> +		data = op->segments[i].addr;
> +
> +		/* Swap complete u32 bytes */
> +		complete = len / 4;
> +		for (j = 0; j < complete; j++)
> +			data[j] = rte_bswap32(data[j]);
> +
> +		/* Swap any remaining data for last seg */
> +		if (i == (nb_segs - 1)) {
> +			rem = len % 4;
> +			rem_data = (uint8_t *)&data[j];
> +			for (j = 0; j < rem/2; j++) {
> +				temp = rem_data[j];
> +				rem_data[j] = rem_data[rem - j - 1];
> +				rem_data[rem - j - 1] = temp;
> +			}
> +		}
> +	}
> +}
> +
> +static inline void
> +reverse_all_ops(void)
> +{
> +	unsigned int nb_inputs, nb_soft_outputs, nb_hard_outputs,
> +		nb_harq_inputs, nb_harq_outputs;
> +
> +	nb_inputs = test_vector.entries[DATA_INPUT].nb_segments;
> +	if (nb_inputs)
> +		reverse_op(&test_vector.entries[DATA_INPUT]);
> +
> +	nb_soft_outputs =
> test_vector.entries[DATA_SOFT_OUTPUT].nb_segments;
> +	if (nb_soft_outputs)
> +		reverse_op(&test_vector.entries[DATA_SOFT_OUTPUT]);
> +
> +	nb_hard_outputs =
> test_vector.entries[DATA_HARD_OUTPUT].nb_segments;
> +	if (nb_hard_outputs)
> +		reverse_op(&test_vector.entries[DATA_HARD_OUTPUT]);
> +
> +	nb_harq_inputs  =
> test_vector.entries[DATA_HARQ_INPUT].nb_segments;
> +	if (nb_harq_inputs)
> +		reverse_op(&test_vector.entries[DATA_HARQ_INPUT]);
> +
> +	nb_harq_outputs =
> test_vector.entries[DATA_HARQ_OUTPUT].nb_segments;
> +	if (nb_harq_outputs)
> +		reverse_op(&test_vector.entries[DATA_HARQ_OUTPUT]);
> +}
> +
>  static int
>  check_dev_cap(const struct rte_bbdev_info *dev_info)  { @@ -324,6
> +389,16 @@ check_dev_cap(const struct rte_bbdev_info *dev_info)
>  			const struct rte_bbdev_op_cap_ldpc_enc *cap =
>  					&op_cap->cap.ldpc_enc;
> 
> +			if ((test_vector.ldpc_enc.op_flags &
> +
> 	RTE_BBDEV_LDPC_ENC_BIG_ENDIAN) !=
> +					(cap->capability_flags &
> +
> 	RTE_BBDEV_LDPC_ENC_BIG_ENDIAN)) {
> +				reverse_all_ops();
> +				clear_ldpc_endianness_flag(
> +					&test_vector.ldpc_enc.op_flags);
> +
> +			}
> +
>  			if (!flags_match(test_vector.ldpc_enc.op_flags,
>  					cap->capability_flags)){
>  				printf("Flag Mismatch\n");
> @@ -352,6 +427,15 @@ check_dev_cap(const struct rte_bbdev_info
> *dev_info)
>  			const struct rte_bbdev_op_cap_ldpc_dec *cap =
>  					&op_cap->cap.ldpc_dec;
> 
> +			if ((test_vector.ldpc_dec.op_flags &
> +
> 	RTE_BBDEV_LDPC_DEC_BIG_ENDIAN) !=
> +					(cap->capability_flags &
> +
> 	RTE_BBDEV_LDPC_DEC_BIG_ENDIAN)) {
> +				reverse_all_ops();
> +				clear_ldpc_endianness_flag(
> +					&test_vector.ldpc_dec.op_flags);
> +			}
> +
>  			if (!flags_match(test_vector.ldpc_dec.op_flags,
>  					cap->capability_flags)){
>  				printf("Flag Mismatch\n");
> diff --git a/app/test-bbdev/test_bbdev_vector.c b/app/test-
> bbdev/test_bbdev_vector.c
> index 614dbd1a6d..b2e7a9008d 100644
> --- a/app/test-bbdev/test_bbdev_vector.c
> +++ b/app/test-bbdev/test_bbdev_vector.c
> @@ -191,6 +191,8 @@ op_ldpc_decoder_flag_strtoul(char *token, uint32_t
> *op_flag_value)
>  		*op_flag_value =
> RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSION;
>  	else if (!strcmp(token, "RTE_BBDEV_LDPC_LLR_COMPRESSION"))
>  		*op_flag_value = RTE_BBDEV_LDPC_LLR_COMPRESSION;
> +	else if (!strcmp(token, "RTE_BBDEV_LDPC_DEC_BIG_ENDIAN"))
> +		*op_flag_value = RTE_BBDEV_LDPC_DEC_BIG_ENDIAN;
>  	else if (!strcmp(token,
> 
> 	"RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_IN_ENABLE"))
>  		*op_flag_value =
> RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_IN_ENABLE;
> @@ -248,6 +250,8 @@ op_ldpc_encoder_flag_strtoul(char *token, uint32_t
> *op_flag_value)
>  		*op_flag_value = RTE_BBDEV_LDPC_ENC_INTERRUPTS;
>  	else if (!strcmp(token,
> "RTE_BBDEV_LDPC_ENC_SCATTER_GATHER"))
>  		*op_flag_value =
> RTE_BBDEV_LDPC_ENC_SCATTER_GATHER;
> +	else if (!strcmp(token, "RTE_BBDEV_LDPC_ENC_BIG_ENDIAN"))
> +		*op_flag_value = RTE_BBDEV_LDPC_ENC_BIG_ENDIAN;
>  	else {
>  		printf("The given value is not a turbo encoder flag\n");
>  		return -1;
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v5 5/9] baseband/la12xx: add queue and modem config support
  2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 5/9] baseband/la12xx: add queue and modem config support Nipun Gupta
@ 2021-09-13 18:56     ` Chautru, Nicolas
  2021-09-17  8:33       ` Nipun Gupta
  0 siblings, 1 reply; 157+ messages in thread
From: Chautru, Nicolas @ 2021-09-13 18:56 UTC (permalink / raw)
  To: Nipun Gupta, dev, gakhil; +Cc: david.marchand, hemant.agrawal



> -----Original Message-----
> From: Nipun Gupta <nipun.gupta@nxp.com>
> Sent: Sunday, September 12, 2021 5:15 AM
> To: dev@dpdk.org; gakhil@marvell.com; Chautru, Nicolas
> <nicolas.chautru@intel.com>
> Cc: david.marchand@redhat.com; hemant.agrawal@nxp.com; Nipun Gupta
> <nipun.gupta@nxp.com>
> Subject: [PATCH v5 5/9] baseband/la12xx: add queue and modem config
> support
> 
> From: Hemant Agrawal <hemant.agrawal@nxp.com>
> 
> This patch add support for connecting with modem and creating the ipc
> channel as queues with modem for the exchange of data.
> 
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>  MAINTAINERS                                |   1 +
>  doc/guides/bbdevs/index.rst                |   1 +
>  doc/guides/bbdevs/la12xx.rst               |  81 +++
>  doc/guides/rel_notes/release_21_11.rst     |   5 +
>  drivers/baseband/la12xx/bbdev_la12xx.c     | 553 ++++++++++++++++++++-
>  drivers/baseband/la12xx/bbdev_la12xx.h     |  11 +-
>  drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 189 ++++++-
>  7 files changed, 831 insertions(+), 10 deletions(-)  create mode 100644
> doc/guides/bbdevs/la12xx.rst
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index a63e672c9e..2c243c10fe 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1295,6 +1295,7 @@ NXP LA12xx driver
>  M: Hemant Agrawal <hemant.agrawal@nxp.com>
>  M: Nipun Gupta <nipun.gupta@nxp.com>
>  F: drivers/baseband/la12xx/
> +F: doc/guides/bbdevs/la12xx.rst
> 
> 
>  Rawdev Drivers
> diff --git a/doc/guides/bbdevs/index.rst b/doc/guides/bbdevs/index.rst
> index 4445cbd1b0..cedd706fa6 100644
> --- a/doc/guides/bbdevs/index.rst
> +++ b/doc/guides/bbdevs/index.rst
> @@ -14,3 +14,4 @@ Baseband Device Drivers
>      fpga_lte_fec
>      fpga_5gnr_fec
>      acc100
> +    la12xx
> diff --git a/doc/guides/bbdevs/la12xx.rst b/doc/guides/bbdevs/la12xx.rst
> new file mode 100644 index 0000000000..3c9ac5c047
> --- /dev/null
> +++ b/doc/guides/bbdevs/la12xx.rst
> @@ -0,0 +1,81 @@
> +..  SPDX-License-Identifier: BSD-3-Clause
> +    Copyright 2021 NXP
> +
> +NXP LA12xx Poll Mode Driver
> +=======================================
> +
> +The BBDEV LA12xx poll mode driver (PMD) supports an implementation for
> +offloading High Phy processing functions like LDPC Encode / Decode 5GNR
> +wireless acceleration function, using PCI based LA12xx Software defined
> radio.
> +
> +More information can be found at `NXP Official Website
> +<https://www.nxp.com/products/processors-and-microcontrollers/arm-
> processors/layerscape-processors/layerscape-access-la1200-programmable-
> baseband-processor:LA1200>`_.
> +
> +Features
> +--------
> +
> +LA12xx PMD supports the following features:
> +
> +- Maximum of 8 UL queues
> +- Maximum of 8 DL queues
> +- PCIe Gen-3 x8 Interface
> +- MSI-X
> +
> +Installation
> +------------
> +
> +Section 3 of the DPDK manual provides instructions on installing and
> compiling DPDK.
> +
> +DPDK requires hugepages to be configured as detailed in section 2 of the
> DPDK manual.
> +
> +Initialization
> +--------------
> +
> +The device can be listed on the host console with:
> +
> +
> +Use the following lspci command to get the multiple LA12xx processor
> +ids. The device ID of the LA12xx baseband processor is "1c30".
> +
> +.. code-block:: console
> +
> +  sudo lspci -nn
> +
> +...
> +0001:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device
> +[1957:1c30] ( rev 10) ...
> +0002:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device
> +[1957:1c30] ( rev 10)
> +
> +
> +Prerequisites
> +-------------
> +
> +Currently supported by DPDK:
> +
> +- NXP LA1224 BSP **1.0+**.
> +- NXP LA1224 PCIe Modem card connected to ARM host.
> +
> +- Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to
> setup the basic DPDK environment.
> +
> +* Use dev arg option ``modem=0`` to identify the modem instance for a
> +given
> +  device. This is required only if more than 1 modem cards are attached to
> host.
> +  this is optional and the default value is 0.
> +  e.g. ``--vdev=baseband_la12xx,modem=0``
> +
> +* Use dev arg option ``max_nb_queues=x`` to specify the maximum
> number
> +of queues
> +  to be used for communication with offload device i.e. modem. default is
> 16.
> +  e.g. ``--vdev=baseband_la12xx,max_nb_queues=4``
> +
> +Enabling logs
> +-------------
> +
> +For enabling logs, use the following EAL parameter:
> +
> +.. code-block:: console
> +
> +   ./your_bbdev_application <EAL args> --log-level=la12xx:<level>
> +
> +Using ``bb.la12xx`` as log matching criteria, all Baseband PMD logs can
> +be enabled which are lower than logging ``level``.
> diff --git a/doc/guides/rel_notes/release_21_11.rst
> b/doc/guides/rel_notes/release_21_11.rst
> index 675b573834..a0e0ebbeb8 100644
> --- a/doc/guides/rel_notes/release_21_11.rst
> +++ b/doc/guides/rel_notes/release_21_11.rst
> @@ -62,6 +62,11 @@ New Features
>    * Added bus-level parsing of the devargs syntax.
>    * Kept compatibility with the legacy syntax as parsing fallback.
> 
> +* **Added NXP LA12xx baseband PMD.**
> +
> +  * Added a new baseband PMD driver for NXP LA12xx Software defined
> radio.
> +  * See the :doc:`../bbdevs/la12xx` for more details.
> +
> 
>  Removed Items
>  -------------
> diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c
> b/drivers/baseband/la12xx/bbdev_la12xx.c
> index f26f3f2a08..57e957a93a 100644
> --- a/drivers/baseband/la12xx/bbdev_la12xx.c
> +++ b/drivers/baseband/la12xx/bbdev_la12xx.c
> @@ -3,6 +3,11 @@
>   */
> 
>  #include <string.h>
> +#include <unistd.h>
> +#include <fcntl.h>
> +#include <sys/ioctl.h>
> +#include <sys/mman.h>
> +#include <dirent.h>
> 
>  #include <rte_common.h>
>  #include <rte_bus_vdev.h>
> @@ -31,11 +36,550 @@ struct bbdev_la12xx_params {
>  #define LA12XX_VDEV_MODEM_ID_ARG	"modem"
>  #define LA12XX_MAX_MODEM 4
> 
> +#define LA12XX_MAX_CORES	4
> +#define LA12XX_LDPC_ENC_CORE	0
> +#define LA12XX_LDPC_DEC_CORE	1
> +
> +#define LA12XX_MAX_LDPC_ENC_QUEUES	4
> +#define LA12XX_MAX_LDPC_DEC_QUEUES	4
> +
>  static const char * const bbdev_la12xx_valid_params[] = {
>  	LA12XX_MAX_NB_QUEUES_ARG,
>  	LA12XX_VDEV_MODEM_ID_ARG,
>  };
> 
> +static const struct rte_bbdev_op_cap bbdev_capabilities[] = {
> +	{
> +		.type   = RTE_BBDEV_OP_LDPC_ENC,
> +		.cap.ldpc_enc = {
> +			.capability_flags =
> +					RTE_BBDEV_LDPC_CRC_24A_ATTACH

Are you sure you genuinely don't support any Ratematching (not a typo)? This is LDPC Encoder only? How do you redefine TB mode without deRMing supported, ie. what concatenation assumption?

> |
> +
> 	RTE_BBDEV_LDPC_CRC_24B_ATTACH,
> +			.num_buffers_src =
> +
> 	RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
> +			.num_buffers_dst =
> +
> 	RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
> +		}
> +	},
> +	{
> +		.type   = RTE_BBDEV_OP_LDPC_DEC,
> +		.cap.ldpc_dec = {
> +			.capability_flags =
> +				RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK |
> +
> 	RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK |

Same comment as above, this is purely decoder? 
From documentation, there was support for MSI-X, still you don't expose that capability here?


> +
> 	RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP,
> +			.num_buffers_src =
> +
> 	RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
> +			.num_buffers_hard_out =
> +
> 	RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
> +			.llr_size = 8,
> +			.llr_decimals = 1,
> +		}
> +	},
> +	RTE_BBDEV_END_OF_CAPABILITIES_LIST()
> +};
> +
> +static struct rte_bbdev_queue_conf default_queue_conf = {
> +	.queue_size = MAX_CHANNEL_DEPTH,
> +};
> +
> +/* Get device info */
> +static void
> +la12xx_info_get(struct rte_bbdev *dev __rte_unused,
> +		struct rte_bbdev_driver_info *dev_info) {
> +	PMD_INIT_FUNC_TRACE();
> +
> +	dev_info->driver_name = RTE_STR(DRIVER_NAME);
> +	dev_info->max_num_queues = LA12XX_MAX_QUEUES;
> +	dev_info->queue_size_lim = MAX_CHANNEL_DEPTH;
> +	dev_info->hardware_accelerated = true;
> +	dev_info->max_dl_queue_priority = 0;
> +	dev_info->max_ul_queue_priority = 0;
> +	dev_info->default_queue_conf = default_queue_conf;
> +	dev_info->capabilities = bbdev_capabilities;
> +	dev_info->cpu_flag_reqs = NULL;
> +	dev_info->min_alignment = 64;
> +
> +	rte_bbdev_log_debug("got device info from %u", dev->data-
> >dev_id); }
> +
> +/* Release queue */
> +static int
> +la12xx_queue_release(struct rte_bbdev *dev, uint16_t q_id) {
> +	RTE_SET_USED(dev);
> +	RTE_SET_USED(q_id);
> +
> +	PMD_INIT_FUNC_TRACE();
> +
> +	/* TODO: Implement */

Why is there a TODO here still? The implementation is not complete in that version of the code?


> +
> +	return 0;
> +}
> +
> +#define HUGEPG_OFFSET(A) \
> +		((uint64_t) ((unsigned long) (A) \
> +		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
> +
> +static int ipc_queue_configure(uint32_t channel_id,
> +		ipc_t instance, struct bbdev_la12xx_q_priv *q_priv) {
> +	ipc_userspace_t *ipc_priv = (ipc_userspace_t *)instance;
> +	ipc_instance_t *ipc_instance = ipc_priv->instance;
> +	ipc_ch_t *ch;
> +	void *vaddr;
> +	uint32_t i = 0;
> +	uint32_t msg_size = sizeof(struct bbdev_ipc_enqueue_op);
> +
> +	PMD_INIT_FUNC_TRACE();
> +
> +	rte_bbdev_log_debug("%x %p", ipc_instance->initialized,
> +		ipc_priv->instance);
> +	ch = &(ipc_instance->ch_list[channel_id]);
> +
> +	rte_bbdev_log_debug("channel: %u, depth: %u, msg size: %u",
> +		channel_id, q_priv->queue_size, msg_size);
> +
> +	/* Start init of channel */
> +	ch->md.ring_size = rte_cpu_to_be_32(q_priv->queue_size);
> +	ch->md.pi = 0;
> +	ch->md.ci = 0;
> +	ch->md.msg_size = msg_size;
> +	for (i = 0; i < q_priv->queue_size; i++) {
> +		vaddr = rte_malloc(NULL, msg_size, RTE_CACHE_LINE_SIZE);
> +		if (!vaddr)
> +			return IPC_HOST_BUF_ALLOC_FAIL;
> +		/* Only offset now */
> +		ch->bd_h[i].modem_ptr =
> +			rte_cpu_to_be_32(HUGEPG_OFFSET(vaddr));
> +		ch->bd_h[i].host_virt_l = lower_32_bits(vaddr);
> +		ch->bd_h[i].host_virt_h = upper_32_bits(vaddr);
> +		q_priv->msg_ch_vaddr[i] = vaddr;
> +		/* Not sure use of this len may be for CRC*/
> +		ch->bd_h[i].len = 0;
> +	}
> +	ch->host_ipc_params =
> +		rte_cpu_to_be_32(HUGEPG_OFFSET(q_priv-
> >host_params));
> +
> +	rte_bbdev_log_debug("Channel configured");
> +	return IPC_SUCCESS;
> +}
> +
> +static int
> +la12xx_e200_queue_setup(struct rte_bbdev *dev,
> +		struct bbdev_la12xx_q_priv *q_priv)
> +{
> +	struct bbdev_la12xx_private *priv = dev->data->dev_private;
> +	ipc_userspace_t *ipc_priv = priv->ipc_priv;
> +	struct gul_hif *mhif;
> +	ipc_metadata_t *ipc_md;
> +	ipc_ch_t *ch;
> +	int instance_id = 0, i;
> +	int ret;
> +
> +	PMD_INIT_FUNC_TRACE();
> +
> +	switch (q_priv->op_type) {
> +	case RTE_BBDEV_OP_LDPC_ENC:
> +		q_priv->la12xx_core_id = LA12XX_LDPC_ENC_CORE;
> +		break;
> +	case RTE_BBDEV_OP_LDPC_DEC:
> +		q_priv->la12xx_core_id = LA12XX_LDPC_DEC_CORE;
> +		break;
> +	default:
> +		rte_bbdev_log(ERR, "Unsupported op type\n");
> +		return -1;
> +	}
> +
> +	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
> +	/* offset is from start of PEB */
> +	ipc_md = (ipc_metadata_t *)((uint64_t)ipc_priv-
> >peb_start.host_vaddr +
> +		mhif->ipc_regs.ipc_mdata_offset);
> +	ch = &ipc_md->instance_list[instance_id].ch_list[q_priv->q_id];
> +
> +	if (q_priv->q_id < priv->num_valid_queues) {
> +		ipc_br_md_t *md = &(ch->md);
> +
> +		q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
> +		q_priv->feca_blk_id_be32 = ch->feca_blk_id;
> +		q_priv->host_pi = rte_be_to_cpu_32(md->pi);
> +		q_priv->host_ci = rte_be_to_cpu_32(md->ci);
> +		q_priv->host_params = (host_ipc_params_t *)
> +			(rte_be_to_cpu_32(ch->host_ipc_params) +
> +			((uint64_t)ipc_priv->hugepg_start.host_vaddr));
> +
> +		for (i = 0; i < q_priv->queue_size; i++) {
> +			uint32_t h, l;
> +
> +			h = ch->bd_h[i].host_virt_h;
> +			l = ch->bd_h[i].host_virt_l;
> +			q_priv->msg_ch_vaddr[i] = (void *)join_32_bits(h, l);
> +		}
> +
> +		rte_bbdev_log(WARNING,
> +			"Queue [%d] already configured, not configuring
> again",
> +			q_priv->q_id);
> +		return 0;
> +	}
> +
> +	rte_bbdev_log_debug("setting up queue %d", q_priv->q_id);
> +
> +	/* Call ipc_configure_channel */
> +	ret = ipc_queue_configure(q_priv->q_id, ipc_priv, q_priv);
> +	if (ret) {
> +		rte_bbdev_log(ERR, "Unable to setup queue (%d) (err=%d)",
> +		       q_priv->q_id, ret);
> +		return ret;
> +	}
> +
> +	/* Set queue properties for LA12xx device */
> +	switch (q_priv->op_type) {
> +	case RTE_BBDEV_OP_LDPC_ENC:
> +		if (priv->num_ldpc_enc_queues >=
> LA12XX_MAX_LDPC_ENC_QUEUES) {
> +			rte_bbdev_log(ERR,
> +				"num_ldpc_enc_queues reached max
> value");
> +			return -1;
> +		}
> +		ch->la12xx_core_id =
> +			rte_cpu_to_be_32(LA12XX_LDPC_ENC_CORE);
> +		ch->feca_blk_id = rte_cpu_to_be_32(priv-
> >num_ldpc_enc_queues++);
> +		break;
> +	case RTE_BBDEV_OP_LDPC_DEC:
> +		if (priv->num_ldpc_dec_queues >=
> LA12XX_MAX_LDPC_DEC_QUEUES) {
> +			rte_bbdev_log(ERR,
> +				"num_ldpc_dec_queues reached max
> value");
> +			return -1;
> +		}
> +		ch->la12xx_core_id =
> +			rte_cpu_to_be_32(LA12XX_LDPC_DEC_CORE);
> +		ch->feca_blk_id = rte_cpu_to_be_32(priv-
> >num_ldpc_dec_queues++);
> +		break;
> +	default:
> +		rte_bbdev_log(ERR, "Not supported op type\n");
> +		return -1;
> +	}
> +	ch->op_type = rte_cpu_to_be_32(q_priv->op_type);
> +	ch->depth = rte_cpu_to_be_32(q_priv->queue_size);
> +
> +	/* Store queue config here */
> +	q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
> +	q_priv->feca_blk_id_be32 = ch->feca_blk_id;
> +
> +	return 0;
> +}
> +
> +/* Setup a queue */
> +static int
> +la12xx_queue_setup(struct rte_bbdev *dev, uint16_t q_id,
> +		const struct rte_bbdev_queue_conf *queue_conf) {
> +	struct bbdev_la12xx_private *priv = dev->data->dev_private;
> +	struct rte_bbdev_queue_data *q_data;
> +	struct bbdev_la12xx_q_priv *q_priv;
> +	int ret;
> +
> +	PMD_INIT_FUNC_TRACE();
> +
> +	/* Move to setup_queues callback */
> +	q_data = &dev->data->queues[q_id];
> +	q_data->queue_private = rte_zmalloc(NULL,
> +		sizeof(struct bbdev_la12xx_q_priv), 0);
> +	if (!q_data->queue_private) {
> +		rte_bbdev_log(ERR, "Memory allocation failed for qpriv");
> +		return -ENOMEM;
> +	}
> +	q_priv = q_data->queue_private;
> +	q_priv->q_id = q_id;
> +	q_priv->bbdev_priv = dev->data->dev_private;
> +	q_priv->queue_size = queue_conf->queue_size;
> +	q_priv->op_type = queue_conf->op_type;
> +
> +	ret = la12xx_e200_queue_setup(dev, q_priv);
> +	if (ret) {
> +		rte_bbdev_log(ERR, "e200_queue_setup failed for qid: %d",
> +				     q_id);
> +		return ret;
> +	}
> +
> +	/* Store queue config here */
> +	priv->num_valid_queues++;
> +
> +	return 0;
> +}
> +
> +static int
> +la12xx_start(struct rte_bbdev *dev)
> +{
> +	struct bbdev_la12xx_private *priv = dev->data->dev_private;
> +	ipc_userspace_t *ipc_priv = priv->ipc_priv;
> +	int ready = 0;
> +	struct gul_hif *hif_start;
> +
> +	PMD_INIT_FUNC_TRACE();
> +
> +	hif_start = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
> +
> +	/* Set Host Read bit */
> +	SET_HIF_HOST_RDY(hif_start, HIF_HOST_READY_IPC_APP);
> +
> +	/* Now wait for modem ready bit */
> +	while (!ready)
> +		ready = CHK_HIF_MOD_RDY(hif_start,
> HIF_MOD_READY_IPC_APP);
> +
> +	return 0;
> +}
> +
> +static const struct rte_bbdev_ops pmd_ops = {
> +	.info_get = la12xx_info_get,
> +	.queue_setup = la12xx_queue_setup,
> +	.queue_release = la12xx_queue_release,
> +	.start = la12xx_start
> +};
> +static struct hugepage_info *
> +get_hugepage_info(void)
> +{
> +	struct hugepage_info *hp_info;
> +	struct rte_memseg *mseg;
> +
> +	PMD_INIT_FUNC_TRACE();
> +
> +	/* TODO - find a better way */
> +	hp_info = rte_malloc(NULL, sizeof(struct hugepage_info), 0);
> +	if (!hp_info) {
> +		rte_bbdev_log(ERR, "Unable to allocate on local heap");
> +		return NULL;
> +	}
> +
> +	mseg = rte_mem_virt2memseg(hp_info, NULL);
> +	hp_info->vaddr = mseg->addr;
> +	hp_info->paddr = rte_mem_virt2phy(mseg->addr);
> +	hp_info->len = mseg->len;
> +
> +	return hp_info;
> +}
> +
> +static int open_ipc_dev(int modem_id)
> +{
> +	char dev_initials[16], dev_path[PATH_MAX];
> +	struct dirent *entry;
> +	int dev_ipc = 0;
> +	DIR *dir;
> +
> +	dir = opendir("/dev/");
> +	if (!dir) {
> +		rte_bbdev_log(ERR, "Unable to open /dev/");
> +		return -1;
> +	}
> +
> +	sprintf(dev_initials, "gulipcgul%d", modem_id);
> +
> +	while ((entry = readdir(dir)) != NULL) {
> +		if (!strncmp(dev_initials, entry->d_name,
> +		    sizeof(dev_initials) - 1))
> +			break;
> +	}
> +
> +	if (!entry) {
> +		rte_bbdev_log(ERR, "Error: No gulipcgul%d device",
> modem_id);
> +		return -1;
> +	}
> +
> +	sprintf(dev_path, "/dev/%s", entry->d_name);
> +	dev_ipc = open(dev_path, O_RDWR);
> +	if (dev_ipc  < 0) {
> +		rte_bbdev_log(ERR, "Error: Cannot open %s", dev_path);
> +		return -errno;
> +	}
> +
> +	return dev_ipc;
> +}
> +
> +static int
> +setup_la12xx_dev(struct rte_bbdev *dev) {
> +	struct bbdev_la12xx_private *priv = dev->data->dev_private;
> +	ipc_userspace_t *ipc_priv = priv->ipc_priv;
> +	struct hugepage_info *hp = NULL;
> +	ipc_channel_us_t *ipc_priv_ch = NULL;
> +	int dev_ipc = 0, dev_mem = 0, i;
> +	ipc_metadata_t *ipc_md;
> +	struct gul_hif *mhif;
> +	uint32_t phy_align = 0;
> +	int ret;
> +
> +	PMD_INIT_FUNC_TRACE();
> +
> +	if (!ipc_priv) {
> +		/* TODO - get a better way */
> +		/* Get the hugepage info against it */
> +		hp = get_hugepage_info();
> +		if (!hp) {
> +			rte_bbdev_log(ERR, "Unable to get hugepage info");
> +			ret = -ENOMEM;
> +			goto err;
> +		}
> +
> +		rte_bbdev_log_debug("%lx %p %lx",
> +				hp->paddr, hp->vaddr, hp->len);
> +
> +		ipc_priv = rte_zmalloc(0, sizeof(ipc_userspace_t), 0);
> +		if (ipc_priv == NULL) {
> +			rte_bbdev_log(ERR,
> +				"Unable to allocate memory for ipc priv");
> +			ret = -ENOMEM;
> +			goto err;
> +		}
> +
> +		for (i = 0; i < IPC_MAX_CHANNEL_COUNT; i++) {
> +			ipc_priv_ch = rte_zmalloc(0,
> +				sizeof(ipc_channel_us_t), 0);
> +			if (ipc_priv_ch == NULL) {
> +				rte_bbdev_log(ERR,
> +					"Unable to allocate memory for
> channels");
> +				ret = -ENOMEM;
> +			}
> +			ipc_priv->channels[i] = ipc_priv_ch;
> +		}
> +
> +		dev_mem = open("/dev/mem", O_RDWR);
> +		if (dev_mem < 0) {
> +			rte_bbdev_log(ERR, "Error: Cannot open
> /dev/mem");
> +			ret = -errno;
> +			goto err;
> +		}
> +
> +		ipc_priv->instance_id = 0;
> +		ipc_priv->dev_mem = dev_mem;
> +
> +		rte_bbdev_log_debug("hugepg input %lx %p %lx",
> +			hp->paddr, hp->vaddr, hp->len);
> +
> +		ipc_priv->sys_map.hugepg_start.host_phys = hp->paddr;
> +		ipc_priv->sys_map.hugepg_start.size = hp->len;
> +
> +		ipc_priv->hugepg_start.host_phys = hp->paddr;
> +		ipc_priv->hugepg_start.host_vaddr = hp->vaddr;
> +		ipc_priv->hugepg_start.size = hp->len;
> +
> +		rte_free(hp);
> +	}
> +
> +	dev_ipc = open_ipc_dev(priv->modem_id);
> +	if (dev_ipc < 0) {
> +		rte_bbdev_log(ERR, "Error: open_ipc_dev failed");
> +		goto err;
> +	}
> +	ipc_priv->dev_ipc = dev_ipc;
> +
> +	ret = ioctl(ipc_priv->dev_ipc, IOCTL_GUL_IPC_GET_SYS_MAP,
> +		    &ipc_priv->sys_map);
> +	if (ret) {
> +		rte_bbdev_log(ERR,
> +			"IOCTL_GUL_IPC_GET_SYS_MAP ioctl failed");
> +		goto err;
> +	}
> +
> +	phy_align = (ipc_priv->sys_map.mhif_start.host_phys % 0x1000);
> +	ipc_priv->mhif_start.host_vaddr =
> +		mmap(0, ipc_priv->sys_map.mhif_start.size + phy_align,
> +		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv-
> >dev_mem,
> +		     (ipc_priv->sys_map.mhif_start.host_phys - phy_align));
> +	if (ipc_priv->mhif_start.host_vaddr == MAP_FAILED) {
> +		rte_bbdev_log(ERR, "MAP failed:");
> +		ret = -errno;
> +		goto err;
> +	}
> +
> +	ipc_priv->mhif_start.host_vaddr = (void *) ((uint64_t)
> +		(ipc_priv->mhif_start.host_vaddr) + phy_align);
> +
> +	phy_align = (ipc_priv->sys_map.peb_start.host_phys % 0x1000);
> +	ipc_priv->peb_start.host_vaddr =
> +		mmap(0, ipc_priv->sys_map.peb_start.size + phy_align,
> +		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv-
> >dev_mem,
> +		     (ipc_priv->sys_map.peb_start.host_phys - phy_align));
> +	if (ipc_priv->peb_start.host_vaddr == MAP_FAILED) {
> +		rte_bbdev_log(ERR, "MAP failed:");
> +		ret = -errno;
> +		goto err;
> +	}
> +
> +	ipc_priv->peb_start.host_vaddr = (void *)((uint64_t)
> +		(ipc_priv->peb_start.host_vaddr) + phy_align);
> +
> +	phy_align = (ipc_priv->sys_map.modem_ccsrbar.host_phys %
> 0x1000);
> +	ipc_priv->modem_ccsrbar.host_vaddr =
> +		mmap(0, ipc_priv->sys_map.modem_ccsrbar.size +
> phy_align,
> +		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv-
> >dev_mem,
> +		     (ipc_priv->sys_map.modem_ccsrbar.host_phys -
> phy_align));
> +	if (ipc_priv->modem_ccsrbar.host_vaddr == MAP_FAILED) {
> +		rte_bbdev_log(ERR, "MAP failed:");
> +		ret = -errno;
> +		goto err;
> +	}
> +
> +	ipc_priv->modem_ccsrbar.host_vaddr = (void *)((uint64_t)
> +		(ipc_priv->modem_ccsrbar.host_vaddr) + phy_align);
> +
> +	ipc_priv->hugepg_start.modem_phys =
> +		ipc_priv->sys_map.hugepg_start.modem_phys;
> +
> +	ipc_priv->mhif_start.host_phys =
> +		ipc_priv->sys_map.mhif_start.host_phys;
> +	ipc_priv->mhif_start.size = ipc_priv->sys_map.mhif_start.size;
> +	ipc_priv->peb_start.host_phys = ipc_priv-
> >sys_map.peb_start.host_phys;
> +	ipc_priv->peb_start.size = ipc_priv->sys_map.peb_start.size;
> +
> +	rte_bbdev_log(INFO, "peb %lx %p %x",
> +			ipc_priv->peb_start.host_phys,
> +			ipc_priv->peb_start.host_vaddr,
> +			ipc_priv->peb_start.size);
> +	rte_bbdev_log(INFO, "hugepg %lx %p %x",
> +			ipc_priv->hugepg_start.host_phys,
> +			ipc_priv->hugepg_start.host_vaddr,
> +			ipc_priv->hugepg_start.size);
> +	rte_bbdev_log(INFO, "mhif %lx %p %x",
> +			ipc_priv->mhif_start.host_phys,
> +			ipc_priv->mhif_start.host_vaddr,
> +			ipc_priv->mhif_start.size);
> +	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
> +
> +	/* offset is from start of PEB */
> +	ipc_md = (ipc_metadata_t *)((uint64_t)ipc_priv-
> >peb_start.host_vaddr +
> +			mhif->ipc_regs.ipc_mdata_offset);
> +
> +	if (sizeof(ipc_metadata_t) != mhif->ipc_regs.ipc_mdata_size) {
> +		rte_bbdev_log(ERR,
> +			"ipc_metadata_t =%lx, mhif-
> >ipc_regs.ipc_mdata_size=%x",
> +			sizeof(ipc_metadata_t), mhif-
> >ipc_regs.ipc_mdata_size);
> +		rte_bbdev_log(ERR, "--> mhif->ipc_regs.ipc_mdata_offset=
> %x",
> +			mhif->ipc_regs.ipc_mdata_offset);
> +		rte_bbdev_log(ERR, "gul_hif size=%lx", sizeof(struct
> gul_hif));
> +		return IPC_MD_SZ_MISS_MATCH;
> +	}
> +
> +	ipc_priv->instance = (ipc_instance_t *)
> +		(&ipc_md->instance_list[ipc_priv->instance_id]);
> +
> +	rte_bbdev_log_debug("finish host init");
> +
> +	priv->ipc_priv = ipc_priv;
> +
> +	return 0;
> +
> +err:
> +	rte_free(hp);
> +	rte_free(ipc_priv);
> +	rte_free(ipc_priv_ch);
> +	if (dev_mem)
> +		close(dev_mem);
> +	if (dev_ipc)
> +		close(dev_ipc);
> +
> +	return ret;
> +}
> +
>  static inline int
>  parse_u16_arg(const char *key, const char *value, void *extra_args)  { @@ -
> 123,6 +667,7 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
>  	struct rte_bbdev *bbdev;
>  	const char *name = rte_vdev_device_name(vdev);
>  	struct bbdev_la12xx_private *priv;
> +	int ret;
> 
>  	PMD_INIT_FUNC_TRACE();
> 
> @@ -152,7 +697,13 @@ la12xx_bbdev_create(struct rte_vdev_device
> *vdev,
> 
>  	rte_bbdev_log(INFO, "Setting Up %s: DevId=%d, ModemId=%d",
>  				name, bbdev->data->dev_id, priv-
> >modem_id);
> -	bbdev->dev_ops = NULL;
> +	ret = setup_la12xx_dev(bbdev);
> +	if (ret) {
> +		rte_bbdev_log(ERR, "IPC Setup failed for %s", name);
> +		rte_free(bbdev->data->dev_private);
> +		return ret;
> +	}
> +	bbdev->dev_ops = &pmd_ops;
>  	bbdev->device = &vdev->device;
>  	bbdev->data->socket_id = 0;
>  	bbdev->intr_handle = NULL;
> diff --git a/drivers/baseband/la12xx/bbdev_la12xx.h
> b/drivers/baseband/la12xx/bbdev_la12xx.h
> index 5228502331..49c37fe2fe 100644
> --- a/drivers/baseband/la12xx/bbdev_la12xx.h
> +++ b/drivers/baseband/la12xx/bbdev_la12xx.h
> @@ -5,16 +5,10 @@
>  #ifndef __BBDEV_LA12XX_H__
>  #define __BBDEV_LA12XX_H__
> 
> -#define BBDEV_IPC_ENC_OP_TYPE	1
> -#define BBDEV_IPC_DEC_OP_TYPE	2
> -
> -#define MAX_LDPC_ENC_FECA_QUEUES	4
> -#define MAX_LDPC_DEC_FECA_QUEUES	4
> -
>  #define MAX_CHANNEL_DEPTH 16
>  /* private data structure */
>  struct bbdev_la12xx_private {
> -	void *ipc_priv;
> +	ipc_userspace_t *ipc_priv;
>  	uint8_t num_valid_queues;
>  	uint8_t max_nb_queues;
>  	uint8_t num_ldpc_enc_queues;
> @@ -52,5 +46,6 @@ struct bbdev_la12xx_q_priv {
> 
>  #define lower_32_bits(x) ((uint32_t)((uint64_t)x))  #define
> upper_32_bits(x) ((uint32_t)(((uint64_t)(x) >> 16) >> 16))
> -
> +#define join_32_bits(upper, lower) \
> +	((size_t)(((uint64_t)(upper) << 32) | (uint32_t)(lower)))
>  #endif
> diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> index 9aa5562981..5f613fb087 100644
> --- a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> +++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> @@ -4,9 +4,182 @@
>  #ifndef __BBDEV_LA12XX_IPC_H__
>  #define __BBDEV_LA12XX_IPC_H__
> 
> +#define LA12XX_MAX_QUEUES 20
> +#define HOST_RX_QUEUEID_OFFSET LA12XX_MAX_QUEUES
> +
> +/** No. of max channel per instance */
> +#define IPC_MAX_CHANNEL_COUNT	(64)
> +
>  /** No. of max channel per instance */
>  #define IPC_MAX_DEPTH	(16)
> 
> +/** No. of max IPC instance per modem */
> +#define IPC_MAX_INSTANCE_COUNT	(1)
> +
> +/** Error codes */
> +#define IPC_SUCCESS		(0) /** IPC operation success */

Cosmetic, but such comments are expected to be as /**< IPC operation success */

> +#define IPC_INPUT_INVALID	(-1) /** Invalid input to API */
> +#define IPC_CH_INVALID		(-2) /** Channel no is invalid */
> +#define IPC_INSTANCE_INVALID	(-3) /** Instance no is invalid */
> +#define IPC_MEM_INVALID		(-4) /** Insufficient memory */
> +#define IPC_CH_FULL		(-5) /** Channel is full */
> +#define IPC_CH_EMPTY		(-6) /** Channel is empty */
> +#define IPC_BL_EMPTY		(-7) /** Free buffer list is empty */
> +#define IPC_BL_FULL		(-8) /** Free buffer list is full */
> +#define IPC_HOST_BUF_ALLOC_FAIL	(-9) /** DPDK malloc fail */
> +#define IPC_MD_SZ_MISS_MATCH	(-10) /** META DATA size in mhif
> miss matched*/
> +#define IPC_MALLOC_FAIL		(-11) /** system malloc fail */
> +#define IPC_IOCTL_FAIL		(-12) /** IOCTL call failed */
> +#define IPC_MMAP_FAIL		(-14) /** MMAP fail */
> +#define IPC_OPEN_FAIL		(-15) /** OPEN fail */
> +#define IPC_EVENTFD_FAIL	(-16) /** eventfd initialization failed */
> +#define IPC_NOT_IMPLEMENTED	(-17) /** IPC feature is not
> implemented yet*/
> +
> +#define SET_HIF_HOST_RDY(hif, RDY_MASK) (hif->host_ready |=
> RDY_MASK)
> +#define CHK_HIF_MOD_RDY(hif, RDY_MASK) (hif->mod_ready &
> RDY_MASK)
> +
> +/* Host Ready bits */
> +#define HIF_HOST_READY_HOST_REGIONS	(1 << 0)
> +#define HIF_HOST_READY_IPC_LIB		(1 << 12)
> +#define HIF_HOST_READY_IPC_APP		(1 << 13)
> +#define HIF_HOST_READY_FECA		(1 << 14)
> +
> +/* Modem Ready bits */
> +#define HIF_MOD_READY_IPC_LIB		(1 << 5)
> +#define HIF_MOD_READY_IPC_APP		(1 << 6)
> +#define HIF_MOD_READY_FECA		(1 << 7)
> +
> +typedef void *ipc_t;
> +
> +struct ipc_msg {
> +	int chid;
> +	void *addr;
> +	uint32_t len;
> +	uint8_t flags;
> +};
> +
> +typedef struct {
> +	uint64_t host_phys;
> +	uint32_t modem_phys;
> +	void    *host_vaddr;
> +	uint32_t size;
> +} mem_range_t;
> +
> +#define GUL_IPC_MAGIC	'R'
> +
> +#define IOCTL_GUL_IPC_GET_SYS_MAP _IOW(GUL_IPC_MAGIC, 1, struct
> ipc_msg
> +*) #define IOCTL_GUL_IPC_CHANNEL_REGISTER _IOWR(GUL_IPC_MAGIC,
> 4,
> +struct ipc_msg *) #define IOCTL_GUL_IPC_CHANNEL_DEREGISTER \
> +	_IOWR(GUL_IPC_MAGIC, 5, struct ipc_msg *) #define
> +IOCTL_GUL_IPC_CHANNEL_RAISE_INTERRUPT _IOW(GUL_IPC_MAGIC, 6,
> int *)
> +
> +/** buffer ring common metadata */
> +typedef struct ipc_bd_ring_md {
> +	volatile uint32_t pi;		/**< Producer index and flag (MSB)
> +					  *  which flip for each Ring wrapping
> +					  */
> +	volatile uint32_t ci;		/**< Consumer index and flag (MSB)
> +					  *  which flip for each Ring wrapping
> +					  */
> +	uint32_t ring_size;	/**< depth (Used to roll-over pi/ci) */
> +	uint32_t msg_size;	/**< Size of the each buffer */
> +} __rte_packed ipc_br_md_t;
> +
> +/** IPC buffer descriptor */
> +typedef struct ipc_buffer_desc {
> +	union {
> +		uint64_t host_virt;	/**< msg's host virtual address */
> +		struct {
> +			uint32_t host_virt_l;
> +			uint32_t host_virt_h;
> +		};
> +	};
> +	uint32_t modem_ptr;	/**< msg's modem physical address */
> +	uint32_t len;		/**< msg len */
> +} __rte_packed ipc_bd_t;
> +
> +typedef struct ipc_channel {
> +	uint32_t ch_id;		/**< Channel id */
> +	ipc_br_md_t md;			/**< Metadata for BD ring */
> +	ipc_bd_t bd_h[IPC_MAX_DEPTH];	/**< Buffer Descriptor on
> Host */
> +	ipc_bd_t bd_m[IPC_MAX_DEPTH];	/**< Buffer Descriptor on
> Modem */
> +	uint32_t op_type;		/**< Type of the BBDEV operation
> +					  * supported on this channel
> +					  */
> +	uint32_t depth;			/**< Channel depth */
> +	uint32_t feca_blk_id;	/**< FECA Transport Block ID for processing
> */
> +	uint32_t la12xx_core_id;/**< LA12xx core ID on which this will be
> +				  * scheduled
> +				  */
> +	uint32_t feca_input_circ_size;	/**< FECA transport block input
> +					  * circular buffer size
> +					  */
> +	uint32_t host_ipc_params;	/**< Address for host IPC
> parameters */
> +} __rte_packed ipc_ch_t;
> +
> +typedef struct ipc_instance {
> +	uint32_t instance_id;		/**< instance id, use to init this
> +					  * instance by ipc_init API
> +					  */
> +	uint32_t initialized;		/**< Set in ipc_init */
> +	ipc_ch_t ch_list[IPC_MAX_CHANNEL_COUNT];
> +		/**< Channel descriptors in this instance */ } __rte_packed
> +ipc_instance_t;
> +
> +typedef struct ipc_metadata {
> +	uint32_t ipc_host_signature; /**< IPC host signature, Set by host/L2
> */
> +	uint32_t ipc_geul_signature; /**< IPC geul signature, Set by modem
> */
> +	ipc_instance_t instance_list[IPC_MAX_INSTANCE_COUNT];
> +} __rte_packed ipc_metadata_t;
> +
> +typedef struct ipc_channel_us_priv {
> +	int32_t		eventfd;
> +	uint32_t	channel_id;
> +	/* In flight packets status for buffer list. */
> +	uint8_t		bufs_inflight[IPC_MAX_DEPTH];
> +} ipc_channel_us_t;
> +
> +typedef struct {
> +	uint64_t host_phys;
> +	uint32_t modem_phys;
> +	uint32_t size;
> +} mem_strt_addr_t;
> +
> +typedef struct {
> +	mem_strt_addr_t modem_ccsrbar;
> +	mem_strt_addr_t peb_start; /* PEB meta data */
> +	mem_strt_addr_t mhif_start; /* MHIF meta daat */
> +	mem_strt_addr_t hugepg_start; /* Modem to access hugepage */ }
> +sys_map_t;
> +
> +typedef struct ipc_priv_t {
> +	int instance_id;
> +	int dev_ipc;
> +	int dev_mem;
> +	sys_map_t sys_map;
> +	mem_range_t modem_ccsrbar;
> +	mem_range_t peb_start;
> +	mem_range_t mhif_start;
> +	mem_range_t hugepg_start;
> +	ipc_channel_us_t *channels[IPC_MAX_CHANNEL_COUNT];
> +	ipc_instance_t	*instance;
> +	ipc_instance_t	*instance_bk;
> +} ipc_userspace_t;
> +
> +/** Structure specifying enqueue operation (enqueue at LA1224) */
> +struct bbdev_ipc_enqueue_op {
> +	/** Status of operation that was performed */
> +	int32_t status;
> +	/** CRC Status of SD operation that was performed */
> +	int32_t crc_stat_addr;
> +	/** HARQ Output buffer memory length for Shared Decode.
> +	 * Filled by LA12xx.
> +	 */
> +	uint32_t out_len;
> +	/** Reserved (for 8 byte alignment) */
> +	uint32_t rsvd;
> +};
> +
>  /* This shared memory would be on the host side which have copy of some
>   * of the parameters which are also part of Shared BD ring. Read access
>   * of these parameters from the host side would not be over PCI.
> @@ -14,7 +187,21 @@
>  typedef struct host_ipc_params {
>  	volatile uint32_t pi;
>  	volatile uint32_t ci;
> -	volatile uint32_t modem_ptr[IPC_MAX_DEPTH];
> +	volatile uint32_t bd_m_modem_ptr[IPC_MAX_DEPTH];
>  } __rte_packed host_ipc_params_t;
> 
> +struct hif_ipc_regs {
> +	uint32_t ipc_mdata_offset;
> +	uint32_t ipc_mdata_size;
> +} __rte_packed;
> +
> +struct gul_hif {
> +	uint32_t ver;
> +	uint32_t hif_ver;
> +	uint32_t status;
> +	volatile uint32_t host_ready;
> +	volatile uint32_t mod_ready;
> +	struct hif_ipc_regs ipc_regs;
> +} __rte_packed;
> +
>  #endif
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v5 9/9] app/bbdev: add test vectors for transport blocks
  2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 9/9] app/bbdev: add test vectors for transport blocks Nipun Gupta
@ 2021-09-13 19:01     ` Chautru, Nicolas
  2021-09-17  8:37       ` Nipun Gupta
  0 siblings, 1 reply; 157+ messages in thread
From: Chautru, Nicolas @ 2021-09-13 19:01 UTC (permalink / raw)
  To: Nipun Gupta, dev, gakhil; +Cc: david.marchand, hemant.agrawal



> -----Original Message-----
> From: Nipun Gupta <nipun.gupta@nxp.com>
> Sent: Sunday, September 12, 2021 5:15 AM
> To: dev@dpdk.org; gakhil@marvell.com; Chautru, Nicolas
> <nicolas.chautru@intel.com>
> Cc: david.marchand@redhat.com; hemant.agrawal@nxp.com; Nipun Gupta
> <nipun.gupta@nxp.com>
> Subject: [PATCH v5 9/9] app/bbdev: add test vectors for transport blocks
> 
> This patch adds two test vectors for transport block in network byte
> order:
> - LDPC encode for Transport Block
> - LDPC decode for Transport block

See comments on previous patchsets related to the same topic:
 - This test vector includes Ratematching hence previous pmd exposed capability were not correct
- This is really is a single CB vector (not a TB made of multiple CBs). More generally I don't believe there is new functionality here compared to existing vectors. (keep in mind that the endianness can be managed as a device capability and would not require new vectors).

Thanks
Nic

> 
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---
>  app/test-bbdev/test_vectors/ldpc_dec_tb.data | 122
> +++++++++++++++++++  app/test-bbdev/test_vectors/ldpc_enc_tb.data |
> 60 +++++++++
>  2 files changed, 182 insertions(+)
>  create mode 100644 app/test-bbdev/test_vectors/ldpc_dec_tb.data
>  create mode 100644 app/test-bbdev/test_vectors/ldpc_enc_tb.data
> 
> diff --git a/app/test-bbdev/test_vectors/ldpc_dec_tb.data b/app/test-
> bbdev/test_vectors/ldpc_dec_tb.data
> new file mode 100644
> index 0000000000..b991e8f305
> --- /dev/null
> +++ b/app/test-bbdev/test_vectors/ldpc_dec_tb.data
> @@ -0,0 +1,122 @@
> +# SPDX-License-Identifier: BSD-3-Clause # Copyright 2020 NXP
> +
> +op_type =
> +RTE_BBDEV_OP_LDPC_DEC
> +
> +input0 =
> +0x817f8181, 0x7f7f8181, 0x817f7f81, 0x81817f81, 0x81817f81, 0x817f7f81,
> +0x7f7f7f7f, 0x7f7f7f81, 0x817f7f81, 0x817f7f81, 0x7f7f817f, 0x7f7f7f81,
> +0x81817f7f, 0x81818181, 0x817f8181, 0x7f817f81, 0x81817f7f, 0x7f7f817f,
> +0x81817f81, 0x817f8181, 0x7f7f7f81, 0x817f817f, 0x7f817f7f, 0x7f817f7f,
> +0x7f817f7f, 0x81817f7f, 0x7f818181, 0x817f7f7f, 0x8181817f, 0x81817f7f,
> +0x7f817f81, 0x7f7f7f7f, 0x7f817f7f, 0x81817f7f, 0x81818181, 0x817f817f,
> +0x81817f7f, 0x7f81817f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f818181, 0x7f7f7f81,
> +0x81817f81, 0x7f817f7f, 0x7f7f7f7f, 0x817f817f, 0x817f817f, 0x7f7f817f,
> +0x81817f81, 0x7f7f7f7f, 0x7f81817f, 0x817f817f, 0x7f7f8181, 0x7f7f7f7f,
> +0x817f7f7f, 0x81818181, 0x817f8181, 0x7f7f817f, 0x7f7f8181, 0x7f7f7f7f,
> +0x7f818181, 0x817f8181, 0x817f7f81, 0x817f8181, 0x817f7f81, 0x81817f7f,
> +0x7f7f8181, 0x81818181, 0x817f817f, 0x817f7f7f, 0x81818181, 0x7f817f81,
> +0x7f7f7f81, 0x81817f81, 0x7f817f7f, 0x7f818181, 0x7f7f7f81, 0x817f817f,
> +0x81818181, 0x81818181, 0x81817f81, 0x81817f81, 0x7f7f8181, 0x817f7f7f,
> +0x7f81817f, 0x817f817f, 0x81817f7f, 0x817f7f81, 0x81817f7f, 0x7f7f7f81,
> +0x7f817f81, 0x7f817f81, 0x817f7f7f, 0x7f818181, 0x81818181, 0x7f7f7f7f,
> +0x7f7f7f7f, 0x8181817f, 0x7f7f7f81, 0x7f817f81, 0x81817f81, 0x7f7f817f,
> +0x7f81817f, 0x817f8181, 0x7f81817f, 0x7f81817f, 0x817f7f7f, 0x7f81817f,
> +0x817f7f81, 0x817f7f81, 0x7f817f7f, 0x8181817f, 0x7f81817f, 0x7f7f8181,
> +0x817f8181, 0x817f7f7f, 0x817f7f81, 0x7f81817f, 0x7f7f817f, 0x7f817f7f,
> +0x7f7f8181, 0x81818181, 0x7f818181, 0x7f7f817f, 0x7f818181, 0x81818181,
> +0x7f817f7f, 0x817f817f, 0x817f817f, 0x817f7f7f, 0x81817f81, 0x81817f7f,
> +0x81817f81, 0x7f817f81, 0x7f817f7f, 0x7f817f7f, 0x817f7f7f, 0x817f7f7f,
> +0x7f7f7f7f, 0x7f7f7f81, 0x7f7f8181, 0x7f817f81, 0x7f817f7f, 0x817f7f7f,
> +0x7f7f8181, 0x8181817f, 0x7f7f8181, 0x7f7f7f81, 0x817f7f7f, 0x7f7f7f81,
> +0x817f8181, 0x7f7f817f, 0x7f81817f, 0x817f817f, 0x7f817f81, 0x7f7f8181,
> +0x7f818181, 0x7f817f81, 0x81818181, 0x81817f7f, 0x7f81817f, 0x7f81817f,
> +0x7f7f8181, 0x81818181, 0x817f8181, 0x7f7f817f, 0x7f817f7f, 0x7f7f8181,
> +0x7f81817f, 0x7f7f817f, 0x7f7f7f7f, 0x7f818181, 0x81817f7f, 0x8181817f,
> +0x7f81817f, 0x8181817f, 0x81817f81, 0x7f7f7f7f, 0x81818181, 0x7f7f817f,
> +0x7f81817f, 0x7f7f7f7f, 0x81817f81, 0x817f7f81, 0x817f7f81, 0x817f7f81,
> +0x81818181, 0x7f7f7f7f, 0x81817f81, 0x817f7f7f, 0x8181817f, 0x7f7f7f81,
> +0x81817f81, 0x817f7f81, 0x81818181, 0x7f7f7f7f, 0x81817f7f, 0x81817f81,
> +0x7f7f7f81, 0x7f7f7f7f, 0x817f817f, 0x7f818181, 0x8181817f, 0x81817f81,
> +0x7f7f7f81, 0x7f817f7f, 0x7f7f7f7f, 0x7f817f81, 0x8181817f, 0x7f7f7f7f,
> +0x81817f7f, 0x7f7f7f81, 0x7f81817f, 0x7f7f7f7f, 0x7f7f7f81, 0x817f8181,
> +0x7f7f8181, 0x7f7f7f81, 0x7f7f8181, 0x7f817f7f, 0x81818181, 0x7f81817f,
> +0x7f818181, 0x7f818181, 0x7f818181, 0x817f7f81, 0x7f7f8181, 0x81818181,
> +0x7f7f7f7f, 0x7f7f7f7f, 0x817f8181, 0x81818181, 0x7f7f817f, 0x817f8181,
> +0x81817f7f, 0x817f817f, 0x7f7f817f, 0x7f7f7f7f, 0x817f8181, 0x817f8181,
> +0x817f8181, 0x81818181, 0x7f7f817f, 0x7f817f81, 0x817f7f81, 0x7f7f7f81,
> +0x81817f81, 0x7f818181, 0x81817f7f, 0x7f818181, 0x81818181, 0x817f817f,
> +0x7f817f7f, 0x81818181, 0x817f8181, 0x7f7f7f7f, 0x7f817f81, 0x817f7f7f,
> +0x7f818181, 0x8181817f, 0x817f817f, 0x7f817f7f, 0x817f7f81, 0x7f818181,
> +0x817f7f7f, 0x817f7f81, 0x7f7f7f81, 0x81817f81, 0x7f81817f, 0x7f818181,
> +0x81817f7f, 0x817f7f81, 0x81817f81, 0x7f7f8181, 0x7f7f8181, 0x7f817f81,
> +0x7f7f817f, 0x817f7f7f, 0x7f7f7f7f, 0x817f7f7f, 0x7f7f8181, 0x817f8181,
> +0x817f8181, 0x7f817f81, 0x817f8181, 0x8181817f, 0x81817f7f, 0x7f817f7f,
> +0x7f817f7f, 0x7f817f81, 0x817f817f, 0x817f7f7f, 0x8181817f, 0x817f817f,
> +0x817f7f81, 0x81817f7f, 0x7f817f7f, 0x7f7f7f7f, 0x7f817f7f, 0x7f7f817f,
> +0x7f818181, 0x8181817f, 0x817f7f7f, 0x7f817f81, 0x7f7f8181, 0x81817f7f,
> +0x7f7f817f, 0x7f7f817f, 0x7f817f7f, 0x7f7f817f, 0x7f818181, 0x7f817f7f,
> +0x817f7f7f, 0x7f817f81, 0x81818181, 0x7f818181, 0x817f8181, 0x8181817f,
> +0x8181817f, 0x817f7f7f, 0x81817f81, 0x817f7f7f, 0x7f81817f, 0x817f8181,
> +0x7f818181, 0x7f817f7f, 0x81817f7f, 0x7f81817f, 0x81817f81, 0x7f7f7f81,
> +0x7f7f7f7f, 0x81818181, 0x817f7f7f, 0x81817f81, 0x817f7f81, 0x81817f7f,
> +0x81818181, 0x7f7f7f7f, 0x817f817f, 0x7f817f81, 0x817f7f7f, 0x7f817f81,
> +0x817f8181, 0x7f81817f, 0x7f818181, 0x7f7f8181, 0x817f817f, 0x7f7f7f7f,
> +0x81818181, 0x7f817f81, 0x81817f81, 0x7f81817f, 0x81818181, 0x7f7f817f,
> +0x81818181, 0x7f7f7f81, 0x817f7f81, 0x8181817f, 0x7f818181, 0x7f7f7f7f,
> +0x7f7f7f7f, 0x8181817f, 0x81817f81, 0x81818181, 0x7f7f817f, 0x81817f7f,
> +0x7f817f81, 0x817f8181, 0x81817f7f, 0x7f817f7f, 0x817f7f7f, 0x7f81817f,
> +0x817f7f7f, 0x7f7f7f7f, 0x7f7f8181, 0x7f7f8181, 0x7f81817f, 0x7f7f8181,
> +0x7f7f8181, 0x817f7f81, 0x8181817f, 0x81817f7f, 0x817f8181, 0x817f817f,
> +0x8181817f, 0x7f7f8181, 0x7f81817f, 0x817f817f, 0x7f817f81, 0x7f817f7f,
> +0x7f7f8181, 0x81818181, 0x7f817f81, 0x7f7f8181, 0x81817f7f, 0x7f7f7f81,
> +0x7f7f7f81, 0x7f7f7f7f, 0x7f81817f, 0x7f7f8181, 0x7f7f817f, 0x817f817f,
> +0x7f7f7f7f, 0x817f8181, 0x7f818181, 0x7f7f817f, 0x8181817f, 0x8181817f,
> +0x817f7f81, 0x8181817f, 0x817f8181, 0x7f817f7f, 0x81817f7f, 0x81818181,
> +0x7f7f8181, 0x7f817f81, 0x817f8181, 0x7f817f7f, 0x81818181, 0x81817f81,
> +0x7f817f81, 0x81817f7f, 0x7f818181, 0x8181817f, 0x7f7f7f81, 0x7f81817f,
> +0x7f7f8181, 0x81818181, 0x81817f7f, 0x817f8181, 0x81817f7f, 0x7f7f817f,
> +0x81818181, 0x7f7f8181, 0x7f7f817f, 0x817f817f, 0x7f817f81, 0x7f7f7f7f,
> +0x7f817f81, 0x7f817f7f, 0x7f81817f, 0x7f7f8181, 0x7f7f817f, 0x81818181,
> +0x7f7f8181, 0x817f7f81, 0x81817f81, 0x81817f7f, 0x81817f81, 0x81818181,
> +0x7f817f81, 0x7f7f7f7f, 0x81817f7f, 0x7f817f7f, 0x7f7f817f, 0x81817f7f,
> +0x81817f7f, 0x7f7f7f7f, 0x817f7f7f, 0x7f817f81, 0x81818181, 0x81817f7f,
> +0x7f817f7f, 0x8181817f, 0x7f81817f, 0x817f7f81, 0x7f817f7f, 0x7f7f7f7f,
> +0x817f7f81, 0x7f817f81, 0x81818181, 0x81817f81, 0x7f817f81, 0x81818181,
> +0x81818181, 0x8181817f, 0x7f7f817f, 0x817f7f7f, 0x817f7f7f, 0x7f7f7f7f,
> +0x81818181, 0x7f817f7f, 0x817f7f81, 0x7f7f8181, 0x817f8181, 0x81817f7f,
> +0x81817f7f, 0x817f7f7f, 0x817f817f, 0x7f818181, 0x7f817f7f, 0x817f8181,
> +0x7f817f7f, 0x817f8181, 0x7f7f817f, 0x81817f7f, 0x8181817f, 0x7f817f81,
> +0x7f7f7f81, 0x81818181, 0x7f7f7f81, 0x81818181, 0x7f7f817f, 0x817f7f7f,
> +0x817f817f, 0x7f7f8181, 0x7f7f7f81, 0x7f817f7f, 0x817f8181, 0x817f817f,
> +0x81818181, 0x81817f7f
> +
> +output0 =
> +0xea7bdad9, 0xabd8311a, 0x4e7ba2e2, 0x5c5c5c85, 0xc400ed50,
> 0x9bea8883,
> +0xb7f0
> +
> +basegraph=
> +2
> +
> +z_c=
> +28
> +
> +n_cb=
> +1400
> +
> +q_m=
> +2
> +
> +n_filler=
> +56
> +
> +ea =
> +2048
> +
> +eb =
> +2048
> +
> +iter_max=
> +8
> +
> +expected_iter_count=
> +2
> +
> +c =
> +1
> +
> +r =
> +0
> +
> +cab =
> +0
> +
> +rv_index =
> +0
> +
> +code_block_mode =
> +0
> +
> +op_flags =
> +RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP,
> RTE_BBDEV_LDPC_DEC_BIG_ENDIAN
> +
> +expected_status =
> +OK
> diff --git a/app/test-bbdev/test_vectors/ldpc_enc_tb.data b/app/test-
> bbdev/test_vectors/ldpc_enc_tb.data
> new file mode 100644
> index 0000000000..277db673c8
> --- /dev/null
> +++ b/app/test-bbdev/test_vectors/ldpc_enc_tb.data
> @@ -0,0 +1,60 @@
> +# SPDX-License-Identifier: BSD-3-Clause # Copyright 2020 NXP
> +
> +op_type =
> +RTE_BBDEV_OP_LDPC_ENC
> +
> +input0 =
> +0xea7bdad9, 0xabd8311a, 0x4e7ba2e2, 0x5c5c5c85, 0xc400ed50,
> 0x9bea8883,
> +0xb7f0
> +
> +output0 =
> +0x109dd93b, 0x5bfc1299, 0x44a1bd2c, 0x05ce87c4, 0x006cafc4, 0x2aa04d17,
> +0xf803a60d, 0xb9b7032b, 0x5f8af3c9, 0xffa174d1, 0x9ca683dd, 0x0f78551c,
> +0xb62d51e0, 0xe4996866, 0x42698b36, 0xa4f727f3, 0x445dcd8a, 0x84531088,
> +0x2b1813e3, 0xcf5735a6, 0x342bf366, 0xe6ec7026, 0x9d062f0d, 0x1e8d0f99,
> +0x01dc0f9d, 0x5041de7a, 0xb1061c0e, 0x776f4313, 0xfb00f397, 0xbb02acb2,
> +0x7d1952fb, 0x0bf4af7c, 0x794ae785, 0x9c76d198, 0x8082533d, 0x4ceb5bb3,
> +0xc9ae8a54, 0x58e72404, 0x472422c3, 0x8eeb7f58, 0x6c47b68d, 0xc9d8f01d,
> +0x6b585a0f, 0x6d5f0a37, 0x07e91f2f, 0xb5c2fde0, 0x3308684c, 0xabce9336,
> +0xf345a63e, 0x36011c35, 0xee27b0a2, 0x53fc4be9, 0xe7c5df4b, 0x2cbcf361,
> +0x4505a23f, 0xcd93f236, 0xc24c05fd, 0xe4cf580c, 0xdf590496, 0x0882eff5,
> +0x8ccb394f, 0xc2b4b47a, 0x82f1f15e, 0xcfab413a
> +
> +basegraph=
> +2
> +
> +z_c=
> +28
> +
> +n_cb=
> +1400
> +
> +q_m=
> +2
> +
> +n_filler=
> +56
> +
> +ea =
> +2048
> +
> +eb =
> +2048
> +
> +c =
> +1
> +
> +r =
> +0
> +
> +cab =
> +0
> +
> +rv_index =
> +0
> +
> +code_block_mode =
> +0
> +
> +op_flags =
> +RTE_BBDEV_LDPC_CRC_24B_ATTACH,
> RTE_BBDEV_LDPC_ENC_BIG_ENDIAN
> +
> +expected_status =
> +OK
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v5 1/9] bbdev: add big endian processing data capability
  2021-09-13 18:39     ` Chautru, Nicolas
@ 2021-09-17  8:30       ` Nipun Gupta
  2021-09-17 14:23         ` Chautru, Nicolas
  0 siblings, 1 reply; 157+ messages in thread
From: Nipun Gupta @ 2021-09-17  8:30 UTC (permalink / raw)
  To: Chautru, Nicolas, dev, gakhil; +Cc: david.marchand, Hemant Agrawal, Tom Rix



> -----Original Message-----
> From: Chautru, Nicolas <nicolas.chautru@intel.com>
> Sent: Tuesday, September 14, 2021 12:10 AM
> To: Nipun Gupta <nipun.gupta@nxp.com>; dev@dpdk.org; gakhil@marvell.com
> Cc: david.marchand@redhat.com; Hemant Agrawal
> <hemant.agrawal@nxp.com>; Tom Rix <trix@redhat.com>
> Subject: RE: [PATCH v5 1/9] bbdev: add big endian processing data capability
> 
> 
> 
> > -----Original Message-----
> > From: Nipun Gupta <nipun.gupta@nxp.com>
> > Sent: Sunday, September 12, 2021 5:15 AM
> > To: dev@dpdk.org; gakhil@marvell.com; Chautru, Nicolas
> > <nicolas.chautru@intel.com>
> > Cc: david.marchand@redhat.com; hemant.agrawal@nxp.com; Nipun Gupta
> > <nipun.gupta@nxp.com>
> > Subject: [PATCH v5 1/9] bbdev: add big endian processing data capability
> >
> > This patch intoduces a new capability of the bbdev device to process the
> > LDPC data in big endian order.
> 
> Hi Gupta,
> 
> As mentioned in previous patch iteration earlier this year I believe this is not
> really an operation flag but more a different device capability.
> ie. you would have the same formalism for all operation (5GDL, 5GUL, 4GDL, ...)
> for that PMD/hw and that is not something you will change dynamically as an
> option.
> I would suggest to add this under "struct rte_bbdev_driver_info" which can be
> used to capture device specific capability and information. In term of processing
> and operation, everything is the same except endianness assumption for the
> input/output data.

Okay, it can be done this way. Then it would be assumption of the driver, that the
operation is in the format as per the driver info. Ill change it in respin.

> 
> 
> >
> > Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > ---
> >  doc/guides/bbdevs/features/default.ini |  1 +
> >  doc/guides/prog_guide/bbdev.rst        |  6 ++++++
> >  lib/bbdev/rte_bbdev_op.h               | 14 ++++++++++++--
> >  3 files changed, 19 insertions(+), 2 deletions(-)
> >
> > diff --git a/doc/guides/bbdevs/features/default.ini
> > b/doc/guides/bbdevs/features/default.ini
> > index 5fe267a625..ae5aacf8f7 100644
> > --- a/doc/guides/bbdevs/features/default.ini
> > +++ b/doc/guides/bbdevs/features/default.ini
> > @@ -14,3 +14,4 @@ LLR/HARQ Compression   =
> >  External DDR Access    =
> >  HW Accelerated         =
> >  BBDEV API              =
> > +Big Endian Processing  =
> > diff --git a/doc/guides/prog_guide/bbdev.rst
> > b/doc/guides/prog_guide/bbdev.rst index 9619280ffc..6540b514bb 100644
> > --- a/doc/guides/prog_guide/bbdev.rst
> > +++ b/doc/guides/prog_guide/bbdev.rst
> > @@ -747,6 +747,9 @@ given below.
> >  |RTE_BBDEV_LDPC_ENC_CONCATENATION                                    |
> >  | Set if a device supports concatenation of non byte aligned output  |  +------
> > --------------------------------------------------------------+
> > +|RTE_BBDEV_LDPC_ENC_BIG_ENDIAN                                       |
> > +| Set if a device supports Big Endian data processing                |
> > ++--------------------------------------------------------------------+
> >
> >  The structure passed for each LDPC encode operation is given below,  with
> > the operation flags forming a bitmask in the ``op_flags`` field.
> > @@ -942,6 +945,9 @@ given below.
> >  |RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_LOOPBACK                        |
> >  | Set if a device supports loopback access to HARQ internal memory   |
> >  +--------------------------------------------------------------------+
> > +|RTE_BBDEV_LDPC_DEC_BIG_ENDIAN                                       |
> > +| Set if a device supports Big Endian data processing                |
> > ++--------------------------------------------------------------------+
> >
> >  The structure passed for each LDPC decode operation is given below,  with
> > the operation flags forming a bitmask in the ``op_flags`` field.
> > diff --git a/lib/bbdev/rte_bbdev_op.h b/lib/bbdev/rte_bbdev_op.h index
> > f946842727..9e9b5be81f 100644
> > --- a/lib/bbdev/rte_bbdev_op.h
> > +++ b/lib/bbdev/rte_bbdev_op.h
> > @@ -186,7 +186,12 @@ enum rte_bbdev_op_ldpcdec_flag_bitmasks {
> >  	 *  for HARQ memory. If not set, it is assumed the filler bits are not
> >  	 *  in HARQ memory and handled directly by the LDPC decoder.
> >  	 */
> > -	RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS = (1ULL <<
> > 18)
> > +	RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS = (1ULL <<
> > 18),
> > +	/** Set if a device supports Big Endian data processing.
> > +	 *  If not set Little Endian data processing is supported by
> > +	 *  default.
> > +	 */
> > +	RTE_BBDEV_LDPC_DEC_BIG_ENDIAN = (1ULL << 8)
> >  };
> >
> >  /** Flags for LDPC encoder operation and capability structure */ @@ -206,7
> > +211,12 @@ enum rte_bbdev_op_ldpcenc_flag_bitmasks {
> >  	/** Set if a device supports scatter-gather functionality. */
> >  	RTE_BBDEV_LDPC_ENC_SCATTER_GATHER = (1ULL << 6),
> >  	/** Set if a device supports concatenation of non byte aligned output
> > */
> > -	RTE_BBDEV_LDPC_ENC_CONCATENATION = (1ULL << 7)
> > +	RTE_BBDEV_LDPC_ENC_CONCATENATION = (1ULL << 7),
> > +	/** Set if a device supports Big Endian data processing
> > +	 *  If not set Little Endian data processing is supported by
> > +	 *  default.
> > +	 */
> > +	RTE_BBDEV_LDPC_ENC_BIG_ENDIAN = (1ULL << 8)
> >  };
> >
> >  /** Flags for the Code Block/Transport block mode  */
> > --
> > 2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v5 5/9] baseband/la12xx: add queue and modem config support
  2021-09-13 18:56     ` Chautru, Nicolas
@ 2021-09-17  8:33       ` Nipun Gupta
  0 siblings, 0 replies; 157+ messages in thread
From: Nipun Gupta @ 2021-09-17  8:33 UTC (permalink / raw)
  To: Chautru, Nicolas, dev, gakhil; +Cc: david.marchand, Hemant Agrawal



> -----Original Message-----
> From: Chautru, Nicolas <nicolas.chautru@intel.com>
> Sent: Tuesday, September 14, 2021 12:26 AM
> To: Nipun Gupta <nipun.gupta@nxp.com>; dev@dpdk.org; gakhil@marvell.com
> Cc: david.marchand@redhat.com; Hemant Agrawal <hemant.agrawal@nxp.com>
> Subject: RE: [PATCH v5 5/9] baseband/la12xx: add queue and modem config
> support
> 
> 
> 
> > -----Original Message-----
> > From: Nipun Gupta <nipun.gupta@nxp.com>
> > Sent: Sunday, September 12, 2021 5:15 AM
> > To: dev@dpdk.org; gakhil@marvell.com; Chautru, Nicolas
> > <nicolas.chautru@intel.com>
> > Cc: david.marchand@redhat.com; hemant.agrawal@nxp.com; Nipun Gupta
> > <nipun.gupta@nxp.com>
> > Subject: [PATCH v5 5/9] baseband/la12xx: add queue and modem config
> > support
> >
> > From: Hemant Agrawal <hemant.agrawal@nxp.com>
> >
> > This patch add support for connecting with modem and creating the ipc
> > channel as queues with modem for the exchange of data.
> >
> > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> > ---
> >  MAINTAINERS                                |   1 +
> >  doc/guides/bbdevs/index.rst                |   1 +
> >  doc/guides/bbdevs/la12xx.rst               |  81 +++
> >  doc/guides/rel_notes/release_21_11.rst     |   5 +
> >  drivers/baseband/la12xx/bbdev_la12xx.c     | 553 ++++++++++++++++++++-
> >  drivers/baseband/la12xx/bbdev_la12xx.h     |  11 +-
> >  drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 189 ++++++-
> >  7 files changed, 831 insertions(+), 10 deletions(-)  create mode 100644
> > doc/guides/bbdevs/la12xx.rst
> >
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index a63e672c9e..2c243c10fe 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -1295,6 +1295,7 @@ NXP LA12xx driver
> >  M: Hemant Agrawal <hemant.agrawal@nxp.com>
> >  M: Nipun Gupta <nipun.gupta@nxp.com>
> >  F: drivers/baseband/la12xx/
> > +F: doc/guides/bbdevs/la12xx.rst
> >
> >
> >  Rawdev Drivers
> > diff --git a/doc/guides/bbdevs/index.rst b/doc/guides/bbdevs/index.rst
> > index 4445cbd1b0..cedd706fa6 100644
> > --- a/doc/guides/bbdevs/index.rst
> > +++ b/doc/guides/bbdevs/index.rst
> > @@ -14,3 +14,4 @@ Baseband Device Drivers
> >      fpga_lte_fec
> >      fpga_5gnr_fec
> >      acc100
> > +    la12xx
> > diff --git a/doc/guides/bbdevs/la12xx.rst b/doc/guides/bbdevs/la12xx.rst
> > new file mode 100644 index 0000000000..3c9ac5c047
> > --- /dev/null
> > +++ b/doc/guides/bbdevs/la12xx.rst
> > @@ -0,0 +1,81 @@
> > +..  SPDX-License-Identifier: BSD-3-Clause
> > +    Copyright 2021 NXP
> > +
> > +NXP LA12xx Poll Mode Driver
> > +=======================================
> > +
> > +The BBDEV LA12xx poll mode driver (PMD) supports an implementation for
> > +offloading High Phy processing functions like LDPC Encode / Decode 5GNR
> > +wireless acceleration function, using PCI based LA12xx Software defined
> > radio.
> > +
> > +More information can be found at `NXP Official Website
> >
> +<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.
> nxp.com%2Fproducts%2Fprocessors-and-microcontrollers%2Farm-
> &amp;data=04%7C01%7Cnipun.gupta%40nxp.com%7C92cc367c64324a156f730
> 8d976e8373d%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C6376715
> 62002990761%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjo
> iV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=4HYKiRKBu
> Y4VkVvN73UKM8ZP13NcBEx81ZbME9LiWhI%3D&amp;reserved=0
> > processors/layerscape-processors/layerscape-access-la1200-programmable-
> > baseband-processor:LA1200>`_.
> > +
> > +Features
> > +--------
> > +
> > +LA12xx PMD supports the following features:
> > +
> > +- Maximum of 8 UL queues
> > +- Maximum of 8 DL queues
> > +- PCIe Gen-3 x8 Interface
> > +- MSI-X
> > +
> > +Installation
> > +------------
> > +
> > +Section 3 of the DPDK manual provides instructions on installing and
> > compiling DPDK.
> > +
> > +DPDK requires hugepages to be configured as detailed in section 2 of the
> > DPDK manual.
> > +
> > +Initialization
> > +--------------
> > +
> > +The device can be listed on the host console with:
> > +
> > +
> > +Use the following lspci command to get the multiple LA12xx processor
> > +ids. The device ID of the LA12xx baseband processor is "1c30".
> > +
> > +.. code-block:: console
> > +
> > +  sudo lspci -nn
> > +
> > +...
> > +0001:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device
> > +[1957:1c30] ( rev 10) ...
> > +0002:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device
> > +[1957:1c30] ( rev 10)
> > +
> > +
> > +Prerequisites
> > +-------------
> > +
> > +Currently supported by DPDK:
> > +
> > +- NXP LA1224 BSP **1.0+**.
> > +- NXP LA1224 PCIe Modem card connected to ARM host.
> > +
> > +- Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to
> > setup the basic DPDK environment.
> > +
> > +* Use dev arg option ``modem=0`` to identify the modem instance for a
> > +given
> > +  device. This is required only if more than 1 modem cards are attached to
> > host.
> > +  this is optional and the default value is 0.
> > +  e.g. ``--vdev=baseband_la12xx,modem=0``
> > +
> > +* Use dev arg option ``max_nb_queues=x`` to specify the maximum
> > number
> > +of queues
> > +  to be used for communication with offload device i.e. modem. default is
> > 16.
> > +  e.g. ``--vdev=baseband_la12xx,max_nb_queues=4``
> > +
> > +Enabling logs
> > +-------------
> > +
> > +For enabling logs, use the following EAL parameter:
> > +
> > +.. code-block:: console
> > +
> > +   ./your_bbdev_application <EAL args> --log-level=la12xx:<level>
> > +
> > +Using ``bb.la12xx`` as log matching criteria, all Baseband PMD logs can
> > +be enabled which are lower than logging ``level``.
> > diff --git a/doc/guides/rel_notes/release_21_11.rst
> > b/doc/guides/rel_notes/release_21_11.rst
> > index 675b573834..a0e0ebbeb8 100644
> > --- a/doc/guides/rel_notes/release_21_11.rst
> > +++ b/doc/guides/rel_notes/release_21_11.rst
> > @@ -62,6 +62,11 @@ New Features
> >    * Added bus-level parsing of the devargs syntax.
> >    * Kept compatibility with the legacy syntax as parsing fallback.
> >
> > +* **Added NXP LA12xx baseband PMD.**
> > +
> > +  * Added a new baseband PMD driver for NXP LA12xx Software defined
> > radio.
> > +  * See the :doc:`../bbdevs/la12xx` for more details.
> > +
> >
> >  Removed Items
> >  -------------
> > diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c
> > b/drivers/baseband/la12xx/bbdev_la12xx.c
> > index f26f3f2a08..57e957a93a 100644
> > --- a/drivers/baseband/la12xx/bbdev_la12xx.c
> > +++ b/drivers/baseband/la12xx/bbdev_la12xx.c
> > @@ -3,6 +3,11 @@
> >   */
> >
> >  #include <string.h>
> > +#include <unistd.h>
> > +#include <fcntl.h>
> > +#include <sys/ioctl.h>
> > +#include <sys/mman.h>
> > +#include <dirent.h>
> >
> >  #include <rte_common.h>
> >  #include <rte_bus_vdev.h>
> > @@ -31,11 +36,550 @@ struct bbdev_la12xx_params {
> >  #define LA12XX_VDEV_MODEM_ID_ARG	"modem"
> >  #define LA12XX_MAX_MODEM 4
> >
> > +#define LA12XX_MAX_CORES	4
> > +#define LA12XX_LDPC_ENC_CORE	0
> > +#define LA12XX_LDPC_DEC_CORE	1
> > +
> > +#define LA12XX_MAX_LDPC_ENC_QUEUES	4
> > +#define LA12XX_MAX_LDPC_DEC_QUEUES	4
> > +
> >  static const char * const bbdev_la12xx_valid_params[] = {
> >  	LA12XX_MAX_NB_QUEUES_ARG,
> >  	LA12XX_VDEV_MODEM_ID_ARG,
> >  };
> >
> > +static const struct rte_bbdev_op_cap bbdev_capabilities[] = {
> > +	{
> > +		.type   = RTE_BBDEV_OP_LDPC_ENC,
> > +		.cap.ldpc_enc = {
> > +			.capability_flags =
> > +					RTE_BBDEV_LDPC_CRC_24A_ATTACH
> 
> Are you sure you genuinely don't support any Ratematching (not a typo)? This is
> LDPC Encoder only? How do you redefine TB mode without deRMing supported,
> ie. what concatenation assumption?

Rate Matcher and de-matcher is supported. Will add it in the next spin.

> 
> > |
> > +
> > 	RTE_BBDEV_LDPC_CRC_24B_ATTACH,
> > +			.num_buffers_src =
> > +
> > 	RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
> > +			.num_buffers_dst =
> > +
> > 	RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
> > +		}
> > +	},
> > +	{
> > +		.type   = RTE_BBDEV_OP_LDPC_DEC,
> > +		.cap.ldpc_dec = {
> > +			.capability_flags =
> > +				RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK |
> > +
> > 	RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK |
> 
> Same comment as above, this is purely decoder?
> From documentation, there was support for MSI-X, still you don't expose that
> capability here?

Ill remove MSI-x capability. It is supported, but not yet implemented.

> 
> 
> > +
> > 	RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP,
> > +			.num_buffers_src =
> > +
> > 	RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
> > +			.num_buffers_hard_out =
> > +
> > 	RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
> > +			.llr_size = 8,
> > +			.llr_decimals = 1,
> > +		}
> > +	},
> > +	RTE_BBDEV_END_OF_CAPABILITIES_LIST()
> > +};
> > +
> > +static struct rte_bbdev_queue_conf default_queue_conf = {
> > +	.queue_size = MAX_CHANNEL_DEPTH,
> > +};
> > +
> > +/* Get device info */
> > +static void
> > +la12xx_info_get(struct rte_bbdev *dev __rte_unused,
> > +		struct rte_bbdev_driver_info *dev_info) {
> > +	PMD_INIT_FUNC_TRACE();
> > +
> > +	dev_info->driver_name = RTE_STR(DRIVER_NAME);
> > +	dev_info->max_num_queues = LA12XX_MAX_QUEUES;
> > +	dev_info->queue_size_lim = MAX_CHANNEL_DEPTH;
> > +	dev_info->hardware_accelerated = true;
> > +	dev_info->max_dl_queue_priority = 0;
> > +	dev_info->max_ul_queue_priority = 0;
> > +	dev_info->default_queue_conf = default_queue_conf;
> > +	dev_info->capabilities = bbdev_capabilities;
> > +	dev_info->cpu_flag_reqs = NULL;
> > +	dev_info->min_alignment = 64;
> > +
> > +	rte_bbdev_log_debug("got device info from %u", dev->data-
> > >dev_id); }
> > +
> > +/* Release queue */
> > +static int
> > +la12xx_queue_release(struct rte_bbdev *dev, uint16_t q_id) {
> > +	RTE_SET_USED(dev);
> > +	RTE_SET_USED(q_id);
> > +
> > +	PMD_INIT_FUNC_TRACE();
> > +
> > +	/* TODO: Implement */
> 
> Why is there a TODO here still? The implementation is not complete in that
> version of the code?

Ill remove this TODO. No queue release is supported.

> 
> 
> > +
> > +	return 0;
> > +}
> > +
> > +#define HUGEPG_OFFSET(A) \
> > +		((uint64_t) ((unsigned long) (A) \
> > +		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
> > +
> > +static int ipc_queue_configure(uint32_t channel_id,
> > +		ipc_t instance, struct bbdev_la12xx_q_priv *q_priv) {
> > +	ipc_userspace_t *ipc_priv = (ipc_userspace_t *)instance;
> > +	ipc_instance_t *ipc_instance = ipc_priv->instance;
> > +	ipc_ch_t *ch;
> > +	void *vaddr;
> > +	uint32_t i = 0;
> > +	uint32_t msg_size = sizeof(struct bbdev_ipc_enqueue_op);
> > +
> > +	PMD_INIT_FUNC_TRACE();
> > +
> > +	rte_bbdev_log_debug("%x %p", ipc_instance->initialized,
> > +		ipc_priv->instance);
> > +	ch = &(ipc_instance->ch_list[channel_id]);
> > +
> > +	rte_bbdev_log_debug("channel: %u, depth: %u, msg size: %u",
> > +		channel_id, q_priv->queue_size, msg_size);
> > +
> > +	/* Start init of channel */
> > +	ch->md.ring_size = rte_cpu_to_be_32(q_priv->queue_size);
> > +	ch->md.pi = 0;
> > +	ch->md.ci = 0;
> > +	ch->md.msg_size = msg_size;
> > +	for (i = 0; i < q_priv->queue_size; i++) {
> > +		vaddr = rte_malloc(NULL, msg_size, RTE_CACHE_LINE_SIZE);
> > +		if (!vaddr)
> > +			return IPC_HOST_BUF_ALLOC_FAIL;
> > +		/* Only offset now */
> > +		ch->bd_h[i].modem_ptr =
> > +			rte_cpu_to_be_32(HUGEPG_OFFSET(vaddr));
> > +		ch->bd_h[i].host_virt_l = lower_32_bits(vaddr);
> > +		ch->bd_h[i].host_virt_h = upper_32_bits(vaddr);
> > +		q_priv->msg_ch_vaddr[i] = vaddr;
> > +		/* Not sure use of this len may be for CRC*/
> > +		ch->bd_h[i].len = 0;
> > +	}
> > +	ch->host_ipc_params =
> > +		rte_cpu_to_be_32(HUGEPG_OFFSET(q_priv-
> > >host_params));
> > +
> > +	rte_bbdev_log_debug("Channel configured");
> > +	return IPC_SUCCESS;
> > +}
> > +
> > +static int
> > +la12xx_e200_queue_setup(struct rte_bbdev *dev,
> > +		struct bbdev_la12xx_q_priv *q_priv)
> > +{
> > +	struct bbdev_la12xx_private *priv = dev->data->dev_private;
> > +	ipc_userspace_t *ipc_priv = priv->ipc_priv;
> > +	struct gul_hif *mhif;
> > +	ipc_metadata_t *ipc_md;
> > +	ipc_ch_t *ch;
> > +	int instance_id = 0, i;
> > +	int ret;
> > +
> > +	PMD_INIT_FUNC_TRACE();
> > +
> > +	switch (q_priv->op_type) {
> > +	case RTE_BBDEV_OP_LDPC_ENC:
> > +		q_priv->la12xx_core_id = LA12XX_LDPC_ENC_CORE;
> > +		break;
> > +	case RTE_BBDEV_OP_LDPC_DEC:
> > +		q_priv->la12xx_core_id = LA12XX_LDPC_DEC_CORE;
> > +		break;
> > +	default:
> > +		rte_bbdev_log(ERR, "Unsupported op type\n");
> > +		return -1;
> > +	}
> > +
> > +	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
> > +	/* offset is from start of PEB */
> > +	ipc_md = (ipc_metadata_t *)((uint64_t)ipc_priv-
> > >peb_start.host_vaddr +
> > +		mhif->ipc_regs.ipc_mdata_offset);
> > +	ch = &ipc_md->instance_list[instance_id].ch_list[q_priv->q_id];
> > +
> > +	if (q_priv->q_id < priv->num_valid_queues) {
> > +		ipc_br_md_t *md = &(ch->md);
> > +
> > +		q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
> > +		q_priv->feca_blk_id_be32 = ch->feca_blk_id;
> > +		q_priv->host_pi = rte_be_to_cpu_32(md->pi);
> > +		q_priv->host_ci = rte_be_to_cpu_32(md->ci);
> > +		q_priv->host_params = (host_ipc_params_t *)
> > +			(rte_be_to_cpu_32(ch->host_ipc_params) +
> > +			((uint64_t)ipc_priv->hugepg_start.host_vaddr));
> > +
> > +		for (i = 0; i < q_priv->queue_size; i++) {
> > +			uint32_t h, l;
> > +
> > +			h = ch->bd_h[i].host_virt_h;
> > +			l = ch->bd_h[i].host_virt_l;
> > +			q_priv->msg_ch_vaddr[i] = (void *)join_32_bits(h, l);
> > +		}
> > +
> > +		rte_bbdev_log(WARNING,
> > +			"Queue [%d] already configured, not configuring
> > again",
> > +			q_priv->q_id);
> > +		return 0;
> > +	}
> > +
> > +	rte_bbdev_log_debug("setting up queue %d", q_priv->q_id);
> > +
> > +	/* Call ipc_configure_channel */
> > +	ret = ipc_queue_configure(q_priv->q_id, ipc_priv, q_priv);
> > +	if (ret) {
> > +		rte_bbdev_log(ERR, "Unable to setup queue (%d) (err=%d)",
> > +		       q_priv->q_id, ret);
> > +		return ret;
> > +	}
> > +
> > +	/* Set queue properties for LA12xx device */
> > +	switch (q_priv->op_type) {
> > +	case RTE_BBDEV_OP_LDPC_ENC:
> > +		if (priv->num_ldpc_enc_queues >=
> > LA12XX_MAX_LDPC_ENC_QUEUES) {
> > +			rte_bbdev_log(ERR,
> > +				"num_ldpc_enc_queues reached max
> > value");
> > +			return -1;
> > +		}
> > +		ch->la12xx_core_id =
> > +			rte_cpu_to_be_32(LA12XX_LDPC_ENC_CORE);
> > +		ch->feca_blk_id = rte_cpu_to_be_32(priv-
> > >num_ldpc_enc_queues++);
> > +		break;
> > +	case RTE_BBDEV_OP_LDPC_DEC:
> > +		if (priv->num_ldpc_dec_queues >=
> > LA12XX_MAX_LDPC_DEC_QUEUES) {
> > +			rte_bbdev_log(ERR,
> > +				"num_ldpc_dec_queues reached max
> > value");
> > +			return -1;
> > +		}
> > +		ch->la12xx_core_id =
> > +			rte_cpu_to_be_32(LA12XX_LDPC_DEC_CORE);
> > +		ch->feca_blk_id = rte_cpu_to_be_32(priv-
> > >num_ldpc_dec_queues++);
> > +		break;
> > +	default:
> > +		rte_bbdev_log(ERR, "Not supported op type\n");
> > +		return -1;
> > +	}
> > +	ch->op_type = rte_cpu_to_be_32(q_priv->op_type);
> > +	ch->depth = rte_cpu_to_be_32(q_priv->queue_size);
> > +
> > +	/* Store queue config here */
> > +	q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
> > +	q_priv->feca_blk_id_be32 = ch->feca_blk_id;
> > +
> > +	return 0;
> > +}
> > +
> > +/* Setup a queue */
> > +static int
> > +la12xx_queue_setup(struct rte_bbdev *dev, uint16_t q_id,
> > +		const struct rte_bbdev_queue_conf *queue_conf) {
> > +	struct bbdev_la12xx_private *priv = dev->data->dev_private;
> > +	struct rte_bbdev_queue_data *q_data;
> > +	struct bbdev_la12xx_q_priv *q_priv;
> > +	int ret;
> > +
> > +	PMD_INIT_FUNC_TRACE();
> > +
> > +	/* Move to setup_queues callback */
> > +	q_data = &dev->data->queues[q_id];
> > +	q_data->queue_private = rte_zmalloc(NULL,
> > +		sizeof(struct bbdev_la12xx_q_priv), 0);
> > +	if (!q_data->queue_private) {
> > +		rte_bbdev_log(ERR, "Memory allocation failed for qpriv");
> > +		return -ENOMEM;
> > +	}
> > +	q_priv = q_data->queue_private;
> > +	q_priv->q_id = q_id;
> > +	q_priv->bbdev_priv = dev->data->dev_private;
> > +	q_priv->queue_size = queue_conf->queue_size;
> > +	q_priv->op_type = queue_conf->op_type;
> > +
> > +	ret = la12xx_e200_queue_setup(dev, q_priv);
> > +	if (ret) {
> > +		rte_bbdev_log(ERR, "e200_queue_setup failed for qid: %d",
> > +				     q_id);
> > +		return ret;
> > +	}
> > +
> > +	/* Store queue config here */
> > +	priv->num_valid_queues++;
> > +
> > +	return 0;
> > +}
> > +
> > +static int
> > +la12xx_start(struct rte_bbdev *dev)
> > +{
> > +	struct bbdev_la12xx_private *priv = dev->data->dev_private;
> > +	ipc_userspace_t *ipc_priv = priv->ipc_priv;
> > +	int ready = 0;
> > +	struct gul_hif *hif_start;
> > +
> > +	PMD_INIT_FUNC_TRACE();
> > +
> > +	hif_start = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
> > +
> > +	/* Set Host Read bit */
> > +	SET_HIF_HOST_RDY(hif_start, HIF_HOST_READY_IPC_APP);
> > +
> > +	/* Now wait for modem ready bit */
> > +	while (!ready)
> > +		ready = CHK_HIF_MOD_RDY(hif_start,
> > HIF_MOD_READY_IPC_APP);
> > +
> > +	return 0;
> > +}
> > +
> > +static const struct rte_bbdev_ops pmd_ops = {
> > +	.info_get = la12xx_info_get,
> > +	.queue_setup = la12xx_queue_setup,
> > +	.queue_release = la12xx_queue_release,
> > +	.start = la12xx_start
> > +};
> > +static struct hugepage_info *
> > +get_hugepage_info(void)
> > +{
> > +	struct hugepage_info *hp_info;
> > +	struct rte_memseg *mseg;
> > +
> > +	PMD_INIT_FUNC_TRACE();
> > +
> > +	/* TODO - find a better way */
> > +	hp_info = rte_malloc(NULL, sizeof(struct hugepage_info), 0);
> > +	if (!hp_info) {
> > +		rte_bbdev_log(ERR, "Unable to allocate on local heap");
> > +		return NULL;
> > +	}
> > +
> > +	mseg = rte_mem_virt2memseg(hp_info, NULL);
> > +	hp_info->vaddr = mseg->addr;
> > +	hp_info->paddr = rte_mem_virt2phy(mseg->addr);
> > +	hp_info->len = mseg->len;
> > +
> > +	return hp_info;
> > +}
> > +
> > +static int open_ipc_dev(int modem_id)
> > +{
> > +	char dev_initials[16], dev_path[PATH_MAX];
> > +	struct dirent *entry;
> > +	int dev_ipc = 0;
> > +	DIR *dir;
> > +
> > +	dir = opendir("/dev/");
> > +	if (!dir) {
> > +		rte_bbdev_log(ERR, "Unable to open /dev/");
> > +		return -1;
> > +	}
> > +
> > +	sprintf(dev_initials, "gulipcgul%d", modem_id);
> > +
> > +	while ((entry = readdir(dir)) != NULL) {
> > +		if (!strncmp(dev_initials, entry->d_name,
> > +		    sizeof(dev_initials) - 1))
> > +			break;
> > +	}
> > +
> > +	if (!entry) {
> > +		rte_bbdev_log(ERR, "Error: No gulipcgul%d device",
> > modem_id);
> > +		return -1;
> > +	}
> > +
> > +	sprintf(dev_path, "/dev/%s", entry->d_name);
> > +	dev_ipc = open(dev_path, O_RDWR);
> > +	if (dev_ipc  < 0) {
> > +		rte_bbdev_log(ERR, "Error: Cannot open %s", dev_path);
> > +		return -errno;
> > +	}
> > +
> > +	return dev_ipc;
> > +}
> > +
> > +static int
> > +setup_la12xx_dev(struct rte_bbdev *dev) {
> > +	struct bbdev_la12xx_private *priv = dev->data->dev_private;
> > +	ipc_userspace_t *ipc_priv = priv->ipc_priv;
> > +	struct hugepage_info *hp = NULL;
> > +	ipc_channel_us_t *ipc_priv_ch = NULL;
> > +	int dev_ipc = 0, dev_mem = 0, i;
> > +	ipc_metadata_t *ipc_md;
> > +	struct gul_hif *mhif;
> > +	uint32_t phy_align = 0;
> > +	int ret;
> > +
> > +	PMD_INIT_FUNC_TRACE();
> > +
> > +	if (!ipc_priv) {
> > +		/* TODO - get a better way */
> > +		/* Get the hugepage info against it */
> > +		hp = get_hugepage_info();
> > +		if (!hp) {
> > +			rte_bbdev_log(ERR, "Unable to get hugepage info");
> > +			ret = -ENOMEM;
> > +			goto err;
> > +		}
> > +
> > +		rte_bbdev_log_debug("%lx %p %lx",
> > +				hp->paddr, hp->vaddr, hp->len);
> > +
> > +		ipc_priv = rte_zmalloc(0, sizeof(ipc_userspace_t), 0);
> > +		if (ipc_priv == NULL) {
> > +			rte_bbdev_log(ERR,
> > +				"Unable to allocate memory for ipc priv");
> > +			ret = -ENOMEM;
> > +			goto err;
> > +		}
> > +
> > +		for (i = 0; i < IPC_MAX_CHANNEL_COUNT; i++) {
> > +			ipc_priv_ch = rte_zmalloc(0,
> > +				sizeof(ipc_channel_us_t), 0);
> > +			if (ipc_priv_ch == NULL) {
> > +				rte_bbdev_log(ERR,
> > +					"Unable to allocate memory for
> > channels");
> > +				ret = -ENOMEM;
> > +			}
> > +			ipc_priv->channels[i] = ipc_priv_ch;
> > +		}
> > +
> > +		dev_mem = open("/dev/mem", O_RDWR);
> > +		if (dev_mem < 0) {
> > +			rte_bbdev_log(ERR, "Error: Cannot open
> > /dev/mem");
> > +			ret = -errno;
> > +			goto err;
> > +		}
> > +
> > +		ipc_priv->instance_id = 0;
> > +		ipc_priv->dev_mem = dev_mem;
> > +
> > +		rte_bbdev_log_debug("hugepg input %lx %p %lx",
> > +			hp->paddr, hp->vaddr, hp->len);
> > +
> > +		ipc_priv->sys_map.hugepg_start.host_phys = hp->paddr;
> > +		ipc_priv->sys_map.hugepg_start.size = hp->len;
> > +
> > +		ipc_priv->hugepg_start.host_phys = hp->paddr;
> > +		ipc_priv->hugepg_start.host_vaddr = hp->vaddr;
> > +		ipc_priv->hugepg_start.size = hp->len;
> > +
> > +		rte_free(hp);
> > +	}
> > +
> > +	dev_ipc = open_ipc_dev(priv->modem_id);
> > +	if (dev_ipc < 0) {
> > +		rte_bbdev_log(ERR, "Error: open_ipc_dev failed");
> > +		goto err;
> > +	}
> > +	ipc_priv->dev_ipc = dev_ipc;
> > +
> > +	ret = ioctl(ipc_priv->dev_ipc, IOCTL_GUL_IPC_GET_SYS_MAP,
> > +		    &ipc_priv->sys_map);
> > +	if (ret) {
> > +		rte_bbdev_log(ERR,
> > +			"IOCTL_GUL_IPC_GET_SYS_MAP ioctl failed");
> > +		goto err;
> > +	}
> > +
> > +	phy_align = (ipc_priv->sys_map.mhif_start.host_phys % 0x1000);
> > +	ipc_priv->mhif_start.host_vaddr =
> > +		mmap(0, ipc_priv->sys_map.mhif_start.size + phy_align,
> > +		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv-
> > >dev_mem,
> > +		     (ipc_priv->sys_map.mhif_start.host_phys - phy_align));
> > +	if (ipc_priv->mhif_start.host_vaddr == MAP_FAILED) {
> > +		rte_bbdev_log(ERR, "MAP failed:");
> > +		ret = -errno;
> > +		goto err;
> > +	}
> > +
> > +	ipc_priv->mhif_start.host_vaddr = (void *) ((uint64_t)
> > +		(ipc_priv->mhif_start.host_vaddr) + phy_align);
> > +
> > +	phy_align = (ipc_priv->sys_map.peb_start.host_phys % 0x1000);
> > +	ipc_priv->peb_start.host_vaddr =
> > +		mmap(0, ipc_priv->sys_map.peb_start.size + phy_align,
> > +		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv-
> > >dev_mem,
> > +		     (ipc_priv->sys_map.peb_start.host_phys - phy_align));
> > +	if (ipc_priv->peb_start.host_vaddr == MAP_FAILED) {
> > +		rte_bbdev_log(ERR, "MAP failed:");
> > +		ret = -errno;
> > +		goto err;
> > +	}
> > +
> > +	ipc_priv->peb_start.host_vaddr = (void *)((uint64_t)
> > +		(ipc_priv->peb_start.host_vaddr) + phy_align);
> > +
> > +	phy_align = (ipc_priv->sys_map.modem_ccsrbar.host_phys %
> > 0x1000);
> > +	ipc_priv->modem_ccsrbar.host_vaddr =
> > +		mmap(0, ipc_priv->sys_map.modem_ccsrbar.size +
> > phy_align,
> > +		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv-
> > >dev_mem,
> > +		     (ipc_priv->sys_map.modem_ccsrbar.host_phys -
> > phy_align));
> > +	if (ipc_priv->modem_ccsrbar.host_vaddr == MAP_FAILED) {
> > +		rte_bbdev_log(ERR, "MAP failed:");
> > +		ret = -errno;
> > +		goto err;
> > +	}
> > +
> > +	ipc_priv->modem_ccsrbar.host_vaddr = (void *)((uint64_t)
> > +		(ipc_priv->modem_ccsrbar.host_vaddr) + phy_align);
> > +
> > +	ipc_priv->hugepg_start.modem_phys =
> > +		ipc_priv->sys_map.hugepg_start.modem_phys;
> > +
> > +	ipc_priv->mhif_start.host_phys =
> > +		ipc_priv->sys_map.mhif_start.host_phys;
> > +	ipc_priv->mhif_start.size = ipc_priv->sys_map.mhif_start.size;
> > +	ipc_priv->peb_start.host_phys = ipc_priv-
> > >sys_map.peb_start.host_phys;
> > +	ipc_priv->peb_start.size = ipc_priv->sys_map.peb_start.size;
> > +
> > +	rte_bbdev_log(INFO, "peb %lx %p %x",
> > +			ipc_priv->peb_start.host_phys,
> > +			ipc_priv->peb_start.host_vaddr,
> > +			ipc_priv->peb_start.size);
> > +	rte_bbdev_log(INFO, "hugepg %lx %p %x",
> > +			ipc_priv->hugepg_start.host_phys,
> > +			ipc_priv->hugepg_start.host_vaddr,
> > +			ipc_priv->hugepg_start.size);
> > +	rte_bbdev_log(INFO, "mhif %lx %p %x",
> > +			ipc_priv->mhif_start.host_phys,
> > +			ipc_priv->mhif_start.host_vaddr,
> > +			ipc_priv->mhif_start.size);
> > +	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
> > +
> > +	/* offset is from start of PEB */
> > +	ipc_md = (ipc_metadata_t *)((uint64_t)ipc_priv-
> > >peb_start.host_vaddr +
> > +			mhif->ipc_regs.ipc_mdata_offset);
> > +
> > +	if (sizeof(ipc_metadata_t) != mhif->ipc_regs.ipc_mdata_size) {
> > +		rte_bbdev_log(ERR,
> > +			"ipc_metadata_t =%lx, mhif-
> > >ipc_regs.ipc_mdata_size=%x",
> > +			sizeof(ipc_metadata_t), mhif-
> > >ipc_regs.ipc_mdata_size);
> > +		rte_bbdev_log(ERR, "--> mhif->ipc_regs.ipc_mdata_offset=
> > %x",
> > +			mhif->ipc_regs.ipc_mdata_offset);
> > +		rte_bbdev_log(ERR, "gul_hif size=%lx", sizeof(struct
> > gul_hif));
> > +		return IPC_MD_SZ_MISS_MATCH;
> > +	}
> > +
> > +	ipc_priv->instance = (ipc_instance_t *)
> > +		(&ipc_md->instance_list[ipc_priv->instance_id]);
> > +
> > +	rte_bbdev_log_debug("finish host init");
> > +
> > +	priv->ipc_priv = ipc_priv;
> > +
> > +	return 0;
> > +
> > +err:
> > +	rte_free(hp);
> > +	rte_free(ipc_priv);
> > +	rte_free(ipc_priv_ch);
> > +	if (dev_mem)
> > +		close(dev_mem);
> > +	if (dev_ipc)
> > +		close(dev_ipc);
> > +
> > +	return ret;
> > +}
> > +
> >  static inline int
> >  parse_u16_arg(const char *key, const char *value, void *extra_args)  { @@ -
> > 123,6 +667,7 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
> >  	struct rte_bbdev *bbdev;
> >  	const char *name = rte_vdev_device_name(vdev);
> >  	struct bbdev_la12xx_private *priv;
> > +	int ret;
> >
> >  	PMD_INIT_FUNC_TRACE();
> >
> > @@ -152,7 +697,13 @@ la12xx_bbdev_create(struct rte_vdev_device
> > *vdev,
> >
> >  	rte_bbdev_log(INFO, "Setting Up %s: DevId=%d, ModemId=%d",
> >  				name, bbdev->data->dev_id, priv-
> > >modem_id);
> > -	bbdev->dev_ops = NULL;
> > +	ret = setup_la12xx_dev(bbdev);
> > +	if (ret) {
> > +		rte_bbdev_log(ERR, "IPC Setup failed for %s", name);
> > +		rte_free(bbdev->data->dev_private);
> > +		return ret;
> > +	}
> > +	bbdev->dev_ops = &pmd_ops;
> >  	bbdev->device = &vdev->device;
> >  	bbdev->data->socket_id = 0;
> >  	bbdev->intr_handle = NULL;
> > diff --git a/drivers/baseband/la12xx/bbdev_la12xx.h
> > b/drivers/baseband/la12xx/bbdev_la12xx.h
> > index 5228502331..49c37fe2fe 100644
> > --- a/drivers/baseband/la12xx/bbdev_la12xx.h
> > +++ b/drivers/baseband/la12xx/bbdev_la12xx.h
> > @@ -5,16 +5,10 @@
> >  #ifndef __BBDEV_LA12XX_H__
> >  #define __BBDEV_LA12XX_H__
> >
> > -#define BBDEV_IPC_ENC_OP_TYPE	1
> > -#define BBDEV_IPC_DEC_OP_TYPE	2
> > -
> > -#define MAX_LDPC_ENC_FECA_QUEUES	4
> > -#define MAX_LDPC_DEC_FECA_QUEUES	4
> > -
> >  #define MAX_CHANNEL_DEPTH 16
> >  /* private data structure */
> >  struct bbdev_la12xx_private {
> > -	void *ipc_priv;
> > +	ipc_userspace_t *ipc_priv;
> >  	uint8_t num_valid_queues;
> >  	uint8_t max_nb_queues;
> >  	uint8_t num_ldpc_enc_queues;
> > @@ -52,5 +46,6 @@ struct bbdev_la12xx_q_priv {
> >
> >  #define lower_32_bits(x) ((uint32_t)((uint64_t)x))  #define
> > upper_32_bits(x) ((uint32_t)(((uint64_t)(x) >> 16) >> 16))
> > -
> > +#define join_32_bits(upper, lower) \
> > +	((size_t)(((uint64_t)(upper) << 32) | (uint32_t)(lower)))
> >  #endif
> > diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> > b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> > index 9aa5562981..5f613fb087 100644
> > --- a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> > +++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> > @@ -4,9 +4,182 @@
> >  #ifndef __BBDEV_LA12XX_IPC_H__
> >  #define __BBDEV_LA12XX_IPC_H__
> >
> > +#define LA12XX_MAX_QUEUES 20
> > +#define HOST_RX_QUEUEID_OFFSET LA12XX_MAX_QUEUES
> > +
> > +/** No. of max channel per instance */
> > +#define IPC_MAX_CHANNEL_COUNT	(64)
> > +
> >  /** No. of max channel per instance */
> >  #define IPC_MAX_DEPTH	(16)
> >
> > +/** No. of max IPC instance per modem */
> > +#define IPC_MAX_INSTANCE_COUNT	(1)
> > +
> > +/** Error codes */
> > +#define IPC_SUCCESS		(0) /** IPC operation success */
> 
> Cosmetic, but such comments are expected to be as /**< IPC operation success
> */

Okay

> 
> > +#define IPC_INPUT_INVALID	(-1) /** Invalid input to API */
> > +#define IPC_CH_INVALID		(-2) /** Channel no is invalid */
> > +#define IPC_INSTANCE_INVALID	(-3) /** Instance no is invalid */
> > +#define IPC_MEM_INVALID		(-4) /** Insufficient memory */
> > +#define IPC_CH_FULL		(-5) /** Channel is full */
> > +#define IPC_CH_EMPTY		(-6) /** Channel is empty */
> > +#define IPC_BL_EMPTY		(-7) /** Free buffer list is empty */
> > +#define IPC_BL_FULL		(-8) /** Free buffer list is full */
> > +#define IPC_HOST_BUF_ALLOC_FAIL	(-9) /** DPDK malloc fail */
> > +#define IPC_MD_SZ_MISS_MATCH	(-10) /** META DATA size in mhif
> > miss matched*/
> > +#define IPC_MALLOC_FAIL		(-11) /** system malloc fail */
> > +#define IPC_IOCTL_FAIL		(-12) /** IOCTL call failed */
> > +#define IPC_MMAP_FAIL		(-14) /** MMAP fail */
> > +#define IPC_OPEN_FAIL		(-15) /** OPEN fail */
> > +#define IPC_EVENTFD_FAIL	(-16) /** eventfd initialization failed */
> > +#define IPC_NOT_IMPLEMENTED	(-17) /** IPC feature is not
> > implemented yet*/
> > +
> > +#define SET_HIF_HOST_RDY(hif, RDY_MASK) (hif->host_ready |=
> > RDY_MASK)
> > +#define CHK_HIF_MOD_RDY(hif, RDY_MASK) (hif->mod_ready &
> > RDY_MASK)
> > +
> > +/* Host Ready bits */
> > +#define HIF_HOST_READY_HOST_REGIONS	(1 << 0)
> > +#define HIF_HOST_READY_IPC_LIB		(1 << 12)
> > +#define HIF_HOST_READY_IPC_APP		(1 << 13)
> > +#define HIF_HOST_READY_FECA		(1 << 14)
> > +
> > +/* Modem Ready bits */
> > +#define HIF_MOD_READY_IPC_LIB		(1 << 5)
> > +#define HIF_MOD_READY_IPC_APP		(1 << 6)
> > +#define HIF_MOD_READY_FECA		(1 << 7)
> > +
> > +typedef void *ipc_t;
> > +
> > +struct ipc_msg {
> > +	int chid;
> > +	void *addr;
> > +	uint32_t len;
> > +	uint8_t flags;
> > +};
> > +
> > +typedef struct {
> > +	uint64_t host_phys;
> > +	uint32_t modem_phys;
> > +	void    *host_vaddr;
> > +	uint32_t size;
> > +} mem_range_t;
> > +
> > +#define GUL_IPC_MAGIC	'R'
> > +
> > +#define IOCTL_GUL_IPC_GET_SYS_MAP _IOW(GUL_IPC_MAGIC, 1, struct
> > ipc_msg
> > +*) #define IOCTL_GUL_IPC_CHANNEL_REGISTER _IOWR(GUL_IPC_MAGIC,
> > 4,
> > +struct ipc_msg *) #define IOCTL_GUL_IPC_CHANNEL_DEREGISTER \
> > +	_IOWR(GUL_IPC_MAGIC, 5, struct ipc_msg *) #define
> > +IOCTL_GUL_IPC_CHANNEL_RAISE_INTERRUPT _IOW(GUL_IPC_MAGIC, 6,
> > int *)
> > +
> > +/** buffer ring common metadata */
> > +typedef struct ipc_bd_ring_md {
> > +	volatile uint32_t pi;		/**< Producer index and flag (MSB)
> > +					  *  which flip for each Ring wrapping
> > +					  */
> > +	volatile uint32_t ci;		/**< Consumer index and flag (MSB)
> > +					  *  which flip for each Ring wrapping
> > +					  */
> > +	uint32_t ring_size;	/**< depth (Used to roll-over pi/ci) */
> > +	uint32_t msg_size;	/**< Size of the each buffer */
> > +} __rte_packed ipc_br_md_t;
> > +
> > +/** IPC buffer descriptor */
> > +typedef struct ipc_buffer_desc {
> > +	union {
> > +		uint64_t host_virt;	/**< msg's host virtual address */
> > +		struct {
> > +			uint32_t host_virt_l;
> > +			uint32_t host_virt_h;
> > +		};
> > +	};
> > +	uint32_t modem_ptr;	/**< msg's modem physical address */
> > +	uint32_t len;		/**< msg len */
> > +} __rte_packed ipc_bd_t;
> > +
> > +typedef struct ipc_channel {
> > +	uint32_t ch_id;		/**< Channel id */
> > +	ipc_br_md_t md;			/**< Metadata for BD ring */
> > +	ipc_bd_t bd_h[IPC_MAX_DEPTH];	/**< Buffer Descriptor on
> > Host */
> > +	ipc_bd_t bd_m[IPC_MAX_DEPTH];	/**< Buffer Descriptor on
> > Modem */
> > +	uint32_t op_type;		/**< Type of the BBDEV operation
> > +					  * supported on this channel
> > +					  */
> > +	uint32_t depth;			/**< Channel depth */
> > +	uint32_t feca_blk_id;	/**< FECA Transport Block ID for processing
> > */
> > +	uint32_t la12xx_core_id;/**< LA12xx core ID on which this will be
> > +				  * scheduled
> > +				  */
> > +	uint32_t feca_input_circ_size;	/**< FECA transport block input
> > +					  * circular buffer size
> > +					  */
> > +	uint32_t host_ipc_params;	/**< Address for host IPC
> > parameters */
> > +} __rte_packed ipc_ch_t;
> > +
> > +typedef struct ipc_instance {
> > +	uint32_t instance_id;		/**< instance id, use to init this
> > +					  * instance by ipc_init API
> > +					  */
> > +	uint32_t initialized;		/**< Set in ipc_init */
> > +	ipc_ch_t ch_list[IPC_MAX_CHANNEL_COUNT];
> > +		/**< Channel descriptors in this instance */ } __rte_packed
> > +ipc_instance_t;
> > +
> > +typedef struct ipc_metadata {
> > +	uint32_t ipc_host_signature; /**< IPC host signature, Set by host/L2
> > */
> > +	uint32_t ipc_geul_signature; /**< IPC geul signature, Set by modem
> > */
> > +	ipc_instance_t instance_list[IPC_MAX_INSTANCE_COUNT];
> > +} __rte_packed ipc_metadata_t;
> > +
> > +typedef struct ipc_channel_us_priv {
> > +	int32_t		eventfd;
> > +	uint32_t	channel_id;
> > +	/* In flight packets status for buffer list. */
> > +	uint8_t		bufs_inflight[IPC_MAX_DEPTH];
> > +} ipc_channel_us_t;
> > +
> > +typedef struct {
> > +	uint64_t host_phys;
> > +	uint32_t modem_phys;
> > +	uint32_t size;
> > +} mem_strt_addr_t;
> > +
> > +typedef struct {
> > +	mem_strt_addr_t modem_ccsrbar;
> > +	mem_strt_addr_t peb_start; /* PEB meta data */
> > +	mem_strt_addr_t mhif_start; /* MHIF meta daat */
> > +	mem_strt_addr_t hugepg_start; /* Modem to access hugepage */ }
> > +sys_map_t;
> > +
> > +typedef struct ipc_priv_t {
> > +	int instance_id;
> > +	int dev_ipc;
> > +	int dev_mem;
> > +	sys_map_t sys_map;
> > +	mem_range_t modem_ccsrbar;
> > +	mem_range_t peb_start;
> > +	mem_range_t mhif_start;
> > +	mem_range_t hugepg_start;
> > +	ipc_channel_us_t *channels[IPC_MAX_CHANNEL_COUNT];
> > +	ipc_instance_t	*instance;
> > +	ipc_instance_t	*instance_bk;
> > +} ipc_userspace_t;
> > +
> > +/** Structure specifying enqueue operation (enqueue at LA1224) */
> > +struct bbdev_ipc_enqueue_op {
> > +	/** Status of operation that was performed */
> > +	int32_t status;
> > +	/** CRC Status of SD operation that was performed */
> > +	int32_t crc_stat_addr;
> > +	/** HARQ Output buffer memory length for Shared Decode.
> > +	 * Filled by LA12xx.
> > +	 */
> > +	uint32_t out_len;
> > +	/** Reserved (for 8 byte alignment) */
> > +	uint32_t rsvd;
> > +};
> > +
> >  /* This shared memory would be on the host side which have copy of some
> >   * of the parameters which are also part of Shared BD ring. Read access
> >   * of these parameters from the host side would not be over PCI.
> > @@ -14,7 +187,21 @@
> >  typedef struct host_ipc_params {
> >  	volatile uint32_t pi;
> >  	volatile uint32_t ci;
> > -	volatile uint32_t modem_ptr[IPC_MAX_DEPTH];
> > +	volatile uint32_t bd_m_modem_ptr[IPC_MAX_DEPTH];
> >  } __rte_packed host_ipc_params_t;
> >
> > +struct hif_ipc_regs {
> > +	uint32_t ipc_mdata_offset;
> > +	uint32_t ipc_mdata_size;
> > +} __rte_packed;
> > +
> > +struct gul_hif {
> > +	uint32_t ver;
> > +	uint32_t hif_ver;
> > +	uint32_t status;
> > +	volatile uint32_t host_ready;
> > +	volatile uint32_t mod_ready;
> > +	struct hif_ipc_regs ipc_regs;
> > +} __rte_packed;
> > +
> >  #endif
> > --
> > 2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v5 9/9] app/bbdev: add test vectors for transport blocks
  2021-09-13 19:01     ` Chautru, Nicolas
@ 2021-09-17  8:37       ` Nipun Gupta
  2021-09-17 14:20         ` Chautru, Nicolas
  0 siblings, 1 reply; 157+ messages in thread
From: Nipun Gupta @ 2021-09-17  8:37 UTC (permalink / raw)
  To: Chautru, Nicolas, dev, gakhil; +Cc: david.marchand, Hemant Agrawal



> -----Original Message-----
> From: Chautru, Nicolas <nicolas.chautru@intel.com>
> Sent: Tuesday, September 14, 2021 12:32 AM
> To: Nipun Gupta <nipun.gupta@nxp.com>; dev@dpdk.org; gakhil@marvell.com
> Cc: david.marchand@redhat.com; Hemant Agrawal <hemant.agrawal@nxp.com>
> Subject: RE: [PATCH v5 9/9] app/bbdev: add test vectors for transport blocks
> 
> 
> 
> > -----Original Message-----
> > From: Nipun Gupta <nipun.gupta@nxp.com>
> > Sent: Sunday, September 12, 2021 5:15 AM
> > To: dev@dpdk.org; gakhil@marvell.com; Chautru, Nicolas
> > <nicolas.chautru@intel.com>
> > Cc: david.marchand@redhat.com; hemant.agrawal@nxp.com; Nipun Gupta
> > <nipun.gupta@nxp.com>
> > Subject: [PATCH v5 9/9] app/bbdev: add test vectors for transport blocks
> >
> > This patch adds two test vectors for transport block in network byte
> > order:
> > - LDPC encode for Transport Block
> > - LDPC decode for Transport block
> 
> See comments on previous patchsets related to the same topic:
>  - This test vector includes Ratematching hence previous pmd exposed capability
> were not correct

It is supported in our driver, I will add it in the capabilities.

> - This is really is a single CB vector (not a TB made of multiple CBs). More
> generally I don't believe there is new functionality here compared to existing
> vectors. (keep in mind that the endianness can be managed as a device
> capability and would not require new vectors).

I agree, it is a single CB, otherwise the test vector file becomes large.
But all the TB parameters are supported, which is not the case with the previous
tests.

I prefer to add a bigger test vector with multiple CBs. But then I hear that file
size is a problem. I don't think it should be a problem. Let me respin with a larger
size TB.

> 
> Thanks
> Nic
> 
> >
> > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > ---
> >  app/test-bbdev/test_vectors/ldpc_dec_tb.data | 122
> > +++++++++++++++++++  app/test-bbdev/test_vectors/ldpc_enc_tb.data |
> > 60 +++++++++
> >  2 files changed, 182 insertions(+)
> >  create mode 100644 app/test-bbdev/test_vectors/ldpc_dec_tb.data
> >  create mode 100644 app/test-bbdev/test_vectors/ldpc_enc_tb.data
> >
> > diff --git a/app/test-bbdev/test_vectors/ldpc_dec_tb.data b/app/test-
> > bbdev/test_vectors/ldpc_dec_tb.data
> > new file mode 100644
> > index 0000000000..b991e8f305
> > --- /dev/null
> > +++ b/app/test-bbdev/test_vectors/ldpc_dec_tb.data
> > @@ -0,0 +1,122 @@
> > +# SPDX-License-Identifier: BSD-3-Clause # Copyright 2020 NXP
> > +
> > +op_type =
> > +RTE_BBDEV_OP_LDPC_DEC
> > +
> > +input0 =
> > +0x817f8181, 0x7f7f8181, 0x817f7f81, 0x81817f81, 0x81817f81, 0x817f7f81,
> > +0x7f7f7f7f, 0x7f7f7f81, 0x817f7f81, 0x817f7f81, 0x7f7f817f, 0x7f7f7f81,
> > +0x81817f7f, 0x81818181, 0x817f8181, 0x7f817f81, 0x81817f7f, 0x7f7f817f,
> > +0x81817f81, 0x817f8181, 0x7f7f7f81, 0x817f817f, 0x7f817f7f, 0x7f817f7f,
> > +0x7f817f7f, 0x81817f7f, 0x7f818181, 0x817f7f7f, 0x8181817f, 0x81817f7f,
> > +0x7f817f81, 0x7f7f7f7f, 0x7f817f7f, 0x81817f7f, 0x81818181, 0x817f817f,
> > +0x81817f7f, 0x7f81817f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f818181, 0x7f7f7f81,
> > +0x81817f81, 0x7f817f7f, 0x7f7f7f7f, 0x817f817f, 0x817f817f, 0x7f7f817f,
> > +0x81817f81, 0x7f7f7f7f, 0x7f81817f, 0x817f817f, 0x7f7f8181, 0x7f7f7f7f,
> > +0x817f7f7f, 0x81818181, 0x817f8181, 0x7f7f817f, 0x7f7f8181, 0x7f7f7f7f,
> > +0x7f818181, 0x817f8181, 0x817f7f81, 0x817f8181, 0x817f7f81, 0x81817f7f,
> > +0x7f7f8181, 0x81818181, 0x817f817f, 0x817f7f7f, 0x81818181, 0x7f817f81,
> > +0x7f7f7f81, 0x81817f81, 0x7f817f7f, 0x7f818181, 0x7f7f7f81, 0x817f817f,
> > +0x81818181, 0x81818181, 0x81817f81, 0x81817f81, 0x7f7f8181, 0x817f7f7f,
> > +0x7f81817f, 0x817f817f, 0x81817f7f, 0x817f7f81, 0x81817f7f, 0x7f7f7f81,
> > +0x7f817f81, 0x7f817f81, 0x817f7f7f, 0x7f818181, 0x81818181, 0x7f7f7f7f,
> > +0x7f7f7f7f, 0x8181817f, 0x7f7f7f81, 0x7f817f81, 0x81817f81, 0x7f7f817f,
> > +0x7f81817f, 0x817f8181, 0x7f81817f, 0x7f81817f, 0x817f7f7f, 0x7f81817f,
> > +0x817f7f81, 0x817f7f81, 0x7f817f7f, 0x8181817f, 0x7f81817f, 0x7f7f8181,
> > +0x817f8181, 0x817f7f7f, 0x817f7f81, 0x7f81817f, 0x7f7f817f, 0x7f817f7f,
> > +0x7f7f8181, 0x81818181, 0x7f818181, 0x7f7f817f, 0x7f818181, 0x81818181,
> > +0x7f817f7f, 0x817f817f, 0x817f817f, 0x817f7f7f, 0x81817f81, 0x81817f7f,
> > +0x81817f81, 0x7f817f81, 0x7f817f7f, 0x7f817f7f, 0x817f7f7f, 0x817f7f7f,
> > +0x7f7f7f7f, 0x7f7f7f81, 0x7f7f8181, 0x7f817f81, 0x7f817f7f, 0x817f7f7f,
> > +0x7f7f8181, 0x8181817f, 0x7f7f8181, 0x7f7f7f81, 0x817f7f7f, 0x7f7f7f81,
> > +0x817f8181, 0x7f7f817f, 0x7f81817f, 0x817f817f, 0x7f817f81, 0x7f7f8181,
> > +0x7f818181, 0x7f817f81, 0x81818181, 0x81817f7f, 0x7f81817f, 0x7f81817f,
> > +0x7f7f8181, 0x81818181, 0x817f8181, 0x7f7f817f, 0x7f817f7f, 0x7f7f8181,
> > +0x7f81817f, 0x7f7f817f, 0x7f7f7f7f, 0x7f818181, 0x81817f7f, 0x8181817f,
> > +0x7f81817f, 0x8181817f, 0x81817f81, 0x7f7f7f7f, 0x81818181, 0x7f7f817f,
> > +0x7f81817f, 0x7f7f7f7f, 0x81817f81, 0x817f7f81, 0x817f7f81, 0x817f7f81,
> > +0x81818181, 0x7f7f7f7f, 0x81817f81, 0x817f7f7f, 0x8181817f, 0x7f7f7f81,
> > +0x81817f81, 0x817f7f81, 0x81818181, 0x7f7f7f7f, 0x81817f7f, 0x81817f81,
> > +0x7f7f7f81, 0x7f7f7f7f, 0x817f817f, 0x7f818181, 0x8181817f, 0x81817f81,
> > +0x7f7f7f81, 0x7f817f7f, 0x7f7f7f7f, 0x7f817f81, 0x8181817f, 0x7f7f7f7f,
> > +0x81817f7f, 0x7f7f7f81, 0x7f81817f, 0x7f7f7f7f, 0x7f7f7f81, 0x817f8181,
> > +0x7f7f8181, 0x7f7f7f81, 0x7f7f8181, 0x7f817f7f, 0x81818181, 0x7f81817f,
> > +0x7f818181, 0x7f818181, 0x7f818181, 0x817f7f81, 0x7f7f8181, 0x81818181,
> > +0x7f7f7f7f, 0x7f7f7f7f, 0x817f8181, 0x81818181, 0x7f7f817f, 0x817f8181,
> > +0x81817f7f, 0x817f817f, 0x7f7f817f, 0x7f7f7f7f, 0x817f8181, 0x817f8181,
> > +0x817f8181, 0x81818181, 0x7f7f817f, 0x7f817f81, 0x817f7f81, 0x7f7f7f81,
> > +0x81817f81, 0x7f818181, 0x81817f7f, 0x7f818181, 0x81818181, 0x817f817f,
> > +0x7f817f7f, 0x81818181, 0x817f8181, 0x7f7f7f7f, 0x7f817f81, 0x817f7f7f,
> > +0x7f818181, 0x8181817f, 0x817f817f, 0x7f817f7f, 0x817f7f81, 0x7f818181,
> > +0x817f7f7f, 0x817f7f81, 0x7f7f7f81, 0x81817f81, 0x7f81817f, 0x7f818181,
> > +0x81817f7f, 0x817f7f81, 0x81817f81, 0x7f7f8181, 0x7f7f8181, 0x7f817f81,
> > +0x7f7f817f, 0x817f7f7f, 0x7f7f7f7f, 0x817f7f7f, 0x7f7f8181, 0x817f8181,
> > +0x817f8181, 0x7f817f81, 0x817f8181, 0x8181817f, 0x81817f7f, 0x7f817f7f,
> > +0x7f817f7f, 0x7f817f81, 0x817f817f, 0x817f7f7f, 0x8181817f, 0x817f817f,
> > +0x817f7f81, 0x81817f7f, 0x7f817f7f, 0x7f7f7f7f, 0x7f817f7f, 0x7f7f817f,
> > +0x7f818181, 0x8181817f, 0x817f7f7f, 0x7f817f81, 0x7f7f8181, 0x81817f7f,
> > +0x7f7f817f, 0x7f7f817f, 0x7f817f7f, 0x7f7f817f, 0x7f818181, 0x7f817f7f,
> > +0x817f7f7f, 0x7f817f81, 0x81818181, 0x7f818181, 0x817f8181, 0x8181817f,
> > +0x8181817f, 0x817f7f7f, 0x81817f81, 0x817f7f7f, 0x7f81817f, 0x817f8181,
> > +0x7f818181, 0x7f817f7f, 0x81817f7f, 0x7f81817f, 0x81817f81, 0x7f7f7f81,
> > +0x7f7f7f7f, 0x81818181, 0x817f7f7f, 0x81817f81, 0x817f7f81, 0x81817f7f,
> > +0x81818181, 0x7f7f7f7f, 0x817f817f, 0x7f817f81, 0x817f7f7f, 0x7f817f81,
> > +0x817f8181, 0x7f81817f, 0x7f818181, 0x7f7f8181, 0x817f817f, 0x7f7f7f7f,
> > +0x81818181, 0x7f817f81, 0x81817f81, 0x7f81817f, 0x81818181, 0x7f7f817f,
> > +0x81818181, 0x7f7f7f81, 0x817f7f81, 0x8181817f, 0x7f818181, 0x7f7f7f7f,
> > +0x7f7f7f7f, 0x8181817f, 0x81817f81, 0x81818181, 0x7f7f817f, 0x81817f7f,
> > +0x7f817f81, 0x817f8181, 0x81817f7f, 0x7f817f7f, 0x817f7f7f, 0x7f81817f,
> > +0x817f7f7f, 0x7f7f7f7f, 0x7f7f8181, 0x7f7f8181, 0x7f81817f, 0x7f7f8181,
> > +0x7f7f8181, 0x817f7f81, 0x8181817f, 0x81817f7f, 0x817f8181, 0x817f817f,
> > +0x8181817f, 0x7f7f8181, 0x7f81817f, 0x817f817f, 0x7f817f81, 0x7f817f7f,
> > +0x7f7f8181, 0x81818181, 0x7f817f81, 0x7f7f8181, 0x81817f7f, 0x7f7f7f81,
> > +0x7f7f7f81, 0x7f7f7f7f, 0x7f81817f, 0x7f7f8181, 0x7f7f817f, 0x817f817f,
> > +0x7f7f7f7f, 0x817f8181, 0x7f818181, 0x7f7f817f, 0x8181817f, 0x8181817f,
> > +0x817f7f81, 0x8181817f, 0x817f8181, 0x7f817f7f, 0x81817f7f, 0x81818181,
> > +0x7f7f8181, 0x7f817f81, 0x817f8181, 0x7f817f7f, 0x81818181, 0x81817f81,
> > +0x7f817f81, 0x81817f7f, 0x7f818181, 0x8181817f, 0x7f7f7f81, 0x7f81817f,
> > +0x7f7f8181, 0x81818181, 0x81817f7f, 0x817f8181, 0x81817f7f, 0x7f7f817f,
> > +0x81818181, 0x7f7f8181, 0x7f7f817f, 0x817f817f, 0x7f817f81, 0x7f7f7f7f,
> > +0x7f817f81, 0x7f817f7f, 0x7f81817f, 0x7f7f8181, 0x7f7f817f, 0x81818181,
> > +0x7f7f8181, 0x817f7f81, 0x81817f81, 0x81817f7f, 0x81817f81, 0x81818181,
> > +0x7f817f81, 0x7f7f7f7f, 0x81817f7f, 0x7f817f7f, 0x7f7f817f, 0x81817f7f,
> > +0x81817f7f, 0x7f7f7f7f, 0x817f7f7f, 0x7f817f81, 0x81818181, 0x81817f7f,
> > +0x7f817f7f, 0x8181817f, 0x7f81817f, 0x817f7f81, 0x7f817f7f, 0x7f7f7f7f,
> > +0x817f7f81, 0x7f817f81, 0x81818181, 0x81817f81, 0x7f817f81, 0x81818181,
> > +0x81818181, 0x8181817f, 0x7f7f817f, 0x817f7f7f, 0x817f7f7f, 0x7f7f7f7f,
> > +0x81818181, 0x7f817f7f, 0x817f7f81, 0x7f7f8181, 0x817f8181, 0x81817f7f,
> > +0x81817f7f, 0x817f7f7f, 0x817f817f, 0x7f818181, 0x7f817f7f, 0x817f8181,
> > +0x7f817f7f, 0x817f8181, 0x7f7f817f, 0x81817f7f, 0x8181817f, 0x7f817f81,
> > +0x7f7f7f81, 0x81818181, 0x7f7f7f81, 0x81818181, 0x7f7f817f, 0x817f7f7f,
> > +0x817f817f, 0x7f7f8181, 0x7f7f7f81, 0x7f817f7f, 0x817f8181, 0x817f817f,
> > +0x81818181, 0x81817f7f
> > +
> > +output0 =
> > +0xea7bdad9, 0xabd8311a, 0x4e7ba2e2, 0x5c5c5c85, 0xc400ed50,
> > 0x9bea8883,
> > +0xb7f0
> > +
> > +basegraph=
> > +2
> > +
> > +z_c=
> > +28
> > +
> > +n_cb=
> > +1400
> > +
> > +q_m=
> > +2
> > +
> > +n_filler=
> > +56
> > +
> > +ea =
> > +2048
> > +
> > +eb =
> > +2048
> > +
> > +iter_max=
> > +8
> > +
> > +expected_iter_count=
> > +2
> > +
> > +c =
> > +1
> > +
> > +r =
> > +0
> > +
> > +cab =
> > +0
> > +
> > +rv_index =
> > +0
> > +
> > +code_block_mode =
> > +0
> > +
> > +op_flags =
> > +RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP,
> > RTE_BBDEV_LDPC_DEC_BIG_ENDIAN
> > +
> > +expected_status =
> > +OK
> > diff --git a/app/test-bbdev/test_vectors/ldpc_enc_tb.data b/app/test-
> > bbdev/test_vectors/ldpc_enc_tb.data
> > new file mode 100644
> > index 0000000000..277db673c8
> > --- /dev/null
> > +++ b/app/test-bbdev/test_vectors/ldpc_enc_tb.data
> > @@ -0,0 +1,60 @@
> > +# SPDX-License-Identifier: BSD-3-Clause # Copyright 2020 NXP
> > +
> > +op_type =
> > +RTE_BBDEV_OP_LDPC_ENC
> > +
> > +input0 =
> > +0xea7bdad9, 0xabd8311a, 0x4e7ba2e2, 0x5c5c5c85, 0xc400ed50,
> > 0x9bea8883,
> > +0xb7f0
> > +
> > +output0 =
> > +0x109dd93b, 0x5bfc1299, 0x44a1bd2c, 0x05ce87c4, 0x006cafc4,
> 0x2aa04d17,
> > +0xf803a60d, 0xb9b7032b, 0x5f8af3c9, 0xffa174d1, 0x9ca683dd, 0x0f78551c,
> > +0xb62d51e0, 0xe4996866, 0x42698b36, 0xa4f727f3, 0x445dcd8a,
> 0x84531088,
> > +0x2b1813e3, 0xcf5735a6, 0x342bf366, 0xe6ec7026, 0x9d062f0d, 0x1e8d0f99,
> > +0x01dc0f9d, 0x5041de7a, 0xb1061c0e, 0x776f4313, 0xfb00f397, 0xbb02acb2,
> > +0x7d1952fb, 0x0bf4af7c, 0x794ae785, 0x9c76d198, 0x8082533d,
> 0x4ceb5bb3,
> > +0xc9ae8a54, 0x58e72404, 0x472422c3, 0x8eeb7f58, 0x6c47b68d,
> 0xc9d8f01d,
> > +0x6b585a0f, 0x6d5f0a37, 0x07e91f2f, 0xb5c2fde0, 0x3308684c, 0xabce9336,
> > +0xf345a63e, 0x36011c35, 0xee27b0a2, 0x53fc4be9, 0xe7c5df4b, 0x2cbcf361,
> > +0x4505a23f, 0xcd93f236, 0xc24c05fd, 0xe4cf580c, 0xdf590496, 0x0882eff5,
> > +0x8ccb394f, 0xc2b4b47a, 0x82f1f15e, 0xcfab413a
> > +
> > +basegraph=
> > +2
> > +
> > +z_c=
> > +28
> > +
> > +n_cb=
> > +1400
> > +
> > +q_m=
> > +2
> > +
> > +n_filler=
> > +56
> > +
> > +ea =
> > +2048
> > +
> > +eb =
> > +2048
> > +
> > +c =
> > +1
> > +
> > +r =
> > +0
> > +
> > +cab =
> > +0
> > +
> > +rv_index =
> > +0
> > +
> > +code_block_mode =
> > +0
> > +
> > +op_flags =
> > +RTE_BBDEV_LDPC_CRC_24B_ATTACH,
> > RTE_BBDEV_LDPC_ENC_BIG_ENDIAN
> > +
> > +expected_status =
> > +OK
> > --
> > 2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v5 9/9] app/bbdev: add test vectors for transport blocks
  2021-09-17  8:37       ` Nipun Gupta
@ 2021-09-17 14:20         ` Chautru, Nicolas
  0 siblings, 0 replies; 157+ messages in thread
From: Chautru, Nicolas @ 2021-09-17 14:20 UTC (permalink / raw)
  To: Nipun Gupta, dev, gakhil; +Cc: david.marchand, Hemant Agrawal



> -----Original Message-----
> From: Nipun Gupta <nipun.gupta@nxp.com>
> Sent: Friday, September 17, 2021 1:38 AM
> To: Chautru, Nicolas <nicolas.chautru@intel.com>; dev@dpdk.org;
> gakhil@marvell.com
> Cc: david.marchand@redhat.com; Hemant Agrawal
> <hemant.agrawal@nxp.com>
> Subject: RE: [PATCH v5 9/9] app/bbdev: add test vectors for transport blocks
> 
> 
> 
> > -----Original Message-----
> > From: Chautru, Nicolas <nicolas.chautru@intel.com>
> > Sent: Tuesday, September 14, 2021 12:32 AM
> > To: Nipun Gupta <nipun.gupta@nxp.com>; dev@dpdk.org;
> > gakhil@marvell.com
> > Cc: david.marchand@redhat.com; Hemant Agrawal
> <hemant.agrawal@nxp.com>
> > Subject: RE: [PATCH v5 9/9] app/bbdev: add test vectors for transport
> > blocks
> >
> >
> >
> > > -----Original Message-----
> > > From: Nipun Gupta <nipun.gupta@nxp.com>
> > > Sent: Sunday, September 12, 2021 5:15 AM
> > > To: dev@dpdk.org; gakhil@marvell.com; Chautru, Nicolas
> > > <nicolas.chautru@intel.com>
> > > Cc: david.marchand@redhat.com; hemant.agrawal@nxp.com; Nipun
> Gupta
> > > <nipun.gupta@nxp.com>
> > > Subject: [PATCH v5 9/9] app/bbdev: add test vectors for transport
> > > blocks
> > >
> > > This patch adds two test vectors for transport block in network byte
> > > order:
> > > - LDPC encode for Transport Block
> > > - LDPC decode for Transport block
> >
> > See comments on previous patchsets related to the same topic:
> >  - This test vector includes Ratematching hence previous pmd exposed
> > capability were not correct
> 
> It is supported in our driver, I will add it in the capabilities.
> 
> > - This is really is a single CB vector (not a TB made of multiple
> > CBs). More generally I don't believe there is new functionality here
> > compared to existing vectors. (keep in mind that the endianness can be
> > managed as a device capability and would not require new vectors).
> 
> I agree, it is a single CB, otherwise the test vector file becomes large.
> But all the TB parameters are supported, which is not the case with the
> previous tests.
> 
> I prefer to add a bigger test vector with multiple CBs. But then I hear that file
> size is a problem. I don't think it should be a problem. Let me respin with a
> larger size TB.

What is the problem with existing vectors? Given the endianness would be managed in the test application, existing vectors should just pass for your PMD.
Any reason we would actually need new vectors? If you really have to do, I would suggest low number of CBs (ie. 2 maybe). 


> 
> >
> > Thanks
> > Nic
> >
> > >
> > > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > > ---
> > >  app/test-bbdev/test_vectors/ldpc_dec_tb.data | 122
> > > +++++++++++++++++++  app/test-bbdev/test_vectors/ldpc_enc_tb.data |
> > > 60 +++++++++
> > >  2 files changed, 182 insertions(+)
> > >  create mode 100644 app/test-bbdev/test_vectors/ldpc_dec_tb.data
> > >  create mode 100644 app/test-bbdev/test_vectors/ldpc_enc_tb.data
> > >
> > > diff --git a/app/test-bbdev/test_vectors/ldpc_dec_tb.data
> > > b/app/test- bbdev/test_vectors/ldpc_dec_tb.data
> > > new file mode 100644
> > > index 0000000000..b991e8f305
> > > --- /dev/null
> > > +++ b/app/test-bbdev/test_vectors/ldpc_dec_tb.data
> > > @@ -0,0 +1,122 @@
> > > +# SPDX-License-Identifier: BSD-3-Clause # Copyright 2020 NXP
> > > +
> > > +op_type =
> > > +RTE_BBDEV_OP_LDPC_DEC
> > > +
> > > +input0 =
> > > +0x817f8181, 0x7f7f8181, 0x817f7f81, 0x81817f81, 0x81817f81,
> > > +0x817f7f81, 0x7f7f7f7f, 0x7f7f7f81, 0x817f7f81, 0x817f7f81,
> > > +0x7f7f817f, 0x7f7f7f81, 0x81817f7f, 0x81818181, 0x817f8181,
> > > +0x7f817f81, 0x81817f7f, 0x7f7f817f, 0x81817f81, 0x817f8181,
> > > +0x7f7f7f81, 0x817f817f, 0x7f817f7f, 0x7f817f7f, 0x7f817f7f,
> > > +0x81817f7f, 0x7f818181, 0x817f7f7f, 0x8181817f, 0x81817f7f,
> > > +0x7f817f81, 0x7f7f7f7f, 0x7f817f7f, 0x81817f7f, 0x81818181,
> > > +0x817f817f, 0x81817f7f, 0x7f81817f, 0x7f7f7f7f, 0x7f7f7f7f,
> > > +0x7f818181, 0x7f7f7f81, 0x81817f81, 0x7f817f7f, 0x7f7f7f7f,
> > > +0x817f817f, 0x817f817f, 0x7f7f817f, 0x81817f81, 0x7f7f7f7f,
> > > +0x7f81817f, 0x817f817f, 0x7f7f8181, 0x7f7f7f7f, 0x817f7f7f,
> > > +0x81818181, 0x817f8181, 0x7f7f817f, 0x7f7f8181, 0x7f7f7f7f,
> > > +0x7f818181, 0x817f8181, 0x817f7f81, 0x817f8181, 0x817f7f81,
> > > +0x81817f7f, 0x7f7f8181, 0x81818181, 0x817f817f, 0x817f7f7f,
> > > +0x81818181, 0x7f817f81, 0x7f7f7f81, 0x81817f81, 0x7f817f7f,
> > > +0x7f818181, 0x7f7f7f81, 0x817f817f, 0x81818181, 0x81818181,
> > > +0x81817f81, 0x81817f81, 0x7f7f8181, 0x817f7f7f, 0x7f81817f,
> > > +0x817f817f, 0x81817f7f, 0x817f7f81, 0x81817f7f, 0x7f7f7f81,
> > > +0x7f817f81, 0x7f817f81, 0x817f7f7f, 0x7f818181, 0x81818181,
> > > +0x7f7f7f7f, 0x7f7f7f7f, 0x8181817f, 0x7f7f7f81, 0x7f817f81,
> > > +0x81817f81, 0x7f7f817f, 0x7f81817f, 0x817f8181, 0x7f81817f,
> > > +0x7f81817f, 0x817f7f7f, 0x7f81817f, 0x817f7f81, 0x817f7f81,
> > > +0x7f817f7f, 0x8181817f, 0x7f81817f, 0x7f7f8181, 0x817f8181,
> > > +0x817f7f7f, 0x817f7f81, 0x7f81817f, 0x7f7f817f, 0x7f817f7f,
> > > +0x7f7f8181, 0x81818181, 0x7f818181, 0x7f7f817f, 0x7f818181,
> > > +0x81818181, 0x7f817f7f, 0x817f817f, 0x817f817f, 0x817f7f7f,
> > > +0x81817f81, 0x81817f7f, 0x81817f81, 0x7f817f81, 0x7f817f7f,
> > > +0x7f817f7f, 0x817f7f7f, 0x817f7f7f, 0x7f7f7f7f, 0x7f7f7f81,
> > > +0x7f7f8181, 0x7f817f81, 0x7f817f7f, 0x817f7f7f, 0x7f7f8181,
> > > +0x8181817f, 0x7f7f8181, 0x7f7f7f81, 0x817f7f7f, 0x7f7f7f81,
> > > +0x817f8181, 0x7f7f817f, 0x7f81817f, 0x817f817f, 0x7f817f81,
> > > +0x7f7f8181, 0x7f818181, 0x7f817f81, 0x81818181, 0x81817f7f,
> > > +0x7f81817f, 0x7f81817f, 0x7f7f8181, 0x81818181, 0x817f8181,
> > > +0x7f7f817f, 0x7f817f7f, 0x7f7f8181, 0x7f81817f, 0x7f7f817f,
> > > +0x7f7f7f7f, 0x7f818181, 0x81817f7f, 0x8181817f, 0x7f81817f,
> > > +0x8181817f, 0x81817f81, 0x7f7f7f7f, 0x81818181, 0x7f7f817f,
> > > +0x7f81817f, 0x7f7f7f7f, 0x81817f81, 0x817f7f81, 0x817f7f81,
> > > +0x817f7f81, 0x81818181, 0x7f7f7f7f, 0x81817f81, 0x817f7f7f,
> > > +0x8181817f, 0x7f7f7f81, 0x81817f81, 0x817f7f81, 0x81818181,
> > > +0x7f7f7f7f, 0x81817f7f, 0x81817f81, 0x7f7f7f81, 0x7f7f7f7f,
> > > +0x817f817f, 0x7f818181, 0x8181817f, 0x81817f81, 0x7f7f7f81,
> > > +0x7f817f7f, 0x7f7f7f7f, 0x7f817f81, 0x8181817f, 0x7f7f7f7f,
> > > +0x81817f7f, 0x7f7f7f81, 0x7f81817f, 0x7f7f7f7f, 0x7f7f7f81,
> > > +0x817f8181, 0x7f7f8181, 0x7f7f7f81, 0x7f7f8181, 0x7f817f7f,
> > > +0x81818181, 0x7f81817f, 0x7f818181, 0x7f818181, 0x7f818181,
> > > +0x817f7f81, 0x7f7f8181, 0x81818181, 0x7f7f7f7f, 0x7f7f7f7f,
> > > +0x817f8181, 0x81818181, 0x7f7f817f, 0x817f8181, 0x81817f7f,
> > > +0x817f817f, 0x7f7f817f, 0x7f7f7f7f, 0x817f8181, 0x817f8181,
> > > +0x817f8181, 0x81818181, 0x7f7f817f, 0x7f817f81, 0x817f7f81,
> > > +0x7f7f7f81, 0x81817f81, 0x7f818181, 0x81817f7f, 0x7f818181,
> > > +0x81818181, 0x817f817f, 0x7f817f7f, 0x81818181, 0x817f8181,
> > > +0x7f7f7f7f, 0x7f817f81, 0x817f7f7f, 0x7f818181, 0x8181817f,
> > > +0x817f817f, 0x7f817f7f, 0x817f7f81, 0x7f818181, 0x817f7f7f,
> > > +0x817f7f81, 0x7f7f7f81, 0x81817f81, 0x7f81817f, 0x7f818181,
> > > +0x81817f7f, 0x817f7f81, 0x81817f81, 0x7f7f8181, 0x7f7f8181,
> > > +0x7f817f81, 0x7f7f817f, 0x817f7f7f, 0x7f7f7f7f, 0x817f7f7f,
> > > +0x7f7f8181, 0x817f8181, 0x817f8181, 0x7f817f81, 0x817f8181,
> > > +0x8181817f, 0x81817f7f, 0x7f817f7f, 0x7f817f7f, 0x7f817f81,
> > > +0x817f817f, 0x817f7f7f, 0x8181817f, 0x817f817f, 0x817f7f81,
> > > +0x81817f7f, 0x7f817f7f, 0x7f7f7f7f, 0x7f817f7f, 0x7f7f817f,
> > > +0x7f818181, 0x8181817f, 0x817f7f7f, 0x7f817f81, 0x7f7f8181,
> > > +0x81817f7f, 0x7f7f817f, 0x7f7f817f, 0x7f817f7f, 0x7f7f817f,
> > > +0x7f818181, 0x7f817f7f, 0x817f7f7f, 0x7f817f81, 0x81818181,
> > > +0x7f818181, 0x817f8181, 0x8181817f, 0x8181817f, 0x817f7f7f,
> > > +0x81817f81, 0x817f7f7f, 0x7f81817f, 0x817f8181, 0x7f818181,
> > > +0x7f817f7f, 0x81817f7f, 0x7f81817f, 0x81817f81, 0x7f7f7f81,
> > > +0x7f7f7f7f, 0x81818181, 0x817f7f7f, 0x81817f81, 0x817f7f81,
> > > +0x81817f7f, 0x81818181, 0x7f7f7f7f, 0x817f817f, 0x7f817f81,
> > > +0x817f7f7f, 0x7f817f81, 0x817f8181, 0x7f81817f, 0x7f818181,
> > > +0x7f7f8181, 0x817f817f, 0x7f7f7f7f, 0x81818181, 0x7f817f81,
> > > +0x81817f81, 0x7f81817f, 0x81818181, 0x7f7f817f, 0x81818181,
> > > +0x7f7f7f81, 0x817f7f81, 0x8181817f, 0x7f818181, 0x7f7f7f7f,
> > > +0x7f7f7f7f, 0x8181817f, 0x81817f81, 0x81818181, 0x7f7f817f,
> > > +0x81817f7f, 0x7f817f81, 0x817f8181, 0x81817f7f, 0x7f817f7f,
> > > +0x817f7f7f, 0x7f81817f, 0x817f7f7f, 0x7f7f7f7f, 0x7f7f8181,
> > > +0x7f7f8181, 0x7f81817f, 0x7f7f8181, 0x7f7f8181, 0x817f7f81,
> > > +0x8181817f, 0x81817f7f, 0x817f8181, 0x817f817f, 0x8181817f,
> > > +0x7f7f8181, 0x7f81817f, 0x817f817f, 0x7f817f81, 0x7f817f7f,
> > > +0x7f7f8181, 0x81818181, 0x7f817f81, 0x7f7f8181, 0x81817f7f,
> > > +0x7f7f7f81, 0x7f7f7f81, 0x7f7f7f7f, 0x7f81817f, 0x7f7f8181,
> > > +0x7f7f817f, 0x817f817f, 0x7f7f7f7f, 0x817f8181, 0x7f818181,
> > > +0x7f7f817f, 0x8181817f, 0x8181817f, 0x817f7f81, 0x8181817f,
> > > +0x817f8181, 0x7f817f7f, 0x81817f7f, 0x81818181, 0x7f7f8181,
> > > +0x7f817f81, 0x817f8181, 0x7f817f7f, 0x81818181, 0x81817f81,
> > > +0x7f817f81, 0x81817f7f, 0x7f818181, 0x8181817f, 0x7f7f7f81,
> > > +0x7f81817f, 0x7f7f8181, 0x81818181, 0x81817f7f, 0x817f8181,
> > > +0x81817f7f, 0x7f7f817f, 0x81818181, 0x7f7f8181, 0x7f7f817f,
> > > +0x817f817f, 0x7f817f81, 0x7f7f7f7f, 0x7f817f81, 0x7f817f7f,
> > > +0x7f81817f, 0x7f7f8181, 0x7f7f817f, 0x81818181, 0x7f7f8181,
> > > +0x817f7f81, 0x81817f81, 0x81817f7f, 0x81817f81, 0x81818181,
> > > +0x7f817f81, 0x7f7f7f7f, 0x81817f7f, 0x7f817f7f, 0x7f7f817f,
> > > +0x81817f7f, 0x81817f7f, 0x7f7f7f7f, 0x817f7f7f, 0x7f817f81,
> > > +0x81818181, 0x81817f7f, 0x7f817f7f, 0x8181817f, 0x7f81817f,
> > > +0x817f7f81, 0x7f817f7f, 0x7f7f7f7f, 0x817f7f81, 0x7f817f81,
> > > +0x81818181, 0x81817f81, 0x7f817f81, 0x81818181, 0x81818181,
> > > +0x8181817f, 0x7f7f817f, 0x817f7f7f, 0x817f7f7f, 0x7f7f7f7f,
> > > +0x81818181, 0x7f817f7f, 0x817f7f81, 0x7f7f8181, 0x817f8181,
> > > +0x81817f7f, 0x81817f7f, 0x817f7f7f, 0x817f817f, 0x7f818181,
> > > +0x7f817f7f, 0x817f8181, 0x7f817f7f, 0x817f8181, 0x7f7f817f,
> > > +0x81817f7f, 0x8181817f, 0x7f817f81, 0x7f7f7f81, 0x81818181,
> > > +0x7f7f7f81, 0x81818181, 0x7f7f817f, 0x817f7f7f, 0x817f817f,
> > > +0x7f7f8181, 0x7f7f7f81, 0x7f817f7f, 0x817f8181, 0x817f817f,
> > > +0x81818181, 0x81817f7f
> > > +
> > > +output0 =
> > > +0xea7bdad9, 0xabd8311a, 0x4e7ba2e2, 0x5c5c5c85, 0xc400ed50,
> > > 0x9bea8883,
> > > +0xb7f0
> > > +
> > > +basegraph=
> > > +2
> > > +
> > > +z_c=
> > > +28
> > > +
> > > +n_cb=
> > > +1400
> > > +
> > > +q_m=
> > > +2
> > > +
> > > +n_filler=
> > > +56
> > > +
> > > +ea =
> > > +2048
> > > +
> > > +eb =
> > > +2048
> > > +
> > > +iter_max=
> > > +8
> > > +
> > > +expected_iter_count=
> > > +2
> > > +
> > > +c =
> > > +1
> > > +
> > > +r =
> > > +0
> > > +
> > > +cab =
> > > +0
> > > +
> > > +rv_index =
> > > +0
> > > +
> > > +code_block_mode =
> > > +0
> > > +
> > > +op_flags =
> > > +RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP,
> > > RTE_BBDEV_LDPC_DEC_BIG_ENDIAN
> > > +
> > > +expected_status =
> > > +OK
> > > diff --git a/app/test-bbdev/test_vectors/ldpc_enc_tb.data
> > > b/app/test- bbdev/test_vectors/ldpc_enc_tb.data
> > > new file mode 100644
> > > index 0000000000..277db673c8
> > > --- /dev/null
> > > +++ b/app/test-bbdev/test_vectors/ldpc_enc_tb.data
> > > @@ -0,0 +1,60 @@
> > > +# SPDX-License-Identifier: BSD-3-Clause # Copyright 2020 NXP
> > > +
> > > +op_type =
> > > +RTE_BBDEV_OP_LDPC_ENC
> > > +
> > > +input0 =
> > > +0xea7bdad9, 0xabd8311a, 0x4e7ba2e2, 0x5c5c5c85, 0xc400ed50,
> > > 0x9bea8883,
> > > +0xb7f0
> > > +
> > > +output0 =
> > > +0x109dd93b, 0x5bfc1299, 0x44a1bd2c, 0x05ce87c4, 0x006cafc4,
> > 0x2aa04d17,
> > > +0xf803a60d, 0xb9b7032b, 0x5f8af3c9, 0xffa174d1, 0x9ca683dd,
> > > +0x0f78551c, 0xb62d51e0, 0xe4996866, 0x42698b36, 0xa4f727f3,
> > > +0x445dcd8a,
> > 0x84531088,
> > > +0x2b1813e3, 0xcf5735a6, 0x342bf366, 0xe6ec7026, 0x9d062f0d,
> > > +0x1e8d0f99, 0x01dc0f9d, 0x5041de7a, 0xb1061c0e, 0x776f4313,
> > > +0xfb00f397, 0xbb02acb2, 0x7d1952fb, 0x0bf4af7c, 0x794ae785,
> > > +0x9c76d198, 0x8082533d,
> > 0x4ceb5bb3,
> > > +0xc9ae8a54, 0x58e72404, 0x472422c3, 0x8eeb7f58, 0x6c47b68d,
> > 0xc9d8f01d,
> > > +0x6b585a0f, 0x6d5f0a37, 0x07e91f2f, 0xb5c2fde0, 0x3308684c,
> > > +0xabce9336, 0xf345a63e, 0x36011c35, 0xee27b0a2, 0x53fc4be9,
> > > +0xe7c5df4b, 0x2cbcf361, 0x4505a23f, 0xcd93f236, 0xc24c05fd,
> > > +0xe4cf580c, 0xdf590496, 0x0882eff5, 0x8ccb394f, 0xc2b4b47a,
> > > +0x82f1f15e, 0xcfab413a
> > > +
> > > +basegraph=
> > > +2
> > > +
> > > +z_c=
> > > +28
> > > +
> > > +n_cb=
> > > +1400
> > > +
> > > +q_m=
> > > +2
> > > +
> > > +n_filler=
> > > +56
> > > +
> > > +ea =
> > > +2048
> > > +
> > > +eb =
> > > +2048
> > > +
> > > +c =
> > > +1
> > > +
> > > +r =
> > > +0
> > > +
> > > +cab =
> > > +0
> > > +
> > > +rv_index =
> > > +0
> > > +
> > > +code_block_mode =
> > > +0
> > > +
> > > +op_flags =
> > > +RTE_BBDEV_LDPC_CRC_24B_ATTACH,
> > > RTE_BBDEV_LDPC_ENC_BIG_ENDIAN
> > > +
> > > +expected_status =
> > > +OK
> > > --
> > > 2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v5 1/9] bbdev: add big endian processing data capability
  2021-09-17  8:30       ` Nipun Gupta
@ 2021-09-17 14:23         ` Chautru, Nicolas
  0 siblings, 0 replies; 157+ messages in thread
From: Chautru, Nicolas @ 2021-09-17 14:23 UTC (permalink / raw)
  To: Nipun Gupta, dev, gakhil; +Cc: david.marchand, Hemant Agrawal, Tom Rix



> -----Original Message-----
> From: Nipun Gupta <nipun.gupta@nxp.com>
> Sent: Friday, September 17, 2021 1:30 AM
> To: Chautru, Nicolas <nicolas.chautru@intel.com>; dev@dpdk.org;
> gakhil@marvell.com
> Cc: david.marchand@redhat.com; Hemant Agrawal
> <hemant.agrawal@nxp.com>; Tom Rix <trix@redhat.com>
> Subject: RE: [PATCH v5 1/9] bbdev: add big endian processing data capability
> 
> 
> 
> > -----Original Message-----
> > From: Chautru, Nicolas <nicolas.chautru@intel.com>
> > Sent: Tuesday, September 14, 2021 12:10 AM
> > To: Nipun Gupta <nipun.gupta@nxp.com>; dev@dpdk.org;
> > gakhil@marvell.com
> > Cc: david.marchand@redhat.com; Hemant Agrawal
> > <hemant.agrawal@nxp.com>; Tom Rix <trix@redhat.com>
> > Subject: RE: [PATCH v5 1/9] bbdev: add big endian processing data
> > capability
> >
> >
> >
> > > -----Original Message-----
> > > From: Nipun Gupta <nipun.gupta@nxp.com>
> > > Sent: Sunday, September 12, 2021 5:15 AM
> > > To: dev@dpdk.org; gakhil@marvell.com; Chautru, Nicolas
> > > <nicolas.chautru@intel.com>
> > > Cc: david.marchand@redhat.com; hemant.agrawal@nxp.com; Nipun
> Gupta
> > > <nipun.gupta@nxp.com>
> > > Subject: [PATCH v5 1/9] bbdev: add big endian processing data
> > > capability
> > >
> > > This patch intoduces a new capability of the bbdev device to process
> > > the LDPC data in big endian order.
> >
> > Hi Gupta,
> >
> > As mentioned in previous patch iteration earlier this year I believe
> > this is not really an operation flag but more a different device capability.
> > ie. you would have the same formalism for all operation (5GDL, 5GUL,
> > 4GDL, ...) for that PMD/hw and that is not something you will change
> > dynamically as an option.
> > I would suggest to add this under "struct rte_bbdev_driver_info" which
> > can be used to capture device specific capability and information. In
> > term of processing and operation, everything is the same except
> > endianness assumption for the input/output data.
> 
> Okay, it can be done this way. Then it would be assumption of the driver,
> that the operation is in the format as per the driver info. Ill change it in
> respin.

Yes the fact that the capability is exposed out means that this is the responsibility of the application to provide input data in that format (ie. similar as for llr numerical representation).
The endianness switch can be done in bbdev-test so that all existing vectors can be run seamlessly even on your PMD (ie. different endianness than the default one so far).

> 
> >
> >
> > >
> > > Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> > > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > > ---
> > >  doc/guides/bbdevs/features/default.ini |  1 +
> > >  doc/guides/prog_guide/bbdev.rst        |  6 ++++++
> > >  lib/bbdev/rte_bbdev_op.h               | 14 ++++++++++++--
> > >  3 files changed, 19 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/doc/guides/bbdevs/features/default.ini
> > > b/doc/guides/bbdevs/features/default.ini
> > > index 5fe267a625..ae5aacf8f7 100644
> > > --- a/doc/guides/bbdevs/features/default.ini
> > > +++ b/doc/guides/bbdevs/features/default.ini
> > > @@ -14,3 +14,4 @@ LLR/HARQ Compression   =
> > >  External DDR Access    =
> > >  HW Accelerated         =
> > >  BBDEV API              =
> > > +Big Endian Processing  =
> > > diff --git a/doc/guides/prog_guide/bbdev.rst
> > > b/doc/guides/prog_guide/bbdev.rst index 9619280ffc..6540b514bb
> > > 100644
> > > --- a/doc/guides/prog_guide/bbdev.rst
> > > +++ b/doc/guides/prog_guide/bbdev.rst
> > > @@ -747,6 +747,9 @@ given below.
> > >  |RTE_BBDEV_LDPC_ENC_CONCATENATION                                    |
> > >  | Set if a device supports concatenation of non byte aligned output
> > > |  +------
> > > --------------------------------------------------------------+
> > > +|RTE_BBDEV_LDPC_ENC_BIG_ENDIAN                                       |
> > > +| Set if a device supports Big Endian data processing                |
> > > ++--------------------------------------------------------------------+
> > >
> > >  The structure passed for each LDPC encode operation is given below,
> > > with the operation flags forming a bitmask in the ``op_flags`` field.
> > > @@ -942,6 +945,9 @@ given below.
> > >  |RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_LOOPBACK
> |
> > >  | Set if a device supports loopback access to HARQ internal memory   |
> > >
> > > +-------------------------------------------------------------------
> > > -+
> > > +|RTE_BBDEV_LDPC_DEC_BIG_ENDIAN                                       |
> > > +| Set if a device supports Big Endian data processing                |
> > > ++--------------------------------------------------------------------+
> > >
> > >  The structure passed for each LDPC decode operation is given below,
> > > with the operation flags forming a bitmask in the ``op_flags`` field.
> > > diff --git a/lib/bbdev/rte_bbdev_op.h b/lib/bbdev/rte_bbdev_op.h
> > > index f946842727..9e9b5be81f 100644
> > > --- a/lib/bbdev/rte_bbdev_op.h
> > > +++ b/lib/bbdev/rte_bbdev_op.h
> > > @@ -186,7 +186,12 @@ enum rte_bbdev_op_ldpcdec_flag_bitmasks {
> > >  	 *  for HARQ memory. If not set, it is assumed the filler bits are not
> > >  	 *  in HARQ memory and handled directly by the LDPC decoder.
> > >  	 */
> > > -	RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS = (1ULL <<
> > > 18)
> > > +	RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS = (1ULL <<
> > > 18),
> > > +	/** Set if a device supports Big Endian data processing.
> > > +	 *  If not set Little Endian data processing is supported by
> > > +	 *  default.
> > > +	 */
> > > +	RTE_BBDEV_LDPC_DEC_BIG_ENDIAN = (1ULL << 8)
> > >  };
> > >
> > >  /** Flags for LDPC encoder operation and capability structure */ @@
> > > -206,7
> > > +211,12 @@ enum rte_bbdev_op_ldpcenc_flag_bitmasks {
> > >  	/** Set if a device supports scatter-gather functionality. */
> > >  	RTE_BBDEV_LDPC_ENC_SCATTER_GATHER = (1ULL << 6),
> > >  	/** Set if a device supports concatenation of non byte aligned
> > > output */
> > > -	RTE_BBDEV_LDPC_ENC_CONCATENATION = (1ULL << 7)
> > > +	RTE_BBDEV_LDPC_ENC_CONCATENATION = (1ULL << 7),
> > > +	/** Set if a device supports Big Endian data processing
> > > +	 *  If not set Little Endian data processing is supported by
> > > +	 *  default.
> > > +	 */
> > > +	RTE_BBDEV_LDPC_ENC_BIG_ENDIAN = (1ULL << 8)
> > >  };
> > >
> > >  /** Flags for the Code Block/Transport block mode  */
> > > --
> > > 2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v6 0/9] baseband: add NXP LA12xx driver
  2021-03-18  6:34 [dpdk-dev] [PATCH 1/6] baseband: introduce NXP LA12xx driver Hemant Agrawal
                   ` (7 preceding siblings ...)
  2021-09-12 12:15 ` [dpdk-dev] [PATCH v5 0/9] " Nipun Gupta
@ 2021-09-24  4:37 ` nipun.gupta
  2021-09-24  4:37   ` [dpdk-dev] [PATCH v6 1/9] bbdev: add big endian processing data processing info nipun.gupta
                     ` (8 more replies)
  2021-09-28  8:29 ` [dpdk-dev] [PATCH v7 0/9] baseband: add NXP LA12xx driver nipun.gupta
                   ` (4 subsequent siblings)
  13 siblings, 9 replies; 157+ messages in thread
From: nipun.gupta @ 2021-09-24  4:37 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal

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

This series introduces the BBDEV LA12xx poll mode driver (PMD) to support
an implementation for offloading High Phy processing functions like
LDPC Encode / Decode 5GNR wireless acceleration function, using PCI based
LA12xx Software defined radio.

Please check the documentation patch for more info.

The driver currently implements basic feature to offload only the 5G LDPC
encode/decode.

A new capability has been added to check if the driver can support the
input data in network byte order. Two test vectors are also added as an
example with input data in network byte.

v2: add test case changes
v3: fix 32 bit compilation
v4: capability for network byte order, doc patch merged inline.
v5: add llr_size and llr_decimals, removed LLR compression flag,
    update testbbdev to handle endianness, rebased on top of 20.08
v6: added BE as device info instead of capability, updated test
    to have 2 codeblocks

Hemant Agrawal (6):
  baseband: introduce NXP LA12xx driver
  baseband/la12xx: add devargs for max queues
  baseband/la12xx: add support for multiple modems
  baseband/la12xx: add queue and modem config support
  baseband/la12xx: add enqueue and dequeue support
  app/bbdev: enable la12xx for bbdev

Nipun Gupta (3):
  bbdev: add big endian processing data processing info
  app/bbdev: handle endianness of test data
  app/bbdev: add test vectors for transport blocks

 MAINTAINERS                                   |   10 +
 app/test-bbdev/meson.build                    |    3 +
 app/test-bbdev/test_bbdev_perf.c              |   62 +
 app/test-bbdev/test_vectors/ldpc_dec_tb.data  |  265 ++++
 app/test-bbdev/test_vectors/ldpc_enc_tb.data  |   95 ++
 doc/guides/bbdevs/features/la12xx.ini         |   13 +
 doc/guides/bbdevs/index.rst                   |    1 +
 doc/guides/bbdevs/la12xx.rst                  |  126 ++
 doc/guides/rel_notes/release_21_11.rst        |    5 +
 drivers/baseband/la12xx/bbdev_la12xx.c        | 1098 +++++++++++++++++
 drivers/baseband/la12xx/bbdev_la12xx.h        |   51 +
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h    |  244 ++++
 .../baseband/la12xx/bbdev_la12xx_pmd_logs.h   |   26 +
 drivers/baseband/la12xx/meson.build           |    6 +
 drivers/baseband/la12xx/version.map           |    3 +
 drivers/baseband/meson.build                  |    1 +
 lib/bbdev/rte_bbdev.h                         |    2 +
 17 files changed, 2011 insertions(+)
 create mode 100644 app/test-bbdev/test_vectors/ldpc_dec_tb.data
 create mode 100644 app/test-bbdev/test_vectors/ldpc_enc_tb.data
 create mode 100644 doc/guides/bbdevs/features/la12xx.ini
 create mode 100644 doc/guides/bbdevs/la12xx.rst
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.c
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_ipc.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
 create mode 100644 drivers/baseband/la12xx/meson.build
 create mode 100644 drivers/baseband/la12xx/version.map

-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v6 1/9] bbdev: add big endian processing data processing info
  2021-09-24  4:37 ` [dpdk-dev] [PATCH v6 0/9] baseband: add NXP LA12xx driver nipun.gupta
@ 2021-09-24  4:37   ` nipun.gupta
  2021-09-24  4:37   ` [dpdk-dev] [PATCH v6 2/9] baseband: introduce NXP LA12xx driver nipun.gupta
                     ` (7 subsequent siblings)
  8 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-09-24  4:37 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

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

This patch intoduces a new info pertaining to bbdev device
to process the data in big endian order.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 lib/bbdev/rte_bbdev.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/bbdev/rte_bbdev.h b/lib/bbdev/rte_bbdev.h
index 7017124414..3acc008d06 100644
--- a/lib/bbdev/rte_bbdev.h
+++ b/lib/bbdev/rte_bbdev.h
@@ -309,6 +309,8 @@ struct rte_bbdev_driver_info {
 	uint16_t min_alignment;
 	/** HARQ memory available in kB */
 	uint32_t harq_buffer_size;
+	/** Device support input, output and HARQ data as big-endian */
+	uint8_t support_be_data;
 	/** Default queue configuration used if none is supplied  */
 	struct rte_bbdev_queue_conf default_queue_conf;
 	/** Device operation capabilities */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v6 2/9] baseband: introduce NXP LA12xx driver
  2021-09-24  4:37 ` [dpdk-dev] [PATCH v6 0/9] baseband: add NXP LA12xx driver nipun.gupta
  2021-09-24  4:37   ` [dpdk-dev] [PATCH v6 1/9] bbdev: add big endian processing data processing info nipun.gupta
@ 2021-09-24  4:37   ` nipun.gupta
  2021-09-24  4:37   ` [dpdk-dev] [PATCH v6 3/9] baseband/la12xx: add devargs for max queues nipun.gupta
                     ` (6 subsequent siblings)
  8 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-09-24  4:37 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This patch introduce the baseband device drivers for NXP's
LA1200 series software defined baseband modem.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 MAINTAINERS                                   |   9 ++
 drivers/baseband/la12xx/bbdev_la12xx.c        | 109 ++++++++++++++++++
 .../baseband/la12xx/bbdev_la12xx_pmd_logs.h   |  26 +++++
 drivers/baseband/la12xx/meson.build           |   6 +
 drivers/baseband/la12xx/version.map           |   3 +
 drivers/baseband/meson.build                  |   1 +
 6 files changed, 154 insertions(+)
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.c
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
 create mode 100644 drivers/baseband/la12xx/meson.build
 create mode 100644 drivers/baseband/la12xx/version.map

diff --git a/MAINTAINERS b/MAINTAINERS
index 266f5ac1da..cbae1bc23a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1288,6 +1288,15 @@ F: drivers/event/opdl/
 F: doc/guides/eventdevs/opdl.rst
 
 
+Baseband Drivers
+----------------
+
+NXP LA12xx driver
+M: Nipun Gupta <nipun.gupta@nxp.com>
+M: Hemant Agrawal <hemant.agrawal@nxp.com>
+F: drivers/baseband/la12xx/
+
+
 Rawdev Drivers
 --------------
 
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
new file mode 100644
index 0000000000..7050b17728
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -0,0 +1,109 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+
+#include <string.h>
+
+#include <rte_common.h>
+#include <rte_bus_vdev.h>
+#include <rte_malloc.h>
+#include <rte_ring.h>
+#include <rte_kvargs.h>
+
+#include <rte_bbdev.h>
+#include <rte_bbdev_pmd.h>
+
+#include <bbdev_la12xx_pmd_logs.h>
+
+#define DRIVER_NAME baseband_la12xx
+
+RTE_LOG_REGISTER(bbdev_la12xx_logtype, pmd.bb.la12xx, NOTICE);
+
+/* private data structure */
+struct bbdev_la12xx_private {
+	unsigned int max_nb_queues;  /**< Max number of queues */
+};
+/* Create device */
+static int
+la12xx_bbdev_create(struct rte_vdev_device *vdev)
+{
+	struct rte_bbdev *bbdev;
+	const char *name = rte_vdev_device_name(vdev);
+
+	PMD_INIT_FUNC_TRACE();
+
+	bbdev = rte_bbdev_allocate(name);
+	if (bbdev == NULL)
+		return -ENODEV;
+
+	bbdev->data->dev_private = rte_zmalloc(name,
+			sizeof(struct bbdev_la12xx_private),
+			RTE_CACHE_LINE_SIZE);
+	if (bbdev->data->dev_private == NULL) {
+		rte_bbdev_release(bbdev);
+		return -ENOMEM;
+	}
+
+	bbdev->dev_ops = NULL;
+	bbdev->device = &vdev->device;
+	bbdev->data->socket_id = 0;
+	bbdev->intr_handle = NULL;
+
+	/* register rx/tx burst functions for data path */
+	bbdev->dequeue_enc_ops = NULL;
+	bbdev->dequeue_dec_ops = NULL;
+	bbdev->enqueue_enc_ops = NULL;
+	bbdev->enqueue_dec_ops = NULL;
+
+	return 0;
+}
+
+/* Initialise device */
+static int
+la12xx_bbdev_probe(struct rte_vdev_device *vdev)
+{
+	const char *name;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (vdev == NULL)
+		return -EINVAL;
+
+	name = rte_vdev_device_name(vdev);
+	if (name == NULL)
+		return -EINVAL;
+
+	return la12xx_bbdev_create(vdev);
+}
+
+/* Uninitialise device */
+static int
+la12xx_bbdev_remove(struct rte_vdev_device *vdev)
+{
+	struct rte_bbdev *bbdev;
+	const char *name;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (vdev == NULL)
+		return -EINVAL;
+
+	name = rte_vdev_device_name(vdev);
+	if (name == NULL)
+		return -EINVAL;
+
+	bbdev = rte_bbdev_get_named_dev(name);
+	if (bbdev == NULL)
+		return -EINVAL;
+
+	rte_free(bbdev->data->dev_private);
+
+	return rte_bbdev_release(bbdev);
+}
+
+static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
+	.probe = la12xx_bbdev_probe,
+	.remove = la12xx_bbdev_remove
+};
+
+RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h b/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
new file mode 100644
index 0000000000..9dfa1cc458
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020 NXP
+ */
+
+#ifndef _BBDEV_LA12XX_PMD_LOGS_H_
+#define _BBDEV_LA12XX_PMD_LOGS_H_
+
+#define rte_bbdev_log(level, fmt, ...) \
+	rte_log(RTE_LOG_ ## level, bbdev_la12xx_logtype, fmt "\n", \
+		##__VA_ARGS__)
+
+#ifdef RTE_LIBRTE_BBDEV_DEBUG
+#define rte_bbdev_log_debug(fmt, ...) \
+		rte_bbdev_log(DEBUG, "la12xx_pmd: " fmt, \
+		##__VA_ARGS__)
+#else
+#define rte_bbdev_log_debug(fmt, ...)
+#endif
+
+#define PMD_INIT_FUNC_TRACE() rte_bbdev_log_debug(">>")
+
+/* DP Logs, toggled out at compile time if level lower than current level */
+#define rte_bbdev_dp_log(level, fmt, args...) \
+	RTE_LOG_DP(level, PMD, fmt, ## args)
+
+#endif /* _BBDEV_LA12XX_PMD_LOGS_H_ */
diff --git a/drivers/baseband/la12xx/meson.build b/drivers/baseband/la12xx/meson.build
new file mode 100644
index 0000000000..7a017dcffa
--- /dev/null
+++ b/drivers/baseband/la12xx/meson.build
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020-2021 NXP
+
+deps += ['bbdev', 'bus_vdev', 'ring']
+
+sources = files('bbdev_la12xx.c')
diff --git a/drivers/baseband/la12xx/version.map b/drivers/baseband/la12xx/version.map
new file mode 100644
index 0000000000..4a76d1d52d
--- /dev/null
+++ b/drivers/baseband/la12xx/version.map
@@ -0,0 +1,3 @@
+DPDK_21 {
+	local: *;
+};
diff --git a/drivers/baseband/meson.build b/drivers/baseband/meson.build
index 5ee61d5323..ccd1eebc3b 100644
--- a/drivers/baseband/meson.build
+++ b/drivers/baseband/meson.build
@@ -11,6 +11,7 @@ drivers = [
         'fpga_lte_fec',
         'null',
         'turbo_sw',
+        'la12xx',
 ]
 
 log_prefix = 'pmd.bb'
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v6 3/9] baseband/la12xx: add devargs for max queues
  2021-09-24  4:37 ` [dpdk-dev] [PATCH v6 0/9] baseband: add NXP LA12xx driver nipun.gupta
  2021-09-24  4:37   ` [dpdk-dev] [PATCH v6 1/9] bbdev: add big endian processing data processing info nipun.gupta
  2021-09-24  4:37   ` [dpdk-dev] [PATCH v6 2/9] baseband: introduce NXP LA12xx driver nipun.gupta
@ 2021-09-24  4:37   ` nipun.gupta
  2021-09-24  4:37   ` [dpdk-dev] [PATCH v6 4/9] baseband/la12xx: add support for multiple modems nipun.gupta
                     ` (5 subsequent siblings)
  8 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-09-24  4:37 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This patch adds dev args to take  max queues as input

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c | 72 +++++++++++++++++++++++++-
 1 file changed, 70 insertions(+), 2 deletions(-)

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 7050b17728..8886b35429 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -19,13 +19,72 @@
 
 RTE_LOG_REGISTER(bbdev_la12xx_logtype, pmd.bb.la12xx, NOTICE);
 
+/*  Initialisation params structure that can be used by LA12xx BBDEV driver */
+struct bbdev_la12xx_params {
+	uint8_t queues_num; /*< LA12xx BBDEV queues number */
+};
+
+#define LA12XX_MAX_NB_QUEUES_ARG	"max_nb_queues"
+
+static const char * const bbdev_la12xx_valid_params[] = {
+	LA12XX_MAX_NB_QUEUES_ARG,
+};
+
 /* private data structure */
 struct bbdev_la12xx_private {
 	unsigned int max_nb_queues;  /**< Max number of queues */
 };
+static inline int
+parse_u16_arg(const char *key, const char *value, void *extra_args)
+{
+	uint16_t *u16 = extra_args;
+
+	unsigned int long result;
+	if ((value == NULL) || (extra_args == NULL))
+		return -EINVAL;
+	errno = 0;
+	result = strtoul(value, NULL, 0);
+	if ((result >= (1 << 16)) || (errno != 0)) {
+		rte_bbdev_log(ERR, "Invalid value %lu for %s", result, key);
+		return -ERANGE;
+	}
+	*u16 = (uint16_t)result;
+	return 0;
+}
+
+/* Parse parameters used to create device */
+static int
+parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
+		const char *input_args)
+{
+	struct rte_kvargs *kvlist = NULL;
+	int ret = 0;
+
+	if (params == NULL)
+		return -EINVAL;
+	if (input_args) {
+		kvlist = rte_kvargs_parse(input_args,
+				bbdev_la12xx_valid_params);
+		if (kvlist == NULL)
+			return -EFAULT;
+
+		ret = rte_kvargs_process(kvlist, bbdev_la12xx_valid_params[0],
+					&parse_u16_arg, &params->queues_num);
+		if (ret < 0)
+			goto exit;
+
+	}
+
+exit:
+	if (kvlist)
+		rte_kvargs_free(kvlist);
+	return ret;
+}
+
 /* Create device */
 static int
-la12xx_bbdev_create(struct rte_vdev_device *vdev)
+la12xx_bbdev_create(struct rte_vdev_device *vdev,
+		struct bbdev_la12xx_params *init_params __rte_unused)
 {
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
@@ -62,7 +121,11 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev)
 static int
 la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 {
+	struct bbdev_la12xx_params init_params = {
+		8
+	};
 	const char *name;
+	const char *input_args;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -73,7 +136,10 @@ la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 	if (name == NULL)
 		return -EINVAL;
 
-	return la12xx_bbdev_create(vdev);
+	input_args = rte_vdev_device_args(vdev);
+	parse_bbdev_la12xx_params(&init_params, input_args);
+
+	return la12xx_bbdev_create(vdev, &init_params);
 }
 
 /* Uninitialise device */
@@ -107,3 +173,5 @@ static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
 };
 
 RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
+RTE_PMD_REGISTER_PARAM_STRING(DRIVER_NAME,
+	LA12XX_MAX_NB_QUEUES_ARG"=<int>");
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v6 4/9] baseband/la12xx: add support for multiple modems
  2021-09-24  4:37 ` [dpdk-dev] [PATCH v6 0/9] baseband: add NXP LA12xx driver nipun.gupta
                     ` (2 preceding siblings ...)
  2021-09-24  4:37   ` [dpdk-dev] [PATCH v6 3/9] baseband/la12xx: add devargs for max queues nipun.gupta
@ 2021-09-24  4:37   ` nipun.gupta
  2021-09-24  4:37   ` [dpdk-dev] [PATCH v6 5/9] baseband/la12xx: add queue and modem config support nipun.gupta
                     ` (4 subsequent siblings)
  8 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-09-24  4:37 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This patch add support for multiple modems by assigning
a modem id as dev args in vdev creation.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c     | 64 +++++++++++++++++++---
 drivers/baseband/la12xx/bbdev_la12xx.h     | 56 +++++++++++++++++++
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 20 +++++++
 3 files changed, 133 insertions(+), 7 deletions(-)
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_ipc.h

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 8886b35429..f26f3f2a08 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -14,6 +14,8 @@
 #include <rte_bbdev_pmd.h>
 
 #include <bbdev_la12xx_pmd_logs.h>
+#include <bbdev_la12xx_ipc.h>
+#include <bbdev_la12xx.h>
 
 #define DRIVER_NAME baseband_la12xx
 
@@ -22,18 +24,18 @@ RTE_LOG_REGISTER(bbdev_la12xx_logtype, pmd.bb.la12xx, NOTICE);
 /*  Initialisation params structure that can be used by LA12xx BBDEV driver */
 struct bbdev_la12xx_params {
 	uint8_t queues_num; /*< LA12xx BBDEV queues number */
+	int8_t modem_id; /*< LA12xx modem instance id */
 };
 
 #define LA12XX_MAX_NB_QUEUES_ARG	"max_nb_queues"
+#define LA12XX_VDEV_MODEM_ID_ARG	"modem"
+#define LA12XX_MAX_MODEM 4
 
 static const char * const bbdev_la12xx_valid_params[] = {
 	LA12XX_MAX_NB_QUEUES_ARG,
+	LA12XX_VDEV_MODEM_ID_ARG,
 };
 
-/* private data structure */
-struct bbdev_la12xx_private {
-	unsigned int max_nb_queues;  /**< Max number of queues */
-};
 static inline int
 parse_u16_arg(const char *key, const char *value, void *extra_args)
 {
@@ -52,6 +54,28 @@ parse_u16_arg(const char *key, const char *value, void *extra_args)
 	return 0;
 }
 
+/* Parse integer from integer argument */
+static int
+parse_integer_arg(const char *key __rte_unused,
+		const char *value, void *extra_args)
+{
+	int i;
+	char *end;
+
+	errno = 0;
+
+	i = strtol(value, &end, 10);
+	if (*end != 0 || errno != 0 || i < 0 || i > LA12XX_MAX_MODEM) {
+		rte_bbdev_log(ERR, "Supported Port IDS are 0 to %d",
+			LA12XX_MAX_MODEM - 1);
+		return -EINVAL;
+	}
+
+	*((uint32_t *)extra_args) = i;
+
+	return 0;
+}
+
 /* Parse parameters used to create device */
 static int
 parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
@@ -73,6 +97,16 @@ parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
 		if (ret < 0)
 			goto exit;
 
+		ret = rte_kvargs_process(kvlist,
+					bbdev_la12xx_valid_params[1],
+					&parse_integer_arg,
+					&params->modem_id);
+
+		if (params->modem_id >= LA12XX_MAX_MODEM) {
+			rte_bbdev_log(ERR, "Invalid modem id, must be < %u",
+					LA12XX_MAX_MODEM);
+			goto exit;
+		}
 	}
 
 exit:
@@ -84,10 +118,11 @@ parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
 /* Create device */
 static int
 la12xx_bbdev_create(struct rte_vdev_device *vdev,
-		struct bbdev_la12xx_params *init_params __rte_unused)
+		struct bbdev_la12xx_params *init_params)
 {
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
+	struct bbdev_la12xx_private *priv;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -103,6 +138,20 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 		return -ENOMEM;
 	}
 
+	priv = bbdev->data->dev_private;
+	priv->modem_id = init_params->modem_id;
+	/* if modem id is not configured */
+	if (priv->modem_id == -1)
+		priv->modem_id = bbdev->data->dev_id;
+
+	/* Reset Global variables */
+	priv->num_ldpc_enc_queues = 0;
+	priv->num_ldpc_dec_queues = 0;
+	priv->num_valid_queues = 0;
+	priv->max_nb_queues = init_params->queues_num;
+
+	rte_bbdev_log(INFO, "Setting Up %s: DevId=%d, ModemId=%d",
+				name, bbdev->data->dev_id, priv->modem_id);
 	bbdev->dev_ops = NULL;
 	bbdev->device = &vdev->device;
 	bbdev->data->socket_id = 0;
@@ -122,7 +171,7 @@ static int
 la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 {
 	struct bbdev_la12xx_params init_params = {
-		8
+		8, -1,
 	};
 	const char *name;
 	const char *input_args;
@@ -174,4 +223,5 @@ static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
 
 RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
 RTE_PMD_REGISTER_PARAM_STRING(DRIVER_NAME,
-	LA12XX_MAX_NB_QUEUES_ARG"=<int>");
+	LA12XX_MAX_NB_QUEUES_ARG"=<int>"
+	LA12XX_VDEV_MODEM_ID_ARG "=<int> ");
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.h b/drivers/baseband/la12xx/bbdev_la12xx.h
new file mode 100644
index 0000000000..5228502331
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx.h
@@ -0,0 +1,56 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+
+#ifndef __BBDEV_LA12XX_H__
+#define __BBDEV_LA12XX_H__
+
+#define BBDEV_IPC_ENC_OP_TYPE	1
+#define BBDEV_IPC_DEC_OP_TYPE	2
+
+#define MAX_LDPC_ENC_FECA_QUEUES	4
+#define MAX_LDPC_DEC_FECA_QUEUES	4
+
+#define MAX_CHANNEL_DEPTH 16
+/* private data structure */
+struct bbdev_la12xx_private {
+	void *ipc_priv;
+	uint8_t num_valid_queues;
+	uint8_t max_nb_queues;
+	uint8_t num_ldpc_enc_queues;
+	uint8_t num_ldpc_dec_queues;
+	int8_t modem_id;
+	struct bbdev_la12xx_q_priv *queues_priv[32];
+};
+
+struct hugepage_info {
+	void *vaddr;
+	phys_addr_t paddr;
+	size_t len;
+};
+
+struct bbdev_la12xx_q_priv {
+	struct bbdev_la12xx_private *bbdev_priv;
+	uint32_t q_id;	/**< Channel ID */
+	uint32_t feca_blk_id;	/** FECA block ID for processing */
+	uint32_t feca_blk_id_be32; /**< FECA Block ID for this queue */
+	uint8_t en_napi; /* 0: napi disabled, 1: napi enabled */
+	uint16_t queue_size;	/**< Queue depth */
+	int32_t eventfd;	/**< Event FD value */
+	enum rte_bbdev_op_type op_type; /**< Operation type */
+	uint32_t la12xx_core_id;
+		/* LA12xx core ID on which this will be scheduled */
+	struct rte_mempool *mp; /**< Pool from where buffers would be cut */
+	void *bbdev_op[MAX_CHANNEL_DEPTH];
+			/**< Stores bbdev op for each index */
+	void *msg_ch_vaddr[MAX_CHANNEL_DEPTH];
+			/**< Stores msg channel addr for modem->host */
+	uint32_t host_pi;	/**< Producer_Index for HOST->MODEM */
+	uint32_t host_ci;	/**< Consumer Index for MODEM->HOST */
+	host_ipc_params_t *host_params; /**< Host parameters */
+};
+
+#define lower_32_bits(x) ((uint32_t)((uint64_t)x))
+#define upper_32_bits(x) ((uint32_t)(((uint64_t)(x) >> 16) >> 16))
+
+#endif
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
new file mode 100644
index 0000000000..9aa5562981
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+#ifndef __BBDEV_LA12XX_IPC_H__
+#define __BBDEV_LA12XX_IPC_H__
+
+/** No. of max channel per instance */
+#define IPC_MAX_DEPTH	(16)
+
+/* This shared memory would be on the host side which have copy of some
+ * of the parameters which are also part of Shared BD ring. Read access
+ * of these parameters from the host side would not be over PCI.
+ */
+typedef struct host_ipc_params {
+	volatile uint32_t pi;
+	volatile uint32_t ci;
+	volatile uint32_t modem_ptr[IPC_MAX_DEPTH];
+} __rte_packed host_ipc_params_t;
+
+#endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v6 5/9] baseband/la12xx: add queue and modem config support
  2021-09-24  4:37 ` [dpdk-dev] [PATCH v6 0/9] baseband: add NXP LA12xx driver nipun.gupta
                     ` (3 preceding siblings ...)
  2021-09-24  4:37   ` [dpdk-dev] [PATCH v6 4/9] baseband/la12xx: add support for multiple modems nipun.gupta
@ 2021-09-24  4:37   ` nipun.gupta
  2021-09-24  4:37   ` [dpdk-dev] [PATCH v6 6/9] baseband/la12xx: add enqueue and dequeue support nipun.gupta
                     ` (3 subsequent siblings)
  8 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-09-24  4:37 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This patch add support for connecting with modem
and creating the ipc channel as queues with modem
for the exchange of data.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 MAINTAINERS                                |   1 +
 doc/guides/bbdevs/index.rst                |   1 +
 doc/guides/bbdevs/la12xx.rst               |  81 +++
 doc/guides/rel_notes/release_21_11.rst     |   5 +
 drivers/baseband/la12xx/bbdev_la12xx.c     | 553 ++++++++++++++++++++-
 drivers/baseband/la12xx/bbdev_la12xx.h     |  17 +-
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 189 ++++++-
 7 files changed, 834 insertions(+), 13 deletions(-)
 create mode 100644 doc/guides/bbdevs/la12xx.rst

diff --git a/MAINTAINERS b/MAINTAINERS
index cbae1bc23a..ee3349a15f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1295,6 +1295,7 @@ NXP LA12xx driver
 M: Nipun Gupta <nipun.gupta@nxp.com>
 M: Hemant Agrawal <hemant.agrawal@nxp.com>
 F: drivers/baseband/la12xx/
+F: doc/guides/bbdevs/la12xx.rst
 
 
 Rawdev Drivers
diff --git a/doc/guides/bbdevs/index.rst b/doc/guides/bbdevs/index.rst
index 4445cbd1b0..cedd706fa6 100644
--- a/doc/guides/bbdevs/index.rst
+++ b/doc/guides/bbdevs/index.rst
@@ -14,3 +14,4 @@ Baseband Device Drivers
     fpga_lte_fec
     fpga_5gnr_fec
     acc100
+    la12xx
diff --git a/doc/guides/bbdevs/la12xx.rst b/doc/guides/bbdevs/la12xx.rst
new file mode 100644
index 0000000000..3c9ac5c047
--- /dev/null
+++ b/doc/guides/bbdevs/la12xx.rst
@@ -0,0 +1,81 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright 2021 NXP
+
+NXP LA12xx Poll Mode Driver
+=======================================
+
+The BBDEV LA12xx poll mode driver (PMD) supports an implementation for
+offloading High Phy processing functions like LDPC Encode / Decode 5GNR wireless
+acceleration function, using PCI based LA12xx Software defined radio.
+
+More information can be found at `NXP Official Website
+<https://www.nxp.com/products/processors-and-microcontrollers/arm-processors/layerscape-processors/layerscape-access-la1200-programmable-baseband-processor:LA1200>`_.
+
+Features
+--------
+
+LA12xx PMD supports the following features:
+
+- Maximum of 8 UL queues
+- Maximum of 8 DL queues
+- PCIe Gen-3 x8 Interface
+- MSI-X
+
+Installation
+------------
+
+Section 3 of the DPDK manual provides instructions on installing and compiling DPDK.
+
+DPDK requires hugepages to be configured as detailed in section 2 of the DPDK manual.
+
+Initialization
+--------------
+
+The device can be listed on the host console with:
+
+
+Use the following lspci command to get the multiple LA12xx processor ids. The
+device ID of the LA12xx baseband processor is "1c30".
+
+.. code-block:: console
+
+  sudo lspci -nn
+
+...
+0001:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device [1957:1c30] (
+rev 10)
+...
+0002:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device [1957:1c30] (
+rev 10)
+
+
+Prerequisites
+-------------
+
+Currently supported by DPDK:
+
+- NXP LA1224 BSP **1.0+**.
+- NXP LA1224 PCIe Modem card connected to ARM host.
+
+- Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup the basic DPDK environment.
+
+* Use dev arg option ``modem=0`` to identify the modem instance for a given
+  device. This is required only if more than 1 modem cards are attached to host.
+  this is optional and the default value is 0.
+  e.g. ``--vdev=baseband_la12xx,modem=0``
+
+* Use dev arg option ``max_nb_queues=x`` to specify the maximum number of queues
+  to be used for communication with offload device i.e. modem. default is 16.
+  e.g. ``--vdev=baseband_la12xx,max_nb_queues=4``
+
+Enabling logs
+-------------
+
+For enabling logs, use the following EAL parameter:
+
+.. code-block:: console
+
+   ./your_bbdev_application <EAL args> --log-level=la12xx:<level>
+
+Using ``bb.la12xx`` as log matching criteria, all Baseband PMD logs can be
+enabled which are lower than logging ``level``.
diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst
index 675b573834..a0e0ebbeb8 100644
--- a/doc/guides/rel_notes/release_21_11.rst
+++ b/doc/guides/rel_notes/release_21_11.rst
@@ -62,6 +62,11 @@ New Features
   * Added bus-level parsing of the devargs syntax.
   * Kept compatibility with the legacy syntax as parsing fallback.
 
+* **Added NXP LA12xx baseband PMD.**
+
+  * Added a new baseband PMD driver for NXP LA12xx Software defined radio.
+  * See the :doc:`../bbdevs/la12xx` for more details.
+
 
 Removed Items
 -------------
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index f26f3f2a08..c758fe3833 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -3,6 +3,11 @@
  */
 
 #include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <dirent.h>
 
 #include <rte_common.h>
 #include <rte_bus_vdev.h>
@@ -31,11 +36,550 @@ struct bbdev_la12xx_params {
 #define LA12XX_VDEV_MODEM_ID_ARG	"modem"
 #define LA12XX_MAX_MODEM 4
 
+#define LA12XX_MAX_CORES	4
+#define LA12XX_LDPC_ENC_CORE	0
+#define LA12XX_LDPC_DEC_CORE	1
+
+#define LA12XX_MAX_LDPC_ENC_QUEUES	4
+#define LA12XX_MAX_LDPC_DEC_QUEUES	4
+
 static const char * const bbdev_la12xx_valid_params[] = {
 	LA12XX_MAX_NB_QUEUES_ARG,
 	LA12XX_VDEV_MODEM_ID_ARG,
 };
 
+static const struct rte_bbdev_op_cap bbdev_capabilities[] = {
+	{
+		.type   = RTE_BBDEV_OP_LDPC_ENC,
+		.cap.ldpc_enc = {
+			.capability_flags =
+					RTE_BBDEV_LDPC_RATE_MATCH |
+					RTE_BBDEV_LDPC_CRC_24A_ATTACH |
+					RTE_BBDEV_LDPC_CRC_24B_ATTACH,
+			.num_buffers_src =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+			.num_buffers_dst =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+		}
+	},
+	{
+		.type   = RTE_BBDEV_OP_LDPC_DEC,
+		.cap.ldpc_dec = {
+			.capability_flags =
+				RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK |
+					RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK |
+					RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP,
+			.num_buffers_src =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+			.num_buffers_hard_out =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+			.llr_size = 8,
+			.llr_decimals = 1,
+		}
+	},
+	RTE_BBDEV_END_OF_CAPABILITIES_LIST()
+};
+
+static struct rte_bbdev_queue_conf default_queue_conf = {
+	.queue_size = MAX_CHANNEL_DEPTH,
+};
+
+/* Get device info */
+static void
+la12xx_info_get(struct rte_bbdev *dev __rte_unused,
+		struct rte_bbdev_driver_info *dev_info)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	dev_info->driver_name = RTE_STR(DRIVER_NAME);
+	dev_info->max_num_queues = LA12XX_MAX_QUEUES;
+	dev_info->queue_size_lim = MAX_CHANNEL_DEPTH;
+	dev_info->hardware_accelerated = true;
+	dev_info->max_dl_queue_priority = 0;
+	dev_info->max_ul_queue_priority = 0;
+	dev_info->support_be_data = 1;
+	dev_info->default_queue_conf = default_queue_conf;
+	dev_info->capabilities = bbdev_capabilities;
+	dev_info->cpu_flag_reqs = NULL;
+	dev_info->min_alignment = 64;
+
+	rte_bbdev_log_debug("got device info from %u", dev->data->dev_id);
+}
+
+/* Release queue */
+static int
+la12xx_queue_release(struct rte_bbdev *dev, uint16_t q_id)
+{
+	RTE_SET_USED(dev);
+	RTE_SET_USED(q_id);
+
+	PMD_INIT_FUNC_TRACE();
+
+	return 0;
+}
+
+#define HUGEPG_OFFSET(A) \
+		((uint64_t) ((unsigned long) (A) \
+		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
+
+static int ipc_queue_configure(uint32_t channel_id,
+		ipc_t instance, struct bbdev_la12xx_q_priv *q_priv)
+{
+	ipc_userspace_t *ipc_priv = (ipc_userspace_t *)instance;
+	ipc_instance_t *ipc_instance = ipc_priv->instance;
+	ipc_ch_t *ch;
+	void *vaddr;
+	uint32_t i = 0;
+	uint32_t msg_size = sizeof(struct bbdev_ipc_enqueue_op);
+
+	PMD_INIT_FUNC_TRACE();
+
+	rte_bbdev_log_debug("%x %p", ipc_instance->initialized,
+		ipc_priv->instance);
+	ch = &(ipc_instance->ch_list[channel_id]);
+
+	rte_bbdev_log_debug("channel: %u, depth: %u, msg size: %u",
+		channel_id, q_priv->queue_size, msg_size);
+
+	/* Start init of channel */
+	ch->md.ring_size = rte_cpu_to_be_32(q_priv->queue_size);
+	ch->md.pi = 0;
+	ch->md.ci = 0;
+	ch->md.msg_size = msg_size;
+	for (i = 0; i < q_priv->queue_size; i++) {
+		vaddr = rte_malloc(NULL, msg_size, RTE_CACHE_LINE_SIZE);
+		if (!vaddr)
+			return IPC_HOST_BUF_ALLOC_FAIL;
+		/* Only offset now */
+		ch->bd_h[i].modem_ptr =
+			rte_cpu_to_be_32(HUGEPG_OFFSET(vaddr));
+		ch->bd_h[i].host_virt_l = lower_32_bits(vaddr);
+		ch->bd_h[i].host_virt_h = upper_32_bits(vaddr);
+		q_priv->msg_ch_vaddr[i] = vaddr;
+		/* Not sure use of this len may be for CRC*/
+		ch->bd_h[i].len = 0;
+	}
+	ch->host_ipc_params =
+		rte_cpu_to_be_32(HUGEPG_OFFSET(q_priv->host_params));
+
+	rte_bbdev_log_debug("Channel configured");
+	return IPC_SUCCESS;
+}
+
+static int
+la12xx_e200_queue_setup(struct rte_bbdev *dev,
+		struct bbdev_la12xx_q_priv *q_priv)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	struct gul_hif *mhif;
+	ipc_metadata_t *ipc_md;
+	ipc_ch_t *ch;
+	int instance_id = 0, i;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		q_priv->la12xx_core_id = LA12XX_LDPC_ENC_CORE;
+		break;
+	case RTE_BBDEV_OP_LDPC_DEC:
+		q_priv->la12xx_core_id = LA12XX_LDPC_DEC_CORE;
+		break;
+	default:
+		rte_bbdev_log(ERR, "Unsupported op type\n");
+		return -1;
+	}
+
+	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+	/* offset is from start of PEB */
+	ipc_md = (ipc_metadata_t *)((uint64_t)ipc_priv->peb_start.host_vaddr +
+		mhif->ipc_regs.ipc_mdata_offset);
+	ch = &ipc_md->instance_list[instance_id].ch_list[q_priv->q_id];
+
+	if (q_priv->q_id < priv->num_valid_queues) {
+		ipc_br_md_t *md = &(ch->md);
+
+		q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
+		q_priv->feca_blk_id_be32 = ch->feca_blk_id;
+		q_priv->host_pi = rte_be_to_cpu_32(md->pi);
+		q_priv->host_ci = rte_be_to_cpu_32(md->ci);
+		q_priv->host_params = (host_ipc_params_t *)
+			(rte_be_to_cpu_32(ch->host_ipc_params) +
+			((uint64_t)ipc_priv->hugepg_start.host_vaddr));
+
+		for (i = 0; i < q_priv->queue_size; i++) {
+			uint32_t h, l;
+
+			h = ch->bd_h[i].host_virt_h;
+			l = ch->bd_h[i].host_virt_l;
+			q_priv->msg_ch_vaddr[i] = (void *)join_32_bits(h, l);
+		}
+
+		rte_bbdev_log(WARNING,
+			"Queue [%d] already configured, not configuring again",
+			q_priv->q_id);
+		return 0;
+	}
+
+	rte_bbdev_log_debug("setting up queue %d", q_priv->q_id);
+
+	/* Call ipc_configure_channel */
+	ret = ipc_queue_configure(q_priv->q_id, ipc_priv, q_priv);
+	if (ret) {
+		rte_bbdev_log(ERR, "Unable to setup queue (%d) (err=%d)",
+		       q_priv->q_id, ret);
+		return ret;
+	}
+
+	/* Set queue properties for LA12xx device */
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		if (priv->num_ldpc_enc_queues >= LA12XX_MAX_LDPC_ENC_QUEUES) {
+			rte_bbdev_log(ERR,
+				"num_ldpc_enc_queues reached max value");
+			return -1;
+		}
+		ch->la12xx_core_id =
+			rte_cpu_to_be_32(LA12XX_LDPC_ENC_CORE);
+		ch->feca_blk_id = rte_cpu_to_be_32(priv->num_ldpc_enc_queues++);
+		break;
+	case RTE_BBDEV_OP_LDPC_DEC:
+		if (priv->num_ldpc_dec_queues >= LA12XX_MAX_LDPC_DEC_QUEUES) {
+			rte_bbdev_log(ERR,
+				"num_ldpc_dec_queues reached max value");
+			return -1;
+		}
+		ch->la12xx_core_id =
+			rte_cpu_to_be_32(LA12XX_LDPC_DEC_CORE);
+		ch->feca_blk_id = rte_cpu_to_be_32(priv->num_ldpc_dec_queues++);
+		break;
+	default:
+		rte_bbdev_log(ERR, "Not supported op type\n");
+		return -1;
+	}
+	ch->op_type = rte_cpu_to_be_32(q_priv->op_type);
+	ch->depth = rte_cpu_to_be_32(q_priv->queue_size);
+
+	/* Store queue config here */
+	q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
+	q_priv->feca_blk_id_be32 = ch->feca_blk_id;
+
+	return 0;
+}
+
+/* Setup a queue */
+static int
+la12xx_queue_setup(struct rte_bbdev *dev, uint16_t q_id,
+		const struct rte_bbdev_queue_conf *queue_conf)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	struct rte_bbdev_queue_data *q_data;
+	struct bbdev_la12xx_q_priv *q_priv;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* Move to setup_queues callback */
+	q_data = &dev->data->queues[q_id];
+	q_data->queue_private = rte_zmalloc(NULL,
+		sizeof(struct bbdev_la12xx_q_priv), 0);
+	if (!q_data->queue_private) {
+		rte_bbdev_log(ERR, "Memory allocation failed for qpriv");
+		return -ENOMEM;
+	}
+	q_priv = q_data->queue_private;
+	q_priv->q_id = q_id;
+	q_priv->bbdev_priv = dev->data->dev_private;
+	q_priv->queue_size = queue_conf->queue_size;
+	q_priv->op_type = queue_conf->op_type;
+
+	ret = la12xx_e200_queue_setup(dev, q_priv);
+	if (ret) {
+		rte_bbdev_log(ERR, "e200_queue_setup failed for qid: %d",
+				     q_id);
+		return ret;
+	}
+
+	/* Store queue config here */
+	priv->num_valid_queues++;
+
+	return 0;
+}
+
+static int
+la12xx_start(struct rte_bbdev *dev)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	int ready = 0;
+	struct gul_hif *hif_start;
+
+	PMD_INIT_FUNC_TRACE();
+
+	hif_start = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+
+	/* Set Host Read bit */
+	SET_HIF_HOST_RDY(hif_start, HIF_HOST_READY_IPC_APP);
+
+	/* Now wait for modem ready bit */
+	while (!ready)
+		ready = CHK_HIF_MOD_RDY(hif_start, HIF_MOD_READY_IPC_APP);
+
+	return 0;
+}
+
+static const struct rte_bbdev_ops pmd_ops = {
+	.info_get = la12xx_info_get,
+	.queue_setup = la12xx_queue_setup,
+	.queue_release = la12xx_queue_release,
+	.start = la12xx_start
+};
+static struct hugepage_info *
+get_hugepage_info(void)
+{
+	struct hugepage_info *hp_info;
+	struct rte_memseg *mseg;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* TODO - find a better way */
+	hp_info = rte_malloc(NULL, sizeof(struct hugepage_info), 0);
+	if (!hp_info) {
+		rte_bbdev_log(ERR, "Unable to allocate on local heap");
+		return NULL;
+	}
+
+	mseg = rte_mem_virt2memseg(hp_info, NULL);
+	hp_info->vaddr = mseg->addr;
+	hp_info->paddr = rte_mem_virt2phy(mseg->addr);
+	hp_info->len = mseg->len;
+
+	return hp_info;
+}
+
+static int open_ipc_dev(int modem_id)
+{
+	char dev_initials[16], dev_path[PATH_MAX];
+	struct dirent *entry;
+	int dev_ipc = 0;
+	DIR *dir;
+
+	dir = opendir("/dev/");
+	if (!dir) {
+		rte_bbdev_log(ERR, "Unable to open /dev/");
+		return -1;
+	}
+
+	sprintf(dev_initials, "gulipcgul%d", modem_id);
+
+	while ((entry = readdir(dir)) != NULL) {
+		if (!strncmp(dev_initials, entry->d_name,
+		    sizeof(dev_initials) - 1))
+			break;
+	}
+
+	if (!entry) {
+		rte_bbdev_log(ERR, "Error: No gulipcgul%d device", modem_id);
+		return -1;
+	}
+
+	sprintf(dev_path, "/dev/%s", entry->d_name);
+	dev_ipc = open(dev_path, O_RDWR);
+	if (dev_ipc  < 0) {
+		rte_bbdev_log(ERR, "Error: Cannot open %s", dev_path);
+		return -errno;
+	}
+
+	return dev_ipc;
+}
+
+static int
+setup_la12xx_dev(struct rte_bbdev *dev)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	struct hugepage_info *hp = NULL;
+	ipc_channel_us_t *ipc_priv_ch = NULL;
+	int dev_ipc = 0, dev_mem = 0, i;
+	ipc_metadata_t *ipc_md;
+	struct gul_hif *mhif;
+	uint32_t phy_align = 0;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (!ipc_priv) {
+		/* TODO - get a better way */
+		/* Get the hugepage info against it */
+		hp = get_hugepage_info();
+		if (!hp) {
+			rte_bbdev_log(ERR, "Unable to get hugepage info");
+			ret = -ENOMEM;
+			goto err;
+		}
+
+		rte_bbdev_log_debug("%lx %p %lx",
+				hp->paddr, hp->vaddr, hp->len);
+
+		ipc_priv = rte_zmalloc(0, sizeof(ipc_userspace_t), 0);
+		if (ipc_priv == NULL) {
+			rte_bbdev_log(ERR,
+				"Unable to allocate memory for ipc priv");
+			ret = -ENOMEM;
+			goto err;
+		}
+
+		for (i = 0; i < IPC_MAX_CHANNEL_COUNT; i++) {
+			ipc_priv_ch = rte_zmalloc(0,
+				sizeof(ipc_channel_us_t), 0);
+			if (ipc_priv_ch == NULL) {
+				rte_bbdev_log(ERR,
+					"Unable to allocate memory for channels");
+				ret = -ENOMEM;
+			}
+			ipc_priv->channels[i] = ipc_priv_ch;
+		}
+
+		dev_mem = open("/dev/mem", O_RDWR);
+		if (dev_mem < 0) {
+			rte_bbdev_log(ERR, "Error: Cannot open /dev/mem");
+			ret = -errno;
+			goto err;
+		}
+
+		ipc_priv->instance_id = 0;
+		ipc_priv->dev_mem = dev_mem;
+
+		rte_bbdev_log_debug("hugepg input %lx %p %lx",
+			hp->paddr, hp->vaddr, hp->len);
+
+		ipc_priv->sys_map.hugepg_start.host_phys = hp->paddr;
+		ipc_priv->sys_map.hugepg_start.size = hp->len;
+
+		ipc_priv->hugepg_start.host_phys = hp->paddr;
+		ipc_priv->hugepg_start.host_vaddr = hp->vaddr;
+		ipc_priv->hugepg_start.size = hp->len;
+
+		rte_free(hp);
+	}
+
+	dev_ipc = open_ipc_dev(priv->modem_id);
+	if (dev_ipc < 0) {
+		rte_bbdev_log(ERR, "Error: open_ipc_dev failed");
+		goto err;
+	}
+	ipc_priv->dev_ipc = dev_ipc;
+
+	ret = ioctl(ipc_priv->dev_ipc, IOCTL_GUL_IPC_GET_SYS_MAP,
+		    &ipc_priv->sys_map);
+	if (ret) {
+		rte_bbdev_log(ERR,
+			"IOCTL_GUL_IPC_GET_SYS_MAP ioctl failed");
+		goto err;
+	}
+
+	phy_align = (ipc_priv->sys_map.mhif_start.host_phys % 0x1000);
+	ipc_priv->mhif_start.host_vaddr =
+		mmap(0, ipc_priv->sys_map.mhif_start.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.mhif_start.host_phys - phy_align));
+	if (ipc_priv->mhif_start.host_vaddr == MAP_FAILED) {
+		rte_bbdev_log(ERR, "MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->mhif_start.host_vaddr = (void *) ((uint64_t)
+		(ipc_priv->mhif_start.host_vaddr) + phy_align);
+
+	phy_align = (ipc_priv->sys_map.peb_start.host_phys % 0x1000);
+	ipc_priv->peb_start.host_vaddr =
+		mmap(0, ipc_priv->sys_map.peb_start.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.peb_start.host_phys - phy_align));
+	if (ipc_priv->peb_start.host_vaddr == MAP_FAILED) {
+		rte_bbdev_log(ERR, "MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->peb_start.host_vaddr = (void *)((uint64_t)
+		(ipc_priv->peb_start.host_vaddr) + phy_align);
+
+	phy_align = (ipc_priv->sys_map.modem_ccsrbar.host_phys % 0x1000);
+	ipc_priv->modem_ccsrbar.host_vaddr =
+		mmap(0, ipc_priv->sys_map.modem_ccsrbar.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.modem_ccsrbar.host_phys - phy_align));
+	if (ipc_priv->modem_ccsrbar.host_vaddr == MAP_FAILED) {
+		rte_bbdev_log(ERR, "MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->modem_ccsrbar.host_vaddr = (void *)((uint64_t)
+		(ipc_priv->modem_ccsrbar.host_vaddr) + phy_align);
+
+	ipc_priv->hugepg_start.modem_phys =
+		ipc_priv->sys_map.hugepg_start.modem_phys;
+
+	ipc_priv->mhif_start.host_phys =
+		ipc_priv->sys_map.mhif_start.host_phys;
+	ipc_priv->mhif_start.size = ipc_priv->sys_map.mhif_start.size;
+	ipc_priv->peb_start.host_phys = ipc_priv->sys_map.peb_start.host_phys;
+	ipc_priv->peb_start.size = ipc_priv->sys_map.peb_start.size;
+
+	rte_bbdev_log(INFO, "peb %lx %p %x",
+			ipc_priv->peb_start.host_phys,
+			ipc_priv->peb_start.host_vaddr,
+			ipc_priv->peb_start.size);
+	rte_bbdev_log(INFO, "hugepg %lx %p %x",
+			ipc_priv->hugepg_start.host_phys,
+			ipc_priv->hugepg_start.host_vaddr,
+			ipc_priv->hugepg_start.size);
+	rte_bbdev_log(INFO, "mhif %lx %p %x",
+			ipc_priv->mhif_start.host_phys,
+			ipc_priv->mhif_start.host_vaddr,
+			ipc_priv->mhif_start.size);
+	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+
+	/* offset is from start of PEB */
+	ipc_md = (ipc_metadata_t *)((uint64_t)ipc_priv->peb_start.host_vaddr +
+			mhif->ipc_regs.ipc_mdata_offset);
+
+	if (sizeof(ipc_metadata_t) != mhif->ipc_regs.ipc_mdata_size) {
+		rte_bbdev_log(ERR,
+			"ipc_metadata_t =%lx, mhif->ipc_regs.ipc_mdata_size=%x",
+			sizeof(ipc_metadata_t), mhif->ipc_regs.ipc_mdata_size);
+		rte_bbdev_log(ERR, "--> mhif->ipc_regs.ipc_mdata_offset= %x",
+			mhif->ipc_regs.ipc_mdata_offset);
+		rte_bbdev_log(ERR, "gul_hif size=%lx", sizeof(struct gul_hif));
+		return IPC_MD_SZ_MISS_MATCH;
+	}
+
+	ipc_priv->instance = (ipc_instance_t *)
+		(&ipc_md->instance_list[ipc_priv->instance_id]);
+
+	rte_bbdev_log_debug("finish host init");
+
+	priv->ipc_priv = ipc_priv;
+
+	return 0;
+
+err:
+	rte_free(hp);
+	rte_free(ipc_priv);
+	rte_free(ipc_priv_ch);
+	if (dev_mem)
+		close(dev_mem);
+	if (dev_ipc)
+		close(dev_ipc);
+
+	return ret;
+}
+
 static inline int
 parse_u16_arg(const char *key, const char *value, void *extra_args)
 {
@@ -123,6 +667,7 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
 	struct bbdev_la12xx_private *priv;
+	int ret;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -152,7 +697,13 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 
 	rte_bbdev_log(INFO, "Setting Up %s: DevId=%d, ModemId=%d",
 				name, bbdev->data->dev_id, priv->modem_id);
-	bbdev->dev_ops = NULL;
+	ret = setup_la12xx_dev(bbdev);
+	if (ret) {
+		rte_bbdev_log(ERR, "IPC Setup failed for %s", name);
+		rte_free(bbdev->data->dev_private);
+		return ret;
+	}
+	bbdev->dev_ops = &pmd_ops;
 	bbdev->device = &vdev->device;
 	bbdev->data->socket_id = 0;
 	bbdev->intr_handle = NULL;
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.h b/drivers/baseband/la12xx/bbdev_la12xx.h
index 5228502331..fe91e62bf6 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx.h
@@ -5,16 +5,10 @@
 #ifndef __BBDEV_LA12XX_H__
 #define __BBDEV_LA12XX_H__
 
-#define BBDEV_IPC_ENC_OP_TYPE	1
-#define BBDEV_IPC_DEC_OP_TYPE	2
-
-#define MAX_LDPC_ENC_FECA_QUEUES	4
-#define MAX_LDPC_DEC_FECA_QUEUES	4
-
 #define MAX_CHANNEL_DEPTH 16
 /* private data structure */
 struct bbdev_la12xx_private {
-	void *ipc_priv;
+	ipc_userspace_t *ipc_priv;
 	uint8_t num_valid_queues;
 	uint8_t max_nb_queues;
 	uint8_t num_ldpc_enc_queues;
@@ -32,14 +26,14 @@ struct hugepage_info {
 struct bbdev_la12xx_q_priv {
 	struct bbdev_la12xx_private *bbdev_priv;
 	uint32_t q_id;	/**< Channel ID */
-	uint32_t feca_blk_id;	/** FECA block ID for processing */
+	uint32_t feca_blk_id;	/**< FECA block ID for processing */
 	uint32_t feca_blk_id_be32; /**< FECA Block ID for this queue */
-	uint8_t en_napi; /* 0: napi disabled, 1: napi enabled */
+	uint8_t en_napi; /**< 0: napi disabled, 1: napi enabled */
 	uint16_t queue_size;	/**< Queue depth */
 	int32_t eventfd;	/**< Event FD value */
 	enum rte_bbdev_op_type op_type; /**< Operation type */
 	uint32_t la12xx_core_id;
-		/* LA12xx core ID on which this will be scheduled */
+		/**< LA12xx core ID on which this will be scheduled */
 	struct rte_mempool *mp; /**< Pool from where buffers would be cut */
 	void *bbdev_op[MAX_CHANNEL_DEPTH];
 			/**< Stores bbdev op for each index */
@@ -52,5 +46,6 @@ struct bbdev_la12xx_q_priv {
 
 #define lower_32_bits(x) ((uint32_t)((uint64_t)x))
 #define upper_32_bits(x) ((uint32_t)(((uint64_t)(x) >> 16) >> 16))
-
+#define join_32_bits(upper, lower) \
+	((size_t)(((uint64_t)(upper) << 32) | (uint32_t)(lower)))
 #endif
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
index 9aa5562981..5f613fb087 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -4,9 +4,182 @@
 #ifndef __BBDEV_LA12XX_IPC_H__
 #define __BBDEV_LA12XX_IPC_H__
 
+#define LA12XX_MAX_QUEUES 20
+#define HOST_RX_QUEUEID_OFFSET LA12XX_MAX_QUEUES
+
+/** No. of max channel per instance */
+#define IPC_MAX_CHANNEL_COUNT	(64)
+
 /** No. of max channel per instance */
 #define IPC_MAX_DEPTH	(16)
 
+/** No. of max IPC instance per modem */
+#define IPC_MAX_INSTANCE_COUNT	(1)
+
+/** Error codes */
+#define IPC_SUCCESS		(0) /** IPC operation success */
+#define IPC_INPUT_INVALID	(-1) /** Invalid input to API */
+#define IPC_CH_INVALID		(-2) /** Channel no is invalid */
+#define IPC_INSTANCE_INVALID	(-3) /** Instance no is invalid */
+#define IPC_MEM_INVALID		(-4) /** Insufficient memory */
+#define IPC_CH_FULL		(-5) /** Channel is full */
+#define IPC_CH_EMPTY		(-6) /** Channel is empty */
+#define IPC_BL_EMPTY		(-7) /** Free buffer list is empty */
+#define IPC_BL_FULL		(-8) /** Free buffer list is full */
+#define IPC_HOST_BUF_ALLOC_FAIL	(-9) /** DPDK malloc fail */
+#define IPC_MD_SZ_MISS_MATCH	(-10) /** META DATA size in mhif miss matched*/
+#define IPC_MALLOC_FAIL		(-11) /** system malloc fail */
+#define IPC_IOCTL_FAIL		(-12) /** IOCTL call failed */
+#define IPC_MMAP_FAIL		(-14) /** MMAP fail */
+#define IPC_OPEN_FAIL		(-15) /** OPEN fail */
+#define IPC_EVENTFD_FAIL	(-16) /** eventfd initialization failed */
+#define IPC_NOT_IMPLEMENTED	(-17) /** IPC feature is not implemented yet*/
+
+#define SET_HIF_HOST_RDY(hif, RDY_MASK) (hif->host_ready |= RDY_MASK)
+#define CHK_HIF_MOD_RDY(hif, RDY_MASK) (hif->mod_ready & RDY_MASK)
+
+/* Host Ready bits */
+#define HIF_HOST_READY_HOST_REGIONS	(1 << 0)
+#define HIF_HOST_READY_IPC_LIB		(1 << 12)
+#define HIF_HOST_READY_IPC_APP		(1 << 13)
+#define HIF_HOST_READY_FECA		(1 << 14)
+
+/* Modem Ready bits */
+#define HIF_MOD_READY_IPC_LIB		(1 << 5)
+#define HIF_MOD_READY_IPC_APP		(1 << 6)
+#define HIF_MOD_READY_FECA		(1 << 7)
+
+typedef void *ipc_t;
+
+struct ipc_msg {
+	int chid;
+	void *addr;
+	uint32_t len;
+	uint8_t flags;
+};
+
+typedef struct {
+	uint64_t host_phys;
+	uint32_t modem_phys;
+	void    *host_vaddr;
+	uint32_t size;
+} mem_range_t;
+
+#define GUL_IPC_MAGIC	'R'
+
+#define IOCTL_GUL_IPC_GET_SYS_MAP _IOW(GUL_IPC_MAGIC, 1, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_REGISTER _IOWR(GUL_IPC_MAGIC, 4, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_DEREGISTER \
+	_IOWR(GUL_IPC_MAGIC, 5, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_RAISE_INTERRUPT _IOW(GUL_IPC_MAGIC, 6, int *)
+
+/** buffer ring common metadata */
+typedef struct ipc_bd_ring_md {
+	volatile uint32_t pi;		/**< Producer index and flag (MSB)
+					  *  which flip for each Ring wrapping
+					  */
+	volatile uint32_t ci;		/**< Consumer index and flag (MSB)
+					  *  which flip for each Ring wrapping
+					  */
+	uint32_t ring_size;	/**< depth (Used to roll-over pi/ci) */
+	uint32_t msg_size;	/**< Size of the each buffer */
+} __rte_packed ipc_br_md_t;
+
+/** IPC buffer descriptor */
+typedef struct ipc_buffer_desc {
+	union {
+		uint64_t host_virt;	/**< msg's host virtual address */
+		struct {
+			uint32_t host_virt_l;
+			uint32_t host_virt_h;
+		};
+	};
+	uint32_t modem_ptr;	/**< msg's modem physical address */
+	uint32_t len;		/**< msg len */
+} __rte_packed ipc_bd_t;
+
+typedef struct ipc_channel {
+	uint32_t ch_id;		/**< Channel id */
+	ipc_br_md_t md;			/**< Metadata for BD ring */
+	ipc_bd_t bd_h[IPC_MAX_DEPTH];	/**< Buffer Descriptor on Host */
+	ipc_bd_t bd_m[IPC_MAX_DEPTH];	/**< Buffer Descriptor on Modem */
+	uint32_t op_type;		/**< Type of the BBDEV operation
+					  * supported on this channel
+					  */
+	uint32_t depth;			/**< Channel depth */
+	uint32_t feca_blk_id;	/**< FECA Transport Block ID for processing */
+	uint32_t la12xx_core_id;/**< LA12xx core ID on which this will be
+				  * scheduled
+				  */
+	uint32_t feca_input_circ_size;	/**< FECA transport block input
+					  * circular buffer size
+					  */
+	uint32_t host_ipc_params;	/**< Address for host IPC parameters */
+} __rte_packed ipc_ch_t;
+
+typedef struct ipc_instance {
+	uint32_t instance_id;		/**< instance id, use to init this
+					  * instance by ipc_init API
+					  */
+	uint32_t initialized;		/**< Set in ipc_init */
+	ipc_ch_t ch_list[IPC_MAX_CHANNEL_COUNT];
+		/**< Channel descriptors in this instance */
+} __rte_packed ipc_instance_t;
+
+typedef struct ipc_metadata {
+	uint32_t ipc_host_signature; /**< IPC host signature, Set by host/L2 */
+	uint32_t ipc_geul_signature; /**< IPC geul signature, Set by modem */
+	ipc_instance_t instance_list[IPC_MAX_INSTANCE_COUNT];
+} __rte_packed ipc_metadata_t;
+
+typedef struct ipc_channel_us_priv {
+	int32_t		eventfd;
+	uint32_t	channel_id;
+	/* In flight packets status for buffer list. */
+	uint8_t		bufs_inflight[IPC_MAX_DEPTH];
+} ipc_channel_us_t;
+
+typedef struct {
+	uint64_t host_phys;
+	uint32_t modem_phys;
+	uint32_t size;
+} mem_strt_addr_t;
+
+typedef struct {
+	mem_strt_addr_t modem_ccsrbar;
+	mem_strt_addr_t peb_start; /* PEB meta data */
+	mem_strt_addr_t mhif_start; /* MHIF meta daat */
+	mem_strt_addr_t hugepg_start; /* Modem to access hugepage */
+} sys_map_t;
+
+typedef struct ipc_priv_t {
+	int instance_id;
+	int dev_ipc;
+	int dev_mem;
+	sys_map_t sys_map;
+	mem_range_t modem_ccsrbar;
+	mem_range_t peb_start;
+	mem_range_t mhif_start;
+	mem_range_t hugepg_start;
+	ipc_channel_us_t *channels[IPC_MAX_CHANNEL_COUNT];
+	ipc_instance_t	*instance;
+	ipc_instance_t	*instance_bk;
+} ipc_userspace_t;
+
+/** Structure specifying enqueue operation (enqueue at LA1224) */
+struct bbdev_ipc_enqueue_op {
+	/** Status of operation that was performed */
+	int32_t status;
+	/** CRC Status of SD operation that was performed */
+	int32_t crc_stat_addr;
+	/** HARQ Output buffer memory length for Shared Decode.
+	 * Filled by LA12xx.
+	 */
+	uint32_t out_len;
+	/** Reserved (for 8 byte alignment) */
+	uint32_t rsvd;
+};
+
 /* This shared memory would be on the host side which have copy of some
  * of the parameters which are also part of Shared BD ring. Read access
  * of these parameters from the host side would not be over PCI.
@@ -14,7 +187,21 @@
 typedef struct host_ipc_params {
 	volatile uint32_t pi;
 	volatile uint32_t ci;
-	volatile uint32_t modem_ptr[IPC_MAX_DEPTH];
+	volatile uint32_t bd_m_modem_ptr[IPC_MAX_DEPTH];
 } __rte_packed host_ipc_params_t;
 
+struct hif_ipc_regs {
+	uint32_t ipc_mdata_offset;
+	uint32_t ipc_mdata_size;
+} __rte_packed;
+
+struct gul_hif {
+	uint32_t ver;
+	uint32_t hif_ver;
+	uint32_t status;
+	volatile uint32_t host_ready;
+	volatile uint32_t mod_ready;
+	struct hif_ipc_regs ipc_regs;
+} __rte_packed;
+
 #endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v6 6/9] baseband/la12xx: add enqueue and dequeue support
  2021-09-24  4:37 ` [dpdk-dev] [PATCH v6 0/9] baseband: add NXP LA12xx driver nipun.gupta
                     ` (4 preceding siblings ...)
  2021-09-24  4:37   ` [dpdk-dev] [PATCH v6 5/9] baseband/la12xx: add queue and modem config support nipun.gupta
@ 2021-09-24  4:37   ` nipun.gupta
  2021-09-24  4:37   ` [dpdk-dev] [PATCH v6 7/9] app/bbdev: enable la12xx for bbdev nipun.gupta
                     ` (2 subsequent siblings)
  8 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-09-24  4:37 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

From: Hemant Agrawal <hemant.agrawal@nxp.com>

Add support for enqueue and dequeue the LDPC enc/dec
from the modem device.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 doc/guides/bbdevs/features/la12xx.ini      |  13 +
 doc/guides/bbdevs/la12xx.rst               |  47 ++-
 drivers/baseband/la12xx/bbdev_la12xx.c     | 328 ++++++++++++++++++++-
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h |  37 +++
 4 files changed, 420 insertions(+), 5 deletions(-)
 create mode 100644 doc/guides/bbdevs/features/la12xx.ini

diff --git a/doc/guides/bbdevs/features/la12xx.ini b/doc/guides/bbdevs/features/la12xx.ini
new file mode 100644
index 0000000000..0aec5eecb6
--- /dev/null
+++ b/doc/guides/bbdevs/features/la12xx.ini
@@ -0,0 +1,13 @@
+;
+; Supported features of the 'la12xx' bbdev driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Turbo Decoder (4G)     = N
+Turbo Encoder (4G)     = N
+LDPC Decoder (5G)      = Y
+LDPC Encoder (5G)      = Y
+LLR/HARQ Compression   = N
+HW Accelerated         = Y
+BBDEV API              = Y
diff --git a/doc/guides/bbdevs/la12xx.rst b/doc/guides/bbdevs/la12xx.rst
index 3c9ac5c047..b111ec0dd6 100644
--- a/doc/guides/bbdevs/la12xx.rst
+++ b/doc/guides/bbdevs/la12xx.rst
@@ -16,10 +16,11 @@ Features
 
 LA12xx PMD supports the following features:
 
+- LDPC Encode in the DL
+- LDPC Decode in the UL
 - Maximum of 8 UL queues
 - Maximum of 8 DL queues
 - PCIe Gen-3 x8 Interface
-- MSI-X
 
 Installation
 ------------
@@ -79,3 +80,47 @@ For enabling logs, use the following EAL parameter:
 
 Using ``bb.la12xx`` as log matching criteria, all Baseband PMD logs can be
 enabled which are lower than logging ``level``.
+
+Test Application
+----------------
+
+BBDEV provides a test application, ``test-bbdev.py`` and range of test data for testing
+the functionality of LA12xx for FEC encode and decode, depending on the device
+capabilities. The test application is located under app->test-bbdev folder and has the
+following options:
+
+.. code-block:: console
+
+  "-p", "--testapp-path": specifies path to the bbdev test app.
+  "-e", "--eal-params"	: EAL arguments which are passed to the test app.
+  "-t", "--timeout"	: Timeout in seconds (default=300).
+  "-c", "--test-cases"	: Defines test cases to run. Run all if not specified.
+  "-v", "--test-vector"	: Test vector path (default=dpdk_path+/app/test-bbdev/test_vectors/bbdev_null.data).
+  "-n", "--num-ops"	: Number of operations to process on device (default=32).
+  "-b", "--burst-size"	: Operations enqueue/dequeue burst size (default=32).
+  "-s", "--snr"		: SNR in dB used when generating LLRs for bler tests.
+  "-s", "--iter_max"	: Number of iterations for LDPC decoder.
+  "-l", "--num-lcores"	: Number of lcores to run (default=16).
+  "-i", "--init-device" : Initialise PF device with default values.
+
+
+To execute the test application tool using simple decode or encode data,
+type one of the following:
+
+.. code-block:: console
+
+  ./test-bbdev.py -e="--vdev=baseband_la12xx,socket_id=0,max_nb_queues=8" -c validation -n 64 -b 1 -v ./ldpc_dec_default.data
+  ./test-bbdev.py -e="--vdev=baseband_la12xx,socket_id=0,max_nb_queues=8" -c validation -n 64 -b 1 -v ./ldpc_enc_default.data
+
+The test application ``test-bbdev.py``, supports the ability to configure the PF device with
+a default set of values, if the "-i" or "- -init-device" option is included. The default values
+are defined in test_bbdev_perf.c.
+
+
+Test Vectors
+~~~~~~~~~~~~
+
+In addition to the simple LDPC decoder and LDPC encoder tests, bbdev also provides
+a range of additional tests under the test_vectors folder, which may be useful. The results
+of these tests will depend on the LA12xx FEC capabilities which may cause some
+testcases to be skipped, but no failure should be reported.
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index c758fe3833..fa16660a77 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -122,6 +122,10 @@ la12xx_queue_release(struct rte_bbdev *dev, uint16_t q_id)
 		((uint64_t) ((unsigned long) (A) \
 		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
 
+#define MODEM_P2V(A) \
+	((uint64_t) ((unsigned long) (A) \
+		+ (unsigned long)(ipc_priv->peb_start.host_vaddr)))
+
 static int ipc_queue_configure(uint32_t channel_id,
 		ipc_t instance, struct bbdev_la12xx_q_priv *q_priv)
 {
@@ -336,6 +340,318 @@ static const struct rte_bbdev_ops pmd_ops = {
 	.queue_release = la12xx_queue_release,
 	.start = la12xx_start
 };
+
+static inline int
+is_bd_ring_full(uint32_t ci, uint32_t ci_flag,
+		uint32_t pi, uint32_t pi_flag)
+{
+	if (pi == ci) {
+		if (pi_flag != ci_flag)
+			return 1; /* Ring is Full */
+	}
+	return 0;
+}
+
+static inline int
+prepare_ldpc_enc_op(struct rte_bbdev_enc_op *bbdev_enc_op,
+		    struct bbdev_la12xx_q_priv *q_priv __rte_unused,
+		    struct rte_bbdev_op_data *in_op_data __rte_unused,
+		    struct rte_bbdev_op_data *out_op_data)
+{
+	struct rte_bbdev_op_ldpc_enc *ldpc_enc = &bbdev_enc_op->ldpc_enc;
+	uint32_t total_out_bits;
+
+	total_out_bits = (ldpc_enc->tb_params.cab *
+		ldpc_enc->tb_params.ea) + (ldpc_enc->tb_params.c -
+		ldpc_enc->tb_params.cab) * ldpc_enc->tb_params.eb;
+
+	ldpc_enc->output.length = (total_out_bits + 7)/8;
+
+	rte_pktmbuf_append(out_op_data->data, ldpc_enc->output.length);
+
+	return 0;
+}
+
+static inline int
+prepare_ldpc_dec_op(struct rte_bbdev_dec_op *bbdev_dec_op,
+		    struct bbdev_ipc_dequeue_op *bbdev_ipc_op,
+		    struct bbdev_la12xx_q_priv *q_priv  __rte_unused,
+		    struct rte_bbdev_op_data *out_op_data  __rte_unused)
+{
+	struct rte_bbdev_op_ldpc_dec *ldpc_dec = &bbdev_dec_op->ldpc_dec;
+	uint32_t total_out_bits;
+	uint32_t num_code_blocks = 0;
+	uint16_t sys_cols;
+
+	sys_cols = (ldpc_dec->basegraph == 1) ? 22 : 10;
+	if (ldpc_dec->tb_params.c == 1) {
+		total_out_bits = ((sys_cols * ldpc_dec->z_c) -
+				ldpc_dec->n_filler);
+		/* 5G-NR protocol uses 16 bit CRC when output packet
+		 * size <= 3824 (bits). Otherwise 24 bit CRC is used.
+		 * Adjust the output bits accordingly
+		 */
+		if (total_out_bits - 16 <= 3824)
+			total_out_bits -= 16;
+		else
+			total_out_bits -= 24;
+		ldpc_dec->hard_output.length = (total_out_bits / 8);
+	} else {
+		total_out_bits = (((sys_cols * ldpc_dec->z_c) -
+				ldpc_dec->n_filler - 24) *
+				ldpc_dec->tb_params.c);
+		ldpc_dec->hard_output.length = (total_out_bits / 8) - 3;
+	}
+
+	num_code_blocks = ldpc_dec->tb_params.c;
+
+	bbdev_ipc_op->num_code_blocks = rte_cpu_to_be_32(num_code_blocks);
+
+	return 0;
+}
+
+static int
+enqueue_single_op(struct bbdev_la12xx_q_priv *q_priv, void *bbdev_op)
+{
+	struct bbdev_la12xx_private *priv = q_priv->bbdev_priv;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	ipc_instance_t *ipc_instance = ipc_priv->instance;
+	struct bbdev_ipc_dequeue_op *bbdev_ipc_op;
+	struct rte_bbdev_op_ldpc_enc *ldpc_enc;
+	struct rte_bbdev_op_ldpc_dec *ldpc_dec;
+	uint32_t q_id = q_priv->q_id;
+	uint32_t ci, ci_flag, pi, pi_flag;
+	ipc_ch_t *ch = &(ipc_instance->ch_list[q_id]);
+	ipc_br_md_t *md = &(ch->md);
+	size_t virt;
+	char *huge_start_addr =
+		(char *)q_priv->bbdev_priv->ipc_priv->hugepg_start.host_vaddr;
+	struct rte_bbdev_op_data *in_op_data, *out_op_data;
+	char *data_ptr;
+	uint32_t l1_pcie_addr;
+	int ret;
+
+	ci = IPC_GET_CI_INDEX(q_priv->host_ci);
+	ci_flag = IPC_GET_CI_FLAG(q_priv->host_ci);
+
+	pi = IPC_GET_PI_INDEX(q_priv->host_pi);
+	pi_flag = IPC_GET_PI_FLAG(q_priv->host_pi);
+
+	rte_bbdev_dp_log(DEBUG, "before bd_ring_full: pi: %u, ci: %u,"
+		"pi_flag: %u, ci_flag: %u, ring size: %u",
+		pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	if (is_bd_ring_full(ci, ci_flag, pi, pi_flag)) {
+		rte_bbdev_dp_log(DEBUG, "bd ring full for queue id: %d", q_id);
+		return IPC_CH_FULL;
+	}
+
+	virt = MODEM_P2V(q_priv->host_params->bd_m_modem_ptr[pi]);
+	bbdev_ipc_op = (struct bbdev_ipc_dequeue_op *)virt;
+	q_priv->bbdev_op[pi] = bbdev_op;
+
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		ldpc_enc = &(((struct rte_bbdev_enc_op *)bbdev_op)->ldpc_enc);
+		in_op_data = &ldpc_enc->input;
+		out_op_data = &ldpc_enc->output;
+
+		ret = prepare_ldpc_enc_op(bbdev_op, q_priv,
+					  in_op_data, out_op_data);
+		if (ret) {
+			rte_bbdev_log(ERR, "process_ldpc_enc_op fail, ret: %d",
+				ret);
+			return ret;
+		}
+		break;
+
+	case RTE_BBDEV_OP_LDPC_DEC:
+		ldpc_dec = &(((struct rte_bbdev_dec_op *)bbdev_op)->ldpc_dec);
+		in_op_data = &ldpc_dec->input;
+
+		out_op_data = &ldpc_dec->hard_output;
+
+		ret = prepare_ldpc_dec_op(bbdev_op, bbdev_ipc_op,
+					  q_priv, out_op_data);
+		if (ret) {
+			rte_bbdev_log(ERR, "process_ldpc_dec_op fail, ret: %d",
+				ret);
+			return ret;
+		}
+		break;
+
+	default:
+		rte_bbdev_log(ERR, "unsupported bbdev_ipc op type");
+		return -1;
+	}
+
+	if (in_op_data->data) {
+		data_ptr = rte_pktmbuf_mtod(in_op_data->data, char *);
+		l1_pcie_addr = (uint32_t)GUL_USER_HUGE_PAGE_ADDR +
+			       data_ptr - huge_start_addr;
+		bbdev_ipc_op->in_addr = l1_pcie_addr;
+		bbdev_ipc_op->in_len = in_op_data->length;
+	}
+
+	if (out_op_data->data) {
+		data_ptr = rte_pktmbuf_mtod(out_op_data->data, char *);
+		l1_pcie_addr = (uint32_t)GUL_USER_HUGE_PAGE_ADDR +
+				data_ptr - huge_start_addr;
+		bbdev_ipc_op->out_addr = rte_cpu_to_be_32(l1_pcie_addr);
+		bbdev_ipc_op->out_len = rte_cpu_to_be_32(out_op_data->length);
+	}
+
+	/* Move Producer Index forward */
+	pi++;
+	/* Flip the PI flag, if wrapping */
+	if (unlikely(q_priv->queue_size == pi)) {
+		pi = 0;
+		pi_flag = pi_flag ? 0 : 1;
+	}
+
+	if (pi_flag)
+		IPC_SET_PI_FLAG(pi);
+	else
+		IPC_RESET_PI_FLAG(pi);
+	q_priv->host_pi = pi;
+
+	/* Wait for Data Copy & pi_flag update to complete before updating pi */
+	rte_mb();
+	/* now update pi */
+	md->pi = rte_cpu_to_be_32(pi);
+
+	rte_bbdev_dp_log(DEBUG, "enter: pi: %u, ci: %u,"
+			"pi_flag: %u, ci_flag: %u, ring size: %u",
+			pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	return 0;
+}
+
+/* Enqueue decode burst */
+static uint16_t
+enqueue_dec_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_dec_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	int nb_enqueued, ret;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ret = enqueue_single_op(q_priv, ops[nb_enqueued]);
+		if (ret)
+			break;
+	}
+
+	q_data->queue_stats.enqueue_err_count += nb_ops - nb_enqueued;
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
+/* Enqueue encode burst */
+static uint16_t
+enqueue_enc_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_enc_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	int nb_enqueued, ret;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ret = enqueue_single_op(q_priv, ops[nb_enqueued]);
+		if (ret)
+			break;
+	}
+
+	q_data->queue_stats.enqueue_err_count += nb_ops - nb_enqueued;
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
+/* Dequeue encode burst */
+static void *
+dequeue_single_op(struct bbdev_la12xx_q_priv *q_priv, void *dst)
+{
+	void *op;
+	uint32_t ci, ci_flag;
+	uint32_t temp_ci;
+
+	temp_ci = q_priv->host_params->ci;
+	if (temp_ci == q_priv->host_ci)
+		return NULL;
+
+	ci = IPC_GET_CI_INDEX(q_priv->host_ci);
+	ci_flag = IPC_GET_CI_FLAG(q_priv->host_ci);
+
+	rte_bbdev_dp_log(DEBUG,
+		"ci: %u, ci_flag: %u, ring size: %u",
+		ci, ci_flag, q_priv->queue_size);
+
+	op = q_priv->bbdev_op[ci];
+
+	rte_memcpy(dst, q_priv->msg_ch_vaddr[ci],
+		sizeof(struct bbdev_ipc_enqueue_op));
+
+	/* Move Consumer Index forward */
+	ci++;
+	/* Flip the CI flag, if wrapping */
+	if (q_priv->queue_size == ci) {
+		ci = 0;
+		ci_flag = ci_flag ? 0 : 1;
+	}
+	if (ci_flag)
+		IPC_SET_CI_FLAG(ci);
+	else
+		IPC_RESET_CI_FLAG(ci);
+
+	q_priv->host_ci = ci;
+
+	rte_bbdev_dp_log(DEBUG,
+		"exit: ci: %u, ci_flag: %u, ring size: %u",
+		ci, ci_flag, q_priv->queue_size);
+
+	return op;
+}
+
+/* Dequeue decode burst */
+static uint16_t
+dequeue_dec_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_dec_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	struct bbdev_ipc_enqueue_op bbdev_ipc_op;
+	int nb_dequeued;
+
+	for (nb_dequeued = 0; nb_dequeued < nb_ops; nb_dequeued++) {
+		ops[nb_dequeued] = dequeue_single_op(q_priv, &bbdev_ipc_op);
+		if (!ops[nb_dequeued])
+			break;
+		ops[nb_dequeued]->status = bbdev_ipc_op.status;
+	}
+	q_data->queue_stats.dequeued_count += nb_dequeued;
+
+	return nb_dequeued;
+}
+
+/* Dequeue encode burst */
+static uint16_t
+dequeue_enc_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_enc_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	struct bbdev_ipc_enqueue_op bbdev_ipc_op;
+	int nb_enqueued;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ops[nb_enqueued] = dequeue_single_op(q_priv, &bbdev_ipc_op);
+		if (!ops[nb_enqueued])
+			break;
+		ops[nb_enqueued]->status = bbdev_ipc_op.status;
+	}
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
 static struct hugepage_info *
 get_hugepage_info(void)
 {
@@ -709,10 +1025,14 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 	bbdev->intr_handle = NULL;
 
 	/* register rx/tx burst functions for data path */
-	bbdev->dequeue_enc_ops = NULL;
-	bbdev->dequeue_dec_ops = NULL;
-	bbdev->enqueue_enc_ops = NULL;
-	bbdev->enqueue_dec_ops = NULL;
+	bbdev->dequeue_enc_ops = dequeue_enc_ops;
+	bbdev->dequeue_dec_ops = dequeue_dec_ops;
+	bbdev->enqueue_enc_ops = enqueue_enc_ops;
+	bbdev->enqueue_dec_ops = enqueue_dec_ops;
+	bbdev->dequeue_ldpc_enc_ops = dequeue_enc_ops;
+	bbdev->dequeue_ldpc_dec_ops = dequeue_dec_ops;
+	bbdev->enqueue_ldpc_enc_ops = enqueue_enc_ops;
+	bbdev->enqueue_ldpc_dec_ops = enqueue_dec_ops;
 
 	return 0;
 }
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
index 5f613fb087..b6a7f677d0 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -73,6 +73,25 @@ typedef struct {
 	_IOWR(GUL_IPC_MAGIC, 5, struct ipc_msg *)
 #define IOCTL_GUL_IPC_CHANNEL_RAISE_INTERRUPT _IOW(GUL_IPC_MAGIC, 6, int *)
 
+#define GUL_USER_HUGE_PAGE_OFFSET	(0)
+#define GUL_PCI1_ADDR_BASE	(0x00000000ULL)
+
+#define GUL_USER_HUGE_PAGE_ADDR	(GUL_PCI1_ADDR_BASE + GUL_USER_HUGE_PAGE_OFFSET)
+
+/* IPC PI/CI index & flag manipulation helpers */
+#define IPC_PI_CI_FLAG_MASK	0x80000000 /*  (1<<31) */
+#define IPC_PI_CI_INDEX_MASK	0x7FFFFFFF /* ~(1<<31) */
+
+#define IPC_SET_PI_FLAG(x)	(x |= IPC_PI_CI_FLAG_MASK)
+#define IPC_RESET_PI_FLAG(x)	(x &= IPC_PI_CI_INDEX_MASK)
+#define IPC_GET_PI_FLAG(x)	(x >> 31)
+#define IPC_GET_PI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
+
+#define IPC_SET_CI_FLAG(x)	(x |= IPC_PI_CI_FLAG_MASK)
+#define IPC_RESET_CI_FLAG(x)	(x &= IPC_PI_CI_INDEX_MASK)
+#define IPC_GET_CI_FLAG(x)	(x >> 31)
+#define IPC_GET_CI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
+
 /** buffer ring common metadata */
 typedef struct ipc_bd_ring_md {
 	volatile uint32_t pi;		/**< Producer index and flag (MSB)
@@ -180,6 +199,24 @@ struct bbdev_ipc_enqueue_op {
 	uint32_t rsvd;
 };
 
+/** Structure specifying dequeue operation (dequeue at LA1224) */
+struct bbdev_ipc_dequeue_op {
+	/** Input buffer memory address */
+	uint32_t in_addr;
+	/** Input buffer memory length */
+	uint32_t in_len;
+	/** Output buffer memory address */
+	uint32_t out_addr;
+	/** Output buffer memory length */
+	uint32_t out_len;
+	/* Number of code blocks. Only set when HARQ is used */
+	uint32_t num_code_blocks;
+	/** Dequeue Operation flags */
+	uint32_t op_flags;
+	/** Shared metadata between L1 and L2 */
+	uint32_t shared_metadata;
+};
+
 /* This shared memory would be on the host side which have copy of some
  * of the parameters which are also part of Shared BD ring. Read access
  * of these parameters from the host side would not be over PCI.
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v6 7/9] app/bbdev: enable la12xx for bbdev
  2021-09-24  4:37 ` [dpdk-dev] [PATCH v6 0/9] baseband: add NXP LA12xx driver nipun.gupta
                     ` (5 preceding siblings ...)
  2021-09-24  4:37   ` [dpdk-dev] [PATCH v6 6/9] baseband/la12xx: add enqueue and dequeue support nipun.gupta
@ 2021-09-24  4:37   ` nipun.gupta
  2021-09-24  4:37   ` [dpdk-dev] [PATCH v6 8/9] app/bbdev: handle endianness of test data nipun.gupta
  2021-09-24  4:37   ` [dpdk-dev] [PATCH v6 9/9] app/bbdev: add test vectors for transport blocks nipun.gupta
  8 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-09-24  4:37 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal

From: Hemant Agrawal <hemant.agrawal@nxp.com>

this patch adds la12xx driver in test bbdev

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/test-bbdev/meson.build | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/app/test-bbdev/meson.build b/app/test-bbdev/meson.build
index edb9deef84..a726a5b3fa 100644
--- a/app/test-bbdev/meson.build
+++ b/app/test-bbdev/meson.build
@@ -23,3 +23,6 @@ endif
 if dpdk_conf.has('RTE_BASEBAND_ACC100')
     deps += ['baseband_acc100']
 endif
+if dpdk_conf.has('RTE_LIBRTE_PMD_BBDEV_LA12XX')
+	deps += ['baseband_la12xx']
+endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v6 8/9] app/bbdev: handle endianness of test data
  2021-09-24  4:37 ` [dpdk-dev] [PATCH v6 0/9] baseband: add NXP LA12xx driver nipun.gupta
                     ` (6 preceding siblings ...)
  2021-09-24  4:37   ` [dpdk-dev] [PATCH v6 7/9] app/bbdev: enable la12xx for bbdev nipun.gupta
@ 2021-09-24  4:37   ` nipun.gupta
  2021-09-24  4:37   ` [dpdk-dev] [PATCH v6 9/9] app/bbdev: add test vectors for transport blocks nipun.gupta
  8 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-09-24  4:37 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

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

With data input, output and harq also supported in big
endian format, this patch updates the testbbdev application
to handle the endianness conversion as directed by the
the driver being used.

If the driver supports big endian data processing, conversion
from little endian to big is handled by the testbbdev application.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 app/test-bbdev/test_bbdev_perf.c | 62 ++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c
index 469597b8b3..a0f565ee3f 100644
--- a/app/test-bbdev/test_bbdev_perf.c
+++ b/app/test-bbdev/test_bbdev_perf.c
@@ -227,6 +227,64 @@ clear_soft_out_cap(uint32_t *op_flags)
 	*op_flags &= ~RTE_BBDEV_TURBO_NEG_LLR_1_BIT_SOFT_OUT;
 }
 
+static inline void
+reverse_op(struct op_data_entries *op)
+{
+	uint8_t nb_segs = op->nb_segments;
+	uint32_t *data, len;
+	int complete, rem, i, j;
+	uint8_t *rem_data, temp;
+
+	/* Validate each mbuf segment length */
+	for (i = 0; i < nb_segs; ++i) {
+		len = op->segments[i].length;
+		data = op->segments[i].addr;
+
+		/* Swap complete u32 bytes */
+		complete = len / 4;
+		for (j = 0; j < complete; j++)
+			data[j] = rte_bswap32(data[j]);
+
+		/* Swap any remaining data for last seg */
+		if (i == (nb_segs - 1)) {
+			rem = len % 4;
+			rem_data = (uint8_t *)&data[j];
+			for (j = 0; j < rem/2; j++) {
+				temp = rem_data[j];
+				rem_data[j] = rem_data[rem - j - 1];
+				rem_data[rem - j - 1] = temp;
+			}
+		}
+	}
+}
+
+static inline void
+reverse_all_ops(void)
+{
+	unsigned int nb_inputs, nb_soft_outputs, nb_hard_outputs,
+		nb_harq_inputs, nb_harq_outputs;
+
+	nb_inputs = test_vector.entries[DATA_INPUT].nb_segments;
+	if (nb_inputs)
+		reverse_op(&test_vector.entries[DATA_INPUT]);
+
+	nb_soft_outputs = test_vector.entries[DATA_SOFT_OUTPUT].nb_segments;
+	if (nb_soft_outputs)
+		reverse_op(&test_vector.entries[DATA_SOFT_OUTPUT]);
+
+	nb_hard_outputs = test_vector.entries[DATA_HARD_OUTPUT].nb_segments;
+	if (nb_hard_outputs)
+		reverse_op(&test_vector.entries[DATA_HARD_OUTPUT]);
+
+	nb_harq_inputs  = test_vector.entries[DATA_HARQ_INPUT].nb_segments;
+	if (nb_harq_inputs)
+		reverse_op(&test_vector.entries[DATA_HARQ_INPUT]);
+
+	nb_harq_outputs = test_vector.entries[DATA_HARQ_OUTPUT].nb_segments;
+	if (nb_harq_outputs)
+		reverse_op(&test_vector.entries[DATA_HARQ_OUTPUT]);
+}
+
 static int
 check_dev_cap(const struct rte_bbdev_info *dev_info)
 {
@@ -234,6 +292,7 @@ check_dev_cap(const struct rte_bbdev_info *dev_info)
 	unsigned int nb_inputs, nb_soft_outputs, nb_hard_outputs,
 		nb_harq_inputs, nb_harq_outputs;
 	const struct rte_bbdev_op_cap *op_cap = dev_info->drv.capabilities;
+	uint8_t be_data = dev_info->drv.support_be_data;
 
 	nb_inputs = test_vector.entries[DATA_INPUT].nb_segments;
 	nb_soft_outputs = test_vector.entries[DATA_SOFT_OUTPUT].nb_segments;
@@ -245,6 +304,9 @@ check_dev_cap(const struct rte_bbdev_info *dev_info)
 		if (op_cap->type != test_vector.op_type)
 			continue;
 
+		if (be_data)
+			reverse_all_ops();
+
 		if (op_cap->type == RTE_BBDEV_OP_TURBO_DEC) {
 			const struct rte_bbdev_op_cap_turbo_dec *cap =
 					&op_cap->cap.turbo_dec;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v6 9/9] app/bbdev: add test vectors for transport blocks
  2021-09-24  4:37 ` [dpdk-dev] [PATCH v6 0/9] baseband: add NXP LA12xx driver nipun.gupta
                     ` (7 preceding siblings ...)
  2021-09-24  4:37   ` [dpdk-dev] [PATCH v6 8/9] app/bbdev: handle endianness of test data nipun.gupta
@ 2021-09-24  4:37   ` nipun.gupta
  8 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-09-24  4:37 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

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

This patch adds two test vectors for transport block in network byte
order:
- LDPC encode for Transport Block
- LDPC decode for Transport block

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 app/test-bbdev/test_vectors/ldpc_dec_tb.data | 265 +++++++++++++++++++
 app/test-bbdev/test_vectors/ldpc_enc_tb.data |  95 +++++++
 2 files changed, 360 insertions(+)
 create mode 100644 app/test-bbdev/test_vectors/ldpc_dec_tb.data
 create mode 100644 app/test-bbdev/test_vectors/ldpc_enc_tb.data

diff --git a/app/test-bbdev/test_vectors/ldpc_dec_tb.data b/app/test-bbdev/test_vectors/ldpc_dec_tb.data
new file mode 100644
index 0000000000..5882e8aafe
--- /dev/null
+++ b/app/test-bbdev/test_vectors/ldpc_dec_tb.data
@@ -0,0 +1,265 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2021 NXP
+
+op_type =
+RTE_BBDEV_OP_LDPC_DEC
+
+input0 =
+0x7f818181, 0x7f7f817f, 0x7f817f81, 0x817f8181, 0x817f7f81, 0x817f7f81, 0x7f817f7f, 0x7f7f7f81,
+0x7f7f7f7f, 0x817f7f7f, 0x7f7f8181, 0x817f7f7f, 0x7f7f817f, 0x8181817f, 0x817f7f81, 0x7f7f8181,
+0x81817f81, 0x7f7f7f81, 0x81817f7f, 0x7f81817f, 0x817f7f81, 0x7f817f81, 0x8181817f, 0x7f7f7f81,
+0x7f7f817f, 0x81817f7f, 0x7f81817f, 0x7f7f817f, 0x817f817f, 0x7f7f817f, 0x7f7f7f81, 0x7f7f7f81,
+0x7f817f7f, 0x7f818181, 0x7f818181, 0x8181817f, 0x7f7f8181, 0x7f7f7f7f, 0x7f817f7f, 0x81818181,
+0x7f7f817f, 0x7f7f7f7f, 0x817f8181, 0x7f7f7f81, 0x817f817f, 0x817f8181, 0x81817f7f, 0x7f7f7f7f,
+0x81817f7f, 0x7f81817f, 0x817f7f7f, 0x817f7f81, 0x7f817f7f, 0x817f817f, 0x81817f81, 0x817f7f7f,
+0x817f7f81, 0x817f817f, 0x8181817f, 0x81818181, 0x81818181, 0x817f7f7f, 0x7f817f81, 0x817f7f7f,
+0x7f817f7f, 0x7f817f7f, 0x7f818181, 0x7f818181, 0x817f817f, 0x81817f81, 0x7f81817f, 0x817f817f,
+0x7f81817f, 0x817f7f81, 0x7f7f817f, 0x817f8181, 0x817f7f81, 0x81817f7f, 0x8181817f, 0x7f7f7f7f,
+0x817f7f81, 0x7f81817f, 0x7f7f7f7f, 0x7f817f81, 0x7f817f81, 0x817f7f7f, 0x81818181, 0x7f7f8181,
+0x7f818181, 0x81817f7f, 0x7f817f81, 0x7f81817f, 0x7f7f8181, 0x7f7f817f, 0x7f7f817f, 0x81817f81,
+0x7f818181, 0x8181817f, 0x7f817f81, 0x7f7f8181, 0x7f7f8181, 0x817f7f81, 0x7f7f7f7f, 0x7f817f7f,
+0x7f7f8181, 0x7f817f7f, 0x7f818181, 0x81817f7f, 0x817f7f7f, 0x81817f81, 0x7f817f7f, 0x7f81817f,
+0x7f81817f, 0x817f7f81, 0x7f817f7f, 0x817f817f, 0x7f7f817f, 0x817f7f81, 0x817f817f, 0x817f8181,
+0x817f817f, 0x7f817f7f, 0x7f817f7f, 0x8181817f, 0x7f818181, 0x7f817f7f, 0x7f818181, 0x7f7f817f,
+0x817f8181, 0x8181817f, 0x7f817f7f, 0x7f7f817f, 0x7f7f817f, 0x7f7f8181, 0x817f7f7f, 0x817f8181,
+0x7f7f817f, 0x7f7f7f81, 0x817f7f81, 0x7f7f7f81, 0x7f7f7f7f, 0x817f8181, 0x81818181, 0x81817f81,
+0x817f7f81, 0x7f7f817f, 0x7f817f7f, 0x7f7f8181, 0x7f7f7f81, 0x7f817f81, 0x817f8181, 0x81817f7f,
+0x7f7f817f, 0x7f817f81, 0x7f817f81, 0x7f7f7f81, 0x81818181, 0x81817f7f, 0x7f7f817f, 0x7f817f81,
+0x7f7f8181, 0x7f81817f, 0x817f8181, 0x7f7f8181, 0x7f7f7f81, 0x8181817f, 0x7f817f81, 0x81817f7f,
+0x817f7f81, 0x817f8181, 0x817f7f7f, 0x7f7f817f, 0x817f7f7f, 0x81817f81, 0x7f7f7f7f, 0x817f7f7f,
+0x817f7f81, 0x7f817f81, 0x8181817f, 0x81817f7f, 0x817f7f81, 0x7f818181, 0x7f7f817f, 0x7f818181,
+0x7f7f7f7f, 0x7f7f8181, 0x7f7f817f, 0x7f817f81, 0x817f7f7f, 0x817f817f, 0x7f7f7f81, 0x7f7f7f81,
+0x7f7f817f, 0x817f8181, 0x81817f81, 0x817f7f7f, 0x7f7f7f81, 0x817f7f7f, 0x7f7f7f7f, 0x7f7f817f,
+0x81817f81, 0x7f7f7f81, 0x81817f7f, 0x81818181, 0x817f7f81, 0x817f817f, 0x817f7f7f, 0x7f7f7f7f,
+0x7f81817f, 0x8181817f, 0x7f7f817f, 0x817f7f81, 0x7f81817f, 0x817f7f81, 0x7f7f817f, 0x7f818181,
+0x817f7f7f, 0x817f7f81, 0x81817f81, 0x81817f81, 0x8181817f, 0x7f817f7f, 0x7f7f7f81, 0x8181817f,
+0x7f817f81, 0x8181817f, 0x7f7f7f81, 0x817f8181, 0x817f7f81, 0x81817f81, 0x7f7f817f, 0x7f7f817f,
+0x817f7f7f, 0x817f8181, 0x7f817f7f, 0x817f7f81, 0x7f7f7f81, 0x7f7f7f7f, 0x817f8181, 0x7f817f81,
+0x81817f81, 0x7f7f7f81, 0x817f7f7f, 0x817f817f, 0x81817f7f, 0x817f7f81, 0x7f81817f, 0x817f817f,
+0x81817f81, 0x8181817f, 0x7f818181, 0x7f81817f, 0x8181817f, 0x817f7f7f, 0x7f817f7f, 0x8181817f,
+0x7f7f7f7f, 0x81817f7f, 0x7f7f7f81, 0x817f7f81, 0x7f7f7f81, 0x7f817f7f, 0x7f7f7f7f, 0x817f7f81,
+0x7f818181, 0x817f7f7f, 0x7f7f7f81, 0x817f7f7f, 0x81818181, 0x81817f7f, 0x7f817f81, 0x7f7f7f81,
+0x7f818181, 0x817f8181, 0x81817f81, 0x8181817f, 0x7f7f8181, 0x817f7f81, 0x7f81817f, 0x7f7f817f,
+0x7f7f8181, 0x7f817f7f, 0x8181817f, 0x7f817f81, 0x7f817f7f, 0x7f7f8181, 0x7f818181, 0x7f7f8181,
+0x817f7f81, 0x81817f81, 0x7f81817f, 0x81817f81, 0x817f7f7f, 0x7f818181, 0x8181817f, 0x817f8181,
+0x7f7f7f81, 0x7f81817f, 0x81817f7f, 0x7f817f81, 0x7f7f817f, 0x7f7f8181, 0x7f81817f, 0x7f81817f,
+0x7f818181, 0x817f7f7f, 0x817f8181, 0x7f7f8181, 0x8181817f, 0x7f817f81, 0x817f8181, 0x817f817f,
+0x7f7f817f, 0x81817f81, 0x7f817f7f, 0x7f81817f, 0x817f817f, 0x81817f81, 0x7f7f7f7f, 0x8181817f,
+0x7f817f81, 0x7f817f7f, 0x7f817f81, 0x7f817f7f, 0x7f7f7f81, 0x817f817f, 0x7f81817f, 0x817f7f81,
+0x81818181, 0x7f817f81, 0x7f7f7f81, 0x7f81817f, 0x817f7f7f, 0x817f7f81, 0x817f7f7f, 0x81817f81,
+0x7f7f817f, 0x817f8181, 0x81818181, 0x81817f81, 0x81817f81, 0x81817f7f, 0x81817f7f, 0x7f817f81,
+0x7f817f7f, 0x7f7f7f81, 0x7f81817f, 0x817f7f81, 0x817f8181, 0x817f7f81, 0x7f817f81, 0x81818181,
+0x7f7f7f7f, 0x817f8181, 0x817f817f, 0x81818181, 0x81817f7f, 0x7f81817f, 0x81817f81, 0x81818181,
+0x7f7f7f81, 0x81817f81, 0x81818181, 0x817f7f7f, 0x817f817f, 0x81818181, 0x7f7f7f7f, 0x7f7f817f,
+0x7f817f81, 0x8181817f, 0x81817f81, 0x7f7f7f7f, 0x7f7f817f, 0x81817f7f, 0x817f817f, 0x7f7f7f81,
+0x81818181, 0x7f7f817f, 0x81818181, 0x7f81817f, 0x7f7f7f7f, 0x817f8181, 0x7f81817f, 0x817f7f7f,
+0x8181817f, 0x8181817f, 0x817f7f7f, 0x7f7f817f, 0x7f81817f, 0x7f817f81, 0x81817f7f, 0x817f7f7f,
+0x81818181, 0x81817f7f, 0x7f81817f, 0x8181817f, 0x817f8181, 0x81817f7f, 0x7f818181, 0x7f7f7f7f,
+0x81818181, 0x8181817f, 0x7f81817f, 0x8181817f, 0x7f7f7f7f, 0x7f817f81, 0x7f7f8181, 0x817f8181,
+0x8181817f, 0x81817f7f, 0x7f817f7f, 0x81818181, 0x7f7f8181, 0x817f817f, 0x7f7f8181, 0x817f7f7f,
+0x81817f7f, 0x81818181, 0x817f7f7f, 0x7f7f817f, 0x81818181, 0x7f817f7f, 0x817f7f7f, 0x7f818181,
+0x7f817f81, 0x7f817f7f, 0x817f817f, 0x8181817f, 0x7f7f8181, 0x817f8181, 0x817f7f7f, 0x817f817f,
+0x7f7f817f, 0x7f7f7f7f, 0x7f817f7f, 0x7f7f7f81, 0x81817f81, 0x8181817f, 0x81818181, 0x7f818181,
+0x817f817f, 0x7f818181, 0x7f81817f, 0x7f817f81, 0x7f817f7f, 0x7f81817f, 0x817f8181, 0x81818181,
+0x7f7f7f7f, 0x7f817f81, 0x7f817f7f, 0x8181817f, 0x817f817f, 0x7f817f7f, 0x817f817f, 0x81818181,
+0x7f7f8181, 0x81817f81, 0x817f7f7f, 0x817f7f81, 0x8181817f, 0x817f7f7f, 0x817f7f81, 0x7f817f81,
+0x817f817f, 0x817f817f, 0x81817f81, 0x817f8181, 0x817f817f, 0x7f7f8181, 0x7f7f8181, 0x7f7f817f,
+0x817f7f81, 0x817f8181, 0x7f7f817f, 0x7f7f817f, 0x7f7f8181, 0x7f81817f, 0x7f7f7f7f, 0x7f7f7f7f,
+0x7f7f7f81, 0x7f817f81, 0x7f817f7f, 0x817f8181, 0x817f8181, 0x7f81817f, 0x817f7f7f, 0x7f818181,
+0x7f817f7f, 0x7f817f81, 0x81817f7f, 0x817f7f81, 0x8181817f, 0x817f7f81, 0x7f818181, 0x817f7f81,
+0x7f818181, 0x817f7f7f, 0x7f818181, 0x7f7f8181, 0x81817f81, 0x817f7f7f, 0x7f7f817f, 0x817f7f81,
+0x817f817f, 0x7f817f81, 0x817f8181, 0x817f8181, 0x7f7f7f81, 0x7f817f7f, 0x81817f81, 0x7f7f8181,
+0x81817f7f, 0x817f7f7f, 0x7f817f7f, 0x817f8181, 0x817f817f, 0x7f81817f, 0x7f818181, 0x817f817f,
+0x7f7f7f7f, 0x7f817f81, 0x7f7f817f, 0x7f818181, 0x81817f81, 0x7f817f81, 0x817f7f7f, 0x7f7f7f7f,
+0x7f7f7f7f, 0x817f7f81, 0x7f7f8181, 0x81817f7f, 0x7f817f81, 0x817f817f, 0x7f7f8181, 0x7f817f7f,
+0x7f7f7f81, 0x817f817f, 0x8181817f, 0x7f81817f, 0x81817f81, 0x7f7f817f, 0x7f818181, 0x8181817f,
+0x7f818181, 0x7f7f7f7f, 0x7f7f8181, 0x817f7f7f, 0x7f7f817f, 0x7f817f7f, 0x81817f81, 0x7f7f817f,
+0x817f7f81, 0x7f817f81, 0x7f7f7f7f, 0x7f818181, 0x81817f7f, 0x817f8181, 0x7f817f7f, 0x7f7f817f,
+0x817f817f, 0x7f7f817f, 0x7f7f8181, 0x81818181, 0x817f7f7f, 0x7f81817f, 0x81818181, 0x817f817f,
+0x817f7f81, 0x7f817f7f, 0x817f7f7f, 0x8181817f, 0x7f7f7f7f, 0x81818181, 0x7f817f81, 0x7f817f7f,
+0x817f7f7f, 0x817f7f7f, 0x7f7f8181, 0x7f81817f, 0x7f818181, 0x7f7f817f, 0x7f81817f, 0x7f7f7f7f,
+0x817f7f7f, 0x81818181, 0x817f7f81, 0x817f8181, 0x7f81817f, 0x8181817f, 0x8181817f, 0x817f7f81,
+0x7f7f817f, 0x7f81817f, 0x7f7f7f7f, 0x81817f81, 0x7f7f817f, 0x7f817f81, 0x81818181, 0x7f7f817f,
+0x7f817f7f, 0x81818181, 0x81817f81, 0x817f7f7f, 0x7f817f7f, 0x817f7f81, 0x8181817f, 0x7f7f7f7f,
+0x7f817f7f, 0x81817f7f, 0x817f8181, 0x817f8181, 0x7f818181, 0x817f8181, 0x7f818181, 0x7f7f817f,
+0x817f8181, 0x7f7f817f, 0x7f7f817f, 0x81818181, 0x81817f81, 0x7f7f7f81, 0x817f817f, 0x7f7f7f7f,
+0x7f7f7f7f, 0x81818181, 0x7f7f7f81, 0x7f818181, 0x7f7f8181, 0x7f7f7f7f, 0x81817f81, 0x7f817f7f,
+0x8181817f, 0x7f817f7f, 0x817f7f7f, 0x7f817f81, 0x8181817f, 0x7f7f817f, 0x817f7f7f, 0x7f7f7f7f,
+0x8181817f, 0x7f81817f, 0x7f7f817f, 0x7f7f7f7f, 0x8181817f, 0x7f7f7f7f, 0x8181817f, 0x7f817f81,
+0x81818181, 0x7f7f7f7f, 0x817f8181, 0x81818181, 0x7f7f817f, 0x7f817f7f, 0x817f8181, 0x7f7f8181,
+0x8181817f, 0x7f7f7f7f, 0x81817f7f, 0x7f7f817f, 0x817f7f7f, 0x7f817f7f, 0x817f817f, 0x7f7f817f,
+0x81818181, 0x81818181, 0x7f7f7f81, 0x81818181, 0x817f7f81, 0x7f7f8181, 0x81818181, 0x7f7f7f81,
+0x7f81817f, 0x817f817f, 0x817f8181, 0x8181817f, 0x7f7f8181, 0x7f817f81, 0x817f817f, 0x817f8181,
+0x81818181, 0x7f818181, 0x817f7f81, 0x8181817f, 0x7f817f81, 0x81817f7f, 0x81817f81, 0x81817f81,
+0x817f7f81, 0x7f817f7f, 0x7f817f7f, 0x81818181, 0x7f817f7f, 0x7f7f8181, 0x817f817f, 0x7f7f7f7f,
+0x7f81817f, 0x7f81817f, 0x817f817f, 0x7f7f7f7f, 0x8181817f, 0x7f817f81, 0x817f8181, 0x7f7f8181,
+0x817f7f7f, 0x81818181, 0x8181817f, 0x817f7f81, 0x7f818181, 0x7f7f7f81, 0x7f81817f, 0x817f7f81,
+0x81817f7f, 0x8181817f, 0x81818181, 0x7f818181, 0x7f818181, 0x81817f7f, 0x7f81817f, 0x81818181,
+0x81817f7f, 0x81817f7f, 0x817f7f7f, 0x7f81817f, 0x81817f7f, 0x8181817f, 0x81818181, 0x81818181,
+0x7f817f81, 0x7f817f81, 0x817f7f81, 0x81817f81, 0x7f7f817f, 0x81817f81, 0x817f7f81, 0x817f817f,
+0x81817f7f, 0x81817f81, 0x7f7f817f, 0x81818181, 0x7f7f7f81, 0x81817f81, 0x7f7f8181, 0x817f7f81,
+0x817f7f7f, 0x81818181, 0x817f817f, 0x7f818181, 0x817f8181, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f817f,
+0x7f81817f, 0x8181817f, 0x81817f7f, 0x7f7f8181, 0x81817f81, 0x81818181, 0x817f817f, 0x8181817f,
+0x7f7f7f7f, 0x7f7f8181, 0x7f81817f, 0x7f7f7f81, 0x7f7f7f7f, 0x7f7f7f7f, 0x81817f81, 0x817f7f7f,
+0x7f7f8181, 0x817f7f7f, 0x7f817f81, 0x817f8181, 0x817f8181, 0x817f8181, 0x81817f81, 0x81817f7f,
+0x7f818181, 0x7f7f7f7f, 0x7f7f817f, 0x817f8181, 0x7f7f7f81, 0x7f7f817f, 0x7f7f7f81, 0x7f817f81,
+0x81817f7f, 0x817f817f, 0x817f7f81, 0x81818181, 0x7f7f817f, 0x7f817f81, 0x817f7f7f, 0x7f81817f,
+0x7f817f81, 0x817f817f, 0x817f7f7f, 0x81817f7f, 0x7f818181, 0x7f7f7f81, 0x817f7f81, 0x81817f81,
+0x7f7f7f81, 0x817f7f81, 0x817f7f81, 0x817f8181, 0x7f817f81, 0x7f81817f, 0x7f7f817f, 0x81817f81,
+0x8181817f, 0x81817f81, 0x7f81817f, 0x817f7f81, 0x7f817f81, 0x7f818181, 0x7f7f7f81, 0x817f8181,
+0x7f7f8181, 0x7f81817f, 0x81818181, 0x7f7f817f, 0x7f818181, 0x81818181, 0x7f81817f, 0x7f818181,
+0x817f817f, 0x81818181, 0x7f7f7f81, 0x7f7f7f7f, 0x8181817f, 0x817f7f81, 0x817f7f81, 0x7f7f7f7f,
+0x817f8181, 0x817f7f81, 0x81818181, 0x81817f7f, 0x7f7f8181, 0x8181817f, 0x817f8181, 0x817f817f,
+0x817f817f, 0x8181817f, 0x7f818181, 0x817f7f81, 0x81817f81, 0x817f817f, 0x7f7f8181, 0x7f817f7f,
+0x81817f81, 0x817f7f7f, 0x7f7f817f, 0x7f817f81, 0x7f817f7f, 0x817f817f, 0x81818181, 0x7f818181,
+0x81817f7f, 0x7f818181, 0x8181817f, 0x817f7f81, 0x7f7f7f81, 0x7f81817f, 0x7f817f81, 0x81817f7f,
+0x7f7f7f81, 0x81817f7f, 0x81817f7f, 0x817f7f81, 0x817f8181, 0x8181817f, 0x817f817f, 0x7f7f7f81,
+0x7f7f817f, 0x7f81817f, 0x8181817f, 0x7f81817f, 0x7f817f81, 0x81818181, 0x7f817f81, 0x7f7f7f7f,
+0x7f818181, 0x81817f7f, 0x817f8181, 0x81817f7f, 0x817f817f, 0x7f7f7f81, 0x817f7f81, 0x7f817f81,
+0x81817f81, 0x7f817f7f, 0x8181817f, 0x7f818181, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f8181, 0x7f7f8181,
+0x817f817f, 0x81817f81, 0x817f7f7f, 0x817f7f7f, 0x817f7f7f, 0x8181817f, 0x81818181, 0x81818181,
+0x8181817f, 0x7f817f7f, 0x81817f7f, 0x7f7f8181, 0x817f7f81, 0x7f81817f, 0x7f7f817f, 0x81817f81,
+0x817f7f81, 0x81817f81, 0x7f817f81, 0x817f7f7f, 0x81817f81, 0x7f81817f, 0x7f818181, 0x81817f81,
+0x7f7f817f, 0x7f7f7f81, 0x7f7f817f, 0x7f7f7f7f, 0x817f7f81, 0x81817f7f, 0x7f81817f, 0x7f7f7f7f,
+0x7f81817f, 0x7f817f7f, 0x817f7f81, 0x81817f7f, 0x7f7f7f81, 0x7f7f7f7f, 0x817f8181, 0x7f7f7f81,
+0x7f7f8181, 0x7f81817f, 0x81818181, 0x7f7f7f7f, 0x81817f7f, 0x7f7f817f, 0x8181817f, 0x81818181,
+0x81817f81, 0x817f7f7f, 0x81818181, 0x817f8181, 0x7f7f8181, 0x7f81817f, 0x817f7f81, 0x7f7f7f81,
+0x7f817f7f, 0x81818181, 0x7f7f817f, 0x817f7f81, 0x817f7f81, 0x81817f7f, 0x7f817f81, 0x7f817f7f,
+0x81817f7f, 0x81818181, 0x8181817f, 0x7f7f8181, 0x7f817f81, 0x81817f81, 0x81817f7f, 0x817f7f81,
+0x817f7f81, 0x7f818181, 0x7f818181, 0x817f8181, 0x7f81817f, 0x7f7f817f, 0x7f817f81, 0x7f81817f,
+0x7f817f7f, 0x817f8181, 0x7f7f817f, 0x81817f7f, 0x817f7f81, 0x7f818181, 0x81817f7f, 0x7f817f81,
+0x7f7f817f, 0x817f7f81, 0x8181817f, 0x81817f7f, 0x7f7f7f81, 0x7f7f817f, 0x7f7f7f81, 0x7f81817f,
+0x7f81817f, 0x7f818181, 0x7f7f817f, 0x7f7f817f, 0x7f81817f, 0x7f7f8181, 0x817f7f7f, 0x7f7f7f7f,
+0x7f7f7f81, 0x7f818181, 0x81817f7f, 0x817f8181, 0x7f81817f, 0x7f7f7f7f, 0x7f7f7f7f, 0x817f7f7f,
+0x81817f7f, 0x7f7f8181, 0x817f8181, 0x7f81817f, 0x7f7f8181, 0x81817f7f, 0x8181817f, 0x81818181,
+0x81817f7f, 0x7f817f7f, 0x817f8181, 0x817f7f81, 0x7f818181, 0x7f7f817f, 0x817f7f81, 0x7f7f817f,
+0x817f7f7f, 0x7f81817f, 0x7f7f7f7f, 0x7f817f81, 0x7f817f7f, 0x817f817f, 0x7f818181, 0x7f818181,
+0x81817f7f, 0x81817f7f, 0x7f817f81, 0x81817f7f, 0x8181817f, 0x7f7f8181, 0x817f7f7f, 0x7f81817f,
+0x81817f81, 0x817f7f81, 0x8181817f, 0x81817f7f, 0x7f7f7f81, 0x7f817f7f, 0x817f7f81, 0x7f817f7f,
+0x7f817f7f, 0x81818181, 0x7f7f8181, 0x7f7f8181, 0x7f7f7f7f, 0x7f818181, 0x7f7f7f7f, 0x7f7f7f7f,
+0x7f817f81, 0x7f7f7f7f, 0x7f7f817f, 0x7f81817f, 0x7f7f8181, 0x817f7f81, 0x7f817f7f, 0x7f7f817f,
+0x81818181, 0x7f81817f, 0x7f7f7f7f, 0x7f817f7f, 0x7f81817f, 0x7f817f81, 0x81818181, 0x7f7f7f81,
+0x7f81817f, 0x7f7f8181, 0x7f7f817f, 0x7f7f8181, 0x7f81817f, 0x81817f7f, 0x7f7f817f, 0x7f81817f,
+0x817f817f, 0x817f817f, 0x7f7f8181, 0x817f7f81, 0x7f7f8181, 0x7f817f7f, 0x7f7f8181, 0x817f817f,
+0x817f7f7f, 0x81817f81, 0x8181817f, 0x817f8181, 0x8181817f, 0x817f817f, 0x7f818181, 0x817f817f,
+0x7f7f7f81, 0x7f818181, 0x7f7f7f7f, 0x7f7f817f, 0x817f8181, 0x7f817f81, 0x7f818181, 0x81818181,
+0x7f81817f, 0x817f7f7f, 0x7f7f8181, 0x81817f81, 0x81817f7f, 0x817f817f, 0x7f7f817f, 0x817f7f7f,
+0x81818181, 0x817f817f, 0x8181817f, 0x7f7f7f7f, 0x81818181, 0x7f81817f, 0x7f7f817f, 0x8181817f,
+0x7f817f81, 0x7f7f817f, 0x81817f81, 0x817f817f, 0x7f7f7f7f, 0x7f817f7f, 0x81817f81, 0x7f7f7f81,
+0x7f818181, 0x7f7f8181, 0x7f817f81, 0x7f7f8181, 0x81817f7f, 0x7f817f7f, 0x817f7f7f, 0x81817f7f,
+0x81818181, 0x7f817f7f, 0x81817f7f, 0x817f7f81, 0x8181817f, 0x7f818181, 0x7f7f817f, 0x7f817f81,
+0x7f817f7f, 0x7f7f7f81, 0x7f7f8181, 0x817f8181, 0x81817f7f, 0x7f7f7f81, 0x817f7f7f, 0x7f7f8181,
+0x7f818181, 0x8181817f, 0x7f7f8181, 0x81817f81, 0x81818181, 0x7f7f8181, 0x817f8181, 0x81817f7f,
+0x7f7f7f81, 0x817f7f81, 0x7f7f817f, 0x7f818181, 0x7f817f81, 0x7f7f8181, 0x7f817f7f, 0x7f7f817f,
+0x7f818181, 0x7f81817f, 0x81817f7f, 0x7f7f7f81, 0x81818181, 0x817f7f7f, 0x817f7f7f, 0x7f817f81,
+0x81818181, 0x8181817f, 0x817f817f, 0x7f818181, 0x7f7f817f, 0x7f818181, 0x817f8181, 0x8181817f,
+0x7f7f7f81, 0x7f7f8181, 0x7f818181, 0x817f7f81, 0x7f818181, 0x8181817f, 0x7f7f7f7f, 0x7f7f817f,
+0x81817f81, 0x7f81817f, 0x7f81817f, 0x817f7f7f, 0x817f7f7f, 0x817f7f81, 0x817f7f81, 0x7f817f7f,
+0x7f817f7f, 0x7f818181, 0x81817f81, 0x8181817f, 0x7f7f8181, 0x817f7f7f, 0x8181817f, 0x81817f81,
+0x817f817f, 0x81818181, 0x7f7f817f, 0x7f7f8181, 0x7f81817f, 0x817f8181, 0x7f7f817f, 0x817f7f7f,
+0x81817f7f, 0x817f8181, 0x7f7f8181, 0x7f7f8181, 0x8181817f, 0x81817f81, 0x7f7f7f81, 0x7f818181,
+0x7f81817f, 0x8181817f, 0x7f7f7f81, 0x7f817f81, 0x7f818181, 0x817f7f81, 0x7f81817f, 0x817f8181,
+0x7f7f8181, 0x7f817f7f, 0x7f7f7f7f, 0x81818181, 0x81818181, 0x7f7f7f7f, 0x817f817f, 0x7f7f8181,
+0x7f81817f, 0x8181817f, 0x817f7f7f, 0x7f817f81, 0x7f817f7f, 0x7f818181, 0x7f817f81, 0x8181817f,
+0x7f817f7f, 0x817f7f81, 0x7f817f7f, 0x7f817f81, 0x81817f7f, 0x817f817f, 0x817f817f, 0x81817f81,
+0x7f7f8181, 0x8181817f, 0x7f7f817f, 0x7f7f7f7f, 0x81817f81, 0x817f8181, 0x7f817f81, 0x7f818181,
+0x817f7f81, 0x7f7f817f, 0x81817f7f, 0x7f7f7f7f, 0x7f81817f, 0x7f7f7f81, 0x817f8181, 0x8181817f,
+0x7f817f7f, 0x817f817f, 0x7f817f7f, 0x7f817f81, 0x817f8181, 0x817f7f7f, 0x7f81817f, 0x817f8181,
+0x81817f7f, 0x8181817f, 0x817f7f81, 0x7f817f7f, 0x7f81817f, 0x7f818181, 0x817f7f81, 0x817f7f81,
+0x81817f81, 0x81817f81, 0x81817f7f, 0x7f81817f, 0x81817f7f, 0x7f817f81, 0x817f7f7f, 0x81818181,
+0x7f7f817f, 0x81817f7f, 0x817f817f, 0x7f817f7f, 0x817f8181, 0x81818181, 0x817f8181, 0x817f7f81,
+0x7f7f7f7f, 0x7f817f81, 0x817f7f81, 0x7f817f7f, 0x817f7f81, 0x7f7f7f81, 0x7f817f81, 0x7f7f8181,
+0x7f7f7f81, 0x7f817f7f, 0x817f7f7f, 0x817f7f7f, 0x81817f7f, 0x817f7f81, 0x7f818181, 0x7f817f7f,
+0x7f817f7f, 0x8181817f, 0x81817f7f, 0x7f817f81, 0x81818181, 0x81817f81, 0x81818181, 0x7f817f7f,
+0x7f817f81, 0x81818181, 0x8181817f, 0x81817f7f, 0x817f7f7f, 0x7f818181, 0x7f7f8181, 0x7f818181,
+0x8181817f, 0x7f817f81, 0x7f7f7f81, 0x8181817f, 0x817f7f7f, 0x7f7f817f, 0x7f817f7f, 0x7f817f7f,
+0x7f817f7f, 0x7f817f81, 0x817f7f81, 0x817f7f7f, 0x817f817f, 0x817f817f, 0x817f7f7f, 0x817f8181,
+0x7f7f7f7f, 0x7f817f81, 0x817f817f, 0x7f817f7f, 0x7f817f81, 0x81817f81, 0x7f7f7f7f, 0x817f7f81,
+0x7f818181, 0x7f81817f, 0x817f7f7f, 0x81818181, 0x817f8181, 0x81817f7f, 0x7f7f8181, 0x7f7f8181,
+0x7f817f81, 0x81817f81, 0x817f7f81, 0x81818181, 0x8181817f, 0x7f7f8181, 0x81818181, 0x817f7f81,
+0x7f817f81, 0x817f7f7f, 0x81818181, 0x7f81817f, 0x7f7f8181, 0x817f7f81, 0x8181817f, 0x7f818181,
+0x817f8181, 0x7f7f7f7f, 0x8181817f, 0x817f817f, 0x817f8181, 0x81817f81, 0x817f817f, 0x7f817f81,
+0x7f7f8181, 0x817f7f81, 0x81818181, 0x7f817f81, 0x817f8181, 0x7f7f7f7f, 0x8181817f, 0x7f7f8181,
+0x817f817f, 0x81817f7f, 0x7f817f81, 0x7f817f7f, 0x7f818181, 0x7f7f7f7f, 0x7f7f817f, 0x7f81817f,
+0x817f7f81, 0x817f817f, 0x7f7f8181, 0x7f7f7f81, 0x817f8181, 0x81818181, 0x8181817f, 0x7f7f8181,
+0x7f817f7f, 0x7f7f7f81, 0x7f7f7f81, 0x7f7f7f7f, 0x81818181, 0x7f7f8181, 0x817f7f81, 0x81817f7f,
+0x7f7f7f7f, 0x817f7f81, 0x7f817f81, 0x81818181, 0x7f817f81, 0x7f7f7f7f, 0x8181817f, 0x7f7f7f81,
+0x7f817f7f, 0x817f8181, 0x7f7f8181, 0x817f8181, 0x7f7f817f, 0x817f8181, 0x817f7f81, 0x81818181,
+0x7f7f8181, 0x81818181, 0x7f7f817f, 0x817f817f, 0x7f7f8181, 0x81818181, 0x7f7f7f7f, 0x7f81817f,
+0x8181817f, 0x817f817f, 0x817f8181, 0x7f818181, 0x81818181, 0x817f817f, 0x7f817f81, 0x7f817f81,
+0x81817f7f, 0x8181817f, 0x817f817f, 0x817f7f7f, 0x81817f81, 0x81817f7f, 0x7f7f817f, 0x7f7f8181,
+0x8181817f, 0x81818181, 0x81817f7f, 0x7f818181, 0x7f7f7f7f, 0x817f7f81, 0x817f7f81, 0x7f7f7f7f,
+0x7f7f7f7f, 0x81817f7f, 0x817f7f7f, 0x7f817f7f, 0x7f7f7f7f, 0x817f8181, 0x81817f81, 0x7f7f7f7f,
+0x817f8181, 0x7f7f817f, 0x81818181, 0x7f7f7f7f, 0x7f817f81, 0x7f7f7f7f, 0x81817f81, 0x81818181,
+0x8181817f, 0x817f8181, 0x7f817f81, 0x8181817f, 0x7f7f7f81, 0x817f7f7f, 0x7f818181, 0x7f818181,
+0x7f7f7f81, 0x7f817f81, 0x8181817f, 0x7f818181
+
+output0 =
+0xd0dd44b2, 0xe91d434b, 0x17b23d65, 0xb8abd7c1, 0x12d7d41c, 0xce2686c2, 0x402c1efa, 0xc9151fcc,
+0xe00effad, 0xc964d36a, 0xe70e39e3, 0xd86577a2, 0x77e04ae3, 0x9dfd60b9, 0xbf43376f, 0x09841e69,
+0x53a02679, 0x898c65d0, 0x17434cf8, 0x9a3abfe2, 0x05e767ac, 0x902d6156, 0x716046a1, 0x636fc345,
+0xf15b483e, 0x910e40e4, 0x5d32b9a2, 0x8e9514b0, 0x7a218bb8, 0x7665aac3, 0x33a5b20c, 0x8ba7b5e3,
+0x220262e0, 0x7b654c15, 0xa69f1855, 0x6dcf61e3, 0x0036c1aa, 0x7ea806e3, 0x3f9b2ef1, 0x386cdd36,
+0xf94ae7e4, 0xf707e376, 0xb9c90f7b, 0x40bdd41f, 0x03cf6ae8, 0xfbd5b550, 0x03d90ae6, 0x65a6cf09,
+0xa3d70588, 0x26343d97, 0x464981b1, 0xd79f8b30, 0xa554bb7e, 0x524d3a2c, 0x2f75d78c, 0x3148c8d8,
+0xd4cccf4d, 0xc98df39c, 0x7f4fdb2a, 0x831c5ccd, 0xbe46bd67, 0xa9bf0a6b, 0xa726bdcc, 0xd590425d,
+0xa792805b, 0xe4b0518a, 0x18c4bcca, 0xf3891686, 0x3cdee43e, 0xd526e3a9, 0x8112aec6, 0x811151f4,
+0x9763de36, 0x56e50307, 0xa7313051, 0xc40db40a, 0x1931fa6e, 0x5701947d, 0x098ee810, 0x01cec402,
+0x804668f1, 0xc00c41da, 0x02432f4d, 0x072c9643, 0xf23088cc, 0x74620646, 0x281f8a80, 0x2c7a2aa6,
+0xfe8c2f88, 0xe0100f94, 0x9c402559, 0x48f5c34d, 0x59a3b023, 0x2427f7e0, 0xb2f30717, 0x9bf140a6,
+0x3fa4710b, 0xb493a4a2, 0xb16e6135, 0xd75f0e8e, 0xe7ff6b4a, 0x43d9e122, 0xafc5d306, 0xec88d05e,
+0xabfc996a, 0x29644a44, 0xa0c5c9fa, 0xf5836a0b, 0xd2a97513, 0x6986e115, 0x5581b429, 0xd6f8e599,
+0x035a2d9a, 0xe0835100, 0x561d04c5, 0x565f647a, 0xff711c76, 0x6b6fcd71, 0xb08518ac, 0xad407897,
+0x6de25115, 0x8e8fd5f1, 0x67196a81, 0xb6ef576b, 0x5e170674, 0x3cd78132, 0x0be74b19, 0x84f30e7b,
+0x85aa98b6, 0xcfe08810, 0xaa438ec3, 0xe95c3900, 0xafb0c225, 0xbe52bde2, 0xd6dcfec6, 0xccde045b,
+0x4fd00da2, 0x30c377b7, 0x771fdf0b, 0xea5f9282, 0x838dc0bf, 0x3250d0a9, 0xf2190c4d, 0x5ec14787,
+0x32c2d755, 0xe3b9f56c, 0xfb34945e, 0x642dc6c3, 0x8fb96e69, 0x612afce6, 0x17eb0530, 0x2fa9637c,
+0xef1068a6, 0x456c8bcd, 0x65b16eb9, 0xf97d8e92, 0x7b1a46
+
+basegraph=
+2
+
+z_c=
+256
+
+n_cb=
+12800
+
+q_m=
+2
+
+n_filler=
+16
+
+ea =
+3000
+
+eb =
+3000
+
+iter_max=
+8
+
+expected_iter_count=
+2
+
+c =
+2
+
+r =
+0
+
+cab =
+0
+
+rv_index =
+0
+
+code_block_mode =
+0
+
+op_flags =
+RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP
+
+expected_status =
+OK
diff --git a/app/test-bbdev/test_vectors/ldpc_enc_tb.data b/app/test-bbdev/test_vectors/ldpc_enc_tb.data
new file mode 100644
index 0000000000..0161c06f0d
--- /dev/null
+++ b/app/test-bbdev/test_vectors/ldpc_enc_tb.data
@@ -0,0 +1,95 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2021 NXP
+
+op_type =
+RTE_BBDEV_OP_LDPC_ENC
+
+input0 =
+0xd0dd44b2, 0xe91d434b, 0x17b23d65, 0xb8abd7c1, 0x12d7d41c, 0xce2686c2, 0x402c1efa, 0xc9151fcc,
+0xe00effad, 0xc964d36a, 0xe70e39e3, 0xd86577a2, 0x77e04ae3, 0x9dfd60b9, 0xbf43376f, 0x09841e69,
+0x53a02679, 0x898c65d0, 0x17434cf8, 0x9a3abfe2, 0x05e767ac, 0x902d6156, 0x716046a1, 0x636fc345,
+0xf15b483e, 0x910e40e4, 0x5d32b9a2, 0x8e9514b0, 0x7a218bb8, 0x7665aac3, 0x33a5b20c, 0x8ba7b5e3,
+0x220262e0, 0x7b654c15, 0xa69f1855, 0x6dcf61e3, 0x0036c1aa, 0x7ea806e3, 0x3f9b2ef1, 0x386cdd36,
+0xf94ae7e4, 0xf707e376, 0xb9c90f7b, 0x40bdd41f, 0x03cf6ae8, 0xfbd5b550, 0x03d90ae6, 0x65a6cf09,
+0xa3d70588, 0x26343d97, 0x464981b1, 0xd79f8b30, 0xa554bb7e, 0x524d3a2c, 0x2f75d78c, 0x3148c8d8,
+0xd4cccf4d, 0xc98df39c, 0x7f4fdb2a, 0x831c5ccd, 0xbe46bd67, 0xa9bf0a6b, 0xa726bdcc, 0xd590425d,
+0xa792805b, 0xe4b0518a, 0x18c4bcca, 0xf3891686, 0x3cdee43e, 0xd526e3a9, 0x8112aec6, 0x811151f4,
+0x9763de36, 0x56e50307, 0xa7313051, 0xc40db40a, 0x1931fa6e, 0x5701947d, 0x098ee810, 0x01cec402,
+0x804668f1, 0xc00c41da, 0x02432f4d, 0x072c9643, 0xf23088cc, 0x74620646, 0x281f8a80, 0x2c7a2aa6,
+0xfe8c2f88, 0xe0100f94, 0x9c402559, 0x48f5c34d, 0x59a3b023, 0x2427f7e0, 0xb2f30717, 0x9bf140a6,
+0x3fa4710b, 0xb493a4a2, 0xb16e6135, 0xd75f0e8e, 0xe7ff6b4a, 0x43d9e122, 0xafc5d306, 0xec88d05e,
+0xabfc996a, 0x29644a44, 0xa0c5c9fa, 0xf5836a0b, 0xd2a97513, 0x6986e115, 0x5581b429, 0xd6f8e599,
+0x035a2d9a, 0xe0835100, 0x561d04c5, 0x565f647a, 0xff711c76, 0x6b6fcd71, 0xb08518ac, 0xad407897,
+0x6de25115, 0x8e8fd5f1, 0x67196a81, 0xb6ef576b, 0x5e170674, 0x3cd78132, 0x0be74b19, 0x84f30e7b,
+0x85aa98b6, 0xcfe08810, 0xaa438ec3, 0xe95c3900, 0xafb0c225, 0xbe52bde2, 0xd6dcfec6, 0xccde045b,
+0x4fd00da2, 0x30c377b7, 0x771fdf0b, 0xea5f9282, 0x838dc0bf, 0x3250d0a9, 0xf2190c4d, 0x5ec14787,
+0x32c2d755, 0xe3b9f56c, 0xfb34945e, 0x642dc6c3, 0x8fb96e69, 0x612afce6, 0x17eb0530, 0x2fa9637c,
+0xef1068a6, 0x456c8bcd, 0x65b16eb9, 0xf97d8e92, 0x7b1a46
+
+output0 =
+0x4eda9982, 0x101c74c9, 0x8b63a987, 0x34464588, 0xe27e0cf2, 0x048dd503, 0x6391521b, 0x59f71f1a,
+0x22eeb556, 0x96d43907, 0x69a01acf, 0x3e6a4cb4, 0x7eca9c20, 0x2c3eb162, 0x965294d5, 0x25722e4e,
+0x7d42c4d1, 0x8489d0bf, 0x49c2a83d, 0xa48a3fa4, 0x6ccd783a, 0xd941b110, 0xa937e9e4, 0xc0a45188,
+0xd41b1840, 0x8bf35901, 0x769496e4, 0x91bb2778, 0x7ad8b944, 0xd19208ad, 0x8b519356, 0x7b6e1772,
+0x30982890, 0x1e183f8a, 0xde7b9c46, 0x2ca7c2ce, 0xb9b6e1d7, 0x68a3c466, 0x1ecda75d, 0xb462b570,
+0x2a2a5896, 0xaf6891b1, 0xd4bf3ba3, 0x82969dfa, 0xd0f563fb, 0xb81ff540, 0x7a0b3485, 0x4f6fd016,
+0x7741a613, 0x3f763d0e, 0x7f76a0dc, 0x37f25c1c, 0xf3412fe1, 0x2a75dc51, 0x04827bef, 0xe5a662fd,
+0xa07225f5, 0xbc9117a9, 0x55dbc54c, 0xd9446c00, 0xa8d26de1, 0xa293979e, 0x1ece1b94, 0xa5dd28cb,
+0x13d2655e, 0xa0e4ab01, 0x903c5a2c, 0x58674b7e, 0x0e1c244b, 0xa9e0d342, 0x45fc615f, 0x2971f02a,
+0x116c4e06, 0xf1d97697, 0x64b0a44f, 0xf21b9207, 0x32ddde4e, 0x4df48b05, 0xf0e80c2b, 0x27a14701,
+0x670407a7, 0x0ffd24cd, 0x07432145, 0xfff8c98f, 0x567dacd5, 0xef793abb, 0x29f2c205, 0x6605a7cd,
+0xf1978e96, 0x73ef3ef6, 0x336173ff, 0xaab9b459, 0xb3f4b89c, 0xf1e50d40, 0x76c3fb75, 0xc086001b,
+0x1cdadd3b, 0x0ed448a8, 0x53f9a461, 0x5a318eb9, 0x98d96ab4, 0xb796ead8, 0x6c4ffee6, 0xf5089709,
+0x9d3f7c5d, 0x759e5b2c, 0x1ba452ef, 0xe397683a, 0x38937d85, 0x6467fa0a, 0x3e3d85a9, 0x2be700cc,
+0xb51171ff, 0x27c369b4, 0xb91a6bbe, 0x84043906, 0x2639088d, 0x6c0f43f7, 0x1bdf6c89, 0xf294392a,
+0xf3c7ba93, 0xe9de466a, 0xd234e9a3, 0x94374868, 0xe644c601, 0xe8d30610, 0xc36d3cf7, 0x239d4e49,
+0x61a052ee, 0x333ac761, 0x9b372829, 0xf2cce000, 0x0a649c42, 0x6f20a68f, 0xc6c43664, 0x559c2c5c,
+0xb1d7575e, 0xe840adfe, 0x16bc5314, 0x5f076f74, 0x4a5b208b, 0xceca2331, 0x2f93e7a4, 0x82dc83c1,
+0x7ebccf3d, 0x98e4ca42, 0x6e831fa1, 0x7fe5e47d, 0xc89e7e40, 0x6b169129, 0xe27b1cb7, 0xf5c4d614,
+0xd3ccb7e8, 0x76a89ed6, 0x2cf00fc5, 0x76a1e27a, 0x92a253b5, 0x7c04dbea, 0x4903867d, 0x52a21dd6,
+0x7329e699, 0xbb63a3f1, 0x3425fd9d, 0xa02989ca, 0x2811932e, 0x72a3bf2f, 0xfa37e1ec, 0xa7784122,
+0xa21955d1, 0xa025ba90, 0x6ef13dcc, 0xbaf9c79f, 0x1a6f9ce7, 0x0d57bda5, 0x9caf0dc7, 0x352a0e64,
+0x598cfdc7, 0x8208cf39, 0x90fa0a87, 0xd2dcd4f9, 0xfc54fc60, 0x57ed5faa, 0x73153bc4, 0xf7e39009,
+0x3021d00b, 0x4d0f0afb, 0xd77a18ee, 0xa8e7
+
+basegraph=
+2
+
+z_c=
+256
+
+n_cb=
+12800
+
+q_m=
+2
+
+n_filler=
+16
+
+ea =
+3000
+
+eb =
+3000
+
+c =
+2
+
+r =
+0
+
+cab =
+0
+
+rv_index =
+0
+
+code_block_mode =
+0
+
+op_flags =
+RTE_BBDEV_LDPC_CRC_24B_ATTACH
+
+expected_status =
+OK
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v7 0/9] baseband: add NXP LA12xx driver
  2021-03-18  6:34 [dpdk-dev] [PATCH 1/6] baseband: introduce NXP LA12xx driver Hemant Agrawal
                   ` (8 preceding siblings ...)
  2021-09-24  4:37 ` [dpdk-dev] [PATCH v6 0/9] baseband: add NXP LA12xx driver nipun.gupta
@ 2021-09-28  8:29 ` nipun.gupta
  2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 1/9] bbdev: add big endian processing data processing info nipun.gupta
                     ` (8 more replies)
  2021-10-06 11:31 ` [dpdk-dev] [PATCH v8 0/8] baseband: add NXP LA12xx driver nipun.gupta
                   ` (3 subsequent siblings)
  13 siblings, 9 replies; 157+ messages in thread
From: nipun.gupta @ 2021-09-28  8:29 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal

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

This series introduces the BBDEV LA12xx poll mode driver (PMD) to support
an implementation for offloading High Phy processing functions like
LDPC Encode / Decode 5GNR wireless acceleration function, using PCI based
LA12xx Software defined radio.

Please check the documentation patch for more info.

The driver currently implements basic feature to offload only the 5G LDPC
encode/decode.

A new capability has been added to check if the driver can support the
input data in network byte order. Two test vectors are also added as an
example with input data in network byte.

v2: add test case changes
v3: fix 32 bit compilation
v4: capability for network byte order, doc patch merged inline.
v5: add llr_size and llr_decimals, removed LLR compression flag,
    update testbbdev to handle endianness, rebased on top of 20.08
v6: added BE as device info instead of capability, updated test
    to have 2 codeblocks
v7: fixed checkpatch errors

Hemant Agrawal (6):
  baseband: introduce NXP LA12xx driver
  baseband/la12xx: add devargs for max queues
  baseband/la12xx: add support for multiple modems
  baseband/la12xx: add queue and modem config support
  baseband/la12xx: add enqueue and dequeue support
  app/bbdev: enable la12xx for bbdev

Nipun Gupta (3):
  bbdev: add big endian processing data processing info
  app/bbdev: handle endianness of test data
  app/bbdev: add test vectors for transport blocks

 MAINTAINERS                                   |   10 +
 app/test-bbdev/meson.build                    |    3 +
 app/test-bbdev/test_bbdev_perf.c              |   62 +
 app/test-bbdev/test_vectors/ldpc_dec_tb.data  |  265 ++++
 app/test-bbdev/test_vectors/ldpc_enc_tb.data  |   95 ++
 doc/guides/bbdevs/features/la12xx.ini         |   13 +
 doc/guides/bbdevs/index.rst                   |    1 +
 doc/guides/bbdevs/la12xx.rst                  |  126 ++
 doc/guides/rel_notes/release_21_11.rst        |    5 +
 drivers/baseband/la12xx/bbdev_la12xx.c        | 1100 +++++++++++++++++
 drivers/baseband/la12xx/bbdev_la12xx.h        |   51 +
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h    |  244 ++++
 .../baseband/la12xx/bbdev_la12xx_pmd_logs.h   |   28 +
 drivers/baseband/la12xx/meson.build           |    6 +
 drivers/baseband/la12xx/version.map           |    3 +
 drivers/baseband/meson.build                  |    1 +
 lib/bbdev/rte_bbdev.h                         |    2 +
 17 files changed, 2015 insertions(+)
 create mode 100644 app/test-bbdev/test_vectors/ldpc_dec_tb.data
 create mode 100644 app/test-bbdev/test_vectors/ldpc_enc_tb.data
 create mode 100644 doc/guides/bbdevs/features/la12xx.ini
 create mode 100644 doc/guides/bbdevs/la12xx.rst
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.c
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_ipc.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
 create mode 100644 drivers/baseband/la12xx/meson.build
 create mode 100644 drivers/baseband/la12xx/version.map

-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v7 1/9] bbdev: add big endian processing data processing info
  2021-09-28  8:29 ` [dpdk-dev] [PATCH v7 0/9] baseband: add NXP LA12xx driver nipun.gupta
@ 2021-09-28  8:29   ` nipun.gupta
  2021-10-04 23:09     ` Chautru, Nicolas
  2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 2/9] baseband: introduce NXP LA12xx driver nipun.gupta
                     ` (7 subsequent siblings)
  8 siblings, 1 reply; 157+ messages in thread
From: nipun.gupta @ 2021-09-28  8:29 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

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

This patch intoduces a new info pertaining to bbdev device
to process the data in big endian order.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 lib/bbdev/rte_bbdev.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/bbdev/rte_bbdev.h b/lib/bbdev/rte_bbdev.h
index 7017124414..3acc008d06 100644
--- a/lib/bbdev/rte_bbdev.h
+++ b/lib/bbdev/rte_bbdev.h
@@ -309,6 +309,8 @@ struct rte_bbdev_driver_info {
 	uint16_t min_alignment;
 	/** HARQ memory available in kB */
 	uint32_t harq_buffer_size;
+	/** Device support input, output and HARQ data as big-endian */
+	uint8_t support_be_data;
 	/** Default queue configuration used if none is supplied  */
 	struct rte_bbdev_queue_conf default_queue_conf;
 	/** Device operation capabilities */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v7 2/9] baseband: introduce NXP LA12xx driver
  2021-09-28  8:29 ` [dpdk-dev] [PATCH v7 0/9] baseband: add NXP LA12xx driver nipun.gupta
  2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 1/9] bbdev: add big endian processing data processing info nipun.gupta
@ 2021-09-28  8:29   ` nipun.gupta
  2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 3/9] baseband/la12xx: add devargs for max queues nipun.gupta
                     ` (6 subsequent siblings)
  8 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-09-28  8:29 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This patch introduce the baseband device drivers for NXP's
LA1200 series software defined baseband modem.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 MAINTAINERS                                   |   9 ++
 drivers/baseband/la12xx/bbdev_la12xx.c        | 108 ++++++++++++++++++
 .../baseband/la12xx/bbdev_la12xx_pmd_logs.h   |  28 +++++
 drivers/baseband/la12xx/meson.build           |   6 +
 drivers/baseband/la12xx/version.map           |   3 +
 drivers/baseband/meson.build                  |   1 +
 6 files changed, 155 insertions(+)
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.c
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
 create mode 100644 drivers/baseband/la12xx/meson.build
 create mode 100644 drivers/baseband/la12xx/version.map

diff --git a/MAINTAINERS b/MAINTAINERS
index 30bf77b79a..e3f0e8759f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1289,6 +1289,15 @@ F: drivers/event/opdl/
 F: doc/guides/eventdevs/opdl.rst
 
 
+Baseband Drivers
+----------------
+
+NXP LA12xx driver
+M: Nipun Gupta <nipun.gupta@nxp.com>
+M: Hemant Agrawal <hemant.agrawal@nxp.com>
+F: drivers/baseband/la12xx/
+
+
 Rawdev Drivers
 --------------
 
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
new file mode 100644
index 0000000000..d3d7a4df37
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -0,0 +1,108 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+
+#include <string.h>
+
+#include <rte_common.h>
+#include <rte_bus_vdev.h>
+#include <rte_malloc.h>
+#include <rte_ring.h>
+#include <rte_kvargs.h>
+
+#include <rte_bbdev.h>
+#include <rte_bbdev_pmd.h>
+
+#include <bbdev_la12xx_pmd_logs.h>
+
+#define DRIVER_NAME baseband_la12xx
+
+/* private data structure */
+struct bbdev_la12xx_private {
+	unsigned int max_nb_queues;  /**< Max number of queues */
+};
+/* Create device */
+static int
+la12xx_bbdev_create(struct rte_vdev_device *vdev)
+{
+	struct rte_bbdev *bbdev;
+	const char *name = rte_vdev_device_name(vdev);
+
+	PMD_INIT_FUNC_TRACE();
+
+	bbdev = rte_bbdev_allocate(name);
+	if (bbdev == NULL)
+		return -ENODEV;
+
+	bbdev->data->dev_private = rte_zmalloc(name,
+			sizeof(struct bbdev_la12xx_private),
+			RTE_CACHE_LINE_SIZE);
+	if (bbdev->data->dev_private == NULL) {
+		rte_bbdev_release(bbdev);
+		return -ENOMEM;
+	}
+
+	bbdev->dev_ops = NULL;
+	bbdev->device = &vdev->device;
+	bbdev->data->socket_id = 0;
+	bbdev->intr_handle = NULL;
+
+	/* register rx/tx burst functions for data path */
+	bbdev->dequeue_enc_ops = NULL;
+	bbdev->dequeue_dec_ops = NULL;
+	bbdev->enqueue_enc_ops = NULL;
+	bbdev->enqueue_dec_ops = NULL;
+
+	return 0;
+}
+
+/* Initialise device */
+static int
+la12xx_bbdev_probe(struct rte_vdev_device *vdev)
+{
+	const char *name;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (vdev == NULL)
+		return -EINVAL;
+
+	name = rte_vdev_device_name(vdev);
+	if (name == NULL)
+		return -EINVAL;
+
+	return la12xx_bbdev_create(vdev);
+}
+
+/* Uninitialise device */
+static int
+la12xx_bbdev_remove(struct rte_vdev_device *vdev)
+{
+	struct rte_bbdev *bbdev;
+	const char *name;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (vdev == NULL)
+		return -EINVAL;
+
+	name = rte_vdev_device_name(vdev);
+	if (name == NULL)
+		return -EINVAL;
+
+	bbdev = rte_bbdev_get_named_dev(name);
+	if (bbdev == NULL)
+		return -EINVAL;
+
+	rte_free(bbdev->data->dev_private);
+
+	return rte_bbdev_release(bbdev);
+}
+
+static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
+	.probe = la12xx_bbdev_probe,
+	.remove = la12xx_bbdev_remove
+};
+
+RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
+RTE_LOG_REGISTER_DEFAULT(bbdev_la12xx_logtype, NOTICE);
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h b/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
new file mode 100644
index 0000000000..452435ccb9
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020 NXP
+ */
+
+#ifndef _BBDEV_LA12XX_PMD_LOGS_H_
+#define _BBDEV_LA12XX_PMD_LOGS_H_
+
+extern int bbdev_la12xx_logtype;
+
+#define rte_bbdev_log(level, fmt, ...) \
+	rte_log(RTE_LOG_ ## level, bbdev_la12xx_logtype, fmt "\n", \
+		##__VA_ARGS__)
+
+#ifdef RTE_LIBRTE_BBDEV_DEBUG
+#define rte_bbdev_log_debug(fmt, ...) \
+		rte_bbdev_log(DEBUG, "la12xx_pmd: " fmt, \
+		##__VA_ARGS__)
+#else
+#define rte_bbdev_log_debug(fmt, ...)
+#endif
+
+#define PMD_INIT_FUNC_TRACE() rte_bbdev_log_debug(">>")
+
+/* DP Logs, toggled out at compile time if level lower than current level */
+#define rte_bbdev_dp_log(level, fmt, args...) \
+	RTE_LOG_DP(level, PMD, fmt, ## args)
+
+#endif /* _BBDEV_LA12XX_PMD_LOGS_H_ */
diff --git a/drivers/baseband/la12xx/meson.build b/drivers/baseband/la12xx/meson.build
new file mode 100644
index 0000000000..7a017dcffa
--- /dev/null
+++ b/drivers/baseband/la12xx/meson.build
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020-2021 NXP
+
+deps += ['bbdev', 'bus_vdev', 'ring']
+
+sources = files('bbdev_la12xx.c')
diff --git a/drivers/baseband/la12xx/version.map b/drivers/baseband/la12xx/version.map
new file mode 100644
index 0000000000..4a76d1d52d
--- /dev/null
+++ b/drivers/baseband/la12xx/version.map
@@ -0,0 +1,3 @@
+DPDK_21 {
+	local: *;
+};
diff --git a/drivers/baseband/meson.build b/drivers/baseband/meson.build
index 5ee61d5323..ccd1eebc3b 100644
--- a/drivers/baseband/meson.build
+++ b/drivers/baseband/meson.build
@@ -11,6 +11,7 @@ drivers = [
         'fpga_lte_fec',
         'null',
         'turbo_sw',
+        'la12xx',
 ]
 
 log_prefix = 'pmd.bb'
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v7 3/9] baseband/la12xx: add devargs for max queues
  2021-09-28  8:29 ` [dpdk-dev] [PATCH v7 0/9] baseband: add NXP LA12xx driver nipun.gupta
  2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 1/9] bbdev: add big endian processing data processing info nipun.gupta
  2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 2/9] baseband: introduce NXP LA12xx driver nipun.gupta
@ 2021-09-28  8:29   ` nipun.gupta
  2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 4/9] baseband/la12xx: add support for multiple modems nipun.gupta
                     ` (5 subsequent siblings)
  8 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-09-28  8:29 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This patch adds dev args to take  max queues as input

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c | 73 +++++++++++++++++++++++++-
 1 file changed, 71 insertions(+), 2 deletions(-)

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index d3d7a4df37..ee03e93870 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -17,13 +17,73 @@
 
 #define DRIVER_NAME baseband_la12xx
 
+/*  Initialisation params structure that can be used by LA12xx BBDEV driver */
+struct bbdev_la12xx_params {
+	uint8_t queues_num; /*< LA12xx BBDEV queues number */
+};
+
+#define LA12XX_MAX_NB_QUEUES_ARG	"max_nb_queues"
+
+static const char * const bbdev_la12xx_valid_params[] = {
+	LA12XX_MAX_NB_QUEUES_ARG,
+};
+
 /* private data structure */
 struct bbdev_la12xx_private {
 	unsigned int max_nb_queues;  /**< Max number of queues */
 };
+static inline int
+parse_u16_arg(const char *key, const char *value, void *extra_args)
+{
+	uint16_t *u16 = extra_args;
+
+	unsigned int long result;
+	if ((value == NULL) || (extra_args == NULL))
+		return -EINVAL;
+	errno = 0;
+	result = strtoul(value, NULL, 0);
+	if ((result >= (1 << 16)) || (errno != 0)) {
+		rte_bbdev_log(ERR, "Invalid value %" PRIu64 " for %s",
+			      result, key);
+		return -ERANGE;
+	}
+	*u16 = (uint16_t)result;
+	return 0;
+}
+
+/* Parse parameters used to create device */
+static int
+parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
+		const char *input_args)
+{
+	struct rte_kvargs *kvlist = NULL;
+	int ret = 0;
+
+	if (params == NULL)
+		return -EINVAL;
+	if (input_args) {
+		kvlist = rte_kvargs_parse(input_args,
+				bbdev_la12xx_valid_params);
+		if (kvlist == NULL)
+			return -EFAULT;
+
+		ret = rte_kvargs_process(kvlist, bbdev_la12xx_valid_params[0],
+					&parse_u16_arg, &params->queues_num);
+		if (ret < 0)
+			goto exit;
+
+	}
+
+exit:
+	if (kvlist)
+		rte_kvargs_free(kvlist);
+	return ret;
+}
+
 /* Create device */
 static int
-la12xx_bbdev_create(struct rte_vdev_device *vdev)
+la12xx_bbdev_create(struct rte_vdev_device *vdev,
+		struct bbdev_la12xx_params *init_params __rte_unused)
 {
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
@@ -60,7 +120,11 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev)
 static int
 la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 {
+	struct bbdev_la12xx_params init_params = {
+		8
+	};
 	const char *name;
+	const char *input_args;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -71,7 +135,10 @@ la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 	if (name == NULL)
 		return -EINVAL;
 
-	return la12xx_bbdev_create(vdev);
+	input_args = rte_vdev_device_args(vdev);
+	parse_bbdev_la12xx_params(&init_params, input_args);
+
+	return la12xx_bbdev_create(vdev, &init_params);
 }
 
 /* Uninitialise device */
@@ -105,4 +172,6 @@ static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
 };
 
 RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
+RTE_PMD_REGISTER_PARAM_STRING(DRIVER_NAME,
+	LA12XX_MAX_NB_QUEUES_ARG"=<int>");
 RTE_LOG_REGISTER_DEFAULT(bbdev_la12xx_logtype, NOTICE);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v7 4/9] baseband/la12xx: add support for multiple modems
  2021-09-28  8:29 ` [dpdk-dev] [PATCH v7 0/9] baseband: add NXP LA12xx driver nipun.gupta
                     ` (2 preceding siblings ...)
  2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 3/9] baseband/la12xx: add devargs for max queues nipun.gupta
@ 2021-09-28  8:29   ` nipun.gupta
  2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 5/9] baseband/la12xx: add queue and modem config support nipun.gupta
                     ` (4 subsequent siblings)
  8 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-09-28  8:29 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This patch add support for multiple modems by assigning
a modem id as dev args in vdev creation.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c     | 64 +++++++++++++++++++---
 drivers/baseband/la12xx/bbdev_la12xx.h     | 56 +++++++++++++++++++
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 20 +++++++
 3 files changed, 133 insertions(+), 7 deletions(-)
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_ipc.h

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index ee03e93870..f9f32d665a 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -14,24 +14,26 @@
 #include <rte_bbdev_pmd.h>
 
 #include <bbdev_la12xx_pmd_logs.h>
+#include <bbdev_la12xx_ipc.h>
+#include <bbdev_la12xx.h>
 
 #define DRIVER_NAME baseband_la12xx
 
 /*  Initialisation params structure that can be used by LA12xx BBDEV driver */
 struct bbdev_la12xx_params {
 	uint8_t queues_num; /*< LA12xx BBDEV queues number */
+	int8_t modem_id; /*< LA12xx modem instance id */
 };
 
 #define LA12XX_MAX_NB_QUEUES_ARG	"max_nb_queues"
+#define LA12XX_VDEV_MODEM_ID_ARG	"modem"
+#define LA12XX_MAX_MODEM 4
 
 static const char * const bbdev_la12xx_valid_params[] = {
 	LA12XX_MAX_NB_QUEUES_ARG,
+	LA12XX_VDEV_MODEM_ID_ARG,
 };
 
-/* private data structure */
-struct bbdev_la12xx_private {
-	unsigned int max_nb_queues;  /**< Max number of queues */
-};
 static inline int
 parse_u16_arg(const char *key, const char *value, void *extra_args)
 {
@@ -51,6 +53,28 @@ parse_u16_arg(const char *key, const char *value, void *extra_args)
 	return 0;
 }
 
+/* Parse integer from integer argument */
+static int
+parse_integer_arg(const char *key __rte_unused,
+		const char *value, void *extra_args)
+{
+	int i;
+	char *end;
+
+	errno = 0;
+
+	i = strtol(value, &end, 10);
+	if (*end != 0 || errno != 0 || i < 0 || i > LA12XX_MAX_MODEM) {
+		rte_bbdev_log(ERR, "Supported Port IDS are 0 to %d",
+			LA12XX_MAX_MODEM - 1);
+		return -EINVAL;
+	}
+
+	*((uint32_t *)extra_args) = i;
+
+	return 0;
+}
+
 /* Parse parameters used to create device */
 static int
 parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
@@ -72,6 +96,16 @@ parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
 		if (ret < 0)
 			goto exit;
 
+		ret = rte_kvargs_process(kvlist,
+					bbdev_la12xx_valid_params[1],
+					&parse_integer_arg,
+					&params->modem_id);
+
+		if (params->modem_id >= LA12XX_MAX_MODEM) {
+			rte_bbdev_log(ERR, "Invalid modem id, must be < %u",
+					LA12XX_MAX_MODEM);
+			goto exit;
+		}
 	}
 
 exit:
@@ -83,10 +117,11 @@ parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
 /* Create device */
 static int
 la12xx_bbdev_create(struct rte_vdev_device *vdev,
-		struct bbdev_la12xx_params *init_params __rte_unused)
+		struct bbdev_la12xx_params *init_params)
 {
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
+	struct bbdev_la12xx_private *priv;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -102,6 +137,20 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 		return -ENOMEM;
 	}
 
+	priv = bbdev->data->dev_private;
+	priv->modem_id = init_params->modem_id;
+	/* if modem id is not configured */
+	if (priv->modem_id == -1)
+		priv->modem_id = bbdev->data->dev_id;
+
+	/* Reset Global variables */
+	priv->num_ldpc_enc_queues = 0;
+	priv->num_ldpc_dec_queues = 0;
+	priv->num_valid_queues = 0;
+	priv->max_nb_queues = init_params->queues_num;
+
+	rte_bbdev_log(INFO, "Setting Up %s: DevId=%d, ModemId=%d",
+				name, bbdev->data->dev_id, priv->modem_id);
 	bbdev->dev_ops = NULL;
 	bbdev->device = &vdev->device;
 	bbdev->data->socket_id = 0;
@@ -121,7 +170,7 @@ static int
 la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 {
 	struct bbdev_la12xx_params init_params = {
-		8
+		8, -1,
 	};
 	const char *name;
 	const char *input_args;
@@ -173,5 +222,6 @@ static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
 
 RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
 RTE_PMD_REGISTER_PARAM_STRING(DRIVER_NAME,
-	LA12XX_MAX_NB_QUEUES_ARG"=<int>");
+	LA12XX_MAX_NB_QUEUES_ARG"=<int>"
+	LA12XX_VDEV_MODEM_ID_ARG "=<int> ");
 RTE_LOG_REGISTER_DEFAULT(bbdev_la12xx_logtype, NOTICE);
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.h b/drivers/baseband/la12xx/bbdev_la12xx.h
new file mode 100644
index 0000000000..5228502331
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx.h
@@ -0,0 +1,56 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+
+#ifndef __BBDEV_LA12XX_H__
+#define __BBDEV_LA12XX_H__
+
+#define BBDEV_IPC_ENC_OP_TYPE	1
+#define BBDEV_IPC_DEC_OP_TYPE	2
+
+#define MAX_LDPC_ENC_FECA_QUEUES	4
+#define MAX_LDPC_DEC_FECA_QUEUES	4
+
+#define MAX_CHANNEL_DEPTH 16
+/* private data structure */
+struct bbdev_la12xx_private {
+	void *ipc_priv;
+	uint8_t num_valid_queues;
+	uint8_t max_nb_queues;
+	uint8_t num_ldpc_enc_queues;
+	uint8_t num_ldpc_dec_queues;
+	int8_t modem_id;
+	struct bbdev_la12xx_q_priv *queues_priv[32];
+};
+
+struct hugepage_info {
+	void *vaddr;
+	phys_addr_t paddr;
+	size_t len;
+};
+
+struct bbdev_la12xx_q_priv {
+	struct bbdev_la12xx_private *bbdev_priv;
+	uint32_t q_id;	/**< Channel ID */
+	uint32_t feca_blk_id;	/** FECA block ID for processing */
+	uint32_t feca_blk_id_be32; /**< FECA Block ID for this queue */
+	uint8_t en_napi; /* 0: napi disabled, 1: napi enabled */
+	uint16_t queue_size;	/**< Queue depth */
+	int32_t eventfd;	/**< Event FD value */
+	enum rte_bbdev_op_type op_type; /**< Operation type */
+	uint32_t la12xx_core_id;
+		/* LA12xx core ID on which this will be scheduled */
+	struct rte_mempool *mp; /**< Pool from where buffers would be cut */
+	void *bbdev_op[MAX_CHANNEL_DEPTH];
+			/**< Stores bbdev op for each index */
+	void *msg_ch_vaddr[MAX_CHANNEL_DEPTH];
+			/**< Stores msg channel addr for modem->host */
+	uint32_t host_pi;	/**< Producer_Index for HOST->MODEM */
+	uint32_t host_ci;	/**< Consumer Index for MODEM->HOST */
+	host_ipc_params_t *host_params; /**< Host parameters */
+};
+
+#define lower_32_bits(x) ((uint32_t)((uint64_t)x))
+#define upper_32_bits(x) ((uint32_t)(((uint64_t)(x) >> 16) >> 16))
+
+#endif
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
new file mode 100644
index 0000000000..9aa5562981
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+#ifndef __BBDEV_LA12XX_IPC_H__
+#define __BBDEV_LA12XX_IPC_H__
+
+/** No. of max channel per instance */
+#define IPC_MAX_DEPTH	(16)
+
+/* This shared memory would be on the host side which have copy of some
+ * of the parameters which are also part of Shared BD ring. Read access
+ * of these parameters from the host side would not be over PCI.
+ */
+typedef struct host_ipc_params {
+	volatile uint32_t pi;
+	volatile uint32_t ci;
+	volatile uint32_t modem_ptr[IPC_MAX_DEPTH];
+} __rte_packed host_ipc_params_t;
+
+#endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v7 5/9] baseband/la12xx: add queue and modem config support
  2021-09-28  8:29 ` [dpdk-dev] [PATCH v7 0/9] baseband: add NXP LA12xx driver nipun.gupta
                     ` (3 preceding siblings ...)
  2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 4/9] baseband/la12xx: add support for multiple modems nipun.gupta
@ 2021-09-28  8:29   ` nipun.gupta
  2021-10-04 23:19     ` Chautru, Nicolas
  2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 6/9] baseband/la12xx: add enqueue and dequeue support nipun.gupta
                     ` (3 subsequent siblings)
  8 siblings, 1 reply; 157+ messages in thread
From: nipun.gupta @ 2021-09-28  8:29 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This patch add support for connecting with modem
and creating the ipc channel as queues with modem
for the exchange of data.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 MAINTAINERS                                |   1 +
 doc/guides/bbdevs/index.rst                |   1 +
 doc/guides/bbdevs/la12xx.rst               |  81 +++
 doc/guides/rel_notes/release_21_11.rst     |   5 +
 drivers/baseband/la12xx/bbdev_la12xx.c     | 555 ++++++++++++++++++++-
 drivers/baseband/la12xx/bbdev_la12xx.h     |  17 +-
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 189 ++++++-
 7 files changed, 836 insertions(+), 13 deletions(-)
 create mode 100644 doc/guides/bbdevs/la12xx.rst

diff --git a/MAINTAINERS b/MAINTAINERS
index e3f0e8759f..1bf39820d6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1296,6 +1296,7 @@ NXP LA12xx driver
 M: Nipun Gupta <nipun.gupta@nxp.com>
 M: Hemant Agrawal <hemant.agrawal@nxp.com>
 F: drivers/baseband/la12xx/
+F: doc/guides/bbdevs/la12xx.rst
 
 
 Rawdev Drivers
diff --git a/doc/guides/bbdevs/index.rst b/doc/guides/bbdevs/index.rst
index 4445cbd1b0..cedd706fa6 100644
--- a/doc/guides/bbdevs/index.rst
+++ b/doc/guides/bbdevs/index.rst
@@ -14,3 +14,4 @@ Baseband Device Drivers
     fpga_lte_fec
     fpga_5gnr_fec
     acc100
+    la12xx
diff --git a/doc/guides/bbdevs/la12xx.rst b/doc/guides/bbdevs/la12xx.rst
new file mode 100644
index 0000000000..3c9ac5c047
--- /dev/null
+++ b/doc/guides/bbdevs/la12xx.rst
@@ -0,0 +1,81 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright 2021 NXP
+
+NXP LA12xx Poll Mode Driver
+=======================================
+
+The BBDEV LA12xx poll mode driver (PMD) supports an implementation for
+offloading High Phy processing functions like LDPC Encode / Decode 5GNR wireless
+acceleration function, using PCI based LA12xx Software defined radio.
+
+More information can be found at `NXP Official Website
+<https://www.nxp.com/products/processors-and-microcontrollers/arm-processors/layerscape-processors/layerscape-access-la1200-programmable-baseband-processor:LA1200>`_.
+
+Features
+--------
+
+LA12xx PMD supports the following features:
+
+- Maximum of 8 UL queues
+- Maximum of 8 DL queues
+- PCIe Gen-3 x8 Interface
+- MSI-X
+
+Installation
+------------
+
+Section 3 of the DPDK manual provides instructions on installing and compiling DPDK.
+
+DPDK requires hugepages to be configured as detailed in section 2 of the DPDK manual.
+
+Initialization
+--------------
+
+The device can be listed on the host console with:
+
+
+Use the following lspci command to get the multiple LA12xx processor ids. The
+device ID of the LA12xx baseband processor is "1c30".
+
+.. code-block:: console
+
+  sudo lspci -nn
+
+...
+0001:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device [1957:1c30] (
+rev 10)
+...
+0002:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device [1957:1c30] (
+rev 10)
+
+
+Prerequisites
+-------------
+
+Currently supported by DPDK:
+
+- NXP LA1224 BSP **1.0+**.
+- NXP LA1224 PCIe Modem card connected to ARM host.
+
+- Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup the basic DPDK environment.
+
+* Use dev arg option ``modem=0`` to identify the modem instance for a given
+  device. This is required only if more than 1 modem cards are attached to host.
+  this is optional and the default value is 0.
+  e.g. ``--vdev=baseband_la12xx,modem=0``
+
+* Use dev arg option ``max_nb_queues=x`` to specify the maximum number of queues
+  to be used for communication with offload device i.e. modem. default is 16.
+  e.g. ``--vdev=baseband_la12xx,max_nb_queues=4``
+
+Enabling logs
+-------------
+
+For enabling logs, use the following EAL parameter:
+
+.. code-block:: console
+
+   ./your_bbdev_application <EAL args> --log-level=la12xx:<level>
+
+Using ``bb.la12xx`` as log matching criteria, all Baseband PMD logs can be
+enabled which are lower than logging ``level``.
diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst
index ad7c1afec0..60b92c9a9f 100644
--- a/doc/guides/rel_notes/release_21_11.rst
+++ b/doc/guides/rel_notes/release_21_11.rst
@@ -91,6 +91,11 @@ New Features
   Added command-line options to specify total number of processes and
   current process ID. Each process owns subset of Rx and Tx queues.
 
+* **Added NXP LA12xx baseband PMD.**
+
+  * Added a new baseband PMD driver for NXP LA12xx Software defined radio.
+  * See the :doc:`../bbdevs/la12xx` for more details.
+
 
 Removed Items
 -------------
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index f9f32d665a..46ee5b4d70 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -3,6 +3,11 @@
  */
 
 #include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <dirent.h>
 
 #include <rte_common.h>
 #include <rte_bus_vdev.h>
@@ -29,11 +34,552 @@ struct bbdev_la12xx_params {
 #define LA12XX_VDEV_MODEM_ID_ARG	"modem"
 #define LA12XX_MAX_MODEM 4
 
+#define LA12XX_MAX_CORES	4
+#define LA12XX_LDPC_ENC_CORE	0
+#define LA12XX_LDPC_DEC_CORE	1
+
+#define LA12XX_MAX_LDPC_ENC_QUEUES	4
+#define LA12XX_MAX_LDPC_DEC_QUEUES	4
+
 static const char * const bbdev_la12xx_valid_params[] = {
 	LA12XX_MAX_NB_QUEUES_ARG,
 	LA12XX_VDEV_MODEM_ID_ARG,
 };
 
+static const struct rte_bbdev_op_cap bbdev_capabilities[] = {
+	{
+		.type   = RTE_BBDEV_OP_LDPC_ENC,
+		.cap.ldpc_enc = {
+			.capability_flags =
+					RTE_BBDEV_LDPC_RATE_MATCH |
+					RTE_BBDEV_LDPC_CRC_24A_ATTACH |
+					RTE_BBDEV_LDPC_CRC_24B_ATTACH,
+			.num_buffers_src =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+			.num_buffers_dst =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+		}
+	},
+	{
+		.type   = RTE_BBDEV_OP_LDPC_DEC,
+		.cap.ldpc_dec = {
+			.capability_flags =
+				RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK |
+					RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK |
+					RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP,
+			.num_buffers_src =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+			.num_buffers_hard_out =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+			.llr_size = 8,
+			.llr_decimals = 1,
+		}
+	},
+	RTE_BBDEV_END_OF_CAPABILITIES_LIST()
+};
+
+static struct rte_bbdev_queue_conf default_queue_conf = {
+	.queue_size = MAX_CHANNEL_DEPTH,
+};
+
+/* Get device info */
+static void
+la12xx_info_get(struct rte_bbdev *dev __rte_unused,
+		struct rte_bbdev_driver_info *dev_info)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	dev_info->driver_name = RTE_STR(DRIVER_NAME);
+	dev_info->max_num_queues = LA12XX_MAX_QUEUES;
+	dev_info->queue_size_lim = MAX_CHANNEL_DEPTH;
+	dev_info->hardware_accelerated = true;
+	dev_info->max_dl_queue_priority = 0;
+	dev_info->max_ul_queue_priority = 0;
+	dev_info->support_be_data = 1;
+	dev_info->default_queue_conf = default_queue_conf;
+	dev_info->capabilities = bbdev_capabilities;
+	dev_info->cpu_flag_reqs = NULL;
+	dev_info->min_alignment = 64;
+
+	rte_bbdev_log_debug("got device info from %u", dev->data->dev_id);
+}
+
+/* Release queue */
+static int
+la12xx_queue_release(struct rte_bbdev *dev, uint16_t q_id)
+{
+	RTE_SET_USED(dev);
+	RTE_SET_USED(q_id);
+
+	PMD_INIT_FUNC_TRACE();
+
+	return 0;
+}
+
+#define HUGEPG_OFFSET(A) \
+		((uint64_t) ((unsigned long) (A) \
+		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
+
+static int ipc_queue_configure(uint32_t channel_id,
+		ipc_t instance, struct bbdev_la12xx_q_priv *q_priv)
+{
+	ipc_userspace_t *ipc_priv = (ipc_userspace_t *)instance;
+	ipc_instance_t *ipc_instance = ipc_priv->instance;
+	ipc_ch_t *ch;
+	void *vaddr;
+	uint32_t i = 0;
+	uint32_t msg_size = sizeof(struct bbdev_ipc_enqueue_op);
+
+	PMD_INIT_FUNC_TRACE();
+
+	rte_bbdev_log_debug("%x %p", ipc_instance->initialized,
+		ipc_priv->instance);
+	ch = &(ipc_instance->ch_list[channel_id]);
+
+	rte_bbdev_log_debug("channel: %u, depth: %u, msg size: %u",
+		channel_id, q_priv->queue_size, msg_size);
+
+	/* Start init of channel */
+	ch->md.ring_size = rte_cpu_to_be_32(q_priv->queue_size);
+	ch->md.pi = 0;
+	ch->md.ci = 0;
+	ch->md.msg_size = msg_size;
+	for (i = 0; i < q_priv->queue_size; i++) {
+		vaddr = rte_malloc(NULL, msg_size, RTE_CACHE_LINE_SIZE);
+		if (!vaddr)
+			return IPC_HOST_BUF_ALLOC_FAIL;
+		/* Only offset now */
+		ch->bd_h[i].modem_ptr =
+			rte_cpu_to_be_32(HUGEPG_OFFSET(vaddr));
+		ch->bd_h[i].host_virt_l = lower_32_bits(vaddr);
+		ch->bd_h[i].host_virt_h = upper_32_bits(vaddr);
+		q_priv->msg_ch_vaddr[i] = vaddr;
+		/* Not sure use of this len may be for CRC*/
+		ch->bd_h[i].len = 0;
+	}
+	ch->host_ipc_params =
+		rte_cpu_to_be_32(HUGEPG_OFFSET(q_priv->host_params));
+
+	rte_bbdev_log_debug("Channel configured");
+	return IPC_SUCCESS;
+}
+
+static int
+la12xx_e200_queue_setup(struct rte_bbdev *dev,
+		struct bbdev_la12xx_q_priv *q_priv)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	struct gul_hif *mhif;
+	ipc_metadata_t *ipc_md;
+	ipc_ch_t *ch;
+	int instance_id = 0, i;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		q_priv->la12xx_core_id = LA12XX_LDPC_ENC_CORE;
+		break;
+	case RTE_BBDEV_OP_LDPC_DEC:
+		q_priv->la12xx_core_id = LA12XX_LDPC_DEC_CORE;
+		break;
+	default:
+		rte_bbdev_log(ERR, "Unsupported op type\n");
+		return -1;
+	}
+
+	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+	/* offset is from start of PEB */
+	ipc_md = (ipc_metadata_t *)((uintptr_t)ipc_priv->peb_start.host_vaddr +
+		mhif->ipc_regs.ipc_mdata_offset);
+	ch = &ipc_md->instance_list[instance_id].ch_list[q_priv->q_id];
+
+	if (q_priv->q_id < priv->num_valid_queues) {
+		ipc_br_md_t *md = &(ch->md);
+
+		q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
+		q_priv->feca_blk_id_be32 = ch->feca_blk_id;
+		q_priv->host_pi = rte_be_to_cpu_32(md->pi);
+		q_priv->host_ci = rte_be_to_cpu_32(md->ci);
+		q_priv->host_params = (host_ipc_params_t *)(uintptr_t)
+			(rte_be_to_cpu_32(ch->host_ipc_params) +
+			((uint64_t)ipc_priv->hugepg_start.host_vaddr));
+
+		for (i = 0; i < q_priv->queue_size; i++) {
+			uint32_t h, l;
+
+			h = ch->bd_h[i].host_virt_h;
+			l = ch->bd_h[i].host_virt_l;
+			q_priv->msg_ch_vaddr[i] = (void *)join_32_bits(h, l);
+		}
+
+		rte_bbdev_log(WARNING,
+			"Queue [%d] already configured, not configuring again",
+			q_priv->q_id);
+		return 0;
+	}
+
+	rte_bbdev_log_debug("setting up queue %d", q_priv->q_id);
+
+	/* Call ipc_configure_channel */
+	ret = ipc_queue_configure(q_priv->q_id, ipc_priv, q_priv);
+	if (ret) {
+		rte_bbdev_log(ERR, "Unable to setup queue (%d) (err=%d)",
+		       q_priv->q_id, ret);
+		return ret;
+	}
+
+	/* Set queue properties for LA12xx device */
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		if (priv->num_ldpc_enc_queues >= LA12XX_MAX_LDPC_ENC_QUEUES) {
+			rte_bbdev_log(ERR,
+				"num_ldpc_enc_queues reached max value");
+			return -1;
+		}
+		ch->la12xx_core_id =
+			rte_cpu_to_be_32(LA12XX_LDPC_ENC_CORE);
+		ch->feca_blk_id = rte_cpu_to_be_32(priv->num_ldpc_enc_queues++);
+		break;
+	case RTE_BBDEV_OP_LDPC_DEC:
+		if (priv->num_ldpc_dec_queues >= LA12XX_MAX_LDPC_DEC_QUEUES) {
+			rte_bbdev_log(ERR,
+				"num_ldpc_dec_queues reached max value");
+			return -1;
+		}
+		ch->la12xx_core_id =
+			rte_cpu_to_be_32(LA12XX_LDPC_DEC_CORE);
+		ch->feca_blk_id = rte_cpu_to_be_32(priv->num_ldpc_dec_queues++);
+		break;
+	default:
+		rte_bbdev_log(ERR, "Not supported op type\n");
+		return -1;
+	}
+	ch->op_type = rte_cpu_to_be_32(q_priv->op_type);
+	ch->depth = rte_cpu_to_be_32(q_priv->queue_size);
+
+	/* Store queue config here */
+	q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
+	q_priv->feca_blk_id_be32 = ch->feca_blk_id;
+
+	return 0;
+}
+
+/* Setup a queue */
+static int
+la12xx_queue_setup(struct rte_bbdev *dev, uint16_t q_id,
+		const struct rte_bbdev_queue_conf *queue_conf)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	struct rte_bbdev_queue_data *q_data;
+	struct bbdev_la12xx_q_priv *q_priv;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* Move to setup_queues callback */
+	q_data = &dev->data->queues[q_id];
+	q_data->queue_private = rte_zmalloc(NULL,
+		sizeof(struct bbdev_la12xx_q_priv), 0);
+	if (!q_data->queue_private) {
+		rte_bbdev_log(ERR, "Memory allocation failed for qpriv");
+		return -ENOMEM;
+	}
+	q_priv = q_data->queue_private;
+	q_priv->q_id = q_id;
+	q_priv->bbdev_priv = dev->data->dev_private;
+	q_priv->queue_size = queue_conf->queue_size;
+	q_priv->op_type = queue_conf->op_type;
+
+	ret = la12xx_e200_queue_setup(dev, q_priv);
+	if (ret) {
+		rte_bbdev_log(ERR, "e200_queue_setup failed for qid: %d",
+				     q_id);
+		return ret;
+	}
+
+	/* Store queue config here */
+	priv->num_valid_queues++;
+
+	return 0;
+}
+
+static int
+la12xx_start(struct rte_bbdev *dev)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	int ready = 0;
+	struct gul_hif *hif_start;
+
+	PMD_INIT_FUNC_TRACE();
+
+	hif_start = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+
+	/* Set Host Read bit */
+	SET_HIF_HOST_RDY(hif_start, HIF_HOST_READY_IPC_APP);
+
+	/* Now wait for modem ready bit */
+	while (!ready)
+		ready = CHK_HIF_MOD_RDY(hif_start, HIF_MOD_READY_IPC_APP);
+
+	return 0;
+}
+
+static const struct rte_bbdev_ops pmd_ops = {
+	.info_get = la12xx_info_get,
+	.queue_setup = la12xx_queue_setup,
+	.queue_release = la12xx_queue_release,
+	.start = la12xx_start
+};
+static struct hugepage_info *
+get_hugepage_info(void)
+{
+	struct hugepage_info *hp_info;
+	struct rte_memseg *mseg;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* TODO - find a better way */
+	hp_info = rte_malloc(NULL, sizeof(struct hugepage_info), 0);
+	if (!hp_info) {
+		rte_bbdev_log(ERR, "Unable to allocate on local heap");
+		return NULL;
+	}
+
+	mseg = rte_mem_virt2memseg(hp_info, NULL);
+	hp_info->vaddr = mseg->addr;
+	hp_info->paddr = rte_mem_virt2phy(mseg->addr);
+	hp_info->len = mseg->len;
+
+	return hp_info;
+}
+
+static int open_ipc_dev(int modem_id)
+{
+	char dev_initials[16], dev_path[PATH_MAX];
+	struct dirent *entry;
+	int dev_ipc = 0;
+	DIR *dir;
+
+	dir = opendir("/dev/");
+	if (!dir) {
+		rte_bbdev_log(ERR, "Unable to open /dev/");
+		return -1;
+	}
+
+	sprintf(dev_initials, "gulipcgul%d", modem_id);
+
+	while ((entry = readdir(dir)) != NULL) {
+		if (!strncmp(dev_initials, entry->d_name,
+		    sizeof(dev_initials) - 1))
+			break;
+	}
+
+	if (!entry) {
+		rte_bbdev_log(ERR, "Error: No gulipcgul%d device", modem_id);
+		return -1;
+	}
+
+	sprintf(dev_path, "/dev/%s", entry->d_name);
+	dev_ipc = open(dev_path, O_RDWR);
+	if (dev_ipc  < 0) {
+		rte_bbdev_log(ERR, "Error: Cannot open %s", dev_path);
+		return -errno;
+	}
+
+	return dev_ipc;
+}
+
+static int
+setup_la12xx_dev(struct rte_bbdev *dev)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	struct hugepage_info *hp = NULL;
+	ipc_channel_us_t *ipc_priv_ch = NULL;
+	int dev_ipc = 0, dev_mem = 0, i;
+	ipc_metadata_t *ipc_md;
+	struct gul_hif *mhif;
+	uint32_t phy_align = 0;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (!ipc_priv) {
+		/* TODO - get a better way */
+		/* Get the hugepage info against it */
+		hp = get_hugepage_info();
+		if (!hp) {
+			rte_bbdev_log(ERR, "Unable to get hugepage info");
+			ret = -ENOMEM;
+			goto err;
+		}
+
+		rte_bbdev_log_debug("0x%" PRIx64 " %p 0x%" PRIx64,
+				hp->paddr, hp->vaddr, hp->len);
+
+		ipc_priv = rte_zmalloc(0, sizeof(ipc_userspace_t), 0);
+		if (ipc_priv == NULL) {
+			rte_bbdev_log(ERR,
+				"Unable to allocate memory for ipc priv");
+			ret = -ENOMEM;
+			goto err;
+		}
+
+		for (i = 0; i < IPC_MAX_CHANNEL_COUNT; i++) {
+			ipc_priv_ch = rte_zmalloc(0,
+				sizeof(ipc_channel_us_t), 0);
+			if (ipc_priv_ch == NULL) {
+				rte_bbdev_log(ERR,
+					"Unable to allocate memory for channels");
+				ret = -ENOMEM;
+			}
+			ipc_priv->channels[i] = ipc_priv_ch;
+		}
+
+		dev_mem = open("/dev/mem", O_RDWR);
+		if (dev_mem < 0) {
+			rte_bbdev_log(ERR, "Error: Cannot open /dev/mem");
+			ret = -errno;
+			goto err;
+		}
+
+		ipc_priv->instance_id = 0;
+		ipc_priv->dev_mem = dev_mem;
+
+		rte_bbdev_log_debug("hugepg input 0x%" PRIx64 "%p 0x%" PRIx64,
+			hp->paddr, hp->vaddr, hp->len);
+
+		ipc_priv->sys_map.hugepg_start.host_phys = hp->paddr;
+		ipc_priv->sys_map.hugepg_start.size = hp->len;
+
+		ipc_priv->hugepg_start.host_phys = hp->paddr;
+		ipc_priv->hugepg_start.host_vaddr = hp->vaddr;
+		ipc_priv->hugepg_start.size = hp->len;
+
+		rte_free(hp);
+	}
+
+	dev_ipc = open_ipc_dev(priv->modem_id);
+	if (dev_ipc < 0) {
+		rte_bbdev_log(ERR, "Error: open_ipc_dev failed");
+		goto err;
+	}
+	ipc_priv->dev_ipc = dev_ipc;
+
+	ret = ioctl(ipc_priv->dev_ipc, IOCTL_GUL_IPC_GET_SYS_MAP,
+		    &ipc_priv->sys_map);
+	if (ret) {
+		rte_bbdev_log(ERR,
+			"IOCTL_GUL_IPC_GET_SYS_MAP ioctl failed");
+		goto err;
+	}
+
+	phy_align = (ipc_priv->sys_map.mhif_start.host_phys % 0x1000);
+	ipc_priv->mhif_start.host_vaddr =
+		mmap(0, ipc_priv->sys_map.mhif_start.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.mhif_start.host_phys - phy_align));
+	if (ipc_priv->mhif_start.host_vaddr == MAP_FAILED) {
+		rte_bbdev_log(ERR, "MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->mhif_start.host_vaddr = (void *) ((uintptr_t)
+		(ipc_priv->mhif_start.host_vaddr) + phy_align);
+
+	phy_align = (ipc_priv->sys_map.peb_start.host_phys % 0x1000);
+	ipc_priv->peb_start.host_vaddr =
+		mmap(0, ipc_priv->sys_map.peb_start.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.peb_start.host_phys - phy_align));
+	if (ipc_priv->peb_start.host_vaddr == MAP_FAILED) {
+		rte_bbdev_log(ERR, "MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->peb_start.host_vaddr = (void *)((uintptr_t)
+		(ipc_priv->peb_start.host_vaddr) + phy_align);
+
+	phy_align = (ipc_priv->sys_map.modem_ccsrbar.host_phys % 0x1000);
+	ipc_priv->modem_ccsrbar.host_vaddr =
+		mmap(0, ipc_priv->sys_map.modem_ccsrbar.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.modem_ccsrbar.host_phys - phy_align));
+	if (ipc_priv->modem_ccsrbar.host_vaddr == MAP_FAILED) {
+		rte_bbdev_log(ERR, "MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->modem_ccsrbar.host_vaddr = (void *)((uintptr_t)
+		(ipc_priv->modem_ccsrbar.host_vaddr) + phy_align);
+
+	ipc_priv->hugepg_start.modem_phys =
+		ipc_priv->sys_map.hugepg_start.modem_phys;
+
+	ipc_priv->mhif_start.host_phys =
+		ipc_priv->sys_map.mhif_start.host_phys;
+	ipc_priv->mhif_start.size = ipc_priv->sys_map.mhif_start.size;
+	ipc_priv->peb_start.host_phys = ipc_priv->sys_map.peb_start.host_phys;
+	ipc_priv->peb_start.size = ipc_priv->sys_map.peb_start.size;
+
+	rte_bbdev_log(INFO, "peb 0x%" PRIx64 "%p 0x%" PRIx32,
+			ipc_priv->peb_start.host_phys,
+			ipc_priv->peb_start.host_vaddr,
+			ipc_priv->peb_start.size);
+	rte_bbdev_log(INFO, "hugepg 0x%" PRIx64 "%p 0x%" PRIx32,
+			ipc_priv->hugepg_start.host_phys,
+			ipc_priv->hugepg_start.host_vaddr,
+			ipc_priv->hugepg_start.size);
+	rte_bbdev_log(INFO, "mhif 0x%" PRIx64 "%p 0x%" PRIx32,
+			ipc_priv->mhif_start.host_phys,
+			ipc_priv->mhif_start.host_vaddr,
+			ipc_priv->mhif_start.size);
+	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+
+	/* offset is from start of PEB */
+	ipc_md = (ipc_metadata_t *)((uint64_t)ipc_priv->peb_start.host_vaddr +
+			mhif->ipc_regs.ipc_mdata_offset);
+
+	if (sizeof(ipc_metadata_t) != mhif->ipc_regs.ipc_mdata_size) {
+		rte_bbdev_log(ERR,
+			"ipc_metadata_t =0x%" PRIx64
+			", mhif->ipc_regs.ipc_mdata_size=0x%" PRIx32,
+			sizeof(ipc_metadata_t), mhif->ipc_regs.ipc_mdata_size);
+		rte_bbdev_log(ERR, "--> mhif->ipc_regs.ipc_mdata_offset= 0x%"
+			PRIx32, mhif->ipc_regs.ipc_mdata_offset);
+		rte_bbdev_log(ERR, "gul_hif size=0x%" PRIx64,
+			sizeof(struct gul_hif));
+		return IPC_MD_SZ_MISS_MATCH;
+	}
+
+	ipc_priv->instance = (ipc_instance_t *)
+		(&ipc_md->instance_list[ipc_priv->instance_id]);
+
+	rte_bbdev_log_debug("finish host init");
+
+	priv->ipc_priv = ipc_priv;
+
+	return 0;
+
+err:
+	rte_free(hp);
+	rte_free(ipc_priv);
+	rte_free(ipc_priv_ch);
+	if (dev_mem)
+		close(dev_mem);
+	if (dev_ipc)
+		close(dev_ipc);
+
+	return ret;
+}
+
 static inline int
 parse_u16_arg(const char *key, const char *value, void *extra_args)
 {
@@ -122,6 +668,7 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
 	struct bbdev_la12xx_private *priv;
+	int ret;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -151,7 +698,13 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 
 	rte_bbdev_log(INFO, "Setting Up %s: DevId=%d, ModemId=%d",
 				name, bbdev->data->dev_id, priv->modem_id);
-	bbdev->dev_ops = NULL;
+	ret = setup_la12xx_dev(bbdev);
+	if (ret) {
+		rte_bbdev_log(ERR, "IPC Setup failed for %s", name);
+		rte_free(bbdev->data->dev_private);
+		return ret;
+	}
+	bbdev->dev_ops = &pmd_ops;
 	bbdev->device = &vdev->device;
 	bbdev->data->socket_id = 0;
 	bbdev->intr_handle = NULL;
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.h b/drivers/baseband/la12xx/bbdev_la12xx.h
index 5228502331..fe91e62bf6 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx.h
@@ -5,16 +5,10 @@
 #ifndef __BBDEV_LA12XX_H__
 #define __BBDEV_LA12XX_H__
 
-#define BBDEV_IPC_ENC_OP_TYPE	1
-#define BBDEV_IPC_DEC_OP_TYPE	2
-
-#define MAX_LDPC_ENC_FECA_QUEUES	4
-#define MAX_LDPC_DEC_FECA_QUEUES	4
-
 #define MAX_CHANNEL_DEPTH 16
 /* private data structure */
 struct bbdev_la12xx_private {
-	void *ipc_priv;
+	ipc_userspace_t *ipc_priv;
 	uint8_t num_valid_queues;
 	uint8_t max_nb_queues;
 	uint8_t num_ldpc_enc_queues;
@@ -32,14 +26,14 @@ struct hugepage_info {
 struct bbdev_la12xx_q_priv {
 	struct bbdev_la12xx_private *bbdev_priv;
 	uint32_t q_id;	/**< Channel ID */
-	uint32_t feca_blk_id;	/** FECA block ID for processing */
+	uint32_t feca_blk_id;	/**< FECA block ID for processing */
 	uint32_t feca_blk_id_be32; /**< FECA Block ID for this queue */
-	uint8_t en_napi; /* 0: napi disabled, 1: napi enabled */
+	uint8_t en_napi; /**< 0: napi disabled, 1: napi enabled */
 	uint16_t queue_size;	/**< Queue depth */
 	int32_t eventfd;	/**< Event FD value */
 	enum rte_bbdev_op_type op_type; /**< Operation type */
 	uint32_t la12xx_core_id;
-		/* LA12xx core ID on which this will be scheduled */
+		/**< LA12xx core ID on which this will be scheduled */
 	struct rte_mempool *mp; /**< Pool from where buffers would be cut */
 	void *bbdev_op[MAX_CHANNEL_DEPTH];
 			/**< Stores bbdev op for each index */
@@ -52,5 +46,6 @@ struct bbdev_la12xx_q_priv {
 
 #define lower_32_bits(x) ((uint32_t)((uint64_t)x))
 #define upper_32_bits(x) ((uint32_t)(((uint64_t)(x) >> 16) >> 16))
-
+#define join_32_bits(upper, lower) \
+	((size_t)(((uint64_t)(upper) << 32) | (uint32_t)(lower)))
 #endif
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
index 9aa5562981..5f613fb087 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -4,9 +4,182 @@
 #ifndef __BBDEV_LA12XX_IPC_H__
 #define __BBDEV_LA12XX_IPC_H__
 
+#define LA12XX_MAX_QUEUES 20
+#define HOST_RX_QUEUEID_OFFSET LA12XX_MAX_QUEUES
+
+/** No. of max channel per instance */
+#define IPC_MAX_CHANNEL_COUNT	(64)
+
 /** No. of max channel per instance */
 #define IPC_MAX_DEPTH	(16)
 
+/** No. of max IPC instance per modem */
+#define IPC_MAX_INSTANCE_COUNT	(1)
+
+/** Error codes */
+#define IPC_SUCCESS		(0) /** IPC operation success */
+#define IPC_INPUT_INVALID	(-1) /** Invalid input to API */
+#define IPC_CH_INVALID		(-2) /** Channel no is invalid */
+#define IPC_INSTANCE_INVALID	(-3) /** Instance no is invalid */
+#define IPC_MEM_INVALID		(-4) /** Insufficient memory */
+#define IPC_CH_FULL		(-5) /** Channel is full */
+#define IPC_CH_EMPTY		(-6) /** Channel is empty */
+#define IPC_BL_EMPTY		(-7) /** Free buffer list is empty */
+#define IPC_BL_FULL		(-8) /** Free buffer list is full */
+#define IPC_HOST_BUF_ALLOC_FAIL	(-9) /** DPDK malloc fail */
+#define IPC_MD_SZ_MISS_MATCH	(-10) /** META DATA size in mhif miss matched*/
+#define IPC_MALLOC_FAIL		(-11) /** system malloc fail */
+#define IPC_IOCTL_FAIL		(-12) /** IOCTL call failed */
+#define IPC_MMAP_FAIL		(-14) /** MMAP fail */
+#define IPC_OPEN_FAIL		(-15) /** OPEN fail */
+#define IPC_EVENTFD_FAIL	(-16) /** eventfd initialization failed */
+#define IPC_NOT_IMPLEMENTED	(-17) /** IPC feature is not implemented yet*/
+
+#define SET_HIF_HOST_RDY(hif, RDY_MASK) (hif->host_ready |= RDY_MASK)
+#define CHK_HIF_MOD_RDY(hif, RDY_MASK) (hif->mod_ready & RDY_MASK)
+
+/* Host Ready bits */
+#define HIF_HOST_READY_HOST_REGIONS	(1 << 0)
+#define HIF_HOST_READY_IPC_LIB		(1 << 12)
+#define HIF_HOST_READY_IPC_APP		(1 << 13)
+#define HIF_HOST_READY_FECA		(1 << 14)
+
+/* Modem Ready bits */
+#define HIF_MOD_READY_IPC_LIB		(1 << 5)
+#define HIF_MOD_READY_IPC_APP		(1 << 6)
+#define HIF_MOD_READY_FECA		(1 << 7)
+
+typedef void *ipc_t;
+
+struct ipc_msg {
+	int chid;
+	void *addr;
+	uint32_t len;
+	uint8_t flags;
+};
+
+typedef struct {
+	uint64_t host_phys;
+	uint32_t modem_phys;
+	void    *host_vaddr;
+	uint32_t size;
+} mem_range_t;
+
+#define GUL_IPC_MAGIC	'R'
+
+#define IOCTL_GUL_IPC_GET_SYS_MAP _IOW(GUL_IPC_MAGIC, 1, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_REGISTER _IOWR(GUL_IPC_MAGIC, 4, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_DEREGISTER \
+	_IOWR(GUL_IPC_MAGIC, 5, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_RAISE_INTERRUPT _IOW(GUL_IPC_MAGIC, 6, int *)
+
+/** buffer ring common metadata */
+typedef struct ipc_bd_ring_md {
+	volatile uint32_t pi;		/**< Producer index and flag (MSB)
+					  *  which flip for each Ring wrapping
+					  */
+	volatile uint32_t ci;		/**< Consumer index and flag (MSB)
+					  *  which flip for each Ring wrapping
+					  */
+	uint32_t ring_size;	/**< depth (Used to roll-over pi/ci) */
+	uint32_t msg_size;	/**< Size of the each buffer */
+} __rte_packed ipc_br_md_t;
+
+/** IPC buffer descriptor */
+typedef struct ipc_buffer_desc {
+	union {
+		uint64_t host_virt;	/**< msg's host virtual address */
+		struct {
+			uint32_t host_virt_l;
+			uint32_t host_virt_h;
+		};
+	};
+	uint32_t modem_ptr;	/**< msg's modem physical address */
+	uint32_t len;		/**< msg len */
+} __rte_packed ipc_bd_t;
+
+typedef struct ipc_channel {
+	uint32_t ch_id;		/**< Channel id */
+	ipc_br_md_t md;			/**< Metadata for BD ring */
+	ipc_bd_t bd_h[IPC_MAX_DEPTH];	/**< Buffer Descriptor on Host */
+	ipc_bd_t bd_m[IPC_MAX_DEPTH];	/**< Buffer Descriptor on Modem */
+	uint32_t op_type;		/**< Type of the BBDEV operation
+					  * supported on this channel
+					  */
+	uint32_t depth;			/**< Channel depth */
+	uint32_t feca_blk_id;	/**< FECA Transport Block ID for processing */
+	uint32_t la12xx_core_id;/**< LA12xx core ID on which this will be
+				  * scheduled
+				  */
+	uint32_t feca_input_circ_size;	/**< FECA transport block input
+					  * circular buffer size
+					  */
+	uint32_t host_ipc_params;	/**< Address for host IPC parameters */
+} __rte_packed ipc_ch_t;
+
+typedef struct ipc_instance {
+	uint32_t instance_id;		/**< instance id, use to init this
+					  * instance by ipc_init API
+					  */
+	uint32_t initialized;		/**< Set in ipc_init */
+	ipc_ch_t ch_list[IPC_MAX_CHANNEL_COUNT];
+		/**< Channel descriptors in this instance */
+} __rte_packed ipc_instance_t;
+
+typedef struct ipc_metadata {
+	uint32_t ipc_host_signature; /**< IPC host signature, Set by host/L2 */
+	uint32_t ipc_geul_signature; /**< IPC geul signature, Set by modem */
+	ipc_instance_t instance_list[IPC_MAX_INSTANCE_COUNT];
+} __rte_packed ipc_metadata_t;
+
+typedef struct ipc_channel_us_priv {
+	int32_t		eventfd;
+	uint32_t	channel_id;
+	/* In flight packets status for buffer list. */
+	uint8_t		bufs_inflight[IPC_MAX_DEPTH];
+} ipc_channel_us_t;
+
+typedef struct {
+	uint64_t host_phys;
+	uint32_t modem_phys;
+	uint32_t size;
+} mem_strt_addr_t;
+
+typedef struct {
+	mem_strt_addr_t modem_ccsrbar;
+	mem_strt_addr_t peb_start; /* PEB meta data */
+	mem_strt_addr_t mhif_start; /* MHIF meta daat */
+	mem_strt_addr_t hugepg_start; /* Modem to access hugepage */
+} sys_map_t;
+
+typedef struct ipc_priv_t {
+	int instance_id;
+	int dev_ipc;
+	int dev_mem;
+	sys_map_t sys_map;
+	mem_range_t modem_ccsrbar;
+	mem_range_t peb_start;
+	mem_range_t mhif_start;
+	mem_range_t hugepg_start;
+	ipc_channel_us_t *channels[IPC_MAX_CHANNEL_COUNT];
+	ipc_instance_t	*instance;
+	ipc_instance_t	*instance_bk;
+} ipc_userspace_t;
+
+/** Structure specifying enqueue operation (enqueue at LA1224) */
+struct bbdev_ipc_enqueue_op {
+	/** Status of operation that was performed */
+	int32_t status;
+	/** CRC Status of SD operation that was performed */
+	int32_t crc_stat_addr;
+	/** HARQ Output buffer memory length for Shared Decode.
+	 * Filled by LA12xx.
+	 */
+	uint32_t out_len;
+	/** Reserved (for 8 byte alignment) */
+	uint32_t rsvd;
+};
+
 /* This shared memory would be on the host side which have copy of some
  * of the parameters which are also part of Shared BD ring. Read access
  * of these parameters from the host side would not be over PCI.
@@ -14,7 +187,21 @@
 typedef struct host_ipc_params {
 	volatile uint32_t pi;
 	volatile uint32_t ci;
-	volatile uint32_t modem_ptr[IPC_MAX_DEPTH];
+	volatile uint32_t bd_m_modem_ptr[IPC_MAX_DEPTH];
 } __rte_packed host_ipc_params_t;
 
+struct hif_ipc_regs {
+	uint32_t ipc_mdata_offset;
+	uint32_t ipc_mdata_size;
+} __rte_packed;
+
+struct gul_hif {
+	uint32_t ver;
+	uint32_t hif_ver;
+	uint32_t status;
+	volatile uint32_t host_ready;
+	volatile uint32_t mod_ready;
+	struct hif_ipc_regs ipc_regs;
+} __rte_packed;
+
 #endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v7 6/9] baseband/la12xx: add enqueue and dequeue support
  2021-09-28  8:29 ` [dpdk-dev] [PATCH v7 0/9] baseband: add NXP LA12xx driver nipun.gupta
                     ` (4 preceding siblings ...)
  2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 5/9] baseband/la12xx: add queue and modem config support nipun.gupta
@ 2021-09-28  8:29   ` nipun.gupta
  2021-10-04 23:23     ` Chautru, Nicolas
  2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 7/9] app/bbdev: enable la12xx for bbdev nipun.gupta
                     ` (2 subsequent siblings)
  8 siblings, 1 reply; 157+ messages in thread
From: nipun.gupta @ 2021-09-28  8:29 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

From: Hemant Agrawal <hemant.agrawal@nxp.com>

Add support for enqueue and dequeue the LDPC enc/dec
from the modem device.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 doc/guides/bbdevs/features/la12xx.ini      |  13 +
 doc/guides/bbdevs/la12xx.rst               |  47 ++-
 drivers/baseband/la12xx/bbdev_la12xx.c     | 328 ++++++++++++++++++++-
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h |  37 +++
 4 files changed, 420 insertions(+), 5 deletions(-)
 create mode 100644 doc/guides/bbdevs/features/la12xx.ini

diff --git a/doc/guides/bbdevs/features/la12xx.ini b/doc/guides/bbdevs/features/la12xx.ini
new file mode 100644
index 0000000000..0aec5eecb6
--- /dev/null
+++ b/doc/guides/bbdevs/features/la12xx.ini
@@ -0,0 +1,13 @@
+;
+; Supported features of the 'la12xx' bbdev driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Turbo Decoder (4G)     = N
+Turbo Encoder (4G)     = N
+LDPC Decoder (5G)      = Y
+LDPC Encoder (5G)      = Y
+LLR/HARQ Compression   = N
+HW Accelerated         = Y
+BBDEV API              = Y
diff --git a/doc/guides/bbdevs/la12xx.rst b/doc/guides/bbdevs/la12xx.rst
index 3c9ac5c047..b111ec0dd6 100644
--- a/doc/guides/bbdevs/la12xx.rst
+++ b/doc/guides/bbdevs/la12xx.rst
@@ -16,10 +16,11 @@ Features
 
 LA12xx PMD supports the following features:
 
+- LDPC Encode in the DL
+- LDPC Decode in the UL
 - Maximum of 8 UL queues
 - Maximum of 8 DL queues
 - PCIe Gen-3 x8 Interface
-- MSI-X
 
 Installation
 ------------
@@ -79,3 +80,47 @@ For enabling logs, use the following EAL parameter:
 
 Using ``bb.la12xx`` as log matching criteria, all Baseband PMD logs can be
 enabled which are lower than logging ``level``.
+
+Test Application
+----------------
+
+BBDEV provides a test application, ``test-bbdev.py`` and range of test data for testing
+the functionality of LA12xx for FEC encode and decode, depending on the device
+capabilities. The test application is located under app->test-bbdev folder and has the
+following options:
+
+.. code-block:: console
+
+  "-p", "--testapp-path": specifies path to the bbdev test app.
+  "-e", "--eal-params"	: EAL arguments which are passed to the test app.
+  "-t", "--timeout"	: Timeout in seconds (default=300).
+  "-c", "--test-cases"	: Defines test cases to run. Run all if not specified.
+  "-v", "--test-vector"	: Test vector path (default=dpdk_path+/app/test-bbdev/test_vectors/bbdev_null.data).
+  "-n", "--num-ops"	: Number of operations to process on device (default=32).
+  "-b", "--burst-size"	: Operations enqueue/dequeue burst size (default=32).
+  "-s", "--snr"		: SNR in dB used when generating LLRs for bler tests.
+  "-s", "--iter_max"	: Number of iterations for LDPC decoder.
+  "-l", "--num-lcores"	: Number of lcores to run (default=16).
+  "-i", "--init-device" : Initialise PF device with default values.
+
+
+To execute the test application tool using simple decode or encode data,
+type one of the following:
+
+.. code-block:: console
+
+  ./test-bbdev.py -e="--vdev=baseband_la12xx,socket_id=0,max_nb_queues=8" -c validation -n 64 -b 1 -v ./ldpc_dec_default.data
+  ./test-bbdev.py -e="--vdev=baseband_la12xx,socket_id=0,max_nb_queues=8" -c validation -n 64 -b 1 -v ./ldpc_enc_default.data
+
+The test application ``test-bbdev.py``, supports the ability to configure the PF device with
+a default set of values, if the "-i" or "- -init-device" option is included. The default values
+are defined in test_bbdev_perf.c.
+
+
+Test Vectors
+~~~~~~~~~~~~
+
+In addition to the simple LDPC decoder and LDPC encoder tests, bbdev also provides
+a range of additional tests under the test_vectors folder, which may be useful. The results
+of these tests will depend on the LA12xx FEC capabilities which may cause some
+testcases to be skipped, but no failure should be reported.
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 46ee5b4d70..69ca83cee6 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -120,6 +120,10 @@ la12xx_queue_release(struct rte_bbdev *dev, uint16_t q_id)
 		((uint64_t) ((unsigned long) (A) \
 		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
 
+#define MODEM_P2V(A) \
+	((uint64_t) ((unsigned long) (A) \
+		+ (unsigned long)(ipc_priv->peb_start.host_vaddr)))
+
 static int ipc_queue_configure(uint32_t channel_id,
 		ipc_t instance, struct bbdev_la12xx_q_priv *q_priv)
 {
@@ -334,6 +338,318 @@ static const struct rte_bbdev_ops pmd_ops = {
 	.queue_release = la12xx_queue_release,
 	.start = la12xx_start
 };
+
+static inline int
+is_bd_ring_full(uint32_t ci, uint32_t ci_flag,
+		uint32_t pi, uint32_t pi_flag)
+{
+	if (pi == ci) {
+		if (pi_flag != ci_flag)
+			return 1; /* Ring is Full */
+	}
+	return 0;
+}
+
+static inline int
+prepare_ldpc_enc_op(struct rte_bbdev_enc_op *bbdev_enc_op,
+		    struct bbdev_la12xx_q_priv *q_priv __rte_unused,
+		    struct rte_bbdev_op_data *in_op_data __rte_unused,
+		    struct rte_bbdev_op_data *out_op_data)
+{
+	struct rte_bbdev_op_ldpc_enc *ldpc_enc = &bbdev_enc_op->ldpc_enc;
+	uint32_t total_out_bits;
+
+	total_out_bits = (ldpc_enc->tb_params.cab *
+		ldpc_enc->tb_params.ea) + (ldpc_enc->tb_params.c -
+		ldpc_enc->tb_params.cab) * ldpc_enc->tb_params.eb;
+
+	ldpc_enc->output.length = (total_out_bits + 7)/8;
+
+	rte_pktmbuf_append(out_op_data->data, ldpc_enc->output.length);
+
+	return 0;
+}
+
+static inline int
+prepare_ldpc_dec_op(struct rte_bbdev_dec_op *bbdev_dec_op,
+		    struct bbdev_ipc_dequeue_op *bbdev_ipc_op,
+		    struct bbdev_la12xx_q_priv *q_priv  __rte_unused,
+		    struct rte_bbdev_op_data *out_op_data  __rte_unused)
+{
+	struct rte_bbdev_op_ldpc_dec *ldpc_dec = &bbdev_dec_op->ldpc_dec;
+	uint32_t total_out_bits;
+	uint32_t num_code_blocks = 0;
+	uint16_t sys_cols;
+
+	sys_cols = (ldpc_dec->basegraph == 1) ? 22 : 10;
+	if (ldpc_dec->tb_params.c == 1) {
+		total_out_bits = ((sys_cols * ldpc_dec->z_c) -
+				ldpc_dec->n_filler);
+		/* 5G-NR protocol uses 16 bit CRC when output packet
+		 * size <= 3824 (bits). Otherwise 24 bit CRC is used.
+		 * Adjust the output bits accordingly
+		 */
+		if (total_out_bits - 16 <= 3824)
+			total_out_bits -= 16;
+		else
+			total_out_bits -= 24;
+		ldpc_dec->hard_output.length = (total_out_bits / 8);
+	} else {
+		total_out_bits = (((sys_cols * ldpc_dec->z_c) -
+				ldpc_dec->n_filler - 24) *
+				ldpc_dec->tb_params.c);
+		ldpc_dec->hard_output.length = (total_out_bits / 8) - 3;
+	}
+
+	num_code_blocks = ldpc_dec->tb_params.c;
+
+	bbdev_ipc_op->num_code_blocks = rte_cpu_to_be_32(num_code_blocks);
+
+	return 0;
+}
+
+static int
+enqueue_single_op(struct bbdev_la12xx_q_priv *q_priv, void *bbdev_op)
+{
+	struct bbdev_la12xx_private *priv = q_priv->bbdev_priv;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	ipc_instance_t *ipc_instance = ipc_priv->instance;
+	struct bbdev_ipc_dequeue_op *bbdev_ipc_op;
+	struct rte_bbdev_op_ldpc_enc *ldpc_enc;
+	struct rte_bbdev_op_ldpc_dec *ldpc_dec;
+	uint32_t q_id = q_priv->q_id;
+	uint32_t ci, ci_flag, pi, pi_flag;
+	ipc_ch_t *ch = &(ipc_instance->ch_list[q_id]);
+	ipc_br_md_t *md = &(ch->md);
+	size_t virt;
+	char *huge_start_addr =
+		(char *)q_priv->bbdev_priv->ipc_priv->hugepg_start.host_vaddr;
+	struct rte_bbdev_op_data *in_op_data, *out_op_data;
+	char *data_ptr;
+	uint32_t l1_pcie_addr;
+	int ret;
+
+	ci = IPC_GET_CI_INDEX(q_priv->host_ci);
+	ci_flag = IPC_GET_CI_FLAG(q_priv->host_ci);
+
+	pi = IPC_GET_PI_INDEX(q_priv->host_pi);
+	pi_flag = IPC_GET_PI_FLAG(q_priv->host_pi);
+
+	rte_bbdev_dp_log(DEBUG, "before bd_ring_full: pi: %u, ci: %u,"
+		"pi_flag: %u, ci_flag: %u, ring size: %u",
+		pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	if (is_bd_ring_full(ci, ci_flag, pi, pi_flag)) {
+		rte_bbdev_dp_log(DEBUG, "bd ring full for queue id: %d", q_id);
+		return IPC_CH_FULL;
+	}
+
+	virt = MODEM_P2V(q_priv->host_params->bd_m_modem_ptr[pi]);
+	bbdev_ipc_op = (struct bbdev_ipc_dequeue_op *)virt;
+	q_priv->bbdev_op[pi] = bbdev_op;
+
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		ldpc_enc = &(((struct rte_bbdev_enc_op *)bbdev_op)->ldpc_enc);
+		in_op_data = &ldpc_enc->input;
+		out_op_data = &ldpc_enc->output;
+
+		ret = prepare_ldpc_enc_op(bbdev_op, q_priv,
+					  in_op_data, out_op_data);
+		if (ret) {
+			rte_bbdev_log(ERR, "process_ldpc_enc_op fail, ret: %d",
+				ret);
+			return ret;
+		}
+		break;
+
+	case RTE_BBDEV_OP_LDPC_DEC:
+		ldpc_dec = &(((struct rte_bbdev_dec_op *)bbdev_op)->ldpc_dec);
+		in_op_data = &ldpc_dec->input;
+
+		out_op_data = &ldpc_dec->hard_output;
+
+		ret = prepare_ldpc_dec_op(bbdev_op, bbdev_ipc_op,
+					  q_priv, out_op_data);
+		if (ret) {
+			rte_bbdev_log(ERR, "process_ldpc_dec_op fail, ret: %d",
+				ret);
+			return ret;
+		}
+		break;
+
+	default:
+		rte_bbdev_log(ERR, "unsupported bbdev_ipc op type");
+		return -1;
+	}
+
+	if (in_op_data->data) {
+		data_ptr = rte_pktmbuf_mtod(in_op_data->data, char *);
+		l1_pcie_addr = (uint32_t)GUL_USER_HUGE_PAGE_ADDR +
+			       data_ptr - huge_start_addr;
+		bbdev_ipc_op->in_addr = l1_pcie_addr;
+		bbdev_ipc_op->in_len = in_op_data->length;
+	}
+
+	if (out_op_data->data) {
+		data_ptr = rte_pktmbuf_mtod(out_op_data->data, char *);
+		l1_pcie_addr = (uint32_t)GUL_USER_HUGE_PAGE_ADDR +
+				data_ptr - huge_start_addr;
+		bbdev_ipc_op->out_addr = rte_cpu_to_be_32(l1_pcie_addr);
+		bbdev_ipc_op->out_len = rte_cpu_to_be_32(out_op_data->length);
+	}
+
+	/* Move Producer Index forward */
+	pi++;
+	/* Flip the PI flag, if wrapping */
+	if (unlikely(q_priv->queue_size == pi)) {
+		pi = 0;
+		pi_flag = pi_flag ? 0 : 1;
+	}
+
+	if (pi_flag)
+		IPC_SET_PI_FLAG(pi);
+	else
+		IPC_RESET_PI_FLAG(pi);
+	q_priv->host_pi = pi;
+
+	/* Wait for Data Copy & pi_flag update to complete before updating pi */
+	rte_mb();
+	/* now update pi */
+	md->pi = rte_cpu_to_be_32(pi);
+
+	rte_bbdev_dp_log(DEBUG, "enter: pi: %u, ci: %u,"
+			"pi_flag: %u, ci_flag: %u, ring size: %u",
+			pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	return 0;
+}
+
+/* Enqueue decode burst */
+static uint16_t
+enqueue_dec_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_dec_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	int nb_enqueued, ret;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ret = enqueue_single_op(q_priv, ops[nb_enqueued]);
+		if (ret)
+			break;
+	}
+
+	q_data->queue_stats.enqueue_err_count += nb_ops - nb_enqueued;
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
+/* Enqueue encode burst */
+static uint16_t
+enqueue_enc_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_enc_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	int nb_enqueued, ret;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ret = enqueue_single_op(q_priv, ops[nb_enqueued]);
+		if (ret)
+			break;
+	}
+
+	q_data->queue_stats.enqueue_err_count += nb_ops - nb_enqueued;
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
+/* Dequeue encode burst */
+static void *
+dequeue_single_op(struct bbdev_la12xx_q_priv *q_priv, void *dst)
+{
+	void *op;
+	uint32_t ci, ci_flag;
+	uint32_t temp_ci;
+
+	temp_ci = q_priv->host_params->ci;
+	if (temp_ci == q_priv->host_ci)
+		return NULL;
+
+	ci = IPC_GET_CI_INDEX(q_priv->host_ci);
+	ci_flag = IPC_GET_CI_FLAG(q_priv->host_ci);
+
+	rte_bbdev_dp_log(DEBUG,
+		"ci: %u, ci_flag: %u, ring size: %u",
+		ci, ci_flag, q_priv->queue_size);
+
+	op = q_priv->bbdev_op[ci];
+
+	rte_memcpy(dst, q_priv->msg_ch_vaddr[ci],
+		sizeof(struct bbdev_ipc_enqueue_op));
+
+	/* Move Consumer Index forward */
+	ci++;
+	/* Flip the CI flag, if wrapping */
+	if (q_priv->queue_size == ci) {
+		ci = 0;
+		ci_flag = ci_flag ? 0 : 1;
+	}
+	if (ci_flag)
+		IPC_SET_CI_FLAG(ci);
+	else
+		IPC_RESET_CI_FLAG(ci);
+
+	q_priv->host_ci = ci;
+
+	rte_bbdev_dp_log(DEBUG,
+		"exit: ci: %u, ci_flag: %u, ring size: %u",
+		ci, ci_flag, q_priv->queue_size);
+
+	return op;
+}
+
+/* Dequeue decode burst */
+static uint16_t
+dequeue_dec_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_dec_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	struct bbdev_ipc_enqueue_op bbdev_ipc_op;
+	int nb_dequeued;
+
+	for (nb_dequeued = 0; nb_dequeued < nb_ops; nb_dequeued++) {
+		ops[nb_dequeued] = dequeue_single_op(q_priv, &bbdev_ipc_op);
+		if (!ops[nb_dequeued])
+			break;
+		ops[nb_dequeued]->status = bbdev_ipc_op.status;
+	}
+	q_data->queue_stats.dequeued_count += nb_dequeued;
+
+	return nb_dequeued;
+}
+
+/* Dequeue encode burst */
+static uint16_t
+dequeue_enc_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_enc_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	struct bbdev_ipc_enqueue_op bbdev_ipc_op;
+	int nb_enqueued;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ops[nb_enqueued] = dequeue_single_op(q_priv, &bbdev_ipc_op);
+		if (!ops[nb_enqueued])
+			break;
+		ops[nb_enqueued]->status = bbdev_ipc_op.status;
+	}
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
 static struct hugepage_info *
 get_hugepage_info(void)
 {
@@ -710,10 +1026,14 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 	bbdev->intr_handle = NULL;
 
 	/* register rx/tx burst functions for data path */
-	bbdev->dequeue_enc_ops = NULL;
-	bbdev->dequeue_dec_ops = NULL;
-	bbdev->enqueue_enc_ops = NULL;
-	bbdev->enqueue_dec_ops = NULL;
+	bbdev->dequeue_enc_ops = dequeue_enc_ops;
+	bbdev->dequeue_dec_ops = dequeue_dec_ops;
+	bbdev->enqueue_enc_ops = enqueue_enc_ops;
+	bbdev->enqueue_dec_ops = enqueue_dec_ops;
+	bbdev->dequeue_ldpc_enc_ops = dequeue_enc_ops;
+	bbdev->dequeue_ldpc_dec_ops = dequeue_dec_ops;
+	bbdev->enqueue_ldpc_enc_ops = enqueue_enc_ops;
+	bbdev->enqueue_ldpc_dec_ops = enqueue_dec_ops;
 
 	return 0;
 }
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
index 5f613fb087..b6a7f677d0 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -73,6 +73,25 @@ typedef struct {
 	_IOWR(GUL_IPC_MAGIC, 5, struct ipc_msg *)
 #define IOCTL_GUL_IPC_CHANNEL_RAISE_INTERRUPT _IOW(GUL_IPC_MAGIC, 6, int *)
 
+#define GUL_USER_HUGE_PAGE_OFFSET	(0)
+#define GUL_PCI1_ADDR_BASE	(0x00000000ULL)
+
+#define GUL_USER_HUGE_PAGE_ADDR	(GUL_PCI1_ADDR_BASE + GUL_USER_HUGE_PAGE_OFFSET)
+
+/* IPC PI/CI index & flag manipulation helpers */
+#define IPC_PI_CI_FLAG_MASK	0x80000000 /*  (1<<31) */
+#define IPC_PI_CI_INDEX_MASK	0x7FFFFFFF /* ~(1<<31) */
+
+#define IPC_SET_PI_FLAG(x)	(x |= IPC_PI_CI_FLAG_MASK)
+#define IPC_RESET_PI_FLAG(x)	(x &= IPC_PI_CI_INDEX_MASK)
+#define IPC_GET_PI_FLAG(x)	(x >> 31)
+#define IPC_GET_PI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
+
+#define IPC_SET_CI_FLAG(x)	(x |= IPC_PI_CI_FLAG_MASK)
+#define IPC_RESET_CI_FLAG(x)	(x &= IPC_PI_CI_INDEX_MASK)
+#define IPC_GET_CI_FLAG(x)	(x >> 31)
+#define IPC_GET_CI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
+
 /** buffer ring common metadata */
 typedef struct ipc_bd_ring_md {
 	volatile uint32_t pi;		/**< Producer index and flag (MSB)
@@ -180,6 +199,24 @@ struct bbdev_ipc_enqueue_op {
 	uint32_t rsvd;
 };
 
+/** Structure specifying dequeue operation (dequeue at LA1224) */
+struct bbdev_ipc_dequeue_op {
+	/** Input buffer memory address */
+	uint32_t in_addr;
+	/** Input buffer memory length */
+	uint32_t in_len;
+	/** Output buffer memory address */
+	uint32_t out_addr;
+	/** Output buffer memory length */
+	uint32_t out_len;
+	/* Number of code blocks. Only set when HARQ is used */
+	uint32_t num_code_blocks;
+	/** Dequeue Operation flags */
+	uint32_t op_flags;
+	/** Shared metadata between L1 and L2 */
+	uint32_t shared_metadata;
+};
+
 /* This shared memory would be on the host side which have copy of some
  * of the parameters which are also part of Shared BD ring. Read access
  * of these parameters from the host side would not be over PCI.
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v7 7/9] app/bbdev: enable la12xx for bbdev
  2021-09-28  8:29 ` [dpdk-dev] [PATCH v7 0/9] baseband: add NXP LA12xx driver nipun.gupta
                     ` (5 preceding siblings ...)
  2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 6/9] baseband/la12xx: add enqueue and dequeue support nipun.gupta
@ 2021-09-28  8:29   ` nipun.gupta
  2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 8/9] app/bbdev: handle endianness of test data nipun.gupta
  2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 9/9] app/bbdev: add test vectors for transport blocks nipun.gupta
  8 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-09-28  8:29 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal

From: Hemant Agrawal <hemant.agrawal@nxp.com>

this patch adds la12xx driver in test bbdev

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/test-bbdev/meson.build | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/app/test-bbdev/meson.build b/app/test-bbdev/meson.build
index edb9deef84..a726a5b3fa 100644
--- a/app/test-bbdev/meson.build
+++ b/app/test-bbdev/meson.build
@@ -23,3 +23,6 @@ endif
 if dpdk_conf.has('RTE_BASEBAND_ACC100')
     deps += ['baseband_acc100']
 endif
+if dpdk_conf.has('RTE_LIBRTE_PMD_BBDEV_LA12XX')
+	deps += ['baseband_la12xx']
+endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v7 8/9] app/bbdev: handle endianness of test data
  2021-09-28  8:29 ` [dpdk-dev] [PATCH v7 0/9] baseband: add NXP LA12xx driver nipun.gupta
                     ` (6 preceding siblings ...)
  2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 7/9] app/bbdev: enable la12xx for bbdev nipun.gupta
@ 2021-09-28  8:29   ` nipun.gupta
  2021-10-04 23:38     ` Chautru, Nicolas
  2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 9/9] app/bbdev: add test vectors for transport blocks nipun.gupta
  8 siblings, 1 reply; 157+ messages in thread
From: nipun.gupta @ 2021-09-28  8:29 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

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

With data input, output and harq also supported in big
endian format, this patch updates the testbbdev application
to handle the endianness conversion as directed by the
the driver being used.

If the driver supports big endian data processing, conversion
from little endian to big is handled by the testbbdev application.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 app/test-bbdev/test_bbdev_perf.c | 62 ++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c
index 469597b8b3..a0f565ee3f 100644
--- a/app/test-bbdev/test_bbdev_perf.c
+++ b/app/test-bbdev/test_bbdev_perf.c
@@ -227,6 +227,64 @@ clear_soft_out_cap(uint32_t *op_flags)
 	*op_flags &= ~RTE_BBDEV_TURBO_NEG_LLR_1_BIT_SOFT_OUT;
 }
 
+static inline void
+reverse_op(struct op_data_entries *op)
+{
+	uint8_t nb_segs = op->nb_segments;
+	uint32_t *data, len;
+	int complete, rem, i, j;
+	uint8_t *rem_data, temp;
+
+	/* Validate each mbuf segment length */
+	for (i = 0; i < nb_segs; ++i) {
+		len = op->segments[i].length;
+		data = op->segments[i].addr;
+
+		/* Swap complete u32 bytes */
+		complete = len / 4;
+		for (j = 0; j < complete; j++)
+			data[j] = rte_bswap32(data[j]);
+
+		/* Swap any remaining data for last seg */
+		if (i == (nb_segs - 1)) {
+			rem = len % 4;
+			rem_data = (uint8_t *)&data[j];
+			for (j = 0; j < rem/2; j++) {
+				temp = rem_data[j];
+				rem_data[j] = rem_data[rem - j - 1];
+				rem_data[rem - j - 1] = temp;
+			}
+		}
+	}
+}
+
+static inline void
+reverse_all_ops(void)
+{
+	unsigned int nb_inputs, nb_soft_outputs, nb_hard_outputs,
+		nb_harq_inputs, nb_harq_outputs;
+
+	nb_inputs = test_vector.entries[DATA_INPUT].nb_segments;
+	if (nb_inputs)
+		reverse_op(&test_vector.entries[DATA_INPUT]);
+
+	nb_soft_outputs = test_vector.entries[DATA_SOFT_OUTPUT].nb_segments;
+	if (nb_soft_outputs)
+		reverse_op(&test_vector.entries[DATA_SOFT_OUTPUT]);
+
+	nb_hard_outputs = test_vector.entries[DATA_HARD_OUTPUT].nb_segments;
+	if (nb_hard_outputs)
+		reverse_op(&test_vector.entries[DATA_HARD_OUTPUT]);
+
+	nb_harq_inputs  = test_vector.entries[DATA_HARQ_INPUT].nb_segments;
+	if (nb_harq_inputs)
+		reverse_op(&test_vector.entries[DATA_HARQ_INPUT]);
+
+	nb_harq_outputs = test_vector.entries[DATA_HARQ_OUTPUT].nb_segments;
+	if (nb_harq_outputs)
+		reverse_op(&test_vector.entries[DATA_HARQ_OUTPUT]);
+}
+
 static int
 check_dev_cap(const struct rte_bbdev_info *dev_info)
 {
@@ -234,6 +292,7 @@ check_dev_cap(const struct rte_bbdev_info *dev_info)
 	unsigned int nb_inputs, nb_soft_outputs, nb_hard_outputs,
 		nb_harq_inputs, nb_harq_outputs;
 	const struct rte_bbdev_op_cap *op_cap = dev_info->drv.capabilities;
+	uint8_t be_data = dev_info->drv.support_be_data;
 
 	nb_inputs = test_vector.entries[DATA_INPUT].nb_segments;
 	nb_soft_outputs = test_vector.entries[DATA_SOFT_OUTPUT].nb_segments;
@@ -245,6 +304,9 @@ check_dev_cap(const struct rte_bbdev_info *dev_info)
 		if (op_cap->type != test_vector.op_type)
 			continue;
 
+		if (be_data)
+			reverse_all_ops();
+
 		if (op_cap->type == RTE_BBDEV_OP_TURBO_DEC) {
 			const struct rte_bbdev_op_cap_turbo_dec *cap =
 					&op_cap->cap.turbo_dec;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v7 9/9] app/bbdev: add test vectors for transport blocks
  2021-09-28  8:29 ` [dpdk-dev] [PATCH v7 0/9] baseband: add NXP LA12xx driver nipun.gupta
                     ` (7 preceding siblings ...)
  2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 8/9] app/bbdev: handle endianness of test data nipun.gupta
@ 2021-09-28  8:29   ` nipun.gupta
  2021-10-04 23:31     ` Chautru, Nicolas
  8 siblings, 1 reply; 157+ messages in thread
From: nipun.gupta @ 2021-09-28  8:29 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

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

This patch adds two test vectors for transport block in network byte
order:
- LDPC encode for Transport Block
- LDPC decode for Transport block

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 app/test-bbdev/test_vectors/ldpc_dec_tb.data | 265 +++++++++++++++++++
 app/test-bbdev/test_vectors/ldpc_enc_tb.data |  95 +++++++
 2 files changed, 360 insertions(+)
 create mode 100644 app/test-bbdev/test_vectors/ldpc_dec_tb.data
 create mode 100644 app/test-bbdev/test_vectors/ldpc_enc_tb.data

diff --git a/app/test-bbdev/test_vectors/ldpc_dec_tb.data b/app/test-bbdev/test_vectors/ldpc_dec_tb.data
new file mode 100644
index 0000000000..5882e8aafe
--- /dev/null
+++ b/app/test-bbdev/test_vectors/ldpc_dec_tb.data
@@ -0,0 +1,265 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2021 NXP
+
+op_type =
+RTE_BBDEV_OP_LDPC_DEC
+
+input0 =
+0x7f818181, 0x7f7f817f, 0x7f817f81, 0x817f8181, 0x817f7f81, 0x817f7f81, 0x7f817f7f, 0x7f7f7f81,
+0x7f7f7f7f, 0x817f7f7f, 0x7f7f8181, 0x817f7f7f, 0x7f7f817f, 0x8181817f, 0x817f7f81, 0x7f7f8181,
+0x81817f81, 0x7f7f7f81, 0x81817f7f, 0x7f81817f, 0x817f7f81, 0x7f817f81, 0x8181817f, 0x7f7f7f81,
+0x7f7f817f, 0x81817f7f, 0x7f81817f, 0x7f7f817f, 0x817f817f, 0x7f7f817f, 0x7f7f7f81, 0x7f7f7f81,
+0x7f817f7f, 0x7f818181, 0x7f818181, 0x8181817f, 0x7f7f8181, 0x7f7f7f7f, 0x7f817f7f, 0x81818181,
+0x7f7f817f, 0x7f7f7f7f, 0x817f8181, 0x7f7f7f81, 0x817f817f, 0x817f8181, 0x81817f7f, 0x7f7f7f7f,
+0x81817f7f, 0x7f81817f, 0x817f7f7f, 0x817f7f81, 0x7f817f7f, 0x817f817f, 0x81817f81, 0x817f7f7f,
+0x817f7f81, 0x817f817f, 0x8181817f, 0x81818181, 0x81818181, 0x817f7f7f, 0x7f817f81, 0x817f7f7f,
+0x7f817f7f, 0x7f817f7f, 0x7f818181, 0x7f818181, 0x817f817f, 0x81817f81, 0x7f81817f, 0x817f817f,
+0x7f81817f, 0x817f7f81, 0x7f7f817f, 0x817f8181, 0x817f7f81, 0x81817f7f, 0x8181817f, 0x7f7f7f7f,
+0x817f7f81, 0x7f81817f, 0x7f7f7f7f, 0x7f817f81, 0x7f817f81, 0x817f7f7f, 0x81818181, 0x7f7f8181,
+0x7f818181, 0x81817f7f, 0x7f817f81, 0x7f81817f, 0x7f7f8181, 0x7f7f817f, 0x7f7f817f, 0x81817f81,
+0x7f818181, 0x8181817f, 0x7f817f81, 0x7f7f8181, 0x7f7f8181, 0x817f7f81, 0x7f7f7f7f, 0x7f817f7f,
+0x7f7f8181, 0x7f817f7f, 0x7f818181, 0x81817f7f, 0x817f7f7f, 0x81817f81, 0x7f817f7f, 0x7f81817f,
+0x7f81817f, 0x817f7f81, 0x7f817f7f, 0x817f817f, 0x7f7f817f, 0x817f7f81, 0x817f817f, 0x817f8181,
+0x817f817f, 0x7f817f7f, 0x7f817f7f, 0x8181817f, 0x7f818181, 0x7f817f7f, 0x7f818181, 0x7f7f817f,
+0x817f8181, 0x8181817f, 0x7f817f7f, 0x7f7f817f, 0x7f7f817f, 0x7f7f8181, 0x817f7f7f, 0x817f8181,
+0x7f7f817f, 0x7f7f7f81, 0x817f7f81, 0x7f7f7f81, 0x7f7f7f7f, 0x817f8181, 0x81818181, 0x81817f81,
+0x817f7f81, 0x7f7f817f, 0x7f817f7f, 0x7f7f8181, 0x7f7f7f81, 0x7f817f81, 0x817f8181, 0x81817f7f,
+0x7f7f817f, 0x7f817f81, 0x7f817f81, 0x7f7f7f81, 0x81818181, 0x81817f7f, 0x7f7f817f, 0x7f817f81,
+0x7f7f8181, 0x7f81817f, 0x817f8181, 0x7f7f8181, 0x7f7f7f81, 0x8181817f, 0x7f817f81, 0x81817f7f,
+0x817f7f81, 0x817f8181, 0x817f7f7f, 0x7f7f817f, 0x817f7f7f, 0x81817f81, 0x7f7f7f7f, 0x817f7f7f,
+0x817f7f81, 0x7f817f81, 0x8181817f, 0x81817f7f, 0x817f7f81, 0x7f818181, 0x7f7f817f, 0x7f818181,
+0x7f7f7f7f, 0x7f7f8181, 0x7f7f817f, 0x7f817f81, 0x817f7f7f, 0x817f817f, 0x7f7f7f81, 0x7f7f7f81,
+0x7f7f817f, 0x817f8181, 0x81817f81, 0x817f7f7f, 0x7f7f7f81, 0x817f7f7f, 0x7f7f7f7f, 0x7f7f817f,
+0x81817f81, 0x7f7f7f81, 0x81817f7f, 0x81818181, 0x817f7f81, 0x817f817f, 0x817f7f7f, 0x7f7f7f7f,
+0x7f81817f, 0x8181817f, 0x7f7f817f, 0x817f7f81, 0x7f81817f, 0x817f7f81, 0x7f7f817f, 0x7f818181,
+0x817f7f7f, 0x817f7f81, 0x81817f81, 0x81817f81, 0x8181817f, 0x7f817f7f, 0x7f7f7f81, 0x8181817f,
+0x7f817f81, 0x8181817f, 0x7f7f7f81, 0x817f8181, 0x817f7f81, 0x81817f81, 0x7f7f817f, 0x7f7f817f,
+0x817f7f7f, 0x817f8181, 0x7f817f7f, 0x817f7f81, 0x7f7f7f81, 0x7f7f7f7f, 0x817f8181, 0x7f817f81,
+0x81817f81, 0x7f7f7f81, 0x817f7f7f, 0x817f817f, 0x81817f7f, 0x817f7f81, 0x7f81817f, 0x817f817f,
+0x81817f81, 0x8181817f, 0x7f818181, 0x7f81817f, 0x8181817f, 0x817f7f7f, 0x7f817f7f, 0x8181817f,
+0x7f7f7f7f, 0x81817f7f, 0x7f7f7f81, 0x817f7f81, 0x7f7f7f81, 0x7f817f7f, 0x7f7f7f7f, 0x817f7f81,
+0x7f818181, 0x817f7f7f, 0x7f7f7f81, 0x817f7f7f, 0x81818181, 0x81817f7f, 0x7f817f81, 0x7f7f7f81,
+0x7f818181, 0x817f8181, 0x81817f81, 0x8181817f, 0x7f7f8181, 0x817f7f81, 0x7f81817f, 0x7f7f817f,
+0x7f7f8181, 0x7f817f7f, 0x8181817f, 0x7f817f81, 0x7f817f7f, 0x7f7f8181, 0x7f818181, 0x7f7f8181,
+0x817f7f81, 0x81817f81, 0x7f81817f, 0x81817f81, 0x817f7f7f, 0x7f818181, 0x8181817f, 0x817f8181,
+0x7f7f7f81, 0x7f81817f, 0x81817f7f, 0x7f817f81, 0x7f7f817f, 0x7f7f8181, 0x7f81817f, 0x7f81817f,
+0x7f818181, 0x817f7f7f, 0x817f8181, 0x7f7f8181, 0x8181817f, 0x7f817f81, 0x817f8181, 0x817f817f,
+0x7f7f817f, 0x81817f81, 0x7f817f7f, 0x7f81817f, 0x817f817f, 0x81817f81, 0x7f7f7f7f, 0x8181817f,
+0x7f817f81, 0x7f817f7f, 0x7f817f81, 0x7f817f7f, 0x7f7f7f81, 0x817f817f, 0x7f81817f, 0x817f7f81,
+0x81818181, 0x7f817f81, 0x7f7f7f81, 0x7f81817f, 0x817f7f7f, 0x817f7f81, 0x817f7f7f, 0x81817f81,
+0x7f7f817f, 0x817f8181, 0x81818181, 0x81817f81, 0x81817f81, 0x81817f7f, 0x81817f7f, 0x7f817f81,
+0x7f817f7f, 0x7f7f7f81, 0x7f81817f, 0x817f7f81, 0x817f8181, 0x817f7f81, 0x7f817f81, 0x81818181,
+0x7f7f7f7f, 0x817f8181, 0x817f817f, 0x81818181, 0x81817f7f, 0x7f81817f, 0x81817f81, 0x81818181,
+0x7f7f7f81, 0x81817f81, 0x81818181, 0x817f7f7f, 0x817f817f, 0x81818181, 0x7f7f7f7f, 0x7f7f817f,
+0x7f817f81, 0x8181817f, 0x81817f81, 0x7f7f7f7f, 0x7f7f817f, 0x81817f7f, 0x817f817f, 0x7f7f7f81,
+0x81818181, 0x7f7f817f, 0x81818181, 0x7f81817f, 0x7f7f7f7f, 0x817f8181, 0x7f81817f, 0x817f7f7f,
+0x8181817f, 0x8181817f, 0x817f7f7f, 0x7f7f817f, 0x7f81817f, 0x7f817f81, 0x81817f7f, 0x817f7f7f,
+0x81818181, 0x81817f7f, 0x7f81817f, 0x8181817f, 0x817f8181, 0x81817f7f, 0x7f818181, 0x7f7f7f7f,
+0x81818181, 0x8181817f, 0x7f81817f, 0x8181817f, 0x7f7f7f7f, 0x7f817f81, 0x7f7f8181, 0x817f8181,
+0x8181817f, 0x81817f7f, 0x7f817f7f, 0x81818181, 0x7f7f8181, 0x817f817f, 0x7f7f8181, 0x817f7f7f,
+0x81817f7f, 0x81818181, 0x817f7f7f, 0x7f7f817f, 0x81818181, 0x7f817f7f, 0x817f7f7f, 0x7f818181,
+0x7f817f81, 0x7f817f7f, 0x817f817f, 0x8181817f, 0x7f7f8181, 0x817f8181, 0x817f7f7f, 0x817f817f,
+0x7f7f817f, 0x7f7f7f7f, 0x7f817f7f, 0x7f7f7f81, 0x81817f81, 0x8181817f, 0x81818181, 0x7f818181,
+0x817f817f, 0x7f818181, 0x7f81817f, 0x7f817f81, 0x7f817f7f, 0x7f81817f, 0x817f8181, 0x81818181,
+0x7f7f7f7f, 0x7f817f81, 0x7f817f7f, 0x8181817f, 0x817f817f, 0x7f817f7f, 0x817f817f, 0x81818181,
+0x7f7f8181, 0x81817f81, 0x817f7f7f, 0x817f7f81, 0x8181817f, 0x817f7f7f, 0x817f7f81, 0x7f817f81,
+0x817f817f, 0x817f817f, 0x81817f81, 0x817f8181, 0x817f817f, 0x7f7f8181, 0x7f7f8181, 0x7f7f817f,
+0x817f7f81, 0x817f8181, 0x7f7f817f, 0x7f7f817f, 0x7f7f8181, 0x7f81817f, 0x7f7f7f7f, 0x7f7f7f7f,
+0x7f7f7f81, 0x7f817f81, 0x7f817f7f, 0x817f8181, 0x817f8181, 0x7f81817f, 0x817f7f7f, 0x7f818181,
+0x7f817f7f, 0x7f817f81, 0x81817f7f, 0x817f7f81, 0x8181817f, 0x817f7f81, 0x7f818181, 0x817f7f81,
+0x7f818181, 0x817f7f7f, 0x7f818181, 0x7f7f8181, 0x81817f81, 0x817f7f7f, 0x7f7f817f, 0x817f7f81,
+0x817f817f, 0x7f817f81, 0x817f8181, 0x817f8181, 0x7f7f7f81, 0x7f817f7f, 0x81817f81, 0x7f7f8181,
+0x81817f7f, 0x817f7f7f, 0x7f817f7f, 0x817f8181, 0x817f817f, 0x7f81817f, 0x7f818181, 0x817f817f,
+0x7f7f7f7f, 0x7f817f81, 0x7f7f817f, 0x7f818181, 0x81817f81, 0x7f817f81, 0x817f7f7f, 0x7f7f7f7f,
+0x7f7f7f7f, 0x817f7f81, 0x7f7f8181, 0x81817f7f, 0x7f817f81, 0x817f817f, 0x7f7f8181, 0x7f817f7f,
+0x7f7f7f81, 0x817f817f, 0x8181817f, 0x7f81817f, 0x81817f81, 0x7f7f817f, 0x7f818181, 0x8181817f,
+0x7f818181, 0x7f7f7f7f, 0x7f7f8181, 0x817f7f7f, 0x7f7f817f, 0x7f817f7f, 0x81817f81, 0x7f7f817f,
+0x817f7f81, 0x7f817f81, 0x7f7f7f7f, 0x7f818181, 0x81817f7f, 0x817f8181, 0x7f817f7f, 0x7f7f817f,
+0x817f817f, 0x7f7f817f, 0x7f7f8181, 0x81818181, 0x817f7f7f, 0x7f81817f, 0x81818181, 0x817f817f,
+0x817f7f81, 0x7f817f7f, 0x817f7f7f, 0x8181817f, 0x7f7f7f7f, 0x81818181, 0x7f817f81, 0x7f817f7f,
+0x817f7f7f, 0x817f7f7f, 0x7f7f8181, 0x7f81817f, 0x7f818181, 0x7f7f817f, 0x7f81817f, 0x7f7f7f7f,
+0x817f7f7f, 0x81818181, 0x817f7f81, 0x817f8181, 0x7f81817f, 0x8181817f, 0x8181817f, 0x817f7f81,
+0x7f7f817f, 0x7f81817f, 0x7f7f7f7f, 0x81817f81, 0x7f7f817f, 0x7f817f81, 0x81818181, 0x7f7f817f,
+0x7f817f7f, 0x81818181, 0x81817f81, 0x817f7f7f, 0x7f817f7f, 0x817f7f81, 0x8181817f, 0x7f7f7f7f,
+0x7f817f7f, 0x81817f7f, 0x817f8181, 0x817f8181, 0x7f818181, 0x817f8181, 0x7f818181, 0x7f7f817f,
+0x817f8181, 0x7f7f817f, 0x7f7f817f, 0x81818181, 0x81817f81, 0x7f7f7f81, 0x817f817f, 0x7f7f7f7f,
+0x7f7f7f7f, 0x81818181, 0x7f7f7f81, 0x7f818181, 0x7f7f8181, 0x7f7f7f7f, 0x81817f81, 0x7f817f7f,
+0x8181817f, 0x7f817f7f, 0x817f7f7f, 0x7f817f81, 0x8181817f, 0x7f7f817f, 0x817f7f7f, 0x7f7f7f7f,
+0x8181817f, 0x7f81817f, 0x7f7f817f, 0x7f7f7f7f, 0x8181817f, 0x7f7f7f7f, 0x8181817f, 0x7f817f81,
+0x81818181, 0x7f7f7f7f, 0x817f8181, 0x81818181, 0x7f7f817f, 0x7f817f7f, 0x817f8181, 0x7f7f8181,
+0x8181817f, 0x7f7f7f7f, 0x81817f7f, 0x7f7f817f, 0x817f7f7f, 0x7f817f7f, 0x817f817f, 0x7f7f817f,
+0x81818181, 0x81818181, 0x7f7f7f81, 0x81818181, 0x817f7f81, 0x7f7f8181, 0x81818181, 0x7f7f7f81,
+0x7f81817f, 0x817f817f, 0x817f8181, 0x8181817f, 0x7f7f8181, 0x7f817f81, 0x817f817f, 0x817f8181,
+0x81818181, 0x7f818181, 0x817f7f81, 0x8181817f, 0x7f817f81, 0x81817f7f, 0x81817f81, 0x81817f81,
+0x817f7f81, 0x7f817f7f, 0x7f817f7f, 0x81818181, 0x7f817f7f, 0x7f7f8181, 0x817f817f, 0x7f7f7f7f,
+0x7f81817f, 0x7f81817f, 0x817f817f, 0x7f7f7f7f, 0x8181817f, 0x7f817f81, 0x817f8181, 0x7f7f8181,
+0x817f7f7f, 0x81818181, 0x8181817f, 0x817f7f81, 0x7f818181, 0x7f7f7f81, 0x7f81817f, 0x817f7f81,
+0x81817f7f, 0x8181817f, 0x81818181, 0x7f818181, 0x7f818181, 0x81817f7f, 0x7f81817f, 0x81818181,
+0x81817f7f, 0x81817f7f, 0x817f7f7f, 0x7f81817f, 0x81817f7f, 0x8181817f, 0x81818181, 0x81818181,
+0x7f817f81, 0x7f817f81, 0x817f7f81, 0x81817f81, 0x7f7f817f, 0x81817f81, 0x817f7f81, 0x817f817f,
+0x81817f7f, 0x81817f81, 0x7f7f817f, 0x81818181, 0x7f7f7f81, 0x81817f81, 0x7f7f8181, 0x817f7f81,
+0x817f7f7f, 0x81818181, 0x817f817f, 0x7f818181, 0x817f8181, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f817f,
+0x7f81817f, 0x8181817f, 0x81817f7f, 0x7f7f8181, 0x81817f81, 0x81818181, 0x817f817f, 0x8181817f,
+0x7f7f7f7f, 0x7f7f8181, 0x7f81817f, 0x7f7f7f81, 0x7f7f7f7f, 0x7f7f7f7f, 0x81817f81, 0x817f7f7f,
+0x7f7f8181, 0x817f7f7f, 0x7f817f81, 0x817f8181, 0x817f8181, 0x817f8181, 0x81817f81, 0x81817f7f,
+0x7f818181, 0x7f7f7f7f, 0x7f7f817f, 0x817f8181, 0x7f7f7f81, 0x7f7f817f, 0x7f7f7f81, 0x7f817f81,
+0x81817f7f, 0x817f817f, 0x817f7f81, 0x81818181, 0x7f7f817f, 0x7f817f81, 0x817f7f7f, 0x7f81817f,
+0x7f817f81, 0x817f817f, 0x817f7f7f, 0x81817f7f, 0x7f818181, 0x7f7f7f81, 0x817f7f81, 0x81817f81,
+0x7f7f7f81, 0x817f7f81, 0x817f7f81, 0x817f8181, 0x7f817f81, 0x7f81817f, 0x7f7f817f, 0x81817f81,
+0x8181817f, 0x81817f81, 0x7f81817f, 0x817f7f81, 0x7f817f81, 0x7f818181, 0x7f7f7f81, 0x817f8181,
+0x7f7f8181, 0x7f81817f, 0x81818181, 0x7f7f817f, 0x7f818181, 0x81818181, 0x7f81817f, 0x7f818181,
+0x817f817f, 0x81818181, 0x7f7f7f81, 0x7f7f7f7f, 0x8181817f, 0x817f7f81, 0x817f7f81, 0x7f7f7f7f,
+0x817f8181, 0x817f7f81, 0x81818181, 0x81817f7f, 0x7f7f8181, 0x8181817f, 0x817f8181, 0x817f817f,
+0x817f817f, 0x8181817f, 0x7f818181, 0x817f7f81, 0x81817f81, 0x817f817f, 0x7f7f8181, 0x7f817f7f,
+0x81817f81, 0x817f7f7f, 0x7f7f817f, 0x7f817f81, 0x7f817f7f, 0x817f817f, 0x81818181, 0x7f818181,
+0x81817f7f, 0x7f818181, 0x8181817f, 0x817f7f81, 0x7f7f7f81, 0x7f81817f, 0x7f817f81, 0x81817f7f,
+0x7f7f7f81, 0x81817f7f, 0x81817f7f, 0x817f7f81, 0x817f8181, 0x8181817f, 0x817f817f, 0x7f7f7f81,
+0x7f7f817f, 0x7f81817f, 0x8181817f, 0x7f81817f, 0x7f817f81, 0x81818181, 0x7f817f81, 0x7f7f7f7f,
+0x7f818181, 0x81817f7f, 0x817f8181, 0x81817f7f, 0x817f817f, 0x7f7f7f81, 0x817f7f81, 0x7f817f81,
+0x81817f81, 0x7f817f7f, 0x8181817f, 0x7f818181, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f8181, 0x7f7f8181,
+0x817f817f, 0x81817f81, 0x817f7f7f, 0x817f7f7f, 0x817f7f7f, 0x8181817f, 0x81818181, 0x81818181,
+0x8181817f, 0x7f817f7f, 0x81817f7f, 0x7f7f8181, 0x817f7f81, 0x7f81817f, 0x7f7f817f, 0x81817f81,
+0x817f7f81, 0x81817f81, 0x7f817f81, 0x817f7f7f, 0x81817f81, 0x7f81817f, 0x7f818181, 0x81817f81,
+0x7f7f817f, 0x7f7f7f81, 0x7f7f817f, 0x7f7f7f7f, 0x817f7f81, 0x81817f7f, 0x7f81817f, 0x7f7f7f7f,
+0x7f81817f, 0x7f817f7f, 0x817f7f81, 0x81817f7f, 0x7f7f7f81, 0x7f7f7f7f, 0x817f8181, 0x7f7f7f81,
+0x7f7f8181, 0x7f81817f, 0x81818181, 0x7f7f7f7f, 0x81817f7f, 0x7f7f817f, 0x8181817f, 0x81818181,
+0x81817f81, 0x817f7f7f, 0x81818181, 0x817f8181, 0x7f7f8181, 0x7f81817f, 0x817f7f81, 0x7f7f7f81,
+0x7f817f7f, 0x81818181, 0x7f7f817f, 0x817f7f81, 0x817f7f81, 0x81817f7f, 0x7f817f81, 0x7f817f7f,
+0x81817f7f, 0x81818181, 0x8181817f, 0x7f7f8181, 0x7f817f81, 0x81817f81, 0x81817f7f, 0x817f7f81,
+0x817f7f81, 0x7f818181, 0x7f818181, 0x817f8181, 0x7f81817f, 0x7f7f817f, 0x7f817f81, 0x7f81817f,
+0x7f817f7f, 0x817f8181, 0x7f7f817f, 0x81817f7f, 0x817f7f81, 0x7f818181, 0x81817f7f, 0x7f817f81,
+0x7f7f817f, 0x817f7f81, 0x8181817f, 0x81817f7f, 0x7f7f7f81, 0x7f7f817f, 0x7f7f7f81, 0x7f81817f,
+0x7f81817f, 0x7f818181, 0x7f7f817f, 0x7f7f817f, 0x7f81817f, 0x7f7f8181, 0x817f7f7f, 0x7f7f7f7f,
+0x7f7f7f81, 0x7f818181, 0x81817f7f, 0x817f8181, 0x7f81817f, 0x7f7f7f7f, 0x7f7f7f7f, 0x817f7f7f,
+0x81817f7f, 0x7f7f8181, 0x817f8181, 0x7f81817f, 0x7f7f8181, 0x81817f7f, 0x8181817f, 0x81818181,
+0x81817f7f, 0x7f817f7f, 0x817f8181, 0x817f7f81, 0x7f818181, 0x7f7f817f, 0x817f7f81, 0x7f7f817f,
+0x817f7f7f, 0x7f81817f, 0x7f7f7f7f, 0x7f817f81, 0x7f817f7f, 0x817f817f, 0x7f818181, 0x7f818181,
+0x81817f7f, 0x81817f7f, 0x7f817f81, 0x81817f7f, 0x8181817f, 0x7f7f8181, 0x817f7f7f, 0x7f81817f,
+0x81817f81, 0x817f7f81, 0x8181817f, 0x81817f7f, 0x7f7f7f81, 0x7f817f7f, 0x817f7f81, 0x7f817f7f,
+0x7f817f7f, 0x81818181, 0x7f7f8181, 0x7f7f8181, 0x7f7f7f7f, 0x7f818181, 0x7f7f7f7f, 0x7f7f7f7f,
+0x7f817f81, 0x7f7f7f7f, 0x7f7f817f, 0x7f81817f, 0x7f7f8181, 0x817f7f81, 0x7f817f7f, 0x7f7f817f,
+0x81818181, 0x7f81817f, 0x7f7f7f7f, 0x7f817f7f, 0x7f81817f, 0x7f817f81, 0x81818181, 0x7f7f7f81,
+0x7f81817f, 0x7f7f8181, 0x7f7f817f, 0x7f7f8181, 0x7f81817f, 0x81817f7f, 0x7f7f817f, 0x7f81817f,
+0x817f817f, 0x817f817f, 0x7f7f8181, 0x817f7f81, 0x7f7f8181, 0x7f817f7f, 0x7f7f8181, 0x817f817f,
+0x817f7f7f, 0x81817f81, 0x8181817f, 0x817f8181, 0x8181817f, 0x817f817f, 0x7f818181, 0x817f817f,
+0x7f7f7f81, 0x7f818181, 0x7f7f7f7f, 0x7f7f817f, 0x817f8181, 0x7f817f81, 0x7f818181, 0x81818181,
+0x7f81817f, 0x817f7f7f, 0x7f7f8181, 0x81817f81, 0x81817f7f, 0x817f817f, 0x7f7f817f, 0x817f7f7f,
+0x81818181, 0x817f817f, 0x8181817f, 0x7f7f7f7f, 0x81818181, 0x7f81817f, 0x7f7f817f, 0x8181817f,
+0x7f817f81, 0x7f7f817f, 0x81817f81, 0x817f817f, 0x7f7f7f7f, 0x7f817f7f, 0x81817f81, 0x7f7f7f81,
+0x7f818181, 0x7f7f8181, 0x7f817f81, 0x7f7f8181, 0x81817f7f, 0x7f817f7f, 0x817f7f7f, 0x81817f7f,
+0x81818181, 0x7f817f7f, 0x81817f7f, 0x817f7f81, 0x8181817f, 0x7f818181, 0x7f7f817f, 0x7f817f81,
+0x7f817f7f, 0x7f7f7f81, 0x7f7f8181, 0x817f8181, 0x81817f7f, 0x7f7f7f81, 0x817f7f7f, 0x7f7f8181,
+0x7f818181, 0x8181817f, 0x7f7f8181, 0x81817f81, 0x81818181, 0x7f7f8181, 0x817f8181, 0x81817f7f,
+0x7f7f7f81, 0x817f7f81, 0x7f7f817f, 0x7f818181, 0x7f817f81, 0x7f7f8181, 0x7f817f7f, 0x7f7f817f,
+0x7f818181, 0x7f81817f, 0x81817f7f, 0x7f7f7f81, 0x81818181, 0x817f7f7f, 0x817f7f7f, 0x7f817f81,
+0x81818181, 0x8181817f, 0x817f817f, 0x7f818181, 0x7f7f817f, 0x7f818181, 0x817f8181, 0x8181817f,
+0x7f7f7f81, 0x7f7f8181, 0x7f818181, 0x817f7f81, 0x7f818181, 0x8181817f, 0x7f7f7f7f, 0x7f7f817f,
+0x81817f81, 0x7f81817f, 0x7f81817f, 0x817f7f7f, 0x817f7f7f, 0x817f7f81, 0x817f7f81, 0x7f817f7f,
+0x7f817f7f, 0x7f818181, 0x81817f81, 0x8181817f, 0x7f7f8181, 0x817f7f7f, 0x8181817f, 0x81817f81,
+0x817f817f, 0x81818181, 0x7f7f817f, 0x7f7f8181, 0x7f81817f, 0x817f8181, 0x7f7f817f, 0x817f7f7f,
+0x81817f7f, 0x817f8181, 0x7f7f8181, 0x7f7f8181, 0x8181817f, 0x81817f81, 0x7f7f7f81, 0x7f818181,
+0x7f81817f, 0x8181817f, 0x7f7f7f81, 0x7f817f81, 0x7f818181, 0x817f7f81, 0x7f81817f, 0x817f8181,
+0x7f7f8181, 0x7f817f7f, 0x7f7f7f7f, 0x81818181, 0x81818181, 0x7f7f7f7f, 0x817f817f, 0x7f7f8181,
+0x7f81817f, 0x8181817f, 0x817f7f7f, 0x7f817f81, 0x7f817f7f, 0x7f818181, 0x7f817f81, 0x8181817f,
+0x7f817f7f, 0x817f7f81, 0x7f817f7f, 0x7f817f81, 0x81817f7f, 0x817f817f, 0x817f817f, 0x81817f81,
+0x7f7f8181, 0x8181817f, 0x7f7f817f, 0x7f7f7f7f, 0x81817f81, 0x817f8181, 0x7f817f81, 0x7f818181,
+0x817f7f81, 0x7f7f817f, 0x81817f7f, 0x7f7f7f7f, 0x7f81817f, 0x7f7f7f81, 0x817f8181, 0x8181817f,
+0x7f817f7f, 0x817f817f, 0x7f817f7f, 0x7f817f81, 0x817f8181, 0x817f7f7f, 0x7f81817f, 0x817f8181,
+0x81817f7f, 0x8181817f, 0x817f7f81, 0x7f817f7f, 0x7f81817f, 0x7f818181, 0x817f7f81, 0x817f7f81,
+0x81817f81, 0x81817f81, 0x81817f7f, 0x7f81817f, 0x81817f7f, 0x7f817f81, 0x817f7f7f, 0x81818181,
+0x7f7f817f, 0x81817f7f, 0x817f817f, 0x7f817f7f, 0x817f8181, 0x81818181, 0x817f8181, 0x817f7f81,
+0x7f7f7f7f, 0x7f817f81, 0x817f7f81, 0x7f817f7f, 0x817f7f81, 0x7f7f7f81, 0x7f817f81, 0x7f7f8181,
+0x7f7f7f81, 0x7f817f7f, 0x817f7f7f, 0x817f7f7f, 0x81817f7f, 0x817f7f81, 0x7f818181, 0x7f817f7f,
+0x7f817f7f, 0x8181817f, 0x81817f7f, 0x7f817f81, 0x81818181, 0x81817f81, 0x81818181, 0x7f817f7f,
+0x7f817f81, 0x81818181, 0x8181817f, 0x81817f7f, 0x817f7f7f, 0x7f818181, 0x7f7f8181, 0x7f818181,
+0x8181817f, 0x7f817f81, 0x7f7f7f81, 0x8181817f, 0x817f7f7f, 0x7f7f817f, 0x7f817f7f, 0x7f817f7f,
+0x7f817f7f, 0x7f817f81, 0x817f7f81, 0x817f7f7f, 0x817f817f, 0x817f817f, 0x817f7f7f, 0x817f8181,
+0x7f7f7f7f, 0x7f817f81, 0x817f817f, 0x7f817f7f, 0x7f817f81, 0x81817f81, 0x7f7f7f7f, 0x817f7f81,
+0x7f818181, 0x7f81817f, 0x817f7f7f, 0x81818181, 0x817f8181, 0x81817f7f, 0x7f7f8181, 0x7f7f8181,
+0x7f817f81, 0x81817f81, 0x817f7f81, 0x81818181, 0x8181817f, 0x7f7f8181, 0x81818181, 0x817f7f81,
+0x7f817f81, 0x817f7f7f, 0x81818181, 0x7f81817f, 0x7f7f8181, 0x817f7f81, 0x8181817f, 0x7f818181,
+0x817f8181, 0x7f7f7f7f, 0x8181817f, 0x817f817f, 0x817f8181, 0x81817f81, 0x817f817f, 0x7f817f81,
+0x7f7f8181, 0x817f7f81, 0x81818181, 0x7f817f81, 0x817f8181, 0x7f7f7f7f, 0x8181817f, 0x7f7f8181,
+0x817f817f, 0x81817f7f, 0x7f817f81, 0x7f817f7f, 0x7f818181, 0x7f7f7f7f, 0x7f7f817f, 0x7f81817f,
+0x817f7f81, 0x817f817f, 0x7f7f8181, 0x7f7f7f81, 0x817f8181, 0x81818181, 0x8181817f, 0x7f7f8181,
+0x7f817f7f, 0x7f7f7f81, 0x7f7f7f81, 0x7f7f7f7f, 0x81818181, 0x7f7f8181, 0x817f7f81, 0x81817f7f,
+0x7f7f7f7f, 0x817f7f81, 0x7f817f81, 0x81818181, 0x7f817f81, 0x7f7f7f7f, 0x8181817f, 0x7f7f7f81,
+0x7f817f7f, 0x817f8181, 0x7f7f8181, 0x817f8181, 0x7f7f817f, 0x817f8181, 0x817f7f81, 0x81818181,
+0x7f7f8181, 0x81818181, 0x7f7f817f, 0x817f817f, 0x7f7f8181, 0x81818181, 0x7f7f7f7f, 0x7f81817f,
+0x8181817f, 0x817f817f, 0x817f8181, 0x7f818181, 0x81818181, 0x817f817f, 0x7f817f81, 0x7f817f81,
+0x81817f7f, 0x8181817f, 0x817f817f, 0x817f7f7f, 0x81817f81, 0x81817f7f, 0x7f7f817f, 0x7f7f8181,
+0x8181817f, 0x81818181, 0x81817f7f, 0x7f818181, 0x7f7f7f7f, 0x817f7f81, 0x817f7f81, 0x7f7f7f7f,
+0x7f7f7f7f, 0x81817f7f, 0x817f7f7f, 0x7f817f7f, 0x7f7f7f7f, 0x817f8181, 0x81817f81, 0x7f7f7f7f,
+0x817f8181, 0x7f7f817f, 0x81818181, 0x7f7f7f7f, 0x7f817f81, 0x7f7f7f7f, 0x81817f81, 0x81818181,
+0x8181817f, 0x817f8181, 0x7f817f81, 0x8181817f, 0x7f7f7f81, 0x817f7f7f, 0x7f818181, 0x7f818181,
+0x7f7f7f81, 0x7f817f81, 0x8181817f, 0x7f818181
+
+output0 =
+0xd0dd44b2, 0xe91d434b, 0x17b23d65, 0xb8abd7c1, 0x12d7d41c, 0xce2686c2, 0x402c1efa, 0xc9151fcc,
+0xe00effad, 0xc964d36a, 0xe70e39e3, 0xd86577a2, 0x77e04ae3, 0x9dfd60b9, 0xbf43376f, 0x09841e69,
+0x53a02679, 0x898c65d0, 0x17434cf8, 0x9a3abfe2, 0x05e767ac, 0x902d6156, 0x716046a1, 0x636fc345,
+0xf15b483e, 0x910e40e4, 0x5d32b9a2, 0x8e9514b0, 0x7a218bb8, 0x7665aac3, 0x33a5b20c, 0x8ba7b5e3,
+0x220262e0, 0x7b654c15, 0xa69f1855, 0x6dcf61e3, 0x0036c1aa, 0x7ea806e3, 0x3f9b2ef1, 0x386cdd36,
+0xf94ae7e4, 0xf707e376, 0xb9c90f7b, 0x40bdd41f, 0x03cf6ae8, 0xfbd5b550, 0x03d90ae6, 0x65a6cf09,
+0xa3d70588, 0x26343d97, 0x464981b1, 0xd79f8b30, 0xa554bb7e, 0x524d3a2c, 0x2f75d78c, 0x3148c8d8,
+0xd4cccf4d, 0xc98df39c, 0x7f4fdb2a, 0x831c5ccd, 0xbe46bd67, 0xa9bf0a6b, 0xa726bdcc, 0xd590425d,
+0xa792805b, 0xe4b0518a, 0x18c4bcca, 0xf3891686, 0x3cdee43e, 0xd526e3a9, 0x8112aec6, 0x811151f4,
+0x9763de36, 0x56e50307, 0xa7313051, 0xc40db40a, 0x1931fa6e, 0x5701947d, 0x098ee810, 0x01cec402,
+0x804668f1, 0xc00c41da, 0x02432f4d, 0x072c9643, 0xf23088cc, 0x74620646, 0x281f8a80, 0x2c7a2aa6,
+0xfe8c2f88, 0xe0100f94, 0x9c402559, 0x48f5c34d, 0x59a3b023, 0x2427f7e0, 0xb2f30717, 0x9bf140a6,
+0x3fa4710b, 0xb493a4a2, 0xb16e6135, 0xd75f0e8e, 0xe7ff6b4a, 0x43d9e122, 0xafc5d306, 0xec88d05e,
+0xabfc996a, 0x29644a44, 0xa0c5c9fa, 0xf5836a0b, 0xd2a97513, 0x6986e115, 0x5581b429, 0xd6f8e599,
+0x035a2d9a, 0xe0835100, 0x561d04c5, 0x565f647a, 0xff711c76, 0x6b6fcd71, 0xb08518ac, 0xad407897,
+0x6de25115, 0x8e8fd5f1, 0x67196a81, 0xb6ef576b, 0x5e170674, 0x3cd78132, 0x0be74b19, 0x84f30e7b,
+0x85aa98b6, 0xcfe08810, 0xaa438ec3, 0xe95c3900, 0xafb0c225, 0xbe52bde2, 0xd6dcfec6, 0xccde045b,
+0x4fd00da2, 0x30c377b7, 0x771fdf0b, 0xea5f9282, 0x838dc0bf, 0x3250d0a9, 0xf2190c4d, 0x5ec14787,
+0x32c2d755, 0xe3b9f56c, 0xfb34945e, 0x642dc6c3, 0x8fb96e69, 0x612afce6, 0x17eb0530, 0x2fa9637c,
+0xef1068a6, 0x456c8bcd, 0x65b16eb9, 0xf97d8e92, 0x7b1a46
+
+basegraph=
+2
+
+z_c=
+256
+
+n_cb=
+12800
+
+q_m=
+2
+
+n_filler=
+16
+
+ea =
+3000
+
+eb =
+3000
+
+iter_max=
+8
+
+expected_iter_count=
+2
+
+c =
+2
+
+r =
+0
+
+cab =
+0
+
+rv_index =
+0
+
+code_block_mode =
+0
+
+op_flags =
+RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP
+
+expected_status =
+OK
diff --git a/app/test-bbdev/test_vectors/ldpc_enc_tb.data b/app/test-bbdev/test_vectors/ldpc_enc_tb.data
new file mode 100644
index 0000000000..0161c06f0d
--- /dev/null
+++ b/app/test-bbdev/test_vectors/ldpc_enc_tb.data
@@ -0,0 +1,95 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2021 NXP
+
+op_type =
+RTE_BBDEV_OP_LDPC_ENC
+
+input0 =
+0xd0dd44b2, 0xe91d434b, 0x17b23d65, 0xb8abd7c1, 0x12d7d41c, 0xce2686c2, 0x402c1efa, 0xc9151fcc,
+0xe00effad, 0xc964d36a, 0xe70e39e3, 0xd86577a2, 0x77e04ae3, 0x9dfd60b9, 0xbf43376f, 0x09841e69,
+0x53a02679, 0x898c65d0, 0x17434cf8, 0x9a3abfe2, 0x05e767ac, 0x902d6156, 0x716046a1, 0x636fc345,
+0xf15b483e, 0x910e40e4, 0x5d32b9a2, 0x8e9514b0, 0x7a218bb8, 0x7665aac3, 0x33a5b20c, 0x8ba7b5e3,
+0x220262e0, 0x7b654c15, 0xa69f1855, 0x6dcf61e3, 0x0036c1aa, 0x7ea806e3, 0x3f9b2ef1, 0x386cdd36,
+0xf94ae7e4, 0xf707e376, 0xb9c90f7b, 0x40bdd41f, 0x03cf6ae8, 0xfbd5b550, 0x03d90ae6, 0x65a6cf09,
+0xa3d70588, 0x26343d97, 0x464981b1, 0xd79f8b30, 0xa554bb7e, 0x524d3a2c, 0x2f75d78c, 0x3148c8d8,
+0xd4cccf4d, 0xc98df39c, 0x7f4fdb2a, 0x831c5ccd, 0xbe46bd67, 0xa9bf0a6b, 0xa726bdcc, 0xd590425d,
+0xa792805b, 0xe4b0518a, 0x18c4bcca, 0xf3891686, 0x3cdee43e, 0xd526e3a9, 0x8112aec6, 0x811151f4,
+0x9763de36, 0x56e50307, 0xa7313051, 0xc40db40a, 0x1931fa6e, 0x5701947d, 0x098ee810, 0x01cec402,
+0x804668f1, 0xc00c41da, 0x02432f4d, 0x072c9643, 0xf23088cc, 0x74620646, 0x281f8a80, 0x2c7a2aa6,
+0xfe8c2f88, 0xe0100f94, 0x9c402559, 0x48f5c34d, 0x59a3b023, 0x2427f7e0, 0xb2f30717, 0x9bf140a6,
+0x3fa4710b, 0xb493a4a2, 0xb16e6135, 0xd75f0e8e, 0xe7ff6b4a, 0x43d9e122, 0xafc5d306, 0xec88d05e,
+0xabfc996a, 0x29644a44, 0xa0c5c9fa, 0xf5836a0b, 0xd2a97513, 0x6986e115, 0x5581b429, 0xd6f8e599,
+0x035a2d9a, 0xe0835100, 0x561d04c5, 0x565f647a, 0xff711c76, 0x6b6fcd71, 0xb08518ac, 0xad407897,
+0x6de25115, 0x8e8fd5f1, 0x67196a81, 0xb6ef576b, 0x5e170674, 0x3cd78132, 0x0be74b19, 0x84f30e7b,
+0x85aa98b6, 0xcfe08810, 0xaa438ec3, 0xe95c3900, 0xafb0c225, 0xbe52bde2, 0xd6dcfec6, 0xccde045b,
+0x4fd00da2, 0x30c377b7, 0x771fdf0b, 0xea5f9282, 0x838dc0bf, 0x3250d0a9, 0xf2190c4d, 0x5ec14787,
+0x32c2d755, 0xe3b9f56c, 0xfb34945e, 0x642dc6c3, 0x8fb96e69, 0x612afce6, 0x17eb0530, 0x2fa9637c,
+0xef1068a6, 0x456c8bcd, 0x65b16eb9, 0xf97d8e92, 0x7b1a46
+
+output0 =
+0x4eda9982, 0x101c74c9, 0x8b63a987, 0x34464588, 0xe27e0cf2, 0x048dd503, 0x6391521b, 0x59f71f1a,
+0x22eeb556, 0x96d43907, 0x69a01acf, 0x3e6a4cb4, 0x7eca9c20, 0x2c3eb162, 0x965294d5, 0x25722e4e,
+0x7d42c4d1, 0x8489d0bf, 0x49c2a83d, 0xa48a3fa4, 0x6ccd783a, 0xd941b110, 0xa937e9e4, 0xc0a45188,
+0xd41b1840, 0x8bf35901, 0x769496e4, 0x91bb2778, 0x7ad8b944, 0xd19208ad, 0x8b519356, 0x7b6e1772,
+0x30982890, 0x1e183f8a, 0xde7b9c46, 0x2ca7c2ce, 0xb9b6e1d7, 0x68a3c466, 0x1ecda75d, 0xb462b570,
+0x2a2a5896, 0xaf6891b1, 0xd4bf3ba3, 0x82969dfa, 0xd0f563fb, 0xb81ff540, 0x7a0b3485, 0x4f6fd016,
+0x7741a613, 0x3f763d0e, 0x7f76a0dc, 0x37f25c1c, 0xf3412fe1, 0x2a75dc51, 0x04827bef, 0xe5a662fd,
+0xa07225f5, 0xbc9117a9, 0x55dbc54c, 0xd9446c00, 0xa8d26de1, 0xa293979e, 0x1ece1b94, 0xa5dd28cb,
+0x13d2655e, 0xa0e4ab01, 0x903c5a2c, 0x58674b7e, 0x0e1c244b, 0xa9e0d342, 0x45fc615f, 0x2971f02a,
+0x116c4e06, 0xf1d97697, 0x64b0a44f, 0xf21b9207, 0x32ddde4e, 0x4df48b05, 0xf0e80c2b, 0x27a14701,
+0x670407a7, 0x0ffd24cd, 0x07432145, 0xfff8c98f, 0x567dacd5, 0xef793abb, 0x29f2c205, 0x6605a7cd,
+0xf1978e96, 0x73ef3ef6, 0x336173ff, 0xaab9b459, 0xb3f4b89c, 0xf1e50d40, 0x76c3fb75, 0xc086001b,
+0x1cdadd3b, 0x0ed448a8, 0x53f9a461, 0x5a318eb9, 0x98d96ab4, 0xb796ead8, 0x6c4ffee6, 0xf5089709,
+0x9d3f7c5d, 0x759e5b2c, 0x1ba452ef, 0xe397683a, 0x38937d85, 0x6467fa0a, 0x3e3d85a9, 0x2be700cc,
+0xb51171ff, 0x27c369b4, 0xb91a6bbe, 0x84043906, 0x2639088d, 0x6c0f43f7, 0x1bdf6c89, 0xf294392a,
+0xf3c7ba93, 0xe9de466a, 0xd234e9a3, 0x94374868, 0xe644c601, 0xe8d30610, 0xc36d3cf7, 0x239d4e49,
+0x61a052ee, 0x333ac761, 0x9b372829, 0xf2cce000, 0x0a649c42, 0x6f20a68f, 0xc6c43664, 0x559c2c5c,
+0xb1d7575e, 0xe840adfe, 0x16bc5314, 0x5f076f74, 0x4a5b208b, 0xceca2331, 0x2f93e7a4, 0x82dc83c1,
+0x7ebccf3d, 0x98e4ca42, 0x6e831fa1, 0x7fe5e47d, 0xc89e7e40, 0x6b169129, 0xe27b1cb7, 0xf5c4d614,
+0xd3ccb7e8, 0x76a89ed6, 0x2cf00fc5, 0x76a1e27a, 0x92a253b5, 0x7c04dbea, 0x4903867d, 0x52a21dd6,
+0x7329e699, 0xbb63a3f1, 0x3425fd9d, 0xa02989ca, 0x2811932e, 0x72a3bf2f, 0xfa37e1ec, 0xa7784122,
+0xa21955d1, 0xa025ba90, 0x6ef13dcc, 0xbaf9c79f, 0x1a6f9ce7, 0x0d57bda5, 0x9caf0dc7, 0x352a0e64,
+0x598cfdc7, 0x8208cf39, 0x90fa0a87, 0xd2dcd4f9, 0xfc54fc60, 0x57ed5faa, 0x73153bc4, 0xf7e39009,
+0x3021d00b, 0x4d0f0afb, 0xd77a18ee, 0xa8e7
+
+basegraph=
+2
+
+z_c=
+256
+
+n_cb=
+12800
+
+q_m=
+2
+
+n_filler=
+16
+
+ea =
+3000
+
+eb =
+3000
+
+c =
+2
+
+r =
+0
+
+cab =
+0
+
+rv_index =
+0
+
+code_block_mode =
+0
+
+op_flags =
+RTE_BBDEV_LDPC_CRC_24B_ATTACH
+
+expected_status =
+OK
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v7 1/9] bbdev: add big endian processing data processing info
  2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 1/9] bbdev: add big endian processing data processing info nipun.gupta
@ 2021-10-04 23:09     ` Chautru, Nicolas
  0 siblings, 0 replies; 157+ messages in thread
From: Chautru, Nicolas @ 2021-10-04 23:09 UTC (permalink / raw)
  To: nipun.gupta, dev, gakhil; +Cc: david.marchand, hemant.agrawal



> -----Original Message-----
> From: nipun.gupta@nxp.com <nipun.gupta@nxp.com>
> Sent: Tuesday, September 28, 2021 1:30 AM
> To: dev@dpdk.org; gakhil@marvell.com; Chautru, Nicolas
> <nicolas.chautru@intel.com>
> Cc: david.marchand@redhat.com; hemant.agrawal@nxp.com; Nipun Gupta
> <nipun.gupta@nxp.com>
> Subject: [PATCH v7 1/9] bbdev: add big endian processing data processing
> info
> 
> From: Nipun Gupta <nipun.gupta@nxp.com>
> 
> This patch intoduces a new info pertaining to bbdev device to process the
> data in big endian order.

Typo in commit message

> 
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---
>  lib/bbdev/rte_bbdev.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/lib/bbdev/rte_bbdev.h b/lib/bbdev/rte_bbdev.h index
> 7017124414..3acc008d06 100644
> --- a/lib/bbdev/rte_bbdev.h
> +++ b/lib/bbdev/rte_bbdev.h
> @@ -309,6 +309,8 @@ struct rte_bbdev_driver_info {
>  	uint16_t min_alignment;
>  	/** HARQ memory available in kB */
>  	uint32_t harq_buffer_size;
> +	/** Device support input, output and HARQ data as big-endian */
> +	uint8_t support_be_data;

Shouldn't this either be a bool or even better an enum?
Ie. as per rte_bbdev_op_cb_mode enum for instance
Having 0/1 magic number in the code will always be misleading

>  	/** Default queue configuration used if none is supplied  */
>  	struct rte_bbdev_queue_conf default_queue_conf;
>  	/** Device operation capabilities */
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v7 5/9] baseband/la12xx: add queue and modem config support
  2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 5/9] baseband/la12xx: add queue and modem config support nipun.gupta
@ 2021-10-04 23:19     ` Chautru, Nicolas
  0 siblings, 0 replies; 157+ messages in thread
From: Chautru, Nicolas @ 2021-10-04 23:19 UTC (permalink / raw)
  To: nipun.gupta, dev, gakhil; +Cc: david.marchand, hemant.agrawal



> -----Original Message-----
> From: nipun.gupta@nxp.com <nipun.gupta@nxp.com>
> Sent: Tuesday, September 28, 2021 1:30 AM
> To: dev@dpdk.org; gakhil@marvell.com; Chautru, Nicolas
> <nicolas.chautru@intel.com>
> Cc: david.marchand@redhat.com; hemant.agrawal@nxp.com; Nipun Gupta
> <nipun.gupta@nxp.com>
> Subject: [PATCH v7 5/9] baseband/la12xx: add queue and modem config
> support
> 
> From: Hemant Agrawal <hemant.agrawal@nxp.com>
> 
> This patch add support for connecting with modem and creating the ipc
> channel as queues with modem for the exchange of data.
> 
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>  MAINTAINERS                                |   1 +
>  doc/guides/bbdevs/index.rst                |   1 +
>  doc/guides/bbdevs/la12xx.rst               |  81 +++
>  doc/guides/rel_notes/release_21_11.rst     |   5 +
>  drivers/baseband/la12xx/bbdev_la12xx.c     | 555 ++++++++++++++++++++-
>  drivers/baseband/la12xx/bbdev_la12xx.h     |  17 +-
>  drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 189 ++++++-
>  7 files changed, 836 insertions(+), 13 deletions(-)  create mode 100644
> doc/guides/bbdevs/la12xx.rst
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index e3f0e8759f..1bf39820d6 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1296,6 +1296,7 @@ NXP LA12xx driver
>  M: Nipun Gupta <nipun.gupta@nxp.com>
>  M: Hemant Agrawal <hemant.agrawal@nxp.com>
>  F: drivers/baseband/la12xx/
> +F: doc/guides/bbdevs/la12xx.rst
> 
> 
>  Rawdev Drivers
> diff --git a/doc/guides/bbdevs/index.rst b/doc/guides/bbdevs/index.rst index
> 4445cbd1b0..cedd706fa6 100644
> --- a/doc/guides/bbdevs/index.rst
> +++ b/doc/guides/bbdevs/index.rst
> @@ -14,3 +14,4 @@ Baseband Device Drivers
>      fpga_lte_fec
>      fpga_5gnr_fec
>      acc100
> +    la12xx
> diff --git a/doc/guides/bbdevs/la12xx.rst b/doc/guides/bbdevs/la12xx.rst
> new file mode 100644 index 0000000000..3c9ac5c047
> --- /dev/null
> +++ b/doc/guides/bbdevs/la12xx.rst
> @@ -0,0 +1,81 @@
> +..  SPDX-License-Identifier: BSD-3-Clause
> +    Copyright 2021 NXP
> +
> +NXP LA12xx Poll Mode Driver
> +=======================================
> +
> +The BBDEV LA12xx poll mode driver (PMD) supports an implementation for
> +offloading High Phy processing functions like LDPC Encode / Decode 5GNR
> +wireless acceleration function, using PCI based LA12xx Software defined
> radio.
> +
> +More information can be found at `NXP Official Website
> +<https://www.nxp.com/products/processors-and-microcontrollers/arm-
> processors/layerscape-processors/layerscape-access-la1200-programmable-
> baseband-processor:LA1200>`_.
> +
> +Features
> +--------
> +
> +LA12xx PMD supports the following features:
> +
> +- Maximum of 8 UL queues
> +- Maximum of 8 DL queues

Minor: I suggest to capture explicitly these are 5G (UL/DL) and not 4G (UL/DL). Or LDPC explicitly. 

> +- PCIe Gen-3 x8 Interface
> +- MSI-X

Minor: I don't see MSI-x capability or implementation in the PMD below (.capability_flags)

> +
> +Installation
> +------------
> +
> +Section 3 of the DPDK manual provides instructions on installing and
> compiling DPDK.
> +
> +DPDK requires hugepages to be configured as detailed in section 2 of the
> DPDK manual.
> +
> +Initialization
> +--------------
> +
> +The device can be listed on the host console with:
> +
> +
> +Use the following lspci command to get the multiple LA12xx processor
> +ids. The device ID of the LA12xx baseband processor is "1c30".
> +
> +.. code-block:: console
> +
> +  sudo lspci -nn
> +
> +...
> +0001:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device
> +[1957:1c30] ( rev 10) ...
> +0002:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device
> +[1957:1c30] ( rev 10)
> +
> +
> +Prerequisites
> +-------------
> +
> +Currently supported by DPDK:
> +
> +- NXP LA1224 BSP **1.0+**.
> +- NXP LA1224 PCIe Modem card connected to ARM host.
> +
> +- Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to
> setup the basic DPDK environment.
> +
> +* Use dev arg option ``modem=0`` to identify the modem instance for a
> +given
> +  device. This is required only if more than 1 modem cards are attached to
> host.
> +  this is optional and the default value is 0.
> +  e.g. ``--vdev=baseband_la12xx,modem=0``
> +
> +* Use dev arg option ``max_nb_queues=x`` to specify the maximum
> number
> +of queues
> +  to be used for communication with offload device i.e. modem. default is
> 16.
> +  e.g. ``--vdev=baseband_la12xx,max_nb_queues=4``
> +
> +Enabling logs
> +-------------
> +
> +For enabling logs, use the following EAL parameter:
> +
> +.. code-block:: console
> +
> +   ./your_bbdev_application <EAL args> --log-level=la12xx:<level>
> +
> +Using ``bb.la12xx`` as log matching criteria, all Baseband PMD logs can
> +be enabled which are lower than logging ``level``.
> diff --git a/doc/guides/rel_notes/release_21_11.rst
> b/doc/guides/rel_notes/release_21_11.rst
> index ad7c1afec0..60b92c9a9f 100644
> --- a/doc/guides/rel_notes/release_21_11.rst
> +++ b/doc/guides/rel_notes/release_21_11.rst
> @@ -91,6 +91,11 @@ New Features
>    Added command-line options to specify total number of processes and
>    current process ID. Each process owns subset of Rx and Tx queues.
> 
> +* **Added NXP LA12xx baseband PMD.**
> +
> +  * Added a new baseband PMD driver for NXP LA12xx Software defined
> radio.
> +  * See the :doc:`../bbdevs/la12xx` for more details.
> +
> 
>  Removed Items
>  -------------
> diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c
> b/drivers/baseband/la12xx/bbdev_la12xx.c
> index f9f32d665a..46ee5b4d70 100644
> --- a/drivers/baseband/la12xx/bbdev_la12xx.c
> +++ b/drivers/baseband/la12xx/bbdev_la12xx.c
> @@ -3,6 +3,11 @@
>   */
> 
>  #include <string.h>
> +#include <unistd.h>
> +#include <fcntl.h>
> +#include <sys/ioctl.h>
> +#include <sys/mman.h>
> +#include <dirent.h>
> 
>  #include <rte_common.h>
>  #include <rte_bus_vdev.h>
> @@ -29,11 +34,552 @@ struct bbdev_la12xx_params {
>  #define LA12XX_VDEV_MODEM_ID_ARG	"modem"
>  #define LA12XX_MAX_MODEM 4
> 
> +#define LA12XX_MAX_CORES	4
> +#define LA12XX_LDPC_ENC_CORE	0
> +#define LA12XX_LDPC_DEC_CORE	1
> +
> +#define LA12XX_MAX_LDPC_ENC_QUEUES	4
> +#define LA12XX_MAX_LDPC_DEC_QUEUES	4
> +
>  static const char * const bbdev_la12xx_valid_params[] = {
>  	LA12XX_MAX_NB_QUEUES_ARG,
>  	LA12XX_VDEV_MODEM_ID_ARG,
>  };
> 
> +static const struct rte_bbdev_op_cap bbdev_capabilities[] = {
> +	{
> +		.type   = RTE_BBDEV_OP_LDPC_ENC,
> +		.cap.ldpc_enc = {
> +			.capability_flags =
> +					RTE_BBDEV_LDPC_RATE_MATCH |
> +					RTE_BBDEV_LDPC_CRC_24A_ATTACH
> |
> +
> 	RTE_BBDEV_LDPC_CRC_24B_ATTACH,
> +			.num_buffers_src =
> +
> 	RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
> +			.num_buffers_dst =
> +
> 	RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
> +		}
> +	},
> +	{
> +		.type   = RTE_BBDEV_OP_LDPC_DEC,
> +		.cap.ldpc_dec = {
> +			.capability_flags =
> +				RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK |
> +
> 	RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK |
> +
> 	RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP,
> +			.num_buffers_src =
> +
> 	RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
> +			.num_buffers_hard_out =
> +
> 	RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
> +			.llr_size = 8,
> +			.llr_decimals = 1,
> +		}
> +	},
> +	RTE_BBDEV_END_OF_CAPABILITIES_LIST()
> +};
> +
> +static struct rte_bbdev_queue_conf default_queue_conf = {
> +	.queue_size = MAX_CHANNEL_DEPTH,
> +};
> +
> +/* Get device info */
> +static void
> +la12xx_info_get(struct rte_bbdev *dev __rte_unused,
> +		struct rte_bbdev_driver_info *dev_info) {
> +	PMD_INIT_FUNC_TRACE();
> +
> +	dev_info->driver_name = RTE_STR(DRIVER_NAME);
> +	dev_info->max_num_queues = LA12XX_MAX_QUEUES;
> +	dev_info->queue_size_lim = MAX_CHANNEL_DEPTH;
> +	dev_info->hardware_accelerated = true;
> +	dev_info->max_dl_queue_priority = 0;
> +	dev_info->max_ul_queue_priority = 0;
> +	dev_info->support_be_data = 1;
> +	dev_info->default_queue_conf = default_queue_conf;
> +	dev_info->capabilities = bbdev_capabilities;
> +	dev_info->cpu_flag_reqs = NULL;
> +	dev_info->min_alignment = 64;
> +
> +	rte_bbdev_log_debug("got device info from %u", dev->data-
> >dev_id); }
> +
> +/* Release queue */
> +static int
> +la12xx_queue_release(struct rte_bbdev *dev, uint16_t q_id) {
> +	RTE_SET_USED(dev);
> +	RTE_SET_USED(q_id);
> +
> +	PMD_INIT_FUNC_TRACE();
> +
> +	return 0;
> +}
> +
> +#define HUGEPG_OFFSET(A) \
> +		((uint64_t) ((unsigned long) (A) \
> +		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
> +
> +static int ipc_queue_configure(uint32_t channel_id,
> +		ipc_t instance, struct bbdev_la12xx_q_priv *q_priv) {
> +	ipc_userspace_t *ipc_priv = (ipc_userspace_t *)instance;
> +	ipc_instance_t *ipc_instance = ipc_priv->instance;
> +	ipc_ch_t *ch;
> +	void *vaddr;
> +	uint32_t i = 0;
> +	uint32_t msg_size = sizeof(struct bbdev_ipc_enqueue_op);
> +
> +	PMD_INIT_FUNC_TRACE();
> +
> +	rte_bbdev_log_debug("%x %p", ipc_instance->initialized,
> +		ipc_priv->instance);
> +	ch = &(ipc_instance->ch_list[channel_id]);
> +
> +	rte_bbdev_log_debug("channel: %u, depth: %u, msg size: %u",
> +		channel_id, q_priv->queue_size, msg_size);
> +
> +	/* Start init of channel */
> +	ch->md.ring_size = rte_cpu_to_be_32(q_priv->queue_size);
> +	ch->md.pi = 0;
> +	ch->md.ci = 0;
> +	ch->md.msg_size = msg_size;
> +	for (i = 0; i < q_priv->queue_size; i++) {
> +		vaddr = rte_malloc(NULL, msg_size, RTE_CACHE_LINE_SIZE);
> +		if (!vaddr)
> +			return IPC_HOST_BUF_ALLOC_FAIL;
> +		/* Only offset now */
> +		ch->bd_h[i].modem_ptr =
> +			rte_cpu_to_be_32(HUGEPG_OFFSET(vaddr));
> +		ch->bd_h[i].host_virt_l = lower_32_bits(vaddr);
> +		ch->bd_h[i].host_virt_h = upper_32_bits(vaddr);
> +		q_priv->msg_ch_vaddr[i] = vaddr;
> +		/* Not sure use of this len may be for CRC*/
> +		ch->bd_h[i].len = 0;
> +	}
> +	ch->host_ipc_params =
> +		rte_cpu_to_be_32(HUGEPG_OFFSET(q_priv->host_params));
> +
> +	rte_bbdev_log_debug("Channel configured");
> +	return IPC_SUCCESS;
> +}
> +
> +static int
> +la12xx_e200_queue_setup(struct rte_bbdev *dev,
> +		struct bbdev_la12xx_q_priv *q_priv)
> +{
> +	struct bbdev_la12xx_private *priv = dev->data->dev_private;
> +	ipc_userspace_t *ipc_priv = priv->ipc_priv;
> +	struct gul_hif *mhif;
> +	ipc_metadata_t *ipc_md;
> +	ipc_ch_t *ch;
> +	int instance_id = 0, i;
> +	int ret;
> +
> +	PMD_INIT_FUNC_TRACE();
> +
> +	switch (q_priv->op_type) {
> +	case RTE_BBDEV_OP_LDPC_ENC:
> +		q_priv->la12xx_core_id = LA12XX_LDPC_ENC_CORE;
> +		break;
> +	case RTE_BBDEV_OP_LDPC_DEC:
> +		q_priv->la12xx_core_id = LA12XX_LDPC_DEC_CORE;
> +		break;
> +	default:
> +		rte_bbdev_log(ERR, "Unsupported op type\n");
> +		return -1;
> +	}
> +
> +	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
> +	/* offset is from start of PEB */
> +	ipc_md = (ipc_metadata_t *)((uintptr_t)ipc_priv-
> >peb_start.host_vaddr +
> +		mhif->ipc_regs.ipc_mdata_offset);
> +	ch = &ipc_md->instance_list[instance_id].ch_list[q_priv->q_id];
> +
> +	if (q_priv->q_id < priv->num_valid_queues) {
> +		ipc_br_md_t *md = &(ch->md);
> +
> +		q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
> +		q_priv->feca_blk_id_be32 = ch->feca_blk_id;
> +		q_priv->host_pi = rte_be_to_cpu_32(md->pi);
> +		q_priv->host_ci = rte_be_to_cpu_32(md->ci);
> +		q_priv->host_params = (host_ipc_params_t *)(uintptr_t)
> +			(rte_be_to_cpu_32(ch->host_ipc_params) +
> +			((uint64_t)ipc_priv->hugepg_start.host_vaddr));
> +
> +		for (i = 0; i < q_priv->queue_size; i++) {
> +			uint32_t h, l;
> +
> +			h = ch->bd_h[i].host_virt_h;
> +			l = ch->bd_h[i].host_virt_l;
> +			q_priv->msg_ch_vaddr[i] = (void *)join_32_bits(h, l);
> +		}
> +
> +		rte_bbdev_log(WARNING,
> +			"Queue [%d] already configured, not configuring
> again",
> +			q_priv->q_id);
> +		return 0;
> +	}
> +
> +	rte_bbdev_log_debug("setting up queue %d", q_priv->q_id);
> +
> +	/* Call ipc_configure_channel */
> +	ret = ipc_queue_configure(q_priv->q_id, ipc_priv, q_priv);
> +	if (ret) {
> +		rte_bbdev_log(ERR, "Unable to setup queue (%d) (err=%d)",
> +		       q_priv->q_id, ret);
> +		return ret;
> +	}
> +
> +	/* Set queue properties for LA12xx device */
> +	switch (q_priv->op_type) {
> +	case RTE_BBDEV_OP_LDPC_ENC:
> +		if (priv->num_ldpc_enc_queues >=
> LA12XX_MAX_LDPC_ENC_QUEUES) {
> +			rte_bbdev_log(ERR,
> +				"num_ldpc_enc_queues reached max
> value");
> +			return -1;
> +		}
> +		ch->la12xx_core_id =
> +			rte_cpu_to_be_32(LA12XX_LDPC_ENC_CORE);
> +		ch->feca_blk_id = rte_cpu_to_be_32(priv-
> >num_ldpc_enc_queues++);
> +		break;
> +	case RTE_BBDEV_OP_LDPC_DEC:
> +		if (priv->num_ldpc_dec_queues >=
> LA12XX_MAX_LDPC_DEC_QUEUES) {
> +			rte_bbdev_log(ERR,
> +				"num_ldpc_dec_queues reached max
> value");
> +			return -1;
> +		}
> +		ch->la12xx_core_id =
> +			rte_cpu_to_be_32(LA12XX_LDPC_DEC_CORE);
> +		ch->feca_blk_id = rte_cpu_to_be_32(priv-
> >num_ldpc_dec_queues++);
> +		break;
> +	default:
> +		rte_bbdev_log(ERR, "Not supported op type\n");
> +		return -1;
> +	}
> +	ch->op_type = rte_cpu_to_be_32(q_priv->op_type);
> +	ch->depth = rte_cpu_to_be_32(q_priv->queue_size);
> +
> +	/* Store queue config here */
> +	q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
> +	q_priv->feca_blk_id_be32 = ch->feca_blk_id;
> +
> +	return 0;
> +}
> +
> +/* Setup a queue */
> +static int
> +la12xx_queue_setup(struct rte_bbdev *dev, uint16_t q_id,
> +		const struct rte_bbdev_queue_conf *queue_conf) {
> +	struct bbdev_la12xx_private *priv = dev->data->dev_private;
> +	struct rte_bbdev_queue_data *q_data;
> +	struct bbdev_la12xx_q_priv *q_priv;
> +	int ret;
> +
> +	PMD_INIT_FUNC_TRACE();
> +
> +	/* Move to setup_queues callback */
> +	q_data = &dev->data->queues[q_id];
> +	q_data->queue_private = rte_zmalloc(NULL,
> +		sizeof(struct bbdev_la12xx_q_priv), 0);
> +	if (!q_data->queue_private) {
> +		rte_bbdev_log(ERR, "Memory allocation failed for qpriv");
> +		return -ENOMEM;
> +	}
> +	q_priv = q_data->queue_private;
> +	q_priv->q_id = q_id;
> +	q_priv->bbdev_priv = dev->data->dev_private;
> +	q_priv->queue_size = queue_conf->queue_size;
> +	q_priv->op_type = queue_conf->op_type;
> +
> +	ret = la12xx_e200_queue_setup(dev, q_priv);
> +	if (ret) {
> +		rte_bbdev_log(ERR, "e200_queue_setup failed for qid: %d",
> +				     q_id);
> +		return ret;
> +	}
> +
> +	/* Store queue config here */
> +	priv->num_valid_queues++;
> +
> +	return 0;
> +}
> +
> +static int
> +la12xx_start(struct rte_bbdev *dev)
> +{
> +	struct bbdev_la12xx_private *priv = dev->data->dev_private;
> +	ipc_userspace_t *ipc_priv = priv->ipc_priv;
> +	int ready = 0;
> +	struct gul_hif *hif_start;
> +
> +	PMD_INIT_FUNC_TRACE();
> +
> +	hif_start = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
> +
> +	/* Set Host Read bit */
> +	SET_HIF_HOST_RDY(hif_start, HIF_HOST_READY_IPC_APP);
> +
> +	/* Now wait for modem ready bit */
> +	while (!ready)
> +		ready = CHK_HIF_MOD_RDY(hif_start,
> HIF_MOD_READY_IPC_APP);
> +
> +	return 0;
> +}
> +
> +static const struct rte_bbdev_ops pmd_ops = {
> +	.info_get = la12xx_info_get,
> +	.queue_setup = la12xx_queue_setup,
> +	.queue_release = la12xx_queue_release,
> +	.start = la12xx_start
> +};
> +static struct hugepage_info *
> +get_hugepage_info(void)
> +{
> +	struct hugepage_info *hp_info;
> +	struct rte_memseg *mseg;
> +
> +	PMD_INIT_FUNC_TRACE();
> +
> +	/* TODO - find a better way */
> +	hp_info = rte_malloc(NULL, sizeof(struct hugepage_info), 0);
> +	if (!hp_info) {
> +		rte_bbdev_log(ERR, "Unable to allocate on local heap");
> +		return NULL;
> +	}
> +
> +	mseg = rte_mem_virt2memseg(hp_info, NULL);
> +	hp_info->vaddr = mseg->addr;
> +	hp_info->paddr = rte_mem_virt2phy(mseg->addr);
> +	hp_info->len = mseg->len;
> +
> +	return hp_info;
> +}
> +
> +static int open_ipc_dev(int modem_id)
> +{
> +	char dev_initials[16], dev_path[PATH_MAX];
> +	struct dirent *entry;
> +	int dev_ipc = 0;
> +	DIR *dir;
> +
> +	dir = opendir("/dev/");
> +	if (!dir) {
> +		rte_bbdev_log(ERR, "Unable to open /dev/");
> +		return -1;
> +	}
> +
> +	sprintf(dev_initials, "gulipcgul%d", modem_id);
> +
> +	while ((entry = readdir(dir)) != NULL) {
> +		if (!strncmp(dev_initials, entry->d_name,
> +		    sizeof(dev_initials) - 1))
> +			break;
> +	}
> +
> +	if (!entry) {
> +		rte_bbdev_log(ERR, "Error: No gulipcgul%d device",
> modem_id);
> +		return -1;
> +	}
> +
> +	sprintf(dev_path, "/dev/%s", entry->d_name);
> +	dev_ipc = open(dev_path, O_RDWR);
> +	if (dev_ipc  < 0) {
> +		rte_bbdev_log(ERR, "Error: Cannot open %s", dev_path);
> +		return -errno;
> +	}
> +
> +	return dev_ipc;
> +}
> +
> +static int
> +setup_la12xx_dev(struct rte_bbdev *dev) {
> +	struct bbdev_la12xx_private *priv = dev->data->dev_private;
> +	ipc_userspace_t *ipc_priv = priv->ipc_priv;
> +	struct hugepage_info *hp = NULL;
> +	ipc_channel_us_t *ipc_priv_ch = NULL;
> +	int dev_ipc = 0, dev_mem = 0, i;
> +	ipc_metadata_t *ipc_md;
> +	struct gul_hif *mhif;
> +	uint32_t phy_align = 0;
> +	int ret;
> +
> +	PMD_INIT_FUNC_TRACE();
> +
> +	if (!ipc_priv) {
> +		/* TODO - get a better way */
> +		/* Get the hugepage info against it */
> +		hp = get_hugepage_info();
> +		if (!hp) {
> +			rte_bbdev_log(ERR, "Unable to get hugepage info");
> +			ret = -ENOMEM;
> +			goto err;
> +		}
> +
> +		rte_bbdev_log_debug("0x%" PRIx64 " %p 0x%" PRIx64,
> +				hp->paddr, hp->vaddr, hp->len);
> +
> +		ipc_priv = rte_zmalloc(0, sizeof(ipc_userspace_t), 0);
> +		if (ipc_priv == NULL) {
> +			rte_bbdev_log(ERR,
> +				"Unable to allocate memory for ipc priv");
> +			ret = -ENOMEM;
> +			goto err;
> +		}
> +
> +		for (i = 0; i < IPC_MAX_CHANNEL_COUNT; i++) {
> +			ipc_priv_ch = rte_zmalloc(0,
> +				sizeof(ipc_channel_us_t), 0);
> +			if (ipc_priv_ch == NULL) {
> +				rte_bbdev_log(ERR,
> +					"Unable to allocate memory for
> channels");
> +				ret = -ENOMEM;
> +			}
> +			ipc_priv->channels[i] = ipc_priv_ch;
> +		}
> +
> +		dev_mem = open("/dev/mem", O_RDWR);
> +		if (dev_mem < 0) {
> +			rte_bbdev_log(ERR, "Error: Cannot open
> /dev/mem");
> +			ret = -errno;
> +			goto err;
> +		}
> +
> +		ipc_priv->instance_id = 0;
> +		ipc_priv->dev_mem = dev_mem;
> +
> +		rte_bbdev_log_debug("hugepg input 0x%" PRIx64 "%p 0x%"
> PRIx64,
> +			hp->paddr, hp->vaddr, hp->len);
> +
> +		ipc_priv->sys_map.hugepg_start.host_phys = hp->paddr;
> +		ipc_priv->sys_map.hugepg_start.size = hp->len;
> +
> +		ipc_priv->hugepg_start.host_phys = hp->paddr;
> +		ipc_priv->hugepg_start.host_vaddr = hp->vaddr;
> +		ipc_priv->hugepg_start.size = hp->len;
> +
> +		rte_free(hp);
> +	}
> +
> +	dev_ipc = open_ipc_dev(priv->modem_id);
> +	if (dev_ipc < 0) {
> +		rte_bbdev_log(ERR, "Error: open_ipc_dev failed");
> +		goto err;
> +	}
> +	ipc_priv->dev_ipc = dev_ipc;
> +
> +	ret = ioctl(ipc_priv->dev_ipc, IOCTL_GUL_IPC_GET_SYS_MAP,
> +		    &ipc_priv->sys_map);
> +	if (ret) {
> +		rte_bbdev_log(ERR,
> +			"IOCTL_GUL_IPC_GET_SYS_MAP ioctl failed");
> +		goto err;
> +	}
> +
> +	phy_align = (ipc_priv->sys_map.mhif_start.host_phys % 0x1000);
> +	ipc_priv->mhif_start.host_vaddr =
> +		mmap(0, ipc_priv->sys_map.mhif_start.size + phy_align,
> +		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv-
> >dev_mem,
> +		     (ipc_priv->sys_map.mhif_start.host_phys - phy_align));
> +	if (ipc_priv->mhif_start.host_vaddr == MAP_FAILED) {
> +		rte_bbdev_log(ERR, "MAP failed:");
> +		ret = -errno;
> +		goto err;
> +	}
> +
> +	ipc_priv->mhif_start.host_vaddr = (void *) ((uintptr_t)
> +		(ipc_priv->mhif_start.host_vaddr) + phy_align);
> +
> +	phy_align = (ipc_priv->sys_map.peb_start.host_phys % 0x1000);
> +	ipc_priv->peb_start.host_vaddr =
> +		mmap(0, ipc_priv->sys_map.peb_start.size + phy_align,
> +		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv-
> >dev_mem,
> +		     (ipc_priv->sys_map.peb_start.host_phys - phy_align));
> +	if (ipc_priv->peb_start.host_vaddr == MAP_FAILED) {
> +		rte_bbdev_log(ERR, "MAP failed:");
> +		ret = -errno;
> +		goto err;
> +	}
> +
> +	ipc_priv->peb_start.host_vaddr = (void *)((uintptr_t)
> +		(ipc_priv->peb_start.host_vaddr) + phy_align);
> +
> +	phy_align = (ipc_priv->sys_map.modem_ccsrbar.host_phys %
> 0x1000);
> +	ipc_priv->modem_ccsrbar.host_vaddr =
> +		mmap(0, ipc_priv->sys_map.modem_ccsrbar.size +
> phy_align,
> +		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv-
> >dev_mem,
> +		     (ipc_priv->sys_map.modem_ccsrbar.host_phys -
> phy_align));
> +	if (ipc_priv->modem_ccsrbar.host_vaddr == MAP_FAILED) {
> +		rte_bbdev_log(ERR, "MAP failed:");
> +		ret = -errno;
> +		goto err;
> +	}
> +
> +	ipc_priv->modem_ccsrbar.host_vaddr = (void *)((uintptr_t)
> +		(ipc_priv->modem_ccsrbar.host_vaddr) + phy_align);
> +
> +	ipc_priv->hugepg_start.modem_phys =
> +		ipc_priv->sys_map.hugepg_start.modem_phys;
> +
> +	ipc_priv->mhif_start.host_phys =
> +		ipc_priv->sys_map.mhif_start.host_phys;
> +	ipc_priv->mhif_start.size = ipc_priv->sys_map.mhif_start.size;
> +	ipc_priv->peb_start.host_phys = ipc_priv-
> >sys_map.peb_start.host_phys;
> +	ipc_priv->peb_start.size = ipc_priv->sys_map.peb_start.size;
> +
> +	rte_bbdev_log(INFO, "peb 0x%" PRIx64 "%p 0x%" PRIx32,
> +			ipc_priv->peb_start.host_phys,
> +			ipc_priv->peb_start.host_vaddr,
> +			ipc_priv->peb_start.size);
> +	rte_bbdev_log(INFO, "hugepg 0x%" PRIx64 "%p 0x%" PRIx32,
> +			ipc_priv->hugepg_start.host_phys,
> +			ipc_priv->hugepg_start.host_vaddr,
> +			ipc_priv->hugepg_start.size);
> +	rte_bbdev_log(INFO, "mhif 0x%" PRIx64 "%p 0x%" PRIx32,
> +			ipc_priv->mhif_start.host_phys,
> +			ipc_priv->mhif_start.host_vaddr,
> +			ipc_priv->mhif_start.size);
> +	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
> +
> +	/* offset is from start of PEB */
> +	ipc_md = (ipc_metadata_t *)((uint64_t)ipc_priv-
> >peb_start.host_vaddr +
> +			mhif->ipc_regs.ipc_mdata_offset);
> +
> +	if (sizeof(ipc_metadata_t) != mhif->ipc_regs.ipc_mdata_size) {
> +		rte_bbdev_log(ERR,
> +			"ipc_metadata_t =0x%" PRIx64
> +			", mhif->ipc_regs.ipc_mdata_size=0x%" PRIx32,
> +			sizeof(ipc_metadata_t), mhif-
> >ipc_regs.ipc_mdata_size);
> +		rte_bbdev_log(ERR, "--> mhif->ipc_regs.ipc_mdata_offset=
> 0x%"
> +			PRIx32, mhif->ipc_regs.ipc_mdata_offset);
> +		rte_bbdev_log(ERR, "gul_hif size=0x%" PRIx64,
> +			sizeof(struct gul_hif));
> +		return IPC_MD_SZ_MISS_MATCH;
> +	}
> +
> +	ipc_priv->instance = (ipc_instance_t *)
> +		(&ipc_md->instance_list[ipc_priv->instance_id]);
> +
> +	rte_bbdev_log_debug("finish host init");
> +
> +	priv->ipc_priv = ipc_priv;
> +
> +	return 0;
> +
> +err:
> +	rte_free(hp);
> +	rte_free(ipc_priv);
> +	rte_free(ipc_priv_ch);
> +	if (dev_mem)
> +		close(dev_mem);
> +	if (dev_ipc)
> +		close(dev_ipc);
> +
> +	return ret;
> +}
> +
>  static inline int
>  parse_u16_arg(const char *key, const char *value, void *extra_args)  { @@ -
> 122,6 +668,7 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
>  	struct rte_bbdev *bbdev;
>  	const char *name = rte_vdev_device_name(vdev);
>  	struct bbdev_la12xx_private *priv;
> +	int ret;
> 
>  	PMD_INIT_FUNC_TRACE();
> 
> @@ -151,7 +698,13 @@ la12xx_bbdev_create(struct rte_vdev_device
> *vdev,
> 
>  	rte_bbdev_log(INFO, "Setting Up %s: DevId=%d, ModemId=%d",
>  				name, bbdev->data->dev_id, priv-
> >modem_id);
> -	bbdev->dev_ops = NULL;
> +	ret = setup_la12xx_dev(bbdev);
> +	if (ret) {
> +		rte_bbdev_log(ERR, "IPC Setup failed for %s", name);
> +		rte_free(bbdev->data->dev_private);
> +		return ret;
> +	}
> +	bbdev->dev_ops = &pmd_ops;
>  	bbdev->device = &vdev->device;
>  	bbdev->data->socket_id = 0;
>  	bbdev->intr_handle = NULL;
> diff --git a/drivers/baseband/la12xx/bbdev_la12xx.h
> b/drivers/baseband/la12xx/bbdev_la12xx.h
> index 5228502331..fe91e62bf6 100644
> --- a/drivers/baseband/la12xx/bbdev_la12xx.h
> +++ b/drivers/baseband/la12xx/bbdev_la12xx.h
> @@ -5,16 +5,10 @@
>  #ifndef __BBDEV_LA12XX_H__
>  #define __BBDEV_LA12XX_H__
> 
> -#define BBDEV_IPC_ENC_OP_TYPE	1
> -#define BBDEV_IPC_DEC_OP_TYPE	2
> -
> -#define MAX_LDPC_ENC_FECA_QUEUES	4
> -#define MAX_LDPC_DEC_FECA_QUEUES	4
> -
>  #define MAX_CHANNEL_DEPTH 16
>  /* private data structure */
>  struct bbdev_la12xx_private {
> -	void *ipc_priv;
> +	ipc_userspace_t *ipc_priv;
>  	uint8_t num_valid_queues;
>  	uint8_t max_nb_queues;
>  	uint8_t num_ldpc_enc_queues;
> @@ -32,14 +26,14 @@ struct hugepage_info {  struct bbdev_la12xx_q_priv {
>  	struct bbdev_la12xx_private *bbdev_priv;
>  	uint32_t q_id;	/**< Channel ID */
> -	uint32_t feca_blk_id;	/** FECA block ID for processing */
> +	uint32_t feca_blk_id;	/**< FECA block ID for processing */
>  	uint32_t feca_blk_id_be32; /**< FECA Block ID for this queue */
> -	uint8_t en_napi; /* 0: napi disabled, 1: napi enabled */
> +	uint8_t en_napi; /**< 0: napi disabled, 1: napi enabled */
>  	uint16_t queue_size;	/**< Queue depth */
>  	int32_t eventfd;	/**< Event FD value */
>  	enum rte_bbdev_op_type op_type; /**< Operation type */
>  	uint32_t la12xx_core_id;
> -		/* LA12xx core ID on which this will be scheduled */
> +		/**< LA12xx core ID on which this will be scheduled */
>  	struct rte_mempool *mp; /**< Pool from where buffers would be
> cut */
>  	void *bbdev_op[MAX_CHANNEL_DEPTH];
>  			/**< Stores bbdev op for each index */ @@ -52,5
> +46,6 @@ struct bbdev_la12xx_q_priv {
> 
>  #define lower_32_bits(x) ((uint32_t)((uint64_t)x))  #define upper_32_bits(x)
> ((uint32_t)(((uint64_t)(x) >> 16) >> 16))
> -
> +#define join_32_bits(upper, lower) \
> +	((size_t)(((uint64_t)(upper) << 32) | (uint32_t)(lower)))
>  #endif
> diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> index 9aa5562981..5f613fb087 100644
> --- a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> +++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> @@ -4,9 +4,182 @@
>  #ifndef __BBDEV_LA12XX_IPC_H__
>  #define __BBDEV_LA12XX_IPC_H__
> 
> +#define LA12XX_MAX_QUEUES 20
> +#define HOST_RX_QUEUEID_OFFSET LA12XX_MAX_QUEUES
> +
> +/** No. of max channel per instance */
> +#define IPC_MAX_CHANNEL_COUNT	(64)
> +
>  /** No. of max channel per instance */
>  #define IPC_MAX_DEPTH	(16)
> 
> +/** No. of max IPC instance per modem */
> +#define IPC_MAX_INSTANCE_COUNT	(1)
> +
> +/** Error codes */
> +#define IPC_SUCCESS		(0) /** IPC operation success */
> +#define IPC_INPUT_INVALID	(-1) /** Invalid input to API */
> +#define IPC_CH_INVALID		(-2) /** Channel no is invalid */
> +#define IPC_INSTANCE_INVALID	(-3) /** Instance no is invalid */
> +#define IPC_MEM_INVALID		(-4) /** Insufficient memory */
> +#define IPC_CH_FULL		(-5) /** Channel is full */
> +#define IPC_CH_EMPTY		(-6) /** Channel is empty */
> +#define IPC_BL_EMPTY		(-7) /** Free buffer list is empty */
> +#define IPC_BL_FULL		(-8) /** Free buffer list is full */
> +#define IPC_HOST_BUF_ALLOC_FAIL	(-9) /** DPDK malloc fail */
> +#define IPC_MD_SZ_MISS_MATCH	(-10) /** META DATA size in mhif
> miss matched*/
> +#define IPC_MALLOC_FAIL		(-11) /** system malloc fail */
> +#define IPC_IOCTL_FAIL		(-12) /** IOCTL call failed */
> +#define IPC_MMAP_FAIL		(-14) /** MMAP fail */
> +#define IPC_OPEN_FAIL		(-15) /** OPEN fail */
> +#define IPC_EVENTFD_FAIL	(-16) /** eventfd initialization failed */
> +#define IPC_NOT_IMPLEMENTED	(-17) /** IPC feature is not
> implemented yet*/
> +
> +#define SET_HIF_HOST_RDY(hif, RDY_MASK) (hif->host_ready |=
> RDY_MASK)
> +#define CHK_HIF_MOD_RDY(hif, RDY_MASK) (hif->mod_ready &
> RDY_MASK)
> +
> +/* Host Ready bits */
> +#define HIF_HOST_READY_HOST_REGIONS	(1 << 0)
> +#define HIF_HOST_READY_IPC_LIB		(1 << 12)
> +#define HIF_HOST_READY_IPC_APP		(1 << 13)
> +#define HIF_HOST_READY_FECA		(1 << 14)
> +
> +/* Modem Ready bits */
> +#define HIF_MOD_READY_IPC_LIB		(1 << 5)
> +#define HIF_MOD_READY_IPC_APP		(1 << 6)
> +#define HIF_MOD_READY_FECA		(1 << 7)
> +
> +typedef void *ipc_t;
> +
> +struct ipc_msg {
> +	int chid;
> +	void *addr;
> +	uint32_t len;
> +	uint8_t flags;
> +};
> +
> +typedef struct {
> +	uint64_t host_phys;
> +	uint32_t modem_phys;
> +	void    *host_vaddr;
> +	uint32_t size;
> +} mem_range_t;
> +
> +#define GUL_IPC_MAGIC	'R'
> +
> +#define IOCTL_GUL_IPC_GET_SYS_MAP _IOW(GUL_IPC_MAGIC, 1, struct
> ipc_msg
> +*) #define IOCTL_GUL_IPC_CHANNEL_REGISTER _IOWR(GUL_IPC_MAGIC, 4,
> +struct ipc_msg *) #define IOCTL_GUL_IPC_CHANNEL_DEREGISTER \
> +	_IOWR(GUL_IPC_MAGIC, 5, struct ipc_msg *) #define
> +IOCTL_GUL_IPC_CHANNEL_RAISE_INTERRUPT _IOW(GUL_IPC_MAGIC, 6, int
> *)
> +
> +/** buffer ring common metadata */
> +typedef struct ipc_bd_ring_md {
> +	volatile uint32_t pi;		/**< Producer index and flag (MSB)
> +					  *  which flip for each Ring wrapping
> +					  */
> +	volatile uint32_t ci;		/**< Consumer index and flag (MSB)
> +					  *  which flip for each Ring wrapping
> +					  */
> +	uint32_t ring_size;	/**< depth (Used to roll-over pi/ci) */
> +	uint32_t msg_size;	/**< Size of the each buffer */
> +} __rte_packed ipc_br_md_t;
> +
> +/** IPC buffer descriptor */
> +typedef struct ipc_buffer_desc {
> +	union {
> +		uint64_t host_virt;	/**< msg's host virtual address */
> +		struct {
> +			uint32_t host_virt_l;
> +			uint32_t host_virt_h;
> +		};
> +	};
> +	uint32_t modem_ptr;	/**< msg's modem physical address */
> +	uint32_t len;		/**< msg len */
> +} __rte_packed ipc_bd_t;
> +
> +typedef struct ipc_channel {
> +	uint32_t ch_id;		/**< Channel id */
> +	ipc_br_md_t md;			/**< Metadata for BD ring */
> +	ipc_bd_t bd_h[IPC_MAX_DEPTH];	/**< Buffer Descriptor on
> Host */
> +	ipc_bd_t bd_m[IPC_MAX_DEPTH];	/**< Buffer Descriptor on
> Modem */
> +	uint32_t op_type;		/**< Type of the BBDEV operation
> +					  * supported on this channel
> +					  */
> +	uint32_t depth;			/**< Channel depth */
> +	uint32_t feca_blk_id;	/**< FECA Transport Block ID for processing
> */
> +	uint32_t la12xx_core_id;/**< LA12xx core ID on which this will be
> +				  * scheduled
> +				  */
> +	uint32_t feca_input_circ_size;	/**< FECA transport block input
> +					  * circular buffer size
> +					  */
> +	uint32_t host_ipc_params;	/**< Address for host IPC parameters
> */
> +} __rte_packed ipc_ch_t;
> +
> +typedef struct ipc_instance {
> +	uint32_t instance_id;		/**< instance id, use to init this
> +					  * instance by ipc_init API
> +					  */
> +	uint32_t initialized;		/**< Set in ipc_init */
> +	ipc_ch_t ch_list[IPC_MAX_CHANNEL_COUNT];
> +		/**< Channel descriptors in this instance */ } __rte_packed
> +ipc_instance_t;
> +
> +typedef struct ipc_metadata {
> +	uint32_t ipc_host_signature; /**< IPC host signature, Set by host/L2
> */
> +	uint32_t ipc_geul_signature; /**< IPC geul signature, Set by modem
> */
> +	ipc_instance_t instance_list[IPC_MAX_INSTANCE_COUNT];
> +} __rte_packed ipc_metadata_t;
> +
> +typedef struct ipc_channel_us_priv {
> +	int32_t		eventfd;
> +	uint32_t	channel_id;
> +	/* In flight packets status for buffer list. */
> +	uint8_t		bufs_inflight[IPC_MAX_DEPTH];
> +} ipc_channel_us_t;
> +
> +typedef struct {
> +	uint64_t host_phys;
> +	uint32_t modem_phys;
> +	uint32_t size;
> +} mem_strt_addr_t;
> +
> +typedef struct {
> +	mem_strt_addr_t modem_ccsrbar;
> +	mem_strt_addr_t peb_start; /* PEB meta data */
> +	mem_strt_addr_t mhif_start; /* MHIF meta daat */
> +	mem_strt_addr_t hugepg_start; /* Modem to access hugepage */ }
> +sys_map_t;
> +
> +typedef struct ipc_priv_t {
> +	int instance_id;
> +	int dev_ipc;
> +	int dev_mem;
> +	sys_map_t sys_map;
> +	mem_range_t modem_ccsrbar;
> +	mem_range_t peb_start;
> +	mem_range_t mhif_start;
> +	mem_range_t hugepg_start;
> +	ipc_channel_us_t *channels[IPC_MAX_CHANNEL_COUNT];
> +	ipc_instance_t	*instance;
> +	ipc_instance_t	*instance_bk;
> +} ipc_userspace_t;
> +
> +/** Structure specifying enqueue operation (enqueue at LA1224) */
> +struct bbdev_ipc_enqueue_op {
> +	/** Status of operation that was performed */
> +	int32_t status;
> +	/** CRC Status of SD operation that was performed */
> +	int32_t crc_stat_addr;
> +	/** HARQ Output buffer memory length for Shared Decode.
> +	 * Filled by LA12xx.
> +	 */
> +	uint32_t out_len;
> +	/** Reserved (for 8 byte alignment) */
> +	uint32_t rsvd;
> +};
> +
>  /* This shared memory would be on the host side which have copy of some
>   * of the parameters which are also part of Shared BD ring. Read access
>   * of these parameters from the host side would not be over PCI.
> @@ -14,7 +187,21 @@
>  typedef struct host_ipc_params {
>  	volatile uint32_t pi;
>  	volatile uint32_t ci;
> -	volatile uint32_t modem_ptr[IPC_MAX_DEPTH];
> +	volatile uint32_t bd_m_modem_ptr[IPC_MAX_DEPTH];
>  } __rte_packed host_ipc_params_t;
> 
> +struct hif_ipc_regs {
> +	uint32_t ipc_mdata_offset;
> +	uint32_t ipc_mdata_size;
> +} __rte_packed;
> +
> +struct gul_hif {
> +	uint32_t ver;
> +	uint32_t hif_ver;
> +	uint32_t status;
> +	volatile uint32_t host_ready;
> +	volatile uint32_t mod_ready;
> +	struct hif_ipc_regs ipc_regs;
> +} __rte_packed;
> +
>  #endif
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v7 6/9] baseband/la12xx: add enqueue and dequeue support
  2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 6/9] baseband/la12xx: add enqueue and dequeue support nipun.gupta
@ 2021-10-04 23:23     ` Chautru, Nicolas
  0 siblings, 0 replies; 157+ messages in thread
From: Chautru, Nicolas @ 2021-10-04 23:23 UTC (permalink / raw)
  To: nipun.gupta, dev, gakhil; +Cc: david.marchand, hemant.agrawal



> -----Original Message-----
> From: nipun.gupta@nxp.com <nipun.gupta@nxp.com>
> Sent: Tuesday, September 28, 2021 1:30 AM
> To: dev@dpdk.org; gakhil@marvell.com; Chautru, Nicolas
> <nicolas.chautru@intel.com>
> Cc: david.marchand@redhat.com; hemant.agrawal@nxp.com; Nipun Gupta
> <nipun.gupta@nxp.com>
> Subject: [PATCH v7 6/9] baseband/la12xx: add enqueue and dequeue
> support
> 
> From: Hemant Agrawal <hemant.agrawal@nxp.com>
> 
> Add support for enqueue and dequeue the LDPC enc/dec from the modem
> device.
> 
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>  doc/guides/bbdevs/features/la12xx.ini      |  13 +
>  doc/guides/bbdevs/la12xx.rst               |  47 ++-
>  drivers/baseband/la12xx/bbdev_la12xx.c     | 328 ++++++++++++++++++++-
>  drivers/baseband/la12xx/bbdev_la12xx_ipc.h |  37 +++
>  4 files changed, 420 insertions(+), 5 deletions(-)  create mode 100644
> doc/guides/bbdevs/features/la12xx.ini
> 
> diff --git a/doc/guides/bbdevs/features/la12xx.ini
> b/doc/guides/bbdevs/features/la12xx.ini
> new file mode 100644
> index 0000000000..0aec5eecb6
> --- /dev/null
> +++ b/doc/guides/bbdevs/features/la12xx.ini
> @@ -0,0 +1,13 @@
> +;
> +; Supported features of the 'la12xx' bbdev driver.
> +;
> +; Refer to default.ini for the full list of available PMD features.
> +;
> +[Features]
> +Turbo Decoder (4G)     = N
> +Turbo Encoder (4G)     = N
> +LDPC Decoder (5G)      = Y
> +LDPC Encoder (5G)      = Y
> +LLR/HARQ Compression   = N
> +HW Accelerated         = Y
> +BBDEV API              = Y
> diff --git a/doc/guides/bbdevs/la12xx.rst b/doc/guides/bbdevs/la12xx.rst
> index 3c9ac5c047..b111ec0dd6 100644
> --- a/doc/guides/bbdevs/la12xx.rst
> +++ b/doc/guides/bbdevs/la12xx.rst
> @@ -16,10 +16,11 @@ Features
> 
>  LA12xx PMD supports the following features:
> 
> +- LDPC Encode in the DL
> +- LDPC Decode in the UL
>  - Maximum of 8 UL queues
>  - Maximum of 8 DL queues
>  - PCIe Gen-3 x8 Interface
> -- MSI-X
> 
>  Installation
>  ------------
> @@ -79,3 +80,47 @@ For enabling logs, use the following EAL parameter:
> 
>  Using ``bb.la12xx`` as log matching criteria, all Baseband PMD logs can be
> enabled which are lower than logging ``level``.
> +
> +Test Application
> +----------------
> +
> +BBDEV provides a test application, ``test-bbdev.py`` and range of test
> +data for testing the functionality of LA12xx for FEC encode and decode,
> +depending on the device capabilities. The test application is located
> +under app->test-bbdev folder and has the following options:
> +
> +.. code-block:: console
> +
> +  "-p", "--testapp-path": specifies path to the bbdev test app.
> +  "-e", "--eal-params"	: EAL arguments which are passed to the test app.
> +  "-t", "--timeout"	: Timeout in seconds (default=300).
> +  "-c", "--test-cases"	: Defines test cases to run. Run all if not specified.
> +  "-v", "--test-vector"	: Test vector path (default=dpdk_path+/app/test-
> bbdev/test_vectors/bbdev_null.data).
> +  "-n", "--num-ops"	: Number of operations to process on device
> (default=32).
> +  "-b", "--burst-size"	: Operations enqueue/dequeue burst size
> (default=32).
> +  "-s", "--snr"		: SNR in dB used when generating LLRs for bler tests.
> +  "-s", "--iter_max"	: Number of iterations for LDPC decoder.
> +  "-l", "--num-lcores"	: Number of lcores to run (default=16).
> +  "-i", "--init-device" : Initialise PF device with default values.
> +
> +
> +To execute the test application tool using simple decode or encode
> +data, type one of the following:
> +
> +.. code-block:: console
> +
> +  ./test-bbdev.py
> + -e="--vdev=baseband_la12xx,socket_id=0,max_nb_queues=8" -c validation
> + -n 64 -b 1 -v ./ldpc_dec_default.data  ./test-bbdev.py
> + -e="--vdev=baseband_la12xx,socket_id=0,max_nb_queues=8" -c validation
> + -n 64 -b 1 -v ./ldpc_enc_default.data
> +
> +The test application ``test-bbdev.py``, supports the ability to
> +configure the PF device with a default set of values, if the "-i" or "-
> +-init-device" option is included. The default values are defined in
> test_bbdev_perf.c.
> +
> +
> +Test Vectors
> +~~~~~~~~~~~~
> +
> +In addition to the simple LDPC decoder and LDPC encoder tests, bbdev
> +also provides a range of additional tests under the test_vectors
> +folder, which may be useful. The results of these tests will depend on
> +the LA12xx FEC capabilities which may cause some testcases to be skipped,
> but no failure should be reported.
> diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c
> b/drivers/baseband/la12xx/bbdev_la12xx.c
> index 46ee5b4d70..69ca83cee6 100644
> --- a/drivers/baseband/la12xx/bbdev_la12xx.c
> +++ b/drivers/baseband/la12xx/bbdev_la12xx.c
> @@ -120,6 +120,10 @@ la12xx_queue_release(struct rte_bbdev *dev,
> uint16_t q_id)
>  		((uint64_t) ((unsigned long) (A) \
>  		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
> 
> +#define MODEM_P2V(A) \
> +	((uint64_t) ((unsigned long) (A) \
> +		+ (unsigned long)(ipc_priv->peb_start.host_vaddr)))
> +
>  static int ipc_queue_configure(uint32_t channel_id,
>  		ipc_t instance, struct bbdev_la12xx_q_priv *q_priv)  { @@ -
> 334,6 +338,318 @@ static const struct rte_bbdev_ops pmd_ops = {
>  	.queue_release = la12xx_queue_release,
>  	.start = la12xx_start
>  };
> +
> +static inline int
> +is_bd_ring_full(uint32_t ci, uint32_t ci_flag,
> +		uint32_t pi, uint32_t pi_flag)
> +{
> +	if (pi == ci) {
> +		if (pi_flag != ci_flag)
> +			return 1; /* Ring is Full */
> +	}
> +	return 0;
> +}
> +
> +static inline int
> +prepare_ldpc_enc_op(struct rte_bbdev_enc_op *bbdev_enc_op,
> +		    struct bbdev_la12xx_q_priv *q_priv __rte_unused,
> +		    struct rte_bbdev_op_data *in_op_data __rte_unused,
> +		    struct rte_bbdev_op_data *out_op_data) {
> +	struct rte_bbdev_op_ldpc_enc *ldpc_enc = &bbdev_enc_op-
> >ldpc_enc;
> +	uint32_t total_out_bits;
> +
> +	total_out_bits = (ldpc_enc->tb_params.cab *
> +		ldpc_enc->tb_params.ea) + (ldpc_enc->tb_params.c -
> +		ldpc_enc->tb_params.cab) * ldpc_enc->tb_params.eb;
> +
> +	ldpc_enc->output.length = (total_out_bits + 7)/8;
> +
> +	rte_pktmbuf_append(out_op_data->data, ldpc_enc->output.length);
> +
> +	return 0;
> +}
> +
> +static inline int
> +prepare_ldpc_dec_op(struct rte_bbdev_dec_op *bbdev_dec_op,
> +		    struct bbdev_ipc_dequeue_op *bbdev_ipc_op,
> +		    struct bbdev_la12xx_q_priv *q_priv  __rte_unused,
> +		    struct rte_bbdev_op_data *out_op_data  __rte_unused) {
> +	struct rte_bbdev_op_ldpc_dec *ldpc_dec = &bbdev_dec_op-
> >ldpc_dec;
> +	uint32_t total_out_bits;
> +	uint32_t num_code_blocks = 0;
> +	uint16_t sys_cols;
> +
> +	sys_cols = (ldpc_dec->basegraph == 1) ? 22 : 10;
> +	if (ldpc_dec->tb_params.c == 1) {
> +		total_out_bits = ((sys_cols * ldpc_dec->z_c) -
> +				ldpc_dec->n_filler);
> +		/* 5G-NR protocol uses 16 bit CRC when output packet
> +		 * size <= 3824 (bits). Otherwise 24 bit CRC is used.
> +		 * Adjust the output bits accordingly
> +		 */
> +		if (total_out_bits - 16 <= 3824)
> +			total_out_bits -= 16;
> +		else
> +			total_out_bits -= 24;
> +		ldpc_dec->hard_output.length = (total_out_bits / 8);
> +	} else {
> +		total_out_bits = (((sys_cols * ldpc_dec->z_c) -
> +				ldpc_dec->n_filler - 24) *
> +				ldpc_dec->tb_params.c);
> +		ldpc_dec->hard_output.length = (total_out_bits / 8) - 3;
> +	}
> +
> +	num_code_blocks = ldpc_dec->tb_params.c;
> +
> +	bbdev_ipc_op->num_code_blocks =
> rte_cpu_to_be_32(num_code_blocks);
> +
> +	return 0;
> +}
> +
> +static int
> +enqueue_single_op(struct bbdev_la12xx_q_priv *q_priv, void *bbdev_op) {
> +	struct bbdev_la12xx_private *priv = q_priv->bbdev_priv;
> +	ipc_userspace_t *ipc_priv = priv->ipc_priv;
> +	ipc_instance_t *ipc_instance = ipc_priv->instance;
> +	struct bbdev_ipc_dequeue_op *bbdev_ipc_op;
> +	struct rte_bbdev_op_ldpc_enc *ldpc_enc;
> +	struct rte_bbdev_op_ldpc_dec *ldpc_dec;
> +	uint32_t q_id = q_priv->q_id;
> +	uint32_t ci, ci_flag, pi, pi_flag;
> +	ipc_ch_t *ch = &(ipc_instance->ch_list[q_id]);
> +	ipc_br_md_t *md = &(ch->md);
> +	size_t virt;
> +	char *huge_start_addr =
> +		(char *)q_priv->bbdev_priv->ipc_priv-
> >hugepg_start.host_vaddr;
> +	struct rte_bbdev_op_data *in_op_data, *out_op_data;
> +	char *data_ptr;
> +	uint32_t l1_pcie_addr;
> +	int ret;
> +
> +	ci = IPC_GET_CI_INDEX(q_priv->host_ci);
> +	ci_flag = IPC_GET_CI_FLAG(q_priv->host_ci);
> +
> +	pi = IPC_GET_PI_INDEX(q_priv->host_pi);
> +	pi_flag = IPC_GET_PI_FLAG(q_priv->host_pi);
> +
> +	rte_bbdev_dp_log(DEBUG, "before bd_ring_full: pi: %u, ci: %u,"
> +		"pi_flag: %u, ci_flag: %u, ring size: %u",
> +		pi, ci, pi_flag, ci_flag, q_priv->queue_size);
> +
> +	if (is_bd_ring_full(ci, ci_flag, pi, pi_flag)) {
> +		rte_bbdev_dp_log(DEBUG, "bd ring full for queue id: %d",
> q_id);
> +		return IPC_CH_FULL;
> +	}
> +
> +	virt = MODEM_P2V(q_priv->host_params->bd_m_modem_ptr[pi]);
> +	bbdev_ipc_op = (struct bbdev_ipc_dequeue_op *)virt;
> +	q_priv->bbdev_op[pi] = bbdev_op;
> +
> +	switch (q_priv->op_type) {
> +	case RTE_BBDEV_OP_LDPC_ENC:
> +		ldpc_enc = &(((struct rte_bbdev_enc_op *)bbdev_op)-
> >ldpc_enc);
> +		in_op_data = &ldpc_enc->input;
> +		out_op_data = &ldpc_enc->output;
> +
> +		ret = prepare_ldpc_enc_op(bbdev_op, q_priv,
> +					  in_op_data, out_op_data);
> +		if (ret) {
> +			rte_bbdev_log(ERR, "process_ldpc_enc_op fail, ret:
> %d",
> +				ret);
> +			return ret;
> +		}
> +		break;
> +
> +	case RTE_BBDEV_OP_LDPC_DEC:
> +		ldpc_dec = &(((struct rte_bbdev_dec_op *)bbdev_op)-
> >ldpc_dec);
> +		in_op_data = &ldpc_dec->input;
> +
> +		out_op_data = &ldpc_dec->hard_output;
> +
> +		ret = prepare_ldpc_dec_op(bbdev_op, bbdev_ipc_op,
> +					  q_priv, out_op_data);
> +		if (ret) {
> +			rte_bbdev_log(ERR, "process_ldpc_dec_op fail, ret:
> %d",
> +				ret);
> +			return ret;
> +		}
> +		break;
> +
> +	default:
> +		rte_bbdev_log(ERR, "unsupported bbdev_ipc op type");
> +		return -1;
> +	}
> +
> +	if (in_op_data->data) {
> +		data_ptr = rte_pktmbuf_mtod(in_op_data->data, char *);
> +		l1_pcie_addr = (uint32_t)GUL_USER_HUGE_PAGE_ADDR +
> +			       data_ptr - huge_start_addr;
> +		bbdev_ipc_op->in_addr = l1_pcie_addr;
> +		bbdev_ipc_op->in_len = in_op_data->length;
> +	}
> +
> +	if (out_op_data->data) {
> +		data_ptr = rte_pktmbuf_mtod(out_op_data->data, char *);
> +		l1_pcie_addr = (uint32_t)GUL_USER_HUGE_PAGE_ADDR +
> +				data_ptr - huge_start_addr;
> +		bbdev_ipc_op->out_addr =
> rte_cpu_to_be_32(l1_pcie_addr);
> +		bbdev_ipc_op->out_len = rte_cpu_to_be_32(out_op_data-
> >length);
> +	}
> +
> +	/* Move Producer Index forward */
> +	pi++;
> +	/* Flip the PI flag, if wrapping */
> +	if (unlikely(q_priv->queue_size == pi)) {
> +		pi = 0;
> +		pi_flag = pi_flag ? 0 : 1;
> +	}
> +
> +	if (pi_flag)
> +		IPC_SET_PI_FLAG(pi);
> +	else
> +		IPC_RESET_PI_FLAG(pi);
> +	q_priv->host_pi = pi;
> +
> +	/* Wait for Data Copy & pi_flag update to complete before updating
> pi */
> +	rte_mb();
> +	/* now update pi */
> +	md->pi = rte_cpu_to_be_32(pi);
> +
> +	rte_bbdev_dp_log(DEBUG, "enter: pi: %u, ci: %u,"
> +			"pi_flag: %u, ci_flag: %u, ring size: %u",
> +			pi, ci, pi_flag, ci_flag, q_priv->queue_size);
> +
> +	return 0;
> +}
> +
> +/* Enqueue decode burst */
> +static uint16_t
> +enqueue_dec_ops(struct rte_bbdev_queue_data *q_data,
> +		struct rte_bbdev_dec_op **ops, uint16_t nb_ops) {
> +	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
> +	int nb_enqueued, ret;
> +
> +	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
> +		ret = enqueue_single_op(q_priv, ops[nb_enqueued]);
> +		if (ret)
> +			break;
> +	}
> +
> +	q_data->queue_stats.enqueue_err_count += nb_ops -
> nb_enqueued;
> +	q_data->queue_stats.enqueued_count += nb_enqueued;
> +
> +	return nb_enqueued;
> +}
> +
> +/* Enqueue encode burst */
> +static uint16_t
> +enqueue_enc_ops(struct rte_bbdev_queue_data *q_data,
> +		struct rte_bbdev_enc_op **ops, uint16_t nb_ops) {
> +	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
> +	int nb_enqueued, ret;
> +
> +	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
> +		ret = enqueue_single_op(q_priv, ops[nb_enqueued]);
> +		if (ret)
> +			break;
> +	}
> +
> +	q_data->queue_stats.enqueue_err_count += nb_ops -
> nb_enqueued;
> +	q_data->queue_stats.enqueued_count += nb_enqueued;
> +
> +	return nb_enqueued;
> +}
> +
> +/* Dequeue encode burst */
> +static void *
> +dequeue_single_op(struct bbdev_la12xx_q_priv *q_priv, void *dst) {
> +	void *op;
> +	uint32_t ci, ci_flag;
> +	uint32_t temp_ci;
> +
> +	temp_ci = q_priv->host_params->ci;
> +	if (temp_ci == q_priv->host_ci)
> +		return NULL;
> +
> +	ci = IPC_GET_CI_INDEX(q_priv->host_ci);
> +	ci_flag = IPC_GET_CI_FLAG(q_priv->host_ci);
> +
> +	rte_bbdev_dp_log(DEBUG,
> +		"ci: %u, ci_flag: %u, ring size: %u",
> +		ci, ci_flag, q_priv->queue_size);
> +
> +	op = q_priv->bbdev_op[ci];
> +
> +	rte_memcpy(dst, q_priv->msg_ch_vaddr[ci],
> +		sizeof(struct bbdev_ipc_enqueue_op));
> +
> +	/* Move Consumer Index forward */
> +	ci++;
> +	/* Flip the CI flag, if wrapping */
> +	if (q_priv->queue_size == ci) {
> +		ci = 0;
> +		ci_flag = ci_flag ? 0 : 1;
> +	}
> +	if (ci_flag)
> +		IPC_SET_CI_FLAG(ci);
> +	else
> +		IPC_RESET_CI_FLAG(ci);
> +
> +	q_priv->host_ci = ci;
> +
> +	rte_bbdev_dp_log(DEBUG,
> +		"exit: ci: %u, ci_flag: %u, ring size: %u",
> +		ci, ci_flag, q_priv->queue_size);
> +
> +	return op;
> +}
> +
> +/* Dequeue decode burst */
> +static uint16_t
> +dequeue_dec_ops(struct rte_bbdev_queue_data *q_data,
> +		struct rte_bbdev_dec_op **ops, uint16_t nb_ops) {
> +	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
> +	struct bbdev_ipc_enqueue_op bbdev_ipc_op;
> +	int nb_dequeued;
> +
> +	for (nb_dequeued = 0; nb_dequeued < nb_ops; nb_dequeued++) {
> +		ops[nb_dequeued] = dequeue_single_op(q_priv,
> &bbdev_ipc_op);
> +		if (!ops[nb_dequeued])
> +			break;
> +		ops[nb_dequeued]->status = bbdev_ipc_op.status;
> +	}
> +	q_data->queue_stats.dequeued_count += nb_dequeued;
> +
> +	return nb_dequeued;
> +}
> +
> +/* Dequeue encode burst */
> +static uint16_t
> +dequeue_enc_ops(struct rte_bbdev_queue_data *q_data,
> +		struct rte_bbdev_enc_op **ops, uint16_t nb_ops) {
> +	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
> +	struct bbdev_ipc_enqueue_op bbdev_ipc_op;
> +	int nb_enqueued;
> +
> +	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
> +		ops[nb_enqueued] = dequeue_single_op(q_priv,
> &bbdev_ipc_op);
> +		if (!ops[nb_enqueued])
> +			break;
> +		ops[nb_enqueued]->status = bbdev_ipc_op.status;
> +	}
> +	q_data->queue_stats.enqueued_count += nb_enqueued;
> +
> +	return nb_enqueued;
> +}
> +
>  static struct hugepage_info *
>  get_hugepage_info(void)
>  {
> @@ -710,10 +1026,14 @@ la12xx_bbdev_create(struct rte_vdev_device
> *vdev,
>  	bbdev->intr_handle = NULL;
> 
>  	/* register rx/tx burst functions for data path */
> -	bbdev->dequeue_enc_ops = NULL;
> -	bbdev->dequeue_dec_ops = NULL;
> -	bbdev->enqueue_enc_ops = NULL;
> -	bbdev->enqueue_dec_ops = NULL;
> +	bbdev->dequeue_enc_ops = dequeue_enc_ops;
> +	bbdev->dequeue_dec_ops = dequeue_dec_ops;
> +	bbdev->enqueue_enc_ops = enqueue_enc_ops;
> +	bbdev->enqueue_dec_ops = enqueue_dec_ops;

These functions are for 4G which are not supported here. These can be kept as NULL. The ones used for LDPC are below. 

> +	bbdev->dequeue_ldpc_enc_ops = dequeue_enc_ops;
> +	bbdev->dequeue_ldpc_dec_ops = dequeue_dec_ops;
> +	bbdev->enqueue_ldpc_enc_ops = enqueue_enc_ops;
> +	bbdev->enqueue_ldpc_dec_ops = enqueue_dec_ops;
> 
>  	return 0;
>  }
> diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> index 5f613fb087..b6a7f677d0 100644
> --- a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> +++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
> @@ -73,6 +73,25 @@ typedef struct {
>  	_IOWR(GUL_IPC_MAGIC, 5, struct ipc_msg *)  #define
> IOCTL_GUL_IPC_CHANNEL_RAISE_INTERRUPT _IOW(GUL_IPC_MAGIC, 6, int
> *)
> 
> +#define GUL_USER_HUGE_PAGE_OFFSET	(0)
> +#define GUL_PCI1_ADDR_BASE	(0x00000000ULL)
> +
> +#define GUL_USER_HUGE_PAGE_ADDR	(GUL_PCI1_ADDR_BASE +
> GUL_USER_HUGE_PAGE_OFFSET)
> +
> +/* IPC PI/CI index & flag manipulation helpers */
> +#define IPC_PI_CI_FLAG_MASK	0x80000000 /*  (1<<31) */
> +#define IPC_PI_CI_INDEX_MASK	0x7FFFFFFF /* ~(1<<31) */
> +
> +#define IPC_SET_PI_FLAG(x)	(x |= IPC_PI_CI_FLAG_MASK)
> +#define IPC_RESET_PI_FLAG(x)	(x &= IPC_PI_CI_INDEX_MASK)
> +#define IPC_GET_PI_FLAG(x)	(x >> 31)
> +#define IPC_GET_PI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
> +
> +#define IPC_SET_CI_FLAG(x)	(x |= IPC_PI_CI_FLAG_MASK)
> +#define IPC_RESET_CI_FLAG(x)	(x &= IPC_PI_CI_INDEX_MASK)
> +#define IPC_GET_CI_FLAG(x)	(x >> 31)
> +#define IPC_GET_CI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
> +
>  /** buffer ring common metadata */
>  typedef struct ipc_bd_ring_md {
>  	volatile uint32_t pi;		/**< Producer index and flag (MSB)
> @@ -180,6 +199,24 @@ struct bbdev_ipc_enqueue_op {
>  	uint32_t rsvd;
>  };
> 
> +/** Structure specifying dequeue operation (dequeue at LA1224) */
> +struct bbdev_ipc_dequeue_op {
> +	/** Input buffer memory address */
> +	uint32_t in_addr;
> +	/** Input buffer memory length */
> +	uint32_t in_len;
> +	/** Output buffer memory address */
> +	uint32_t out_addr;
> +	/** Output buffer memory length */
> +	uint32_t out_len;
> +	/* Number of code blocks. Only set when HARQ is used */
> +	uint32_t num_code_blocks;
> +	/** Dequeue Operation flags */
> +	uint32_t op_flags;
> +	/** Shared metadata between L1 and L2 */
> +	uint32_t shared_metadata;
> +};
> +
>  /* This shared memory would be on the host side which have copy of some
>   * of the parameters which are also part of Shared BD ring. Read access
>   * of these parameters from the host side would not be over PCI.
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v7 9/9] app/bbdev: add test vectors for transport blocks
  2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 9/9] app/bbdev: add test vectors for transport blocks nipun.gupta
@ 2021-10-04 23:31     ` Chautru, Nicolas
  0 siblings, 0 replies; 157+ messages in thread
From: Chautru, Nicolas @ 2021-10-04 23:31 UTC (permalink / raw)
  To: nipun.gupta, dev, gakhil; +Cc: david.marchand, hemant.agrawal

Hi Nipin, 
Based on patch 8/9 you should not need new vectors with different endianness. 
Existing vectors should already be supported (ie all vectors must have the same LE endianness assumption) and the bbdev-test will call reverse_all_ops to change the endianness from the vectors when the endianness == BE.
This is the same concept mentioned a few times, let me know if unclear
Thanks
Nic


> -----Original Message-----
> From: nipun.gupta@nxp.com <nipun.gupta@nxp.com>
> Sent: Tuesday, September 28, 2021 1:30 AM
> To: dev@dpdk.org; gakhil@marvell.com; Chautru, Nicolas
> <nicolas.chautru@intel.com>
> Cc: david.marchand@redhat.com; hemant.agrawal@nxp.com; Nipun Gupta
> <nipun.gupta@nxp.com>
> Subject: [PATCH v7 9/9] app/bbdev: add test vectors for transport blocks
> 
> From: Nipun Gupta <nipun.gupta@nxp.com>
> 
> This patch adds two test vectors for transport block in network byte
> order:
> - LDPC encode for Transport Block
> - LDPC decode for Transport block
> 
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---
>  app/test-bbdev/test_vectors/ldpc_dec_tb.data | 265
> +++++++++++++++++++  app/test-bbdev/test_vectors/ldpc_enc_tb.data |  95
> +++++++
>  2 files changed, 360 insertions(+)
>  create mode 100644 app/test-bbdev/test_vectors/ldpc_dec_tb.data
>  create mode 100644 app/test-bbdev/test_vectors/ldpc_enc_tb.data
> 
> diff --git a/app/test-bbdev/test_vectors/ldpc_dec_tb.data b/app/test-
> bbdev/test_vectors/ldpc_dec_tb.data
> new file mode 100644
> index 0000000000..5882e8aafe
> --- /dev/null
> +++ b/app/test-bbdev/test_vectors/ldpc_dec_tb.data
> @@ -0,0 +1,265 @@
> +# SPDX-License-Identifier: BSD-3-Clause # Copyright 2021 NXP
> +
> +op_type =
> +RTE_BBDEV_OP_LDPC_DEC
> +
> +input0 =
> +0x7f818181, 0x7f7f817f, 0x7f817f81, 0x817f8181, 0x817f7f81, 0x817f7f81,
> +0x7f817f7f, 0x7f7f7f81, 0x7f7f7f7f, 0x817f7f7f, 0x7f7f8181, 0x817f7f7f,
> +0x7f7f817f, 0x8181817f, 0x817f7f81, 0x7f7f8181, 0x81817f81, 0x7f7f7f81,
> +0x81817f7f, 0x7f81817f, 0x817f7f81, 0x7f817f81, 0x8181817f, 0x7f7f7f81,
> +0x7f7f817f, 0x81817f7f, 0x7f81817f, 0x7f7f817f, 0x817f817f, 0x7f7f817f,
> +0x7f7f7f81, 0x7f7f7f81, 0x7f817f7f, 0x7f818181, 0x7f818181, 0x8181817f,
> +0x7f7f8181, 0x7f7f7f7f, 0x7f817f7f, 0x81818181, 0x7f7f817f, 0x7f7f7f7f,
> +0x817f8181, 0x7f7f7f81, 0x817f817f, 0x817f8181, 0x81817f7f, 0x7f7f7f7f,
> +0x81817f7f, 0x7f81817f, 0x817f7f7f, 0x817f7f81, 0x7f817f7f, 0x817f817f,
> +0x81817f81, 0x817f7f7f, 0x817f7f81, 0x817f817f, 0x8181817f, 0x81818181,
> +0x81818181, 0x817f7f7f, 0x7f817f81, 0x817f7f7f, 0x7f817f7f, 0x7f817f7f,
> +0x7f818181, 0x7f818181, 0x817f817f, 0x81817f81, 0x7f81817f, 0x817f817f,
> +0x7f81817f, 0x817f7f81, 0x7f7f817f, 0x817f8181, 0x817f7f81, 0x81817f7f,
> +0x8181817f, 0x7f7f7f7f, 0x817f7f81, 0x7f81817f, 0x7f7f7f7f, 0x7f817f81,
> +0x7f817f81, 0x817f7f7f, 0x81818181, 0x7f7f8181, 0x7f818181, 0x81817f7f,
> +0x7f817f81, 0x7f81817f, 0x7f7f8181, 0x7f7f817f, 0x7f7f817f, 0x81817f81,
> +0x7f818181, 0x8181817f, 0x7f817f81, 0x7f7f8181, 0x7f7f8181, 0x817f7f81,
> +0x7f7f7f7f, 0x7f817f7f, 0x7f7f8181, 0x7f817f7f, 0x7f818181, 0x81817f7f,
> +0x817f7f7f, 0x81817f81, 0x7f817f7f, 0x7f81817f, 0x7f81817f, 0x817f7f81,
> +0x7f817f7f, 0x817f817f, 0x7f7f817f, 0x817f7f81, 0x817f817f, 0x817f8181,
> +0x817f817f, 0x7f817f7f, 0x7f817f7f, 0x8181817f, 0x7f818181, 0x7f817f7f,
> +0x7f818181, 0x7f7f817f, 0x817f8181, 0x8181817f, 0x7f817f7f, 0x7f7f817f,
> +0x7f7f817f, 0x7f7f8181, 0x817f7f7f, 0x817f8181, 0x7f7f817f, 0x7f7f7f81,
> +0x817f7f81, 0x7f7f7f81, 0x7f7f7f7f, 0x817f8181, 0x81818181, 0x81817f81,
> +0x817f7f81, 0x7f7f817f, 0x7f817f7f, 0x7f7f8181, 0x7f7f7f81, 0x7f817f81,
> +0x817f8181, 0x81817f7f, 0x7f7f817f, 0x7f817f81, 0x7f817f81, 0x7f7f7f81,
> +0x81818181, 0x81817f7f, 0x7f7f817f, 0x7f817f81, 0x7f7f8181, 0x7f81817f,
> +0x817f8181, 0x7f7f8181, 0x7f7f7f81, 0x8181817f, 0x7f817f81, 0x81817f7f,
> +0x817f7f81, 0x817f8181, 0x817f7f7f, 0x7f7f817f, 0x817f7f7f, 0x81817f81,
> +0x7f7f7f7f, 0x817f7f7f, 0x817f7f81, 0x7f817f81, 0x8181817f, 0x81817f7f,
> +0x817f7f81, 0x7f818181, 0x7f7f817f, 0x7f818181, 0x7f7f7f7f, 0x7f7f8181,
> +0x7f7f817f, 0x7f817f81, 0x817f7f7f, 0x817f817f, 0x7f7f7f81, 0x7f7f7f81,
> +0x7f7f817f, 0x817f8181, 0x81817f81, 0x817f7f7f, 0x7f7f7f81, 0x817f7f7f,
> +0x7f7f7f7f, 0x7f7f817f, 0x81817f81, 0x7f7f7f81, 0x81817f7f, 0x81818181,
> +0x817f7f81, 0x817f817f, 0x817f7f7f, 0x7f7f7f7f, 0x7f81817f, 0x8181817f,
> +0x7f7f817f, 0x817f7f81, 0x7f81817f, 0x817f7f81, 0x7f7f817f, 0x7f818181,
> +0x817f7f7f, 0x817f7f81, 0x81817f81, 0x81817f81, 0x8181817f, 0x7f817f7f,
> +0x7f7f7f81, 0x8181817f, 0x7f817f81, 0x8181817f, 0x7f7f7f81, 0x817f8181,
> +0x817f7f81, 0x81817f81, 0x7f7f817f, 0x7f7f817f, 0x817f7f7f, 0x817f8181,
> +0x7f817f7f, 0x817f7f81, 0x7f7f7f81, 0x7f7f7f7f, 0x817f8181, 0x7f817f81,
> +0x81817f81, 0x7f7f7f81, 0x817f7f7f, 0x817f817f, 0x81817f7f, 0x817f7f81,
> +0x7f81817f, 0x817f817f, 0x81817f81, 0x8181817f, 0x7f818181, 0x7f81817f,
> +0x8181817f, 0x817f7f7f, 0x7f817f7f, 0x8181817f, 0x7f7f7f7f, 0x81817f7f,
> +0x7f7f7f81, 0x817f7f81, 0x7f7f7f81, 0x7f817f7f, 0x7f7f7f7f, 0x817f7f81,
> +0x7f818181, 0x817f7f7f, 0x7f7f7f81, 0x817f7f7f, 0x81818181, 0x81817f7f,
> +0x7f817f81, 0x7f7f7f81, 0x7f818181, 0x817f8181, 0x81817f81, 0x8181817f,
> +0x7f7f8181, 0x817f7f81, 0x7f81817f, 0x7f7f817f, 0x7f7f8181, 0x7f817f7f,
> +0x8181817f, 0x7f817f81, 0x7f817f7f, 0x7f7f8181, 0x7f818181, 0x7f7f8181,
> +0x817f7f81, 0x81817f81, 0x7f81817f, 0x81817f81, 0x817f7f7f, 0x7f818181,
> +0x8181817f, 0x817f8181, 0x7f7f7f81, 0x7f81817f, 0x81817f7f, 0x7f817f81,
> +0x7f7f817f, 0x7f7f8181, 0x7f81817f, 0x7f81817f, 0x7f818181, 0x817f7f7f,
> +0x817f8181, 0x7f7f8181, 0x8181817f, 0x7f817f81, 0x817f8181, 0x817f817f,
> +0x7f7f817f, 0x81817f81, 0x7f817f7f, 0x7f81817f, 0x817f817f, 0x81817f81,
> +0x7f7f7f7f, 0x8181817f, 0x7f817f81, 0x7f817f7f, 0x7f817f81, 0x7f817f7f,
> +0x7f7f7f81, 0x817f817f, 0x7f81817f, 0x817f7f81, 0x81818181, 0x7f817f81,
> +0x7f7f7f81, 0x7f81817f, 0x817f7f7f, 0x817f7f81, 0x817f7f7f, 0x81817f81,
> +0x7f7f817f, 0x817f8181, 0x81818181, 0x81817f81, 0x81817f81, 0x81817f7f,
> +0x81817f7f, 0x7f817f81, 0x7f817f7f, 0x7f7f7f81, 0x7f81817f, 0x817f7f81,
> +0x817f8181, 0x817f7f81, 0x7f817f81, 0x81818181, 0x7f7f7f7f, 0x817f8181,
> +0x817f817f, 0x81818181, 0x81817f7f, 0x7f81817f, 0x81817f81, 0x81818181,
> +0x7f7f7f81, 0x81817f81, 0x81818181, 0x817f7f7f, 0x817f817f, 0x81818181,
> +0x7f7f7f7f, 0x7f7f817f, 0x7f817f81, 0x8181817f, 0x81817f81, 0x7f7f7f7f,
> +0x7f7f817f, 0x81817f7f, 0x817f817f, 0x7f7f7f81, 0x81818181, 0x7f7f817f,
> +0x81818181, 0x7f81817f, 0x7f7f7f7f, 0x817f8181, 0x7f81817f, 0x817f7f7f,
> +0x8181817f, 0x8181817f, 0x817f7f7f, 0x7f7f817f, 0x7f81817f, 0x7f817f81,
> +0x81817f7f, 0x817f7f7f, 0x81818181, 0x81817f7f, 0x7f81817f, 0x8181817f,
> +0x817f8181, 0x81817f7f, 0x7f818181, 0x7f7f7f7f, 0x81818181, 0x8181817f,
> +0x7f81817f, 0x8181817f, 0x7f7f7f7f, 0x7f817f81, 0x7f7f8181, 0x817f8181,
> +0x8181817f, 0x81817f7f, 0x7f817f7f, 0x81818181, 0x7f7f8181, 0x817f817f,
> +0x7f7f8181, 0x817f7f7f, 0x81817f7f, 0x81818181, 0x817f7f7f, 0x7f7f817f,
> +0x81818181, 0x7f817f7f, 0x817f7f7f, 0x7f818181, 0x7f817f81, 0x7f817f7f,
> +0x817f817f, 0x8181817f, 0x7f7f8181, 0x817f8181, 0x817f7f7f, 0x817f817f,
> +0x7f7f817f, 0x7f7f7f7f, 0x7f817f7f, 0x7f7f7f81, 0x81817f81, 0x8181817f,
> +0x81818181, 0x7f818181, 0x817f817f, 0x7f818181, 0x7f81817f, 0x7f817f81,
> +0x7f817f7f, 0x7f81817f, 0x817f8181, 0x81818181, 0x7f7f7f7f, 0x7f817f81,
> +0x7f817f7f, 0x8181817f, 0x817f817f, 0x7f817f7f, 0x817f817f, 0x81818181,
> +0x7f7f8181, 0x81817f81, 0x817f7f7f, 0x817f7f81, 0x8181817f, 0x817f7f7f,
> +0x817f7f81, 0x7f817f81, 0x817f817f, 0x817f817f, 0x81817f81, 0x817f8181,
> +0x817f817f, 0x7f7f8181, 0x7f7f8181, 0x7f7f817f, 0x817f7f81, 0x817f8181,
> +0x7f7f817f, 0x7f7f817f, 0x7f7f8181, 0x7f81817f, 0x7f7f7f7f, 0x7f7f7f7f,
> +0x7f7f7f81, 0x7f817f81, 0x7f817f7f, 0x817f8181, 0x817f8181, 0x7f81817f,
> +0x817f7f7f, 0x7f818181, 0x7f817f7f, 0x7f817f81, 0x81817f7f, 0x817f7f81,
> +0x8181817f, 0x817f7f81, 0x7f818181, 0x817f7f81, 0x7f818181, 0x817f7f7f,
> +0x7f818181, 0x7f7f8181, 0x81817f81, 0x817f7f7f, 0x7f7f817f, 0x817f7f81,
> +0x817f817f, 0x7f817f81, 0x817f8181, 0x817f8181, 0x7f7f7f81, 0x7f817f7f,
> +0x81817f81, 0x7f7f8181, 0x81817f7f, 0x817f7f7f, 0x7f817f7f, 0x817f8181,
> +0x817f817f, 0x7f81817f, 0x7f818181, 0x817f817f, 0x7f7f7f7f, 0x7f817f81,
> +0x7f7f817f, 0x7f818181, 0x81817f81, 0x7f817f81, 0x817f7f7f, 0x7f7f7f7f,
> +0x7f7f7f7f, 0x817f7f81, 0x7f7f8181, 0x81817f7f, 0x7f817f81, 0x817f817f,
> +0x7f7f8181, 0x7f817f7f, 0x7f7f7f81, 0x817f817f, 0x8181817f, 0x7f81817f,
> +0x81817f81, 0x7f7f817f, 0x7f818181, 0x8181817f, 0x7f818181, 0x7f7f7f7f,
> +0x7f7f8181, 0x817f7f7f, 0x7f7f817f, 0x7f817f7f, 0x81817f81, 0x7f7f817f,
> +0x817f7f81, 0x7f817f81, 0x7f7f7f7f, 0x7f818181, 0x81817f7f, 0x817f8181,
> +0x7f817f7f, 0x7f7f817f, 0x817f817f, 0x7f7f817f, 0x7f7f8181, 0x81818181,
> +0x817f7f7f, 0x7f81817f, 0x81818181, 0x817f817f, 0x817f7f81, 0x7f817f7f,
> +0x817f7f7f, 0x8181817f, 0x7f7f7f7f, 0x81818181, 0x7f817f81, 0x7f817f7f,
> +0x817f7f7f, 0x817f7f7f, 0x7f7f8181, 0x7f81817f, 0x7f818181, 0x7f7f817f,
> +0x7f81817f, 0x7f7f7f7f, 0x817f7f7f, 0x81818181, 0x817f7f81, 0x817f8181,
> +0x7f81817f, 0x8181817f, 0x8181817f, 0x817f7f81, 0x7f7f817f, 0x7f81817f,
> +0x7f7f7f7f, 0x81817f81, 0x7f7f817f, 0x7f817f81, 0x81818181, 0x7f7f817f,
> +0x7f817f7f, 0x81818181, 0x81817f81, 0x817f7f7f, 0x7f817f7f, 0x817f7f81,
> +0x8181817f, 0x7f7f7f7f, 0x7f817f7f, 0x81817f7f, 0x817f8181, 0x817f8181,
> +0x7f818181, 0x817f8181, 0x7f818181, 0x7f7f817f, 0x817f8181, 0x7f7f817f,
> +0x7f7f817f, 0x81818181, 0x81817f81, 0x7f7f7f81, 0x817f817f, 0x7f7f7f7f,
> +0x7f7f7f7f, 0x81818181, 0x7f7f7f81, 0x7f818181, 0x7f7f8181, 0x7f7f7f7f,
> +0x81817f81, 0x7f817f7f, 0x8181817f, 0x7f817f7f, 0x817f7f7f, 0x7f817f81,
> +0x8181817f, 0x7f7f817f, 0x817f7f7f, 0x7f7f7f7f, 0x8181817f, 0x7f81817f,
> +0x7f7f817f, 0x7f7f7f7f, 0x8181817f, 0x7f7f7f7f, 0x8181817f, 0x7f817f81,
> +0x81818181, 0x7f7f7f7f, 0x817f8181, 0x81818181, 0x7f7f817f, 0x7f817f7f,
> +0x817f8181, 0x7f7f8181, 0x8181817f, 0x7f7f7f7f, 0x81817f7f, 0x7f7f817f,
> +0x817f7f7f, 0x7f817f7f, 0x817f817f, 0x7f7f817f, 0x81818181, 0x81818181,
> +0x7f7f7f81, 0x81818181, 0x817f7f81, 0x7f7f8181, 0x81818181, 0x7f7f7f81,
> +0x7f81817f, 0x817f817f, 0x817f8181, 0x8181817f, 0x7f7f8181, 0x7f817f81,
> +0x817f817f, 0x817f8181, 0x81818181, 0x7f818181, 0x817f7f81, 0x8181817f,
> +0x7f817f81, 0x81817f7f, 0x81817f81, 0x81817f81, 0x817f7f81, 0x7f817f7f,
> +0x7f817f7f, 0x81818181, 0x7f817f7f, 0x7f7f8181, 0x817f817f, 0x7f7f7f7f,
> +0x7f81817f, 0x7f81817f, 0x817f817f, 0x7f7f7f7f, 0x8181817f, 0x7f817f81,
> +0x817f8181, 0x7f7f8181, 0x817f7f7f, 0x81818181, 0x8181817f, 0x817f7f81,
> +0x7f818181, 0x7f7f7f81, 0x7f81817f, 0x817f7f81, 0x81817f7f, 0x8181817f,
> +0x81818181, 0x7f818181, 0x7f818181, 0x81817f7f, 0x7f81817f, 0x81818181,
> +0x81817f7f, 0x81817f7f, 0x817f7f7f, 0x7f81817f, 0x81817f7f, 0x8181817f,
> +0x81818181, 0x81818181, 0x7f817f81, 0x7f817f81, 0x817f7f81, 0x81817f81,
> +0x7f7f817f, 0x81817f81, 0x817f7f81, 0x817f817f, 0x81817f7f, 0x81817f81,
> +0x7f7f817f, 0x81818181, 0x7f7f7f81, 0x81817f81, 0x7f7f8181, 0x817f7f81,
> +0x817f7f7f, 0x81818181, 0x817f817f, 0x7f818181, 0x817f8181, 0x7f7f7f7f,
> +0x7f7f7f7f, 0x7f7f817f, 0x7f81817f, 0x8181817f, 0x81817f7f, 0x7f7f8181,
> +0x81817f81, 0x81818181, 0x817f817f, 0x8181817f, 0x7f7f7f7f, 0x7f7f8181,
> +0x7f81817f, 0x7f7f7f81, 0x7f7f7f7f, 0x7f7f7f7f, 0x81817f81, 0x817f7f7f,
> +0x7f7f8181, 0x817f7f7f, 0x7f817f81, 0x817f8181, 0x817f8181, 0x817f8181,
> +0x81817f81, 0x81817f7f, 0x7f818181, 0x7f7f7f7f, 0x7f7f817f, 0x817f8181,
> +0x7f7f7f81, 0x7f7f817f, 0x7f7f7f81, 0x7f817f81, 0x81817f7f, 0x817f817f,
> +0x817f7f81, 0x81818181, 0x7f7f817f, 0x7f817f81, 0x817f7f7f, 0x7f81817f,
> +0x7f817f81, 0x817f817f, 0x817f7f7f, 0x81817f7f, 0x7f818181, 0x7f7f7f81,
> +0x817f7f81, 0x81817f81, 0x7f7f7f81, 0x817f7f81, 0x817f7f81, 0x817f8181,
> +0x7f817f81, 0x7f81817f, 0x7f7f817f, 0x81817f81, 0x8181817f, 0x81817f81,
> +0x7f81817f, 0x817f7f81, 0x7f817f81, 0x7f818181, 0x7f7f7f81, 0x817f8181,
> +0x7f7f8181, 0x7f81817f, 0x81818181, 0x7f7f817f, 0x7f818181, 0x81818181,
> +0x7f81817f, 0x7f818181, 0x817f817f, 0x81818181, 0x7f7f7f81, 0x7f7f7f7f,
> +0x8181817f, 0x817f7f81, 0x817f7f81, 0x7f7f7f7f, 0x817f8181, 0x817f7f81,
> +0x81818181, 0x81817f7f, 0x7f7f8181, 0x8181817f, 0x817f8181, 0x817f817f,
> +0x817f817f, 0x8181817f, 0x7f818181, 0x817f7f81, 0x81817f81, 0x817f817f,
> +0x7f7f8181, 0x7f817f7f, 0x81817f81, 0x817f7f7f, 0x7f7f817f, 0x7f817f81,
> +0x7f817f7f, 0x817f817f, 0x81818181, 0x7f818181, 0x81817f7f, 0x7f818181,
> +0x8181817f, 0x817f7f81, 0x7f7f7f81, 0x7f81817f, 0x7f817f81, 0x81817f7f,
> +0x7f7f7f81, 0x81817f7f, 0x81817f7f, 0x817f7f81, 0x817f8181, 0x8181817f,
> +0x817f817f, 0x7f7f7f81, 0x7f7f817f, 0x7f81817f, 0x8181817f, 0x7f81817f,
> +0x7f817f81, 0x81818181, 0x7f817f81, 0x7f7f7f7f, 0x7f818181, 0x81817f7f,
> +0x817f8181, 0x81817f7f, 0x817f817f, 0x7f7f7f81, 0x817f7f81, 0x7f817f81,
> +0x81817f81, 0x7f817f7f, 0x8181817f, 0x7f818181, 0x7f7f7f7f, 0x7f7f7f7f,
> +0x7f7f8181, 0x7f7f8181, 0x817f817f, 0x81817f81, 0x817f7f7f, 0x817f7f7f,
> +0x817f7f7f, 0x8181817f, 0x81818181, 0x81818181, 0x8181817f, 0x7f817f7f,
> +0x81817f7f, 0x7f7f8181, 0x817f7f81, 0x7f81817f, 0x7f7f817f, 0x81817f81,
> +0x817f7f81, 0x81817f81, 0x7f817f81, 0x817f7f7f, 0x81817f81, 0x7f81817f,
> +0x7f818181, 0x81817f81, 0x7f7f817f, 0x7f7f7f81, 0x7f7f817f, 0x7f7f7f7f,
> +0x817f7f81, 0x81817f7f, 0x7f81817f, 0x7f7f7f7f, 0x7f81817f, 0x7f817f7f,
> +0x817f7f81, 0x81817f7f, 0x7f7f7f81, 0x7f7f7f7f, 0x817f8181, 0x7f7f7f81,
> +0x7f7f8181, 0x7f81817f, 0x81818181, 0x7f7f7f7f, 0x81817f7f, 0x7f7f817f,
> +0x8181817f, 0x81818181, 0x81817f81, 0x817f7f7f, 0x81818181, 0x817f8181,
> +0x7f7f8181, 0x7f81817f, 0x817f7f81, 0x7f7f7f81, 0x7f817f7f, 0x81818181,
> +0x7f7f817f, 0x817f7f81, 0x817f7f81, 0x81817f7f, 0x7f817f81, 0x7f817f7f,
> +0x81817f7f, 0x81818181, 0x8181817f, 0x7f7f8181, 0x7f817f81, 0x81817f81,
> +0x81817f7f, 0x817f7f81, 0x817f7f81, 0x7f818181, 0x7f818181, 0x817f8181,
> +0x7f81817f, 0x7f7f817f, 0x7f817f81, 0x7f81817f, 0x7f817f7f, 0x817f8181,
> +0x7f7f817f, 0x81817f7f, 0x817f7f81, 0x7f818181, 0x81817f7f, 0x7f817f81,
> +0x7f7f817f, 0x817f7f81, 0x8181817f, 0x81817f7f, 0x7f7f7f81, 0x7f7f817f,
> +0x7f7f7f81, 0x7f81817f, 0x7f81817f, 0x7f818181, 0x7f7f817f, 0x7f7f817f,
> +0x7f81817f, 0x7f7f8181, 0x817f7f7f, 0x7f7f7f7f, 0x7f7f7f81, 0x7f818181,
> +0x81817f7f, 0x817f8181, 0x7f81817f, 0x7f7f7f7f, 0x7f7f7f7f, 0x817f7f7f,
> +0x81817f7f, 0x7f7f8181, 0x817f8181, 0x7f81817f, 0x7f7f8181, 0x81817f7f,
> +0x8181817f, 0x81818181, 0x81817f7f, 0x7f817f7f, 0x817f8181, 0x817f7f81,
> +0x7f818181, 0x7f7f817f, 0x817f7f81, 0x7f7f817f, 0x817f7f7f, 0x7f81817f,
> +0x7f7f7f7f, 0x7f817f81, 0x7f817f7f, 0x817f817f, 0x7f818181, 0x7f818181,
> +0x81817f7f, 0x81817f7f, 0x7f817f81, 0x81817f7f, 0x8181817f, 0x7f7f8181,
> +0x817f7f7f, 0x7f81817f, 0x81817f81, 0x817f7f81, 0x8181817f, 0x81817f7f,
> +0x7f7f7f81, 0x7f817f7f, 0x817f7f81, 0x7f817f7f, 0x7f817f7f, 0x81818181,
> +0x7f7f8181, 0x7f7f8181, 0x7f7f7f7f, 0x7f818181, 0x7f7f7f7f, 0x7f7f7f7f,
> +0x7f817f81, 0x7f7f7f7f, 0x7f7f817f, 0x7f81817f, 0x7f7f8181, 0x817f7f81,
> +0x7f817f7f, 0x7f7f817f, 0x81818181, 0x7f81817f, 0x7f7f7f7f, 0x7f817f7f,
> +0x7f81817f, 0x7f817f81, 0x81818181, 0x7f7f7f81, 0x7f81817f, 0x7f7f8181,
> +0x7f7f817f, 0x7f7f8181, 0x7f81817f, 0x81817f7f, 0x7f7f817f, 0x7f81817f,
> +0x817f817f, 0x817f817f, 0x7f7f8181, 0x817f7f81, 0x7f7f8181, 0x7f817f7f,
> +0x7f7f8181, 0x817f817f, 0x817f7f7f, 0x81817f81, 0x8181817f, 0x817f8181,
> +0x8181817f, 0x817f817f, 0x7f818181, 0x817f817f, 0x7f7f7f81, 0x7f818181,
> +0x7f7f7f7f, 0x7f7f817f, 0x817f8181, 0x7f817f81, 0x7f818181, 0x81818181,
> +0x7f81817f, 0x817f7f7f, 0x7f7f8181, 0x81817f81, 0x81817f7f, 0x817f817f,
> +0x7f7f817f, 0x817f7f7f, 0x81818181, 0x817f817f, 0x8181817f, 0x7f7f7f7f,
> +0x81818181, 0x7f81817f, 0x7f7f817f, 0x8181817f, 0x7f817f81, 0x7f7f817f,
> +0x81817f81, 0x817f817f, 0x7f7f7f7f, 0x7f817f7f, 0x81817f81, 0x7f7f7f81,
> +0x7f818181, 0x7f7f8181, 0x7f817f81, 0x7f7f8181, 0x81817f7f, 0x7f817f7f,
> +0x817f7f7f, 0x81817f7f, 0x81818181, 0x7f817f7f, 0x81817f7f, 0x817f7f81,
> +0x8181817f, 0x7f818181, 0x7f7f817f, 0x7f817f81, 0x7f817f7f, 0x7f7f7f81,
> +0x7f7f8181, 0x817f8181, 0x81817f7f, 0x7f7f7f81, 0x817f7f7f, 0x7f7f8181,
> +0x7f818181, 0x8181817f, 0x7f7f8181, 0x81817f81, 0x81818181, 0x7f7f8181,
> +0x817f8181, 0x81817f7f, 0x7f7f7f81, 0x817f7f81, 0x7f7f817f, 0x7f818181,
> +0x7f817f81, 0x7f7f8181, 0x7f817f7f, 0x7f7f817f, 0x7f818181, 0x7f81817f,
> +0x81817f7f, 0x7f7f7f81, 0x81818181, 0x817f7f7f, 0x817f7f7f, 0x7f817f81,
> +0x81818181, 0x8181817f, 0x817f817f, 0x7f818181, 0x7f7f817f, 0x7f818181,
> +0x817f8181, 0x8181817f, 0x7f7f7f81, 0x7f7f8181, 0x7f818181, 0x817f7f81,
> +0x7f818181, 0x8181817f, 0x7f7f7f7f, 0x7f7f817f, 0x81817f81, 0x7f81817f,
> +0x7f81817f, 0x817f7f7f, 0x817f7f7f, 0x817f7f81, 0x817f7f81, 0x7f817f7f,
> +0x7f817f7f, 0x7f818181, 0x81817f81, 0x8181817f, 0x7f7f8181, 0x817f7f7f,
> +0x8181817f, 0x81817f81, 0x817f817f, 0x81818181, 0x7f7f817f, 0x7f7f8181,
> +0x7f81817f, 0x817f8181, 0x7f7f817f, 0x817f7f7f, 0x81817f7f, 0x817f8181,
> +0x7f7f8181, 0x7f7f8181, 0x8181817f, 0x81817f81, 0x7f7f7f81, 0x7f818181,
> +0x7f81817f, 0x8181817f, 0x7f7f7f81, 0x7f817f81, 0x7f818181, 0x817f7f81,
> +0x7f81817f, 0x817f8181, 0x7f7f8181, 0x7f817f7f, 0x7f7f7f7f, 0x81818181,
> +0x81818181, 0x7f7f7f7f, 0x817f817f, 0x7f7f8181, 0x7f81817f, 0x8181817f,
> +0x817f7f7f, 0x7f817f81, 0x7f817f7f, 0x7f818181, 0x7f817f81, 0x8181817f,
> +0x7f817f7f, 0x817f7f81, 0x7f817f7f, 0x7f817f81, 0x81817f7f, 0x817f817f,
> +0x817f817f, 0x81817f81, 0x7f7f8181, 0x8181817f, 0x7f7f817f, 0x7f7f7f7f,
> +0x81817f81, 0x817f8181, 0x7f817f81, 0x7f818181, 0x817f7f81, 0x7f7f817f,
> +0x81817f7f, 0x7f7f7f7f, 0x7f81817f, 0x7f7f7f81, 0x817f8181, 0x8181817f,
> +0x7f817f7f, 0x817f817f, 0x7f817f7f, 0x7f817f81, 0x817f8181, 0x817f7f7f,
> +0x7f81817f, 0x817f8181, 0x81817f7f, 0x8181817f, 0x817f7f81, 0x7f817f7f,
> +0x7f81817f, 0x7f818181, 0x817f7f81, 0x817f7f81, 0x81817f81, 0x81817f81,
> +0x81817f7f, 0x7f81817f, 0x81817f7f, 0x7f817f81, 0x817f7f7f, 0x81818181,
> +0x7f7f817f, 0x81817f7f, 0x817f817f, 0x7f817f7f, 0x817f8181, 0x81818181,
> +0x817f8181, 0x817f7f81, 0x7f7f7f7f, 0x7f817f81, 0x817f7f81, 0x7f817f7f,
> +0x817f7f81, 0x7f7f7f81, 0x7f817f81, 0x7f7f8181, 0x7f7f7f81, 0x7f817f7f,
> +0x817f7f7f, 0x817f7f7f, 0x81817f7f, 0x817f7f81, 0x7f818181, 0x7f817f7f,
> +0x7f817f7f, 0x8181817f, 0x81817f7f, 0x7f817f81, 0x81818181, 0x81817f81,
> +0x81818181, 0x7f817f7f, 0x7f817f81, 0x81818181, 0x8181817f, 0x81817f7f,
> +0x817f7f7f, 0x7f818181, 0x7f7f8181, 0x7f818181, 0x8181817f, 0x7f817f81,
> +0x7f7f7f81, 0x8181817f, 0x817f7f7f, 0x7f7f817f, 0x7f817f7f, 0x7f817f7f,
> +0x7f817f7f, 0x7f817f81, 0x817f7f81, 0x817f7f7f, 0x817f817f, 0x817f817f,
> +0x817f7f7f, 0x817f8181, 0x7f7f7f7f, 0x7f817f81, 0x817f817f, 0x7f817f7f,
> +0x7f817f81, 0x81817f81, 0x7f7f7f7f, 0x817f7f81, 0x7f818181, 0x7f81817f,
> +0x817f7f7f, 0x81818181, 0x817f8181, 0x81817f7f, 0x7f7f8181, 0x7f7f8181,
> +0x7f817f81, 0x81817f81, 0x817f7f81, 0x81818181, 0x8181817f, 0x7f7f8181,
> +0x81818181, 0x817f7f81, 0x7f817f81, 0x817f7f7f, 0x81818181, 0x7f81817f,
> +0x7f7f8181, 0x817f7f81, 0x8181817f, 0x7f818181, 0x817f8181, 0x7f7f7f7f,
> +0x8181817f, 0x817f817f, 0x817f8181, 0x81817f81, 0x817f817f, 0x7f817f81,
> +0x7f7f8181, 0x817f7f81, 0x81818181, 0x7f817f81, 0x817f8181, 0x7f7f7f7f,
> +0x8181817f, 0x7f7f8181, 0x817f817f, 0x81817f7f, 0x7f817f81, 0x7f817f7f,
> +0x7f818181, 0x7f7f7f7f, 0x7f7f817f, 0x7f81817f, 0x817f7f81, 0x817f817f,
> +0x7f7f8181, 0x7f7f7f81, 0x817f8181, 0x81818181, 0x8181817f, 0x7f7f8181,
> +0x7f817f7f, 0x7f7f7f81, 0x7f7f7f81, 0x7f7f7f7f, 0x81818181, 0x7f7f8181,
> +0x817f7f81, 0x81817f7f, 0x7f7f7f7f, 0x817f7f81, 0x7f817f81, 0x81818181,
> +0x7f817f81, 0x7f7f7f7f, 0x8181817f, 0x7f7f7f81, 0x7f817f7f, 0x817f8181,
> +0x7f7f8181, 0x817f8181, 0x7f7f817f, 0x817f8181, 0x817f7f81, 0x81818181,
> +0x7f7f8181, 0x81818181, 0x7f7f817f, 0x817f817f, 0x7f7f8181, 0x81818181,
> +0x7f7f7f7f, 0x7f81817f, 0x8181817f, 0x817f817f, 0x817f8181, 0x7f818181,
> +0x81818181, 0x817f817f, 0x7f817f81, 0x7f817f81, 0x81817f7f, 0x8181817f,
> +0x817f817f, 0x817f7f7f, 0x81817f81, 0x81817f7f, 0x7f7f817f, 0x7f7f8181,
> +0x8181817f, 0x81818181, 0x81817f7f, 0x7f818181, 0x7f7f7f7f, 0x817f7f81,
> +0x817f7f81, 0x7f7f7f7f, 0x7f7f7f7f, 0x81817f7f, 0x817f7f7f, 0x7f817f7f,
> +0x7f7f7f7f, 0x817f8181, 0x81817f81, 0x7f7f7f7f, 0x817f8181, 0x7f7f817f,
> +0x81818181, 0x7f7f7f7f, 0x7f817f81, 0x7f7f7f7f, 0x81817f81, 0x81818181,
> +0x8181817f, 0x817f8181, 0x7f817f81, 0x8181817f, 0x7f7f7f81, 0x817f7f7f,
> +0x7f818181, 0x7f818181, 0x7f7f7f81, 0x7f817f81, 0x8181817f, 0x7f818181
> +
> +output0 =
> +0xd0dd44b2, 0xe91d434b, 0x17b23d65, 0xb8abd7c1, 0x12d7d41c,
> 0xce2686c2,
> +0x402c1efa, 0xc9151fcc, 0xe00effad, 0xc964d36a, 0xe70e39e3, 0xd86577a2,
> +0x77e04ae3, 0x9dfd60b9, 0xbf43376f, 0x09841e69, 0x53a02679,
> 0x898c65d0,
> +0x17434cf8, 0x9a3abfe2, 0x05e767ac, 0x902d6156, 0x716046a1,
> 0x636fc345,
> +0xf15b483e, 0x910e40e4, 0x5d32b9a2, 0x8e9514b0, 0x7a218bb8,
> 0x7665aac3,
> +0x33a5b20c, 0x8ba7b5e3, 0x220262e0, 0x7b654c15, 0xa69f1855,
> 0x6dcf61e3,
> +0x0036c1aa, 0x7ea806e3, 0x3f9b2ef1, 0x386cdd36, 0xf94ae7e4,
> 0xf707e376,
> +0xb9c90f7b, 0x40bdd41f, 0x03cf6ae8, 0xfbd5b550, 0x03d90ae6,
> 0x65a6cf09,
> +0xa3d70588, 0x26343d97, 0x464981b1, 0xd79f8b30, 0xa554bb7e,
> 0x524d3a2c,
> +0x2f75d78c, 0x3148c8d8, 0xd4cccf4d, 0xc98df39c, 0x7f4fdb2a, 0x831c5ccd,
> +0xbe46bd67, 0xa9bf0a6b, 0xa726bdcc, 0xd590425d, 0xa792805b,
> 0xe4b0518a,
> +0x18c4bcca, 0xf3891686, 0x3cdee43e, 0xd526e3a9, 0x8112aec6,
> 0x811151f4,
> +0x9763de36, 0x56e50307, 0xa7313051, 0xc40db40a, 0x1931fa6e,
> 0x5701947d,
> +0x098ee810, 0x01cec402, 0x804668f1, 0xc00c41da, 0x02432f4d,
> 0x072c9643,
> +0xf23088cc, 0x74620646, 0x281f8a80, 0x2c7a2aa6, 0xfe8c2f88, 0xe0100f94,
> +0x9c402559, 0x48f5c34d, 0x59a3b023, 0x2427f7e0, 0xb2f30717,
> 0x9bf140a6,
> +0x3fa4710b, 0xb493a4a2, 0xb16e6135, 0xd75f0e8e, 0xe7ff6b4a,
> 0x43d9e122,
> +0xafc5d306, 0xec88d05e, 0xabfc996a, 0x29644a44, 0xa0c5c9fa, 0xf5836a0b,
> +0xd2a97513, 0x6986e115, 0x5581b429, 0xd6f8e599, 0x035a2d9a,
> 0xe0835100,
> +0x561d04c5, 0x565f647a, 0xff711c76, 0x6b6fcd71, 0xb08518ac,
> 0xad407897,
> +0x6de25115, 0x8e8fd5f1, 0x67196a81, 0xb6ef576b, 0x5e170674,
> 0x3cd78132,
> +0x0be74b19, 0x84f30e7b, 0x85aa98b6, 0xcfe08810, 0xaa438ec3,
> 0xe95c3900,
> +0xafb0c225, 0xbe52bde2, 0xd6dcfec6, 0xccde045b, 0x4fd00da2,
> 0x30c377b7,
> +0x771fdf0b, 0xea5f9282, 0x838dc0bf, 0x3250d0a9, 0xf2190c4d,
> 0x5ec14787,
> +0x32c2d755, 0xe3b9f56c, 0xfb34945e, 0x642dc6c3, 0x8fb96e69,
> 0x612afce6,
> +0x17eb0530, 0x2fa9637c, 0xef1068a6, 0x456c8bcd, 0x65b16eb9,
> 0xf97d8e92,
> +0x7b1a46
> +
> +basegraph=
> +2
> +
> +z_c=
> +256
> +
> +n_cb=
> +12800
> +
> +q_m=
> +2
> +
> +n_filler=
> +16
> +
> +ea =
> +3000
> +
> +eb =
> +3000
> +
> +iter_max=
> +8
> +
> +expected_iter_count=
> +2
> +
> +c =
> +2
> +
> +r =
> +0
> +
> +cab =
> +0
> +
> +rv_index =
> +0
> +
> +code_block_mode =
> +0
> +
> +op_flags =
> +RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP
> +
> +expected_status =
> +OK
> diff --git a/app/test-bbdev/test_vectors/ldpc_enc_tb.data b/app/test-
> bbdev/test_vectors/ldpc_enc_tb.data
> new file mode 100644
> index 0000000000..0161c06f0d
> --- /dev/null
> +++ b/app/test-bbdev/test_vectors/ldpc_enc_tb.data
> @@ -0,0 +1,95 @@
> +# SPDX-License-Identifier: BSD-3-Clause # Copyright 2021 NXP
> +
> +op_type =
> +RTE_BBDEV_OP_LDPC_ENC
> +
> +input0 =
> +0xd0dd44b2, 0xe91d434b, 0x17b23d65, 0xb8abd7c1, 0x12d7d41c,
> 0xce2686c2,
> +0x402c1efa, 0xc9151fcc, 0xe00effad, 0xc964d36a, 0xe70e39e3, 0xd86577a2,
> +0x77e04ae3, 0x9dfd60b9, 0xbf43376f, 0x09841e69, 0x53a02679,
> 0x898c65d0,
> +0x17434cf8, 0x9a3abfe2, 0x05e767ac, 0x902d6156, 0x716046a1,
> 0x636fc345,
> +0xf15b483e, 0x910e40e4, 0x5d32b9a2, 0x8e9514b0, 0x7a218bb8,
> 0x7665aac3,
> +0x33a5b20c, 0x8ba7b5e3, 0x220262e0, 0x7b654c15, 0xa69f1855,
> 0x6dcf61e3,
> +0x0036c1aa, 0x7ea806e3, 0x3f9b2ef1, 0x386cdd36, 0xf94ae7e4,
> 0xf707e376,
> +0xb9c90f7b, 0x40bdd41f, 0x03cf6ae8, 0xfbd5b550, 0x03d90ae6,
> 0x65a6cf09,
> +0xa3d70588, 0x26343d97, 0x464981b1, 0xd79f8b30, 0xa554bb7e,
> 0x524d3a2c,
> +0x2f75d78c, 0x3148c8d8, 0xd4cccf4d, 0xc98df39c, 0x7f4fdb2a, 0x831c5ccd,
> +0xbe46bd67, 0xa9bf0a6b, 0xa726bdcc, 0xd590425d, 0xa792805b,
> 0xe4b0518a,
> +0x18c4bcca, 0xf3891686, 0x3cdee43e, 0xd526e3a9, 0x8112aec6,
> 0x811151f4,
> +0x9763de36, 0x56e50307, 0xa7313051, 0xc40db40a, 0x1931fa6e,
> 0x5701947d,
> +0x098ee810, 0x01cec402, 0x804668f1, 0xc00c41da, 0x02432f4d,
> 0x072c9643,
> +0xf23088cc, 0x74620646, 0x281f8a80, 0x2c7a2aa6, 0xfe8c2f88, 0xe0100f94,
> +0x9c402559, 0x48f5c34d, 0x59a3b023, 0x2427f7e0, 0xb2f30717,
> 0x9bf140a6,
> +0x3fa4710b, 0xb493a4a2, 0xb16e6135, 0xd75f0e8e, 0xe7ff6b4a,
> 0x43d9e122,
> +0xafc5d306, 0xec88d05e, 0xabfc996a, 0x29644a44, 0xa0c5c9fa, 0xf5836a0b,
> +0xd2a97513, 0x6986e115, 0x5581b429, 0xd6f8e599, 0x035a2d9a,
> 0xe0835100,
> +0x561d04c5, 0x565f647a, 0xff711c76, 0x6b6fcd71, 0xb08518ac,
> 0xad407897,
> +0x6de25115, 0x8e8fd5f1, 0x67196a81, 0xb6ef576b, 0x5e170674,
> 0x3cd78132,
> +0x0be74b19, 0x84f30e7b, 0x85aa98b6, 0xcfe08810, 0xaa438ec3,
> 0xe95c3900,
> +0xafb0c225, 0xbe52bde2, 0xd6dcfec6, 0xccde045b, 0x4fd00da2,
> 0x30c377b7,
> +0x771fdf0b, 0xea5f9282, 0x838dc0bf, 0x3250d0a9, 0xf2190c4d,
> 0x5ec14787,
> +0x32c2d755, 0xe3b9f56c, 0xfb34945e, 0x642dc6c3, 0x8fb96e69,
> 0x612afce6,
> +0x17eb0530, 0x2fa9637c, 0xef1068a6, 0x456c8bcd, 0x65b16eb9,
> 0xf97d8e92,
> +0x7b1a46
> +
> +output0 =
> +0x4eda9982, 0x101c74c9, 0x8b63a987, 0x34464588, 0xe27e0cf2,
> 0x048dd503,
> +0x6391521b, 0x59f71f1a, 0x22eeb556, 0x96d43907, 0x69a01acf,
> 0x3e6a4cb4,
> +0x7eca9c20, 0x2c3eb162, 0x965294d5, 0x25722e4e, 0x7d42c4d1,
> 0x8489d0bf,
> +0x49c2a83d, 0xa48a3fa4, 0x6ccd783a, 0xd941b110, 0xa937e9e4,
> 0xc0a45188,
> +0xd41b1840, 0x8bf35901, 0x769496e4, 0x91bb2778, 0x7ad8b944,
> 0xd19208ad,
> +0x8b519356, 0x7b6e1772, 0x30982890, 0x1e183f8a, 0xde7b9c46,
> 0x2ca7c2ce,
> +0xb9b6e1d7, 0x68a3c466, 0x1ecda75d, 0xb462b570, 0x2a2a5896,
> 0xaf6891b1,
> +0xd4bf3ba3, 0x82969dfa, 0xd0f563fb, 0xb81ff540, 0x7a0b3485, 0x4f6fd016,
> +0x7741a613, 0x3f763d0e, 0x7f76a0dc, 0x37f25c1c, 0xf3412fe1, 0x2a75dc51,
> +0x04827bef, 0xe5a662fd, 0xa07225f5, 0xbc9117a9, 0x55dbc54c,
> 0xd9446c00,
> +0xa8d26de1, 0xa293979e, 0x1ece1b94, 0xa5dd28cb, 0x13d2655e,
> 0xa0e4ab01,
> +0x903c5a2c, 0x58674b7e, 0x0e1c244b, 0xa9e0d342, 0x45fc615f,
> 0x2971f02a,
> +0x116c4e06, 0xf1d97697, 0x64b0a44f, 0xf21b9207, 0x32ddde4e,
> 0x4df48b05,
> +0xf0e80c2b, 0x27a14701, 0x670407a7, 0x0ffd24cd, 0x07432145, 0xfff8c98f,
> +0x567dacd5, 0xef793abb, 0x29f2c205, 0x6605a7cd, 0xf1978e96,
> 0x73ef3ef6,
> +0x336173ff, 0xaab9b459, 0xb3f4b89c, 0xf1e50d40, 0x76c3fb75,
> 0xc086001b,
> +0x1cdadd3b, 0x0ed448a8, 0x53f9a461, 0x5a318eb9, 0x98d96ab4,
> 0xb796ead8,
> +0x6c4ffee6, 0xf5089709, 0x9d3f7c5d, 0x759e5b2c, 0x1ba452ef,
> 0xe397683a,
> +0x38937d85, 0x6467fa0a, 0x3e3d85a9, 0x2be700cc, 0xb51171ff,
> 0x27c369b4,
> +0xb91a6bbe, 0x84043906, 0x2639088d, 0x6c0f43f7, 0x1bdf6c89,
> 0xf294392a,
> +0xf3c7ba93, 0xe9de466a, 0xd234e9a3, 0x94374868, 0xe644c601,
> 0xe8d30610,
> +0xc36d3cf7, 0x239d4e49, 0x61a052ee, 0x333ac761, 0x9b372829,
> 0xf2cce000,
> +0x0a649c42, 0x6f20a68f, 0xc6c43664, 0x559c2c5c, 0xb1d7575e,
> 0xe840adfe,
> +0x16bc5314, 0x5f076f74, 0x4a5b208b, 0xceca2331, 0x2f93e7a4,
> 0x82dc83c1,
> +0x7ebccf3d, 0x98e4ca42, 0x6e831fa1, 0x7fe5e47d, 0xc89e7e40,
> 0x6b169129,
> +0xe27b1cb7, 0xf5c4d614, 0xd3ccb7e8, 0x76a89ed6, 0x2cf00fc5,
> 0x76a1e27a,
> +0x92a253b5, 0x7c04dbea, 0x4903867d, 0x52a21dd6, 0x7329e699,
> 0xbb63a3f1,
> +0x3425fd9d, 0xa02989ca, 0x2811932e, 0x72a3bf2f, 0xfa37e1ec,
> 0xa7784122,
> +0xa21955d1, 0xa025ba90, 0x6ef13dcc, 0xbaf9c79f, 0x1a6f9ce7,
> 0x0d57bda5,
> +0x9caf0dc7, 0x352a0e64, 0x598cfdc7, 0x8208cf39, 0x90fa0a87, 0xd2dcd4f9,
> +0xfc54fc60, 0x57ed5faa, 0x73153bc4, 0xf7e39009, 0x3021d00b, 0x4d0f0afb,
> +0xd77a18ee, 0xa8e7
> +
> +basegraph=
> +2
> +
> +z_c=
> +256
> +
> +n_cb=
> +12800
> +
> +q_m=
> +2
> +
> +n_filler=
> +16
> +
> +ea =
> +3000
> +
> +eb =
> +3000
> +
> +c =
> +2
> +
> +r =
> +0
> +
> +cab =
> +0
> +
> +rv_index =
> +0
> +
> +code_block_mode =
> +0
> +
> +op_flags =
> +RTE_BBDEV_LDPC_CRC_24B_ATTACH
> +
> +expected_status =
> +OK
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v7 8/9] app/bbdev: handle endianness of test data
  2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 8/9] app/bbdev: handle endianness of test data nipun.gupta
@ 2021-10-04 23:38     ` Chautru, Nicolas
  0 siblings, 0 replies; 157+ messages in thread
From: Chautru, Nicolas @ 2021-10-04 23:38 UTC (permalink / raw)
  To: nipun.gupta, dev, gakhil; +Cc: david.marchand, hemant.agrawal



> -----Original Message-----
> From: nipun.gupta@nxp.com <nipun.gupta@nxp.com>
> Sent: Tuesday, September 28, 2021 1:30 AM
> To: dev@dpdk.org; gakhil@marvell.com; Chautru, Nicolas
> <nicolas.chautru@intel.com>
> Cc: david.marchand@redhat.com; hemant.agrawal@nxp.com; Nipun Gupta
> <nipun.gupta@nxp.com>
> Subject: [PATCH v7 8/9] app/bbdev: handle endianness of test data
> 
> From: Nipun Gupta <nipun.gupta@nxp.com>
> 
> With data input, output and harq also supported in big endian format, this
> patch updates the testbbdev application to handle the endianness
> conversion as directed by the the driver being used.
> 
> If the driver supports big endian data processing, conversion from little
> endian to big is handled by the testbbdev application.
> 
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---
>  app/test-bbdev/test_bbdev_perf.c | 62
> ++++++++++++++++++++++++++++++++
>  1 file changed, 62 insertions(+)
> 
> diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-
> bbdev/test_bbdev_perf.c
> index 469597b8b3..a0f565ee3f 100644
> --- a/app/test-bbdev/test_bbdev_perf.c
> +++ b/app/test-bbdev/test_bbdev_perf.c
> @@ -227,6 +227,64 @@ clear_soft_out_cap(uint32_t *op_flags)
>  	*op_flags &= ~RTE_BBDEV_TURBO_NEG_LLR_1_BIT_SOFT_OUT;
>  }
> 
> +static inline void
> +reverse_op(struct op_data_entries *op)

Please refer explicitly to byte endianness in that function name + comment

> +{
> +	uint8_t nb_segs = op->nb_segments;
> +	uint32_t *data, len;
> +	int complete, rem, i, j;
> +	uint8_t *rem_data, temp;
> +
> +	/* Validate each mbuf segment length */
	
Unsure the comment is correct. The code is inverting the byte endianness for all segments of the mbuf. 

> +	for (i = 0; i < nb_segs; ++i) {
> +		len = op->segments[i].length;
> +		data = op->segments[i].addr;
> +
> +		/* Swap complete u32 bytes */
> +		complete = len / 4;
> +		for (j = 0; j < complete; j++)
> +			data[j] = rte_bswap32(data[j]);
> +
> +		/* Swap any remaining data for last seg */
> +		if (i == (nb_segs - 1)) {
> +			rem = len % 4;
> +			rem_data = (uint8_t *)&data[j];
> +			for (j = 0; j < rem/2; j++) {
> +				temp = rem_data[j];
> +				rem_data[j] = rem_data[rem - j - 1];
> +				rem_data[rem - j - 1] = temp;
> +			}
> +		}
> +	}
> +}
> +
> +static inline void
> +reverse_all_ops(void)

Same comment as above, refer explicitly to byte endianness

> +{
> +	unsigned int nb_inputs, nb_soft_outputs, nb_hard_outputs,
> +		nb_harq_inputs, nb_harq_outputs;
> +
> +	nb_inputs = test_vector.entries[DATA_INPUT].nb_segments;
> +	if (nb_inputs)
> +		reverse_op(&test_vector.entries[DATA_INPUT]);
> +
> +	nb_soft_outputs =
> test_vector.entries[DATA_SOFT_OUTPUT].nb_segments;
> +	if (nb_soft_outputs)
> +		reverse_op(&test_vector.entries[DATA_SOFT_OUTPUT]);
> +
> +	nb_hard_outputs =
> test_vector.entries[DATA_HARD_OUTPUT].nb_segments;
> +	if (nb_hard_outputs)
> +		reverse_op(&test_vector.entries[DATA_HARD_OUTPUT]);
> +
> +	nb_harq_inputs  =
> test_vector.entries[DATA_HARQ_INPUT].nb_segments;
> +	if (nb_harq_inputs)
> +		reverse_op(&test_vector.entries[DATA_HARQ_INPUT]);
> +
> +	nb_harq_outputs =
> test_vector.entries[DATA_HARQ_OUTPUT].nb_segments;
> +	if (nb_harq_outputs)
> +		reverse_op(&test_vector.entries[DATA_HARQ_OUTPUT]);


Any reason not to use a for loop through all the enums of these 5 data types
Ie. 
enum op_data_type {
	DATA_INPUT = 0,
	DATA_SOFT_OUTPUT,
	DATA_HARD_OUTPUT,
	DATA_HARQ_INPUT,
	DATA_HARQ_OUTPUT,
	DATA_NUM_TYPES,
};

> +}
> +
>  static int
>  check_dev_cap(const struct rte_bbdev_info *dev_info)  { @@ -234,6 +292,7
> @@ check_dev_cap(const struct rte_bbdev_info *dev_info)
>  	unsigned int nb_inputs, nb_soft_outputs, nb_hard_outputs,
>  		nb_harq_inputs, nb_harq_outputs;
>  	const struct rte_bbdev_op_cap *op_cap = dev_info->drv.capabilities;
> +	uint8_t be_data = dev_info->drv.support_be_data;
> 
>  	nb_inputs = test_vector.entries[DATA_INPUT].nb_segments;
>  	nb_soft_outputs =
> test_vector.entries[DATA_SOFT_OUTPUT].nb_segments;
> @@ -245,6 +304,9 @@ check_dev_cap(const struct rte_bbdev_info
> *dev_info)
>  		if (op_cap->type != test_vector.op_type)
>  			continue;
> 
> +		if (be_data)
> +			reverse_all_ops();
> +
>  		if (op_cap->type == RTE_BBDEV_OP_TURBO_DEC) {
>  			const struct rte_bbdev_op_cap_turbo_dec *cap =
>  					&op_cap->cap.turbo_dec;
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v8 0/8]  baseband: add NXP LA12xx driver
  2021-03-18  6:34 [dpdk-dev] [PATCH 1/6] baseband: introduce NXP LA12xx driver Hemant Agrawal
                   ` (9 preceding siblings ...)
  2021-09-28  8:29 ` [dpdk-dev] [PATCH v7 0/9] baseband: add NXP LA12xx driver nipun.gupta
@ 2021-10-06 11:31 ` nipun.gupta
  2021-10-06 11:31   ` [dpdk-dev] [PATCH v8 1/8] bbdev: add big endian processing data processing info nipun.gupta
                     ` (7 more replies)
  2021-10-07  9:33 ` [dpdk-dev] [PATCH v9 0/8] baseband: add NXP LA12xx driver nipun.gupta
                   ` (2 subsequent siblings)
  13 siblings, 8 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-06 11:31 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal

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

This series introduces the BBDEV LA12xx poll mode driver (PMD) to support
an implementation for offloading High Phy processing functions like
LDPC Encode / Decode 5GNR wireless acceleration function, using PCI based
LA12xx Software defined radio.

Please check the documentation patch for more info.

The driver currently implements basic feature to offload only the 5G LDPC
encode/decode.

A new capability has been added to check if the driver can support the
input data in network byte order. Two test vectors are also added as an
example with input data in network byte.

v2: add test case changes
v3: fix 32 bit compilation
v4: capability for network byte order, doc patch merged inline.
v5: add llr_size and llr_decimals, removed LLR compression flag,
    update testbbdev to handle endianness, rebased on top of 20.08
v6: added BE as device info instead of capability, updated test
    to have 2 codeblocks
v7: fixed checkpatch errors
v8: remove additional test vectors, update reverse_op function name,
    make be_support param as bool, other minor changes in la12xx driver

Hemant Agrawal (6):
  baseband: introduce NXP LA12xx driver
  baseband/la12xx: add devargs for max queues
  baseband/la12xx: add support for multiple modems
  baseband/la12xx: add queue and modem config support
  baseband/la12xx: add enqueue and dequeue support
  app/bbdev: enable la12xx for bbdev

Nipun Gupta (2):
  bbdev: add big endian processing data processing info
  app/bbdev: handle endianness of test data

 MAINTAINERS                                   |   10 +
 app/test-bbdev/meson.build                    |    3 +
 app/test-bbdev/test_bbdev_perf.c              |   43 +
 doc/guides/bbdevs/features/la12xx.ini         |   13 +
 doc/guides/bbdevs/index.rst                   |    1 +
 doc/guides/bbdevs/la12xx.rst                  |  124 ++
 doc/guides/rel_notes/release_21_11.rst        |    5 +
 drivers/baseband/la12xx/bbdev_la12xx.c        | 1100 +++++++++++++++++
 drivers/baseband/la12xx/bbdev_la12xx.h        |   51 +
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h    |  244 ++++
 .../baseband/la12xx/bbdev_la12xx_pmd_logs.h   |   28 +
 drivers/baseband/la12xx/meson.build           |    6 +
 drivers/baseband/la12xx/version.map           |    3 +
 drivers/baseband/meson.build                  |    1 +
 lib/bbdev/rte_bbdev.h                         |    2 +
 15 files changed, 1634 insertions(+)
 create mode 100644 doc/guides/bbdevs/features/la12xx.ini
 create mode 100644 doc/guides/bbdevs/la12xx.rst
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.c
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_ipc.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
 create mode 100644 drivers/baseband/la12xx/meson.build
 create mode 100644 drivers/baseband/la12xx/version.map

-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v8 1/8] bbdev: add big endian processing data processing info
  2021-10-06 11:31 ` [dpdk-dev] [PATCH v8 0/8] baseband: add NXP LA12xx driver nipun.gupta
@ 2021-10-06 11:31   ` nipun.gupta
  2021-10-06 21:02     ` Chautru, Nicolas
  2021-10-06 11:31   ` [dpdk-dev] [PATCH v8 2/8] baseband: introduce NXP LA12xx driver nipun.gupta
                     ` (6 subsequent siblings)
  7 siblings, 1 reply; 157+ messages in thread
From: nipun.gupta @ 2021-10-06 11:31 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

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

This patch introduces a new info pertaining to bbdev device
to process the data in big endian order.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 lib/bbdev/rte_bbdev.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/bbdev/rte_bbdev.h b/lib/bbdev/rte_bbdev.h
index 3ebf62e697..9b9f9d0be6 100644
--- a/lib/bbdev/rte_bbdev.h
+++ b/lib/bbdev/rte_bbdev.h
@@ -309,6 +309,8 @@ struct rte_bbdev_driver_info {
 	uint16_t min_alignment;
 	/** HARQ memory available in kB */
 	uint32_t harq_buffer_size;
+	/** Device support input, output and HARQ data as big-endian */
+	bool support_be_data;
 	/** Default queue configuration used if none is supplied  */
 	struct rte_bbdev_queue_conf default_queue_conf;
 	/** Device operation capabilities */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v8 2/8] baseband: introduce NXP LA12xx driver
  2021-10-06 11:31 ` [dpdk-dev] [PATCH v8 0/8] baseband: add NXP LA12xx driver nipun.gupta
  2021-10-06 11:31   ` [dpdk-dev] [PATCH v8 1/8] bbdev: add big endian processing data processing info nipun.gupta
@ 2021-10-06 11:31   ` nipun.gupta
  2021-10-06 11:31   ` [dpdk-dev] [PATCH v8 3/8] baseband/la12xx: add devargs for max queues nipun.gupta
                     ` (5 subsequent siblings)
  7 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-06 11:31 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This patch introduce the baseband device drivers for NXP's
LA1200 series software defined baseband modem.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 MAINTAINERS                                   |   9 ++
 drivers/baseband/la12xx/bbdev_la12xx.c        | 108 ++++++++++++++++++
 .../baseband/la12xx/bbdev_la12xx_pmd_logs.h   |  28 +++++
 drivers/baseband/la12xx/meson.build           |   6 +
 drivers/baseband/la12xx/version.map           |   3 +
 drivers/baseband/meson.build                  |   1 +
 6 files changed, 155 insertions(+)
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.c
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
 create mode 100644 drivers/baseband/la12xx/meson.build
 create mode 100644 drivers/baseband/la12xx/version.map

diff --git a/MAINTAINERS b/MAINTAINERS
index 278e5b3226..25eec751bb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1289,6 +1289,15 @@ F: drivers/event/opdl/
 F: doc/guides/eventdevs/opdl.rst
 
 
+Baseband Drivers
+----------------
+
+NXP LA12xx driver
+M: Nipun Gupta <nipun.gupta@nxp.com>
+M: Hemant Agrawal <hemant.agrawal@nxp.com>
+F: drivers/baseband/la12xx/
+
+
 Rawdev Drivers
 --------------
 
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
new file mode 100644
index 0000000000..d3d7a4df37
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -0,0 +1,108 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+
+#include <string.h>
+
+#include <rte_common.h>
+#include <rte_bus_vdev.h>
+#include <rte_malloc.h>
+#include <rte_ring.h>
+#include <rte_kvargs.h>
+
+#include <rte_bbdev.h>
+#include <rte_bbdev_pmd.h>
+
+#include <bbdev_la12xx_pmd_logs.h>
+
+#define DRIVER_NAME baseband_la12xx
+
+/* private data structure */
+struct bbdev_la12xx_private {
+	unsigned int max_nb_queues;  /**< Max number of queues */
+};
+/* Create device */
+static int
+la12xx_bbdev_create(struct rte_vdev_device *vdev)
+{
+	struct rte_bbdev *bbdev;
+	const char *name = rte_vdev_device_name(vdev);
+
+	PMD_INIT_FUNC_TRACE();
+
+	bbdev = rte_bbdev_allocate(name);
+	if (bbdev == NULL)
+		return -ENODEV;
+
+	bbdev->data->dev_private = rte_zmalloc(name,
+			sizeof(struct bbdev_la12xx_private),
+			RTE_CACHE_LINE_SIZE);
+	if (bbdev->data->dev_private == NULL) {
+		rte_bbdev_release(bbdev);
+		return -ENOMEM;
+	}
+
+	bbdev->dev_ops = NULL;
+	bbdev->device = &vdev->device;
+	bbdev->data->socket_id = 0;
+	bbdev->intr_handle = NULL;
+
+	/* register rx/tx burst functions for data path */
+	bbdev->dequeue_enc_ops = NULL;
+	bbdev->dequeue_dec_ops = NULL;
+	bbdev->enqueue_enc_ops = NULL;
+	bbdev->enqueue_dec_ops = NULL;
+
+	return 0;
+}
+
+/* Initialise device */
+static int
+la12xx_bbdev_probe(struct rte_vdev_device *vdev)
+{
+	const char *name;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (vdev == NULL)
+		return -EINVAL;
+
+	name = rte_vdev_device_name(vdev);
+	if (name == NULL)
+		return -EINVAL;
+
+	return la12xx_bbdev_create(vdev);
+}
+
+/* Uninitialise device */
+static int
+la12xx_bbdev_remove(struct rte_vdev_device *vdev)
+{
+	struct rte_bbdev *bbdev;
+	const char *name;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (vdev == NULL)
+		return -EINVAL;
+
+	name = rte_vdev_device_name(vdev);
+	if (name == NULL)
+		return -EINVAL;
+
+	bbdev = rte_bbdev_get_named_dev(name);
+	if (bbdev == NULL)
+		return -EINVAL;
+
+	rte_free(bbdev->data->dev_private);
+
+	return rte_bbdev_release(bbdev);
+}
+
+static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
+	.probe = la12xx_bbdev_probe,
+	.remove = la12xx_bbdev_remove
+};
+
+RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
+RTE_LOG_REGISTER_DEFAULT(bbdev_la12xx_logtype, NOTICE);
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h b/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
new file mode 100644
index 0000000000..452435ccb9
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020 NXP
+ */
+
+#ifndef _BBDEV_LA12XX_PMD_LOGS_H_
+#define _BBDEV_LA12XX_PMD_LOGS_H_
+
+extern int bbdev_la12xx_logtype;
+
+#define rte_bbdev_log(level, fmt, ...) \
+	rte_log(RTE_LOG_ ## level, bbdev_la12xx_logtype, fmt "\n", \
+		##__VA_ARGS__)
+
+#ifdef RTE_LIBRTE_BBDEV_DEBUG
+#define rte_bbdev_log_debug(fmt, ...) \
+		rte_bbdev_log(DEBUG, "la12xx_pmd: " fmt, \
+		##__VA_ARGS__)
+#else
+#define rte_bbdev_log_debug(fmt, ...)
+#endif
+
+#define PMD_INIT_FUNC_TRACE() rte_bbdev_log_debug(">>")
+
+/* DP Logs, toggled out at compile time if level lower than current level */
+#define rte_bbdev_dp_log(level, fmt, args...) \
+	RTE_LOG_DP(level, PMD, fmt, ## args)
+
+#endif /* _BBDEV_LA12XX_PMD_LOGS_H_ */
diff --git a/drivers/baseband/la12xx/meson.build b/drivers/baseband/la12xx/meson.build
new file mode 100644
index 0000000000..7a017dcffa
--- /dev/null
+++ b/drivers/baseband/la12xx/meson.build
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020-2021 NXP
+
+deps += ['bbdev', 'bus_vdev', 'ring']
+
+sources = files('bbdev_la12xx.c')
diff --git a/drivers/baseband/la12xx/version.map b/drivers/baseband/la12xx/version.map
new file mode 100644
index 0000000000..4a76d1d52d
--- /dev/null
+++ b/drivers/baseband/la12xx/version.map
@@ -0,0 +1,3 @@
+DPDK_21 {
+	local: *;
+};
diff --git a/drivers/baseband/meson.build b/drivers/baseband/meson.build
index 5ee61d5323..ccd1eebc3b 100644
--- a/drivers/baseband/meson.build
+++ b/drivers/baseband/meson.build
@@ -11,6 +11,7 @@ drivers = [
         'fpga_lte_fec',
         'null',
         'turbo_sw',
+        'la12xx',
 ]
 
 log_prefix = 'pmd.bb'
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v8 3/8] baseband/la12xx: add devargs for max queues
  2021-10-06 11:31 ` [dpdk-dev] [PATCH v8 0/8] baseband: add NXP LA12xx driver nipun.gupta
  2021-10-06 11:31   ` [dpdk-dev] [PATCH v8 1/8] bbdev: add big endian processing data processing info nipun.gupta
  2021-10-06 11:31   ` [dpdk-dev] [PATCH v8 2/8] baseband: introduce NXP LA12xx driver nipun.gupta
@ 2021-10-06 11:31   ` nipun.gupta
  2021-10-06 11:31   ` [dpdk-dev] [PATCH v8 4/8] baseband/la12xx: add support for multiple modems nipun.gupta
                     ` (4 subsequent siblings)
  7 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-06 11:31 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This patch adds dev args to take  max queues as input

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c | 73 +++++++++++++++++++++++++-
 1 file changed, 71 insertions(+), 2 deletions(-)

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index d3d7a4df37..f5c835eeb8 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -17,13 +17,73 @@
 
 #define DRIVER_NAME baseband_la12xx
 
+/*  Initialisation params structure that can be used by LA12xx BBDEV driver */
+struct bbdev_la12xx_params {
+	uint8_t queues_num; /*< LA12xx BBDEV queues number */
+};
+
+#define LA12XX_MAX_NB_QUEUES_ARG	"max_nb_queues"
+
+static const char * const bbdev_la12xx_valid_params[] = {
+	LA12XX_MAX_NB_QUEUES_ARG,
+};
+
 /* private data structure */
 struct bbdev_la12xx_private {
 	unsigned int max_nb_queues;  /**< Max number of queues */
 };
+static inline int
+parse_u16_arg(const char *key, const char *value, void *extra_args)
+{
+	uint16_t *u16 = extra_args;
+
+	uint64_t result;
+	if ((value == NULL) || (extra_args == NULL))
+		return -EINVAL;
+	errno = 0;
+	result = strtoul(value, NULL, 0);
+	if ((result >= (1 << 16)) || (errno != 0)) {
+		rte_bbdev_log(ERR, "Invalid value %" PRIu64 " for %s",
+			      result, key);
+		return -ERANGE;
+	}
+	*u16 = (uint16_t)result;
+	return 0;
+}
+
+/* Parse parameters used to create device */
+static int
+parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
+		const char *input_args)
+{
+	struct rte_kvargs *kvlist = NULL;
+	int ret = 0;
+
+	if (params == NULL)
+		return -EINVAL;
+	if (input_args) {
+		kvlist = rte_kvargs_parse(input_args,
+				bbdev_la12xx_valid_params);
+		if (kvlist == NULL)
+			return -EFAULT;
+
+		ret = rte_kvargs_process(kvlist, bbdev_la12xx_valid_params[0],
+					&parse_u16_arg, &params->queues_num);
+		if (ret < 0)
+			goto exit;
+
+	}
+
+exit:
+	if (kvlist)
+		rte_kvargs_free(kvlist);
+	return ret;
+}
+
 /* Create device */
 static int
-la12xx_bbdev_create(struct rte_vdev_device *vdev)
+la12xx_bbdev_create(struct rte_vdev_device *vdev,
+		struct bbdev_la12xx_params *init_params __rte_unused)
 {
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
@@ -60,7 +120,11 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev)
 static int
 la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 {
+	struct bbdev_la12xx_params init_params = {
+		8
+	};
 	const char *name;
+	const char *input_args;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -71,7 +135,10 @@ la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 	if (name == NULL)
 		return -EINVAL;
 
-	return la12xx_bbdev_create(vdev);
+	input_args = rte_vdev_device_args(vdev);
+	parse_bbdev_la12xx_params(&init_params, input_args);
+
+	return la12xx_bbdev_create(vdev, &init_params);
 }
 
 /* Uninitialise device */
@@ -105,4 +172,6 @@ static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
 };
 
 RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
+RTE_PMD_REGISTER_PARAM_STRING(DRIVER_NAME,
+	LA12XX_MAX_NB_QUEUES_ARG"=<int>");
 RTE_LOG_REGISTER_DEFAULT(bbdev_la12xx_logtype, NOTICE);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v8 4/8] baseband/la12xx: add support for multiple modems
  2021-10-06 11:31 ` [dpdk-dev] [PATCH v8 0/8] baseband: add NXP LA12xx driver nipun.gupta
                     ` (2 preceding siblings ...)
  2021-10-06 11:31   ` [dpdk-dev] [PATCH v8 3/8] baseband/la12xx: add devargs for max queues nipun.gupta
@ 2021-10-06 11:31   ` nipun.gupta
  2021-10-06 11:31   ` [dpdk-dev] [PATCH v8 5/8] baseband/la12xx: add queue and modem config support nipun.gupta
                     ` (3 subsequent siblings)
  7 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-06 11:31 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This patch add support for multiple modems by assigning
a modem id as dev args in vdev creation.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c     | 64 +++++++++++++++++++---
 drivers/baseband/la12xx/bbdev_la12xx.h     | 56 +++++++++++++++++++
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 20 +++++++
 3 files changed, 133 insertions(+), 7 deletions(-)
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_ipc.h

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index f5c835eeb8..58defa54f0 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -14,24 +14,26 @@
 #include <rte_bbdev_pmd.h>
 
 #include <bbdev_la12xx_pmd_logs.h>
+#include <bbdev_la12xx_ipc.h>
+#include <bbdev_la12xx.h>
 
 #define DRIVER_NAME baseband_la12xx
 
 /*  Initialisation params structure that can be used by LA12xx BBDEV driver */
 struct bbdev_la12xx_params {
 	uint8_t queues_num; /*< LA12xx BBDEV queues number */
+	int8_t modem_id; /*< LA12xx modem instance id */
 };
 
 #define LA12XX_MAX_NB_QUEUES_ARG	"max_nb_queues"
+#define LA12XX_VDEV_MODEM_ID_ARG	"modem"
+#define LA12XX_MAX_MODEM 4
 
 static const char * const bbdev_la12xx_valid_params[] = {
 	LA12XX_MAX_NB_QUEUES_ARG,
+	LA12XX_VDEV_MODEM_ID_ARG,
 };
 
-/* private data structure */
-struct bbdev_la12xx_private {
-	unsigned int max_nb_queues;  /**< Max number of queues */
-};
 static inline int
 parse_u16_arg(const char *key, const char *value, void *extra_args)
 {
@@ -51,6 +53,28 @@ parse_u16_arg(const char *key, const char *value, void *extra_args)
 	return 0;
 }
 
+/* Parse integer from integer argument */
+static int
+parse_integer_arg(const char *key __rte_unused,
+		const char *value, void *extra_args)
+{
+	int i;
+	char *end;
+
+	errno = 0;
+
+	i = strtol(value, &end, 10);
+	if (*end != 0 || errno != 0 || i < 0 || i > LA12XX_MAX_MODEM) {
+		rte_bbdev_log(ERR, "Supported Port IDS are 0 to %d",
+			LA12XX_MAX_MODEM - 1);
+		return -EINVAL;
+	}
+
+	*((uint32_t *)extra_args) = i;
+
+	return 0;
+}
+
 /* Parse parameters used to create device */
 static int
 parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
@@ -72,6 +96,16 @@ parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
 		if (ret < 0)
 			goto exit;
 
+		ret = rte_kvargs_process(kvlist,
+					bbdev_la12xx_valid_params[1],
+					&parse_integer_arg,
+					&params->modem_id);
+
+		if (params->modem_id >= LA12XX_MAX_MODEM) {
+			rte_bbdev_log(ERR, "Invalid modem id, must be < %u",
+					LA12XX_MAX_MODEM);
+			goto exit;
+		}
 	}
 
 exit:
@@ -83,10 +117,11 @@ parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
 /* Create device */
 static int
 la12xx_bbdev_create(struct rte_vdev_device *vdev,
-		struct bbdev_la12xx_params *init_params __rte_unused)
+		struct bbdev_la12xx_params *init_params)
 {
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
+	struct bbdev_la12xx_private *priv;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -102,6 +137,20 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 		return -ENOMEM;
 	}
 
+	priv = bbdev->data->dev_private;
+	priv->modem_id = init_params->modem_id;
+	/* if modem id is not configured */
+	if (priv->modem_id == -1)
+		priv->modem_id = bbdev->data->dev_id;
+
+	/* Reset Global variables */
+	priv->num_ldpc_enc_queues = 0;
+	priv->num_ldpc_dec_queues = 0;
+	priv->num_valid_queues = 0;
+	priv->max_nb_queues = init_params->queues_num;
+
+	rte_bbdev_log(INFO, "Setting Up %s: DevId=%d, ModemId=%d",
+				name, bbdev->data->dev_id, priv->modem_id);
 	bbdev->dev_ops = NULL;
 	bbdev->device = &vdev->device;
 	bbdev->data->socket_id = 0;
@@ -121,7 +170,7 @@ static int
 la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 {
 	struct bbdev_la12xx_params init_params = {
-		8
+		8, -1,
 	};
 	const char *name;
 	const char *input_args;
@@ -173,5 +222,6 @@ static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
 
 RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
 RTE_PMD_REGISTER_PARAM_STRING(DRIVER_NAME,
-	LA12XX_MAX_NB_QUEUES_ARG"=<int>");
+	LA12XX_MAX_NB_QUEUES_ARG"=<int>"
+	LA12XX_VDEV_MODEM_ID_ARG "=<int> ");
 RTE_LOG_REGISTER_DEFAULT(bbdev_la12xx_logtype, NOTICE);
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.h b/drivers/baseband/la12xx/bbdev_la12xx.h
new file mode 100644
index 0000000000..5228502331
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx.h
@@ -0,0 +1,56 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+
+#ifndef __BBDEV_LA12XX_H__
+#define __BBDEV_LA12XX_H__
+
+#define BBDEV_IPC_ENC_OP_TYPE	1
+#define BBDEV_IPC_DEC_OP_TYPE	2
+
+#define MAX_LDPC_ENC_FECA_QUEUES	4
+#define MAX_LDPC_DEC_FECA_QUEUES	4
+
+#define MAX_CHANNEL_DEPTH 16
+/* private data structure */
+struct bbdev_la12xx_private {
+	void *ipc_priv;
+	uint8_t num_valid_queues;
+	uint8_t max_nb_queues;
+	uint8_t num_ldpc_enc_queues;
+	uint8_t num_ldpc_dec_queues;
+	int8_t modem_id;
+	struct bbdev_la12xx_q_priv *queues_priv[32];
+};
+
+struct hugepage_info {
+	void *vaddr;
+	phys_addr_t paddr;
+	size_t len;
+};
+
+struct bbdev_la12xx_q_priv {
+	struct bbdev_la12xx_private *bbdev_priv;
+	uint32_t q_id;	/**< Channel ID */
+	uint32_t feca_blk_id;	/** FECA block ID for processing */
+	uint32_t feca_blk_id_be32; /**< FECA Block ID for this queue */
+	uint8_t en_napi; /* 0: napi disabled, 1: napi enabled */
+	uint16_t queue_size;	/**< Queue depth */
+	int32_t eventfd;	/**< Event FD value */
+	enum rte_bbdev_op_type op_type; /**< Operation type */
+	uint32_t la12xx_core_id;
+		/* LA12xx core ID on which this will be scheduled */
+	struct rte_mempool *mp; /**< Pool from where buffers would be cut */
+	void *bbdev_op[MAX_CHANNEL_DEPTH];
+			/**< Stores bbdev op for each index */
+	void *msg_ch_vaddr[MAX_CHANNEL_DEPTH];
+			/**< Stores msg channel addr for modem->host */
+	uint32_t host_pi;	/**< Producer_Index for HOST->MODEM */
+	uint32_t host_ci;	/**< Consumer Index for MODEM->HOST */
+	host_ipc_params_t *host_params; /**< Host parameters */
+};
+
+#define lower_32_bits(x) ((uint32_t)((uint64_t)x))
+#define upper_32_bits(x) ((uint32_t)(((uint64_t)(x) >> 16) >> 16))
+
+#endif
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
new file mode 100644
index 0000000000..9aa5562981
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+#ifndef __BBDEV_LA12XX_IPC_H__
+#define __BBDEV_LA12XX_IPC_H__
+
+/** No. of max channel per instance */
+#define IPC_MAX_DEPTH	(16)
+
+/* This shared memory would be on the host side which have copy of some
+ * of the parameters which are also part of Shared BD ring. Read access
+ * of these parameters from the host side would not be over PCI.
+ */
+typedef struct host_ipc_params {
+	volatile uint32_t pi;
+	volatile uint32_t ci;
+	volatile uint32_t modem_ptr[IPC_MAX_DEPTH];
+} __rte_packed host_ipc_params_t;
+
+#endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v8 5/8] baseband/la12xx: add queue and modem config support
  2021-10-06 11:31 ` [dpdk-dev] [PATCH v8 0/8] baseband: add NXP LA12xx driver nipun.gupta
                     ` (3 preceding siblings ...)
  2021-10-06 11:31   ` [dpdk-dev] [PATCH v8 4/8] baseband/la12xx: add support for multiple modems nipun.gupta
@ 2021-10-06 11:31   ` nipun.gupta
  2021-10-06 11:31   ` [dpdk-dev] [PATCH v8 6/8] baseband/la12xx: add enqueue and dequeue support nipun.gupta
                     ` (2 subsequent siblings)
  7 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-06 11:31 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This patch add support for connecting with modem
and creating the ipc channel as queues with modem
for the exchange of data.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 MAINTAINERS                                |   1 +
 doc/guides/bbdevs/index.rst                |   1 +
 doc/guides/bbdevs/la12xx.rst               |  80 +++
 doc/guides/rel_notes/release_21_11.rst     |   5 +
 drivers/baseband/la12xx/bbdev_la12xx.c     | 555 ++++++++++++++++++++-
 drivers/baseband/la12xx/bbdev_la12xx.h     |  17 +-
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 189 ++++++-
 7 files changed, 835 insertions(+), 13 deletions(-)
 create mode 100644 doc/guides/bbdevs/la12xx.rst

diff --git a/MAINTAINERS b/MAINTAINERS
index 25eec751bb..7030147767 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1296,6 +1296,7 @@ NXP LA12xx driver
 M: Nipun Gupta <nipun.gupta@nxp.com>
 M: Hemant Agrawal <hemant.agrawal@nxp.com>
 F: drivers/baseband/la12xx/
+F: doc/guides/bbdevs/la12xx.rst
 
 
 Rawdev Drivers
diff --git a/doc/guides/bbdevs/index.rst b/doc/guides/bbdevs/index.rst
index 4445cbd1b0..cedd706fa6 100644
--- a/doc/guides/bbdevs/index.rst
+++ b/doc/guides/bbdevs/index.rst
@@ -14,3 +14,4 @@ Baseband Device Drivers
     fpga_lte_fec
     fpga_5gnr_fec
     acc100
+    la12xx
diff --git a/doc/guides/bbdevs/la12xx.rst b/doc/guides/bbdevs/la12xx.rst
new file mode 100644
index 0000000000..1a711ef5e3
--- /dev/null
+++ b/doc/guides/bbdevs/la12xx.rst
@@ -0,0 +1,80 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright 2021 NXP
+
+NXP LA12xx Poll Mode Driver
+=======================================
+
+The BBDEV LA12xx poll mode driver (PMD) supports an implementation for
+offloading High Phy processing functions like LDPC Encode / Decode 5GNR wireless
+acceleration function, using PCI based LA12xx Software defined radio.
+
+More information can be found at `NXP Official Website
+<https://www.nxp.com/products/processors-and-microcontrollers/arm-processors/layerscape-processors/layerscape-access-la1200-programmable-baseband-processor:LA1200>`_.
+
+Features
+--------
+
+LA12xx PMD supports the following features:
+
+- Maximum of 8 LDPC decode (UL) queues
+- Maximum of 8 LDPC encode (DL) queues
+- PCIe Gen-3 x8 Interface
+
+Installation
+------------
+
+Section 3 of the DPDK manual provides instructions on installing and compiling DPDK.
+
+DPDK requires hugepages to be configured as detailed in section 2 of the DPDK manual.
+
+Initialization
+--------------
+
+The device can be listed on the host console with:
+
+
+Use the following lspci command to get the multiple LA12xx processor ids. The
+device ID of the LA12xx baseband processor is "1c30".
+
+.. code-block:: console
+
+  sudo lspci -nn
+
+...
+0001:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device [1957:1c30] (
+rev 10)
+...
+0002:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device [1957:1c30] (
+rev 10)
+
+
+Prerequisites
+-------------
+
+Currently supported by DPDK:
+
+- NXP LA1224 BSP **1.0+**.
+- NXP LA1224 PCIe Modem card connected to ARM host.
+
+- Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup the basic DPDK environment.
+
+* Use dev arg option ``modem=0`` to identify the modem instance for a given
+  device. This is required only if more than 1 modem cards are attached to host.
+  this is optional and the default value is 0.
+  e.g. ``--vdev=baseband_la12xx,modem=0``
+
+* Use dev arg option ``max_nb_queues=x`` to specify the maximum number of queues
+  to be used for communication with offload device i.e. modem. default is 16.
+  e.g. ``--vdev=baseband_la12xx,max_nb_queues=4``
+
+Enabling logs
+-------------
+
+For enabling logs, use the following EAL parameter:
+
+.. code-block:: console
+
+   ./your_bbdev_application <EAL args> --log-level=la12xx:<level>
+
+Using ``bb.la12xx`` as log matching criteria, all Baseband PMD logs can be
+enabled which are lower than logging ``level``.
diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst
index dfc2cbdeed..1b361a46ee 100644
--- a/doc/guides/rel_notes/release_21_11.rst
+++ b/doc/guides/rel_notes/release_21_11.rst
@@ -130,6 +130,11 @@ New Features
   * Added tests to validate packets hard expiry.
   * Added tests to verify tunnel header verification in IPsec inbound.
 
+* **Added NXP LA12xx baseband PMD.**
+
+  * Added a new baseband PMD driver for NXP LA12xx Software defined radio.
+  * See the :doc:`../bbdevs/la12xx` for more details.
+
 
 Removed Items
 -------------
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 58defa54f0..0fe67ca42e 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -3,6 +3,11 @@
  */
 
 #include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <dirent.h>
 
 #include <rte_common.h>
 #include <rte_bus_vdev.h>
@@ -29,11 +34,552 @@ struct bbdev_la12xx_params {
 #define LA12XX_VDEV_MODEM_ID_ARG	"modem"
 #define LA12XX_MAX_MODEM 4
 
+#define LA12XX_MAX_CORES	4
+#define LA12XX_LDPC_ENC_CORE	0
+#define LA12XX_LDPC_DEC_CORE	1
+
+#define LA12XX_MAX_LDPC_ENC_QUEUES	4
+#define LA12XX_MAX_LDPC_DEC_QUEUES	4
+
 static const char * const bbdev_la12xx_valid_params[] = {
 	LA12XX_MAX_NB_QUEUES_ARG,
 	LA12XX_VDEV_MODEM_ID_ARG,
 };
 
+static const struct rte_bbdev_op_cap bbdev_capabilities[] = {
+	{
+		.type   = RTE_BBDEV_OP_LDPC_ENC,
+		.cap.ldpc_enc = {
+			.capability_flags =
+					RTE_BBDEV_LDPC_RATE_MATCH |
+					RTE_BBDEV_LDPC_CRC_24A_ATTACH |
+					RTE_BBDEV_LDPC_CRC_24B_ATTACH,
+			.num_buffers_src =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+			.num_buffers_dst =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+		}
+	},
+	{
+		.type   = RTE_BBDEV_OP_LDPC_DEC,
+		.cap.ldpc_dec = {
+			.capability_flags =
+				RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK |
+					RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK |
+					RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP,
+			.num_buffers_src =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+			.num_buffers_hard_out =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+			.llr_size = 8,
+			.llr_decimals = 1,
+		}
+	},
+	RTE_BBDEV_END_OF_CAPABILITIES_LIST()
+};
+
+static struct rte_bbdev_queue_conf default_queue_conf = {
+	.queue_size = MAX_CHANNEL_DEPTH,
+};
+
+/* Get device info */
+static void
+la12xx_info_get(struct rte_bbdev *dev __rte_unused,
+		struct rte_bbdev_driver_info *dev_info)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	dev_info->driver_name = RTE_STR(DRIVER_NAME);
+	dev_info->max_num_queues = LA12XX_MAX_QUEUES;
+	dev_info->queue_size_lim = MAX_CHANNEL_DEPTH;
+	dev_info->hardware_accelerated = true;
+	dev_info->max_dl_queue_priority = 0;
+	dev_info->max_ul_queue_priority = 0;
+	dev_info->support_be_data = 1;
+	dev_info->default_queue_conf = default_queue_conf;
+	dev_info->capabilities = bbdev_capabilities;
+	dev_info->cpu_flag_reqs = NULL;
+	dev_info->min_alignment = 64;
+
+	rte_bbdev_log_debug("got device info from %u", dev->data->dev_id);
+}
+
+/* Release queue */
+static int
+la12xx_queue_release(struct rte_bbdev *dev, uint16_t q_id)
+{
+	RTE_SET_USED(dev);
+	RTE_SET_USED(q_id);
+
+	PMD_INIT_FUNC_TRACE();
+
+	return 0;
+}
+
+#define HUGEPG_OFFSET(A) \
+		((uint64_t) ((unsigned long) (A) \
+		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
+
+static int ipc_queue_configure(uint32_t channel_id,
+		ipc_t instance, struct bbdev_la12xx_q_priv *q_priv)
+{
+	ipc_userspace_t *ipc_priv = (ipc_userspace_t *)instance;
+	ipc_instance_t *ipc_instance = ipc_priv->instance;
+	ipc_ch_t *ch;
+	void *vaddr;
+	uint32_t i = 0;
+	uint32_t msg_size = sizeof(struct bbdev_ipc_enqueue_op);
+
+	PMD_INIT_FUNC_TRACE();
+
+	rte_bbdev_log_debug("%x %p", ipc_instance->initialized,
+		ipc_priv->instance);
+	ch = &(ipc_instance->ch_list[channel_id]);
+
+	rte_bbdev_log_debug("channel: %u, depth: %u, msg size: %u",
+		channel_id, q_priv->queue_size, msg_size);
+
+	/* Start init of channel */
+	ch->md.ring_size = rte_cpu_to_be_32(q_priv->queue_size);
+	ch->md.pi = 0;
+	ch->md.ci = 0;
+	ch->md.msg_size = msg_size;
+	for (i = 0; i < q_priv->queue_size; i++) {
+		vaddr = rte_malloc(NULL, msg_size, RTE_CACHE_LINE_SIZE);
+		if (!vaddr)
+			return IPC_HOST_BUF_ALLOC_FAIL;
+		/* Only offset now */
+		ch->bd_h[i].modem_ptr =
+			rte_cpu_to_be_32(HUGEPG_OFFSET(vaddr));
+		ch->bd_h[i].host_virt_l = lower_32_bits(vaddr);
+		ch->bd_h[i].host_virt_h = upper_32_bits(vaddr);
+		q_priv->msg_ch_vaddr[i] = vaddr;
+		/* Not sure use of this len may be for CRC*/
+		ch->bd_h[i].len = 0;
+	}
+	ch->host_ipc_params =
+		rte_cpu_to_be_32(HUGEPG_OFFSET(q_priv->host_params));
+
+	rte_bbdev_log_debug("Channel configured");
+	return IPC_SUCCESS;
+}
+
+static int
+la12xx_e200_queue_setup(struct rte_bbdev *dev,
+		struct bbdev_la12xx_q_priv *q_priv)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	struct gul_hif *mhif;
+	ipc_metadata_t *ipc_md;
+	ipc_ch_t *ch;
+	int instance_id = 0, i;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		q_priv->la12xx_core_id = LA12XX_LDPC_ENC_CORE;
+		break;
+	case RTE_BBDEV_OP_LDPC_DEC:
+		q_priv->la12xx_core_id = LA12XX_LDPC_DEC_CORE;
+		break;
+	default:
+		rte_bbdev_log(ERR, "Unsupported op type\n");
+		return -1;
+	}
+
+	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+	/* offset is from start of PEB */
+	ipc_md = (ipc_metadata_t *)((uintptr_t)ipc_priv->peb_start.host_vaddr +
+		mhif->ipc_regs.ipc_mdata_offset);
+	ch = &ipc_md->instance_list[instance_id].ch_list[q_priv->q_id];
+
+	if (q_priv->q_id < priv->num_valid_queues) {
+		ipc_br_md_t *md = &(ch->md);
+
+		q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
+		q_priv->feca_blk_id_be32 = ch->feca_blk_id;
+		q_priv->host_pi = rte_be_to_cpu_32(md->pi);
+		q_priv->host_ci = rte_be_to_cpu_32(md->ci);
+		q_priv->host_params = (host_ipc_params_t *)(uintptr_t)
+			(rte_be_to_cpu_32(ch->host_ipc_params) +
+			((uint64_t)ipc_priv->hugepg_start.host_vaddr));
+
+		for (i = 0; i < q_priv->queue_size; i++) {
+			uint32_t h, l;
+
+			h = ch->bd_h[i].host_virt_h;
+			l = ch->bd_h[i].host_virt_l;
+			q_priv->msg_ch_vaddr[i] = (void *)join_32_bits(h, l);
+		}
+
+		rte_bbdev_log(WARNING,
+			"Queue [%d] already configured, not configuring again",
+			q_priv->q_id);
+		return 0;
+	}
+
+	rte_bbdev_log_debug("setting up queue %d", q_priv->q_id);
+
+	/* Call ipc_configure_channel */
+	ret = ipc_queue_configure(q_priv->q_id, ipc_priv, q_priv);
+	if (ret) {
+		rte_bbdev_log(ERR, "Unable to setup queue (%d) (err=%d)",
+		       q_priv->q_id, ret);
+		return ret;
+	}
+
+	/* Set queue properties for LA12xx device */
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		if (priv->num_ldpc_enc_queues >= LA12XX_MAX_LDPC_ENC_QUEUES) {
+			rte_bbdev_log(ERR,
+				"num_ldpc_enc_queues reached max value");
+			return -1;
+		}
+		ch->la12xx_core_id =
+			rte_cpu_to_be_32(LA12XX_LDPC_ENC_CORE);
+		ch->feca_blk_id = rte_cpu_to_be_32(priv->num_ldpc_enc_queues++);
+		break;
+	case RTE_BBDEV_OP_LDPC_DEC:
+		if (priv->num_ldpc_dec_queues >= LA12XX_MAX_LDPC_DEC_QUEUES) {
+			rte_bbdev_log(ERR,
+				"num_ldpc_dec_queues reached max value");
+			return -1;
+		}
+		ch->la12xx_core_id =
+			rte_cpu_to_be_32(LA12XX_LDPC_DEC_CORE);
+		ch->feca_blk_id = rte_cpu_to_be_32(priv->num_ldpc_dec_queues++);
+		break;
+	default:
+		rte_bbdev_log(ERR, "Not supported op type\n");
+		return -1;
+	}
+	ch->op_type = rte_cpu_to_be_32(q_priv->op_type);
+	ch->depth = rte_cpu_to_be_32(q_priv->queue_size);
+
+	/* Store queue config here */
+	q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
+	q_priv->feca_blk_id_be32 = ch->feca_blk_id;
+
+	return 0;
+}
+
+/* Setup a queue */
+static int
+la12xx_queue_setup(struct rte_bbdev *dev, uint16_t q_id,
+		const struct rte_bbdev_queue_conf *queue_conf)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	struct rte_bbdev_queue_data *q_data;
+	struct bbdev_la12xx_q_priv *q_priv;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* Move to setup_queues callback */
+	q_data = &dev->data->queues[q_id];
+	q_data->queue_private = rte_zmalloc(NULL,
+		sizeof(struct bbdev_la12xx_q_priv), 0);
+	if (!q_data->queue_private) {
+		rte_bbdev_log(ERR, "Memory allocation failed for qpriv");
+		return -ENOMEM;
+	}
+	q_priv = q_data->queue_private;
+	q_priv->q_id = q_id;
+	q_priv->bbdev_priv = dev->data->dev_private;
+	q_priv->queue_size = queue_conf->queue_size;
+	q_priv->op_type = queue_conf->op_type;
+
+	ret = la12xx_e200_queue_setup(dev, q_priv);
+	if (ret) {
+		rte_bbdev_log(ERR, "e200_queue_setup failed for qid: %d",
+				     q_id);
+		return ret;
+	}
+
+	/* Store queue config here */
+	priv->num_valid_queues++;
+
+	return 0;
+}
+
+static int
+la12xx_start(struct rte_bbdev *dev)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	int ready = 0;
+	struct gul_hif *hif_start;
+
+	PMD_INIT_FUNC_TRACE();
+
+	hif_start = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+
+	/* Set Host Read bit */
+	SET_HIF_HOST_RDY(hif_start, HIF_HOST_READY_IPC_APP);
+
+	/* Now wait for modem ready bit */
+	while (!ready)
+		ready = CHK_HIF_MOD_RDY(hif_start, HIF_MOD_READY_IPC_APP);
+
+	return 0;
+}
+
+static const struct rte_bbdev_ops pmd_ops = {
+	.info_get = la12xx_info_get,
+	.queue_setup = la12xx_queue_setup,
+	.queue_release = la12xx_queue_release,
+	.start = la12xx_start
+};
+static struct hugepage_info *
+get_hugepage_info(void)
+{
+	struct hugepage_info *hp_info;
+	struct rte_memseg *mseg;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* TODO - find a better way */
+	hp_info = rte_malloc(NULL, sizeof(struct hugepage_info), 0);
+	if (!hp_info) {
+		rte_bbdev_log(ERR, "Unable to allocate on local heap");
+		return NULL;
+	}
+
+	mseg = rte_mem_virt2memseg(hp_info, NULL);
+	hp_info->vaddr = mseg->addr;
+	hp_info->paddr = rte_mem_virt2phy(mseg->addr);
+	hp_info->len = mseg->len;
+
+	return hp_info;
+}
+
+static int open_ipc_dev(int modem_id)
+{
+	char dev_initials[16], dev_path[PATH_MAX];
+	struct dirent *entry;
+	int dev_ipc = 0;
+	DIR *dir;
+
+	dir = opendir("/dev/");
+	if (!dir) {
+		rte_bbdev_log(ERR, "Unable to open /dev/");
+		return -1;
+	}
+
+	sprintf(dev_initials, "gulipcgul%d", modem_id);
+
+	while ((entry = readdir(dir)) != NULL) {
+		if (!strncmp(dev_initials, entry->d_name,
+		    sizeof(dev_initials) - 1))
+			break;
+	}
+
+	if (!entry) {
+		rte_bbdev_log(ERR, "Error: No gulipcgul%d device", modem_id);
+		return -1;
+	}
+
+	sprintf(dev_path, "/dev/%s", entry->d_name);
+	dev_ipc = open(dev_path, O_RDWR);
+	if (dev_ipc  < 0) {
+		rte_bbdev_log(ERR, "Error: Cannot open %s", dev_path);
+		return -errno;
+	}
+
+	return dev_ipc;
+}
+
+static int
+setup_la12xx_dev(struct rte_bbdev *dev)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	struct hugepage_info *hp = NULL;
+	ipc_channel_us_t *ipc_priv_ch = NULL;
+	int dev_ipc = 0, dev_mem = 0, i;
+	ipc_metadata_t *ipc_md;
+	struct gul_hif *mhif;
+	uint32_t phy_align = 0;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (!ipc_priv) {
+		/* TODO - get a better way */
+		/* Get the hugepage info against it */
+		hp = get_hugepage_info();
+		if (!hp) {
+			rte_bbdev_log(ERR, "Unable to get hugepage info");
+			ret = -ENOMEM;
+			goto err;
+		}
+
+		rte_bbdev_log_debug("0x%" PRIx64 " %p 0x%" PRIx64,
+				hp->paddr, hp->vaddr, hp->len);
+
+		ipc_priv = rte_zmalloc(0, sizeof(ipc_userspace_t), 0);
+		if (ipc_priv == NULL) {
+			rte_bbdev_log(ERR,
+				"Unable to allocate memory for ipc priv");
+			ret = -ENOMEM;
+			goto err;
+		}
+
+		for (i = 0; i < IPC_MAX_CHANNEL_COUNT; i++) {
+			ipc_priv_ch = rte_zmalloc(0,
+				sizeof(ipc_channel_us_t), 0);
+			if (ipc_priv_ch == NULL) {
+				rte_bbdev_log(ERR,
+					"Unable to allocate memory for channels");
+				ret = -ENOMEM;
+			}
+			ipc_priv->channels[i] = ipc_priv_ch;
+		}
+
+		dev_mem = open("/dev/mem", O_RDWR);
+		if (dev_mem < 0) {
+			rte_bbdev_log(ERR, "Error: Cannot open /dev/mem");
+			ret = -errno;
+			goto err;
+		}
+
+		ipc_priv->instance_id = 0;
+		ipc_priv->dev_mem = dev_mem;
+
+		rte_bbdev_log_debug("hugepg input 0x%" PRIx64 "%p 0x%" PRIx64,
+			hp->paddr, hp->vaddr, hp->len);
+
+		ipc_priv->sys_map.hugepg_start.host_phys = hp->paddr;
+		ipc_priv->sys_map.hugepg_start.size = hp->len;
+
+		ipc_priv->hugepg_start.host_phys = hp->paddr;
+		ipc_priv->hugepg_start.host_vaddr = hp->vaddr;
+		ipc_priv->hugepg_start.size = hp->len;
+
+		rte_free(hp);
+	}
+
+	dev_ipc = open_ipc_dev(priv->modem_id);
+	if (dev_ipc < 0) {
+		rte_bbdev_log(ERR, "Error: open_ipc_dev failed");
+		goto err;
+	}
+	ipc_priv->dev_ipc = dev_ipc;
+
+	ret = ioctl(ipc_priv->dev_ipc, IOCTL_GUL_IPC_GET_SYS_MAP,
+		    &ipc_priv->sys_map);
+	if (ret) {
+		rte_bbdev_log(ERR,
+			"IOCTL_GUL_IPC_GET_SYS_MAP ioctl failed");
+		goto err;
+	}
+
+	phy_align = (ipc_priv->sys_map.mhif_start.host_phys % 0x1000);
+	ipc_priv->mhif_start.host_vaddr =
+		mmap(0, ipc_priv->sys_map.mhif_start.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.mhif_start.host_phys - phy_align));
+	if (ipc_priv->mhif_start.host_vaddr == MAP_FAILED) {
+		rte_bbdev_log(ERR, "MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->mhif_start.host_vaddr = (void *) ((uintptr_t)
+		(ipc_priv->mhif_start.host_vaddr) + phy_align);
+
+	phy_align = (ipc_priv->sys_map.peb_start.host_phys % 0x1000);
+	ipc_priv->peb_start.host_vaddr =
+		mmap(0, ipc_priv->sys_map.peb_start.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.peb_start.host_phys - phy_align));
+	if (ipc_priv->peb_start.host_vaddr == MAP_FAILED) {
+		rte_bbdev_log(ERR, "MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->peb_start.host_vaddr = (void *)((uintptr_t)
+		(ipc_priv->peb_start.host_vaddr) + phy_align);
+
+	phy_align = (ipc_priv->sys_map.modem_ccsrbar.host_phys % 0x1000);
+	ipc_priv->modem_ccsrbar.host_vaddr =
+		mmap(0, ipc_priv->sys_map.modem_ccsrbar.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.modem_ccsrbar.host_phys - phy_align));
+	if (ipc_priv->modem_ccsrbar.host_vaddr == MAP_FAILED) {
+		rte_bbdev_log(ERR, "MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->modem_ccsrbar.host_vaddr = (void *)((uintptr_t)
+		(ipc_priv->modem_ccsrbar.host_vaddr) + phy_align);
+
+	ipc_priv->hugepg_start.modem_phys =
+		ipc_priv->sys_map.hugepg_start.modem_phys;
+
+	ipc_priv->mhif_start.host_phys =
+		ipc_priv->sys_map.mhif_start.host_phys;
+	ipc_priv->mhif_start.size = ipc_priv->sys_map.mhif_start.size;
+	ipc_priv->peb_start.host_phys = ipc_priv->sys_map.peb_start.host_phys;
+	ipc_priv->peb_start.size = ipc_priv->sys_map.peb_start.size;
+
+	rte_bbdev_log(INFO, "peb 0x%" PRIx64 "%p 0x%" PRIx32,
+			ipc_priv->peb_start.host_phys,
+			ipc_priv->peb_start.host_vaddr,
+			ipc_priv->peb_start.size);
+	rte_bbdev_log(INFO, "hugepg 0x%" PRIx64 "%p 0x%" PRIx32,
+			ipc_priv->hugepg_start.host_phys,
+			ipc_priv->hugepg_start.host_vaddr,
+			ipc_priv->hugepg_start.size);
+	rte_bbdev_log(INFO, "mhif 0x%" PRIx64 "%p 0x%" PRIx32,
+			ipc_priv->mhif_start.host_phys,
+			ipc_priv->mhif_start.host_vaddr,
+			ipc_priv->mhif_start.size);
+	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+
+	/* offset is from start of PEB */
+	ipc_md = (ipc_metadata_t *)((uint64_t)ipc_priv->peb_start.host_vaddr +
+			mhif->ipc_regs.ipc_mdata_offset);
+
+	if (sizeof(ipc_metadata_t) != mhif->ipc_regs.ipc_mdata_size) {
+		rte_bbdev_log(ERR,
+			"ipc_metadata_t =0x%" PRIx64
+			", mhif->ipc_regs.ipc_mdata_size=0x%" PRIx32,
+			sizeof(ipc_metadata_t), mhif->ipc_regs.ipc_mdata_size);
+		rte_bbdev_log(ERR, "--> mhif->ipc_regs.ipc_mdata_offset= 0x%"
+			PRIx32, mhif->ipc_regs.ipc_mdata_offset);
+		rte_bbdev_log(ERR, "gul_hif size=0x%" PRIx64,
+			sizeof(struct gul_hif));
+		return IPC_MD_SZ_MISS_MATCH;
+	}
+
+	ipc_priv->instance = (ipc_instance_t *)
+		(&ipc_md->instance_list[ipc_priv->instance_id]);
+
+	rte_bbdev_log_debug("finish host init");
+
+	priv->ipc_priv = ipc_priv;
+
+	return 0;
+
+err:
+	rte_free(hp);
+	rte_free(ipc_priv);
+	rte_free(ipc_priv_ch);
+	if (dev_mem)
+		close(dev_mem);
+	if (dev_ipc)
+		close(dev_ipc);
+
+	return ret;
+}
+
 static inline int
 parse_u16_arg(const char *key, const char *value, void *extra_args)
 {
@@ -122,6 +668,7 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
 	struct bbdev_la12xx_private *priv;
+	int ret;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -151,7 +698,13 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 
 	rte_bbdev_log(INFO, "Setting Up %s: DevId=%d, ModemId=%d",
 				name, bbdev->data->dev_id, priv->modem_id);
-	bbdev->dev_ops = NULL;
+	ret = setup_la12xx_dev(bbdev);
+	if (ret) {
+		rte_bbdev_log(ERR, "IPC Setup failed for %s", name);
+		rte_free(bbdev->data->dev_private);
+		return ret;
+	}
+	bbdev->dev_ops = &pmd_ops;
 	bbdev->device = &vdev->device;
 	bbdev->data->socket_id = 0;
 	bbdev->intr_handle = NULL;
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.h b/drivers/baseband/la12xx/bbdev_la12xx.h
index 5228502331..fe91e62bf6 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx.h
@@ -5,16 +5,10 @@
 #ifndef __BBDEV_LA12XX_H__
 #define __BBDEV_LA12XX_H__
 
-#define BBDEV_IPC_ENC_OP_TYPE	1
-#define BBDEV_IPC_DEC_OP_TYPE	2
-
-#define MAX_LDPC_ENC_FECA_QUEUES	4
-#define MAX_LDPC_DEC_FECA_QUEUES	4
-
 #define MAX_CHANNEL_DEPTH 16
 /* private data structure */
 struct bbdev_la12xx_private {
-	void *ipc_priv;
+	ipc_userspace_t *ipc_priv;
 	uint8_t num_valid_queues;
 	uint8_t max_nb_queues;
 	uint8_t num_ldpc_enc_queues;
@@ -32,14 +26,14 @@ struct hugepage_info {
 struct bbdev_la12xx_q_priv {
 	struct bbdev_la12xx_private *bbdev_priv;
 	uint32_t q_id;	/**< Channel ID */
-	uint32_t feca_blk_id;	/** FECA block ID for processing */
+	uint32_t feca_blk_id;	/**< FECA block ID for processing */
 	uint32_t feca_blk_id_be32; /**< FECA Block ID for this queue */
-	uint8_t en_napi; /* 0: napi disabled, 1: napi enabled */
+	uint8_t en_napi; /**< 0: napi disabled, 1: napi enabled */
 	uint16_t queue_size;	/**< Queue depth */
 	int32_t eventfd;	/**< Event FD value */
 	enum rte_bbdev_op_type op_type; /**< Operation type */
 	uint32_t la12xx_core_id;
-		/* LA12xx core ID on which this will be scheduled */
+		/**< LA12xx core ID on which this will be scheduled */
 	struct rte_mempool *mp; /**< Pool from where buffers would be cut */
 	void *bbdev_op[MAX_CHANNEL_DEPTH];
 			/**< Stores bbdev op for each index */
@@ -52,5 +46,6 @@ struct bbdev_la12xx_q_priv {
 
 #define lower_32_bits(x) ((uint32_t)((uint64_t)x))
 #define upper_32_bits(x) ((uint32_t)(((uint64_t)(x) >> 16) >> 16))
-
+#define join_32_bits(upper, lower) \
+	((size_t)(((uint64_t)(upper) << 32) | (uint32_t)(lower)))
 #endif
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
index 9aa5562981..5f613fb087 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -4,9 +4,182 @@
 #ifndef __BBDEV_LA12XX_IPC_H__
 #define __BBDEV_LA12XX_IPC_H__
 
+#define LA12XX_MAX_QUEUES 20
+#define HOST_RX_QUEUEID_OFFSET LA12XX_MAX_QUEUES
+
+/** No. of max channel per instance */
+#define IPC_MAX_CHANNEL_COUNT	(64)
+
 /** No. of max channel per instance */
 #define IPC_MAX_DEPTH	(16)
 
+/** No. of max IPC instance per modem */
+#define IPC_MAX_INSTANCE_COUNT	(1)
+
+/** Error codes */
+#define IPC_SUCCESS		(0) /** IPC operation success */
+#define IPC_INPUT_INVALID	(-1) /** Invalid input to API */
+#define IPC_CH_INVALID		(-2) /** Channel no is invalid */
+#define IPC_INSTANCE_INVALID	(-3) /** Instance no is invalid */
+#define IPC_MEM_INVALID		(-4) /** Insufficient memory */
+#define IPC_CH_FULL		(-5) /** Channel is full */
+#define IPC_CH_EMPTY		(-6) /** Channel is empty */
+#define IPC_BL_EMPTY		(-7) /** Free buffer list is empty */
+#define IPC_BL_FULL		(-8) /** Free buffer list is full */
+#define IPC_HOST_BUF_ALLOC_FAIL	(-9) /** DPDK malloc fail */
+#define IPC_MD_SZ_MISS_MATCH	(-10) /** META DATA size in mhif miss matched*/
+#define IPC_MALLOC_FAIL		(-11) /** system malloc fail */
+#define IPC_IOCTL_FAIL		(-12) /** IOCTL call failed */
+#define IPC_MMAP_FAIL		(-14) /** MMAP fail */
+#define IPC_OPEN_FAIL		(-15) /** OPEN fail */
+#define IPC_EVENTFD_FAIL	(-16) /** eventfd initialization failed */
+#define IPC_NOT_IMPLEMENTED	(-17) /** IPC feature is not implemented yet*/
+
+#define SET_HIF_HOST_RDY(hif, RDY_MASK) (hif->host_ready |= RDY_MASK)
+#define CHK_HIF_MOD_RDY(hif, RDY_MASK) (hif->mod_ready & RDY_MASK)
+
+/* Host Ready bits */
+#define HIF_HOST_READY_HOST_REGIONS	(1 << 0)
+#define HIF_HOST_READY_IPC_LIB		(1 << 12)
+#define HIF_HOST_READY_IPC_APP		(1 << 13)
+#define HIF_HOST_READY_FECA		(1 << 14)
+
+/* Modem Ready bits */
+#define HIF_MOD_READY_IPC_LIB		(1 << 5)
+#define HIF_MOD_READY_IPC_APP		(1 << 6)
+#define HIF_MOD_READY_FECA		(1 << 7)
+
+typedef void *ipc_t;
+
+struct ipc_msg {
+	int chid;
+	void *addr;
+	uint32_t len;
+	uint8_t flags;
+};
+
+typedef struct {
+	uint64_t host_phys;
+	uint32_t modem_phys;
+	void    *host_vaddr;
+	uint32_t size;
+} mem_range_t;
+
+#define GUL_IPC_MAGIC	'R'
+
+#define IOCTL_GUL_IPC_GET_SYS_MAP _IOW(GUL_IPC_MAGIC, 1, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_REGISTER _IOWR(GUL_IPC_MAGIC, 4, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_DEREGISTER \
+	_IOWR(GUL_IPC_MAGIC, 5, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_RAISE_INTERRUPT _IOW(GUL_IPC_MAGIC, 6, int *)
+
+/** buffer ring common metadata */
+typedef struct ipc_bd_ring_md {
+	volatile uint32_t pi;		/**< Producer index and flag (MSB)
+					  *  which flip for each Ring wrapping
+					  */
+	volatile uint32_t ci;		/**< Consumer index and flag (MSB)
+					  *  which flip for each Ring wrapping
+					  */
+	uint32_t ring_size;	/**< depth (Used to roll-over pi/ci) */
+	uint32_t msg_size;	/**< Size of the each buffer */
+} __rte_packed ipc_br_md_t;
+
+/** IPC buffer descriptor */
+typedef struct ipc_buffer_desc {
+	union {
+		uint64_t host_virt;	/**< msg's host virtual address */
+		struct {
+			uint32_t host_virt_l;
+			uint32_t host_virt_h;
+		};
+	};
+	uint32_t modem_ptr;	/**< msg's modem physical address */
+	uint32_t len;		/**< msg len */
+} __rte_packed ipc_bd_t;
+
+typedef struct ipc_channel {
+	uint32_t ch_id;		/**< Channel id */
+	ipc_br_md_t md;			/**< Metadata for BD ring */
+	ipc_bd_t bd_h[IPC_MAX_DEPTH];	/**< Buffer Descriptor on Host */
+	ipc_bd_t bd_m[IPC_MAX_DEPTH];	/**< Buffer Descriptor on Modem */
+	uint32_t op_type;		/**< Type of the BBDEV operation
+					  * supported on this channel
+					  */
+	uint32_t depth;			/**< Channel depth */
+	uint32_t feca_blk_id;	/**< FECA Transport Block ID for processing */
+	uint32_t la12xx_core_id;/**< LA12xx core ID on which this will be
+				  * scheduled
+				  */
+	uint32_t feca_input_circ_size;	/**< FECA transport block input
+					  * circular buffer size
+					  */
+	uint32_t host_ipc_params;	/**< Address for host IPC parameters */
+} __rte_packed ipc_ch_t;
+
+typedef struct ipc_instance {
+	uint32_t instance_id;		/**< instance id, use to init this
+					  * instance by ipc_init API
+					  */
+	uint32_t initialized;		/**< Set in ipc_init */
+	ipc_ch_t ch_list[IPC_MAX_CHANNEL_COUNT];
+		/**< Channel descriptors in this instance */
+} __rte_packed ipc_instance_t;
+
+typedef struct ipc_metadata {
+	uint32_t ipc_host_signature; /**< IPC host signature, Set by host/L2 */
+	uint32_t ipc_geul_signature; /**< IPC geul signature, Set by modem */
+	ipc_instance_t instance_list[IPC_MAX_INSTANCE_COUNT];
+} __rte_packed ipc_metadata_t;
+
+typedef struct ipc_channel_us_priv {
+	int32_t		eventfd;
+	uint32_t	channel_id;
+	/* In flight packets status for buffer list. */
+	uint8_t		bufs_inflight[IPC_MAX_DEPTH];
+} ipc_channel_us_t;
+
+typedef struct {
+	uint64_t host_phys;
+	uint32_t modem_phys;
+	uint32_t size;
+} mem_strt_addr_t;
+
+typedef struct {
+	mem_strt_addr_t modem_ccsrbar;
+	mem_strt_addr_t peb_start; /* PEB meta data */
+	mem_strt_addr_t mhif_start; /* MHIF meta daat */
+	mem_strt_addr_t hugepg_start; /* Modem to access hugepage */
+} sys_map_t;
+
+typedef struct ipc_priv_t {
+	int instance_id;
+	int dev_ipc;
+	int dev_mem;
+	sys_map_t sys_map;
+	mem_range_t modem_ccsrbar;
+	mem_range_t peb_start;
+	mem_range_t mhif_start;
+	mem_range_t hugepg_start;
+	ipc_channel_us_t *channels[IPC_MAX_CHANNEL_COUNT];
+	ipc_instance_t	*instance;
+	ipc_instance_t	*instance_bk;
+} ipc_userspace_t;
+
+/** Structure specifying enqueue operation (enqueue at LA1224) */
+struct bbdev_ipc_enqueue_op {
+	/** Status of operation that was performed */
+	int32_t status;
+	/** CRC Status of SD operation that was performed */
+	int32_t crc_stat_addr;
+	/** HARQ Output buffer memory length for Shared Decode.
+	 * Filled by LA12xx.
+	 */
+	uint32_t out_len;
+	/** Reserved (for 8 byte alignment) */
+	uint32_t rsvd;
+};
+
 /* This shared memory would be on the host side which have copy of some
  * of the parameters which are also part of Shared BD ring. Read access
  * of these parameters from the host side would not be over PCI.
@@ -14,7 +187,21 @@
 typedef struct host_ipc_params {
 	volatile uint32_t pi;
 	volatile uint32_t ci;
-	volatile uint32_t modem_ptr[IPC_MAX_DEPTH];
+	volatile uint32_t bd_m_modem_ptr[IPC_MAX_DEPTH];
 } __rte_packed host_ipc_params_t;
 
+struct hif_ipc_regs {
+	uint32_t ipc_mdata_offset;
+	uint32_t ipc_mdata_size;
+} __rte_packed;
+
+struct gul_hif {
+	uint32_t ver;
+	uint32_t hif_ver;
+	uint32_t status;
+	volatile uint32_t host_ready;
+	volatile uint32_t mod_ready;
+	struct hif_ipc_regs ipc_regs;
+} __rte_packed;
+
 #endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v8 6/8] baseband/la12xx: add enqueue and dequeue support
  2021-10-06 11:31 ` [dpdk-dev] [PATCH v8 0/8] baseband: add NXP LA12xx driver nipun.gupta
                     ` (4 preceding siblings ...)
  2021-10-06 11:31   ` [dpdk-dev] [PATCH v8 5/8] baseband/la12xx: add queue and modem config support nipun.gupta
@ 2021-10-06 11:31   ` nipun.gupta
  2021-10-06 11:31   ` [dpdk-dev] [PATCH v8 7/8] app/bbdev: enable la12xx for bbdev nipun.gupta
  2021-10-06 11:31   ` [dpdk-dev] [PATCH v8 8/8] app/bbdev: handle endianness of test data nipun.gupta
  7 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-06 11:31 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

From: Hemant Agrawal <hemant.agrawal@nxp.com>

Add support for enqueue and dequeue the LDPC enc/dec
from the modem device.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 doc/guides/bbdevs/features/la12xx.ini      |  13 +
 doc/guides/bbdevs/la12xx.rst               |  44 +++
 drivers/baseband/la12xx/bbdev_la12xx.c     | 320 +++++++++++++++++++++
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h |  37 +++
 4 files changed, 414 insertions(+)
 create mode 100644 doc/guides/bbdevs/features/la12xx.ini

diff --git a/doc/guides/bbdevs/features/la12xx.ini b/doc/guides/bbdevs/features/la12xx.ini
new file mode 100644
index 0000000000..0aec5eecb6
--- /dev/null
+++ b/doc/guides/bbdevs/features/la12xx.ini
@@ -0,0 +1,13 @@
+;
+; Supported features of the 'la12xx' bbdev driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Turbo Decoder (4G)     = N
+Turbo Encoder (4G)     = N
+LDPC Decoder (5G)      = Y
+LDPC Encoder (5G)      = Y
+LLR/HARQ Compression   = N
+HW Accelerated         = Y
+BBDEV API              = Y
diff --git a/doc/guides/bbdevs/la12xx.rst b/doc/guides/bbdevs/la12xx.rst
index 1a711ef5e3..fe1bca4c5c 100644
--- a/doc/guides/bbdevs/la12xx.rst
+++ b/doc/guides/bbdevs/la12xx.rst
@@ -78,3 +78,47 @@ For enabling logs, use the following EAL parameter:
 
 Using ``bb.la12xx`` as log matching criteria, all Baseband PMD logs can be
 enabled which are lower than logging ``level``.
+
+Test Application
+----------------
+
+BBDEV provides a test application, ``test-bbdev.py`` and range of test data for testing
+the functionality of LA12xx for FEC encode and decode, depending on the device
+capabilities. The test application is located under app->test-bbdev folder and has the
+following options:
+
+.. code-block:: console
+
+  "-p", "--testapp-path": specifies path to the bbdev test app.
+  "-e", "--eal-params"	: EAL arguments which are passed to the test app.
+  "-t", "--timeout"	: Timeout in seconds (default=300).
+  "-c", "--test-cases"	: Defines test cases to run. Run all if not specified.
+  "-v", "--test-vector"	: Test vector path (default=dpdk_path+/app/test-bbdev/test_vectors/bbdev_null.data).
+  "-n", "--num-ops"	: Number of operations to process on device (default=32).
+  "-b", "--burst-size"	: Operations enqueue/dequeue burst size (default=32).
+  "-s", "--snr"		: SNR in dB used when generating LLRs for bler tests.
+  "-s", "--iter_max"	: Number of iterations for LDPC decoder.
+  "-l", "--num-lcores"	: Number of lcores to run (default=16).
+  "-i", "--init-device" : Initialise PF device with default values.
+
+
+To execute the test application tool using simple decode or encode data,
+type one of the following:
+
+.. code-block:: console
+
+  ./test-bbdev.py -e="--vdev=baseband_la12xx,socket_id=0,max_nb_queues=8" -c validation -n 64 -b 1 -v ./ldpc_dec_default.data
+  ./test-bbdev.py -e="--vdev=baseband_la12xx,socket_id=0,max_nb_queues=8" -c validation -n 64 -b 1 -v ./ldpc_enc_default.data
+
+The test application ``test-bbdev.py``, supports the ability to configure the PF device with
+a default set of values, if the "-i" or "- -init-device" option is included. The default values
+are defined in test_bbdev_perf.c.
+
+
+Test Vectors
+~~~~~~~~~~~~
+
+In addition to the simple LDPC decoder and LDPC encoder tests, bbdev also provides
+a range of additional tests under the test_vectors folder, which may be useful. The results
+of these tests will depend on the LA12xx FEC capabilities which may cause some
+testcases to be skipped, but no failure should be reported.
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 0fe67ca42e..b25fc9aeb1 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -120,6 +120,10 @@ la12xx_queue_release(struct rte_bbdev *dev, uint16_t q_id)
 		((uint64_t) ((unsigned long) (A) \
 		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
 
+#define MODEM_P2V(A) \
+	((uint64_t) ((unsigned long) (A) \
+		+ (unsigned long)(ipc_priv->peb_start.host_vaddr)))
+
 static int ipc_queue_configure(uint32_t channel_id,
 		ipc_t instance, struct bbdev_la12xx_q_priv *q_priv)
 {
@@ -334,6 +338,318 @@ static const struct rte_bbdev_ops pmd_ops = {
 	.queue_release = la12xx_queue_release,
 	.start = la12xx_start
 };
+
+static inline int
+is_bd_ring_full(uint32_t ci, uint32_t ci_flag,
+		uint32_t pi, uint32_t pi_flag)
+{
+	if (pi == ci) {
+		if (pi_flag != ci_flag)
+			return 1; /* Ring is Full */
+	}
+	return 0;
+}
+
+static inline int
+prepare_ldpc_enc_op(struct rte_bbdev_enc_op *bbdev_enc_op,
+		    struct bbdev_la12xx_q_priv *q_priv __rte_unused,
+		    struct rte_bbdev_op_data *in_op_data __rte_unused,
+		    struct rte_bbdev_op_data *out_op_data)
+{
+	struct rte_bbdev_op_ldpc_enc *ldpc_enc = &bbdev_enc_op->ldpc_enc;
+	uint32_t total_out_bits;
+
+	total_out_bits = (ldpc_enc->tb_params.cab *
+		ldpc_enc->tb_params.ea) + (ldpc_enc->tb_params.c -
+		ldpc_enc->tb_params.cab) * ldpc_enc->tb_params.eb;
+
+	ldpc_enc->output.length = (total_out_bits + 7)/8;
+
+	rte_pktmbuf_append(out_op_data->data, ldpc_enc->output.length);
+
+	return 0;
+}
+
+static inline int
+prepare_ldpc_dec_op(struct rte_bbdev_dec_op *bbdev_dec_op,
+		    struct bbdev_ipc_dequeue_op *bbdev_ipc_op,
+		    struct bbdev_la12xx_q_priv *q_priv  __rte_unused,
+		    struct rte_bbdev_op_data *out_op_data  __rte_unused)
+{
+	struct rte_bbdev_op_ldpc_dec *ldpc_dec = &bbdev_dec_op->ldpc_dec;
+	uint32_t total_out_bits;
+	uint32_t num_code_blocks = 0;
+	uint16_t sys_cols;
+
+	sys_cols = (ldpc_dec->basegraph == 1) ? 22 : 10;
+	if (ldpc_dec->tb_params.c == 1) {
+		total_out_bits = ((sys_cols * ldpc_dec->z_c) -
+				ldpc_dec->n_filler);
+		/* 5G-NR protocol uses 16 bit CRC when output packet
+		 * size <= 3824 (bits). Otherwise 24 bit CRC is used.
+		 * Adjust the output bits accordingly
+		 */
+		if (total_out_bits - 16 <= 3824)
+			total_out_bits -= 16;
+		else
+			total_out_bits -= 24;
+		ldpc_dec->hard_output.length = (total_out_bits / 8);
+	} else {
+		total_out_bits = (((sys_cols * ldpc_dec->z_c) -
+				ldpc_dec->n_filler - 24) *
+				ldpc_dec->tb_params.c);
+		ldpc_dec->hard_output.length = (total_out_bits / 8) - 3;
+	}
+
+	num_code_blocks = ldpc_dec->tb_params.c;
+
+	bbdev_ipc_op->num_code_blocks = rte_cpu_to_be_32(num_code_blocks);
+
+	return 0;
+}
+
+static int
+enqueue_single_op(struct bbdev_la12xx_q_priv *q_priv, void *bbdev_op)
+{
+	struct bbdev_la12xx_private *priv = q_priv->bbdev_priv;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	ipc_instance_t *ipc_instance = ipc_priv->instance;
+	struct bbdev_ipc_dequeue_op *bbdev_ipc_op;
+	struct rte_bbdev_op_ldpc_enc *ldpc_enc;
+	struct rte_bbdev_op_ldpc_dec *ldpc_dec;
+	uint32_t q_id = q_priv->q_id;
+	uint32_t ci, ci_flag, pi, pi_flag;
+	ipc_ch_t *ch = &(ipc_instance->ch_list[q_id]);
+	ipc_br_md_t *md = &(ch->md);
+	size_t virt;
+	char *huge_start_addr =
+		(char *)q_priv->bbdev_priv->ipc_priv->hugepg_start.host_vaddr;
+	struct rte_bbdev_op_data *in_op_data, *out_op_data;
+	char *data_ptr;
+	uint32_t l1_pcie_addr;
+	int ret;
+
+	ci = IPC_GET_CI_INDEX(q_priv->host_ci);
+	ci_flag = IPC_GET_CI_FLAG(q_priv->host_ci);
+
+	pi = IPC_GET_PI_INDEX(q_priv->host_pi);
+	pi_flag = IPC_GET_PI_FLAG(q_priv->host_pi);
+
+	rte_bbdev_dp_log(DEBUG, "before bd_ring_full: pi: %u, ci: %u,"
+		"pi_flag: %u, ci_flag: %u, ring size: %u",
+		pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	if (is_bd_ring_full(ci, ci_flag, pi, pi_flag)) {
+		rte_bbdev_dp_log(DEBUG, "bd ring full for queue id: %d", q_id);
+		return IPC_CH_FULL;
+	}
+
+	virt = MODEM_P2V(q_priv->host_params->bd_m_modem_ptr[pi]);
+	bbdev_ipc_op = (struct bbdev_ipc_dequeue_op *)virt;
+	q_priv->bbdev_op[pi] = bbdev_op;
+
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		ldpc_enc = &(((struct rte_bbdev_enc_op *)bbdev_op)->ldpc_enc);
+		in_op_data = &ldpc_enc->input;
+		out_op_data = &ldpc_enc->output;
+
+		ret = prepare_ldpc_enc_op(bbdev_op, q_priv,
+					  in_op_data, out_op_data);
+		if (ret) {
+			rte_bbdev_log(ERR, "process_ldpc_enc_op fail, ret: %d",
+				ret);
+			return ret;
+		}
+		break;
+
+	case RTE_BBDEV_OP_LDPC_DEC:
+		ldpc_dec = &(((struct rte_bbdev_dec_op *)bbdev_op)->ldpc_dec);
+		in_op_data = &ldpc_dec->input;
+
+		out_op_data = &ldpc_dec->hard_output;
+
+		ret = prepare_ldpc_dec_op(bbdev_op, bbdev_ipc_op,
+					  q_priv, out_op_data);
+		if (ret) {
+			rte_bbdev_log(ERR, "process_ldpc_dec_op fail, ret: %d",
+				ret);
+			return ret;
+		}
+		break;
+
+	default:
+		rte_bbdev_log(ERR, "unsupported bbdev_ipc op type");
+		return -1;
+	}
+
+	if (in_op_data->data) {
+		data_ptr = rte_pktmbuf_mtod(in_op_data->data, char *);
+		l1_pcie_addr = (uint32_t)GUL_USER_HUGE_PAGE_ADDR +
+			       data_ptr - huge_start_addr;
+		bbdev_ipc_op->in_addr = l1_pcie_addr;
+		bbdev_ipc_op->in_len = in_op_data->length;
+	}
+
+	if (out_op_data->data) {
+		data_ptr = rte_pktmbuf_mtod(out_op_data->data, char *);
+		l1_pcie_addr = (uint32_t)GUL_USER_HUGE_PAGE_ADDR +
+				data_ptr - huge_start_addr;
+		bbdev_ipc_op->out_addr = rte_cpu_to_be_32(l1_pcie_addr);
+		bbdev_ipc_op->out_len = rte_cpu_to_be_32(out_op_data->length);
+	}
+
+	/* Move Producer Index forward */
+	pi++;
+	/* Flip the PI flag, if wrapping */
+	if (unlikely(q_priv->queue_size == pi)) {
+		pi = 0;
+		pi_flag = pi_flag ? 0 : 1;
+	}
+
+	if (pi_flag)
+		IPC_SET_PI_FLAG(pi);
+	else
+		IPC_RESET_PI_FLAG(pi);
+	q_priv->host_pi = pi;
+
+	/* Wait for Data Copy & pi_flag update to complete before updating pi */
+	rte_mb();
+	/* now update pi */
+	md->pi = rte_cpu_to_be_32(pi);
+
+	rte_bbdev_dp_log(DEBUG, "enter: pi: %u, ci: %u,"
+			"pi_flag: %u, ci_flag: %u, ring size: %u",
+			pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	return 0;
+}
+
+/* Enqueue decode burst */
+static uint16_t
+enqueue_dec_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_dec_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	int nb_enqueued, ret;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ret = enqueue_single_op(q_priv, ops[nb_enqueued]);
+		if (ret)
+			break;
+	}
+
+	q_data->queue_stats.enqueue_err_count += nb_ops - nb_enqueued;
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
+/* Enqueue encode burst */
+static uint16_t
+enqueue_enc_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_enc_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	int nb_enqueued, ret;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ret = enqueue_single_op(q_priv, ops[nb_enqueued]);
+		if (ret)
+			break;
+	}
+
+	q_data->queue_stats.enqueue_err_count += nb_ops - nb_enqueued;
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
+/* Dequeue encode burst */
+static void *
+dequeue_single_op(struct bbdev_la12xx_q_priv *q_priv, void *dst)
+{
+	void *op;
+	uint32_t ci, ci_flag;
+	uint32_t temp_ci;
+
+	temp_ci = q_priv->host_params->ci;
+	if (temp_ci == q_priv->host_ci)
+		return NULL;
+
+	ci = IPC_GET_CI_INDEX(q_priv->host_ci);
+	ci_flag = IPC_GET_CI_FLAG(q_priv->host_ci);
+
+	rte_bbdev_dp_log(DEBUG,
+		"ci: %u, ci_flag: %u, ring size: %u",
+		ci, ci_flag, q_priv->queue_size);
+
+	op = q_priv->bbdev_op[ci];
+
+	rte_memcpy(dst, q_priv->msg_ch_vaddr[ci],
+		sizeof(struct bbdev_ipc_enqueue_op));
+
+	/* Move Consumer Index forward */
+	ci++;
+	/* Flip the CI flag, if wrapping */
+	if (q_priv->queue_size == ci) {
+		ci = 0;
+		ci_flag = ci_flag ? 0 : 1;
+	}
+	if (ci_flag)
+		IPC_SET_CI_FLAG(ci);
+	else
+		IPC_RESET_CI_FLAG(ci);
+
+	q_priv->host_ci = ci;
+
+	rte_bbdev_dp_log(DEBUG,
+		"exit: ci: %u, ci_flag: %u, ring size: %u",
+		ci, ci_flag, q_priv->queue_size);
+
+	return op;
+}
+
+/* Dequeue decode burst */
+static uint16_t
+dequeue_dec_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_dec_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	struct bbdev_ipc_enqueue_op bbdev_ipc_op;
+	int nb_dequeued;
+
+	for (nb_dequeued = 0; nb_dequeued < nb_ops; nb_dequeued++) {
+		ops[nb_dequeued] = dequeue_single_op(q_priv, &bbdev_ipc_op);
+		if (!ops[nb_dequeued])
+			break;
+		ops[nb_dequeued]->status = bbdev_ipc_op.status;
+	}
+	q_data->queue_stats.dequeued_count += nb_dequeued;
+
+	return nb_dequeued;
+}
+
+/* Dequeue encode burst */
+static uint16_t
+dequeue_enc_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_enc_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	struct bbdev_ipc_enqueue_op bbdev_ipc_op;
+	int nb_enqueued;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ops[nb_enqueued] = dequeue_single_op(q_priv, &bbdev_ipc_op);
+		if (!ops[nb_enqueued])
+			break;
+		ops[nb_enqueued]->status = bbdev_ipc_op.status;
+	}
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
 static struct hugepage_info *
 get_hugepage_info(void)
 {
@@ -714,6 +1030,10 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 	bbdev->dequeue_dec_ops = NULL;
 	bbdev->enqueue_enc_ops = NULL;
 	bbdev->enqueue_dec_ops = NULL;
+	bbdev->dequeue_ldpc_enc_ops = dequeue_enc_ops;
+	bbdev->dequeue_ldpc_dec_ops = dequeue_dec_ops;
+	bbdev->enqueue_ldpc_enc_ops = enqueue_enc_ops;
+	bbdev->enqueue_ldpc_dec_ops = enqueue_dec_ops;
 
 	return 0;
 }
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
index 5f613fb087..b6a7f677d0 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -73,6 +73,25 @@ typedef struct {
 	_IOWR(GUL_IPC_MAGIC, 5, struct ipc_msg *)
 #define IOCTL_GUL_IPC_CHANNEL_RAISE_INTERRUPT _IOW(GUL_IPC_MAGIC, 6, int *)
 
+#define GUL_USER_HUGE_PAGE_OFFSET	(0)
+#define GUL_PCI1_ADDR_BASE	(0x00000000ULL)
+
+#define GUL_USER_HUGE_PAGE_ADDR	(GUL_PCI1_ADDR_BASE + GUL_USER_HUGE_PAGE_OFFSET)
+
+/* IPC PI/CI index & flag manipulation helpers */
+#define IPC_PI_CI_FLAG_MASK	0x80000000 /*  (1<<31) */
+#define IPC_PI_CI_INDEX_MASK	0x7FFFFFFF /* ~(1<<31) */
+
+#define IPC_SET_PI_FLAG(x)	(x |= IPC_PI_CI_FLAG_MASK)
+#define IPC_RESET_PI_FLAG(x)	(x &= IPC_PI_CI_INDEX_MASK)
+#define IPC_GET_PI_FLAG(x)	(x >> 31)
+#define IPC_GET_PI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
+
+#define IPC_SET_CI_FLAG(x)	(x |= IPC_PI_CI_FLAG_MASK)
+#define IPC_RESET_CI_FLAG(x)	(x &= IPC_PI_CI_INDEX_MASK)
+#define IPC_GET_CI_FLAG(x)	(x >> 31)
+#define IPC_GET_CI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
+
 /** buffer ring common metadata */
 typedef struct ipc_bd_ring_md {
 	volatile uint32_t pi;		/**< Producer index and flag (MSB)
@@ -180,6 +199,24 @@ struct bbdev_ipc_enqueue_op {
 	uint32_t rsvd;
 };
 
+/** Structure specifying dequeue operation (dequeue at LA1224) */
+struct bbdev_ipc_dequeue_op {
+	/** Input buffer memory address */
+	uint32_t in_addr;
+	/** Input buffer memory length */
+	uint32_t in_len;
+	/** Output buffer memory address */
+	uint32_t out_addr;
+	/** Output buffer memory length */
+	uint32_t out_len;
+	/* Number of code blocks. Only set when HARQ is used */
+	uint32_t num_code_blocks;
+	/** Dequeue Operation flags */
+	uint32_t op_flags;
+	/** Shared metadata between L1 and L2 */
+	uint32_t shared_metadata;
+};
+
 /* This shared memory would be on the host side which have copy of some
  * of the parameters which are also part of Shared BD ring. Read access
  * of these parameters from the host side would not be over PCI.
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v8 7/8] app/bbdev: enable la12xx for bbdev
  2021-10-06 11:31 ` [dpdk-dev] [PATCH v8 0/8] baseband: add NXP LA12xx driver nipun.gupta
                     ` (5 preceding siblings ...)
  2021-10-06 11:31   ` [dpdk-dev] [PATCH v8 6/8] baseband/la12xx: add enqueue and dequeue support nipun.gupta
@ 2021-10-06 11:31   ` nipun.gupta
  2021-10-06 11:31   ` [dpdk-dev] [PATCH v8 8/8] app/bbdev: handle endianness of test data nipun.gupta
  7 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-06 11:31 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal

From: Hemant Agrawal <hemant.agrawal@nxp.com>

this patch adds la12xx driver in test bbdev

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/test-bbdev/meson.build | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/app/test-bbdev/meson.build b/app/test-bbdev/meson.build
index edb9deef84..a726a5b3fa 100644
--- a/app/test-bbdev/meson.build
+++ b/app/test-bbdev/meson.build
@@ -23,3 +23,6 @@ endif
 if dpdk_conf.has('RTE_BASEBAND_ACC100')
     deps += ['baseband_acc100']
 endif
+if dpdk_conf.has('RTE_LIBRTE_PMD_BBDEV_LA12XX')
+	deps += ['baseband_la12xx']
+endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v8 8/8] app/bbdev: handle endianness of test data
  2021-10-06 11:31 ` [dpdk-dev] [PATCH v8 0/8] baseband: add NXP LA12xx driver nipun.gupta
                     ` (6 preceding siblings ...)
  2021-10-06 11:31   ` [dpdk-dev] [PATCH v8 7/8] app/bbdev: enable la12xx for bbdev nipun.gupta
@ 2021-10-06 11:31   ` nipun.gupta
  2021-10-06 20:24     ` Chautru, Nicolas
  7 siblings, 1 reply; 157+ messages in thread
From: nipun.gupta @ 2021-10-06 11:31 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

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

With data input, output and harq also supported in big
endian format, this patch updates the testbbdev application
to handle the endianness conversion as directed by the
the driver being used.

If the driver supports big endian data processing, conversion
from little endian to big is handled by the testbbdev application.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 app/test-bbdev/test_bbdev_perf.c | 43 ++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c
index 469597b8b3..597c443596 100644
--- a/app/test-bbdev/test_bbdev_perf.c
+++ b/app/test-bbdev/test_bbdev_perf.c
@@ -227,6 +227,45 @@ clear_soft_out_cap(uint32_t *op_flags)
 	*op_flags &= ~RTE_BBDEV_TURBO_NEG_LLR_1_BIT_SOFT_OUT;
 }
 
+/* This API is to convert all the test vector op data entries
+ * to big endian format. It is used when the device supports
+ * the input in the big endian format.
+ */
+static inline void
+convert_op_data_to_be(void)
+{
+	struct op_data_entries *op;
+	enum op_data_type type;
+	uint8_t nb_segs, *rem_data, temp;
+	uint32_t *data, len;
+	int complete, rem, i, j;
+
+	for (type = DATA_INPUT; type < DATA_NUM_TYPES; ++type) {
+		nb_segs = test_vector.entries[DATA_INPUT].nb_segments;
+		op = &test_vector.entries[type];
+
+		/* Invert byte endianness for all the segments */
+		for (i = 0; i < nb_segs; ++i) {
+			len = op->segments[i].length;
+			data = op->segments[i].addr;
+
+			/* Swap complete u32 bytes */
+			complete = len / 4;
+			for (j = 0; j < complete; j++)
+				data[j] = rte_bswap32(data[j]);
+
+			/* Swap any remaining bytes */
+			rem = len % 4;
+			rem_data = (uint8_t *)&data[j];
+			for (j = 0; j < rem/2; j++) {
+				temp = rem_data[j];
+				rem_data[j] = rem_data[rem - j - 1];
+				rem_data[rem - j - 1] = temp;
+			}
+		}
+	}
+}
+
 static int
 check_dev_cap(const struct rte_bbdev_info *dev_info)
 {
@@ -234,6 +273,7 @@ check_dev_cap(const struct rte_bbdev_info *dev_info)
 	unsigned int nb_inputs, nb_soft_outputs, nb_hard_outputs,
 		nb_harq_inputs, nb_harq_outputs;
 	const struct rte_bbdev_op_cap *op_cap = dev_info->drv.capabilities;
+	uint8_t dev_be_input = dev_info->drv.support_be_data;
 
 	nb_inputs = test_vector.entries[DATA_INPUT].nb_segments;
 	nb_soft_outputs = test_vector.entries[DATA_SOFT_OUTPUT].nb_segments;
@@ -245,6 +285,9 @@ check_dev_cap(const struct rte_bbdev_info *dev_info)
 		if (op_cap->type != test_vector.op_type)
 			continue;
 
+		if (dev_be_input)
+			convert_op_data_to_be();
+
 		if (op_cap->type == RTE_BBDEV_OP_TURBO_DEC) {
 			const struct rte_bbdev_op_cap_turbo_dec *cap =
 					&op_cap->cap.turbo_dec;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v8 8/8] app/bbdev: handle endianness of test data
  2021-10-06 11:31   ` [dpdk-dev] [PATCH v8 8/8] app/bbdev: handle endianness of test data nipun.gupta
@ 2021-10-06 20:24     ` Chautru, Nicolas
  0 siblings, 0 replies; 157+ messages in thread
From: Chautru, Nicolas @ 2021-10-06 20:24 UTC (permalink / raw)
  To: nipun.gupta, dev, gakhil; +Cc: david.marchand, hemant.agrawal


> -----Original Message-----
> From: nipun.gupta@nxp.com <nipun.gupta@nxp.com>
> Sent: Wednesday, October 6, 2021 4:31 AM
> To: dev@dpdk.org; gakhil@marvell.com; Chautru, Nicolas
> <nicolas.chautru@intel.com>
> Cc: david.marchand@redhat.com; hemant.agrawal@nxp.com; Nipun Gupta
> <nipun.gupta@nxp.com>
> Subject: [PATCH v8 8/8] app/bbdev: handle endianness of test data
> 
> From: Nipun Gupta <nipun.gupta@nxp.com>
> 
> With data input, output and harq also supported in big endian format, this
> patch updates the testbbdev application to handle the endianness
> conversion as directed by the the driver being used.
> 
> If the driver supports big endian data processing, conversion from little
> endian to big is handled by the testbbdev application.
> 
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---
>  app/test-bbdev/test_bbdev_perf.c | 43
> ++++++++++++++++++++++++++++++++
>  1 file changed, 43 insertions(+)
> 
> diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-
> bbdev/test_bbdev_perf.c
> index 469597b8b3..597c443596 100644
> --- a/app/test-bbdev/test_bbdev_perf.c
> +++ b/app/test-bbdev/test_bbdev_perf.c
> @@ -227,6 +227,45 @@ clear_soft_out_cap(uint32_t *op_flags)
>  	*op_flags &= ~RTE_BBDEV_TURBO_NEG_LLR_1_BIT_SOFT_OUT;
>  }
> 
> +/* This API is to convert all the test vector op data entries
> + * to big endian format. It is used when the device supports
> + * the input in the big endian format.
> + */
> +static inline void
> +convert_op_data_to_be(void)
> +{
> +	struct op_data_entries *op;
> +	enum op_data_type type;
> +	uint8_t nb_segs, *rem_data, temp;
> +	uint32_t *data, len;
> +	int complete, rem, i, j;
> +
> +	for (type = DATA_INPUT; type < DATA_NUM_TYPES; ++type) {
> +		nb_segs = test_vector.entries[DATA_INPUT].nb_segments;

Is there a typo here? Shouldn't it be instead:
nb_segs = test_vector.entries[type].nb_segments;

Also as part of that same commit, please put a comment in the doc that the bbdev-test is adjusting the byte endianness based on the PMD capability and confirming that all vectors input/ouput data are assuming LE by default.  ./doc/guides/tool/testbbdev.rst


> +		op = &test_vector.entries[type];
> +
> +		/* Invert byte endianness for all the segments */
> +		for (i = 0; i < nb_segs; ++i) {
> +			len = op->segments[i].length;
> +			data = op->segments[i].addr;
> +
> +			/* Swap complete u32 bytes */
> +			complete = len / 4;
> +			for (j = 0; j < complete; j++)
> +				data[j] = rte_bswap32(data[j]);
> +
> +			/* Swap any remaining bytes */
> +			rem = len % 4;
> +			rem_data = (uint8_t *)&data[j];
> +			for (j = 0; j < rem/2; j++) {
> +				temp = rem_data[j];
> +				rem_data[j] = rem_data[rem - j - 1];
> +				rem_data[rem - j - 1] = temp;
> +			}
> +		}
> +	}
> +}
> +
>  static int
>  check_dev_cap(const struct rte_bbdev_info *dev_info)  { @@ -234,6 +273,7
> @@ check_dev_cap(const struct rte_bbdev_info *dev_info)
>  	unsigned int nb_inputs, nb_soft_outputs, nb_hard_outputs,
>  		nb_harq_inputs, nb_harq_outputs;
>  	const struct rte_bbdev_op_cap *op_cap = dev_info-
> >drv.capabilities;
> +	uint8_t dev_be_input = dev_info->drv.support_be_data;
> 
>  	nb_inputs = test_vector.entries[DATA_INPUT].nb_segments;
>  	nb_soft_outputs =
> test_vector.entries[DATA_SOFT_OUTPUT].nb_segments;
> @@ -245,6 +285,9 @@ check_dev_cap(const struct rte_bbdev_info
> *dev_info)
>  		if (op_cap->type != test_vector.op_type)
>  			continue;
> 
> +		if (dev_be_input)
> +			convert_op_data_to_be();
> +
>  		if (op_cap->type == RTE_BBDEV_OP_TURBO_DEC) {
>  			const struct rte_bbdev_op_cap_turbo_dec *cap =
>  					&op_cap->cap.turbo_dec;
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [PATCH v8 1/8] bbdev: add big endian processing data processing info
  2021-10-06 11:31   ` [dpdk-dev] [PATCH v8 1/8] bbdev: add big endian processing data processing info nipun.gupta
@ 2021-10-06 21:02     ` Chautru, Nicolas
  0 siblings, 0 replies; 157+ messages in thread
From: Chautru, Nicolas @ 2021-10-06 21:02 UTC (permalink / raw)
  To: nipun.gupta, dev, gakhil; +Cc: david.marchand, hemant.agrawal

Hi Nipin, 
As mentioned earlier the bbdev api change related to endianness would be more explicit as an enum. 
I have put the change here as an adjusted proposal : https://patches.dpdk.org/project/dpdk/patch/1633553929-58670-2-git-send-email-nicolas.chautru@intel.com/
I have also set default value for existing PMDs for backward compatibility and put a note in rel_notes
Let me know if unclear or other opinion
Thanks
Nic

> -----Original Message-----
> From: nipun.gupta@nxp.com <nipun.gupta@nxp.com>
> Sent: Wednesday, October 6, 2021 4:31 AM
> To: dev@dpdk.org; gakhil@marvell.com; Chautru, Nicolas
> <nicolas.chautru@intel.com>
> Cc: david.marchand@redhat.com; hemant.agrawal@nxp.com; Nipun Gupta
> <nipun.gupta@nxp.com>
> Subject: [PATCH v8 1/8] bbdev: add big endian processing data processing
> info
> 
> From: Nipun Gupta <nipun.gupta@nxp.com>
> 
> This patch introduces a new info pertaining to bbdev device to process the
> data in big endian order.
> 
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---
>  lib/bbdev/rte_bbdev.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/lib/bbdev/rte_bbdev.h b/lib/bbdev/rte_bbdev.h index
> 3ebf62e697..9b9f9d0be6 100644
> --- a/lib/bbdev/rte_bbdev.h
> +++ b/lib/bbdev/rte_bbdev.h
> @@ -309,6 +309,8 @@ struct rte_bbdev_driver_info {
>  	uint16_t min_alignment;
>  	/** HARQ memory available in kB */
>  	uint32_t harq_buffer_size;
> +	/** Device support input, output and HARQ data as big-endian */
> +	bool support_be_data;
>  	/** Default queue configuration used if none is supplied  */
>  	struct rte_bbdev_queue_conf default_queue_conf;
>  	/** Device operation capabilities */
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v9 0/8] baseband: add NXP LA12xx driver
  2021-03-18  6:34 [dpdk-dev] [PATCH 1/6] baseband: introduce NXP LA12xx driver Hemant Agrawal
                   ` (10 preceding siblings ...)
  2021-10-06 11:31 ` [dpdk-dev] [PATCH v8 0/8] baseband: add NXP LA12xx driver nipun.gupta
@ 2021-10-07  9:33 ` nipun.gupta
  2021-10-07  9:33   ` [dpdk-dev] [PATCH v9 1/8] bbdev: add device info related to data endianness assumption nipun.gupta
                     ` (7 more replies)
  2021-10-11  4:32 ` [dpdk-dev] [PATCH v10 0/8] baseband: add NXP LA12xx driver nipun.gupta
  2021-10-17  6:53 ` [dpdk-dev] [PATCH v11 0/8] baseband: add NXP LA12xx driver nipun.gupta
  13 siblings, 8 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-07  9:33 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal

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

This series introduces the BBDEV LA12xx poll mode driver (PMD) to support
an implementation for offloading High Phy processing functions like
LDPC Encode / Decode 5GNR wireless acceleration function, using PCI based
LA12xx Software defined radio.

Please check the documentation patch for more info.

The driver currently implements basic feature to offload only the 5G LDPC
encode/decode.

A new capability has been added to check if the driver can support the
input data in little/big endian byte order.

v2: add test case changes
v3: fix 32 bit compilation
v4: capability for network byte order, doc patch merged inline.
v5: add llr_size and llr_decimals, removed LLR compression flag,
    update testbbdev to handle endianness, rebased on top of 20.08
v6: added BE as device info instead of capability, updated test
    to have 2 codeblocks
v7: fixed checkpatch errors
v8: remove additional test vectors, update reverse_op function name,
    make be_support param as bool, other minor changes in la12xx driver
v9: add little endianness capability as well (patch by Nicolas Chautru),
    fix 32 bit (i386) compilation, fix get of nb_segs, add endianness
    info in testbbdev doc.

Hemant Agrawal (6):
  baseband: introduce NXP LA12xx driver
  baseband/la12xx: add devargs for max queues
  baseband/la12xx: add support for multiple modems
  baseband/la12xx: add queue and modem config support
  baseband/la12xx: add enqueue and dequeue support
  app/bbdev: enable la12xx for bbdev

Nicolas Chautru (1):
  bbdev: add device info related to data endianness assumption

Nipun Gupta (1):
  app/bbdev: handle endianness of test data

 MAINTAINERS                                   |   10 +
 app/test-bbdev/meson.build                    |    3 +
 app/test-bbdev/test_bbdev_perf.c              |   43 +
 doc/guides/bbdevs/features/la12xx.ini         |   13 +
 doc/guides/bbdevs/index.rst                   |    1 +
 doc/guides/bbdevs/la12xx.rst                  |  124 ++
 doc/guides/rel_notes/release_21_11.rst        |    6 +
 doc/guides/tools/testbbdev.rst                |    3 +
 drivers/baseband/acc100/rte_acc100_pmd.c      |    1 +
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         |    1 +
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |    1 +
 drivers/baseband/la12xx/bbdev_la12xx.c        | 1101 +++++++++++++++++
 drivers/baseband/la12xx/bbdev_la12xx.h        |   51 +
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h    |  244 ++++
 .../baseband/la12xx/bbdev_la12xx_pmd_logs.h   |   28 +
 drivers/baseband/la12xx/meson.build           |    6 +
 drivers/baseband/la12xx/version.map           |    3 +
 drivers/baseband/meson.build                  |    1 +
 .../baseband/turbo_sw/bbdev_turbo_software.c  |    1 +
 lib/bbdev/rte_bbdev.h                         |    8 +
 20 files changed, 1649 insertions(+)
 create mode 100644 doc/guides/bbdevs/features/la12xx.ini
 create mode 100644 doc/guides/bbdevs/la12xx.rst
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.c
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_ipc.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
 create mode 100644 drivers/baseband/la12xx/meson.build
 create mode 100644 drivers/baseband/la12xx/version.map

-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v9 1/8] bbdev: add device info related to data endianness assumption
  2021-10-07  9:33 ` [dpdk-dev] [PATCH v9 0/8] baseband: add NXP LA12xx driver nipun.gupta
@ 2021-10-07  9:33   ` nipun.gupta
  2021-10-07  9:33   ` [dpdk-dev] [PATCH v9 2/8] baseband: introduce NXP LA12xx driver nipun.gupta
                     ` (6 subsequent siblings)
  7 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-07  9:33 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal

From: Nicolas Chautru <nicolas.chautru@intel.com>

Adding device information to capture explicitly the assumption
of the input/output data byte endianness being processed.

Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
---
 doc/guides/rel_notes/release_21_11.rst             | 1 +
 drivers/baseband/acc100/rte_acc100_pmd.c           | 1 +
 drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 1 +
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c       | 1 +
 drivers/baseband/turbo_sw/bbdev_turbo_software.c   | 1 +
 lib/bbdev/rte_bbdev.h                              | 8 ++++++++
 6 files changed, 13 insertions(+)

diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst
index dfc2cbdeed..a991f01bf3 100644
--- a/doc/guides/rel_notes/release_21_11.rst
+++ b/doc/guides/rel_notes/release_21_11.rst
@@ -187,6 +187,7 @@ API Changes
   the crypto/security operation. This field will be used to communicate
   events such as soft expiry with IPsec in lookaside mode.
 
+* bbdev: Added device info related to data byte endianness processing assumption.
 
 ABI Changes
 -----------
diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c
index 68ba523ea9..5c3901c9ca 100644
--- a/drivers/baseband/acc100/rte_acc100_pmd.c
+++ b/drivers/baseband/acc100/rte_acc100_pmd.c
@@ -1088,6 +1088,7 @@ acc100_dev_info_get(struct rte_bbdev *dev,
 #else
 	dev_info->harq_buffer_size = 0;
 #endif
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 	acc100_check_ir(d);
 }
 
diff --git a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
index 6485cc824a..c7f15c0bfc 100644
--- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
+++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
@@ -372,6 +372,7 @@ fpga_dev_info_get(struct rte_bbdev *dev,
 	dev_info->default_queue_conf = default_queue_conf;
 	dev_info->capabilities = bbdev_capabilities;
 	dev_info->cpu_flag_reqs = NULL;
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 
 	/* Calculates number of queues assigned to device */
 	dev_info->max_num_queues = 0;
diff --git a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
index 350c4248eb..72e213ed9a 100644
--- a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
+++ b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
@@ -644,6 +644,7 @@ fpga_dev_info_get(struct rte_bbdev *dev,
 	dev_info->default_queue_conf = default_queue_conf;
 	dev_info->capabilities = bbdev_capabilities;
 	dev_info->cpu_flag_reqs = NULL;
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 
 	/* Calculates number of queues assigned to device */
 	dev_info->max_num_queues = 0;
diff --git a/drivers/baseband/turbo_sw/bbdev_turbo_software.c b/drivers/baseband/turbo_sw/bbdev_turbo_software.c
index 77e9a2ecbc..193f701028 100644
--- a/drivers/baseband/turbo_sw/bbdev_turbo_software.c
+++ b/drivers/baseband/turbo_sw/bbdev_turbo_software.c
@@ -251,6 +251,7 @@ info_get(struct rte_bbdev *dev, struct rte_bbdev_driver_info *dev_info)
 	dev_info->capabilities = bbdev_capabilities;
 	dev_info->min_alignment = 64;
 	dev_info->harq_buffer_size = 0;
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 
 	rte_bbdev_log_debug("got device info from %u\n", dev->data->dev_id);
 }
diff --git a/lib/bbdev/rte_bbdev.h b/lib/bbdev/rte_bbdev.h
index 3ebf62e697..b3f30002cd 100644
--- a/lib/bbdev/rte_bbdev.h
+++ b/lib/bbdev/rte_bbdev.h
@@ -49,6 +49,12 @@ enum rte_bbdev_state {
 	RTE_BBDEV_INITIALIZED
 };
 
+/** Definitions of device data byte endianness types */
+enum rte_bbdev_endianness {
+	RTE_BBDEV_BIG_ENDIAN,    /**< Data with byte-endianness BE */
+	RTE_BBDEV_LITTLE_ENDIAN, /**< Data with byte-endianness LE */
+};
+
 /**
  * Get the total number of devices that have been successfully initialised.
  *
@@ -309,6 +315,8 @@ struct rte_bbdev_driver_info {
 	uint16_t min_alignment;
 	/** HARQ memory available in kB */
 	uint32_t harq_buffer_size;
+	/** Byte endianness assumption for input/output data */
+	enum rte_bbdev_endianness data_endianness;
 	/** Default queue configuration used if none is supplied  */
 	struct rte_bbdev_queue_conf default_queue_conf;
 	/** Device operation capabilities */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v9 2/8] baseband: introduce NXP LA12xx driver
  2021-10-07  9:33 ` [dpdk-dev] [PATCH v9 0/8] baseband: add NXP LA12xx driver nipun.gupta
  2021-10-07  9:33   ` [dpdk-dev] [PATCH v9 1/8] bbdev: add device info related to data endianness assumption nipun.gupta
@ 2021-10-07  9:33   ` nipun.gupta
  2021-10-07  9:33   ` [dpdk-dev] [PATCH v9 3/8] baseband/la12xx: add devargs for max queues nipun.gupta
                     ` (5 subsequent siblings)
  7 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-07  9:33 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This patch introduce the baseband device drivers for NXP's
LA1200 series software defined baseband modem.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 MAINTAINERS                                   |   9 ++
 drivers/baseband/la12xx/bbdev_la12xx.c        | 108 ++++++++++++++++++
 .../baseband/la12xx/bbdev_la12xx_pmd_logs.h   |  28 +++++
 drivers/baseband/la12xx/meson.build           |   6 +
 drivers/baseband/la12xx/version.map           |   3 +
 drivers/baseband/meson.build                  |   1 +
 6 files changed, 155 insertions(+)
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.c
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
 create mode 100644 drivers/baseband/la12xx/meson.build
 create mode 100644 drivers/baseband/la12xx/version.map

diff --git a/MAINTAINERS b/MAINTAINERS
index 278e5b3226..25eec751bb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1289,6 +1289,15 @@ F: drivers/event/opdl/
 F: doc/guides/eventdevs/opdl.rst
 
 
+Baseband Drivers
+----------------
+
+NXP LA12xx driver
+M: Nipun Gupta <nipun.gupta@nxp.com>
+M: Hemant Agrawal <hemant.agrawal@nxp.com>
+F: drivers/baseband/la12xx/
+
+
 Rawdev Drivers
 --------------
 
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
new file mode 100644
index 0000000000..d3d7a4df37
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -0,0 +1,108 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+
+#include <string.h>
+
+#include <rte_common.h>
+#include <rte_bus_vdev.h>
+#include <rte_malloc.h>
+#include <rte_ring.h>
+#include <rte_kvargs.h>
+
+#include <rte_bbdev.h>
+#include <rte_bbdev_pmd.h>
+
+#include <bbdev_la12xx_pmd_logs.h>
+
+#define DRIVER_NAME baseband_la12xx
+
+/* private data structure */
+struct bbdev_la12xx_private {
+	unsigned int max_nb_queues;  /**< Max number of queues */
+};
+/* Create device */
+static int
+la12xx_bbdev_create(struct rte_vdev_device *vdev)
+{
+	struct rte_bbdev *bbdev;
+	const char *name = rte_vdev_device_name(vdev);
+
+	PMD_INIT_FUNC_TRACE();
+
+	bbdev = rte_bbdev_allocate(name);
+	if (bbdev == NULL)
+		return -ENODEV;
+
+	bbdev->data->dev_private = rte_zmalloc(name,
+			sizeof(struct bbdev_la12xx_private),
+			RTE_CACHE_LINE_SIZE);
+	if (bbdev->data->dev_private == NULL) {
+		rte_bbdev_release(bbdev);
+		return -ENOMEM;
+	}
+
+	bbdev->dev_ops = NULL;
+	bbdev->device = &vdev->device;
+	bbdev->data->socket_id = 0;
+	bbdev->intr_handle = NULL;
+
+	/* register rx/tx burst functions for data path */
+	bbdev->dequeue_enc_ops = NULL;
+	bbdev->dequeue_dec_ops = NULL;
+	bbdev->enqueue_enc_ops = NULL;
+	bbdev->enqueue_dec_ops = NULL;
+
+	return 0;
+}
+
+/* Initialise device */
+static int
+la12xx_bbdev_probe(struct rte_vdev_device *vdev)
+{
+	const char *name;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (vdev == NULL)
+		return -EINVAL;
+
+	name = rte_vdev_device_name(vdev);
+	if (name == NULL)
+		return -EINVAL;
+
+	return la12xx_bbdev_create(vdev);
+}
+
+/* Uninitialise device */
+static int
+la12xx_bbdev_remove(struct rte_vdev_device *vdev)
+{
+	struct rte_bbdev *bbdev;
+	const char *name;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (vdev == NULL)
+		return -EINVAL;
+
+	name = rte_vdev_device_name(vdev);
+	if (name == NULL)
+		return -EINVAL;
+
+	bbdev = rte_bbdev_get_named_dev(name);
+	if (bbdev == NULL)
+		return -EINVAL;
+
+	rte_free(bbdev->data->dev_private);
+
+	return rte_bbdev_release(bbdev);
+}
+
+static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
+	.probe = la12xx_bbdev_probe,
+	.remove = la12xx_bbdev_remove
+};
+
+RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
+RTE_LOG_REGISTER_DEFAULT(bbdev_la12xx_logtype, NOTICE);
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h b/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
new file mode 100644
index 0000000000..452435ccb9
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020 NXP
+ */
+
+#ifndef _BBDEV_LA12XX_PMD_LOGS_H_
+#define _BBDEV_LA12XX_PMD_LOGS_H_
+
+extern int bbdev_la12xx_logtype;
+
+#define rte_bbdev_log(level, fmt, ...) \
+	rte_log(RTE_LOG_ ## level, bbdev_la12xx_logtype, fmt "\n", \
+		##__VA_ARGS__)
+
+#ifdef RTE_LIBRTE_BBDEV_DEBUG
+#define rte_bbdev_log_debug(fmt, ...) \
+		rte_bbdev_log(DEBUG, "la12xx_pmd: " fmt, \
+		##__VA_ARGS__)
+#else
+#define rte_bbdev_log_debug(fmt, ...)
+#endif
+
+#define PMD_INIT_FUNC_TRACE() rte_bbdev_log_debug(">>")
+
+/* DP Logs, toggled out at compile time if level lower than current level */
+#define rte_bbdev_dp_log(level, fmt, args...) \
+	RTE_LOG_DP(level, PMD, fmt, ## args)
+
+#endif /* _BBDEV_LA12XX_PMD_LOGS_H_ */
diff --git a/drivers/baseband/la12xx/meson.build b/drivers/baseband/la12xx/meson.build
new file mode 100644
index 0000000000..7a017dcffa
--- /dev/null
+++ b/drivers/baseband/la12xx/meson.build
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020-2021 NXP
+
+deps += ['bbdev', 'bus_vdev', 'ring']
+
+sources = files('bbdev_la12xx.c')
diff --git a/drivers/baseband/la12xx/version.map b/drivers/baseband/la12xx/version.map
new file mode 100644
index 0000000000..4a76d1d52d
--- /dev/null
+++ b/drivers/baseband/la12xx/version.map
@@ -0,0 +1,3 @@
+DPDK_21 {
+	local: *;
+};
diff --git a/drivers/baseband/meson.build b/drivers/baseband/meson.build
index 5ee61d5323..ccd1eebc3b 100644
--- a/drivers/baseband/meson.build
+++ b/drivers/baseband/meson.build
@@ -11,6 +11,7 @@ drivers = [
         'fpga_lte_fec',
         'null',
         'turbo_sw',
+        'la12xx',
 ]
 
 log_prefix = 'pmd.bb'
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v9 3/8] baseband/la12xx: add devargs for max queues
  2021-10-07  9:33 ` [dpdk-dev] [PATCH v9 0/8] baseband: add NXP LA12xx driver nipun.gupta
  2021-10-07  9:33   ` [dpdk-dev] [PATCH v9 1/8] bbdev: add device info related to data endianness assumption nipun.gupta
  2021-10-07  9:33   ` [dpdk-dev] [PATCH v9 2/8] baseband: introduce NXP LA12xx driver nipun.gupta
@ 2021-10-07  9:33   ` nipun.gupta
  2021-10-07  9:33   ` [dpdk-dev] [PATCH v9 4/8] baseband/la12xx: add support for multiple modems nipun.gupta
                     ` (4 subsequent siblings)
  7 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-07  9:33 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This patch adds dev args to take  max queues as input

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c | 73 +++++++++++++++++++++++++-
 1 file changed, 71 insertions(+), 2 deletions(-)

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index d3d7a4df37..f5c835eeb8 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -17,13 +17,73 @@
 
 #define DRIVER_NAME baseband_la12xx
 
+/*  Initialisation params structure that can be used by LA12xx BBDEV driver */
+struct bbdev_la12xx_params {
+	uint8_t queues_num; /*< LA12xx BBDEV queues number */
+};
+
+#define LA12XX_MAX_NB_QUEUES_ARG	"max_nb_queues"
+
+static const char * const bbdev_la12xx_valid_params[] = {
+	LA12XX_MAX_NB_QUEUES_ARG,
+};
+
 /* private data structure */
 struct bbdev_la12xx_private {
 	unsigned int max_nb_queues;  /**< Max number of queues */
 };
+static inline int
+parse_u16_arg(const char *key, const char *value, void *extra_args)
+{
+	uint16_t *u16 = extra_args;
+
+	uint64_t result;
+	if ((value == NULL) || (extra_args == NULL))
+		return -EINVAL;
+	errno = 0;
+	result = strtoul(value, NULL, 0);
+	if ((result >= (1 << 16)) || (errno != 0)) {
+		rte_bbdev_log(ERR, "Invalid value %" PRIu64 " for %s",
+			      result, key);
+		return -ERANGE;
+	}
+	*u16 = (uint16_t)result;
+	return 0;
+}
+
+/* Parse parameters used to create device */
+static int
+parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
+		const char *input_args)
+{
+	struct rte_kvargs *kvlist = NULL;
+	int ret = 0;
+
+	if (params == NULL)
+		return -EINVAL;
+	if (input_args) {
+		kvlist = rte_kvargs_parse(input_args,
+				bbdev_la12xx_valid_params);
+		if (kvlist == NULL)
+			return -EFAULT;
+
+		ret = rte_kvargs_process(kvlist, bbdev_la12xx_valid_params[0],
+					&parse_u16_arg, &params->queues_num);
+		if (ret < 0)
+			goto exit;
+
+	}
+
+exit:
+	if (kvlist)
+		rte_kvargs_free(kvlist);
+	return ret;
+}
+
 /* Create device */
 static int
-la12xx_bbdev_create(struct rte_vdev_device *vdev)
+la12xx_bbdev_create(struct rte_vdev_device *vdev,
+		struct bbdev_la12xx_params *init_params __rte_unused)
 {
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
@@ -60,7 +120,11 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev)
 static int
 la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 {
+	struct bbdev_la12xx_params init_params = {
+		8
+	};
 	const char *name;
+	const char *input_args;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -71,7 +135,10 @@ la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 	if (name == NULL)
 		return -EINVAL;
 
-	return la12xx_bbdev_create(vdev);
+	input_args = rte_vdev_device_args(vdev);
+	parse_bbdev_la12xx_params(&init_params, input_args);
+
+	return la12xx_bbdev_create(vdev, &init_params);
 }
 
 /* Uninitialise device */
@@ -105,4 +172,6 @@ static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
 };
 
 RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
+RTE_PMD_REGISTER_PARAM_STRING(DRIVER_NAME,
+	LA12XX_MAX_NB_QUEUES_ARG"=<int>");
 RTE_LOG_REGISTER_DEFAULT(bbdev_la12xx_logtype, NOTICE);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v9 4/8] baseband/la12xx: add support for multiple modems
  2021-10-07  9:33 ` [dpdk-dev] [PATCH v9 0/8] baseband: add NXP LA12xx driver nipun.gupta
                     ` (2 preceding siblings ...)
  2021-10-07  9:33   ` [dpdk-dev] [PATCH v9 3/8] baseband/la12xx: add devargs for max queues nipun.gupta
@ 2021-10-07  9:33   ` nipun.gupta
  2021-10-07  9:33   ` [dpdk-dev] [PATCH v9 5/8] baseband/la12xx: add queue and modem config support nipun.gupta
                     ` (3 subsequent siblings)
  7 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-07  9:33 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This patch add support for multiple modems by assigning
a modem id as dev args in vdev creation.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c     | 64 +++++++++++++++++++---
 drivers/baseband/la12xx/bbdev_la12xx.h     | 56 +++++++++++++++++++
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 20 +++++++
 3 files changed, 133 insertions(+), 7 deletions(-)
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_ipc.h

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index f5c835eeb8..58defa54f0 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -14,24 +14,26 @@
 #include <rte_bbdev_pmd.h>
 
 #include <bbdev_la12xx_pmd_logs.h>
+#include <bbdev_la12xx_ipc.h>
+#include <bbdev_la12xx.h>
 
 #define DRIVER_NAME baseband_la12xx
 
 /*  Initialisation params structure that can be used by LA12xx BBDEV driver */
 struct bbdev_la12xx_params {
 	uint8_t queues_num; /*< LA12xx BBDEV queues number */
+	int8_t modem_id; /*< LA12xx modem instance id */
 };
 
 #define LA12XX_MAX_NB_QUEUES_ARG	"max_nb_queues"
+#define LA12XX_VDEV_MODEM_ID_ARG	"modem"
+#define LA12XX_MAX_MODEM 4
 
 static const char * const bbdev_la12xx_valid_params[] = {
 	LA12XX_MAX_NB_QUEUES_ARG,
+	LA12XX_VDEV_MODEM_ID_ARG,
 };
 
-/* private data structure */
-struct bbdev_la12xx_private {
-	unsigned int max_nb_queues;  /**< Max number of queues */
-};
 static inline int
 parse_u16_arg(const char *key, const char *value, void *extra_args)
 {
@@ -51,6 +53,28 @@ parse_u16_arg(const char *key, const char *value, void *extra_args)
 	return 0;
 }
 
+/* Parse integer from integer argument */
+static int
+parse_integer_arg(const char *key __rte_unused,
+		const char *value, void *extra_args)
+{
+	int i;
+	char *end;
+
+	errno = 0;
+
+	i = strtol(value, &end, 10);
+	if (*end != 0 || errno != 0 || i < 0 || i > LA12XX_MAX_MODEM) {
+		rte_bbdev_log(ERR, "Supported Port IDS are 0 to %d",
+			LA12XX_MAX_MODEM - 1);
+		return -EINVAL;
+	}
+
+	*((uint32_t *)extra_args) = i;
+
+	return 0;
+}
+
 /* Parse parameters used to create device */
 static int
 parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
@@ -72,6 +96,16 @@ parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
 		if (ret < 0)
 			goto exit;
 
+		ret = rte_kvargs_process(kvlist,
+					bbdev_la12xx_valid_params[1],
+					&parse_integer_arg,
+					&params->modem_id);
+
+		if (params->modem_id >= LA12XX_MAX_MODEM) {
+			rte_bbdev_log(ERR, "Invalid modem id, must be < %u",
+					LA12XX_MAX_MODEM);
+			goto exit;
+		}
 	}
 
 exit:
@@ -83,10 +117,11 @@ parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
 /* Create device */
 static int
 la12xx_bbdev_create(struct rte_vdev_device *vdev,
-		struct bbdev_la12xx_params *init_params __rte_unused)
+		struct bbdev_la12xx_params *init_params)
 {
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
+	struct bbdev_la12xx_private *priv;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -102,6 +137,20 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 		return -ENOMEM;
 	}
 
+	priv = bbdev->data->dev_private;
+	priv->modem_id = init_params->modem_id;
+	/* if modem id is not configured */
+	if (priv->modem_id == -1)
+		priv->modem_id = bbdev->data->dev_id;
+
+	/* Reset Global variables */
+	priv->num_ldpc_enc_queues = 0;
+	priv->num_ldpc_dec_queues = 0;
+	priv->num_valid_queues = 0;
+	priv->max_nb_queues = init_params->queues_num;
+
+	rte_bbdev_log(INFO, "Setting Up %s: DevId=%d, ModemId=%d",
+				name, bbdev->data->dev_id, priv->modem_id);
 	bbdev->dev_ops = NULL;
 	bbdev->device = &vdev->device;
 	bbdev->data->socket_id = 0;
@@ -121,7 +170,7 @@ static int
 la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 {
 	struct bbdev_la12xx_params init_params = {
-		8
+		8, -1,
 	};
 	const char *name;
 	const char *input_args;
@@ -173,5 +222,6 @@ static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
 
 RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
 RTE_PMD_REGISTER_PARAM_STRING(DRIVER_NAME,
-	LA12XX_MAX_NB_QUEUES_ARG"=<int>");
+	LA12XX_MAX_NB_QUEUES_ARG"=<int>"
+	LA12XX_VDEV_MODEM_ID_ARG "=<int> ");
 RTE_LOG_REGISTER_DEFAULT(bbdev_la12xx_logtype, NOTICE);
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.h b/drivers/baseband/la12xx/bbdev_la12xx.h
new file mode 100644
index 0000000000..5228502331
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx.h
@@ -0,0 +1,56 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+
+#ifndef __BBDEV_LA12XX_H__
+#define __BBDEV_LA12XX_H__
+
+#define BBDEV_IPC_ENC_OP_TYPE	1
+#define BBDEV_IPC_DEC_OP_TYPE	2
+
+#define MAX_LDPC_ENC_FECA_QUEUES	4
+#define MAX_LDPC_DEC_FECA_QUEUES	4
+
+#define MAX_CHANNEL_DEPTH 16
+/* private data structure */
+struct bbdev_la12xx_private {
+	void *ipc_priv;
+	uint8_t num_valid_queues;
+	uint8_t max_nb_queues;
+	uint8_t num_ldpc_enc_queues;
+	uint8_t num_ldpc_dec_queues;
+	int8_t modem_id;
+	struct bbdev_la12xx_q_priv *queues_priv[32];
+};
+
+struct hugepage_info {
+	void *vaddr;
+	phys_addr_t paddr;
+	size_t len;
+};
+
+struct bbdev_la12xx_q_priv {
+	struct bbdev_la12xx_private *bbdev_priv;
+	uint32_t q_id;	/**< Channel ID */
+	uint32_t feca_blk_id;	/** FECA block ID for processing */
+	uint32_t feca_blk_id_be32; /**< FECA Block ID for this queue */
+	uint8_t en_napi; /* 0: napi disabled, 1: napi enabled */
+	uint16_t queue_size;	/**< Queue depth */
+	int32_t eventfd;	/**< Event FD value */
+	enum rte_bbdev_op_type op_type; /**< Operation type */
+	uint32_t la12xx_core_id;
+		/* LA12xx core ID on which this will be scheduled */
+	struct rte_mempool *mp; /**< Pool from where buffers would be cut */
+	void *bbdev_op[MAX_CHANNEL_DEPTH];
+			/**< Stores bbdev op for each index */
+	void *msg_ch_vaddr[MAX_CHANNEL_DEPTH];
+			/**< Stores msg channel addr for modem->host */
+	uint32_t host_pi;	/**< Producer_Index for HOST->MODEM */
+	uint32_t host_ci;	/**< Consumer Index for MODEM->HOST */
+	host_ipc_params_t *host_params; /**< Host parameters */
+};
+
+#define lower_32_bits(x) ((uint32_t)((uint64_t)x))
+#define upper_32_bits(x) ((uint32_t)(((uint64_t)(x) >> 16) >> 16))
+
+#endif
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
new file mode 100644
index 0000000000..9aa5562981
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+#ifndef __BBDEV_LA12XX_IPC_H__
+#define __BBDEV_LA12XX_IPC_H__
+
+/** No. of max channel per instance */
+#define IPC_MAX_DEPTH	(16)
+
+/* This shared memory would be on the host side which have copy of some
+ * of the parameters which are also part of Shared BD ring. Read access
+ * of these parameters from the host side would not be over PCI.
+ */
+typedef struct host_ipc_params {
+	volatile uint32_t pi;
+	volatile uint32_t ci;
+	volatile uint32_t modem_ptr[IPC_MAX_DEPTH];
+} __rte_packed host_ipc_params_t;
+
+#endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v9 5/8] baseband/la12xx: add queue and modem config support
  2021-10-07  9:33 ` [dpdk-dev] [PATCH v9 0/8] baseband: add NXP LA12xx driver nipun.gupta
                     ` (3 preceding siblings ...)
  2021-10-07  9:33   ` [dpdk-dev] [PATCH v9 4/8] baseband/la12xx: add support for multiple modems nipun.gupta
@ 2021-10-07  9:33   ` nipun.gupta
  2021-10-07  9:33   ` [dpdk-dev] [PATCH v9 6/8] baseband/la12xx: add enqueue and dequeue support nipun.gupta
                     ` (2 subsequent siblings)
  7 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-07  9:33 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This patch add support for connecting with modem
and creating the ipc channel as queues with modem
for the exchange of data.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 MAINTAINERS                                |   1 +
 doc/guides/bbdevs/index.rst                |   1 +
 doc/guides/bbdevs/la12xx.rst               |  80 +++
 doc/guides/rel_notes/release_21_11.rst     |   5 +
 drivers/baseband/la12xx/bbdev_la12xx.c     | 556 ++++++++++++++++++++-
 drivers/baseband/la12xx/bbdev_la12xx.h     |  17 +-
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 189 ++++++-
 7 files changed, 836 insertions(+), 13 deletions(-)
 create mode 100644 doc/guides/bbdevs/la12xx.rst

diff --git a/MAINTAINERS b/MAINTAINERS
index 25eec751bb..7030147767 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1296,6 +1296,7 @@ NXP LA12xx driver
 M: Nipun Gupta <nipun.gupta@nxp.com>
 M: Hemant Agrawal <hemant.agrawal@nxp.com>
 F: drivers/baseband/la12xx/
+F: doc/guides/bbdevs/la12xx.rst
 
 
 Rawdev Drivers
diff --git a/doc/guides/bbdevs/index.rst b/doc/guides/bbdevs/index.rst
index 4445cbd1b0..cedd706fa6 100644
--- a/doc/guides/bbdevs/index.rst
+++ b/doc/guides/bbdevs/index.rst
@@ -14,3 +14,4 @@ Baseband Device Drivers
     fpga_lte_fec
     fpga_5gnr_fec
     acc100
+    la12xx
diff --git a/doc/guides/bbdevs/la12xx.rst b/doc/guides/bbdevs/la12xx.rst
new file mode 100644
index 0000000000..1a711ef5e3
--- /dev/null
+++ b/doc/guides/bbdevs/la12xx.rst
@@ -0,0 +1,80 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright 2021 NXP
+
+NXP LA12xx Poll Mode Driver
+=======================================
+
+The BBDEV LA12xx poll mode driver (PMD) supports an implementation for
+offloading High Phy processing functions like LDPC Encode / Decode 5GNR wireless
+acceleration function, using PCI based LA12xx Software defined radio.
+
+More information can be found at `NXP Official Website
+<https://www.nxp.com/products/processors-and-microcontrollers/arm-processors/layerscape-processors/layerscape-access-la1200-programmable-baseband-processor:LA1200>`_.
+
+Features
+--------
+
+LA12xx PMD supports the following features:
+
+- Maximum of 8 LDPC decode (UL) queues
+- Maximum of 8 LDPC encode (DL) queues
+- PCIe Gen-3 x8 Interface
+
+Installation
+------------
+
+Section 3 of the DPDK manual provides instructions on installing and compiling DPDK.
+
+DPDK requires hugepages to be configured as detailed in section 2 of the DPDK manual.
+
+Initialization
+--------------
+
+The device can be listed on the host console with:
+
+
+Use the following lspci command to get the multiple LA12xx processor ids. The
+device ID of the LA12xx baseband processor is "1c30".
+
+.. code-block:: console
+
+  sudo lspci -nn
+
+...
+0001:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device [1957:1c30] (
+rev 10)
+...
+0002:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device [1957:1c30] (
+rev 10)
+
+
+Prerequisites
+-------------
+
+Currently supported by DPDK:
+
+- NXP LA1224 BSP **1.0+**.
+- NXP LA1224 PCIe Modem card connected to ARM host.
+
+- Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup the basic DPDK environment.
+
+* Use dev arg option ``modem=0`` to identify the modem instance for a given
+  device. This is required only if more than 1 modem cards are attached to host.
+  this is optional and the default value is 0.
+  e.g. ``--vdev=baseband_la12xx,modem=0``
+
+* Use dev arg option ``max_nb_queues=x`` to specify the maximum number of queues
+  to be used for communication with offload device i.e. modem. default is 16.
+  e.g. ``--vdev=baseband_la12xx,max_nb_queues=4``
+
+Enabling logs
+-------------
+
+For enabling logs, use the following EAL parameter:
+
+.. code-block:: console
+
+   ./your_bbdev_application <EAL args> --log-level=la12xx:<level>
+
+Using ``bb.la12xx`` as log matching criteria, all Baseband PMD logs can be
+enabled which are lower than logging ``level``.
diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst
index a991f01bf3..3b41239484 100644
--- a/doc/guides/rel_notes/release_21_11.rst
+++ b/doc/guides/rel_notes/release_21_11.rst
@@ -130,6 +130,11 @@ New Features
   * Added tests to validate packets hard expiry.
   * Added tests to verify tunnel header verification in IPsec inbound.
 
+* **Added NXP LA12xx baseband PMD.**
+
+  * Added a new baseband PMD driver for NXP LA12xx Software defined radio.
+  * See the :doc:`../bbdevs/la12xx` for more details.
+
 
 Removed Items
 -------------
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 58defa54f0..efd5b5c42d 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -3,6 +3,11 @@
  */
 
 #include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <dirent.h>
 
 #include <rte_common.h>
 #include <rte_bus_vdev.h>
@@ -29,11 +34,553 @@ struct bbdev_la12xx_params {
 #define LA12XX_VDEV_MODEM_ID_ARG	"modem"
 #define LA12XX_MAX_MODEM 4
 
+#define LA12XX_MAX_CORES	4
+#define LA12XX_LDPC_ENC_CORE	0
+#define LA12XX_LDPC_DEC_CORE	1
+
+#define LA12XX_MAX_LDPC_ENC_QUEUES	4
+#define LA12XX_MAX_LDPC_DEC_QUEUES	4
+
 static const char * const bbdev_la12xx_valid_params[] = {
 	LA12XX_MAX_NB_QUEUES_ARG,
 	LA12XX_VDEV_MODEM_ID_ARG,
 };
 
+static const struct rte_bbdev_op_cap bbdev_capabilities[] = {
+	{
+		.type   = RTE_BBDEV_OP_LDPC_ENC,
+		.cap.ldpc_enc = {
+			.capability_flags =
+					RTE_BBDEV_LDPC_RATE_MATCH |
+					RTE_BBDEV_LDPC_CRC_24A_ATTACH |
+					RTE_BBDEV_LDPC_CRC_24B_ATTACH,
+			.num_buffers_src =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+			.num_buffers_dst =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+		}
+	},
+	{
+		.type   = RTE_BBDEV_OP_LDPC_DEC,
+		.cap.ldpc_dec = {
+			.capability_flags =
+				RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK |
+					RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK |
+					RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP,
+			.num_buffers_src =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+			.num_buffers_hard_out =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+			.llr_size = 8,
+			.llr_decimals = 1,
+		}
+	},
+	RTE_BBDEV_END_OF_CAPABILITIES_LIST()
+};
+
+static struct rte_bbdev_queue_conf default_queue_conf = {
+	.queue_size = MAX_CHANNEL_DEPTH,
+};
+
+/* Get device info */
+static void
+la12xx_info_get(struct rte_bbdev *dev __rte_unused,
+		struct rte_bbdev_driver_info *dev_info)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	dev_info->driver_name = RTE_STR(DRIVER_NAME);
+	dev_info->max_num_queues = LA12XX_MAX_QUEUES;
+	dev_info->queue_size_lim = MAX_CHANNEL_DEPTH;
+	dev_info->hardware_accelerated = true;
+	dev_info->max_dl_queue_priority = 0;
+	dev_info->max_ul_queue_priority = 0;
+	dev_info->data_endianness = RTE_BBDEV_BIG_ENDIAN;
+	dev_info->default_queue_conf = default_queue_conf;
+	dev_info->capabilities = bbdev_capabilities;
+	dev_info->cpu_flag_reqs = NULL;
+	dev_info->min_alignment = 64;
+
+	rte_bbdev_log_debug("got device info from %u", dev->data->dev_id);
+}
+
+/* Release queue */
+static int
+la12xx_queue_release(struct rte_bbdev *dev, uint16_t q_id)
+{
+	RTE_SET_USED(dev);
+	RTE_SET_USED(q_id);
+
+	PMD_INIT_FUNC_TRACE();
+
+	return 0;
+}
+
+#define HUGEPG_OFFSET(A) \
+		((uint64_t) ((unsigned long) (A) \
+		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
+
+static int ipc_queue_configure(uint32_t channel_id,
+		ipc_t instance, struct bbdev_la12xx_q_priv *q_priv)
+{
+	ipc_userspace_t *ipc_priv = (ipc_userspace_t *)instance;
+	ipc_instance_t *ipc_instance = ipc_priv->instance;
+	ipc_ch_t *ch;
+	void *vaddr;
+	uint32_t i = 0;
+	uint32_t msg_size = sizeof(struct bbdev_ipc_enqueue_op);
+
+	PMD_INIT_FUNC_TRACE();
+
+	rte_bbdev_log_debug("%x %p", ipc_instance->initialized,
+		ipc_priv->instance);
+	ch = &(ipc_instance->ch_list[channel_id]);
+
+	rte_bbdev_log_debug("channel: %u, depth: %u, msg size: %u",
+		channel_id, q_priv->queue_size, msg_size);
+
+	/* Start init of channel */
+	ch->md.ring_size = rte_cpu_to_be_32(q_priv->queue_size);
+	ch->md.pi = 0;
+	ch->md.ci = 0;
+	ch->md.msg_size = msg_size;
+	for (i = 0; i < q_priv->queue_size; i++) {
+		vaddr = rte_malloc(NULL, msg_size, RTE_CACHE_LINE_SIZE);
+		if (!vaddr)
+			return IPC_HOST_BUF_ALLOC_FAIL;
+		/* Only offset now */
+		ch->bd_h[i].modem_ptr =
+			rte_cpu_to_be_32(HUGEPG_OFFSET(vaddr));
+		ch->bd_h[i].host_virt_l = lower_32_bits(vaddr);
+		ch->bd_h[i].host_virt_h = upper_32_bits(vaddr);
+		q_priv->msg_ch_vaddr[i] = vaddr;
+		/* Not sure use of this len may be for CRC*/
+		ch->bd_h[i].len = 0;
+	}
+	ch->host_ipc_params =
+		rte_cpu_to_be_32(HUGEPG_OFFSET(q_priv->host_params));
+
+	rte_bbdev_log_debug("Channel configured");
+	return IPC_SUCCESS;
+}
+
+static int
+la12xx_e200_queue_setup(struct rte_bbdev *dev,
+		struct bbdev_la12xx_q_priv *q_priv)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	struct gul_hif *mhif;
+	ipc_metadata_t *ipc_md;
+	ipc_ch_t *ch;
+	int instance_id = 0, i;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		q_priv->la12xx_core_id = LA12XX_LDPC_ENC_CORE;
+		break;
+	case RTE_BBDEV_OP_LDPC_DEC:
+		q_priv->la12xx_core_id = LA12XX_LDPC_DEC_CORE;
+		break;
+	default:
+		rte_bbdev_log(ERR, "Unsupported op type\n");
+		return -1;
+	}
+
+	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+	/* offset is from start of PEB */
+	ipc_md = (ipc_metadata_t *)((uintptr_t)ipc_priv->peb_start.host_vaddr +
+		mhif->ipc_regs.ipc_mdata_offset);
+	ch = &ipc_md->instance_list[instance_id].ch_list[q_priv->q_id];
+
+	if (q_priv->q_id < priv->num_valid_queues) {
+		ipc_br_md_t *md = &(ch->md);
+
+		q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
+		q_priv->feca_blk_id_be32 = ch->feca_blk_id;
+		q_priv->host_pi = rte_be_to_cpu_32(md->pi);
+		q_priv->host_ci = rte_be_to_cpu_32(md->ci);
+		q_priv->host_params = (host_ipc_params_t *)(uintptr_t)
+			(rte_be_to_cpu_32(ch->host_ipc_params) +
+			((uint64_t)ipc_priv->hugepg_start.host_vaddr));
+
+		for (i = 0; i < q_priv->queue_size; i++) {
+			uint32_t h, l;
+
+			h = ch->bd_h[i].host_virt_h;
+			l = ch->bd_h[i].host_virt_l;
+			q_priv->msg_ch_vaddr[i] = (void *)join_32_bits(h, l);
+		}
+
+		rte_bbdev_log(WARNING,
+			"Queue [%d] already configured, not configuring again",
+			q_priv->q_id);
+		return 0;
+	}
+
+	rte_bbdev_log_debug("setting up queue %d", q_priv->q_id);
+
+	/* Call ipc_configure_channel */
+	ret = ipc_queue_configure(q_priv->q_id, ipc_priv, q_priv);
+	if (ret) {
+		rte_bbdev_log(ERR, "Unable to setup queue (%d) (err=%d)",
+		       q_priv->q_id, ret);
+		return ret;
+	}
+
+	/* Set queue properties for LA12xx device */
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		if (priv->num_ldpc_enc_queues >= LA12XX_MAX_LDPC_ENC_QUEUES) {
+			rte_bbdev_log(ERR,
+				"num_ldpc_enc_queues reached max value");
+			return -1;
+		}
+		ch->la12xx_core_id =
+			rte_cpu_to_be_32(LA12XX_LDPC_ENC_CORE);
+		ch->feca_blk_id = rte_cpu_to_be_32(priv->num_ldpc_enc_queues++);
+		break;
+	case RTE_BBDEV_OP_LDPC_DEC:
+		if (priv->num_ldpc_dec_queues >= LA12XX_MAX_LDPC_DEC_QUEUES) {
+			rte_bbdev_log(ERR,
+				"num_ldpc_dec_queues reached max value");
+			return -1;
+		}
+		ch->la12xx_core_id =
+			rte_cpu_to_be_32(LA12XX_LDPC_DEC_CORE);
+		ch->feca_blk_id = rte_cpu_to_be_32(priv->num_ldpc_dec_queues++);
+		break;
+	default:
+		rte_bbdev_log(ERR, "Not supported op type\n");
+		return -1;
+	}
+	ch->op_type = rte_cpu_to_be_32(q_priv->op_type);
+	ch->depth = rte_cpu_to_be_32(q_priv->queue_size);
+
+	/* Store queue config here */
+	q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
+	q_priv->feca_blk_id_be32 = ch->feca_blk_id;
+
+	return 0;
+}
+
+/* Setup a queue */
+static int
+la12xx_queue_setup(struct rte_bbdev *dev, uint16_t q_id,
+		const struct rte_bbdev_queue_conf *queue_conf)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	struct rte_bbdev_queue_data *q_data;
+	struct bbdev_la12xx_q_priv *q_priv;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* Move to setup_queues callback */
+	q_data = &dev->data->queues[q_id];
+	q_data->queue_private = rte_zmalloc(NULL,
+		sizeof(struct bbdev_la12xx_q_priv), 0);
+	if (!q_data->queue_private) {
+		rte_bbdev_log(ERR, "Memory allocation failed for qpriv");
+		return -ENOMEM;
+	}
+	q_priv = q_data->queue_private;
+	q_priv->q_id = q_id;
+	q_priv->bbdev_priv = dev->data->dev_private;
+	q_priv->queue_size = queue_conf->queue_size;
+	q_priv->op_type = queue_conf->op_type;
+
+	ret = la12xx_e200_queue_setup(dev, q_priv);
+	if (ret) {
+		rte_bbdev_log(ERR, "e200_queue_setup failed for qid: %d",
+				     q_id);
+		return ret;
+	}
+
+	/* Store queue config here */
+	priv->num_valid_queues++;
+
+	return 0;
+}
+
+static int
+la12xx_start(struct rte_bbdev *dev)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	int ready = 0;
+	struct gul_hif *hif_start;
+
+	PMD_INIT_FUNC_TRACE();
+
+	hif_start = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+
+	/* Set Host Read bit */
+	SET_HIF_HOST_RDY(hif_start, HIF_HOST_READY_IPC_APP);
+
+	/* Now wait for modem ready bit */
+	while (!ready)
+		ready = CHK_HIF_MOD_RDY(hif_start, HIF_MOD_READY_IPC_APP);
+
+	return 0;
+}
+
+static const struct rte_bbdev_ops pmd_ops = {
+	.info_get = la12xx_info_get,
+	.queue_setup = la12xx_queue_setup,
+	.queue_release = la12xx_queue_release,
+	.start = la12xx_start
+};
+static struct hugepage_info *
+get_hugepage_info(void)
+{
+	struct hugepage_info *hp_info;
+	struct rte_memseg *mseg;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* TODO - find a better way */
+	hp_info = rte_malloc(NULL, sizeof(struct hugepage_info), 0);
+	if (!hp_info) {
+		rte_bbdev_log(ERR, "Unable to allocate on local heap");
+		return NULL;
+	}
+
+	mseg = rte_mem_virt2memseg(hp_info, NULL);
+	hp_info->vaddr = mseg->addr;
+	hp_info->paddr = rte_mem_virt2phy(mseg->addr);
+	hp_info->len = mseg->len;
+
+	return hp_info;
+}
+
+static int open_ipc_dev(int modem_id)
+{
+	char dev_initials[16], dev_path[PATH_MAX];
+	struct dirent *entry;
+	int dev_ipc = 0;
+	DIR *dir;
+
+	dir = opendir("/dev/");
+	if (!dir) {
+		rte_bbdev_log(ERR, "Unable to open /dev/");
+		return -1;
+	}
+
+	sprintf(dev_initials, "gulipcgul%d", modem_id);
+
+	while ((entry = readdir(dir)) != NULL) {
+		if (!strncmp(dev_initials, entry->d_name,
+		    sizeof(dev_initials) - 1))
+			break;
+	}
+
+	if (!entry) {
+		rte_bbdev_log(ERR, "Error: No gulipcgul%d device", modem_id);
+		return -1;
+	}
+
+	sprintf(dev_path, "/dev/%s", entry->d_name);
+	dev_ipc = open(dev_path, O_RDWR);
+	if (dev_ipc  < 0) {
+		rte_bbdev_log(ERR, "Error: Cannot open %s", dev_path);
+		return -errno;
+	}
+
+	return dev_ipc;
+}
+
+static int
+setup_la12xx_dev(struct rte_bbdev *dev)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	struct hugepage_info *hp = NULL;
+	ipc_channel_us_t *ipc_priv_ch = NULL;
+	int dev_ipc = 0, dev_mem = 0, i;
+	ipc_metadata_t *ipc_md;
+	struct gul_hif *mhif;
+	uint32_t phy_align = 0;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (!ipc_priv) {
+		/* TODO - get a better way */
+		/* Get the hugepage info against it */
+		hp = get_hugepage_info();
+		if (!hp) {
+			rte_bbdev_log(ERR, "Unable to get hugepage info");
+			ret = -ENOMEM;
+			goto err;
+		}
+
+		rte_bbdev_log_debug("0x%" PRIx64 " %p 0x%" PRIx64,
+				hp->paddr, hp->vaddr, hp->len);
+
+		ipc_priv = rte_zmalloc(0, sizeof(ipc_userspace_t), 0);
+		if (ipc_priv == NULL) {
+			rte_bbdev_log(ERR,
+				"Unable to allocate memory for ipc priv");
+			ret = -ENOMEM;
+			goto err;
+		}
+
+		for (i = 0; i < IPC_MAX_CHANNEL_COUNT; i++) {
+			ipc_priv_ch = rte_zmalloc(0,
+				sizeof(ipc_channel_us_t), 0);
+			if (ipc_priv_ch == NULL) {
+				rte_bbdev_log(ERR,
+					"Unable to allocate memory for channels");
+				ret = -ENOMEM;
+			}
+			ipc_priv->channels[i] = ipc_priv_ch;
+		}
+
+		dev_mem = open("/dev/mem", O_RDWR);
+		if (dev_mem < 0) {
+			rte_bbdev_log(ERR, "Error: Cannot open /dev/mem");
+			ret = -errno;
+			goto err;
+		}
+
+		ipc_priv->instance_id = 0;
+		ipc_priv->dev_mem = dev_mem;
+
+		rte_bbdev_log_debug("hugepg input 0x%" PRIx64 "%p 0x%" PRIx64,
+			hp->paddr, hp->vaddr, hp->len);
+
+		ipc_priv->sys_map.hugepg_start.host_phys = hp->paddr;
+		ipc_priv->sys_map.hugepg_start.size = hp->len;
+
+		ipc_priv->hugepg_start.host_phys = hp->paddr;
+		ipc_priv->hugepg_start.host_vaddr = hp->vaddr;
+		ipc_priv->hugepg_start.size = hp->len;
+
+		rte_free(hp);
+	}
+
+	dev_ipc = open_ipc_dev(priv->modem_id);
+	if (dev_ipc < 0) {
+		rte_bbdev_log(ERR, "Error: open_ipc_dev failed");
+		goto err;
+	}
+	ipc_priv->dev_ipc = dev_ipc;
+
+	ret = ioctl(ipc_priv->dev_ipc, IOCTL_GUL_IPC_GET_SYS_MAP,
+		    &ipc_priv->sys_map);
+	if (ret) {
+		rte_bbdev_log(ERR,
+			"IOCTL_GUL_IPC_GET_SYS_MAP ioctl failed");
+		goto err;
+	}
+
+	phy_align = (ipc_priv->sys_map.mhif_start.host_phys % 0x1000);
+	ipc_priv->mhif_start.host_vaddr =
+		mmap(0, ipc_priv->sys_map.mhif_start.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.mhif_start.host_phys - phy_align));
+	if (ipc_priv->mhif_start.host_vaddr == MAP_FAILED) {
+		rte_bbdev_log(ERR, "MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->mhif_start.host_vaddr = (void *) ((uintptr_t)
+		(ipc_priv->mhif_start.host_vaddr) + phy_align);
+
+	phy_align = (ipc_priv->sys_map.peb_start.host_phys % 0x1000);
+	ipc_priv->peb_start.host_vaddr =
+		mmap(0, ipc_priv->sys_map.peb_start.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.peb_start.host_phys - phy_align));
+	if (ipc_priv->peb_start.host_vaddr == MAP_FAILED) {
+		rte_bbdev_log(ERR, "MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->peb_start.host_vaddr = (void *)((uintptr_t)
+		(ipc_priv->peb_start.host_vaddr) + phy_align);
+
+	phy_align = (ipc_priv->sys_map.modem_ccsrbar.host_phys % 0x1000);
+	ipc_priv->modem_ccsrbar.host_vaddr =
+		mmap(0, ipc_priv->sys_map.modem_ccsrbar.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.modem_ccsrbar.host_phys - phy_align));
+	if (ipc_priv->modem_ccsrbar.host_vaddr == MAP_FAILED) {
+		rte_bbdev_log(ERR, "MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->modem_ccsrbar.host_vaddr = (void *)((uintptr_t)
+		(ipc_priv->modem_ccsrbar.host_vaddr) + phy_align);
+
+	ipc_priv->hugepg_start.modem_phys =
+		ipc_priv->sys_map.hugepg_start.modem_phys;
+
+	ipc_priv->mhif_start.host_phys =
+		ipc_priv->sys_map.mhif_start.host_phys;
+	ipc_priv->mhif_start.size = ipc_priv->sys_map.mhif_start.size;
+	ipc_priv->peb_start.host_phys = ipc_priv->sys_map.peb_start.host_phys;
+	ipc_priv->peb_start.size = ipc_priv->sys_map.peb_start.size;
+
+	rte_bbdev_log(INFO, "peb 0x%" PRIx64 "%p 0x%" PRIx32,
+			ipc_priv->peb_start.host_phys,
+			ipc_priv->peb_start.host_vaddr,
+			ipc_priv->peb_start.size);
+	rte_bbdev_log(INFO, "hugepg 0x%" PRIx64 "%p 0x%" PRIx32,
+			ipc_priv->hugepg_start.host_phys,
+			ipc_priv->hugepg_start.host_vaddr,
+			ipc_priv->hugepg_start.size);
+	rte_bbdev_log(INFO, "mhif 0x%" PRIx64 "%p 0x%" PRIx32,
+			ipc_priv->mhif_start.host_phys,
+			ipc_priv->mhif_start.host_vaddr,
+			ipc_priv->mhif_start.size);
+	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+
+	/* offset is from start of PEB */
+	ipc_md = (ipc_metadata_t *)((uintptr_t)ipc_priv->peb_start.host_vaddr +
+			mhif->ipc_regs.ipc_mdata_offset);
+
+	if (sizeof(ipc_metadata_t) != mhif->ipc_regs.ipc_mdata_size) {
+		rte_bbdev_log(ERR,
+			"ipc_metadata_t =0x%" PRIx64
+			", mhif->ipc_regs.ipc_mdata_size=0x%" PRIx32,
+			(uint64_t)(sizeof(ipc_metadata_t)),
+			mhif->ipc_regs.ipc_mdata_size);
+		rte_bbdev_log(ERR, "--> mhif->ipc_regs.ipc_mdata_offset= 0x%"
+			PRIx32, mhif->ipc_regs.ipc_mdata_offset);
+		rte_bbdev_log(ERR, "gul_hif size=0x%" PRIx64,
+			(uint64_t)(sizeof(struct gul_hif)));
+		return IPC_MD_SZ_MISS_MATCH;
+	}
+
+	ipc_priv->instance = (ipc_instance_t *)
+		(&ipc_md->instance_list[ipc_priv->instance_id]);
+
+	rte_bbdev_log_debug("finish host init");
+
+	priv->ipc_priv = ipc_priv;
+
+	return 0;
+
+err:
+	rte_free(hp);
+	rte_free(ipc_priv);
+	rte_free(ipc_priv_ch);
+	if (dev_mem)
+		close(dev_mem);
+	if (dev_ipc)
+		close(dev_ipc);
+
+	return ret;
+}
+
 static inline int
 parse_u16_arg(const char *key, const char *value, void *extra_args)
 {
@@ -122,6 +669,7 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
 	struct bbdev_la12xx_private *priv;
+	int ret;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -151,7 +699,13 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 
 	rte_bbdev_log(INFO, "Setting Up %s: DevId=%d, ModemId=%d",
 				name, bbdev->data->dev_id, priv->modem_id);
-	bbdev->dev_ops = NULL;
+	ret = setup_la12xx_dev(bbdev);
+	if (ret) {
+		rte_bbdev_log(ERR, "IPC Setup failed for %s", name);
+		rte_free(bbdev->data->dev_private);
+		return ret;
+	}
+	bbdev->dev_ops = &pmd_ops;
 	bbdev->device = &vdev->device;
 	bbdev->data->socket_id = 0;
 	bbdev->intr_handle = NULL;
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.h b/drivers/baseband/la12xx/bbdev_la12xx.h
index 5228502331..fe91e62bf6 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx.h
@@ -5,16 +5,10 @@
 #ifndef __BBDEV_LA12XX_H__
 #define __BBDEV_LA12XX_H__
 
-#define BBDEV_IPC_ENC_OP_TYPE	1
-#define BBDEV_IPC_DEC_OP_TYPE	2
-
-#define MAX_LDPC_ENC_FECA_QUEUES	4
-#define MAX_LDPC_DEC_FECA_QUEUES	4
-
 #define MAX_CHANNEL_DEPTH 16
 /* private data structure */
 struct bbdev_la12xx_private {
-	void *ipc_priv;
+	ipc_userspace_t *ipc_priv;
 	uint8_t num_valid_queues;
 	uint8_t max_nb_queues;
 	uint8_t num_ldpc_enc_queues;
@@ -32,14 +26,14 @@ struct hugepage_info {
 struct bbdev_la12xx_q_priv {
 	struct bbdev_la12xx_private *bbdev_priv;
 	uint32_t q_id;	/**< Channel ID */
-	uint32_t feca_blk_id;	/** FECA block ID for processing */
+	uint32_t feca_blk_id;	/**< FECA block ID for processing */
 	uint32_t feca_blk_id_be32; /**< FECA Block ID for this queue */
-	uint8_t en_napi; /* 0: napi disabled, 1: napi enabled */
+	uint8_t en_napi; /**< 0: napi disabled, 1: napi enabled */
 	uint16_t queue_size;	/**< Queue depth */
 	int32_t eventfd;	/**< Event FD value */
 	enum rte_bbdev_op_type op_type; /**< Operation type */
 	uint32_t la12xx_core_id;
-		/* LA12xx core ID on which this will be scheduled */
+		/**< LA12xx core ID on which this will be scheduled */
 	struct rte_mempool *mp; /**< Pool from where buffers would be cut */
 	void *bbdev_op[MAX_CHANNEL_DEPTH];
 			/**< Stores bbdev op for each index */
@@ -52,5 +46,6 @@ struct bbdev_la12xx_q_priv {
 
 #define lower_32_bits(x) ((uint32_t)((uint64_t)x))
 #define upper_32_bits(x) ((uint32_t)(((uint64_t)(x) >> 16) >> 16))
-
+#define join_32_bits(upper, lower) \
+	((size_t)(((uint64_t)(upper) << 32) | (uint32_t)(lower)))
 #endif
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
index 9aa5562981..5f613fb087 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -4,9 +4,182 @@
 #ifndef __BBDEV_LA12XX_IPC_H__
 #define __BBDEV_LA12XX_IPC_H__
 
+#define LA12XX_MAX_QUEUES 20
+#define HOST_RX_QUEUEID_OFFSET LA12XX_MAX_QUEUES
+
+/** No. of max channel per instance */
+#define IPC_MAX_CHANNEL_COUNT	(64)
+
 /** No. of max channel per instance */
 #define IPC_MAX_DEPTH	(16)
 
+/** No. of max IPC instance per modem */
+#define IPC_MAX_INSTANCE_COUNT	(1)
+
+/** Error codes */
+#define IPC_SUCCESS		(0) /** IPC operation success */
+#define IPC_INPUT_INVALID	(-1) /** Invalid input to API */
+#define IPC_CH_INVALID		(-2) /** Channel no is invalid */
+#define IPC_INSTANCE_INVALID	(-3) /** Instance no is invalid */
+#define IPC_MEM_INVALID		(-4) /** Insufficient memory */
+#define IPC_CH_FULL		(-5) /** Channel is full */
+#define IPC_CH_EMPTY		(-6) /** Channel is empty */
+#define IPC_BL_EMPTY		(-7) /** Free buffer list is empty */
+#define IPC_BL_FULL		(-8) /** Free buffer list is full */
+#define IPC_HOST_BUF_ALLOC_FAIL	(-9) /** DPDK malloc fail */
+#define IPC_MD_SZ_MISS_MATCH	(-10) /** META DATA size in mhif miss matched*/
+#define IPC_MALLOC_FAIL		(-11) /** system malloc fail */
+#define IPC_IOCTL_FAIL		(-12) /** IOCTL call failed */
+#define IPC_MMAP_FAIL		(-14) /** MMAP fail */
+#define IPC_OPEN_FAIL		(-15) /** OPEN fail */
+#define IPC_EVENTFD_FAIL	(-16) /** eventfd initialization failed */
+#define IPC_NOT_IMPLEMENTED	(-17) /** IPC feature is not implemented yet*/
+
+#define SET_HIF_HOST_RDY(hif, RDY_MASK) (hif->host_ready |= RDY_MASK)
+#define CHK_HIF_MOD_RDY(hif, RDY_MASK) (hif->mod_ready & RDY_MASK)
+
+/* Host Ready bits */
+#define HIF_HOST_READY_HOST_REGIONS	(1 << 0)
+#define HIF_HOST_READY_IPC_LIB		(1 << 12)
+#define HIF_HOST_READY_IPC_APP		(1 << 13)
+#define HIF_HOST_READY_FECA		(1 << 14)
+
+/* Modem Ready bits */
+#define HIF_MOD_READY_IPC_LIB		(1 << 5)
+#define HIF_MOD_READY_IPC_APP		(1 << 6)
+#define HIF_MOD_READY_FECA		(1 << 7)
+
+typedef void *ipc_t;
+
+struct ipc_msg {
+	int chid;
+	void *addr;
+	uint32_t len;
+	uint8_t flags;
+};
+
+typedef struct {
+	uint64_t host_phys;
+	uint32_t modem_phys;
+	void    *host_vaddr;
+	uint32_t size;
+} mem_range_t;
+
+#define GUL_IPC_MAGIC	'R'
+
+#define IOCTL_GUL_IPC_GET_SYS_MAP _IOW(GUL_IPC_MAGIC, 1, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_REGISTER _IOWR(GUL_IPC_MAGIC, 4, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_DEREGISTER \
+	_IOWR(GUL_IPC_MAGIC, 5, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_RAISE_INTERRUPT _IOW(GUL_IPC_MAGIC, 6, int *)
+
+/** buffer ring common metadata */
+typedef struct ipc_bd_ring_md {
+	volatile uint32_t pi;		/**< Producer index and flag (MSB)
+					  *  which flip for each Ring wrapping
+					  */
+	volatile uint32_t ci;		/**< Consumer index and flag (MSB)
+					  *  which flip for each Ring wrapping
+					  */
+	uint32_t ring_size;	/**< depth (Used to roll-over pi/ci) */
+	uint32_t msg_size;	/**< Size of the each buffer */
+} __rte_packed ipc_br_md_t;
+
+/** IPC buffer descriptor */
+typedef struct ipc_buffer_desc {
+	union {
+		uint64_t host_virt;	/**< msg's host virtual address */
+		struct {
+			uint32_t host_virt_l;
+			uint32_t host_virt_h;
+		};
+	};
+	uint32_t modem_ptr;	/**< msg's modem physical address */
+	uint32_t len;		/**< msg len */
+} __rte_packed ipc_bd_t;
+
+typedef struct ipc_channel {
+	uint32_t ch_id;		/**< Channel id */
+	ipc_br_md_t md;			/**< Metadata for BD ring */
+	ipc_bd_t bd_h[IPC_MAX_DEPTH];	/**< Buffer Descriptor on Host */
+	ipc_bd_t bd_m[IPC_MAX_DEPTH];	/**< Buffer Descriptor on Modem */
+	uint32_t op_type;		/**< Type of the BBDEV operation
+					  * supported on this channel
+					  */
+	uint32_t depth;			/**< Channel depth */
+	uint32_t feca_blk_id;	/**< FECA Transport Block ID for processing */
+	uint32_t la12xx_core_id;/**< LA12xx core ID on which this will be
+				  * scheduled
+				  */
+	uint32_t feca_input_circ_size;	/**< FECA transport block input
+					  * circular buffer size
+					  */
+	uint32_t host_ipc_params;	/**< Address for host IPC parameters */
+} __rte_packed ipc_ch_t;
+
+typedef struct ipc_instance {
+	uint32_t instance_id;		/**< instance id, use to init this
+					  * instance by ipc_init API
+					  */
+	uint32_t initialized;		/**< Set in ipc_init */
+	ipc_ch_t ch_list[IPC_MAX_CHANNEL_COUNT];
+		/**< Channel descriptors in this instance */
+} __rte_packed ipc_instance_t;
+
+typedef struct ipc_metadata {
+	uint32_t ipc_host_signature; /**< IPC host signature, Set by host/L2 */
+	uint32_t ipc_geul_signature; /**< IPC geul signature, Set by modem */
+	ipc_instance_t instance_list[IPC_MAX_INSTANCE_COUNT];
+} __rte_packed ipc_metadata_t;
+
+typedef struct ipc_channel_us_priv {
+	int32_t		eventfd;
+	uint32_t	channel_id;
+	/* In flight packets status for buffer list. */
+	uint8_t		bufs_inflight[IPC_MAX_DEPTH];
+} ipc_channel_us_t;
+
+typedef struct {
+	uint64_t host_phys;
+	uint32_t modem_phys;
+	uint32_t size;
+} mem_strt_addr_t;
+
+typedef struct {
+	mem_strt_addr_t modem_ccsrbar;
+	mem_strt_addr_t peb_start; /* PEB meta data */
+	mem_strt_addr_t mhif_start; /* MHIF meta daat */
+	mem_strt_addr_t hugepg_start; /* Modem to access hugepage */
+} sys_map_t;
+
+typedef struct ipc_priv_t {
+	int instance_id;
+	int dev_ipc;
+	int dev_mem;
+	sys_map_t sys_map;
+	mem_range_t modem_ccsrbar;
+	mem_range_t peb_start;
+	mem_range_t mhif_start;
+	mem_range_t hugepg_start;
+	ipc_channel_us_t *channels[IPC_MAX_CHANNEL_COUNT];
+	ipc_instance_t	*instance;
+	ipc_instance_t	*instance_bk;
+} ipc_userspace_t;
+
+/** Structure specifying enqueue operation (enqueue at LA1224) */
+struct bbdev_ipc_enqueue_op {
+	/** Status of operation that was performed */
+	int32_t status;
+	/** CRC Status of SD operation that was performed */
+	int32_t crc_stat_addr;
+	/** HARQ Output buffer memory length for Shared Decode.
+	 * Filled by LA12xx.
+	 */
+	uint32_t out_len;
+	/** Reserved (for 8 byte alignment) */
+	uint32_t rsvd;
+};
+
 /* This shared memory would be on the host side which have copy of some
  * of the parameters which are also part of Shared BD ring. Read access
  * of these parameters from the host side would not be over PCI.
@@ -14,7 +187,21 @@
 typedef struct host_ipc_params {
 	volatile uint32_t pi;
 	volatile uint32_t ci;
-	volatile uint32_t modem_ptr[IPC_MAX_DEPTH];
+	volatile uint32_t bd_m_modem_ptr[IPC_MAX_DEPTH];
 } __rte_packed host_ipc_params_t;
 
+struct hif_ipc_regs {
+	uint32_t ipc_mdata_offset;
+	uint32_t ipc_mdata_size;
+} __rte_packed;
+
+struct gul_hif {
+	uint32_t ver;
+	uint32_t hif_ver;
+	uint32_t status;
+	volatile uint32_t host_ready;
+	volatile uint32_t mod_ready;
+	struct hif_ipc_regs ipc_regs;
+} __rte_packed;
+
 #endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v9 6/8] baseband/la12xx: add enqueue and dequeue support
  2021-10-07  9:33 ` [dpdk-dev] [PATCH v9 0/8] baseband: add NXP LA12xx driver nipun.gupta
                     ` (4 preceding siblings ...)
  2021-10-07  9:33   ` [dpdk-dev] [PATCH v9 5/8] baseband/la12xx: add queue and modem config support nipun.gupta
@ 2021-10-07  9:33   ` nipun.gupta
  2021-10-07  9:33   ` [dpdk-dev] [PATCH v9 7/8] app/bbdev: enable la12xx for bbdev nipun.gupta
  2021-10-07  9:33   ` [dpdk-dev] [PATCH v9 8/8] app/bbdev: handle endianness of test data nipun.gupta
  7 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-07  9:33 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

From: Hemant Agrawal <hemant.agrawal@nxp.com>

Add support for enqueue and dequeue the LDPC enc/dec
from the modem device.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 doc/guides/bbdevs/features/la12xx.ini      |  13 +
 doc/guides/bbdevs/la12xx.rst               |  44 +++
 drivers/baseband/la12xx/bbdev_la12xx.c     | 320 +++++++++++++++++++++
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h |  37 +++
 4 files changed, 414 insertions(+)
 create mode 100644 doc/guides/bbdevs/features/la12xx.ini

diff --git a/doc/guides/bbdevs/features/la12xx.ini b/doc/guides/bbdevs/features/la12xx.ini
new file mode 100644
index 0000000000..0aec5eecb6
--- /dev/null
+++ b/doc/guides/bbdevs/features/la12xx.ini
@@ -0,0 +1,13 @@
+;
+; Supported features of the 'la12xx' bbdev driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Turbo Decoder (4G)     = N
+Turbo Encoder (4G)     = N
+LDPC Decoder (5G)      = Y
+LDPC Encoder (5G)      = Y
+LLR/HARQ Compression   = N
+HW Accelerated         = Y
+BBDEV API              = Y
diff --git a/doc/guides/bbdevs/la12xx.rst b/doc/guides/bbdevs/la12xx.rst
index 1a711ef5e3..fe1bca4c5c 100644
--- a/doc/guides/bbdevs/la12xx.rst
+++ b/doc/guides/bbdevs/la12xx.rst
@@ -78,3 +78,47 @@ For enabling logs, use the following EAL parameter:
 
 Using ``bb.la12xx`` as log matching criteria, all Baseband PMD logs can be
 enabled which are lower than logging ``level``.
+
+Test Application
+----------------
+
+BBDEV provides a test application, ``test-bbdev.py`` and range of test data for testing
+the functionality of LA12xx for FEC encode and decode, depending on the device
+capabilities. The test application is located under app->test-bbdev folder and has the
+following options:
+
+.. code-block:: console
+
+  "-p", "--testapp-path": specifies path to the bbdev test app.
+  "-e", "--eal-params"	: EAL arguments which are passed to the test app.
+  "-t", "--timeout"	: Timeout in seconds (default=300).
+  "-c", "--test-cases"	: Defines test cases to run. Run all if not specified.
+  "-v", "--test-vector"	: Test vector path (default=dpdk_path+/app/test-bbdev/test_vectors/bbdev_null.data).
+  "-n", "--num-ops"	: Number of operations to process on device (default=32).
+  "-b", "--burst-size"	: Operations enqueue/dequeue burst size (default=32).
+  "-s", "--snr"		: SNR in dB used when generating LLRs for bler tests.
+  "-s", "--iter_max"	: Number of iterations for LDPC decoder.
+  "-l", "--num-lcores"	: Number of lcores to run (default=16).
+  "-i", "--init-device" : Initialise PF device with default values.
+
+
+To execute the test application tool using simple decode or encode data,
+type one of the following:
+
+.. code-block:: console
+
+  ./test-bbdev.py -e="--vdev=baseband_la12xx,socket_id=0,max_nb_queues=8" -c validation -n 64 -b 1 -v ./ldpc_dec_default.data
+  ./test-bbdev.py -e="--vdev=baseband_la12xx,socket_id=0,max_nb_queues=8" -c validation -n 64 -b 1 -v ./ldpc_enc_default.data
+
+The test application ``test-bbdev.py``, supports the ability to configure the PF device with
+a default set of values, if the "-i" or "- -init-device" option is included. The default values
+are defined in test_bbdev_perf.c.
+
+
+Test Vectors
+~~~~~~~~~~~~
+
+In addition to the simple LDPC decoder and LDPC encoder tests, bbdev also provides
+a range of additional tests under the test_vectors folder, which may be useful. The results
+of these tests will depend on the LA12xx FEC capabilities which may cause some
+testcases to be skipped, but no failure should be reported.
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index efd5b5c42d..eaadd4f6e9 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -120,6 +120,10 @@ la12xx_queue_release(struct rte_bbdev *dev, uint16_t q_id)
 		((uint64_t) ((unsigned long) (A) \
 		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
 
+#define MODEM_P2V(A) \
+	((uint64_t) ((unsigned long) (A) \
+		+ (unsigned long)(ipc_priv->peb_start.host_vaddr)))
+
 static int ipc_queue_configure(uint32_t channel_id,
 		ipc_t instance, struct bbdev_la12xx_q_priv *q_priv)
 {
@@ -334,6 +338,318 @@ static const struct rte_bbdev_ops pmd_ops = {
 	.queue_release = la12xx_queue_release,
 	.start = la12xx_start
 };
+
+static inline int
+is_bd_ring_full(uint32_t ci, uint32_t ci_flag,
+		uint32_t pi, uint32_t pi_flag)
+{
+	if (pi == ci) {
+		if (pi_flag != ci_flag)
+			return 1; /* Ring is Full */
+	}
+	return 0;
+}
+
+static inline int
+prepare_ldpc_enc_op(struct rte_bbdev_enc_op *bbdev_enc_op,
+		    struct bbdev_la12xx_q_priv *q_priv __rte_unused,
+		    struct rte_bbdev_op_data *in_op_data __rte_unused,
+		    struct rte_bbdev_op_data *out_op_data)
+{
+	struct rte_bbdev_op_ldpc_enc *ldpc_enc = &bbdev_enc_op->ldpc_enc;
+	uint32_t total_out_bits;
+
+	total_out_bits = (ldpc_enc->tb_params.cab *
+		ldpc_enc->tb_params.ea) + (ldpc_enc->tb_params.c -
+		ldpc_enc->tb_params.cab) * ldpc_enc->tb_params.eb;
+
+	ldpc_enc->output.length = (total_out_bits + 7)/8;
+
+	rte_pktmbuf_append(out_op_data->data, ldpc_enc->output.length);
+
+	return 0;
+}
+
+static inline int
+prepare_ldpc_dec_op(struct rte_bbdev_dec_op *bbdev_dec_op,
+		    struct bbdev_ipc_dequeue_op *bbdev_ipc_op,
+		    struct bbdev_la12xx_q_priv *q_priv  __rte_unused,
+		    struct rte_bbdev_op_data *out_op_data  __rte_unused)
+{
+	struct rte_bbdev_op_ldpc_dec *ldpc_dec = &bbdev_dec_op->ldpc_dec;
+	uint32_t total_out_bits;
+	uint32_t num_code_blocks = 0;
+	uint16_t sys_cols;
+
+	sys_cols = (ldpc_dec->basegraph == 1) ? 22 : 10;
+	if (ldpc_dec->tb_params.c == 1) {
+		total_out_bits = ((sys_cols * ldpc_dec->z_c) -
+				ldpc_dec->n_filler);
+		/* 5G-NR protocol uses 16 bit CRC when output packet
+		 * size <= 3824 (bits). Otherwise 24 bit CRC is used.
+		 * Adjust the output bits accordingly
+		 */
+		if (total_out_bits - 16 <= 3824)
+			total_out_bits -= 16;
+		else
+			total_out_bits -= 24;
+		ldpc_dec->hard_output.length = (total_out_bits / 8);
+	} else {
+		total_out_bits = (((sys_cols * ldpc_dec->z_c) -
+				ldpc_dec->n_filler - 24) *
+				ldpc_dec->tb_params.c);
+		ldpc_dec->hard_output.length = (total_out_bits / 8) - 3;
+	}
+
+	num_code_blocks = ldpc_dec->tb_params.c;
+
+	bbdev_ipc_op->num_code_blocks = rte_cpu_to_be_32(num_code_blocks);
+
+	return 0;
+}
+
+static int
+enqueue_single_op(struct bbdev_la12xx_q_priv *q_priv, void *bbdev_op)
+{
+	struct bbdev_la12xx_private *priv = q_priv->bbdev_priv;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	ipc_instance_t *ipc_instance = ipc_priv->instance;
+	struct bbdev_ipc_dequeue_op *bbdev_ipc_op;
+	struct rte_bbdev_op_ldpc_enc *ldpc_enc;
+	struct rte_bbdev_op_ldpc_dec *ldpc_dec;
+	uint32_t q_id = q_priv->q_id;
+	uint32_t ci, ci_flag, pi, pi_flag;
+	ipc_ch_t *ch = &(ipc_instance->ch_list[q_id]);
+	ipc_br_md_t *md = &(ch->md);
+	size_t virt;
+	char *huge_start_addr =
+		(char *)q_priv->bbdev_priv->ipc_priv->hugepg_start.host_vaddr;
+	struct rte_bbdev_op_data *in_op_data, *out_op_data;
+	char *data_ptr;
+	uint32_t l1_pcie_addr;
+	int ret;
+
+	ci = IPC_GET_CI_INDEX(q_priv->host_ci);
+	ci_flag = IPC_GET_CI_FLAG(q_priv->host_ci);
+
+	pi = IPC_GET_PI_INDEX(q_priv->host_pi);
+	pi_flag = IPC_GET_PI_FLAG(q_priv->host_pi);
+
+	rte_bbdev_dp_log(DEBUG, "before bd_ring_full: pi: %u, ci: %u,"
+		"pi_flag: %u, ci_flag: %u, ring size: %u",
+		pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	if (is_bd_ring_full(ci, ci_flag, pi, pi_flag)) {
+		rte_bbdev_dp_log(DEBUG, "bd ring full for queue id: %d", q_id);
+		return IPC_CH_FULL;
+	}
+
+	virt = MODEM_P2V(q_priv->host_params->bd_m_modem_ptr[pi]);
+	bbdev_ipc_op = (struct bbdev_ipc_dequeue_op *)virt;
+	q_priv->bbdev_op[pi] = bbdev_op;
+
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		ldpc_enc = &(((struct rte_bbdev_enc_op *)bbdev_op)->ldpc_enc);
+		in_op_data = &ldpc_enc->input;
+		out_op_data = &ldpc_enc->output;
+
+		ret = prepare_ldpc_enc_op(bbdev_op, q_priv,
+					  in_op_data, out_op_data);
+		if (ret) {
+			rte_bbdev_log(ERR, "process_ldpc_enc_op fail, ret: %d",
+				ret);
+			return ret;
+		}
+		break;
+
+	case RTE_BBDEV_OP_LDPC_DEC:
+		ldpc_dec = &(((struct rte_bbdev_dec_op *)bbdev_op)->ldpc_dec);
+		in_op_data = &ldpc_dec->input;
+
+		out_op_data = &ldpc_dec->hard_output;
+
+		ret = prepare_ldpc_dec_op(bbdev_op, bbdev_ipc_op,
+					  q_priv, out_op_data);
+		if (ret) {
+			rte_bbdev_log(ERR, "process_ldpc_dec_op fail, ret: %d",
+				ret);
+			return ret;
+		}
+		break;
+
+	default:
+		rte_bbdev_log(ERR, "unsupported bbdev_ipc op type");
+		return -1;
+	}
+
+	if (in_op_data->data) {
+		data_ptr = rte_pktmbuf_mtod(in_op_data->data, char *);
+		l1_pcie_addr = (uint32_t)GUL_USER_HUGE_PAGE_ADDR +
+			       data_ptr - huge_start_addr;
+		bbdev_ipc_op->in_addr = l1_pcie_addr;
+		bbdev_ipc_op->in_len = in_op_data->length;
+	}
+
+	if (out_op_data->data) {
+		data_ptr = rte_pktmbuf_mtod(out_op_data->data, char *);
+		l1_pcie_addr = (uint32_t)GUL_USER_HUGE_PAGE_ADDR +
+				data_ptr - huge_start_addr;
+		bbdev_ipc_op->out_addr = rte_cpu_to_be_32(l1_pcie_addr);
+		bbdev_ipc_op->out_len = rte_cpu_to_be_32(out_op_data->length);
+	}
+
+	/* Move Producer Index forward */
+	pi++;
+	/* Flip the PI flag, if wrapping */
+	if (unlikely(q_priv->queue_size == pi)) {
+		pi = 0;
+		pi_flag = pi_flag ? 0 : 1;
+	}
+
+	if (pi_flag)
+		IPC_SET_PI_FLAG(pi);
+	else
+		IPC_RESET_PI_FLAG(pi);
+	q_priv->host_pi = pi;
+
+	/* Wait for Data Copy & pi_flag update to complete before updating pi */
+	rte_mb();
+	/* now update pi */
+	md->pi = rte_cpu_to_be_32(pi);
+
+	rte_bbdev_dp_log(DEBUG, "enter: pi: %u, ci: %u,"
+			"pi_flag: %u, ci_flag: %u, ring size: %u",
+			pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	return 0;
+}
+
+/* Enqueue decode burst */
+static uint16_t
+enqueue_dec_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_dec_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	int nb_enqueued, ret;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ret = enqueue_single_op(q_priv, ops[nb_enqueued]);
+		if (ret)
+			break;
+	}
+
+	q_data->queue_stats.enqueue_err_count += nb_ops - nb_enqueued;
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
+/* Enqueue encode burst */
+static uint16_t
+enqueue_enc_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_enc_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	int nb_enqueued, ret;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ret = enqueue_single_op(q_priv, ops[nb_enqueued]);
+		if (ret)
+			break;
+	}
+
+	q_data->queue_stats.enqueue_err_count += nb_ops - nb_enqueued;
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
+/* Dequeue encode burst */
+static void *
+dequeue_single_op(struct bbdev_la12xx_q_priv *q_priv, void *dst)
+{
+	void *op;
+	uint32_t ci, ci_flag;
+	uint32_t temp_ci;
+
+	temp_ci = q_priv->host_params->ci;
+	if (temp_ci == q_priv->host_ci)
+		return NULL;
+
+	ci = IPC_GET_CI_INDEX(q_priv->host_ci);
+	ci_flag = IPC_GET_CI_FLAG(q_priv->host_ci);
+
+	rte_bbdev_dp_log(DEBUG,
+		"ci: %u, ci_flag: %u, ring size: %u",
+		ci, ci_flag, q_priv->queue_size);
+
+	op = q_priv->bbdev_op[ci];
+
+	rte_memcpy(dst, q_priv->msg_ch_vaddr[ci],
+		sizeof(struct bbdev_ipc_enqueue_op));
+
+	/* Move Consumer Index forward */
+	ci++;
+	/* Flip the CI flag, if wrapping */
+	if (q_priv->queue_size == ci) {
+		ci = 0;
+		ci_flag = ci_flag ? 0 : 1;
+	}
+	if (ci_flag)
+		IPC_SET_CI_FLAG(ci);
+	else
+		IPC_RESET_CI_FLAG(ci);
+
+	q_priv->host_ci = ci;
+
+	rte_bbdev_dp_log(DEBUG,
+		"exit: ci: %u, ci_flag: %u, ring size: %u",
+		ci, ci_flag, q_priv->queue_size);
+
+	return op;
+}
+
+/* Dequeue decode burst */
+static uint16_t
+dequeue_dec_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_dec_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	struct bbdev_ipc_enqueue_op bbdev_ipc_op;
+	int nb_dequeued;
+
+	for (nb_dequeued = 0; nb_dequeued < nb_ops; nb_dequeued++) {
+		ops[nb_dequeued] = dequeue_single_op(q_priv, &bbdev_ipc_op);
+		if (!ops[nb_dequeued])
+			break;
+		ops[nb_dequeued]->status = bbdev_ipc_op.status;
+	}
+	q_data->queue_stats.dequeued_count += nb_dequeued;
+
+	return nb_dequeued;
+}
+
+/* Dequeue encode burst */
+static uint16_t
+dequeue_enc_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_enc_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	struct bbdev_ipc_enqueue_op bbdev_ipc_op;
+	int nb_enqueued;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ops[nb_enqueued] = dequeue_single_op(q_priv, &bbdev_ipc_op);
+		if (!ops[nb_enqueued])
+			break;
+		ops[nb_enqueued]->status = bbdev_ipc_op.status;
+	}
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
 static struct hugepage_info *
 get_hugepage_info(void)
 {
@@ -715,6 +1031,10 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 	bbdev->dequeue_dec_ops = NULL;
 	bbdev->enqueue_enc_ops = NULL;
 	bbdev->enqueue_dec_ops = NULL;
+	bbdev->dequeue_ldpc_enc_ops = dequeue_enc_ops;
+	bbdev->dequeue_ldpc_dec_ops = dequeue_dec_ops;
+	bbdev->enqueue_ldpc_enc_ops = enqueue_enc_ops;
+	bbdev->enqueue_ldpc_dec_ops = enqueue_dec_ops;
 
 	return 0;
 }
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
index 5f613fb087..b6a7f677d0 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -73,6 +73,25 @@ typedef struct {
 	_IOWR(GUL_IPC_MAGIC, 5, struct ipc_msg *)
 #define IOCTL_GUL_IPC_CHANNEL_RAISE_INTERRUPT _IOW(GUL_IPC_MAGIC, 6, int *)
 
+#define GUL_USER_HUGE_PAGE_OFFSET	(0)
+#define GUL_PCI1_ADDR_BASE	(0x00000000ULL)
+
+#define GUL_USER_HUGE_PAGE_ADDR	(GUL_PCI1_ADDR_BASE + GUL_USER_HUGE_PAGE_OFFSET)
+
+/* IPC PI/CI index & flag manipulation helpers */
+#define IPC_PI_CI_FLAG_MASK	0x80000000 /*  (1<<31) */
+#define IPC_PI_CI_INDEX_MASK	0x7FFFFFFF /* ~(1<<31) */
+
+#define IPC_SET_PI_FLAG(x)	(x |= IPC_PI_CI_FLAG_MASK)
+#define IPC_RESET_PI_FLAG(x)	(x &= IPC_PI_CI_INDEX_MASK)
+#define IPC_GET_PI_FLAG(x)	(x >> 31)
+#define IPC_GET_PI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
+
+#define IPC_SET_CI_FLAG(x)	(x |= IPC_PI_CI_FLAG_MASK)
+#define IPC_RESET_CI_FLAG(x)	(x &= IPC_PI_CI_INDEX_MASK)
+#define IPC_GET_CI_FLAG(x)	(x >> 31)
+#define IPC_GET_CI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
+
 /** buffer ring common metadata */
 typedef struct ipc_bd_ring_md {
 	volatile uint32_t pi;		/**< Producer index and flag (MSB)
@@ -180,6 +199,24 @@ struct bbdev_ipc_enqueue_op {
 	uint32_t rsvd;
 };
 
+/** Structure specifying dequeue operation (dequeue at LA1224) */
+struct bbdev_ipc_dequeue_op {
+	/** Input buffer memory address */
+	uint32_t in_addr;
+	/** Input buffer memory length */
+	uint32_t in_len;
+	/** Output buffer memory address */
+	uint32_t out_addr;
+	/** Output buffer memory length */
+	uint32_t out_len;
+	/* Number of code blocks. Only set when HARQ is used */
+	uint32_t num_code_blocks;
+	/** Dequeue Operation flags */
+	uint32_t op_flags;
+	/** Shared metadata between L1 and L2 */
+	uint32_t shared_metadata;
+};
+
 /* This shared memory would be on the host side which have copy of some
  * of the parameters which are also part of Shared BD ring. Read access
  * of these parameters from the host side would not be over PCI.
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v9 7/8] app/bbdev: enable la12xx for bbdev
  2021-10-07  9:33 ` [dpdk-dev] [PATCH v9 0/8] baseband: add NXP LA12xx driver nipun.gupta
                     ` (5 preceding siblings ...)
  2021-10-07  9:33   ` [dpdk-dev] [PATCH v9 6/8] baseband/la12xx: add enqueue and dequeue support nipun.gupta
@ 2021-10-07  9:33   ` nipun.gupta
  2021-10-07  9:33   ` [dpdk-dev] [PATCH v9 8/8] app/bbdev: handle endianness of test data nipun.gupta
  7 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-07  9:33 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal

From: Hemant Agrawal <hemant.agrawal@nxp.com>

this patch adds la12xx driver in test bbdev

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/test-bbdev/meson.build | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/app/test-bbdev/meson.build b/app/test-bbdev/meson.build
index edb9deef84..a726a5b3fa 100644
--- a/app/test-bbdev/meson.build
+++ b/app/test-bbdev/meson.build
@@ -23,3 +23,6 @@ endif
 if dpdk_conf.has('RTE_BASEBAND_ACC100')
     deps += ['baseband_acc100']
 endif
+if dpdk_conf.has('RTE_LIBRTE_PMD_BBDEV_LA12XX')
+	deps += ['baseband_la12xx']
+endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v9 8/8] app/bbdev: handle endianness of test data
  2021-10-07  9:33 ` [dpdk-dev] [PATCH v9 0/8] baseband: add NXP LA12xx driver nipun.gupta
                     ` (6 preceding siblings ...)
  2021-10-07  9:33   ` [dpdk-dev] [PATCH v9 7/8] app/bbdev: enable la12xx for bbdev nipun.gupta
@ 2021-10-07  9:33   ` nipun.gupta
  7 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-07  9:33 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

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

With data input, output and harq also supported in big
endian format, this patch updates the testbbdev application
to handle the endianness conversion as directed by the
the driver being used.

The test vectors assumes the data in the little endian order, and
thus if the driver supports big endian data processing, conversion
from little endian to big is handled by the testbbdev application.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 app/test-bbdev/test_bbdev_perf.c | 43 ++++++++++++++++++++++++++++++++
 doc/guides/tools/testbbdev.rst   |  3 +++
 2 files changed, 46 insertions(+)

diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c
index 469597b8b3..05f12463a8 100644
--- a/app/test-bbdev/test_bbdev_perf.c
+++ b/app/test-bbdev/test_bbdev_perf.c
@@ -227,6 +227,45 @@ clear_soft_out_cap(uint32_t *op_flags)
 	*op_flags &= ~RTE_BBDEV_TURBO_NEG_LLR_1_BIT_SOFT_OUT;
 }
 
+/* This API is to convert all the test vector op data entries
+ * to big endian format. It is used when the device supports
+ * the input in the big endian format.
+ */
+static inline void
+convert_op_data_to_be(void)
+{
+	struct op_data_entries *op;
+	enum op_data_type type;
+	uint8_t nb_segs, *rem_data, temp;
+	uint32_t *data, len;
+	int complete, rem, i, j;
+
+	for (type = DATA_INPUT; type < DATA_NUM_TYPES; ++type) {
+		nb_segs = test_vector.entries[type].nb_segments;
+		op = &test_vector.entries[type];
+
+		/* Invert byte endianness for all the segments */
+		for (i = 0; i < nb_segs; ++i) {
+			len = op->segments[i].length;
+			data = op->segments[i].addr;
+
+			/* Swap complete u32 bytes */
+			complete = len / 4;
+			for (j = 0; j < complete; j++)
+				data[j] = rte_bswap32(data[j]);
+
+			/* Swap any remaining bytes */
+			rem = len % 4;
+			rem_data = (uint8_t *)&data[j];
+			for (j = 0; j < rem/2; j++) {
+				temp = rem_data[j];
+				rem_data[j] = rem_data[rem - j - 1];
+				rem_data[rem - j - 1] = temp;
+			}
+		}
+	}
+}
+
 static int
 check_dev_cap(const struct rte_bbdev_info *dev_info)
 {
@@ -234,6 +273,7 @@ check_dev_cap(const struct rte_bbdev_info *dev_info)
 	unsigned int nb_inputs, nb_soft_outputs, nb_hard_outputs,
 		nb_harq_inputs, nb_harq_outputs;
 	const struct rte_bbdev_op_cap *op_cap = dev_info->drv.capabilities;
+	uint8_t dev_data_endianness = dev_info->drv.data_endianness;
 
 	nb_inputs = test_vector.entries[DATA_INPUT].nb_segments;
 	nb_soft_outputs = test_vector.entries[DATA_SOFT_OUTPUT].nb_segments;
@@ -245,6 +285,9 @@ check_dev_cap(const struct rte_bbdev_info *dev_info)
 		if (op_cap->type != test_vector.op_type)
 			continue;
 
+		if (dev_data_endianness == RTE_BBDEV_BIG_ENDIAN)
+			convert_op_data_to_be();
+
 		if (op_cap->type == RTE_BBDEV_OP_TURBO_DEC) {
 			const struct rte_bbdev_op_cap_turbo_dec *cap =
 					&op_cap->cap.turbo_dec;
diff --git a/doc/guides/tools/testbbdev.rst b/doc/guides/tools/testbbdev.rst
index d397d991ff..83a0312062 100644
--- a/doc/guides/tools/testbbdev.rst
+++ b/doc/guides/tools/testbbdev.rst
@@ -332,6 +332,9 @@ Variable op_type has to be defined as a first variable in file. It specifies
 what type of operations will be executed. For 4G decoder op_type has to be set to
 ``RTE_BBDEV_OP_TURBO_DEC`` and for 4G encoder to ``RTE_BBDEV_OP_TURBO_ENC``.
 
+Bbdev-test adjusts the byte endianness based on the PMD capability (data_endianness)
+and all the test vectors input/output data are assumed to be LE by default
+
 Full details of the meaning and valid values for the below fields are
 documented in *rte_bbdev_op.h*
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v10 0/8] baseband: add NXP LA12xx driver
  2021-03-18  6:34 [dpdk-dev] [PATCH 1/6] baseband: introduce NXP LA12xx driver Hemant Agrawal
                   ` (11 preceding siblings ...)
  2021-10-07  9:33 ` [dpdk-dev] [PATCH v9 0/8] baseband: add NXP LA12xx driver nipun.gupta
@ 2021-10-11  4:32 ` nipun.gupta
  2021-10-11  4:32   ` [dpdk-dev] [PATCH v10 1/8] bbdev: add device info related to data endianness nipun.gupta
                     ` (7 more replies)
  2021-10-17  6:53 ` [dpdk-dev] [PATCH v11 0/8] baseband: add NXP LA12xx driver nipun.gupta
  13 siblings, 8 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-11  4:32 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal

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

This series introduces the BBDEV LA12xx poll mode driver (PMD) to support
an implementation for offloading High Phy processing functions like
LDPC Encode / Decode 5GNR wireless acceleration function, using PCI based
LA12xx Software defined radio.

Please check the documentation patch for more info.

The driver currently implements basic feature to offload only the 5G LDPC
encode/decode.

A new capability has been added to check if the driver can support the
input data in little/big endian byte order.

v2: add test case changes
v3: fix 32 bit compilation
v4: capability for network byte order, doc patch merged inline.
v5: add llr_size and llr_decimals, removed LLR compression flag,
    update testbbdev to handle endianness, rebased on top of 20.08
v6: added BE as device info instead of capability, updated test
    to have 2 codeblocks
v7: fixed checkpatch errors
v8: remove additional test vectors, update reverse_op function name,
    make be_support param as bool, other minor changes in la12xx driver
v9: add little endianness capability as well (patch by Nicolas Chautru),
    fix 32 bit (i386) compilation, fix get of nb_segs, add endianness
    info in testbbdev doc.
v10: use default RTE_BIG_ENDIAN/RTE_LITTLE_ENDIAN defined, add
     data_endianness info for BBDEV null device

Hemant Agrawal (6):
  baseband: introduce NXP LA12xx driver
  baseband/la12xx: add devargs for max queues
  baseband/la12xx: add support for multiple modems
  baseband/la12xx: add queue and modem config support
  baseband/la12xx: add enqueue and dequeue support
  app/bbdev: enable la12xx for bbdev

Nicolas Chautru (1):
  bbdev: add device info related to data endianness

Nipun Gupta (1):
  app/bbdev: handle endianness of test data

 MAINTAINERS                                   |   10 +
 app/test-bbdev/meson.build                    |    3 +
 app/test-bbdev/test_bbdev_perf.c              |   43 +
 doc/guides/bbdevs/features/la12xx.ini         |   13 +
 doc/guides/bbdevs/index.rst                   |    1 +
 doc/guides/bbdevs/la12xx.rst                  |  124 ++
 doc/guides/rel_notes/release_21_11.rst        |    6 +
 doc/guides/tools/testbbdev.rst                |    3 +
 drivers/baseband/acc100/rte_acc100_pmd.c      |    1 +
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         |    1 +
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |    1 +
 drivers/baseband/la12xx/bbdev_la12xx.c        | 1101 +++++++++++++++++
 drivers/baseband/la12xx/bbdev_la12xx.h        |   51 +
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h    |  244 ++++
 .../baseband/la12xx/bbdev_la12xx_pmd_logs.h   |   28 +
 drivers/baseband/la12xx/meson.build           |    6 +
 drivers/baseband/la12xx/version.map           |    3 +
 drivers/baseband/meson.build                  |    1 +
 drivers/baseband/null/bbdev_null.c            |    6 +
 .../baseband/turbo_sw/bbdev_turbo_software.c  |    1 +
 lib/bbdev/rte_bbdev.h                         |    4 +
 21 files changed, 1651 insertions(+)
 create mode 100644 doc/guides/bbdevs/features/la12xx.ini
 create mode 100644 doc/guides/bbdevs/la12xx.rst
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.c
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_ipc.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
 create mode 100644 drivers/baseband/la12xx/meson.build
 create mode 100644 drivers/baseband/la12xx/version.map

-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v10 1/8] bbdev: add device info related to data endianness
  2021-10-11  4:32 ` [dpdk-dev] [PATCH v10 0/8] baseband: add NXP LA12xx driver nipun.gupta
@ 2021-10-11  4:32   ` nipun.gupta
  2021-10-11  4:32   ` [dpdk-dev] [PATCH v10 2/8] baseband: introduce NXP LA12xx driver nipun.gupta
                     ` (6 subsequent siblings)
  7 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-11  4:32 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

From: Nicolas Chautru <nicolas.chautru@intel.com>

Adding device information to capture explicitly the assumption
of the input/output data byte endianness being processed.

Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 doc/guides/rel_notes/release_21_11.rst             | 1 +
 drivers/baseband/acc100/rte_acc100_pmd.c           | 1 +
 drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 1 +
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c       | 1 +
 drivers/baseband/null/bbdev_null.c                 | 6 ++++++
 drivers/baseband/turbo_sw/bbdev_turbo_software.c   | 1 +
 lib/bbdev/rte_bbdev.h                              | 4 ++++
 7 files changed, 15 insertions(+)

diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst
index c0a7f75518..135aa467f2 100644
--- a/doc/guides/rel_notes/release_21_11.rst
+++ b/doc/guides/rel_notes/release_21_11.rst
@@ -194,6 +194,7 @@ API Changes
   the crypto/security operation. This field will be used to communicate
   events such as soft expiry with IPsec in lookaside mode.
 
+* bbdev: Added device info related to data byte endianness processing.
 
 ABI Changes
 -----------
diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c
index 68ba523ea9..361e06cf94 100644
--- a/drivers/baseband/acc100/rte_acc100_pmd.c
+++ b/drivers/baseband/acc100/rte_acc100_pmd.c
@@ -1088,6 +1088,7 @@ acc100_dev_info_get(struct rte_bbdev *dev,
 #else
 	dev_info->harq_buffer_size = 0;
 #endif
+	dev_info->data_endianness = RTE_LITTLE_ENDIAN;
 	acc100_check_ir(d);
 }
 
diff --git a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
index 6485cc824a..ee457f3071 100644
--- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
+++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
@@ -372,6 +372,7 @@ fpga_dev_info_get(struct rte_bbdev *dev,
 	dev_info->default_queue_conf = default_queue_conf;
 	dev_info->capabilities = bbdev_capabilities;
 	dev_info->cpu_flag_reqs = NULL;
+	dev_info->data_endianness = RTE_LITTLE_ENDIAN;
 
 	/* Calculates number of queues assigned to device */
 	dev_info->max_num_queues = 0;
diff --git a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
index 350c4248eb..703bb611a0 100644
--- a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
+++ b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
@@ -644,6 +644,7 @@ fpga_dev_info_get(struct rte_bbdev *dev,
 	dev_info->default_queue_conf = default_queue_conf;
 	dev_info->capabilities = bbdev_capabilities;
 	dev_info->cpu_flag_reqs = NULL;
+	dev_info->data_endianness = RTE_LITTLE_ENDIAN;
 
 	/* Calculates number of queues assigned to device */
 	dev_info->max_num_queues = 0;
diff --git a/drivers/baseband/null/bbdev_null.c b/drivers/baseband/null/bbdev_null.c
index 53c538ba44..753d920e18 100644
--- a/drivers/baseband/null/bbdev_null.c
+++ b/drivers/baseband/null/bbdev_null.c
@@ -77,6 +77,12 @@ info_get(struct rte_bbdev *dev, struct rte_bbdev_driver_info *dev_info)
 	dev_info->cpu_flag_reqs = NULL;
 	dev_info->min_alignment = 0;
 
+	/* BBDEV null device does not process the data, so
+	 * endianness setting is not relevant, but setting it
+	 * here for code completeness.
+	 */
+	dev_info->data_endianness = RTE_LITTLE_ENDIAN;
+
 	rte_bbdev_log_debug("got device info from %u", dev->data->dev_id);
 }
 
diff --git a/drivers/baseband/turbo_sw/bbdev_turbo_software.c b/drivers/baseband/turbo_sw/bbdev_turbo_software.c
index 77e9a2ecbc..7dfeec665a 100644
--- a/drivers/baseband/turbo_sw/bbdev_turbo_software.c
+++ b/drivers/baseband/turbo_sw/bbdev_turbo_software.c
@@ -251,6 +251,7 @@ info_get(struct rte_bbdev *dev, struct rte_bbdev_driver_info *dev_info)
 	dev_info->capabilities = bbdev_capabilities;
 	dev_info->min_alignment = 64;
 	dev_info->harq_buffer_size = 0;
+	dev_info->data_endianness = RTE_LITTLE_ENDIAN;
 
 	rte_bbdev_log_debug("got device info from %u\n", dev->data->dev_id);
 }
diff --git a/lib/bbdev/rte_bbdev.h b/lib/bbdev/rte_bbdev.h
index 3ebf62e697..e863bd913f 100644
--- a/lib/bbdev/rte_bbdev.h
+++ b/lib/bbdev/rte_bbdev.h
@@ -309,6 +309,10 @@ struct rte_bbdev_driver_info {
 	uint16_t min_alignment;
 	/** HARQ memory available in kB */
 	uint32_t harq_buffer_size;
+	/** Byte endianness (RTE_BIG_ENDIAN/RTE_LITTLE_ENDIAN) supported
+	 *  for input/output data
+	 */
+	uint8_t data_endianness;
 	/** Default queue configuration used if none is supplied  */
 	struct rte_bbdev_queue_conf default_queue_conf;
 	/** Device operation capabilities */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v10 2/8] baseband: introduce NXP LA12xx driver
  2021-10-11  4:32 ` [dpdk-dev] [PATCH v10 0/8] baseband: add NXP LA12xx driver nipun.gupta
  2021-10-11  4:32   ` [dpdk-dev] [PATCH v10 1/8] bbdev: add device info related to data endianness nipun.gupta
@ 2021-10-11  4:32   ` nipun.gupta
  2021-10-16 13:58     ` [dpdk-dev] [EXT] " Akhil Goyal
  2021-10-11  4:32   ` [dpdk-dev] [PATCH v10 3/8] baseband/la12xx: add devargs for max queues nipun.gupta
                     ` (5 subsequent siblings)
  7 siblings, 1 reply; 157+ messages in thread
From: nipun.gupta @ 2021-10-11  4:32 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This patch introduce the baseband device drivers for NXP's
LA1200 series software defined baseband modem.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 MAINTAINERS                                   |   9 ++
 drivers/baseband/la12xx/bbdev_la12xx.c        | 108 ++++++++++++++++++
 .../baseband/la12xx/bbdev_la12xx_pmd_logs.h   |  28 +++++
 drivers/baseband/la12xx/meson.build           |   6 +
 drivers/baseband/la12xx/version.map           |   3 +
 drivers/baseband/meson.build                  |   1 +
 6 files changed, 155 insertions(+)
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.c
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
 create mode 100644 drivers/baseband/la12xx/meson.build
 create mode 100644 drivers/baseband/la12xx/version.map

diff --git a/MAINTAINERS b/MAINTAINERS
index 278e5b3226..25eec751bb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1289,6 +1289,15 @@ F: drivers/event/opdl/
 F: doc/guides/eventdevs/opdl.rst
 
 
+Baseband Drivers
+----------------
+
+NXP LA12xx driver
+M: Nipun Gupta <nipun.gupta@nxp.com>
+M: Hemant Agrawal <hemant.agrawal@nxp.com>
+F: drivers/baseband/la12xx/
+
+
 Rawdev Drivers
 --------------
 
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
new file mode 100644
index 0000000000..d3d7a4df37
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -0,0 +1,108 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+
+#include <string.h>
+
+#include <rte_common.h>
+#include <rte_bus_vdev.h>
+#include <rte_malloc.h>
+#include <rte_ring.h>
+#include <rte_kvargs.h>
+
+#include <rte_bbdev.h>
+#include <rte_bbdev_pmd.h>
+
+#include <bbdev_la12xx_pmd_logs.h>
+
+#define DRIVER_NAME baseband_la12xx
+
+/* private data structure */
+struct bbdev_la12xx_private {
+	unsigned int max_nb_queues;  /**< Max number of queues */
+};
+/* Create device */
+static int
+la12xx_bbdev_create(struct rte_vdev_device *vdev)
+{
+	struct rte_bbdev *bbdev;
+	const char *name = rte_vdev_device_name(vdev);
+
+	PMD_INIT_FUNC_TRACE();
+
+	bbdev = rte_bbdev_allocate(name);
+	if (bbdev == NULL)
+		return -ENODEV;
+
+	bbdev->data->dev_private = rte_zmalloc(name,
+			sizeof(struct bbdev_la12xx_private),
+			RTE_CACHE_LINE_SIZE);
+	if (bbdev->data->dev_private == NULL) {
+		rte_bbdev_release(bbdev);
+		return -ENOMEM;
+	}
+
+	bbdev->dev_ops = NULL;
+	bbdev->device = &vdev->device;
+	bbdev->data->socket_id = 0;
+	bbdev->intr_handle = NULL;
+
+	/* register rx/tx burst functions for data path */
+	bbdev->dequeue_enc_ops = NULL;
+	bbdev->dequeue_dec_ops = NULL;
+	bbdev->enqueue_enc_ops = NULL;
+	bbdev->enqueue_dec_ops = NULL;
+
+	return 0;
+}
+
+/* Initialise device */
+static int
+la12xx_bbdev_probe(struct rte_vdev_device *vdev)
+{
+	const char *name;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (vdev == NULL)
+		return -EINVAL;
+
+	name = rte_vdev_device_name(vdev);
+	if (name == NULL)
+		return -EINVAL;
+
+	return la12xx_bbdev_create(vdev);
+}
+
+/* Uninitialise device */
+static int
+la12xx_bbdev_remove(struct rte_vdev_device *vdev)
+{
+	struct rte_bbdev *bbdev;
+	const char *name;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (vdev == NULL)
+		return -EINVAL;
+
+	name = rte_vdev_device_name(vdev);
+	if (name == NULL)
+		return -EINVAL;
+
+	bbdev = rte_bbdev_get_named_dev(name);
+	if (bbdev == NULL)
+		return -EINVAL;
+
+	rte_free(bbdev->data->dev_private);
+
+	return rte_bbdev_release(bbdev);
+}
+
+static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
+	.probe = la12xx_bbdev_probe,
+	.remove = la12xx_bbdev_remove
+};
+
+RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
+RTE_LOG_REGISTER_DEFAULT(bbdev_la12xx_logtype, NOTICE);
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h b/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
new file mode 100644
index 0000000000..452435ccb9
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020 NXP
+ */
+
+#ifndef _BBDEV_LA12XX_PMD_LOGS_H_
+#define _BBDEV_LA12XX_PMD_LOGS_H_
+
+extern int bbdev_la12xx_logtype;
+
+#define rte_bbdev_log(level, fmt, ...) \
+	rte_log(RTE_LOG_ ## level, bbdev_la12xx_logtype, fmt "\n", \
+		##__VA_ARGS__)
+
+#ifdef RTE_LIBRTE_BBDEV_DEBUG
+#define rte_bbdev_log_debug(fmt, ...) \
+		rte_bbdev_log(DEBUG, "la12xx_pmd: " fmt, \
+		##__VA_ARGS__)
+#else
+#define rte_bbdev_log_debug(fmt, ...)
+#endif
+
+#define PMD_INIT_FUNC_TRACE() rte_bbdev_log_debug(">>")
+
+/* DP Logs, toggled out at compile time if level lower than current level */
+#define rte_bbdev_dp_log(level, fmt, args...) \
+	RTE_LOG_DP(level, PMD, fmt, ## args)
+
+#endif /* _BBDEV_LA12XX_PMD_LOGS_H_ */
diff --git a/drivers/baseband/la12xx/meson.build b/drivers/baseband/la12xx/meson.build
new file mode 100644
index 0000000000..7a017dcffa
--- /dev/null
+++ b/drivers/baseband/la12xx/meson.build
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020-2021 NXP
+
+deps += ['bbdev', 'bus_vdev', 'ring']
+
+sources = files('bbdev_la12xx.c')
diff --git a/drivers/baseband/la12xx/version.map b/drivers/baseband/la12xx/version.map
new file mode 100644
index 0000000000..4a76d1d52d
--- /dev/null
+++ b/drivers/baseband/la12xx/version.map
@@ -0,0 +1,3 @@
+DPDK_21 {
+	local: *;
+};
diff --git a/drivers/baseband/meson.build b/drivers/baseband/meson.build
index 5ee61d5323..ccd1eebc3b 100644
--- a/drivers/baseband/meson.build
+++ b/drivers/baseband/meson.build
@@ -11,6 +11,7 @@ drivers = [
         'fpga_lte_fec',
         'null',
         'turbo_sw',
+        'la12xx',
 ]
 
 log_prefix = 'pmd.bb'
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v10 3/8] baseband/la12xx: add devargs for max queues
  2021-10-11  4:32 ` [dpdk-dev] [PATCH v10 0/8] baseband: add NXP LA12xx driver nipun.gupta
  2021-10-11  4:32   ` [dpdk-dev] [PATCH v10 1/8] bbdev: add device info related to data endianness nipun.gupta
  2021-10-11  4:32   ` [dpdk-dev] [PATCH v10 2/8] baseband: introduce NXP LA12xx driver nipun.gupta
@ 2021-10-11  4:32   ` nipun.gupta
  2021-10-16 14:00     ` [dpdk-dev] [EXT] " Akhil Goyal
  2021-10-11  4:32   ` [dpdk-dev] [PATCH v10 4/8] baseband/la12xx: add support for multiple modems nipun.gupta
                     ` (4 subsequent siblings)
  7 siblings, 1 reply; 157+ messages in thread
From: nipun.gupta @ 2021-10-11  4:32 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This patch adds dev args to take  max queues as input

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c | 73 +++++++++++++++++++++++++-
 1 file changed, 71 insertions(+), 2 deletions(-)

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index d3d7a4df37..f5c835eeb8 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -17,13 +17,73 @@
 
 #define DRIVER_NAME baseband_la12xx
 
+/*  Initialisation params structure that can be used by LA12xx BBDEV driver */
+struct bbdev_la12xx_params {
+	uint8_t queues_num; /*< LA12xx BBDEV queues number */
+};
+
+#define LA12XX_MAX_NB_QUEUES_ARG	"max_nb_queues"
+
+static const char * const bbdev_la12xx_valid_params[] = {
+	LA12XX_MAX_NB_QUEUES_ARG,
+};
+
 /* private data structure */
 struct bbdev_la12xx_private {
 	unsigned int max_nb_queues;  /**< Max number of queues */
 };
+static inline int
+parse_u16_arg(const char *key, const char *value, void *extra_args)
+{
+	uint16_t *u16 = extra_args;
+
+	uint64_t result;
+	if ((value == NULL) || (extra_args == NULL))
+		return -EINVAL;
+	errno = 0;
+	result = strtoul(value, NULL, 0);
+	if ((result >= (1 << 16)) || (errno != 0)) {
+		rte_bbdev_log(ERR, "Invalid value %" PRIu64 " for %s",
+			      result, key);
+		return -ERANGE;
+	}
+	*u16 = (uint16_t)result;
+	return 0;
+}
+
+/* Parse parameters used to create device */
+static int
+parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
+		const char *input_args)
+{
+	struct rte_kvargs *kvlist = NULL;
+	int ret = 0;
+
+	if (params == NULL)
+		return -EINVAL;
+	if (input_args) {
+		kvlist = rte_kvargs_parse(input_args,
+				bbdev_la12xx_valid_params);
+		if (kvlist == NULL)
+			return -EFAULT;
+
+		ret = rte_kvargs_process(kvlist, bbdev_la12xx_valid_params[0],
+					&parse_u16_arg, &params->queues_num);
+		if (ret < 0)
+			goto exit;
+
+	}
+
+exit:
+	if (kvlist)
+		rte_kvargs_free(kvlist);
+	return ret;
+}
+
 /* Create device */
 static int
-la12xx_bbdev_create(struct rte_vdev_device *vdev)
+la12xx_bbdev_create(struct rte_vdev_device *vdev,
+		struct bbdev_la12xx_params *init_params __rte_unused)
 {
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
@@ -60,7 +120,11 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev)
 static int
 la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 {
+	struct bbdev_la12xx_params init_params = {
+		8
+	};
 	const char *name;
+	const char *input_args;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -71,7 +135,10 @@ la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 	if (name == NULL)
 		return -EINVAL;
 
-	return la12xx_bbdev_create(vdev);
+	input_args = rte_vdev_device_args(vdev);
+	parse_bbdev_la12xx_params(&init_params, input_args);
+
+	return la12xx_bbdev_create(vdev, &init_params);
 }
 
 /* Uninitialise device */
@@ -105,4 +172,6 @@ static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
 };
 
 RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
+RTE_PMD_REGISTER_PARAM_STRING(DRIVER_NAME,
+	LA12XX_MAX_NB_QUEUES_ARG"=<int>");
 RTE_LOG_REGISTER_DEFAULT(bbdev_la12xx_logtype, NOTICE);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v10 4/8] baseband/la12xx: add support for multiple modems
  2021-10-11  4:32 ` [dpdk-dev] [PATCH v10 0/8] baseband: add NXP LA12xx driver nipun.gupta
                     ` (2 preceding siblings ...)
  2021-10-11  4:32   ` [dpdk-dev] [PATCH v10 3/8] baseband/la12xx: add devargs for max queues nipun.gupta
@ 2021-10-11  4:32   ` nipun.gupta
  2021-10-11  4:32   ` [dpdk-dev] [PATCH v10 5/8] baseband/la12xx: add queue and modem config support nipun.gupta
                     ` (3 subsequent siblings)
  7 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-11  4:32 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This patch add support for multiple modems by assigning
a modem id as dev args in vdev creation.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c     | 64 +++++++++++++++++++---
 drivers/baseband/la12xx/bbdev_la12xx.h     | 56 +++++++++++++++++++
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 20 +++++++
 3 files changed, 133 insertions(+), 7 deletions(-)
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_ipc.h

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index f5c835eeb8..58defa54f0 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -14,24 +14,26 @@
 #include <rte_bbdev_pmd.h>
 
 #include <bbdev_la12xx_pmd_logs.h>
+#include <bbdev_la12xx_ipc.h>
+#include <bbdev_la12xx.h>
 
 #define DRIVER_NAME baseband_la12xx
 
 /*  Initialisation params structure that can be used by LA12xx BBDEV driver */
 struct bbdev_la12xx_params {
 	uint8_t queues_num; /*< LA12xx BBDEV queues number */
+	int8_t modem_id; /*< LA12xx modem instance id */
 };
 
 #define LA12XX_MAX_NB_QUEUES_ARG	"max_nb_queues"
+#define LA12XX_VDEV_MODEM_ID_ARG	"modem"
+#define LA12XX_MAX_MODEM 4
 
 static const char * const bbdev_la12xx_valid_params[] = {
 	LA12XX_MAX_NB_QUEUES_ARG,
+	LA12XX_VDEV_MODEM_ID_ARG,
 };
 
-/* private data structure */
-struct bbdev_la12xx_private {
-	unsigned int max_nb_queues;  /**< Max number of queues */
-};
 static inline int
 parse_u16_arg(const char *key, const char *value, void *extra_args)
 {
@@ -51,6 +53,28 @@ parse_u16_arg(const char *key, const char *value, void *extra_args)
 	return 0;
 }
 
+/* Parse integer from integer argument */
+static int
+parse_integer_arg(const char *key __rte_unused,
+		const char *value, void *extra_args)
+{
+	int i;
+	char *end;
+
+	errno = 0;
+
+	i = strtol(value, &end, 10);
+	if (*end != 0 || errno != 0 || i < 0 || i > LA12XX_MAX_MODEM) {
+		rte_bbdev_log(ERR, "Supported Port IDS are 0 to %d",
+			LA12XX_MAX_MODEM - 1);
+		return -EINVAL;
+	}
+
+	*((uint32_t *)extra_args) = i;
+
+	return 0;
+}
+
 /* Parse parameters used to create device */
 static int
 parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
@@ -72,6 +96,16 @@ parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
 		if (ret < 0)
 			goto exit;
 
+		ret = rte_kvargs_process(kvlist,
+					bbdev_la12xx_valid_params[1],
+					&parse_integer_arg,
+					&params->modem_id);
+
+		if (params->modem_id >= LA12XX_MAX_MODEM) {
+			rte_bbdev_log(ERR, "Invalid modem id, must be < %u",
+					LA12XX_MAX_MODEM);
+			goto exit;
+		}
 	}
 
 exit:
@@ -83,10 +117,11 @@ parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
 /* Create device */
 static int
 la12xx_bbdev_create(struct rte_vdev_device *vdev,
-		struct bbdev_la12xx_params *init_params __rte_unused)
+		struct bbdev_la12xx_params *init_params)
 {
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
+	struct bbdev_la12xx_private *priv;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -102,6 +137,20 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 		return -ENOMEM;
 	}
 
+	priv = bbdev->data->dev_private;
+	priv->modem_id = init_params->modem_id;
+	/* if modem id is not configured */
+	if (priv->modem_id == -1)
+		priv->modem_id = bbdev->data->dev_id;
+
+	/* Reset Global variables */
+	priv->num_ldpc_enc_queues = 0;
+	priv->num_ldpc_dec_queues = 0;
+	priv->num_valid_queues = 0;
+	priv->max_nb_queues = init_params->queues_num;
+
+	rte_bbdev_log(INFO, "Setting Up %s: DevId=%d, ModemId=%d",
+				name, bbdev->data->dev_id, priv->modem_id);
 	bbdev->dev_ops = NULL;
 	bbdev->device = &vdev->device;
 	bbdev->data->socket_id = 0;
@@ -121,7 +170,7 @@ static int
 la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 {
 	struct bbdev_la12xx_params init_params = {
-		8
+		8, -1,
 	};
 	const char *name;
 	const char *input_args;
@@ -173,5 +222,6 @@ static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
 
 RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
 RTE_PMD_REGISTER_PARAM_STRING(DRIVER_NAME,
-	LA12XX_MAX_NB_QUEUES_ARG"=<int>");
+	LA12XX_MAX_NB_QUEUES_ARG"=<int>"
+	LA12XX_VDEV_MODEM_ID_ARG "=<int> ");
 RTE_LOG_REGISTER_DEFAULT(bbdev_la12xx_logtype, NOTICE);
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.h b/drivers/baseband/la12xx/bbdev_la12xx.h
new file mode 100644
index 0000000000..5228502331
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx.h
@@ -0,0 +1,56 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+
+#ifndef __BBDEV_LA12XX_H__
+#define __BBDEV_LA12XX_H__
+
+#define BBDEV_IPC_ENC_OP_TYPE	1
+#define BBDEV_IPC_DEC_OP_TYPE	2
+
+#define MAX_LDPC_ENC_FECA_QUEUES	4
+#define MAX_LDPC_DEC_FECA_QUEUES	4
+
+#define MAX_CHANNEL_DEPTH 16
+/* private data structure */
+struct bbdev_la12xx_private {
+	void *ipc_priv;
+	uint8_t num_valid_queues;
+	uint8_t max_nb_queues;
+	uint8_t num_ldpc_enc_queues;
+	uint8_t num_ldpc_dec_queues;
+	int8_t modem_id;
+	struct bbdev_la12xx_q_priv *queues_priv[32];
+};
+
+struct hugepage_info {
+	void *vaddr;
+	phys_addr_t paddr;
+	size_t len;
+};
+
+struct bbdev_la12xx_q_priv {
+	struct bbdev_la12xx_private *bbdev_priv;
+	uint32_t q_id;	/**< Channel ID */
+	uint32_t feca_blk_id;	/** FECA block ID for processing */
+	uint32_t feca_blk_id_be32; /**< FECA Block ID for this queue */
+	uint8_t en_napi; /* 0: napi disabled, 1: napi enabled */
+	uint16_t queue_size;	/**< Queue depth */
+	int32_t eventfd;	/**< Event FD value */
+	enum rte_bbdev_op_type op_type; /**< Operation type */
+	uint32_t la12xx_core_id;
+		/* LA12xx core ID on which this will be scheduled */
+	struct rte_mempool *mp; /**< Pool from where buffers would be cut */
+	void *bbdev_op[MAX_CHANNEL_DEPTH];
+			/**< Stores bbdev op for each index */
+	void *msg_ch_vaddr[MAX_CHANNEL_DEPTH];
+			/**< Stores msg channel addr for modem->host */
+	uint32_t host_pi;	/**< Producer_Index for HOST->MODEM */
+	uint32_t host_ci;	/**< Consumer Index for MODEM->HOST */
+	host_ipc_params_t *host_params; /**< Host parameters */
+};
+
+#define lower_32_bits(x) ((uint32_t)((uint64_t)x))
+#define upper_32_bits(x) ((uint32_t)(((uint64_t)(x) >> 16) >> 16))
+
+#endif
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
new file mode 100644
index 0000000000..9aa5562981
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+#ifndef __BBDEV_LA12XX_IPC_H__
+#define __BBDEV_LA12XX_IPC_H__
+
+/** No. of max channel per instance */
+#define IPC_MAX_DEPTH	(16)
+
+/* This shared memory would be on the host side which have copy of some
+ * of the parameters which are also part of Shared BD ring. Read access
+ * of these parameters from the host side would not be over PCI.
+ */
+typedef struct host_ipc_params {
+	volatile uint32_t pi;
+	volatile uint32_t ci;
+	volatile uint32_t modem_ptr[IPC_MAX_DEPTH];
+} __rte_packed host_ipc_params_t;
+
+#endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v10 5/8] baseband/la12xx: add queue and modem config support
  2021-10-11  4:32 ` [dpdk-dev] [PATCH v10 0/8] baseband: add NXP LA12xx driver nipun.gupta
                     ` (3 preceding siblings ...)
  2021-10-11  4:32   ` [dpdk-dev] [PATCH v10 4/8] baseband/la12xx: add support for multiple modems nipun.gupta
@ 2021-10-11  4:32   ` nipun.gupta
  2021-10-16 14:13     ` [dpdk-dev] [EXT] " Akhil Goyal
  2021-10-11  4:32   ` [dpdk-dev] [PATCH v10 6/8] baseband/la12xx: add enqueue and dequeue support nipun.gupta
                     ` (2 subsequent siblings)
  7 siblings, 1 reply; 157+ messages in thread
From: nipun.gupta @ 2021-10-11  4:32 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This patch add support for connecting with modem
and creating the ipc channel as queues with modem
for the exchange of data.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 MAINTAINERS                                |   1 +
 doc/guides/bbdevs/index.rst                |   1 +
 doc/guides/bbdevs/la12xx.rst               |  80 +++
 doc/guides/rel_notes/release_21_11.rst     |   5 +
 drivers/baseband/la12xx/bbdev_la12xx.c     | 556 ++++++++++++++++++++-
 drivers/baseband/la12xx/bbdev_la12xx.h     |  17 +-
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 189 ++++++-
 7 files changed, 836 insertions(+), 13 deletions(-)
 create mode 100644 doc/guides/bbdevs/la12xx.rst

diff --git a/MAINTAINERS b/MAINTAINERS
index 25eec751bb..7030147767 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1296,6 +1296,7 @@ NXP LA12xx driver
 M: Nipun Gupta <nipun.gupta@nxp.com>
 M: Hemant Agrawal <hemant.agrawal@nxp.com>
 F: drivers/baseband/la12xx/
+F: doc/guides/bbdevs/la12xx.rst
 
 
 Rawdev Drivers
diff --git a/doc/guides/bbdevs/index.rst b/doc/guides/bbdevs/index.rst
index 4445cbd1b0..cedd706fa6 100644
--- a/doc/guides/bbdevs/index.rst
+++ b/doc/guides/bbdevs/index.rst
@@ -14,3 +14,4 @@ Baseband Device Drivers
     fpga_lte_fec
     fpga_5gnr_fec
     acc100
+    la12xx
diff --git a/doc/guides/bbdevs/la12xx.rst b/doc/guides/bbdevs/la12xx.rst
new file mode 100644
index 0000000000..1a711ef5e3
--- /dev/null
+++ b/doc/guides/bbdevs/la12xx.rst
@@ -0,0 +1,80 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright 2021 NXP
+
+NXP LA12xx Poll Mode Driver
+=======================================
+
+The BBDEV LA12xx poll mode driver (PMD) supports an implementation for
+offloading High Phy processing functions like LDPC Encode / Decode 5GNR wireless
+acceleration function, using PCI based LA12xx Software defined radio.
+
+More information can be found at `NXP Official Website
+<https://www.nxp.com/products/processors-and-microcontrollers/arm-processors/layerscape-processors/layerscape-access-la1200-programmable-baseband-processor:LA1200>`_.
+
+Features
+--------
+
+LA12xx PMD supports the following features:
+
+- Maximum of 8 LDPC decode (UL) queues
+- Maximum of 8 LDPC encode (DL) queues
+- PCIe Gen-3 x8 Interface
+
+Installation
+------------
+
+Section 3 of the DPDK manual provides instructions on installing and compiling DPDK.
+
+DPDK requires hugepages to be configured as detailed in section 2 of the DPDK manual.
+
+Initialization
+--------------
+
+The device can be listed on the host console with:
+
+
+Use the following lspci command to get the multiple LA12xx processor ids. The
+device ID of the LA12xx baseband processor is "1c30".
+
+.. code-block:: console
+
+  sudo lspci -nn
+
+...
+0001:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device [1957:1c30] (
+rev 10)
+...
+0002:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device [1957:1c30] (
+rev 10)
+
+
+Prerequisites
+-------------
+
+Currently supported by DPDK:
+
+- NXP LA1224 BSP **1.0+**.
+- NXP LA1224 PCIe Modem card connected to ARM host.
+
+- Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup the basic DPDK environment.
+
+* Use dev arg option ``modem=0`` to identify the modem instance for a given
+  device. This is required only if more than 1 modem cards are attached to host.
+  this is optional and the default value is 0.
+  e.g. ``--vdev=baseband_la12xx,modem=0``
+
+* Use dev arg option ``max_nb_queues=x`` to specify the maximum number of queues
+  to be used for communication with offload device i.e. modem. default is 16.
+  e.g. ``--vdev=baseband_la12xx,max_nb_queues=4``
+
+Enabling logs
+-------------
+
+For enabling logs, use the following EAL parameter:
+
+.. code-block:: console
+
+   ./your_bbdev_application <EAL args> --log-level=la12xx:<level>
+
+Using ``bb.la12xx`` as log matching criteria, all Baseband PMD logs can be
+enabled which are lower than logging ``level``.
diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst
index 135aa467f2..f4cae1b760 100644
--- a/doc/guides/rel_notes/release_21_11.rst
+++ b/doc/guides/rel_notes/release_21_11.rst
@@ -134,6 +134,11 @@ New Features
   * Added tests to validate packets hard expiry.
   * Added tests to verify tunnel header verification in IPsec inbound.
 
+* **Added NXP LA12xx baseband PMD.**
+
+  * Added a new baseband PMD driver for NXP LA12xx Software defined radio.
+  * See the :doc:`../bbdevs/la12xx` for more details.
+
 
 Removed Items
 -------------
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 58defa54f0..9fad7462e8 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -3,6 +3,11 @@
  */
 
 #include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <dirent.h>
 
 #include <rte_common.h>
 #include <rte_bus_vdev.h>
@@ -29,11 +34,553 @@ struct bbdev_la12xx_params {
 #define LA12XX_VDEV_MODEM_ID_ARG	"modem"
 #define LA12XX_MAX_MODEM 4
 
+#define LA12XX_MAX_CORES	4
+#define LA12XX_LDPC_ENC_CORE	0
+#define LA12XX_LDPC_DEC_CORE	1
+
+#define LA12XX_MAX_LDPC_ENC_QUEUES	4
+#define LA12XX_MAX_LDPC_DEC_QUEUES	4
+
 static const char * const bbdev_la12xx_valid_params[] = {
 	LA12XX_MAX_NB_QUEUES_ARG,
 	LA12XX_VDEV_MODEM_ID_ARG,
 };
 
+static const struct rte_bbdev_op_cap bbdev_capabilities[] = {
+	{
+		.type   = RTE_BBDEV_OP_LDPC_ENC,
+		.cap.ldpc_enc = {
+			.capability_flags =
+					RTE_BBDEV_LDPC_RATE_MATCH |
+					RTE_BBDEV_LDPC_CRC_24A_ATTACH |
+					RTE_BBDEV_LDPC_CRC_24B_ATTACH,
+			.num_buffers_src =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+			.num_buffers_dst =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+		}
+	},
+	{
+		.type   = RTE_BBDEV_OP_LDPC_DEC,
+		.cap.ldpc_dec = {
+			.capability_flags =
+				RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK |
+					RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK |
+					RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP,
+			.num_buffers_src =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+			.num_buffers_hard_out =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+			.llr_size = 8,
+			.llr_decimals = 1,
+		}
+	},
+	RTE_BBDEV_END_OF_CAPABILITIES_LIST()
+};
+
+static struct rte_bbdev_queue_conf default_queue_conf = {
+	.queue_size = MAX_CHANNEL_DEPTH,
+};
+
+/* Get device info */
+static void
+la12xx_info_get(struct rte_bbdev *dev __rte_unused,
+		struct rte_bbdev_driver_info *dev_info)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	dev_info->driver_name = RTE_STR(DRIVER_NAME);
+	dev_info->max_num_queues = LA12XX_MAX_QUEUES;
+	dev_info->queue_size_lim = MAX_CHANNEL_DEPTH;
+	dev_info->hardware_accelerated = true;
+	dev_info->max_dl_queue_priority = 0;
+	dev_info->max_ul_queue_priority = 0;
+	dev_info->data_endianness = RTE_BIG_ENDIAN;
+	dev_info->default_queue_conf = default_queue_conf;
+	dev_info->capabilities = bbdev_capabilities;
+	dev_info->cpu_flag_reqs = NULL;
+	dev_info->min_alignment = 64;
+
+	rte_bbdev_log_debug("got device info from %u", dev->data->dev_id);
+}
+
+/* Release queue */
+static int
+la12xx_queue_release(struct rte_bbdev *dev, uint16_t q_id)
+{
+	RTE_SET_USED(dev);
+	RTE_SET_USED(q_id);
+
+	PMD_INIT_FUNC_TRACE();
+
+	return 0;
+}
+
+#define HUGEPG_OFFSET(A) \
+		((uint64_t) ((unsigned long) (A) \
+		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
+
+static int ipc_queue_configure(uint32_t channel_id,
+		ipc_t instance, struct bbdev_la12xx_q_priv *q_priv)
+{
+	ipc_userspace_t *ipc_priv = (ipc_userspace_t *)instance;
+	ipc_instance_t *ipc_instance = ipc_priv->instance;
+	ipc_ch_t *ch;
+	void *vaddr;
+	uint32_t i = 0;
+	uint32_t msg_size = sizeof(struct bbdev_ipc_enqueue_op);
+
+	PMD_INIT_FUNC_TRACE();
+
+	rte_bbdev_log_debug("%x %p", ipc_instance->initialized,
+		ipc_priv->instance);
+	ch = &(ipc_instance->ch_list[channel_id]);
+
+	rte_bbdev_log_debug("channel: %u, depth: %u, msg size: %u",
+		channel_id, q_priv->queue_size, msg_size);
+
+	/* Start init of channel */
+	ch->md.ring_size = rte_cpu_to_be_32(q_priv->queue_size);
+	ch->md.pi = 0;
+	ch->md.ci = 0;
+	ch->md.msg_size = msg_size;
+	for (i = 0; i < q_priv->queue_size; i++) {
+		vaddr = rte_malloc(NULL, msg_size, RTE_CACHE_LINE_SIZE);
+		if (!vaddr)
+			return IPC_HOST_BUF_ALLOC_FAIL;
+		/* Only offset now */
+		ch->bd_h[i].modem_ptr =
+			rte_cpu_to_be_32(HUGEPG_OFFSET(vaddr));
+		ch->bd_h[i].host_virt_l = lower_32_bits(vaddr);
+		ch->bd_h[i].host_virt_h = upper_32_bits(vaddr);
+		q_priv->msg_ch_vaddr[i] = vaddr;
+		/* Not sure use of this len may be for CRC*/
+		ch->bd_h[i].len = 0;
+	}
+	ch->host_ipc_params =
+		rte_cpu_to_be_32(HUGEPG_OFFSET(q_priv->host_params));
+
+	rte_bbdev_log_debug("Channel configured");
+	return IPC_SUCCESS;
+}
+
+static int
+la12xx_e200_queue_setup(struct rte_bbdev *dev,
+		struct bbdev_la12xx_q_priv *q_priv)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	struct gul_hif *mhif;
+	ipc_metadata_t *ipc_md;
+	ipc_ch_t *ch;
+	int instance_id = 0, i;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		q_priv->la12xx_core_id = LA12XX_LDPC_ENC_CORE;
+		break;
+	case RTE_BBDEV_OP_LDPC_DEC:
+		q_priv->la12xx_core_id = LA12XX_LDPC_DEC_CORE;
+		break;
+	default:
+		rte_bbdev_log(ERR, "Unsupported op type\n");
+		return -1;
+	}
+
+	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+	/* offset is from start of PEB */
+	ipc_md = (ipc_metadata_t *)((uintptr_t)ipc_priv->peb_start.host_vaddr +
+		mhif->ipc_regs.ipc_mdata_offset);
+	ch = &ipc_md->instance_list[instance_id].ch_list[q_priv->q_id];
+
+	if (q_priv->q_id < priv->num_valid_queues) {
+		ipc_br_md_t *md = &(ch->md);
+
+		q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
+		q_priv->feca_blk_id_be32 = ch->feca_blk_id;
+		q_priv->host_pi = rte_be_to_cpu_32(md->pi);
+		q_priv->host_ci = rte_be_to_cpu_32(md->ci);
+		q_priv->host_params = (host_ipc_params_t *)(uintptr_t)
+			(rte_be_to_cpu_32(ch->host_ipc_params) +
+			((uint64_t)ipc_priv->hugepg_start.host_vaddr));
+
+		for (i = 0; i < q_priv->queue_size; i++) {
+			uint32_t h, l;
+
+			h = ch->bd_h[i].host_virt_h;
+			l = ch->bd_h[i].host_virt_l;
+			q_priv->msg_ch_vaddr[i] = (void *)join_32_bits(h, l);
+		}
+
+		rte_bbdev_log(WARNING,
+			"Queue [%d] already configured, not configuring again",
+			q_priv->q_id);
+		return 0;
+	}
+
+	rte_bbdev_log_debug("setting up queue %d", q_priv->q_id);
+
+	/* Call ipc_configure_channel */
+	ret = ipc_queue_configure(q_priv->q_id, ipc_priv, q_priv);
+	if (ret) {
+		rte_bbdev_log(ERR, "Unable to setup queue (%d) (err=%d)",
+		       q_priv->q_id, ret);
+		return ret;
+	}
+
+	/* Set queue properties for LA12xx device */
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		if (priv->num_ldpc_enc_queues >= LA12XX_MAX_LDPC_ENC_QUEUES) {
+			rte_bbdev_log(ERR,
+				"num_ldpc_enc_queues reached max value");
+			return -1;
+		}
+		ch->la12xx_core_id =
+			rte_cpu_to_be_32(LA12XX_LDPC_ENC_CORE);
+		ch->feca_blk_id = rte_cpu_to_be_32(priv->num_ldpc_enc_queues++);
+		break;
+	case RTE_BBDEV_OP_LDPC_DEC:
+		if (priv->num_ldpc_dec_queues >= LA12XX_MAX_LDPC_DEC_QUEUES) {
+			rte_bbdev_log(ERR,
+				"num_ldpc_dec_queues reached max value");
+			return -1;
+		}
+		ch->la12xx_core_id =
+			rte_cpu_to_be_32(LA12XX_LDPC_DEC_CORE);
+		ch->feca_blk_id = rte_cpu_to_be_32(priv->num_ldpc_dec_queues++);
+		break;
+	default:
+		rte_bbdev_log(ERR, "Not supported op type\n");
+		return -1;
+	}
+	ch->op_type = rte_cpu_to_be_32(q_priv->op_type);
+	ch->depth = rte_cpu_to_be_32(q_priv->queue_size);
+
+	/* Store queue config here */
+	q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
+	q_priv->feca_blk_id_be32 = ch->feca_blk_id;
+
+	return 0;
+}
+
+/* Setup a queue */
+static int
+la12xx_queue_setup(struct rte_bbdev *dev, uint16_t q_id,
+		const struct rte_bbdev_queue_conf *queue_conf)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	struct rte_bbdev_queue_data *q_data;
+	struct bbdev_la12xx_q_priv *q_priv;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* Move to setup_queues callback */
+	q_data = &dev->data->queues[q_id];
+	q_data->queue_private = rte_zmalloc(NULL,
+		sizeof(struct bbdev_la12xx_q_priv), 0);
+	if (!q_data->queue_private) {
+		rte_bbdev_log(ERR, "Memory allocation failed for qpriv");
+		return -ENOMEM;
+	}
+	q_priv = q_data->queue_private;
+	q_priv->q_id = q_id;
+	q_priv->bbdev_priv = dev->data->dev_private;
+	q_priv->queue_size = queue_conf->queue_size;
+	q_priv->op_type = queue_conf->op_type;
+
+	ret = la12xx_e200_queue_setup(dev, q_priv);
+	if (ret) {
+		rte_bbdev_log(ERR, "e200_queue_setup failed for qid: %d",
+				     q_id);
+		return ret;
+	}
+
+	/* Store queue config here */
+	priv->num_valid_queues++;
+
+	return 0;
+}
+
+static int
+la12xx_start(struct rte_bbdev *dev)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	int ready = 0;
+	struct gul_hif *hif_start;
+
+	PMD_INIT_FUNC_TRACE();
+
+	hif_start = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+
+	/* Set Host Read bit */
+	SET_HIF_HOST_RDY(hif_start, HIF_HOST_READY_IPC_APP);
+
+	/* Now wait for modem ready bit */
+	while (!ready)
+		ready = CHK_HIF_MOD_RDY(hif_start, HIF_MOD_READY_IPC_APP);
+
+	return 0;
+}
+
+static const struct rte_bbdev_ops pmd_ops = {
+	.info_get = la12xx_info_get,
+	.queue_setup = la12xx_queue_setup,
+	.queue_release = la12xx_queue_release,
+	.start = la12xx_start
+};
+static struct hugepage_info *
+get_hugepage_info(void)
+{
+	struct hugepage_info *hp_info;
+	struct rte_memseg *mseg;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* TODO - find a better way */
+	hp_info = rte_malloc(NULL, sizeof(struct hugepage_info), 0);
+	if (!hp_info) {
+		rte_bbdev_log(ERR, "Unable to allocate on local heap");
+		return NULL;
+	}
+
+	mseg = rte_mem_virt2memseg(hp_info, NULL);
+	hp_info->vaddr = mseg->addr;
+	hp_info->paddr = rte_mem_virt2phy(mseg->addr);
+	hp_info->len = mseg->len;
+
+	return hp_info;
+}
+
+static int open_ipc_dev(int modem_id)
+{
+	char dev_initials[16], dev_path[PATH_MAX];
+	struct dirent *entry;
+	int dev_ipc = 0;
+	DIR *dir;
+
+	dir = opendir("/dev/");
+	if (!dir) {
+		rte_bbdev_log(ERR, "Unable to open /dev/");
+		return -1;
+	}
+
+	sprintf(dev_initials, "gulipcgul%d", modem_id);
+
+	while ((entry = readdir(dir)) != NULL) {
+		if (!strncmp(dev_initials, entry->d_name,
+		    sizeof(dev_initials) - 1))
+			break;
+	}
+
+	if (!entry) {
+		rte_bbdev_log(ERR, "Error: No gulipcgul%d device", modem_id);
+		return -1;
+	}
+
+	sprintf(dev_path, "/dev/%s", entry->d_name);
+	dev_ipc = open(dev_path, O_RDWR);
+	if (dev_ipc  < 0) {
+		rte_bbdev_log(ERR, "Error: Cannot open %s", dev_path);
+		return -errno;
+	}
+
+	return dev_ipc;
+}
+
+static int
+setup_la12xx_dev(struct rte_bbdev *dev)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	struct hugepage_info *hp = NULL;
+	ipc_channel_us_t *ipc_priv_ch = NULL;
+	int dev_ipc = 0, dev_mem = 0, i;
+	ipc_metadata_t *ipc_md;
+	struct gul_hif *mhif;
+	uint32_t phy_align = 0;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (!ipc_priv) {
+		/* TODO - get a better way */
+		/* Get the hugepage info against it */
+		hp = get_hugepage_info();
+		if (!hp) {
+			rte_bbdev_log(ERR, "Unable to get hugepage info");
+			ret = -ENOMEM;
+			goto err;
+		}
+
+		rte_bbdev_log_debug("0x%" PRIx64 " %p 0x%" PRIx64,
+				hp->paddr, hp->vaddr, hp->len);
+
+		ipc_priv = rte_zmalloc(0, sizeof(ipc_userspace_t), 0);
+		if (ipc_priv == NULL) {
+			rte_bbdev_log(ERR,
+				"Unable to allocate memory for ipc priv");
+			ret = -ENOMEM;
+			goto err;
+		}
+
+		for (i = 0; i < IPC_MAX_CHANNEL_COUNT; i++) {
+			ipc_priv_ch = rte_zmalloc(0,
+				sizeof(ipc_channel_us_t), 0);
+			if (ipc_priv_ch == NULL) {
+				rte_bbdev_log(ERR,
+					"Unable to allocate memory for channels");
+				ret = -ENOMEM;
+			}
+			ipc_priv->channels[i] = ipc_priv_ch;
+		}
+
+		dev_mem = open("/dev/mem", O_RDWR);
+		if (dev_mem < 0) {
+			rte_bbdev_log(ERR, "Error: Cannot open /dev/mem");
+			ret = -errno;
+			goto err;
+		}
+
+		ipc_priv->instance_id = 0;
+		ipc_priv->dev_mem = dev_mem;
+
+		rte_bbdev_log_debug("hugepg input 0x%" PRIx64 "%p 0x%" PRIx64,
+			hp->paddr, hp->vaddr, hp->len);
+
+		ipc_priv->sys_map.hugepg_start.host_phys = hp->paddr;
+		ipc_priv->sys_map.hugepg_start.size = hp->len;
+
+		ipc_priv->hugepg_start.host_phys = hp->paddr;
+		ipc_priv->hugepg_start.host_vaddr = hp->vaddr;
+		ipc_priv->hugepg_start.size = hp->len;
+
+		rte_free(hp);
+	}
+
+	dev_ipc = open_ipc_dev(priv->modem_id);
+	if (dev_ipc < 0) {
+		rte_bbdev_log(ERR, "Error: open_ipc_dev failed");
+		goto err;
+	}
+	ipc_priv->dev_ipc = dev_ipc;
+
+	ret = ioctl(ipc_priv->dev_ipc, IOCTL_GUL_IPC_GET_SYS_MAP,
+		    &ipc_priv->sys_map);
+	if (ret) {
+		rte_bbdev_log(ERR,
+			"IOCTL_GUL_IPC_GET_SYS_MAP ioctl failed");
+		goto err;
+	}
+
+	phy_align = (ipc_priv->sys_map.mhif_start.host_phys % 0x1000);
+	ipc_priv->mhif_start.host_vaddr =
+		mmap(0, ipc_priv->sys_map.mhif_start.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.mhif_start.host_phys - phy_align));
+	if (ipc_priv->mhif_start.host_vaddr == MAP_FAILED) {
+		rte_bbdev_log(ERR, "MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->mhif_start.host_vaddr = (void *) ((uintptr_t)
+		(ipc_priv->mhif_start.host_vaddr) + phy_align);
+
+	phy_align = (ipc_priv->sys_map.peb_start.host_phys % 0x1000);
+	ipc_priv->peb_start.host_vaddr =
+		mmap(0, ipc_priv->sys_map.peb_start.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.peb_start.host_phys - phy_align));
+	if (ipc_priv->peb_start.host_vaddr == MAP_FAILED) {
+		rte_bbdev_log(ERR, "MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->peb_start.host_vaddr = (void *)((uintptr_t)
+		(ipc_priv->peb_start.host_vaddr) + phy_align);
+
+	phy_align = (ipc_priv->sys_map.modem_ccsrbar.host_phys % 0x1000);
+	ipc_priv->modem_ccsrbar.host_vaddr =
+		mmap(0, ipc_priv->sys_map.modem_ccsrbar.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.modem_ccsrbar.host_phys - phy_align));
+	if (ipc_priv->modem_ccsrbar.host_vaddr == MAP_FAILED) {
+		rte_bbdev_log(ERR, "MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->modem_ccsrbar.host_vaddr = (void *)((uintptr_t)
+		(ipc_priv->modem_ccsrbar.host_vaddr) + phy_align);
+
+	ipc_priv->hugepg_start.modem_phys =
+		ipc_priv->sys_map.hugepg_start.modem_phys;
+
+	ipc_priv->mhif_start.host_phys =
+		ipc_priv->sys_map.mhif_start.host_phys;
+	ipc_priv->mhif_start.size = ipc_priv->sys_map.mhif_start.size;
+	ipc_priv->peb_start.host_phys = ipc_priv->sys_map.peb_start.host_phys;
+	ipc_priv->peb_start.size = ipc_priv->sys_map.peb_start.size;
+
+	rte_bbdev_log(INFO, "peb 0x%" PRIx64 "%p 0x%" PRIx32,
+			ipc_priv->peb_start.host_phys,
+			ipc_priv->peb_start.host_vaddr,
+			ipc_priv->peb_start.size);
+	rte_bbdev_log(INFO, "hugepg 0x%" PRIx64 "%p 0x%" PRIx32,
+			ipc_priv->hugepg_start.host_phys,
+			ipc_priv->hugepg_start.host_vaddr,
+			ipc_priv->hugepg_start.size);
+	rte_bbdev_log(INFO, "mhif 0x%" PRIx64 "%p 0x%" PRIx32,
+			ipc_priv->mhif_start.host_phys,
+			ipc_priv->mhif_start.host_vaddr,
+			ipc_priv->mhif_start.size);
+	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+
+	/* offset is from start of PEB */
+	ipc_md = (ipc_metadata_t *)((uintptr_t)ipc_priv->peb_start.host_vaddr +
+			mhif->ipc_regs.ipc_mdata_offset);
+
+	if (sizeof(ipc_metadata_t) != mhif->ipc_regs.ipc_mdata_size) {
+		rte_bbdev_log(ERR,
+			"ipc_metadata_t =0x%" PRIx64
+			", mhif->ipc_regs.ipc_mdata_size=0x%" PRIx32,
+			(uint64_t)(sizeof(ipc_metadata_t)),
+			mhif->ipc_regs.ipc_mdata_size);
+		rte_bbdev_log(ERR, "--> mhif->ipc_regs.ipc_mdata_offset= 0x%"
+			PRIx32, mhif->ipc_regs.ipc_mdata_offset);
+		rte_bbdev_log(ERR, "gul_hif size=0x%" PRIx64,
+			(uint64_t)(sizeof(struct gul_hif)));
+		return IPC_MD_SZ_MISS_MATCH;
+	}
+
+	ipc_priv->instance = (ipc_instance_t *)
+		(&ipc_md->instance_list[ipc_priv->instance_id]);
+
+	rte_bbdev_log_debug("finish host init");
+
+	priv->ipc_priv = ipc_priv;
+
+	return 0;
+
+err:
+	rte_free(hp);
+	rte_free(ipc_priv);
+	rte_free(ipc_priv_ch);
+	if (dev_mem)
+		close(dev_mem);
+	if (dev_ipc)
+		close(dev_ipc);
+
+	return ret;
+}
+
 static inline int
 parse_u16_arg(const char *key, const char *value, void *extra_args)
 {
@@ -122,6 +669,7 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
 	struct bbdev_la12xx_private *priv;
+	int ret;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -151,7 +699,13 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 
 	rte_bbdev_log(INFO, "Setting Up %s: DevId=%d, ModemId=%d",
 				name, bbdev->data->dev_id, priv->modem_id);
-	bbdev->dev_ops = NULL;
+	ret = setup_la12xx_dev(bbdev);
+	if (ret) {
+		rte_bbdev_log(ERR, "IPC Setup failed for %s", name);
+		rte_free(bbdev->data->dev_private);
+		return ret;
+	}
+	bbdev->dev_ops = &pmd_ops;
 	bbdev->device = &vdev->device;
 	bbdev->data->socket_id = 0;
 	bbdev->intr_handle = NULL;
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.h b/drivers/baseband/la12xx/bbdev_la12xx.h
index 5228502331..fe91e62bf6 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx.h
@@ -5,16 +5,10 @@
 #ifndef __BBDEV_LA12XX_H__
 #define __BBDEV_LA12XX_H__
 
-#define BBDEV_IPC_ENC_OP_TYPE	1
-#define BBDEV_IPC_DEC_OP_TYPE	2
-
-#define MAX_LDPC_ENC_FECA_QUEUES	4
-#define MAX_LDPC_DEC_FECA_QUEUES	4
-
 #define MAX_CHANNEL_DEPTH 16
 /* private data structure */
 struct bbdev_la12xx_private {
-	void *ipc_priv;
+	ipc_userspace_t *ipc_priv;
 	uint8_t num_valid_queues;
 	uint8_t max_nb_queues;
 	uint8_t num_ldpc_enc_queues;
@@ -32,14 +26,14 @@ struct hugepage_info {
 struct bbdev_la12xx_q_priv {
 	struct bbdev_la12xx_private *bbdev_priv;
 	uint32_t q_id;	/**< Channel ID */
-	uint32_t feca_blk_id;	/** FECA block ID for processing */
+	uint32_t feca_blk_id;	/**< FECA block ID for processing */
 	uint32_t feca_blk_id_be32; /**< FECA Block ID for this queue */
-	uint8_t en_napi; /* 0: napi disabled, 1: napi enabled */
+	uint8_t en_napi; /**< 0: napi disabled, 1: napi enabled */
 	uint16_t queue_size;	/**< Queue depth */
 	int32_t eventfd;	/**< Event FD value */
 	enum rte_bbdev_op_type op_type; /**< Operation type */
 	uint32_t la12xx_core_id;
-		/* LA12xx core ID on which this will be scheduled */
+		/**< LA12xx core ID on which this will be scheduled */
 	struct rte_mempool *mp; /**< Pool from where buffers would be cut */
 	void *bbdev_op[MAX_CHANNEL_DEPTH];
 			/**< Stores bbdev op for each index */
@@ -52,5 +46,6 @@ struct bbdev_la12xx_q_priv {
 
 #define lower_32_bits(x) ((uint32_t)((uint64_t)x))
 #define upper_32_bits(x) ((uint32_t)(((uint64_t)(x) >> 16) >> 16))
-
+#define join_32_bits(upper, lower) \
+	((size_t)(((uint64_t)(upper) << 32) | (uint32_t)(lower)))
 #endif
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
index 9aa5562981..5f613fb087 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -4,9 +4,182 @@
 #ifndef __BBDEV_LA12XX_IPC_H__
 #define __BBDEV_LA12XX_IPC_H__
 
+#define LA12XX_MAX_QUEUES 20
+#define HOST_RX_QUEUEID_OFFSET LA12XX_MAX_QUEUES
+
+/** No. of max channel per instance */
+#define IPC_MAX_CHANNEL_COUNT	(64)
+
 /** No. of max channel per instance */
 #define IPC_MAX_DEPTH	(16)
 
+/** No. of max IPC instance per modem */
+#define IPC_MAX_INSTANCE_COUNT	(1)
+
+/** Error codes */
+#define IPC_SUCCESS		(0) /** IPC operation success */
+#define IPC_INPUT_INVALID	(-1) /** Invalid input to API */
+#define IPC_CH_INVALID		(-2) /** Channel no is invalid */
+#define IPC_INSTANCE_INVALID	(-3) /** Instance no is invalid */
+#define IPC_MEM_INVALID		(-4) /** Insufficient memory */
+#define IPC_CH_FULL		(-5) /** Channel is full */
+#define IPC_CH_EMPTY		(-6) /** Channel is empty */
+#define IPC_BL_EMPTY		(-7) /** Free buffer list is empty */
+#define IPC_BL_FULL		(-8) /** Free buffer list is full */
+#define IPC_HOST_BUF_ALLOC_FAIL	(-9) /** DPDK malloc fail */
+#define IPC_MD_SZ_MISS_MATCH	(-10) /** META DATA size in mhif miss matched*/
+#define IPC_MALLOC_FAIL		(-11) /** system malloc fail */
+#define IPC_IOCTL_FAIL		(-12) /** IOCTL call failed */
+#define IPC_MMAP_FAIL		(-14) /** MMAP fail */
+#define IPC_OPEN_FAIL		(-15) /** OPEN fail */
+#define IPC_EVENTFD_FAIL	(-16) /** eventfd initialization failed */
+#define IPC_NOT_IMPLEMENTED	(-17) /** IPC feature is not implemented yet*/
+
+#define SET_HIF_HOST_RDY(hif, RDY_MASK) (hif->host_ready |= RDY_MASK)
+#define CHK_HIF_MOD_RDY(hif, RDY_MASK) (hif->mod_ready & RDY_MASK)
+
+/* Host Ready bits */
+#define HIF_HOST_READY_HOST_REGIONS	(1 << 0)
+#define HIF_HOST_READY_IPC_LIB		(1 << 12)
+#define HIF_HOST_READY_IPC_APP		(1 << 13)
+#define HIF_HOST_READY_FECA		(1 << 14)
+
+/* Modem Ready bits */
+#define HIF_MOD_READY_IPC_LIB		(1 << 5)
+#define HIF_MOD_READY_IPC_APP		(1 << 6)
+#define HIF_MOD_READY_FECA		(1 << 7)
+
+typedef void *ipc_t;
+
+struct ipc_msg {
+	int chid;
+	void *addr;
+	uint32_t len;
+	uint8_t flags;
+};
+
+typedef struct {
+	uint64_t host_phys;
+	uint32_t modem_phys;
+	void    *host_vaddr;
+	uint32_t size;
+} mem_range_t;
+
+#define GUL_IPC_MAGIC	'R'
+
+#define IOCTL_GUL_IPC_GET_SYS_MAP _IOW(GUL_IPC_MAGIC, 1, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_REGISTER _IOWR(GUL_IPC_MAGIC, 4, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_DEREGISTER \
+	_IOWR(GUL_IPC_MAGIC, 5, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_RAISE_INTERRUPT _IOW(GUL_IPC_MAGIC, 6, int *)
+
+/** buffer ring common metadata */
+typedef struct ipc_bd_ring_md {
+	volatile uint32_t pi;		/**< Producer index and flag (MSB)
+					  *  which flip for each Ring wrapping
+					  */
+	volatile uint32_t ci;		/**< Consumer index and flag (MSB)
+					  *  which flip for each Ring wrapping
+					  */
+	uint32_t ring_size;	/**< depth (Used to roll-over pi/ci) */
+	uint32_t msg_size;	/**< Size of the each buffer */
+} __rte_packed ipc_br_md_t;
+
+/** IPC buffer descriptor */
+typedef struct ipc_buffer_desc {
+	union {
+		uint64_t host_virt;	/**< msg's host virtual address */
+		struct {
+			uint32_t host_virt_l;
+			uint32_t host_virt_h;
+		};
+	};
+	uint32_t modem_ptr;	/**< msg's modem physical address */
+	uint32_t len;		/**< msg len */
+} __rte_packed ipc_bd_t;
+
+typedef struct ipc_channel {
+	uint32_t ch_id;		/**< Channel id */
+	ipc_br_md_t md;			/**< Metadata for BD ring */
+	ipc_bd_t bd_h[IPC_MAX_DEPTH];	/**< Buffer Descriptor on Host */
+	ipc_bd_t bd_m[IPC_MAX_DEPTH];	/**< Buffer Descriptor on Modem */
+	uint32_t op_type;		/**< Type of the BBDEV operation
+					  * supported on this channel
+					  */
+	uint32_t depth;			/**< Channel depth */
+	uint32_t feca_blk_id;	/**< FECA Transport Block ID for processing */
+	uint32_t la12xx_core_id;/**< LA12xx core ID on which this will be
+				  * scheduled
+				  */
+	uint32_t feca_input_circ_size;	/**< FECA transport block input
+					  * circular buffer size
+					  */
+	uint32_t host_ipc_params;	/**< Address for host IPC parameters */
+} __rte_packed ipc_ch_t;
+
+typedef struct ipc_instance {
+	uint32_t instance_id;		/**< instance id, use to init this
+					  * instance by ipc_init API
+					  */
+	uint32_t initialized;		/**< Set in ipc_init */
+	ipc_ch_t ch_list[IPC_MAX_CHANNEL_COUNT];
+		/**< Channel descriptors in this instance */
+} __rte_packed ipc_instance_t;
+
+typedef struct ipc_metadata {
+	uint32_t ipc_host_signature; /**< IPC host signature, Set by host/L2 */
+	uint32_t ipc_geul_signature; /**< IPC geul signature, Set by modem */
+	ipc_instance_t instance_list[IPC_MAX_INSTANCE_COUNT];
+} __rte_packed ipc_metadata_t;
+
+typedef struct ipc_channel_us_priv {
+	int32_t		eventfd;
+	uint32_t	channel_id;
+	/* In flight packets status for buffer list. */
+	uint8_t		bufs_inflight[IPC_MAX_DEPTH];
+} ipc_channel_us_t;
+
+typedef struct {
+	uint64_t host_phys;
+	uint32_t modem_phys;
+	uint32_t size;
+} mem_strt_addr_t;
+
+typedef struct {
+	mem_strt_addr_t modem_ccsrbar;
+	mem_strt_addr_t peb_start; /* PEB meta data */
+	mem_strt_addr_t mhif_start; /* MHIF meta daat */
+	mem_strt_addr_t hugepg_start; /* Modem to access hugepage */
+} sys_map_t;
+
+typedef struct ipc_priv_t {
+	int instance_id;
+	int dev_ipc;
+	int dev_mem;
+	sys_map_t sys_map;
+	mem_range_t modem_ccsrbar;
+	mem_range_t peb_start;
+	mem_range_t mhif_start;
+	mem_range_t hugepg_start;
+	ipc_channel_us_t *channels[IPC_MAX_CHANNEL_COUNT];
+	ipc_instance_t	*instance;
+	ipc_instance_t	*instance_bk;
+} ipc_userspace_t;
+
+/** Structure specifying enqueue operation (enqueue at LA1224) */
+struct bbdev_ipc_enqueue_op {
+	/** Status of operation that was performed */
+	int32_t status;
+	/** CRC Status of SD operation that was performed */
+	int32_t crc_stat_addr;
+	/** HARQ Output buffer memory length for Shared Decode.
+	 * Filled by LA12xx.
+	 */
+	uint32_t out_len;
+	/** Reserved (for 8 byte alignment) */
+	uint32_t rsvd;
+};
+
 /* This shared memory would be on the host side which have copy of some
  * of the parameters which are also part of Shared BD ring. Read access
  * of these parameters from the host side would not be over PCI.
@@ -14,7 +187,21 @@
 typedef struct host_ipc_params {
 	volatile uint32_t pi;
 	volatile uint32_t ci;
-	volatile uint32_t modem_ptr[IPC_MAX_DEPTH];
+	volatile uint32_t bd_m_modem_ptr[IPC_MAX_DEPTH];
 } __rte_packed host_ipc_params_t;
 
+struct hif_ipc_regs {
+	uint32_t ipc_mdata_offset;
+	uint32_t ipc_mdata_size;
+} __rte_packed;
+
+struct gul_hif {
+	uint32_t ver;
+	uint32_t hif_ver;
+	uint32_t status;
+	volatile uint32_t host_ready;
+	volatile uint32_t mod_ready;
+	struct hif_ipc_regs ipc_regs;
+} __rte_packed;
+
 #endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v10 6/8] baseband/la12xx: add enqueue and dequeue support
  2021-10-11  4:32 ` [dpdk-dev] [PATCH v10 0/8] baseband: add NXP LA12xx driver nipun.gupta
                     ` (4 preceding siblings ...)
  2021-10-11  4:32   ` [dpdk-dev] [PATCH v10 5/8] baseband/la12xx: add queue and modem config support nipun.gupta
@ 2021-10-11  4:32   ` nipun.gupta
  2021-10-11  4:32   ` [dpdk-dev] [PATCH v10 7/8] app/bbdev: enable la12xx for bbdev nipun.gupta
  2021-10-11  4:32   ` [dpdk-dev] [PATCH v10 8/8] app/bbdev: handle endianness of test data nipun.gupta
  7 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-11  4:32 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

From: Hemant Agrawal <hemant.agrawal@nxp.com>

Add support for enqueue and dequeue the LDPC enc/dec
from the modem device.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 doc/guides/bbdevs/features/la12xx.ini      |  13 +
 doc/guides/bbdevs/la12xx.rst               |  44 +++
 drivers/baseband/la12xx/bbdev_la12xx.c     | 320 +++++++++++++++++++++
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h |  37 +++
 4 files changed, 414 insertions(+)
 create mode 100644 doc/guides/bbdevs/features/la12xx.ini

diff --git a/doc/guides/bbdevs/features/la12xx.ini b/doc/guides/bbdevs/features/la12xx.ini
new file mode 100644
index 0000000000..0aec5eecb6
--- /dev/null
+++ b/doc/guides/bbdevs/features/la12xx.ini
@@ -0,0 +1,13 @@
+;
+; Supported features of the 'la12xx' bbdev driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Turbo Decoder (4G)     = N
+Turbo Encoder (4G)     = N
+LDPC Decoder (5G)      = Y
+LDPC Encoder (5G)      = Y
+LLR/HARQ Compression   = N
+HW Accelerated         = Y
+BBDEV API              = Y
diff --git a/doc/guides/bbdevs/la12xx.rst b/doc/guides/bbdevs/la12xx.rst
index 1a711ef5e3..fe1bca4c5c 100644
--- a/doc/guides/bbdevs/la12xx.rst
+++ b/doc/guides/bbdevs/la12xx.rst
@@ -78,3 +78,47 @@ For enabling logs, use the following EAL parameter:
 
 Using ``bb.la12xx`` as log matching criteria, all Baseband PMD logs can be
 enabled which are lower than logging ``level``.
+
+Test Application
+----------------
+
+BBDEV provides a test application, ``test-bbdev.py`` and range of test data for testing
+the functionality of LA12xx for FEC encode and decode, depending on the device
+capabilities. The test application is located under app->test-bbdev folder and has the
+following options:
+
+.. code-block:: console
+
+  "-p", "--testapp-path": specifies path to the bbdev test app.
+  "-e", "--eal-params"	: EAL arguments which are passed to the test app.
+  "-t", "--timeout"	: Timeout in seconds (default=300).
+  "-c", "--test-cases"	: Defines test cases to run. Run all if not specified.
+  "-v", "--test-vector"	: Test vector path (default=dpdk_path+/app/test-bbdev/test_vectors/bbdev_null.data).
+  "-n", "--num-ops"	: Number of operations to process on device (default=32).
+  "-b", "--burst-size"	: Operations enqueue/dequeue burst size (default=32).
+  "-s", "--snr"		: SNR in dB used when generating LLRs for bler tests.
+  "-s", "--iter_max"	: Number of iterations for LDPC decoder.
+  "-l", "--num-lcores"	: Number of lcores to run (default=16).
+  "-i", "--init-device" : Initialise PF device with default values.
+
+
+To execute the test application tool using simple decode or encode data,
+type one of the following:
+
+.. code-block:: console
+
+  ./test-bbdev.py -e="--vdev=baseband_la12xx,socket_id=0,max_nb_queues=8" -c validation -n 64 -b 1 -v ./ldpc_dec_default.data
+  ./test-bbdev.py -e="--vdev=baseband_la12xx,socket_id=0,max_nb_queues=8" -c validation -n 64 -b 1 -v ./ldpc_enc_default.data
+
+The test application ``test-bbdev.py``, supports the ability to configure the PF device with
+a default set of values, if the "-i" or "- -init-device" option is included. The default values
+are defined in test_bbdev_perf.c.
+
+
+Test Vectors
+~~~~~~~~~~~~
+
+In addition to the simple LDPC decoder and LDPC encoder tests, bbdev also provides
+a range of additional tests under the test_vectors folder, which may be useful. The results
+of these tests will depend on the LA12xx FEC capabilities which may cause some
+testcases to be skipped, but no failure should be reported.
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 9fad7462e8..cce03f75ae 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -120,6 +120,10 @@ la12xx_queue_release(struct rte_bbdev *dev, uint16_t q_id)
 		((uint64_t) ((unsigned long) (A) \
 		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
 
+#define MODEM_P2V(A) \
+	((uint64_t) ((unsigned long) (A) \
+		+ (unsigned long)(ipc_priv->peb_start.host_vaddr)))
+
 static int ipc_queue_configure(uint32_t channel_id,
 		ipc_t instance, struct bbdev_la12xx_q_priv *q_priv)
 {
@@ -334,6 +338,318 @@ static const struct rte_bbdev_ops pmd_ops = {
 	.queue_release = la12xx_queue_release,
 	.start = la12xx_start
 };
+
+static inline int
+is_bd_ring_full(uint32_t ci, uint32_t ci_flag,
+		uint32_t pi, uint32_t pi_flag)
+{
+	if (pi == ci) {
+		if (pi_flag != ci_flag)
+			return 1; /* Ring is Full */
+	}
+	return 0;
+}
+
+static inline int
+prepare_ldpc_enc_op(struct rte_bbdev_enc_op *bbdev_enc_op,
+		    struct bbdev_la12xx_q_priv *q_priv __rte_unused,
+		    struct rte_bbdev_op_data *in_op_data __rte_unused,
+		    struct rte_bbdev_op_data *out_op_data)
+{
+	struct rte_bbdev_op_ldpc_enc *ldpc_enc = &bbdev_enc_op->ldpc_enc;
+	uint32_t total_out_bits;
+
+	total_out_bits = (ldpc_enc->tb_params.cab *
+		ldpc_enc->tb_params.ea) + (ldpc_enc->tb_params.c -
+		ldpc_enc->tb_params.cab) * ldpc_enc->tb_params.eb;
+
+	ldpc_enc->output.length = (total_out_bits + 7)/8;
+
+	rte_pktmbuf_append(out_op_data->data, ldpc_enc->output.length);
+
+	return 0;
+}
+
+static inline int
+prepare_ldpc_dec_op(struct rte_bbdev_dec_op *bbdev_dec_op,
+		    struct bbdev_ipc_dequeue_op *bbdev_ipc_op,
+		    struct bbdev_la12xx_q_priv *q_priv  __rte_unused,
+		    struct rte_bbdev_op_data *out_op_data  __rte_unused)
+{
+	struct rte_bbdev_op_ldpc_dec *ldpc_dec = &bbdev_dec_op->ldpc_dec;
+	uint32_t total_out_bits;
+	uint32_t num_code_blocks = 0;
+	uint16_t sys_cols;
+
+	sys_cols = (ldpc_dec->basegraph == 1) ? 22 : 10;
+	if (ldpc_dec->tb_params.c == 1) {
+		total_out_bits = ((sys_cols * ldpc_dec->z_c) -
+				ldpc_dec->n_filler);
+		/* 5G-NR protocol uses 16 bit CRC when output packet
+		 * size <= 3824 (bits). Otherwise 24 bit CRC is used.
+		 * Adjust the output bits accordingly
+		 */
+		if (total_out_bits - 16 <= 3824)
+			total_out_bits -= 16;
+		else
+			total_out_bits -= 24;
+		ldpc_dec->hard_output.length = (total_out_bits / 8);
+	} else {
+		total_out_bits = (((sys_cols * ldpc_dec->z_c) -
+				ldpc_dec->n_filler - 24) *
+				ldpc_dec->tb_params.c);
+		ldpc_dec->hard_output.length = (total_out_bits / 8) - 3;
+	}
+
+	num_code_blocks = ldpc_dec->tb_params.c;
+
+	bbdev_ipc_op->num_code_blocks = rte_cpu_to_be_32(num_code_blocks);
+
+	return 0;
+}
+
+static int
+enqueue_single_op(struct bbdev_la12xx_q_priv *q_priv, void *bbdev_op)
+{
+	struct bbdev_la12xx_private *priv = q_priv->bbdev_priv;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	ipc_instance_t *ipc_instance = ipc_priv->instance;
+	struct bbdev_ipc_dequeue_op *bbdev_ipc_op;
+	struct rte_bbdev_op_ldpc_enc *ldpc_enc;
+	struct rte_bbdev_op_ldpc_dec *ldpc_dec;
+	uint32_t q_id = q_priv->q_id;
+	uint32_t ci, ci_flag, pi, pi_flag;
+	ipc_ch_t *ch = &(ipc_instance->ch_list[q_id]);
+	ipc_br_md_t *md = &(ch->md);
+	size_t virt;
+	char *huge_start_addr =
+		(char *)q_priv->bbdev_priv->ipc_priv->hugepg_start.host_vaddr;
+	struct rte_bbdev_op_data *in_op_data, *out_op_data;
+	char *data_ptr;
+	uint32_t l1_pcie_addr;
+	int ret;
+
+	ci = IPC_GET_CI_INDEX(q_priv->host_ci);
+	ci_flag = IPC_GET_CI_FLAG(q_priv->host_ci);
+
+	pi = IPC_GET_PI_INDEX(q_priv->host_pi);
+	pi_flag = IPC_GET_PI_FLAG(q_priv->host_pi);
+
+	rte_bbdev_dp_log(DEBUG, "before bd_ring_full: pi: %u, ci: %u,"
+		"pi_flag: %u, ci_flag: %u, ring size: %u",
+		pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	if (is_bd_ring_full(ci, ci_flag, pi, pi_flag)) {
+		rte_bbdev_dp_log(DEBUG, "bd ring full for queue id: %d", q_id);
+		return IPC_CH_FULL;
+	}
+
+	virt = MODEM_P2V(q_priv->host_params->bd_m_modem_ptr[pi]);
+	bbdev_ipc_op = (struct bbdev_ipc_dequeue_op *)virt;
+	q_priv->bbdev_op[pi] = bbdev_op;
+
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		ldpc_enc = &(((struct rte_bbdev_enc_op *)bbdev_op)->ldpc_enc);
+		in_op_data = &ldpc_enc->input;
+		out_op_data = &ldpc_enc->output;
+
+		ret = prepare_ldpc_enc_op(bbdev_op, q_priv,
+					  in_op_data, out_op_data);
+		if (ret) {
+			rte_bbdev_log(ERR, "process_ldpc_enc_op fail, ret: %d",
+				ret);
+			return ret;
+		}
+		break;
+
+	case RTE_BBDEV_OP_LDPC_DEC:
+		ldpc_dec = &(((struct rte_bbdev_dec_op *)bbdev_op)->ldpc_dec);
+		in_op_data = &ldpc_dec->input;
+
+		out_op_data = &ldpc_dec->hard_output;
+
+		ret = prepare_ldpc_dec_op(bbdev_op, bbdev_ipc_op,
+					  q_priv, out_op_data);
+		if (ret) {
+			rte_bbdev_log(ERR, "process_ldpc_dec_op fail, ret: %d",
+				ret);
+			return ret;
+		}
+		break;
+
+	default:
+		rte_bbdev_log(ERR, "unsupported bbdev_ipc op type");
+		return -1;
+	}
+
+	if (in_op_data->data) {
+		data_ptr = rte_pktmbuf_mtod(in_op_data->data, char *);
+		l1_pcie_addr = (uint32_t)GUL_USER_HUGE_PAGE_ADDR +
+			       data_ptr - huge_start_addr;
+		bbdev_ipc_op->in_addr = l1_pcie_addr;
+		bbdev_ipc_op->in_len = in_op_data->length;
+	}
+
+	if (out_op_data->data) {
+		data_ptr = rte_pktmbuf_mtod(out_op_data->data, char *);
+		l1_pcie_addr = (uint32_t)GUL_USER_HUGE_PAGE_ADDR +
+				data_ptr - huge_start_addr;
+		bbdev_ipc_op->out_addr = rte_cpu_to_be_32(l1_pcie_addr);
+		bbdev_ipc_op->out_len = rte_cpu_to_be_32(out_op_data->length);
+	}
+
+	/* Move Producer Index forward */
+	pi++;
+	/* Flip the PI flag, if wrapping */
+	if (unlikely(q_priv->queue_size == pi)) {
+		pi = 0;
+		pi_flag = pi_flag ? 0 : 1;
+	}
+
+	if (pi_flag)
+		IPC_SET_PI_FLAG(pi);
+	else
+		IPC_RESET_PI_FLAG(pi);
+	q_priv->host_pi = pi;
+
+	/* Wait for Data Copy & pi_flag update to complete before updating pi */
+	rte_mb();
+	/* now update pi */
+	md->pi = rte_cpu_to_be_32(pi);
+
+	rte_bbdev_dp_log(DEBUG, "enter: pi: %u, ci: %u,"
+			"pi_flag: %u, ci_flag: %u, ring size: %u",
+			pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	return 0;
+}
+
+/* Enqueue decode burst */
+static uint16_t
+enqueue_dec_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_dec_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	int nb_enqueued, ret;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ret = enqueue_single_op(q_priv, ops[nb_enqueued]);
+		if (ret)
+			break;
+	}
+
+	q_data->queue_stats.enqueue_err_count += nb_ops - nb_enqueued;
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
+/* Enqueue encode burst */
+static uint16_t
+enqueue_enc_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_enc_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	int nb_enqueued, ret;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ret = enqueue_single_op(q_priv, ops[nb_enqueued]);
+		if (ret)
+			break;
+	}
+
+	q_data->queue_stats.enqueue_err_count += nb_ops - nb_enqueued;
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
+/* Dequeue encode burst */
+static void *
+dequeue_single_op(struct bbdev_la12xx_q_priv *q_priv, void *dst)
+{
+	void *op;
+	uint32_t ci, ci_flag;
+	uint32_t temp_ci;
+
+	temp_ci = q_priv->host_params->ci;
+	if (temp_ci == q_priv->host_ci)
+		return NULL;
+
+	ci = IPC_GET_CI_INDEX(q_priv->host_ci);
+	ci_flag = IPC_GET_CI_FLAG(q_priv->host_ci);
+
+	rte_bbdev_dp_log(DEBUG,
+		"ci: %u, ci_flag: %u, ring size: %u",
+		ci, ci_flag, q_priv->queue_size);
+
+	op = q_priv->bbdev_op[ci];
+
+	rte_memcpy(dst, q_priv->msg_ch_vaddr[ci],
+		sizeof(struct bbdev_ipc_enqueue_op));
+
+	/* Move Consumer Index forward */
+	ci++;
+	/* Flip the CI flag, if wrapping */
+	if (q_priv->queue_size == ci) {
+		ci = 0;
+		ci_flag = ci_flag ? 0 : 1;
+	}
+	if (ci_flag)
+		IPC_SET_CI_FLAG(ci);
+	else
+		IPC_RESET_CI_FLAG(ci);
+
+	q_priv->host_ci = ci;
+
+	rte_bbdev_dp_log(DEBUG,
+		"exit: ci: %u, ci_flag: %u, ring size: %u",
+		ci, ci_flag, q_priv->queue_size);
+
+	return op;
+}
+
+/* Dequeue decode burst */
+static uint16_t
+dequeue_dec_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_dec_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	struct bbdev_ipc_enqueue_op bbdev_ipc_op;
+	int nb_dequeued;
+
+	for (nb_dequeued = 0; nb_dequeued < nb_ops; nb_dequeued++) {
+		ops[nb_dequeued] = dequeue_single_op(q_priv, &bbdev_ipc_op);
+		if (!ops[nb_dequeued])
+			break;
+		ops[nb_dequeued]->status = bbdev_ipc_op.status;
+	}
+	q_data->queue_stats.dequeued_count += nb_dequeued;
+
+	return nb_dequeued;
+}
+
+/* Dequeue encode burst */
+static uint16_t
+dequeue_enc_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_enc_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	struct bbdev_ipc_enqueue_op bbdev_ipc_op;
+	int nb_enqueued;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ops[nb_enqueued] = dequeue_single_op(q_priv, &bbdev_ipc_op);
+		if (!ops[nb_enqueued])
+			break;
+		ops[nb_enqueued]->status = bbdev_ipc_op.status;
+	}
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
 static struct hugepage_info *
 get_hugepage_info(void)
 {
@@ -715,6 +1031,10 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 	bbdev->dequeue_dec_ops = NULL;
 	bbdev->enqueue_enc_ops = NULL;
 	bbdev->enqueue_dec_ops = NULL;
+	bbdev->dequeue_ldpc_enc_ops = dequeue_enc_ops;
+	bbdev->dequeue_ldpc_dec_ops = dequeue_dec_ops;
+	bbdev->enqueue_ldpc_enc_ops = enqueue_enc_ops;
+	bbdev->enqueue_ldpc_dec_ops = enqueue_dec_ops;
 
 	return 0;
 }
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
index 5f613fb087..b6a7f677d0 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -73,6 +73,25 @@ typedef struct {
 	_IOWR(GUL_IPC_MAGIC, 5, struct ipc_msg *)
 #define IOCTL_GUL_IPC_CHANNEL_RAISE_INTERRUPT _IOW(GUL_IPC_MAGIC, 6, int *)
 
+#define GUL_USER_HUGE_PAGE_OFFSET	(0)
+#define GUL_PCI1_ADDR_BASE	(0x00000000ULL)
+
+#define GUL_USER_HUGE_PAGE_ADDR	(GUL_PCI1_ADDR_BASE + GUL_USER_HUGE_PAGE_OFFSET)
+
+/* IPC PI/CI index & flag manipulation helpers */
+#define IPC_PI_CI_FLAG_MASK	0x80000000 /*  (1<<31) */
+#define IPC_PI_CI_INDEX_MASK	0x7FFFFFFF /* ~(1<<31) */
+
+#define IPC_SET_PI_FLAG(x)	(x |= IPC_PI_CI_FLAG_MASK)
+#define IPC_RESET_PI_FLAG(x)	(x &= IPC_PI_CI_INDEX_MASK)
+#define IPC_GET_PI_FLAG(x)	(x >> 31)
+#define IPC_GET_PI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
+
+#define IPC_SET_CI_FLAG(x)	(x |= IPC_PI_CI_FLAG_MASK)
+#define IPC_RESET_CI_FLAG(x)	(x &= IPC_PI_CI_INDEX_MASK)
+#define IPC_GET_CI_FLAG(x)	(x >> 31)
+#define IPC_GET_CI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
+
 /** buffer ring common metadata */
 typedef struct ipc_bd_ring_md {
 	volatile uint32_t pi;		/**< Producer index and flag (MSB)
@@ -180,6 +199,24 @@ struct bbdev_ipc_enqueue_op {
 	uint32_t rsvd;
 };
 
+/** Structure specifying dequeue operation (dequeue at LA1224) */
+struct bbdev_ipc_dequeue_op {
+	/** Input buffer memory address */
+	uint32_t in_addr;
+	/** Input buffer memory length */
+	uint32_t in_len;
+	/** Output buffer memory address */
+	uint32_t out_addr;
+	/** Output buffer memory length */
+	uint32_t out_len;
+	/* Number of code blocks. Only set when HARQ is used */
+	uint32_t num_code_blocks;
+	/** Dequeue Operation flags */
+	uint32_t op_flags;
+	/** Shared metadata between L1 and L2 */
+	uint32_t shared_metadata;
+};
+
 /* This shared memory would be on the host side which have copy of some
  * of the parameters which are also part of Shared BD ring. Read access
  * of these parameters from the host side would not be over PCI.
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v10 7/8] app/bbdev: enable la12xx for bbdev
  2021-10-11  4:32 ` [dpdk-dev] [PATCH v10 0/8] baseband: add NXP LA12xx driver nipun.gupta
                     ` (5 preceding siblings ...)
  2021-10-11  4:32   ` [dpdk-dev] [PATCH v10 6/8] baseband/la12xx: add enqueue and dequeue support nipun.gupta
@ 2021-10-11  4:32   ` nipun.gupta
  2021-10-11  4:32   ` [dpdk-dev] [PATCH v10 8/8] app/bbdev: handle endianness of test data nipun.gupta
  7 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-11  4:32 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal

From: Hemant Agrawal <hemant.agrawal@nxp.com>

this patch adds la12xx driver in test bbdev

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/test-bbdev/meson.build | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/app/test-bbdev/meson.build b/app/test-bbdev/meson.build
index edb9deef84..a726a5b3fa 100644
--- a/app/test-bbdev/meson.build
+++ b/app/test-bbdev/meson.build
@@ -23,3 +23,6 @@ endif
 if dpdk_conf.has('RTE_BASEBAND_ACC100')
     deps += ['baseband_acc100']
 endif
+if dpdk_conf.has('RTE_LIBRTE_PMD_BBDEV_LA12XX')
+	deps += ['baseband_la12xx']
+endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v10 8/8] app/bbdev: handle endianness of test data
  2021-10-11  4:32 ` [dpdk-dev] [PATCH v10 0/8] baseband: add NXP LA12xx driver nipun.gupta
                     ` (6 preceding siblings ...)
  2021-10-11  4:32   ` [dpdk-dev] [PATCH v10 7/8] app/bbdev: enable la12xx for bbdev nipun.gupta
@ 2021-10-11  4:32   ` nipun.gupta
  7 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-11  4:32 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

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

With data input, output and harq also supported in big
endian format, this patch updates the testbbdev application
to handle the endianness conversion as directed by the
the driver being used.

The test vectors assumes the data in the little endian order, and
thus if the driver supports big endian data processing, conversion
from little endian to big is handled by the testbbdev application.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 app/test-bbdev/test_bbdev_perf.c | 43 ++++++++++++++++++++++++++++++++
 doc/guides/tools/testbbdev.rst   |  3 +++
 2 files changed, 46 insertions(+)

diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c
index 469597b8b3..7b4529789b 100644
--- a/app/test-bbdev/test_bbdev_perf.c
+++ b/app/test-bbdev/test_bbdev_perf.c
@@ -227,6 +227,45 @@ clear_soft_out_cap(uint32_t *op_flags)
 	*op_flags &= ~RTE_BBDEV_TURBO_NEG_LLR_1_BIT_SOFT_OUT;
 }
 
+/* This API is to convert all the test vector op data entries
+ * to big endian format. It is used when the device supports
+ * the input in the big endian format.
+ */
+static inline void
+convert_op_data_to_be(void)
+{
+	struct op_data_entries *op;
+	enum op_data_type type;
+	uint8_t nb_segs, *rem_data, temp;
+	uint32_t *data, len;
+	int complete, rem, i, j;
+
+	for (type = DATA_INPUT; type < DATA_NUM_TYPES; ++type) {
+		nb_segs = test_vector.entries[type].nb_segments;
+		op = &test_vector.entries[type];
+
+		/* Invert byte endianness for all the segments */
+		for (i = 0; i < nb_segs; ++i) {
+			len = op->segments[i].length;
+			data = op->segments[i].addr;
+
+			/* Swap complete u32 bytes */
+			complete = len / 4;
+			for (j = 0; j < complete; j++)
+				data[j] = rte_bswap32(data[j]);
+
+			/* Swap any remaining bytes */
+			rem = len % 4;
+			rem_data = (uint8_t *)&data[j];
+			for (j = 0; j < rem/2; j++) {
+				temp = rem_data[j];
+				rem_data[j] = rem_data[rem - j - 1];
+				rem_data[rem - j - 1] = temp;
+			}
+		}
+	}
+}
+
 static int
 check_dev_cap(const struct rte_bbdev_info *dev_info)
 {
@@ -234,6 +273,7 @@ check_dev_cap(const struct rte_bbdev_info *dev_info)
 	unsigned int nb_inputs, nb_soft_outputs, nb_hard_outputs,
 		nb_harq_inputs, nb_harq_outputs;
 	const struct rte_bbdev_op_cap *op_cap = dev_info->drv.capabilities;
+	uint8_t dev_data_endianness = dev_info->drv.data_endianness;
 
 	nb_inputs = test_vector.entries[DATA_INPUT].nb_segments;
 	nb_soft_outputs = test_vector.entries[DATA_SOFT_OUTPUT].nb_segments;
@@ -245,6 +285,9 @@ check_dev_cap(const struct rte_bbdev_info *dev_info)
 		if (op_cap->type != test_vector.op_type)
 			continue;
 
+		if (dev_data_endianness == RTE_BIG_ENDIAN)
+			convert_op_data_to_be();
+
 		if (op_cap->type == RTE_BBDEV_OP_TURBO_DEC) {
 			const struct rte_bbdev_op_cap_turbo_dec *cap =
 					&op_cap->cap.turbo_dec;
diff --git a/doc/guides/tools/testbbdev.rst b/doc/guides/tools/testbbdev.rst
index d397d991ff..83a0312062 100644
--- a/doc/guides/tools/testbbdev.rst
+++ b/doc/guides/tools/testbbdev.rst
@@ -332,6 +332,9 @@ Variable op_type has to be defined as a first variable in file. It specifies
 what type of operations will be executed. For 4G decoder op_type has to be set to
 ``RTE_BBDEV_OP_TURBO_DEC`` and for 4G encoder to ``RTE_BBDEV_OP_TURBO_ENC``.
 
+Bbdev-test adjusts the byte endianness based on the PMD capability (data_endianness)
+and all the test vectors input/output data are assumed to be LE by default
+
 Full details of the meaning and valid values for the below fields are
 documented in *rte_bbdev_op.h*
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [EXT] [PATCH v10 2/8] baseband: introduce NXP LA12xx driver
  2021-10-11  4:32   ` [dpdk-dev] [PATCH v10 2/8] baseband: introduce NXP LA12xx driver nipun.gupta
@ 2021-10-16 13:58     ` Akhil Goyal
  0 siblings, 0 replies; 157+ messages in thread
From: Akhil Goyal @ 2021-10-16 13:58 UTC (permalink / raw)
  To: nipun.gupta, dev, nicolas.chautru; +Cc: david.marchand, hemant.agrawal

Hi Nipun, 
Few nits below.

Nicolas, Any more comments on this patchset, Can you ack?

> +++ b/drivers/baseband/la12xx/version.map
> @@ -0,0 +1,3 @@
> +DPDK_21 {
> +	local: *;
> +};
This should be DPDK_22

> diff --git a/drivers/baseband/meson.build b/drivers/baseband/meson.build
> index 5ee61d5323..ccd1eebc3b 100644
> --- a/drivers/baseband/meson.build
> +++ b/drivers/baseband/meson.build
> @@ -11,6 +11,7 @@ drivers = [
>          'fpga_lte_fec',
>          'null',
>          'turbo_sw',
> +        'la12xx',

Alphabetical order?

>  ]
> 
>  log_prefix = 'pmd.bb'
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [EXT] [PATCH v10 3/8] baseband/la12xx: add devargs for max queues
  2021-10-11  4:32   ` [dpdk-dev] [PATCH v10 3/8] baseband/la12xx: add devargs for max queues nipun.gupta
@ 2021-10-16 14:00     ` Akhil Goyal
  0 siblings, 0 replies; 157+ messages in thread
From: Akhil Goyal @ 2021-10-16 14:00 UTC (permalink / raw)
  To: nipun.gupta, dev, nicolas.chautru; +Cc: david.marchand, hemant.agrawal

> From: Hemant Agrawal <hemant.agrawal@nxp.com>
> 
> This patch adds dev args to take  max queues as input
> 
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
Documentation for dev args missing in this patch.

^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [EXT] [PATCH v10 5/8] baseband/la12xx: add queue and modem config support
  2021-10-11  4:32   ` [dpdk-dev] [PATCH v10 5/8] baseband/la12xx: add queue and modem config support nipun.gupta
@ 2021-10-16 14:13     ` Akhil Goyal
  0 siblings, 0 replies; 157+ messages in thread
From: Akhil Goyal @ 2021-10-16 14:13 UTC (permalink / raw)
  To: nipun.gupta, dev, nicolas.chautru; +Cc: david.marchand, hemant.agrawal

> +Prerequisites
> +-------------
> +
> +Currently supported by DPDK:
> +
> +- NXP LA1224 BSP **1.0+**.
> +- NXP LA1224 PCIe Modem card connected to ARM host.
> +
> +- Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup
> the basic DPDK environment.
> +
> +* Use dev arg option ``modem=0`` to identify the modem instance for a
> given
> +  device. This is required only if more than 1 modem cards are attached to
> host.
> +  this is optional and the default value is 0.
> +  e.g. ``--vdev=baseband_la12xx,modem=0``
> +
The documentation need to be split in different patches
- base doc to be added in first patch,
- devargs max_nb_queues for 2/8
- devargs modem for 5/8


> +* Use dev arg option ``max_nb_queues=x`` to specify the maximum number
> of queues
> +  to be used for communication with offload device i.e. modem. default is
> 16.
> +  e.g. ``--vdev=baseband_la12xx,max_nb_queues=4``
> +
> +Enabling logs
> +-------------
> +
> +For enabling logs, use the following EAL parameter:
> +
> +.. code-block:: console
> +
> +   ./your_bbdev_application <EAL args> --log-level=la12xx:<level>
> +
> +Using ``bb.la12xx`` as log matching criteria, all Baseband PMD logs can be
> +enabled which are lower than logging ``level``.
> diff --git a/doc/guides/rel_notes/release_21_11.rst
> b/doc/guides/rel_notes/release_21_11.rst
> index 135aa467f2..f4cae1b760 100644
> --- a/doc/guides/rel_notes/release_21_11.rst
> +++ b/doc/guides/rel_notes/release_21_11.rst
> @@ -134,6 +134,11 @@ New Features
>    * Added tests to validate packets hard expiry.
>    * Added tests to verify tunnel header verification in IPsec inbound.
> 
> +* **Added NXP LA12xx baseband PMD.**
> +
> +  * Added a new baseband PMD driver for NXP LA12xx Software defined
> radio.
> +  * See the :doc:`../bbdevs/la12xx` for more details.
> +
> 

Release notes may be added in your 6/8 patch where PMD is completely supported.

> +#define HUGEPG_OFFSET(A) \
> +		((uint64_t) ((unsigned long) (A) \
> +		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
> +
> +static int ipc_queue_configure(uint32_t channel_id,
> +		ipc_t instance, struct bbdev_la12xx_q_priv *q_priv)

Follow DPDK coding convention here and check for other functions also.


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v11 0/8]  baseband: add NXP LA12xx driver
  2021-03-18  6:34 [dpdk-dev] [PATCH 1/6] baseband: introduce NXP LA12xx driver Hemant Agrawal
                   ` (12 preceding siblings ...)
  2021-10-11  4:32 ` [dpdk-dev] [PATCH v10 0/8] baseband: add NXP LA12xx driver nipun.gupta
@ 2021-10-17  6:53 ` nipun.gupta
  2021-10-17  6:53   ` [dpdk-dev] [PATCH v11 1/8] bbdev: add device info related to data endianness nipun.gupta
                     ` (8 more replies)
  13 siblings, 9 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-17  6:53 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal

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

This series introduces the BBDEV LA12xx poll mode driver (PMD) to support
an implementation for offloading High Phy processing functions like
LDPC Encode / Decode 5GNR wireless acceleration function, using PCI based
LA12xx Software defined radio.

Please check the documentation patch for more info.

The driver currently implements basic feature to offload only the 5G LDPC
encode/decode.

A new capability has been added to check if the driver can support the
input data in little/big endian byte order.

v2: add test case changes
v3: fix 32 bit compilation
v4: capability for network byte order, doc patch merged inline.
v5: add llr_size and llr_decimals, removed LLR compression flag,
    update testbbdev to handle endianness, rebased on top of 20.08
v6: added BE as device info instead of capability, updated test
    to have 2 codeblocks
v7: fixed checkpatch errors
v8: remove additional test vectors, update reverse_op function name,
    make be_support param as bool, other minor changes in la12xx driver
v9: add little endianness capability as well (patch by Nicolas Chautru),
    fix 32 bit (i386) compilation, fix get of nb_segs, add endianness
    info in testbbdev doc.
v10: use default RTE_BIG_ENDIAN/RTE_LITTLE_ENDIAN defined, add
     data_endianness info for BBDEV null device
v11: split la12xx doc in separate patches and fixed some nits

Hemant Agrawal (5):
  baseband/la12xx: add devargs for max queues
  baseband/la12xx: add support for multiple modems
  baseband/la12xx: add queue and modem config support
  baseband/la12xx: add enqueue and dequeue support
  app/bbdev: enable la12xx for bbdev

Nicolas Chautru (1):
  bbdev: add device info related to data endianness

Nipun Gupta (2):
  baseband: introduce NXP LA12xx driver
  app/bbdev: handle endianness of test data

 MAINTAINERS                                   |   10 +
 app/test-bbdev/meson.build                    |    3 +
 app/test-bbdev/test_bbdev_perf.c              |   43 +
 doc/guides/bbdevs/features/la12xx.ini         |   13 +
 doc/guides/bbdevs/index.rst                   |    1 +
 doc/guides/bbdevs/la12xx.rst                  |  124 ++
 doc/guides/rel_notes/release_21_11.rst        |    6 +
 doc/guides/tools/testbbdev.rst                |    3 +
 drivers/baseband/acc100/rte_acc100_pmd.c      |    1 +
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         |    1 +
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |    1 +
 drivers/baseband/la12xx/bbdev_la12xx.c        | 1104 +++++++++++++++++
 drivers/baseband/la12xx/bbdev_la12xx.h        |   51 +
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h    |  244 ++++
 .../baseband/la12xx/bbdev_la12xx_pmd_logs.h   |   28 +
 drivers/baseband/la12xx/meson.build           |    6 +
 drivers/baseband/la12xx/version.map           |    3 +
 drivers/baseband/meson.build                  |    1 +
 drivers/baseband/null/bbdev_null.c            |    6 +
 .../baseband/turbo_sw/bbdev_turbo_software.c  |    1 +
 lib/bbdev/rte_bbdev.h                         |    4 +
 21 files changed, 1654 insertions(+)
 create mode 100644 doc/guides/bbdevs/features/la12xx.ini
 create mode 100644 doc/guides/bbdevs/la12xx.rst
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.c
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_ipc.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
 create mode 100644 drivers/baseband/la12xx/meson.build
 create mode 100644 drivers/baseband/la12xx/version.map

-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v11 1/8] bbdev: add device info related to data endianness
  2021-10-17  6:53 ` [dpdk-dev] [PATCH v11 0/8] baseband: add NXP LA12xx driver nipun.gupta
@ 2021-10-17  6:53   ` nipun.gupta
  2021-10-17  6:53   ` [dpdk-dev] [PATCH v11 2/8] baseband: introduce NXP LA12xx driver nipun.gupta
                     ` (7 subsequent siblings)
  8 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-17  6:53 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

From: Nicolas Chautru <nicolas.chautru@intel.com>

Adding device information to capture explicitly the assumption
of the input/output data byte endianness being processed.

Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 doc/guides/rel_notes/release_21_11.rst             | 1 +
 drivers/baseband/acc100/rte_acc100_pmd.c           | 1 +
 drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 1 +
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c       | 1 +
 drivers/baseband/null/bbdev_null.c                 | 6 ++++++
 drivers/baseband/turbo_sw/bbdev_turbo_software.c   | 1 +
 lib/bbdev/rte_bbdev.h                              | 4 ++++
 7 files changed, 15 insertions(+)

diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst
index 4c56cdfeaa..957bd78d61 100644
--- a/doc/guides/rel_notes/release_21_11.rst
+++ b/doc/guides/rel_notes/release_21_11.rst
@@ -229,6 +229,7 @@ API Changes
   the crypto/security operation. This field will be used to communicate
   events such as soft expiry with IPsec in lookaside mode.
 
+* bbdev: Added device info related to data byte endianness processing.
 
 ABI Changes
 -----------
diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c
index 4e2feefc3c..05fe6f8b6f 100644
--- a/drivers/baseband/acc100/rte_acc100_pmd.c
+++ b/drivers/baseband/acc100/rte_acc100_pmd.c
@@ -1089,6 +1089,7 @@ acc100_dev_info_get(struct rte_bbdev *dev,
 #else
 	dev_info->harq_buffer_size = 0;
 #endif
+	dev_info->data_endianness = RTE_LITTLE_ENDIAN;
 	acc100_check_ir(d);
 }
 
diff --git a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
index 6485cc824a..ee457f3071 100644
--- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
+++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
@@ -372,6 +372,7 @@ fpga_dev_info_get(struct rte_bbdev *dev,
 	dev_info->default_queue_conf = default_queue_conf;
 	dev_info->capabilities = bbdev_capabilities;
 	dev_info->cpu_flag_reqs = NULL;
+	dev_info->data_endianness = RTE_LITTLE_ENDIAN;
 
 	/* Calculates number of queues assigned to device */
 	dev_info->max_num_queues = 0;
diff --git a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
index 350c4248eb..703bb611a0 100644
--- a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
+++ b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
@@ -644,6 +644,7 @@ fpga_dev_info_get(struct rte_bbdev *dev,
 	dev_info->default_queue_conf = default_queue_conf;
 	dev_info->capabilities = bbdev_capabilities;
 	dev_info->cpu_flag_reqs = NULL;
+	dev_info->data_endianness = RTE_LITTLE_ENDIAN;
 
 	/* Calculates number of queues assigned to device */
 	dev_info->max_num_queues = 0;
diff --git a/drivers/baseband/null/bbdev_null.c b/drivers/baseband/null/bbdev_null.c
index 53c538ba44..753d920e18 100644
--- a/drivers/baseband/null/bbdev_null.c
+++ b/drivers/baseband/null/bbdev_null.c
@@ -77,6 +77,12 @@ info_get(struct rte_bbdev *dev, struct rte_bbdev_driver_info *dev_info)
 	dev_info->cpu_flag_reqs = NULL;
 	dev_info->min_alignment = 0;
 
+	/* BBDEV null device does not process the data, so
+	 * endianness setting is not relevant, but setting it
+	 * here for code completeness.
+	 */
+	dev_info->data_endianness = RTE_LITTLE_ENDIAN;
+
 	rte_bbdev_log_debug("got device info from %u", dev->data->dev_id);
 }
 
diff --git a/drivers/baseband/turbo_sw/bbdev_turbo_software.c b/drivers/baseband/turbo_sw/bbdev_turbo_software.c
index e1db2bf205..b234bb751a 100644
--- a/drivers/baseband/turbo_sw/bbdev_turbo_software.c
+++ b/drivers/baseband/turbo_sw/bbdev_turbo_software.c
@@ -253,6 +253,7 @@ info_get(struct rte_bbdev *dev, struct rte_bbdev_driver_info *dev_info)
 	dev_info->capabilities = bbdev_capabilities;
 	dev_info->min_alignment = 64;
 	dev_info->harq_buffer_size = 0;
+	dev_info->data_endianness = RTE_LITTLE_ENDIAN;
 
 	rte_bbdev_log_debug("got device info from %u\n", dev->data->dev_id);
 }
diff --git a/lib/bbdev/rte_bbdev.h b/lib/bbdev/rte_bbdev.h
index 3ebf62e697..e863bd913f 100644
--- a/lib/bbdev/rte_bbdev.h
+++ b/lib/bbdev/rte_bbdev.h
@@ -309,6 +309,10 @@ struct rte_bbdev_driver_info {
 	uint16_t min_alignment;
 	/** HARQ memory available in kB */
 	uint32_t harq_buffer_size;
+	/** Byte endianness (RTE_BIG_ENDIAN/RTE_LITTLE_ENDIAN) supported
+	 *  for input/output data
+	 */
+	uint8_t data_endianness;
 	/** Default queue configuration used if none is supplied  */
 	struct rte_bbdev_queue_conf default_queue_conf;
 	/** Device operation capabilities */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v11 2/8] baseband: introduce NXP LA12xx driver
  2021-10-17  6:53 ` [dpdk-dev] [PATCH v11 0/8] baseband: add NXP LA12xx driver nipun.gupta
  2021-10-17  6:53   ` [dpdk-dev] [PATCH v11 1/8] bbdev: add device info related to data endianness nipun.gupta
@ 2021-10-17  6:53   ` nipun.gupta
  2021-10-17  6:53   ` [dpdk-dev] [PATCH v11 3/8] baseband/la12xx: add devargs for max queues nipun.gupta
                     ` (6 subsequent siblings)
  8 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-17  6:53 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

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

This patch introduce the baseband device drivers for NXP's
LA1200 series software defined baseband modem.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 MAINTAINERS                                   |  10 ++
 doc/guides/bbdevs/index.rst                   |   1 +
 doc/guides/bbdevs/la12xx.rst                  |  71 ++++++++++++
 drivers/baseband/la12xx/bbdev_la12xx.c        | 108 ++++++++++++++++++
 .../baseband/la12xx/bbdev_la12xx_pmd_logs.h   |  28 +++++
 drivers/baseband/la12xx/meson.build           |   6 +
 drivers/baseband/la12xx/version.map           |   3 +
 drivers/baseband/meson.build                  |   1 +
 8 files changed, 228 insertions(+)
 create mode 100644 doc/guides/bbdevs/la12xx.rst
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.c
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
 create mode 100644 drivers/baseband/la12xx/meson.build
 create mode 100644 drivers/baseband/la12xx/version.map

diff --git a/MAINTAINERS b/MAINTAINERS
index ed8becce85..ff632479c5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1289,6 +1289,16 @@ F: drivers/event/opdl/
 F: doc/guides/eventdevs/opdl.rst
 
 
+Baseband Drivers
+----------------
+
+NXP LA12xx driver
+M: Nipun Gupta <nipun.gupta@nxp.com>
+M: Hemant Agrawal <hemant.agrawal@nxp.com>
+F: drivers/baseband/la12xx/
+F: doc/guides/bbdevs/la12xx.rst
+
+
 Rawdev Drivers
 --------------
 
diff --git a/doc/guides/bbdevs/index.rst b/doc/guides/bbdevs/index.rst
index 4445cbd1b0..cedd706fa6 100644
--- a/doc/guides/bbdevs/index.rst
+++ b/doc/guides/bbdevs/index.rst
@@ -14,3 +14,4 @@ Baseband Device Drivers
     fpga_lte_fec
     fpga_5gnr_fec
     acc100
+    la12xx
diff --git a/doc/guides/bbdevs/la12xx.rst b/doc/guides/bbdevs/la12xx.rst
new file mode 100644
index 0000000000..9ac6f0a0cd
--- /dev/null
+++ b/doc/guides/bbdevs/la12xx.rst
@@ -0,0 +1,71 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright 2021 NXP
+
+NXP LA12xx Poll Mode Driver
+=======================================
+
+The BBDEV LA12xx poll mode driver (PMD) supports an implementation for
+offloading High Phy processing functions like LDPC Encode / Decode 5GNR wireless
+acceleration function, using PCI based LA12xx Software defined radio.
+
+More information can be found at `NXP Official Website
+<https://www.nxp.com/products/processors-and-microcontrollers/arm-processors/layerscape-processors/layerscape-access-la1200-programmable-baseband-processor:LA1200>`_.
+
+Features
+--------
+
+LA12xx PMD supports the following features:
+
+- Maximum of 8 LDPC decode (UL) queues
+- Maximum of 8 LDPC encode (DL) queues
+- PCIe Gen-3 x8 Interface
+
+Installation
+------------
+
+Section 3 of the DPDK manual provides instructions on installing and compiling DPDK.
+
+DPDK requires hugepages to be configured as detailed in section 2 of the DPDK manual.
+
+Initialization
+--------------
+
+The device can be listed on the host console with:
+
+
+Use the following lspci command to get the multiple LA12xx processor ids. The
+device ID of the LA12xx baseband processor is "1c30".
+
+.. code-block:: console
+
+  sudo lspci -nn
+
+...
+0001:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device [1957:1c30] (
+rev 10)
+...
+0002:01:00.0 Power PC [0b20]: Freescale Semiconductor Inc Device [1957:1c30] (
+rev 10)
+
+
+Prerequisites
+-------------
+
+Currently supported by DPDK:
+
+- NXP LA1224 BSP **1.0+**.
+- NXP LA1224 PCIe Modem card connected to ARM host.
+
+- Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup the basic DPDK environment.
+
+Enabling logs
+-------------
+
+For enabling logs, use the following EAL parameter:
+
+.. code-block:: console
+
+   ./your_bbdev_application <EAL args> --log-level=la12xx:<level>
+
+Using ``bb.la12xx`` as log matching criteria, all Baseband PMD logs can be
+enabled which are lower than logging ``level``.
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
new file mode 100644
index 0000000000..d3d7a4df37
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -0,0 +1,108 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+
+#include <string.h>
+
+#include <rte_common.h>
+#include <rte_bus_vdev.h>
+#include <rte_malloc.h>
+#include <rte_ring.h>
+#include <rte_kvargs.h>
+
+#include <rte_bbdev.h>
+#include <rte_bbdev_pmd.h>
+
+#include <bbdev_la12xx_pmd_logs.h>
+
+#define DRIVER_NAME baseband_la12xx
+
+/* private data structure */
+struct bbdev_la12xx_private {
+	unsigned int max_nb_queues;  /**< Max number of queues */
+};
+/* Create device */
+static int
+la12xx_bbdev_create(struct rte_vdev_device *vdev)
+{
+	struct rte_bbdev *bbdev;
+	const char *name = rte_vdev_device_name(vdev);
+
+	PMD_INIT_FUNC_TRACE();
+
+	bbdev = rte_bbdev_allocate(name);
+	if (bbdev == NULL)
+		return -ENODEV;
+
+	bbdev->data->dev_private = rte_zmalloc(name,
+			sizeof(struct bbdev_la12xx_private),
+			RTE_CACHE_LINE_SIZE);
+	if (bbdev->data->dev_private == NULL) {
+		rte_bbdev_release(bbdev);
+		return -ENOMEM;
+	}
+
+	bbdev->dev_ops = NULL;
+	bbdev->device = &vdev->device;
+	bbdev->data->socket_id = 0;
+	bbdev->intr_handle = NULL;
+
+	/* register rx/tx burst functions for data path */
+	bbdev->dequeue_enc_ops = NULL;
+	bbdev->dequeue_dec_ops = NULL;
+	bbdev->enqueue_enc_ops = NULL;
+	bbdev->enqueue_dec_ops = NULL;
+
+	return 0;
+}
+
+/* Initialise device */
+static int
+la12xx_bbdev_probe(struct rte_vdev_device *vdev)
+{
+	const char *name;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (vdev == NULL)
+		return -EINVAL;
+
+	name = rte_vdev_device_name(vdev);
+	if (name == NULL)
+		return -EINVAL;
+
+	return la12xx_bbdev_create(vdev);
+}
+
+/* Uninitialise device */
+static int
+la12xx_bbdev_remove(struct rte_vdev_device *vdev)
+{
+	struct rte_bbdev *bbdev;
+	const char *name;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (vdev == NULL)
+		return -EINVAL;
+
+	name = rte_vdev_device_name(vdev);
+	if (name == NULL)
+		return -EINVAL;
+
+	bbdev = rte_bbdev_get_named_dev(name);
+	if (bbdev == NULL)
+		return -EINVAL;
+
+	rte_free(bbdev->data->dev_private);
+
+	return rte_bbdev_release(bbdev);
+}
+
+static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
+	.probe = la12xx_bbdev_probe,
+	.remove = la12xx_bbdev_remove
+};
+
+RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
+RTE_LOG_REGISTER_DEFAULT(bbdev_la12xx_logtype, NOTICE);
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h b/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
new file mode 100644
index 0000000000..452435ccb9
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx_pmd_logs.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020 NXP
+ */
+
+#ifndef _BBDEV_LA12XX_PMD_LOGS_H_
+#define _BBDEV_LA12XX_PMD_LOGS_H_
+
+extern int bbdev_la12xx_logtype;
+
+#define rte_bbdev_log(level, fmt, ...) \
+	rte_log(RTE_LOG_ ## level, bbdev_la12xx_logtype, fmt "\n", \
+		##__VA_ARGS__)
+
+#ifdef RTE_LIBRTE_BBDEV_DEBUG
+#define rte_bbdev_log_debug(fmt, ...) \
+		rte_bbdev_log(DEBUG, "la12xx_pmd: " fmt, \
+		##__VA_ARGS__)
+#else
+#define rte_bbdev_log_debug(fmt, ...)
+#endif
+
+#define PMD_INIT_FUNC_TRACE() rte_bbdev_log_debug(">>")
+
+/* DP Logs, toggled out at compile time if level lower than current level */
+#define rte_bbdev_dp_log(level, fmt, args...) \
+	RTE_LOG_DP(level, PMD, fmt, ## args)
+
+#endif /* _BBDEV_LA12XX_PMD_LOGS_H_ */
diff --git a/drivers/baseband/la12xx/meson.build b/drivers/baseband/la12xx/meson.build
new file mode 100644
index 0000000000..7a017dcffa
--- /dev/null
+++ b/drivers/baseband/la12xx/meson.build
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020-2021 NXP
+
+deps += ['bbdev', 'bus_vdev', 'ring']
+
+sources = files('bbdev_la12xx.c')
diff --git a/drivers/baseband/la12xx/version.map b/drivers/baseband/la12xx/version.map
new file mode 100644
index 0000000000..4a76d1d52d
--- /dev/null
+++ b/drivers/baseband/la12xx/version.map
@@ -0,0 +1,3 @@
+DPDK_21 {
+	local: *;
+};
diff --git a/drivers/baseband/meson.build b/drivers/baseband/meson.build
index 5ee61d5323..686e98b2ed 100644
--- a/drivers/baseband/meson.build
+++ b/drivers/baseband/meson.build
@@ -9,6 +9,7 @@ drivers = [
         'acc100',
         'fpga_5gnr_fec',
         'fpga_lte_fec',
+        'la12xx',
         'null',
         'turbo_sw',
 ]
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v11 3/8] baseband/la12xx: add devargs for max queues
  2021-10-17  6:53 ` [dpdk-dev] [PATCH v11 0/8] baseband: add NXP LA12xx driver nipun.gupta
  2021-10-17  6:53   ` [dpdk-dev] [PATCH v11 1/8] bbdev: add device info related to data endianness nipun.gupta
  2021-10-17  6:53   ` [dpdk-dev] [PATCH v11 2/8] baseband: introduce NXP LA12xx driver nipun.gupta
@ 2021-10-17  6:53   ` nipun.gupta
  2021-10-17  6:53   ` [dpdk-dev] [PATCH v11 4/8] baseband/la12xx: add support for multiple modems nipun.gupta
                     ` (5 subsequent siblings)
  8 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-17  6:53 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This patch adds dev args to take  max queues as input

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 doc/guides/bbdevs/la12xx.rst           |  4 ++
 drivers/baseband/la12xx/bbdev_la12xx.c | 73 +++++++++++++++++++++++++-
 2 files changed, 75 insertions(+), 2 deletions(-)

diff --git a/doc/guides/bbdevs/la12xx.rst b/doc/guides/bbdevs/la12xx.rst
index 9ac6f0a0cd..3725078567 100644
--- a/doc/guides/bbdevs/la12xx.rst
+++ b/doc/guides/bbdevs/la12xx.rst
@@ -58,6 +58,10 @@ Currently supported by DPDK:
 
 - Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup the basic DPDK environment.
 
+* Use dev arg option ``max_nb_queues=x`` to specify the maximum number of queues
+  to be used for communication with offload device i.e. modem. default is 16.
+  e.g. ``--vdev=baseband_la12xx,max_nb_queues=4``
+
 Enabling logs
 -------------
 
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index d3d7a4df37..f5c835eeb8 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -17,13 +17,73 @@
 
 #define DRIVER_NAME baseband_la12xx
 
+/*  Initialisation params structure that can be used by LA12xx BBDEV driver */
+struct bbdev_la12xx_params {
+	uint8_t queues_num; /*< LA12xx BBDEV queues number */
+};
+
+#define LA12XX_MAX_NB_QUEUES_ARG	"max_nb_queues"
+
+static const char * const bbdev_la12xx_valid_params[] = {
+	LA12XX_MAX_NB_QUEUES_ARG,
+};
+
 /* private data structure */
 struct bbdev_la12xx_private {
 	unsigned int max_nb_queues;  /**< Max number of queues */
 };
+static inline int
+parse_u16_arg(const char *key, const char *value, void *extra_args)
+{
+	uint16_t *u16 = extra_args;
+
+	uint64_t result;
+	if ((value == NULL) || (extra_args == NULL))
+		return -EINVAL;
+	errno = 0;
+	result = strtoul(value, NULL, 0);
+	if ((result >= (1 << 16)) || (errno != 0)) {
+		rte_bbdev_log(ERR, "Invalid value %" PRIu64 " for %s",
+			      result, key);
+		return -ERANGE;
+	}
+	*u16 = (uint16_t)result;
+	return 0;
+}
+
+/* Parse parameters used to create device */
+static int
+parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
+		const char *input_args)
+{
+	struct rte_kvargs *kvlist = NULL;
+	int ret = 0;
+
+	if (params == NULL)
+		return -EINVAL;
+	if (input_args) {
+		kvlist = rte_kvargs_parse(input_args,
+				bbdev_la12xx_valid_params);
+		if (kvlist == NULL)
+			return -EFAULT;
+
+		ret = rte_kvargs_process(kvlist, bbdev_la12xx_valid_params[0],
+					&parse_u16_arg, &params->queues_num);
+		if (ret < 0)
+			goto exit;
+
+	}
+
+exit:
+	if (kvlist)
+		rte_kvargs_free(kvlist);
+	return ret;
+}
+
 /* Create device */
 static int
-la12xx_bbdev_create(struct rte_vdev_device *vdev)
+la12xx_bbdev_create(struct rte_vdev_device *vdev,
+		struct bbdev_la12xx_params *init_params __rte_unused)
 {
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
@@ -60,7 +120,11 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev)
 static int
 la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 {
+	struct bbdev_la12xx_params init_params = {
+		8
+	};
 	const char *name;
+	const char *input_args;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -71,7 +135,10 @@ la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 	if (name == NULL)
 		return -EINVAL;
 
-	return la12xx_bbdev_create(vdev);
+	input_args = rte_vdev_device_args(vdev);
+	parse_bbdev_la12xx_params(&init_params, input_args);
+
+	return la12xx_bbdev_create(vdev, &init_params);
 }
 
 /* Uninitialise device */
@@ -105,4 +172,6 @@ static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
 };
 
 RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
+RTE_PMD_REGISTER_PARAM_STRING(DRIVER_NAME,
+	LA12XX_MAX_NB_QUEUES_ARG"=<int>");
 RTE_LOG_REGISTER_DEFAULT(bbdev_la12xx_logtype, NOTICE);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v11 4/8] baseband/la12xx: add support for multiple modems
  2021-10-17  6:53 ` [dpdk-dev] [PATCH v11 0/8] baseband: add NXP LA12xx driver nipun.gupta
                     ` (2 preceding siblings ...)
  2021-10-17  6:53   ` [dpdk-dev] [PATCH v11 3/8] baseband/la12xx: add devargs for max queues nipun.gupta
@ 2021-10-17  6:53   ` nipun.gupta
  2021-10-17  6:53   ` [dpdk-dev] [PATCH v11 5/8] baseband/la12xx: add queue and modem config support nipun.gupta
                     ` (4 subsequent siblings)
  8 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-17  6:53 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This patch add support for multiple modems by assigning
a modem id as dev args in vdev creation.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 doc/guides/bbdevs/la12xx.rst               |  5 ++
 drivers/baseband/la12xx/bbdev_la12xx.c     | 64 +++++++++++++++++++---
 drivers/baseband/la12xx/bbdev_la12xx.h     | 56 +++++++++++++++++++
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 20 +++++++
 4 files changed, 138 insertions(+), 7 deletions(-)
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.h
 create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_ipc.h

diff --git a/doc/guides/bbdevs/la12xx.rst b/doc/guides/bbdevs/la12xx.rst
index 3725078567..1a711ef5e3 100644
--- a/doc/guides/bbdevs/la12xx.rst
+++ b/doc/guides/bbdevs/la12xx.rst
@@ -58,6 +58,11 @@ Currently supported by DPDK:
 
 - Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup the basic DPDK environment.
 
+* Use dev arg option ``modem=0`` to identify the modem instance for a given
+  device. This is required only if more than 1 modem cards are attached to host.
+  this is optional and the default value is 0.
+  e.g. ``--vdev=baseband_la12xx,modem=0``
+
 * Use dev arg option ``max_nb_queues=x`` to specify the maximum number of queues
   to be used for communication with offload device i.e. modem. default is 16.
   e.g. ``--vdev=baseband_la12xx,max_nb_queues=4``
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index f5c835eeb8..58defa54f0 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -14,24 +14,26 @@
 #include <rte_bbdev_pmd.h>
 
 #include <bbdev_la12xx_pmd_logs.h>
+#include <bbdev_la12xx_ipc.h>
+#include <bbdev_la12xx.h>
 
 #define DRIVER_NAME baseband_la12xx
 
 /*  Initialisation params structure that can be used by LA12xx BBDEV driver */
 struct bbdev_la12xx_params {
 	uint8_t queues_num; /*< LA12xx BBDEV queues number */
+	int8_t modem_id; /*< LA12xx modem instance id */
 };
 
 #define LA12XX_MAX_NB_QUEUES_ARG	"max_nb_queues"
+#define LA12XX_VDEV_MODEM_ID_ARG	"modem"
+#define LA12XX_MAX_MODEM 4
 
 static const char * const bbdev_la12xx_valid_params[] = {
 	LA12XX_MAX_NB_QUEUES_ARG,
+	LA12XX_VDEV_MODEM_ID_ARG,
 };
 
-/* private data structure */
-struct bbdev_la12xx_private {
-	unsigned int max_nb_queues;  /**< Max number of queues */
-};
 static inline int
 parse_u16_arg(const char *key, const char *value, void *extra_args)
 {
@@ -51,6 +53,28 @@ parse_u16_arg(const char *key, const char *value, void *extra_args)
 	return 0;
 }
 
+/* Parse integer from integer argument */
+static int
+parse_integer_arg(const char *key __rte_unused,
+		const char *value, void *extra_args)
+{
+	int i;
+	char *end;
+
+	errno = 0;
+
+	i = strtol(value, &end, 10);
+	if (*end != 0 || errno != 0 || i < 0 || i > LA12XX_MAX_MODEM) {
+		rte_bbdev_log(ERR, "Supported Port IDS are 0 to %d",
+			LA12XX_MAX_MODEM - 1);
+		return -EINVAL;
+	}
+
+	*((uint32_t *)extra_args) = i;
+
+	return 0;
+}
+
 /* Parse parameters used to create device */
 static int
 parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
@@ -72,6 +96,16 @@ parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
 		if (ret < 0)
 			goto exit;
 
+		ret = rte_kvargs_process(kvlist,
+					bbdev_la12xx_valid_params[1],
+					&parse_integer_arg,
+					&params->modem_id);
+
+		if (params->modem_id >= LA12XX_MAX_MODEM) {
+			rte_bbdev_log(ERR, "Invalid modem id, must be < %u",
+					LA12XX_MAX_MODEM);
+			goto exit;
+		}
 	}
 
 exit:
@@ -83,10 +117,11 @@ parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params,
 /* Create device */
 static int
 la12xx_bbdev_create(struct rte_vdev_device *vdev,
-		struct bbdev_la12xx_params *init_params __rte_unused)
+		struct bbdev_la12xx_params *init_params)
 {
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
+	struct bbdev_la12xx_private *priv;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -102,6 +137,20 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 		return -ENOMEM;
 	}
 
+	priv = bbdev->data->dev_private;
+	priv->modem_id = init_params->modem_id;
+	/* if modem id is not configured */
+	if (priv->modem_id == -1)
+		priv->modem_id = bbdev->data->dev_id;
+
+	/* Reset Global variables */
+	priv->num_ldpc_enc_queues = 0;
+	priv->num_ldpc_dec_queues = 0;
+	priv->num_valid_queues = 0;
+	priv->max_nb_queues = init_params->queues_num;
+
+	rte_bbdev_log(INFO, "Setting Up %s: DevId=%d, ModemId=%d",
+				name, bbdev->data->dev_id, priv->modem_id);
 	bbdev->dev_ops = NULL;
 	bbdev->device = &vdev->device;
 	bbdev->data->socket_id = 0;
@@ -121,7 +170,7 @@ static int
 la12xx_bbdev_probe(struct rte_vdev_device *vdev)
 {
 	struct bbdev_la12xx_params init_params = {
-		8
+		8, -1,
 	};
 	const char *name;
 	const char *input_args;
@@ -173,5 +222,6 @@ static struct rte_vdev_driver bbdev_la12xx_pmd_drv = {
 
 RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv);
 RTE_PMD_REGISTER_PARAM_STRING(DRIVER_NAME,
-	LA12XX_MAX_NB_QUEUES_ARG"=<int>");
+	LA12XX_MAX_NB_QUEUES_ARG"=<int>"
+	LA12XX_VDEV_MODEM_ID_ARG "=<int> ");
 RTE_LOG_REGISTER_DEFAULT(bbdev_la12xx_logtype, NOTICE);
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.h b/drivers/baseband/la12xx/bbdev_la12xx.h
new file mode 100644
index 0000000000..5228502331
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx.h
@@ -0,0 +1,56 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+
+#ifndef __BBDEV_LA12XX_H__
+#define __BBDEV_LA12XX_H__
+
+#define BBDEV_IPC_ENC_OP_TYPE	1
+#define BBDEV_IPC_DEC_OP_TYPE	2
+
+#define MAX_LDPC_ENC_FECA_QUEUES	4
+#define MAX_LDPC_DEC_FECA_QUEUES	4
+
+#define MAX_CHANNEL_DEPTH 16
+/* private data structure */
+struct bbdev_la12xx_private {
+	void *ipc_priv;
+	uint8_t num_valid_queues;
+	uint8_t max_nb_queues;
+	uint8_t num_ldpc_enc_queues;
+	uint8_t num_ldpc_dec_queues;
+	int8_t modem_id;
+	struct bbdev_la12xx_q_priv *queues_priv[32];
+};
+
+struct hugepage_info {
+	void *vaddr;
+	phys_addr_t paddr;
+	size_t len;
+};
+
+struct bbdev_la12xx_q_priv {
+	struct bbdev_la12xx_private *bbdev_priv;
+	uint32_t q_id;	/**< Channel ID */
+	uint32_t feca_blk_id;	/** FECA block ID for processing */
+	uint32_t feca_blk_id_be32; /**< FECA Block ID for this queue */
+	uint8_t en_napi; /* 0: napi disabled, 1: napi enabled */
+	uint16_t queue_size;	/**< Queue depth */
+	int32_t eventfd;	/**< Event FD value */
+	enum rte_bbdev_op_type op_type; /**< Operation type */
+	uint32_t la12xx_core_id;
+		/* LA12xx core ID on which this will be scheduled */
+	struct rte_mempool *mp; /**< Pool from where buffers would be cut */
+	void *bbdev_op[MAX_CHANNEL_DEPTH];
+			/**< Stores bbdev op for each index */
+	void *msg_ch_vaddr[MAX_CHANNEL_DEPTH];
+			/**< Stores msg channel addr for modem->host */
+	uint32_t host_pi;	/**< Producer_Index for HOST->MODEM */
+	uint32_t host_ci;	/**< Consumer Index for MODEM->HOST */
+	host_ipc_params_t *host_params; /**< Host parameters */
+};
+
+#define lower_32_bits(x) ((uint32_t)((uint64_t)x))
+#define upper_32_bits(x) ((uint32_t)(((uint64_t)(x) >> 16) >> 16))
+
+#endif
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
new file mode 100644
index 0000000000..9aa5562981
--- /dev/null
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2021 NXP
+ */
+#ifndef __BBDEV_LA12XX_IPC_H__
+#define __BBDEV_LA12XX_IPC_H__
+
+/** No. of max channel per instance */
+#define IPC_MAX_DEPTH	(16)
+
+/* This shared memory would be on the host side which have copy of some
+ * of the parameters which are also part of Shared BD ring. Read access
+ * of these parameters from the host side would not be over PCI.
+ */
+typedef struct host_ipc_params {
+	volatile uint32_t pi;
+	volatile uint32_t ci;
+	volatile uint32_t modem_ptr[IPC_MAX_DEPTH];
+} __rte_packed host_ipc_params_t;
+
+#endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v11 5/8] baseband/la12xx: add queue and modem config support
  2021-10-17  6:53 ` [dpdk-dev] [PATCH v11 0/8] baseband: add NXP LA12xx driver nipun.gupta
                     ` (3 preceding siblings ...)
  2021-10-17  6:53   ` [dpdk-dev] [PATCH v11 4/8] baseband/la12xx: add support for multiple modems nipun.gupta
@ 2021-10-17  6:53   ` nipun.gupta
  2021-10-17  6:53   ` [dpdk-dev] [PATCH v11 6/8] baseband/la12xx: add enqueue and dequeue support nipun.gupta
                     ` (3 subsequent siblings)
  8 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-17  6:53 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This patch add support for connecting with modem
and creating the ipc channel as queues with modem
for the exchange of data.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/baseband/la12xx/bbdev_la12xx.c     | 559 ++++++++++++++++++++-
 drivers/baseband/la12xx/bbdev_la12xx.h     |  17 +-
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 189 ++++++-
 3 files changed, 752 insertions(+), 13 deletions(-)

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 58defa54f0..7e312cf2e7 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -3,6 +3,11 @@
  */
 
 #include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <dirent.h>
 
 #include <rte_common.h>
 #include <rte_bus_vdev.h>
@@ -29,11 +34,556 @@ struct bbdev_la12xx_params {
 #define LA12XX_VDEV_MODEM_ID_ARG	"modem"
 #define LA12XX_MAX_MODEM 4
 
+#define LA12XX_MAX_CORES	4
+#define LA12XX_LDPC_ENC_CORE	0
+#define LA12XX_LDPC_DEC_CORE	1
+
+#define LA12XX_MAX_LDPC_ENC_QUEUES	4
+#define LA12XX_MAX_LDPC_DEC_QUEUES	4
+
 static const char * const bbdev_la12xx_valid_params[] = {
 	LA12XX_MAX_NB_QUEUES_ARG,
 	LA12XX_VDEV_MODEM_ID_ARG,
 };
 
+static const struct rte_bbdev_op_cap bbdev_capabilities[] = {
+	{
+		.type   = RTE_BBDEV_OP_LDPC_ENC,
+		.cap.ldpc_enc = {
+			.capability_flags =
+					RTE_BBDEV_LDPC_RATE_MATCH |
+					RTE_BBDEV_LDPC_CRC_24A_ATTACH |
+					RTE_BBDEV_LDPC_CRC_24B_ATTACH,
+			.num_buffers_src =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+			.num_buffers_dst =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+		}
+	},
+	{
+		.type   = RTE_BBDEV_OP_LDPC_DEC,
+		.cap.ldpc_dec = {
+			.capability_flags =
+				RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK |
+					RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK |
+					RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP,
+			.num_buffers_src =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+			.num_buffers_hard_out =
+					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+			.llr_size = 8,
+			.llr_decimals = 1,
+		}
+	},
+	RTE_BBDEV_END_OF_CAPABILITIES_LIST()
+};
+
+static struct rte_bbdev_queue_conf default_queue_conf = {
+	.queue_size = MAX_CHANNEL_DEPTH,
+};
+
+/* Get device info */
+static void
+la12xx_info_get(struct rte_bbdev *dev __rte_unused,
+		struct rte_bbdev_driver_info *dev_info)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	dev_info->driver_name = RTE_STR(DRIVER_NAME);
+	dev_info->max_num_queues = LA12XX_MAX_QUEUES;
+	dev_info->queue_size_lim = MAX_CHANNEL_DEPTH;
+	dev_info->hardware_accelerated = true;
+	dev_info->max_dl_queue_priority = 0;
+	dev_info->max_ul_queue_priority = 0;
+	dev_info->data_endianness = RTE_BIG_ENDIAN;
+	dev_info->default_queue_conf = default_queue_conf;
+	dev_info->capabilities = bbdev_capabilities;
+	dev_info->cpu_flag_reqs = NULL;
+	dev_info->min_alignment = 64;
+
+	rte_bbdev_log_debug("got device info from %u", dev->data->dev_id);
+}
+
+/* Release queue */
+static int
+la12xx_queue_release(struct rte_bbdev *dev, uint16_t q_id)
+{
+	RTE_SET_USED(dev);
+	RTE_SET_USED(q_id);
+
+	PMD_INIT_FUNC_TRACE();
+
+	return 0;
+}
+
+#define HUGEPG_OFFSET(A) \
+		((uint64_t) ((unsigned long) (A) \
+		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
+
+static int
+ipc_queue_configure(uint32_t channel_id,
+		    ipc_t instance,
+		    struct bbdev_la12xx_q_priv *q_priv)
+{
+	ipc_userspace_t *ipc_priv = (ipc_userspace_t *)instance;
+	ipc_instance_t *ipc_instance = ipc_priv->instance;
+	ipc_ch_t *ch;
+	void *vaddr;
+	uint32_t i = 0;
+	uint32_t msg_size = sizeof(struct bbdev_ipc_enqueue_op);
+
+	PMD_INIT_FUNC_TRACE();
+
+	rte_bbdev_log_debug("%x %p", ipc_instance->initialized,
+		ipc_priv->instance);
+	ch = &(ipc_instance->ch_list[channel_id]);
+
+	rte_bbdev_log_debug("channel: %u, depth: %u, msg size: %u",
+		channel_id, q_priv->queue_size, msg_size);
+
+	/* Start init of channel */
+	ch->md.ring_size = rte_cpu_to_be_32(q_priv->queue_size);
+	ch->md.pi = 0;
+	ch->md.ci = 0;
+	ch->md.msg_size = msg_size;
+	for (i = 0; i < q_priv->queue_size; i++) {
+		vaddr = rte_malloc(NULL, msg_size, RTE_CACHE_LINE_SIZE);
+		if (!vaddr)
+			return IPC_HOST_BUF_ALLOC_FAIL;
+		/* Only offset now */
+		ch->bd_h[i].modem_ptr =
+			rte_cpu_to_be_32(HUGEPG_OFFSET(vaddr));
+		ch->bd_h[i].host_virt_l = lower_32_bits(vaddr);
+		ch->bd_h[i].host_virt_h = upper_32_bits(vaddr);
+		q_priv->msg_ch_vaddr[i] = vaddr;
+		/* Not sure use of this len may be for CRC*/
+		ch->bd_h[i].len = 0;
+	}
+	ch->host_ipc_params =
+		rte_cpu_to_be_32(HUGEPG_OFFSET(q_priv->host_params));
+
+	rte_bbdev_log_debug("Channel configured");
+	return IPC_SUCCESS;
+}
+
+static int
+la12xx_e200_queue_setup(struct rte_bbdev *dev,
+		struct bbdev_la12xx_q_priv *q_priv)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	struct gul_hif *mhif;
+	ipc_metadata_t *ipc_md;
+	ipc_ch_t *ch;
+	int instance_id = 0, i;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		q_priv->la12xx_core_id = LA12XX_LDPC_ENC_CORE;
+		break;
+	case RTE_BBDEV_OP_LDPC_DEC:
+		q_priv->la12xx_core_id = LA12XX_LDPC_DEC_CORE;
+		break;
+	default:
+		rte_bbdev_log(ERR, "Unsupported op type\n");
+		return -1;
+	}
+
+	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+	/* offset is from start of PEB */
+	ipc_md = (ipc_metadata_t *)((uintptr_t)ipc_priv->peb_start.host_vaddr +
+		mhif->ipc_regs.ipc_mdata_offset);
+	ch = &ipc_md->instance_list[instance_id].ch_list[q_priv->q_id];
+
+	if (q_priv->q_id < priv->num_valid_queues) {
+		ipc_br_md_t *md = &(ch->md);
+
+		q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
+		q_priv->feca_blk_id_be32 = ch->feca_blk_id;
+		q_priv->host_pi = rte_be_to_cpu_32(md->pi);
+		q_priv->host_ci = rte_be_to_cpu_32(md->ci);
+		q_priv->host_params = (host_ipc_params_t *)(uintptr_t)
+			(rte_be_to_cpu_32(ch->host_ipc_params) +
+			((uint64_t)ipc_priv->hugepg_start.host_vaddr));
+
+		for (i = 0; i < q_priv->queue_size; i++) {
+			uint32_t h, l;
+
+			h = ch->bd_h[i].host_virt_h;
+			l = ch->bd_h[i].host_virt_l;
+			q_priv->msg_ch_vaddr[i] = (void *)join_32_bits(h, l);
+		}
+
+		rte_bbdev_log(WARNING,
+			"Queue [%d] already configured, not configuring again",
+			q_priv->q_id);
+		return 0;
+	}
+
+	rte_bbdev_log_debug("setting up queue %d", q_priv->q_id);
+
+	/* Call ipc_configure_channel */
+	ret = ipc_queue_configure(q_priv->q_id, ipc_priv, q_priv);
+	if (ret) {
+		rte_bbdev_log(ERR, "Unable to setup queue (%d) (err=%d)",
+		       q_priv->q_id, ret);
+		return ret;
+	}
+
+	/* Set queue properties for LA12xx device */
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		if (priv->num_ldpc_enc_queues >= LA12XX_MAX_LDPC_ENC_QUEUES) {
+			rte_bbdev_log(ERR,
+				"num_ldpc_enc_queues reached max value");
+			return -1;
+		}
+		ch->la12xx_core_id =
+			rte_cpu_to_be_32(LA12XX_LDPC_ENC_CORE);
+		ch->feca_blk_id = rte_cpu_to_be_32(priv->num_ldpc_enc_queues++);
+		break;
+	case RTE_BBDEV_OP_LDPC_DEC:
+		if (priv->num_ldpc_dec_queues >= LA12XX_MAX_LDPC_DEC_QUEUES) {
+			rte_bbdev_log(ERR,
+				"num_ldpc_dec_queues reached max value");
+			return -1;
+		}
+		ch->la12xx_core_id =
+			rte_cpu_to_be_32(LA12XX_LDPC_DEC_CORE);
+		ch->feca_blk_id = rte_cpu_to_be_32(priv->num_ldpc_dec_queues++);
+		break;
+	default:
+		rte_bbdev_log(ERR, "Not supported op type\n");
+		return -1;
+	}
+	ch->op_type = rte_cpu_to_be_32(q_priv->op_type);
+	ch->depth = rte_cpu_to_be_32(q_priv->queue_size);
+
+	/* Store queue config here */
+	q_priv->feca_blk_id = rte_cpu_to_be_32(ch->feca_blk_id);
+	q_priv->feca_blk_id_be32 = ch->feca_blk_id;
+
+	return 0;
+}
+
+/* Setup a queue */
+static int
+la12xx_queue_setup(struct rte_bbdev *dev, uint16_t q_id,
+		const struct rte_bbdev_queue_conf *queue_conf)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	struct rte_bbdev_queue_data *q_data;
+	struct bbdev_la12xx_q_priv *q_priv;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* Move to setup_queues callback */
+	q_data = &dev->data->queues[q_id];
+	q_data->queue_private = rte_zmalloc(NULL,
+		sizeof(struct bbdev_la12xx_q_priv), 0);
+	if (!q_data->queue_private) {
+		rte_bbdev_log(ERR, "Memory allocation failed for qpriv");
+		return -ENOMEM;
+	}
+	q_priv = q_data->queue_private;
+	q_priv->q_id = q_id;
+	q_priv->bbdev_priv = dev->data->dev_private;
+	q_priv->queue_size = queue_conf->queue_size;
+	q_priv->op_type = queue_conf->op_type;
+
+	ret = la12xx_e200_queue_setup(dev, q_priv);
+	if (ret) {
+		rte_bbdev_log(ERR, "e200_queue_setup failed for qid: %d",
+				     q_id);
+		return ret;
+	}
+
+	/* Store queue config here */
+	priv->num_valid_queues++;
+
+	return 0;
+}
+
+static int
+la12xx_start(struct rte_bbdev *dev)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	int ready = 0;
+	struct gul_hif *hif_start;
+
+	PMD_INIT_FUNC_TRACE();
+
+	hif_start = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+
+	/* Set Host Read bit */
+	SET_HIF_HOST_RDY(hif_start, HIF_HOST_READY_IPC_APP);
+
+	/* Now wait for modem ready bit */
+	while (!ready)
+		ready = CHK_HIF_MOD_RDY(hif_start, HIF_MOD_READY_IPC_APP);
+
+	return 0;
+}
+
+static const struct rte_bbdev_ops pmd_ops = {
+	.info_get = la12xx_info_get,
+	.queue_setup = la12xx_queue_setup,
+	.queue_release = la12xx_queue_release,
+	.start = la12xx_start
+};
+static struct hugepage_info *
+get_hugepage_info(void)
+{
+	struct hugepage_info *hp_info;
+	struct rte_memseg *mseg;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* TODO - find a better way */
+	hp_info = rte_malloc(NULL, sizeof(struct hugepage_info), 0);
+	if (!hp_info) {
+		rte_bbdev_log(ERR, "Unable to allocate on local heap");
+		return NULL;
+	}
+
+	mseg = rte_mem_virt2memseg(hp_info, NULL);
+	hp_info->vaddr = mseg->addr;
+	hp_info->paddr = rte_mem_virt2phy(mseg->addr);
+	hp_info->len = mseg->len;
+
+	return hp_info;
+}
+
+static int
+open_ipc_dev(int modem_id)
+{
+	char dev_initials[16], dev_path[PATH_MAX];
+	struct dirent *entry;
+	int dev_ipc = 0;
+	DIR *dir;
+
+	dir = opendir("/dev/");
+	if (!dir) {
+		rte_bbdev_log(ERR, "Unable to open /dev/");
+		return -1;
+	}
+
+	sprintf(dev_initials, "gulipcgul%d", modem_id);
+
+	while ((entry = readdir(dir)) != NULL) {
+		if (!strncmp(dev_initials, entry->d_name,
+		    sizeof(dev_initials) - 1))
+			break;
+	}
+
+	if (!entry) {
+		rte_bbdev_log(ERR, "Error: No gulipcgul%d device", modem_id);
+		return -1;
+	}
+
+	sprintf(dev_path, "/dev/%s", entry->d_name);
+	dev_ipc = open(dev_path, O_RDWR);
+	if (dev_ipc  < 0) {
+		rte_bbdev_log(ERR, "Error: Cannot open %s", dev_path);
+		return -errno;
+	}
+
+	return dev_ipc;
+}
+
+static int
+setup_la12xx_dev(struct rte_bbdev *dev)
+{
+	struct bbdev_la12xx_private *priv = dev->data->dev_private;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	struct hugepage_info *hp = NULL;
+	ipc_channel_us_t *ipc_priv_ch = NULL;
+	int dev_ipc = 0, dev_mem = 0, i;
+	ipc_metadata_t *ipc_md;
+	struct gul_hif *mhif;
+	uint32_t phy_align = 0;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (!ipc_priv) {
+		/* TODO - get a better way */
+		/* Get the hugepage info against it */
+		hp = get_hugepage_info();
+		if (!hp) {
+			rte_bbdev_log(ERR, "Unable to get hugepage info");
+			ret = -ENOMEM;
+			goto err;
+		}
+
+		rte_bbdev_log_debug("0x%" PRIx64 " %p 0x%" PRIx64,
+				hp->paddr, hp->vaddr, hp->len);
+
+		ipc_priv = rte_zmalloc(0, sizeof(ipc_userspace_t), 0);
+		if (ipc_priv == NULL) {
+			rte_bbdev_log(ERR,
+				"Unable to allocate memory for ipc priv");
+			ret = -ENOMEM;
+			goto err;
+		}
+
+		for (i = 0; i < IPC_MAX_CHANNEL_COUNT; i++) {
+			ipc_priv_ch = rte_zmalloc(0,
+				sizeof(ipc_channel_us_t), 0);
+			if (ipc_priv_ch == NULL) {
+				rte_bbdev_log(ERR,
+					"Unable to allocate memory for channels");
+				ret = -ENOMEM;
+			}
+			ipc_priv->channels[i] = ipc_priv_ch;
+		}
+
+		dev_mem = open("/dev/mem", O_RDWR);
+		if (dev_mem < 0) {
+			rte_bbdev_log(ERR, "Error: Cannot open /dev/mem");
+			ret = -errno;
+			goto err;
+		}
+
+		ipc_priv->instance_id = 0;
+		ipc_priv->dev_mem = dev_mem;
+
+		rte_bbdev_log_debug("hugepg input 0x%" PRIx64 "%p 0x%" PRIx64,
+			hp->paddr, hp->vaddr, hp->len);
+
+		ipc_priv->sys_map.hugepg_start.host_phys = hp->paddr;
+		ipc_priv->sys_map.hugepg_start.size = hp->len;
+
+		ipc_priv->hugepg_start.host_phys = hp->paddr;
+		ipc_priv->hugepg_start.host_vaddr = hp->vaddr;
+		ipc_priv->hugepg_start.size = hp->len;
+
+		rte_free(hp);
+	}
+
+	dev_ipc = open_ipc_dev(priv->modem_id);
+	if (dev_ipc < 0) {
+		rte_bbdev_log(ERR, "Error: open_ipc_dev failed");
+		goto err;
+	}
+	ipc_priv->dev_ipc = dev_ipc;
+
+	ret = ioctl(ipc_priv->dev_ipc, IOCTL_GUL_IPC_GET_SYS_MAP,
+		    &ipc_priv->sys_map);
+	if (ret) {
+		rte_bbdev_log(ERR,
+			"IOCTL_GUL_IPC_GET_SYS_MAP ioctl failed");
+		goto err;
+	}
+
+	phy_align = (ipc_priv->sys_map.mhif_start.host_phys % 0x1000);
+	ipc_priv->mhif_start.host_vaddr =
+		mmap(0, ipc_priv->sys_map.mhif_start.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.mhif_start.host_phys - phy_align));
+	if (ipc_priv->mhif_start.host_vaddr == MAP_FAILED) {
+		rte_bbdev_log(ERR, "MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->mhif_start.host_vaddr = (void *) ((uintptr_t)
+		(ipc_priv->mhif_start.host_vaddr) + phy_align);
+
+	phy_align = (ipc_priv->sys_map.peb_start.host_phys % 0x1000);
+	ipc_priv->peb_start.host_vaddr =
+		mmap(0, ipc_priv->sys_map.peb_start.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.peb_start.host_phys - phy_align));
+	if (ipc_priv->peb_start.host_vaddr == MAP_FAILED) {
+		rte_bbdev_log(ERR, "MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->peb_start.host_vaddr = (void *)((uintptr_t)
+		(ipc_priv->peb_start.host_vaddr) + phy_align);
+
+	phy_align = (ipc_priv->sys_map.modem_ccsrbar.host_phys % 0x1000);
+	ipc_priv->modem_ccsrbar.host_vaddr =
+		mmap(0, ipc_priv->sys_map.modem_ccsrbar.size + phy_align,
+		     (PROT_READ | PROT_WRITE), MAP_SHARED, ipc_priv->dev_mem,
+		     (ipc_priv->sys_map.modem_ccsrbar.host_phys - phy_align));
+	if (ipc_priv->modem_ccsrbar.host_vaddr == MAP_FAILED) {
+		rte_bbdev_log(ERR, "MAP failed:");
+		ret = -errno;
+		goto err;
+	}
+
+	ipc_priv->modem_ccsrbar.host_vaddr = (void *)((uintptr_t)
+		(ipc_priv->modem_ccsrbar.host_vaddr) + phy_align);
+
+	ipc_priv->hugepg_start.modem_phys =
+		ipc_priv->sys_map.hugepg_start.modem_phys;
+
+	ipc_priv->mhif_start.host_phys =
+		ipc_priv->sys_map.mhif_start.host_phys;
+	ipc_priv->mhif_start.size = ipc_priv->sys_map.mhif_start.size;
+	ipc_priv->peb_start.host_phys = ipc_priv->sys_map.peb_start.host_phys;
+	ipc_priv->peb_start.size = ipc_priv->sys_map.peb_start.size;
+
+	rte_bbdev_log(INFO, "peb 0x%" PRIx64 "%p 0x%" PRIx32,
+			ipc_priv->peb_start.host_phys,
+			ipc_priv->peb_start.host_vaddr,
+			ipc_priv->peb_start.size);
+	rte_bbdev_log(INFO, "hugepg 0x%" PRIx64 "%p 0x%" PRIx32,
+			ipc_priv->hugepg_start.host_phys,
+			ipc_priv->hugepg_start.host_vaddr,
+			ipc_priv->hugepg_start.size);
+	rte_bbdev_log(INFO, "mhif 0x%" PRIx64 "%p 0x%" PRIx32,
+			ipc_priv->mhif_start.host_phys,
+			ipc_priv->mhif_start.host_vaddr,
+			ipc_priv->mhif_start.size);
+	mhif = (struct gul_hif *)ipc_priv->mhif_start.host_vaddr;
+
+	/* offset is from start of PEB */
+	ipc_md = (ipc_metadata_t *)((uintptr_t)ipc_priv->peb_start.host_vaddr +
+			mhif->ipc_regs.ipc_mdata_offset);
+
+	if (sizeof(ipc_metadata_t) != mhif->ipc_regs.ipc_mdata_size) {
+		rte_bbdev_log(ERR,
+			"ipc_metadata_t =0x%" PRIx64
+			", mhif->ipc_regs.ipc_mdata_size=0x%" PRIx32,
+			(uint64_t)(sizeof(ipc_metadata_t)),
+			mhif->ipc_regs.ipc_mdata_size);
+		rte_bbdev_log(ERR, "--> mhif->ipc_regs.ipc_mdata_offset= 0x%"
+			PRIx32, mhif->ipc_regs.ipc_mdata_offset);
+		rte_bbdev_log(ERR, "gul_hif size=0x%" PRIx64,
+			(uint64_t)(sizeof(struct gul_hif)));
+		return IPC_MD_SZ_MISS_MATCH;
+	}
+
+	ipc_priv->instance = (ipc_instance_t *)
+		(&ipc_md->instance_list[ipc_priv->instance_id]);
+
+	rte_bbdev_log_debug("finish host init");
+
+	priv->ipc_priv = ipc_priv;
+
+	return 0;
+
+err:
+	rte_free(hp);
+	rte_free(ipc_priv);
+	rte_free(ipc_priv_ch);
+	if (dev_mem)
+		close(dev_mem);
+	if (dev_ipc)
+		close(dev_ipc);
+
+	return ret;
+}
+
 static inline int
 parse_u16_arg(const char *key, const char *value, void *extra_args)
 {
@@ -122,6 +672,7 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 	struct rte_bbdev *bbdev;
 	const char *name = rte_vdev_device_name(vdev);
 	struct bbdev_la12xx_private *priv;
+	int ret;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -151,7 +702,13 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 
 	rte_bbdev_log(INFO, "Setting Up %s: DevId=%d, ModemId=%d",
 				name, bbdev->data->dev_id, priv->modem_id);
-	bbdev->dev_ops = NULL;
+	ret = setup_la12xx_dev(bbdev);
+	if (ret) {
+		rte_bbdev_log(ERR, "IPC Setup failed for %s", name);
+		rte_free(bbdev->data->dev_private);
+		return ret;
+	}
+	bbdev->dev_ops = &pmd_ops;
 	bbdev->device = &vdev->device;
 	bbdev->data->socket_id = 0;
 	bbdev->intr_handle = NULL;
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.h b/drivers/baseband/la12xx/bbdev_la12xx.h
index 5228502331..fe91e62bf6 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx.h
@@ -5,16 +5,10 @@
 #ifndef __BBDEV_LA12XX_H__
 #define __BBDEV_LA12XX_H__
 
-#define BBDEV_IPC_ENC_OP_TYPE	1
-#define BBDEV_IPC_DEC_OP_TYPE	2
-
-#define MAX_LDPC_ENC_FECA_QUEUES	4
-#define MAX_LDPC_DEC_FECA_QUEUES	4
-
 #define MAX_CHANNEL_DEPTH 16
 /* private data structure */
 struct bbdev_la12xx_private {
-	void *ipc_priv;
+	ipc_userspace_t *ipc_priv;
 	uint8_t num_valid_queues;
 	uint8_t max_nb_queues;
 	uint8_t num_ldpc_enc_queues;
@@ -32,14 +26,14 @@ struct hugepage_info {
 struct bbdev_la12xx_q_priv {
 	struct bbdev_la12xx_private *bbdev_priv;
 	uint32_t q_id;	/**< Channel ID */
-	uint32_t feca_blk_id;	/** FECA block ID for processing */
+	uint32_t feca_blk_id;	/**< FECA block ID for processing */
 	uint32_t feca_blk_id_be32; /**< FECA Block ID for this queue */
-	uint8_t en_napi; /* 0: napi disabled, 1: napi enabled */
+	uint8_t en_napi; /**< 0: napi disabled, 1: napi enabled */
 	uint16_t queue_size;	/**< Queue depth */
 	int32_t eventfd;	/**< Event FD value */
 	enum rte_bbdev_op_type op_type; /**< Operation type */
 	uint32_t la12xx_core_id;
-		/* LA12xx core ID on which this will be scheduled */
+		/**< LA12xx core ID on which this will be scheduled */
 	struct rte_mempool *mp; /**< Pool from where buffers would be cut */
 	void *bbdev_op[MAX_CHANNEL_DEPTH];
 			/**< Stores bbdev op for each index */
@@ -52,5 +46,6 @@ struct bbdev_la12xx_q_priv {
 
 #define lower_32_bits(x) ((uint32_t)((uint64_t)x))
 #define upper_32_bits(x) ((uint32_t)(((uint64_t)(x) >> 16) >> 16))
-
+#define join_32_bits(upper, lower) \
+	((size_t)(((uint64_t)(upper) << 32) | (uint32_t)(lower)))
 #endif
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
index 9aa5562981..5f613fb087 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -4,9 +4,182 @@
 #ifndef __BBDEV_LA12XX_IPC_H__
 #define __BBDEV_LA12XX_IPC_H__
 
+#define LA12XX_MAX_QUEUES 20
+#define HOST_RX_QUEUEID_OFFSET LA12XX_MAX_QUEUES
+
+/** No. of max channel per instance */
+#define IPC_MAX_CHANNEL_COUNT	(64)
+
 /** No. of max channel per instance */
 #define IPC_MAX_DEPTH	(16)
 
+/** No. of max IPC instance per modem */
+#define IPC_MAX_INSTANCE_COUNT	(1)
+
+/** Error codes */
+#define IPC_SUCCESS		(0) /** IPC operation success */
+#define IPC_INPUT_INVALID	(-1) /** Invalid input to API */
+#define IPC_CH_INVALID		(-2) /** Channel no is invalid */
+#define IPC_INSTANCE_INVALID	(-3) /** Instance no is invalid */
+#define IPC_MEM_INVALID		(-4) /** Insufficient memory */
+#define IPC_CH_FULL		(-5) /** Channel is full */
+#define IPC_CH_EMPTY		(-6) /** Channel is empty */
+#define IPC_BL_EMPTY		(-7) /** Free buffer list is empty */
+#define IPC_BL_FULL		(-8) /** Free buffer list is full */
+#define IPC_HOST_BUF_ALLOC_FAIL	(-9) /** DPDK malloc fail */
+#define IPC_MD_SZ_MISS_MATCH	(-10) /** META DATA size in mhif miss matched*/
+#define IPC_MALLOC_FAIL		(-11) /** system malloc fail */
+#define IPC_IOCTL_FAIL		(-12) /** IOCTL call failed */
+#define IPC_MMAP_FAIL		(-14) /** MMAP fail */
+#define IPC_OPEN_FAIL		(-15) /** OPEN fail */
+#define IPC_EVENTFD_FAIL	(-16) /** eventfd initialization failed */
+#define IPC_NOT_IMPLEMENTED	(-17) /** IPC feature is not implemented yet*/
+
+#define SET_HIF_HOST_RDY(hif, RDY_MASK) (hif->host_ready |= RDY_MASK)
+#define CHK_HIF_MOD_RDY(hif, RDY_MASK) (hif->mod_ready & RDY_MASK)
+
+/* Host Ready bits */
+#define HIF_HOST_READY_HOST_REGIONS	(1 << 0)
+#define HIF_HOST_READY_IPC_LIB		(1 << 12)
+#define HIF_HOST_READY_IPC_APP		(1 << 13)
+#define HIF_HOST_READY_FECA		(1 << 14)
+
+/* Modem Ready bits */
+#define HIF_MOD_READY_IPC_LIB		(1 << 5)
+#define HIF_MOD_READY_IPC_APP		(1 << 6)
+#define HIF_MOD_READY_FECA		(1 << 7)
+
+typedef void *ipc_t;
+
+struct ipc_msg {
+	int chid;
+	void *addr;
+	uint32_t len;
+	uint8_t flags;
+};
+
+typedef struct {
+	uint64_t host_phys;
+	uint32_t modem_phys;
+	void    *host_vaddr;
+	uint32_t size;
+} mem_range_t;
+
+#define GUL_IPC_MAGIC	'R'
+
+#define IOCTL_GUL_IPC_GET_SYS_MAP _IOW(GUL_IPC_MAGIC, 1, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_REGISTER _IOWR(GUL_IPC_MAGIC, 4, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_DEREGISTER \
+	_IOWR(GUL_IPC_MAGIC, 5, struct ipc_msg *)
+#define IOCTL_GUL_IPC_CHANNEL_RAISE_INTERRUPT _IOW(GUL_IPC_MAGIC, 6, int *)
+
+/** buffer ring common metadata */
+typedef struct ipc_bd_ring_md {
+	volatile uint32_t pi;		/**< Producer index and flag (MSB)
+					  *  which flip for each Ring wrapping
+					  */
+	volatile uint32_t ci;		/**< Consumer index and flag (MSB)
+					  *  which flip for each Ring wrapping
+					  */
+	uint32_t ring_size;	/**< depth (Used to roll-over pi/ci) */
+	uint32_t msg_size;	/**< Size of the each buffer */
+} __rte_packed ipc_br_md_t;
+
+/** IPC buffer descriptor */
+typedef struct ipc_buffer_desc {
+	union {
+		uint64_t host_virt;	/**< msg's host virtual address */
+		struct {
+			uint32_t host_virt_l;
+			uint32_t host_virt_h;
+		};
+	};
+	uint32_t modem_ptr;	/**< msg's modem physical address */
+	uint32_t len;		/**< msg len */
+} __rte_packed ipc_bd_t;
+
+typedef struct ipc_channel {
+	uint32_t ch_id;		/**< Channel id */
+	ipc_br_md_t md;			/**< Metadata for BD ring */
+	ipc_bd_t bd_h[IPC_MAX_DEPTH];	/**< Buffer Descriptor on Host */
+	ipc_bd_t bd_m[IPC_MAX_DEPTH];	/**< Buffer Descriptor on Modem */
+	uint32_t op_type;		/**< Type of the BBDEV operation
+					  * supported on this channel
+					  */
+	uint32_t depth;			/**< Channel depth */
+	uint32_t feca_blk_id;	/**< FECA Transport Block ID for processing */
+	uint32_t la12xx_core_id;/**< LA12xx core ID on which this will be
+				  * scheduled
+				  */
+	uint32_t feca_input_circ_size;	/**< FECA transport block input
+					  * circular buffer size
+					  */
+	uint32_t host_ipc_params;	/**< Address for host IPC parameters */
+} __rte_packed ipc_ch_t;
+
+typedef struct ipc_instance {
+	uint32_t instance_id;		/**< instance id, use to init this
+					  * instance by ipc_init API
+					  */
+	uint32_t initialized;		/**< Set in ipc_init */
+	ipc_ch_t ch_list[IPC_MAX_CHANNEL_COUNT];
+		/**< Channel descriptors in this instance */
+} __rte_packed ipc_instance_t;
+
+typedef struct ipc_metadata {
+	uint32_t ipc_host_signature; /**< IPC host signature, Set by host/L2 */
+	uint32_t ipc_geul_signature; /**< IPC geul signature, Set by modem */
+	ipc_instance_t instance_list[IPC_MAX_INSTANCE_COUNT];
+} __rte_packed ipc_metadata_t;
+
+typedef struct ipc_channel_us_priv {
+	int32_t		eventfd;
+	uint32_t	channel_id;
+	/* In flight packets status for buffer list. */
+	uint8_t		bufs_inflight[IPC_MAX_DEPTH];
+} ipc_channel_us_t;
+
+typedef struct {
+	uint64_t host_phys;
+	uint32_t modem_phys;
+	uint32_t size;
+} mem_strt_addr_t;
+
+typedef struct {
+	mem_strt_addr_t modem_ccsrbar;
+	mem_strt_addr_t peb_start; /* PEB meta data */
+	mem_strt_addr_t mhif_start; /* MHIF meta daat */
+	mem_strt_addr_t hugepg_start; /* Modem to access hugepage */
+} sys_map_t;
+
+typedef struct ipc_priv_t {
+	int instance_id;
+	int dev_ipc;
+	int dev_mem;
+	sys_map_t sys_map;
+	mem_range_t modem_ccsrbar;
+	mem_range_t peb_start;
+	mem_range_t mhif_start;
+	mem_range_t hugepg_start;
+	ipc_channel_us_t *channels[IPC_MAX_CHANNEL_COUNT];
+	ipc_instance_t	*instance;
+	ipc_instance_t	*instance_bk;
+} ipc_userspace_t;
+
+/** Structure specifying enqueue operation (enqueue at LA1224) */
+struct bbdev_ipc_enqueue_op {
+	/** Status of operation that was performed */
+	int32_t status;
+	/** CRC Status of SD operation that was performed */
+	int32_t crc_stat_addr;
+	/** HARQ Output buffer memory length for Shared Decode.
+	 * Filled by LA12xx.
+	 */
+	uint32_t out_len;
+	/** Reserved (for 8 byte alignment) */
+	uint32_t rsvd;
+};
+
 /* This shared memory would be on the host side which have copy of some
  * of the parameters which are also part of Shared BD ring. Read access
  * of these parameters from the host side would not be over PCI.
@@ -14,7 +187,21 @@
 typedef struct host_ipc_params {
 	volatile uint32_t pi;
 	volatile uint32_t ci;
-	volatile uint32_t modem_ptr[IPC_MAX_DEPTH];
+	volatile uint32_t bd_m_modem_ptr[IPC_MAX_DEPTH];
 } __rte_packed host_ipc_params_t;
 
+struct hif_ipc_regs {
+	uint32_t ipc_mdata_offset;
+	uint32_t ipc_mdata_size;
+} __rte_packed;
+
+struct gul_hif {
+	uint32_t ver;
+	uint32_t hif_ver;
+	uint32_t status;
+	volatile uint32_t host_ready;
+	volatile uint32_t mod_ready;
+	struct hif_ipc_regs ipc_regs;
+} __rte_packed;
+
 #endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v11 6/8] baseband/la12xx: add enqueue and dequeue support
  2021-10-17  6:53 ` [dpdk-dev] [PATCH v11 0/8] baseband: add NXP LA12xx driver nipun.gupta
                     ` (4 preceding siblings ...)
  2021-10-17  6:53   ` [dpdk-dev] [PATCH v11 5/8] baseband/la12xx: add queue and modem config support nipun.gupta
@ 2021-10-17  6:53   ` nipun.gupta
  2021-10-17  6:53   ` [dpdk-dev] [PATCH v11 7/8] app/bbdev: enable la12xx for bbdev nipun.gupta
                     ` (2 subsequent siblings)
  8 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-17  6:53 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

From: Hemant Agrawal <hemant.agrawal@nxp.com>

Add support for enqueue and dequeue the LDPC enc/dec
from the modem device.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 doc/guides/bbdevs/features/la12xx.ini      |  13 +
 doc/guides/bbdevs/la12xx.rst               |  44 +++
 doc/guides/rel_notes/release_21_11.rst     |   5 +
 drivers/baseband/la12xx/bbdev_la12xx.c     | 320 +++++++++++++++++++++
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h |  37 +++
 5 files changed, 419 insertions(+)
 create mode 100644 doc/guides/bbdevs/features/la12xx.ini

diff --git a/doc/guides/bbdevs/features/la12xx.ini b/doc/guides/bbdevs/features/la12xx.ini
new file mode 100644
index 0000000000..0aec5eecb6
--- /dev/null
+++ b/doc/guides/bbdevs/features/la12xx.ini
@@ -0,0 +1,13 @@
+;
+; Supported features of the 'la12xx' bbdev driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Turbo Decoder (4G)     = N
+Turbo Encoder (4G)     = N
+LDPC Decoder (5G)      = Y
+LDPC Encoder (5G)      = Y
+LLR/HARQ Compression   = N
+HW Accelerated         = Y
+BBDEV API              = Y
diff --git a/doc/guides/bbdevs/la12xx.rst b/doc/guides/bbdevs/la12xx.rst
index 1a711ef5e3..fe1bca4c5c 100644
--- a/doc/guides/bbdevs/la12xx.rst
+++ b/doc/guides/bbdevs/la12xx.rst
@@ -78,3 +78,47 @@ For enabling logs, use the following EAL parameter:
 
 Using ``bb.la12xx`` as log matching criteria, all Baseband PMD logs can be
 enabled which are lower than logging ``level``.
+
+Test Application
+----------------
+
+BBDEV provides a test application, ``test-bbdev.py`` and range of test data for testing
+the functionality of LA12xx for FEC encode and decode, depending on the device
+capabilities. The test application is located under app->test-bbdev folder and has the
+following options:
+
+.. code-block:: console
+
+  "-p", "--testapp-path": specifies path to the bbdev test app.
+  "-e", "--eal-params"	: EAL arguments which are passed to the test app.
+  "-t", "--timeout"	: Timeout in seconds (default=300).
+  "-c", "--test-cases"	: Defines test cases to run. Run all if not specified.
+  "-v", "--test-vector"	: Test vector path (default=dpdk_path+/app/test-bbdev/test_vectors/bbdev_null.data).
+  "-n", "--num-ops"	: Number of operations to process on device (default=32).
+  "-b", "--burst-size"	: Operations enqueue/dequeue burst size (default=32).
+  "-s", "--snr"		: SNR in dB used when generating LLRs for bler tests.
+  "-s", "--iter_max"	: Number of iterations for LDPC decoder.
+  "-l", "--num-lcores"	: Number of lcores to run (default=16).
+  "-i", "--init-device" : Initialise PF device with default values.
+
+
+To execute the test application tool using simple decode or encode data,
+type one of the following:
+
+.. code-block:: console
+
+  ./test-bbdev.py -e="--vdev=baseband_la12xx,socket_id=0,max_nb_queues=8" -c validation -n 64 -b 1 -v ./ldpc_dec_default.data
+  ./test-bbdev.py -e="--vdev=baseband_la12xx,socket_id=0,max_nb_queues=8" -c validation -n 64 -b 1 -v ./ldpc_enc_default.data
+
+The test application ``test-bbdev.py``, supports the ability to configure the PF device with
+a default set of values, if the "-i" or "- -init-device" option is included. The default values
+are defined in test_bbdev_perf.c.
+
+
+Test Vectors
+~~~~~~~~~~~~
+
+In addition to the simple LDPC decoder and LDPC encoder tests, bbdev also provides
+a range of additional tests under the test_vectors folder, which may be useful. The results
+of these tests will depend on the LA12xx FEC capabilities which may cause some
+testcases to be skipped, but no failure should be reported.
diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst
index 957bd78d61..d7e0bdc09b 100644
--- a/doc/guides/rel_notes/release_21_11.rst
+++ b/doc/guides/rel_notes/release_21_11.rst
@@ -159,6 +159,11 @@ New Features
   * Added tests to verify tunnel header verification in IPsec inbound.
   * Added tests to verify inner checksum.
 
+* **Added NXP LA12xx baseband PMD.**
+
+  * Added a new baseband PMD driver for NXP LA12xx Software defined radio.
+  * See the :doc:`../bbdevs/la12xx` for more details.
+
 
 Removed Items
 -------------
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 7e312cf2e7..4b05b5d3f2 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -120,6 +120,10 @@ la12xx_queue_release(struct rte_bbdev *dev, uint16_t q_id)
 		((uint64_t) ((unsigned long) (A) \
 		- ((uint64_t)ipc_priv->hugepg_start.host_vaddr)))
 
+#define MODEM_P2V(A) \
+	((uint64_t) ((unsigned long) (A) \
+		+ (unsigned long)(ipc_priv->peb_start.host_vaddr)))
+
 static int
 ipc_queue_configure(uint32_t channel_id,
 		    ipc_t instance,
@@ -336,6 +340,318 @@ static const struct rte_bbdev_ops pmd_ops = {
 	.queue_release = la12xx_queue_release,
 	.start = la12xx_start
 };
+
+static inline int
+is_bd_ring_full(uint32_t ci, uint32_t ci_flag,
+		uint32_t pi, uint32_t pi_flag)
+{
+	if (pi == ci) {
+		if (pi_flag != ci_flag)
+			return 1; /* Ring is Full */
+	}
+	return 0;
+}
+
+static inline int
+prepare_ldpc_enc_op(struct rte_bbdev_enc_op *bbdev_enc_op,
+		    struct bbdev_la12xx_q_priv *q_priv __rte_unused,
+		    struct rte_bbdev_op_data *in_op_data __rte_unused,
+		    struct rte_bbdev_op_data *out_op_data)
+{
+	struct rte_bbdev_op_ldpc_enc *ldpc_enc = &bbdev_enc_op->ldpc_enc;
+	uint32_t total_out_bits;
+
+	total_out_bits = (ldpc_enc->tb_params.cab *
+		ldpc_enc->tb_params.ea) + (ldpc_enc->tb_params.c -
+		ldpc_enc->tb_params.cab) * ldpc_enc->tb_params.eb;
+
+	ldpc_enc->output.length = (total_out_bits + 7)/8;
+
+	rte_pktmbuf_append(out_op_data->data, ldpc_enc->output.length);
+
+	return 0;
+}
+
+static inline int
+prepare_ldpc_dec_op(struct rte_bbdev_dec_op *bbdev_dec_op,
+		    struct bbdev_ipc_dequeue_op *bbdev_ipc_op,
+		    struct bbdev_la12xx_q_priv *q_priv  __rte_unused,
+		    struct rte_bbdev_op_data *out_op_data  __rte_unused)
+{
+	struct rte_bbdev_op_ldpc_dec *ldpc_dec = &bbdev_dec_op->ldpc_dec;
+	uint32_t total_out_bits;
+	uint32_t num_code_blocks = 0;
+	uint16_t sys_cols;
+
+	sys_cols = (ldpc_dec->basegraph == 1) ? 22 : 10;
+	if (ldpc_dec->tb_params.c == 1) {
+		total_out_bits = ((sys_cols * ldpc_dec->z_c) -
+				ldpc_dec->n_filler);
+		/* 5G-NR protocol uses 16 bit CRC when output packet
+		 * size <= 3824 (bits). Otherwise 24 bit CRC is used.
+		 * Adjust the output bits accordingly
+		 */
+		if (total_out_bits - 16 <= 3824)
+			total_out_bits -= 16;
+		else
+			total_out_bits -= 24;
+		ldpc_dec->hard_output.length = (total_out_bits / 8);
+	} else {
+		total_out_bits = (((sys_cols * ldpc_dec->z_c) -
+				ldpc_dec->n_filler - 24) *
+				ldpc_dec->tb_params.c);
+		ldpc_dec->hard_output.length = (total_out_bits / 8) - 3;
+	}
+
+	num_code_blocks = ldpc_dec->tb_params.c;
+
+	bbdev_ipc_op->num_code_blocks = rte_cpu_to_be_32(num_code_blocks);
+
+	return 0;
+}
+
+static int
+enqueue_single_op(struct bbdev_la12xx_q_priv *q_priv, void *bbdev_op)
+{
+	struct bbdev_la12xx_private *priv = q_priv->bbdev_priv;
+	ipc_userspace_t *ipc_priv = priv->ipc_priv;
+	ipc_instance_t *ipc_instance = ipc_priv->instance;
+	struct bbdev_ipc_dequeue_op *bbdev_ipc_op;
+	struct rte_bbdev_op_ldpc_enc *ldpc_enc;
+	struct rte_bbdev_op_ldpc_dec *ldpc_dec;
+	uint32_t q_id = q_priv->q_id;
+	uint32_t ci, ci_flag, pi, pi_flag;
+	ipc_ch_t *ch = &(ipc_instance->ch_list[q_id]);
+	ipc_br_md_t *md = &(ch->md);
+	size_t virt;
+	char *huge_start_addr =
+		(char *)q_priv->bbdev_priv->ipc_priv->hugepg_start.host_vaddr;
+	struct rte_bbdev_op_data *in_op_data, *out_op_data;
+	char *data_ptr;
+	uint32_t l1_pcie_addr;
+	int ret;
+
+	ci = IPC_GET_CI_INDEX(q_priv->host_ci);
+	ci_flag = IPC_GET_CI_FLAG(q_priv->host_ci);
+
+	pi = IPC_GET_PI_INDEX(q_priv->host_pi);
+	pi_flag = IPC_GET_PI_FLAG(q_priv->host_pi);
+
+	rte_bbdev_dp_log(DEBUG, "before bd_ring_full: pi: %u, ci: %u,"
+		"pi_flag: %u, ci_flag: %u, ring size: %u",
+		pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	if (is_bd_ring_full(ci, ci_flag, pi, pi_flag)) {
+		rte_bbdev_dp_log(DEBUG, "bd ring full for queue id: %d", q_id);
+		return IPC_CH_FULL;
+	}
+
+	virt = MODEM_P2V(q_priv->host_params->bd_m_modem_ptr[pi]);
+	bbdev_ipc_op = (struct bbdev_ipc_dequeue_op *)virt;
+	q_priv->bbdev_op[pi] = bbdev_op;
+
+	switch (q_priv->op_type) {
+	case RTE_BBDEV_OP_LDPC_ENC:
+		ldpc_enc = &(((struct rte_bbdev_enc_op *)bbdev_op)->ldpc_enc);
+		in_op_data = &ldpc_enc->input;
+		out_op_data = &ldpc_enc->output;
+
+		ret = prepare_ldpc_enc_op(bbdev_op, q_priv,
+					  in_op_data, out_op_data);
+		if (ret) {
+			rte_bbdev_log(ERR, "process_ldpc_enc_op fail, ret: %d",
+				ret);
+			return ret;
+		}
+		break;
+
+	case RTE_BBDEV_OP_LDPC_DEC:
+		ldpc_dec = &(((struct rte_bbdev_dec_op *)bbdev_op)->ldpc_dec);
+		in_op_data = &ldpc_dec->input;
+
+		out_op_data = &ldpc_dec->hard_output;
+
+		ret = prepare_ldpc_dec_op(bbdev_op, bbdev_ipc_op,
+					  q_priv, out_op_data);
+		if (ret) {
+			rte_bbdev_log(ERR, "process_ldpc_dec_op fail, ret: %d",
+				ret);
+			return ret;
+		}
+		break;
+
+	default:
+		rte_bbdev_log(ERR, "unsupported bbdev_ipc op type");
+		return -1;
+	}
+
+	if (in_op_data->data) {
+		data_ptr = rte_pktmbuf_mtod(in_op_data->data, char *);
+		l1_pcie_addr = (uint32_t)GUL_USER_HUGE_PAGE_ADDR +
+			       data_ptr - huge_start_addr;
+		bbdev_ipc_op->in_addr = l1_pcie_addr;
+		bbdev_ipc_op->in_len = in_op_data->length;
+	}
+
+	if (out_op_data->data) {
+		data_ptr = rte_pktmbuf_mtod(out_op_data->data, char *);
+		l1_pcie_addr = (uint32_t)GUL_USER_HUGE_PAGE_ADDR +
+				data_ptr - huge_start_addr;
+		bbdev_ipc_op->out_addr = rte_cpu_to_be_32(l1_pcie_addr);
+		bbdev_ipc_op->out_len = rte_cpu_to_be_32(out_op_data->length);
+	}
+
+	/* Move Producer Index forward */
+	pi++;
+	/* Flip the PI flag, if wrapping */
+	if (unlikely(q_priv->queue_size == pi)) {
+		pi = 0;
+		pi_flag = pi_flag ? 0 : 1;
+	}
+
+	if (pi_flag)
+		IPC_SET_PI_FLAG(pi);
+	else
+		IPC_RESET_PI_FLAG(pi);
+	q_priv->host_pi = pi;
+
+	/* Wait for Data Copy & pi_flag update to complete before updating pi */
+	rte_mb();
+	/* now update pi */
+	md->pi = rte_cpu_to_be_32(pi);
+
+	rte_bbdev_dp_log(DEBUG, "enter: pi: %u, ci: %u,"
+			"pi_flag: %u, ci_flag: %u, ring size: %u",
+			pi, ci, pi_flag, ci_flag, q_priv->queue_size);
+
+	return 0;
+}
+
+/* Enqueue decode burst */
+static uint16_t
+enqueue_dec_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_dec_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	int nb_enqueued, ret;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ret = enqueue_single_op(q_priv, ops[nb_enqueued]);
+		if (ret)
+			break;
+	}
+
+	q_data->queue_stats.enqueue_err_count += nb_ops - nb_enqueued;
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
+/* Enqueue encode burst */
+static uint16_t
+enqueue_enc_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_enc_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	int nb_enqueued, ret;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ret = enqueue_single_op(q_priv, ops[nb_enqueued]);
+		if (ret)
+			break;
+	}
+
+	q_data->queue_stats.enqueue_err_count += nb_ops - nb_enqueued;
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
+/* Dequeue encode burst */
+static void *
+dequeue_single_op(struct bbdev_la12xx_q_priv *q_priv, void *dst)
+{
+	void *op;
+	uint32_t ci, ci_flag;
+	uint32_t temp_ci;
+
+	temp_ci = q_priv->host_params->ci;
+	if (temp_ci == q_priv->host_ci)
+		return NULL;
+
+	ci = IPC_GET_CI_INDEX(q_priv->host_ci);
+	ci_flag = IPC_GET_CI_FLAG(q_priv->host_ci);
+
+	rte_bbdev_dp_log(DEBUG,
+		"ci: %u, ci_flag: %u, ring size: %u",
+		ci, ci_flag, q_priv->queue_size);
+
+	op = q_priv->bbdev_op[ci];
+
+	rte_memcpy(dst, q_priv->msg_ch_vaddr[ci],
+		sizeof(struct bbdev_ipc_enqueue_op));
+
+	/* Move Consumer Index forward */
+	ci++;
+	/* Flip the CI flag, if wrapping */
+	if (q_priv->queue_size == ci) {
+		ci = 0;
+		ci_flag = ci_flag ? 0 : 1;
+	}
+	if (ci_flag)
+		IPC_SET_CI_FLAG(ci);
+	else
+		IPC_RESET_CI_FLAG(ci);
+
+	q_priv->host_ci = ci;
+
+	rte_bbdev_dp_log(DEBUG,
+		"exit: ci: %u, ci_flag: %u, ring size: %u",
+		ci, ci_flag, q_priv->queue_size);
+
+	return op;
+}
+
+/* Dequeue decode burst */
+static uint16_t
+dequeue_dec_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_dec_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	struct bbdev_ipc_enqueue_op bbdev_ipc_op;
+	int nb_dequeued;
+
+	for (nb_dequeued = 0; nb_dequeued < nb_ops; nb_dequeued++) {
+		ops[nb_dequeued] = dequeue_single_op(q_priv, &bbdev_ipc_op);
+		if (!ops[nb_dequeued])
+			break;
+		ops[nb_dequeued]->status = bbdev_ipc_op.status;
+	}
+	q_data->queue_stats.dequeued_count += nb_dequeued;
+
+	return nb_dequeued;
+}
+
+/* Dequeue encode burst */
+static uint16_t
+dequeue_enc_ops(struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_enc_op **ops, uint16_t nb_ops)
+{
+	struct bbdev_la12xx_q_priv *q_priv = q_data->queue_private;
+	struct bbdev_ipc_enqueue_op bbdev_ipc_op;
+	int nb_enqueued;
+
+	for (nb_enqueued = 0; nb_enqueued < nb_ops; nb_enqueued++) {
+		ops[nb_enqueued] = dequeue_single_op(q_priv, &bbdev_ipc_op);
+		if (!ops[nb_enqueued])
+			break;
+		ops[nb_enqueued]->status = bbdev_ipc_op.status;
+	}
+	q_data->queue_stats.enqueued_count += nb_enqueued;
+
+	return nb_enqueued;
+}
+
 static struct hugepage_info *
 get_hugepage_info(void)
 {
@@ -718,6 +1034,10 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev,
 	bbdev->dequeue_dec_ops = NULL;
 	bbdev->enqueue_enc_ops = NULL;
 	bbdev->enqueue_dec_ops = NULL;
+	bbdev->dequeue_ldpc_enc_ops = dequeue_enc_ops;
+	bbdev->dequeue_ldpc_dec_ops = dequeue_dec_ops;
+	bbdev->enqueue_ldpc_enc_ops = enqueue_enc_ops;
+	bbdev->enqueue_ldpc_dec_ops = enqueue_dec_ops;
 
 	return 0;
 }
diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
index 5f613fb087..b6a7f677d0 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
+++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h
@@ -73,6 +73,25 @@ typedef struct {
 	_IOWR(GUL_IPC_MAGIC, 5, struct ipc_msg *)
 #define IOCTL_GUL_IPC_CHANNEL_RAISE_INTERRUPT _IOW(GUL_IPC_MAGIC, 6, int *)
 
+#define GUL_USER_HUGE_PAGE_OFFSET	(0)
+#define GUL_PCI1_ADDR_BASE	(0x00000000ULL)
+
+#define GUL_USER_HUGE_PAGE_ADDR	(GUL_PCI1_ADDR_BASE + GUL_USER_HUGE_PAGE_OFFSET)
+
+/* IPC PI/CI index & flag manipulation helpers */
+#define IPC_PI_CI_FLAG_MASK	0x80000000 /*  (1<<31) */
+#define IPC_PI_CI_INDEX_MASK	0x7FFFFFFF /* ~(1<<31) */
+
+#define IPC_SET_PI_FLAG(x)	(x |= IPC_PI_CI_FLAG_MASK)
+#define IPC_RESET_PI_FLAG(x)	(x &= IPC_PI_CI_INDEX_MASK)
+#define IPC_GET_PI_FLAG(x)	(x >> 31)
+#define IPC_GET_PI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
+
+#define IPC_SET_CI_FLAG(x)	(x |= IPC_PI_CI_FLAG_MASK)
+#define IPC_RESET_CI_FLAG(x)	(x &= IPC_PI_CI_INDEX_MASK)
+#define IPC_GET_CI_FLAG(x)	(x >> 31)
+#define IPC_GET_CI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
+
 /** buffer ring common metadata */
 typedef struct ipc_bd_ring_md {
 	volatile uint32_t pi;		/**< Producer index and flag (MSB)
@@ -180,6 +199,24 @@ struct bbdev_ipc_enqueue_op {
 	uint32_t rsvd;
 };
 
+/** Structure specifying dequeue operation (dequeue at LA1224) */
+struct bbdev_ipc_dequeue_op {
+	/** Input buffer memory address */
+	uint32_t in_addr;
+	/** Input buffer memory length */
+	uint32_t in_len;
+	/** Output buffer memory address */
+	uint32_t out_addr;
+	/** Output buffer memory length */
+	uint32_t out_len;
+	/* Number of code blocks. Only set when HARQ is used */
+	uint32_t num_code_blocks;
+	/** Dequeue Operation flags */
+	uint32_t op_flags;
+	/** Shared metadata between L1 and L2 */
+	uint32_t shared_metadata;
+};
+
 /* This shared memory would be on the host side which have copy of some
  * of the parameters which are also part of Shared BD ring. Read access
  * of these parameters from the host side would not be over PCI.
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v11 7/8] app/bbdev: enable la12xx for bbdev
  2021-10-17  6:53 ` [dpdk-dev] [PATCH v11 0/8] baseband: add NXP LA12xx driver nipun.gupta
                     ` (5 preceding siblings ...)
  2021-10-17  6:53   ` [dpdk-dev] [PATCH v11 6/8] baseband/la12xx: add enqueue and dequeue support nipun.gupta
@ 2021-10-17  6:53   ` nipun.gupta
  2021-10-17  6:53   ` [dpdk-dev] [PATCH v11 8/8] app/bbdev: handle endianness of test data nipun.gupta
  2021-10-18 15:23   ` [dpdk-dev] [EXT] [PATCH v11 0/8] baseband: add NXP LA12xx driver Akhil Goyal
  8 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-17  6:53 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal

From: Hemant Agrawal <hemant.agrawal@nxp.com>

this patch adds la12xx driver in test bbdev

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/test-bbdev/meson.build | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/app/test-bbdev/meson.build b/app/test-bbdev/meson.build
index edb9deef84..a726a5b3fa 100644
--- a/app/test-bbdev/meson.build
+++ b/app/test-bbdev/meson.build
@@ -23,3 +23,6 @@ endif
 if dpdk_conf.has('RTE_BASEBAND_ACC100')
     deps += ['baseband_acc100']
 endif
+if dpdk_conf.has('RTE_LIBRTE_PMD_BBDEV_LA12XX')
+	deps += ['baseband_la12xx']
+endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* [dpdk-dev] [PATCH v11 8/8] app/bbdev: handle endianness of test data
  2021-10-17  6:53 ` [dpdk-dev] [PATCH v11 0/8] baseband: add NXP LA12xx driver nipun.gupta
                     ` (6 preceding siblings ...)
  2021-10-17  6:53   ` [dpdk-dev] [PATCH v11 7/8] app/bbdev: enable la12xx for bbdev nipun.gupta
@ 2021-10-17  6:53   ` nipun.gupta
  2021-10-18 15:23   ` [dpdk-dev] [EXT] [PATCH v11 0/8] baseband: add NXP LA12xx driver Akhil Goyal
  8 siblings, 0 replies; 157+ messages in thread
From: nipun.gupta @ 2021-10-17  6:53 UTC (permalink / raw)
  To: dev, gakhil, nicolas.chautru; +Cc: david.marchand, hemant.agrawal, Nipun Gupta

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

With data input, output and harq also supported in big
endian format, this patch updates the testbbdev application
to handle the endianness conversion as directed by the
the driver being used.

The test vectors assumes the data in the little endian order, and
thus if the driver supports big endian data processing, conversion
from little endian to big is handled by the testbbdev application.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 app/test-bbdev/test_bbdev_perf.c | 43 ++++++++++++++++++++++++++++++++
 doc/guides/tools/testbbdev.rst   |  3 +++
 2 files changed, 46 insertions(+)

diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c
index 469597b8b3..7b4529789b 100644
--- a/app/test-bbdev/test_bbdev_perf.c
+++ b/app/test-bbdev/test_bbdev_perf.c
@@ -227,6 +227,45 @@ clear_soft_out_cap(uint32_t *op_flags)
 	*op_flags &= ~RTE_BBDEV_TURBO_NEG_LLR_1_BIT_SOFT_OUT;
 }
 
+/* This API is to convert all the test vector op data entries
+ * to big endian format. It is used when the device supports
+ * the input in the big endian format.
+ */
+static inline void
+convert_op_data_to_be(void)
+{
+	struct op_data_entries *op;
+	enum op_data_type type;
+	uint8_t nb_segs, *rem_data, temp;
+	uint32_t *data, len;
+	int complete, rem, i, j;
+
+	for (type = DATA_INPUT; type < DATA_NUM_TYPES; ++type) {
+		nb_segs = test_vector.entries[type].nb_segments;
+		op = &test_vector.entries[type];
+
+		/* Invert byte endianness for all the segments */
+		for (i = 0; i < nb_segs; ++i) {
+			len = op->segments[i].length;
+			data = op->segments[i].addr;
+
+			/* Swap complete u32 bytes */
+			complete = len / 4;
+			for (j = 0; j < complete; j++)
+				data[j] = rte_bswap32(data[j]);
+
+			/* Swap any remaining bytes */
+			rem = len % 4;
+			rem_data = (uint8_t *)&data[j];
+			for (j = 0; j < rem/2; j++) {
+				temp = rem_data[j];
+				rem_data[j] = rem_data[rem - j - 1];
+				rem_data[rem - j - 1] = temp;
+			}
+		}
+	}
+}
+
 static int
 check_dev_cap(const struct rte_bbdev_info *dev_info)
 {
@@ -234,6 +273,7 @@ check_dev_cap(const struct rte_bbdev_info *dev_info)
 	unsigned int nb_inputs, nb_soft_outputs, nb_hard_outputs,
 		nb_harq_inputs, nb_harq_outputs;
 	const struct rte_bbdev_op_cap *op_cap = dev_info->drv.capabilities;
+	uint8_t dev_data_endianness = dev_info->drv.data_endianness;
 
 	nb_inputs = test_vector.entries[DATA_INPUT].nb_segments;
 	nb_soft_outputs = test_vector.entries[DATA_SOFT_OUTPUT].nb_segments;
@@ -245,6 +285,9 @@ check_dev_cap(const struct rte_bbdev_info *dev_info)
 		if (op_cap->type != test_vector.op_type)
 			continue;
 
+		if (dev_data_endianness == RTE_BIG_ENDIAN)
+			convert_op_data_to_be();
+
 		if (op_cap->type == RTE_BBDEV_OP_TURBO_DEC) {
 			const struct rte_bbdev_op_cap_turbo_dec *cap =
 					&op_cap->cap.turbo_dec;
diff --git a/doc/guides/tools/testbbdev.rst b/doc/guides/tools/testbbdev.rst
index d397d991ff..83a0312062 100644
--- a/doc/guides/tools/testbbdev.rst
+++ b/doc/guides/tools/testbbdev.rst
@@ -332,6 +332,9 @@ Variable op_type has to be defined as a first variable in file. It specifies
 what type of operations will be executed. For 4G decoder op_type has to be set to
 ``RTE_BBDEV_OP_TURBO_DEC`` and for 4G encoder to ``RTE_BBDEV_OP_TURBO_ENC``.
 
+Bbdev-test adjusts the byte endianness based on the PMD capability (data_endianness)
+and all the test vectors input/output data are assumed to be LE by default
+
 Full details of the meaning and valid values for the below fields are
 documented in *rte_bbdev_op.h*
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [EXT] [PATCH v11 0/8] baseband: add NXP LA12xx driver
  2021-10-17  6:53 ` [dpdk-dev] [PATCH v11 0/8] baseband: add NXP LA12xx driver nipun.gupta
                     ` (7 preceding siblings ...)
  2021-10-17  6:53   ` [dpdk-dev] [PATCH v11 8/8] app/bbdev: handle endianness of test data nipun.gupta
@ 2021-10-18 15:23   ` Akhil Goyal
  2021-10-18 18:08     ` Chautru, Nicolas
  8 siblings, 1 reply; 157+ messages in thread
From: Akhil Goyal @ 2021-10-18 15:23 UTC (permalink / raw)
  To: nipun.gupta, dev, nicolas.chautru; +Cc: david.marchand, hemant.agrawal

> From: Nipun Gupta <nipun.gupta@nxp.com>
> 
> This series introduces the BBDEV LA12xx poll mode driver (PMD) to support
> an implementation for offloading High Phy processing functions like
> LDPC Encode / Decode 5GNR wireless acceleration function, using PCI based
> LA12xx Software defined radio.
> 
> Please check the documentation patch for more info.
> 
> The driver currently implements basic feature to offload only the 5G LDPC
> encode/decode.
> 
> A new capability has been added to check if the driver can support the
> input data in little/big endian byte order.
> 
> v2: add test case changes
> v3: fix 32 bit compilation
> v4: capability for network byte order, doc patch merged inline.
> v5: add llr_size and llr_decimals, removed LLR compression flag,
>     update testbbdev to handle endianness, rebased on top of 20.08
> v6: added BE as device info instead of capability, updated test
>     to have 2 codeblocks
> v7: fixed checkpatch errors
> v8: remove additional test vectors, update reverse_op function name,
>     make be_support param as bool, other minor changes in la12xx driver
> v9: add little endianness capability as well (patch by Nicolas Chautru),
>     fix 32 bit (i386) compilation, fix get of nb_segs, add endianness
>     info in testbbdev doc.
> v10: use default RTE_BIG_ENDIAN/RTE_LITTLE_ENDIAN defined, add
>      data_endianness info for BBDEV null device
> v11: split la12xx doc in separate patches and fixed some nits
> 
Acked-by: Akhil Goyal <gakhil@marvell.com>
Release notes are updated
Applied to dpdk-next-crypto

I believe Nicolas is out, but he has reviewed the patches and the patches look good.
If I get the Ack by Wednesday, I will update the patches before they are pulled on main.


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [EXT] [PATCH v11 0/8] baseband: add NXP LA12xx driver
  2021-10-18 15:23   ` [dpdk-dev] [EXT] [PATCH v11 0/8] baseband: add NXP LA12xx driver Akhil Goyal
@ 2021-10-18 18:08     ` Chautru, Nicolas
  2021-10-18 18:13       ` Akhil Goyal
  0 siblings, 1 reply; 157+ messages in thread
From: Chautru, Nicolas @ 2021-10-18 18:08 UTC (permalink / raw)
  To: Akhil Goyal, nipun.gupta, dev; +Cc: david.marchand, hemant.agrawal

Hi Akhil, Nipin, 

I do ack the serie formally. Thanks for the updates and welcome to the new bbdev pmd!

Acked-by: Nicolas Chautru <nicolas.chautru@intel.com

> -----Original Message-----
> From: Akhil Goyal <gakhil@marvell.com>
> Sent: Monday, October 18, 2021 8:23 AM
> To: nipun.gupta@nxp.com; dev@dpdk.org; Chautru, Nicolas
> <nicolas.chautru@intel.com>
> Cc: david.marchand@redhat.com; hemant.agrawal@nxp.com
> Subject: RE: [EXT] [PATCH v11 0/8] baseband: add NXP LA12xx driver
> 
> > From: Nipun Gupta <nipun.gupta@nxp.com>
> >
> > This series introduces the BBDEV LA12xx poll mode driver (PMD) to
> > support an implementation for offloading High Phy processing functions
> > like LDPC Encode / Decode 5GNR wireless acceleration function, using
> > PCI based LA12xx Software defined radio.
> >
> > Please check the documentation patch for more info.
> >
> > The driver currently implements basic feature to offload only the 5G
> > LDPC encode/decode.
> >
> > A new capability has been added to check if the driver can support the
> > input data in little/big endian byte order.
> >
> > v2: add test case changes
> > v3: fix 32 bit compilation
> > v4: capability for network byte order, doc patch merged inline.
> > v5: add llr_size and llr_decimals, removed LLR compression flag,
> >     update testbbdev to handle endianness, rebased on top of 20.08
> > v6: added BE as device info instead of capability, updated test
> >     to have 2 codeblocks
> > v7: fixed checkpatch errors
> > v8: remove additional test vectors, update reverse_op function name,
> >     make be_support param as bool, other minor changes in la12xx
> > driver
> > v9: add little endianness capability as well (patch by Nicolas Chautru),
> >     fix 32 bit (i386) compilation, fix get of nb_segs, add endianness
> >     info in testbbdev doc.
> > v10: use default RTE_BIG_ENDIAN/RTE_LITTLE_ENDIAN defined, add
> >      data_endianness info for BBDEV null device
> > v11: split la12xx doc in separate patches and fixed some nits
> >
> Acked-by: Akhil Goyal <gakhil@marvell.com> Release notes are updated
> Applied to dpdk-next-crypto
> 

Acked-by: Nicolas Chautru <nicolas.chautru@intel.com

> I believe Nicolas is out, but he has reviewed the patches and the patches
> look good.
> If I get the Ack by Wednesday, I will update the patches before they are
> pulled on main.


^ permalink raw reply	[flat|nested] 157+ messages in thread

* Re: [dpdk-dev] [EXT] [PATCH v11 0/8] baseband: add NXP LA12xx driver
  2021-10-18 18:08     ` Chautru, Nicolas
@ 2021-10-18 18:13       ` Akhil Goyal
  0 siblings, 0 replies; 157+ messages in thread
From: Akhil Goyal @ 2021-10-18 18:13 UTC (permalink / raw)
  To: Chautru, Nicolas, nipun.gupta, dev; +Cc: david.marchand, hemant.agrawal

> Hi Akhil, Nipin,
> 
> I do ack the serie formally. Thanks for the updates and welcome to the new
> bbdev pmd!
> 
> Acked-by: Nicolas Chautru <nicolas.chautru@intel.com
Thanks, updated the tree.

^ permalink raw reply	[flat|nested] 157+ messages in thread

end of thread, other threads:[~2021-10-18 18:13 UTC | newest]

Thread overview: 157+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-18  6:34 [dpdk-dev] [PATCH 1/6] baseband: introduce NXP LA12xx driver Hemant Agrawal
2021-03-18  6:34 ` [dpdk-dev] [PATCH 2/6] baseband/la12xx: add devargs for max queues Hemant Agrawal
2021-03-18  6:34 ` [dpdk-dev] [PATCH 3/6] baseband/la12xx: add support for multiple modems Hemant Agrawal
2021-03-18  6:34 ` [dpdk-dev] [PATCH 4/6] baseband/la12xx: add queue and modem config support Hemant Agrawal
2021-03-18  6:34 ` [dpdk-dev] [PATCH 5/6] baseband/la12xx: add enqueue and dequeue support Hemant Agrawal
2021-03-18  6:34 ` [dpdk-dev] [PATCH 6/6] baseband/la12xx: add documentation support Hemant Agrawal
2021-03-18 14:53 ` [dpdk-dev] [PATCH 1/6] baseband: introduce NXP LA12xx driver David Marchand
2021-03-19  5:54   ` Hemant Agrawal
2021-04-08  8:55     ` [dpdk-dev] [EXT] " Akhil Goyal
2021-04-08  8:57       ` Hemant Agrawal
2021-04-08 15:29       ` Chautru, Nicolas
2021-04-10 17:02 ` [dpdk-dev] [PATCH v2 0/8] baseband: add " Hemant Agrawal
2021-04-10 17:02   ` [dpdk-dev] [PATCH v2 1/8] baseband: introduce " Hemant Agrawal
2021-04-10 17:02   ` [dpdk-dev] [PATCH v2 2/8] baseband/la12xx: add devargs for max queues Hemant Agrawal
2021-04-10 17:02   ` [dpdk-dev] [PATCH v2 3/8] baseband/la12xx: add support for multiple modems Hemant Agrawal
2021-04-10 17:02   ` [dpdk-dev] [PATCH v2 4/8] baseband/la12xx: add queue and modem config support Hemant Agrawal
2021-04-10 17:02   ` [dpdk-dev] [PATCH v2 5/8] baseband/la12xx: add enqueue and dequeue support Hemant Agrawal
2021-04-10 17:02   ` [dpdk-dev] [PATCH v2 6/8] baseband/la12xx: add documentation support Hemant Agrawal
2021-04-10 17:02   ` [dpdk-dev] [PATCH v2 7/8] app/bbdev: add parameter to take input in network order Hemant Agrawal
2021-04-12  7:22     ` David Marchand
2021-04-12  7:29       ` Hemant Agrawal
2021-04-10 17:02   ` [dpdk-dev] [PATCH v2 8/8] app/bbdev: add test vectors for transport blocks Hemant Agrawal
2021-04-13  5:17   ` [dpdk-dev] [PATCH v3 0/8] baseband: add NXP LA12xx driver Hemant Agrawal
2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 1/8] baseband: introduce " Hemant Agrawal
2021-04-24 10:36       ` [dpdk-dev] [PATCH v4 0/8] baseband: add " Hemant Agrawal
2021-04-24 10:36         ` [dpdk-dev] [PATCH v4 1/8] bbdev: add network order data capability Hemant Agrawal
2021-04-24 21:59           ` Chautru, Nicolas
2021-04-25 16:14             ` Thomas Monjalon
2021-04-26 17:01           ` Dave Burley
2021-04-28 13:03             ` Hemant Agrawal
2021-04-28 13:34             ` Hemant Agrawal
2021-04-28 15:19               ` Chautru, Nicolas
2021-04-24 10:36         ` [dpdk-dev] [PATCH v4 2/8] baseband: introduce NXP LA12xx driver Hemant Agrawal
2021-04-24 10:36         ` [dpdk-dev] [PATCH v4 3/8] baseband/la12xx: add devargs for max queues Hemant Agrawal
2021-04-24 10:36         ` [dpdk-dev] [PATCH v4 4/8] baseband/la12xx: add support for multiple modems Hemant Agrawal
2021-04-24 10:36         ` [dpdk-dev] [PATCH v4 5/8] baseband/la12xx: add queue and modem config support Hemant Agrawal
2021-04-24 22:12           ` Chautru, Nicolas
2021-05-13 11:01             ` Nipun Gupta
2021-05-13 14:51               ` Chautru, Nicolas
2021-05-17 17:00                 ` Nipun Gupta
2021-05-17 17:53                   ` Chautru, Nicolas
2021-05-19 18:43                     ` Nipun Gupta
2021-04-24 10:36         ` [dpdk-dev] [PATCH v4 6/8] baseband/la12xx: add enqueue and dequeue support Hemant Agrawal
2021-04-24 10:36         ` [dpdk-dev] [PATCH v4 7/8] app/bbdev: enable la12xx for bbdev Hemant Agrawal
2021-04-24 10:37         ` [dpdk-dev] [PATCH v4 8/8] app/bbdev: add test vectors for transport blocks Hemant Agrawal
2021-04-24 22:05           ` Chautru, Nicolas
2021-05-05 12:31         ` [dpdk-dev] [EXT] [PATCH v4 0/8] baseband: add NXP LA12xx driver Akhil Goyal
2021-06-16 20:35           ` Akhil Goyal
2021-06-26  9:59             ` Hemant Agrawal
2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 2/8] baseband/la12xx: add devargs for max queues Hemant Agrawal
2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 3/8] baseband/la12xx: add support for multiple modems Hemant Agrawal
2021-04-14  0:02       ` Chautru, Nicolas
2021-04-14 12:10         ` Hemant Agrawal
2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 4/8] baseband/la12xx: add queue and modem config support Hemant Agrawal
2021-04-14  0:41       ` Chautru, Nicolas
2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 5/8] baseband/la12xx: add enqueue and dequeue support Hemant Agrawal
2021-04-14  0:53       ` Chautru, Nicolas
2021-04-14 12:06         ` Hemant Agrawal
2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 6/8] baseband/la12xx: add documentation support Hemant Agrawal
2021-04-14  0:57       ` Chautru, Nicolas
2021-04-14 11:59         ` Hemant Agrawal
2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 7/8] app/bbdev: add parameter to take input in network order Hemant Agrawal
2021-04-14  1:00       ` Chautru, Nicolas
2021-04-14 12:15         ` Nipun Gupta
2021-04-13  5:17     ` [dpdk-dev] [PATCH v3 8/8] app/bbdev: add test vectors for transport blocks Hemant Agrawal
2021-04-14  1:09       ` Chautru, Nicolas
2021-04-14 12:16         ` Nipun Gupta
2021-04-14 15:48           ` Chautru, Nicolas
2021-04-13 10:06     ` [dpdk-dev] [EXT] [PATCH v3 0/8] baseband: add NXP LA12xx driver Akhil Goyal
2021-09-12 12:15 ` [dpdk-dev] [PATCH v5 0/9] " Nipun Gupta
2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 1/9] bbdev: add big endian processing data capability Nipun Gupta
2021-09-13 18:39     ` Chautru, Nicolas
2021-09-17  8:30       ` Nipun Gupta
2021-09-17 14:23         ` Chautru, Nicolas
2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 2/9] baseband: introduce NXP LA12xx driver Nipun Gupta
2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 3/9] baseband/la12xx: add devargs for max queues Nipun Gupta
2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 4/9] baseband/la12xx: add support for multiple modems Nipun Gupta
2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 5/9] baseband/la12xx: add queue and modem config support Nipun Gupta
2021-09-13 18:56     ` Chautru, Nicolas
2021-09-17  8:33       ` Nipun Gupta
2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 6/9] baseband/la12xx: add enqueue and dequeue support Nipun Gupta
2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 7/9] app/bbdev: enable la12xx for bbdev Nipun Gupta
2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 8/9] app/bbdev: handle endianness of test data Nipun Gupta
2021-09-13 18:45     ` Chautru, Nicolas
2021-09-12 12:15   ` [dpdk-dev] [PATCH v5 9/9] app/bbdev: add test vectors for transport blocks Nipun Gupta
2021-09-13 19:01     ` Chautru, Nicolas
2021-09-17  8:37       ` Nipun Gupta
2021-09-17 14:20         ` Chautru, Nicolas
2021-09-24  4:37 ` [dpdk-dev] [PATCH v6 0/9] baseband: add NXP LA12xx driver nipun.gupta
2021-09-24  4:37   ` [dpdk-dev] [PATCH v6 1/9] bbdev: add big endian processing data processing info nipun.gupta
2021-09-24  4:37   ` [dpdk-dev] [PATCH v6 2/9] baseband: introduce NXP LA12xx driver nipun.gupta
2021-09-24  4:37   ` [dpdk-dev] [PATCH v6 3/9] baseband/la12xx: add devargs for max queues nipun.gupta
2021-09-24  4:37   ` [dpdk-dev] [PATCH v6 4/9] baseband/la12xx: add support for multiple modems nipun.gupta
2021-09-24  4:37   ` [dpdk-dev] [PATCH v6 5/9] baseband/la12xx: add queue and modem config support nipun.gupta
2021-09-24  4:37   ` [dpdk-dev] [PATCH v6 6/9] baseband/la12xx: add enqueue and dequeue support nipun.gupta
2021-09-24  4:37   ` [dpdk-dev] [PATCH v6 7/9] app/bbdev: enable la12xx for bbdev nipun.gupta
2021-09-24  4:37   ` [dpdk-dev] [PATCH v6 8/9] app/bbdev: handle endianness of test data nipun.gupta
2021-09-24  4:37   ` [dpdk-dev] [PATCH v6 9/9] app/bbdev: add test vectors for transport blocks nipun.gupta
2021-09-28  8:29 ` [dpdk-dev] [PATCH v7 0/9] baseband: add NXP LA12xx driver nipun.gupta
2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 1/9] bbdev: add big endian processing data processing info nipun.gupta
2021-10-04 23:09     ` Chautru, Nicolas
2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 2/9] baseband: introduce NXP LA12xx driver nipun.gupta
2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 3/9] baseband/la12xx: add devargs for max queues nipun.gupta
2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 4/9] baseband/la12xx: add support for multiple modems nipun.gupta
2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 5/9] baseband/la12xx: add queue and modem config support nipun.gupta
2021-10-04 23:19     ` Chautru, Nicolas
2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 6/9] baseband/la12xx: add enqueue and dequeue support nipun.gupta
2021-10-04 23:23     ` Chautru, Nicolas
2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 7/9] app/bbdev: enable la12xx for bbdev nipun.gupta
2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 8/9] app/bbdev: handle endianness of test data nipun.gupta
2021-10-04 23:38     ` Chautru, Nicolas
2021-09-28  8:29   ` [dpdk-dev] [PATCH v7 9/9] app/bbdev: add test vectors for transport blocks nipun.gupta
2021-10-04 23:31     ` Chautru, Nicolas
2021-10-06 11:31 ` [dpdk-dev] [PATCH v8 0/8] baseband: add NXP LA12xx driver nipun.gupta
2021-10-06 11:31   ` [dpdk-dev] [PATCH v8 1/8] bbdev: add big endian processing data processing info nipun.gupta
2021-10-06 21:02     ` Chautru, Nicolas
2021-10-06 11:31   ` [dpdk-dev] [PATCH v8 2/8] baseband: introduce NXP LA12xx driver nipun.gupta
2021-10-06 11:31   ` [dpdk-dev] [PATCH v8 3/8] baseband/la12xx: add devargs for max queues nipun.gupta
2021-10-06 11:31   ` [dpdk-dev] [PATCH v8 4/8] baseband/la12xx: add support for multiple modems nipun.gupta
2021-10-06 11:31   ` [dpdk-dev] [PATCH v8 5/8] baseband/la12xx: add queue and modem config support nipun.gupta
2021-10-06 11:31   ` [dpdk-dev] [PATCH v8 6/8] baseband/la12xx: add enqueue and dequeue support nipun.gupta
2021-10-06 11:31   ` [dpdk-dev] [PATCH v8 7/8] app/bbdev: enable la12xx for bbdev nipun.gupta
2021-10-06 11:31   ` [dpdk-dev] [PATCH v8 8/8] app/bbdev: handle endianness of test data nipun.gupta
2021-10-06 20:24     ` Chautru, Nicolas
2021-10-07  9:33 ` [dpdk-dev] [PATCH v9 0/8] baseband: add NXP LA12xx driver nipun.gupta
2021-10-07  9:33   ` [dpdk-dev] [PATCH v9 1/8] bbdev: add device info related to data endianness assumption nipun.gupta
2021-10-07  9:33   ` [dpdk-dev] [PATCH v9 2/8] baseband: introduce NXP LA12xx driver nipun.gupta
2021-10-07  9:33   ` [dpdk-dev] [PATCH v9 3/8] baseband/la12xx: add devargs for max queues nipun.gupta
2021-10-07  9:33   ` [dpdk-dev] [PATCH v9 4/8] baseband/la12xx: add support for multiple modems nipun.gupta
2021-10-07  9:33   ` [dpdk-dev] [PATCH v9 5/8] baseband/la12xx: add queue and modem config support nipun.gupta
2021-10-07  9:33   ` [dpdk-dev] [PATCH v9 6/8] baseband/la12xx: add enqueue and dequeue support nipun.gupta
2021-10-07  9:33   ` [dpdk-dev] [PATCH v9 7/8] app/bbdev: enable la12xx for bbdev nipun.gupta
2021-10-07  9:33   ` [dpdk-dev] [PATCH v9 8/8] app/bbdev: handle endianness of test data nipun.gupta
2021-10-11  4:32 ` [dpdk-dev] [PATCH v10 0/8] baseband: add NXP LA12xx driver nipun.gupta
2021-10-11  4:32   ` [dpdk-dev] [PATCH v10 1/8] bbdev: add device info related to data endianness nipun.gupta
2021-10-11  4:32   ` [dpdk-dev] [PATCH v10 2/8] baseband: introduce NXP LA12xx driver nipun.gupta
2021-10-16 13:58     ` [dpdk-dev] [EXT] " Akhil Goyal
2021-10-11  4:32   ` [dpdk-dev] [PATCH v10 3/8] baseband/la12xx: add devargs for max queues nipun.gupta
2021-10-16 14:00     ` [dpdk-dev] [EXT] " Akhil Goyal
2021-10-11  4:32   ` [dpdk-dev] [PATCH v10 4/8] baseband/la12xx: add support for multiple modems nipun.gupta
2021-10-11  4:32   ` [dpdk-dev] [PATCH v10 5/8] baseband/la12xx: add queue and modem config support nipun.gupta
2021-10-16 14:13     ` [dpdk-dev] [EXT] " Akhil Goyal
2021-10-11  4:32   ` [dpdk-dev] [PATCH v10 6/8] baseband/la12xx: add enqueue and dequeue support nipun.gupta
2021-10-11  4:32   ` [dpdk-dev] [PATCH v10 7/8] app/bbdev: enable la12xx for bbdev nipun.gupta
2021-10-11  4:32   ` [dpdk-dev] [PATCH v10 8/8] app/bbdev: handle endianness of test data nipun.gupta
2021-10-17  6:53 ` [dpdk-dev] [PATCH v11 0/8] baseband: add NXP LA12xx driver nipun.gupta
2021-10-17  6:53   ` [dpdk-dev] [PATCH v11 1/8] bbdev: add device info related to data endianness nipun.gupta
2021-10-17  6:53   ` [dpdk-dev] [PATCH v11 2/8] baseband: introduce NXP LA12xx driver nipun.gupta
2021-10-17  6:53   ` [dpdk-dev] [PATCH v11 3/8] baseband/la12xx: add devargs for max queues nipun.gupta
2021-10-17  6:53   ` [dpdk-dev] [PATCH v11 4/8] baseband/la12xx: add support for multiple modems nipun.gupta
2021-10-17  6:53   ` [dpdk-dev] [PATCH v11 5/8] baseband/la12xx: add queue and modem config support nipun.gupta
2021-10-17  6:53   ` [dpdk-dev] [PATCH v11 6/8] baseband/la12xx: add enqueue and dequeue support nipun.gupta
2021-10-17  6:53   ` [dpdk-dev] [PATCH v11 7/8] app/bbdev: enable la12xx for bbdev nipun.gupta
2021-10-17  6:53   ` [dpdk-dev] [PATCH v11 8/8] app/bbdev: handle endianness of test data nipun.gupta
2021-10-18 15:23   ` [dpdk-dev] [EXT] [PATCH v11 0/8] baseband: add NXP LA12xx driver Akhil Goyal
2021-10-18 18:08     ` Chautru, Nicolas
2021-10-18 18:13       ` Akhil Goyal

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).