[dpdk-dev] baseband/turbo_sw: splitting Queue Groups

Message ID 20180404140602.9344-4-kamilx.chalupnik@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Kamil Chalupnik April 4, 2018, 2:05 p.m. UTC
  From: "Chalupnik, KamilX" <kamilx.chalupnik@intel.com>

Splitting Queue Groups into UL/DL Groups in Turbo Software
Driver. The are independent for Decode/Encode

Signed-off-by: KamilX Chalupnik <kamilx.chalupnik@intel.com>
---
 app/test-bbdev/test_bbdev.c                      | 29 ++++++++------------
 drivers/baseband/null/bbdev_null.c               | 35 +++++++++++-------------
 drivers/baseband/turbo_sw/bbdev_turbo_software.c |  3 +-
 lib/librte_bbdev/rte_bbdev.c                     | 13 +++++++--
 lib/librte_bbdev/rte_bbdev.h                     |  6 ++--
 5 files changed, 44 insertions(+), 42 deletions(-)
  

Comments

Mokhtar, Amr April 13, 2018, 11:19 p.m. UTC | #1
> -----Original Message-----
> From: Chalupnik, KamilX
> Sent: Wednesday 4 April 2018 15:06
> To: dev@dpdk.org
> Cc: Mokhtar, Amr <amr.mokhtar@intel.com>; Chalupnik, KamilX
> <kamilx.chalupnik@intel.com>
> Subject: [PATCH] baseband/turbo_sw: splitting Queue Groups
> 
> From: "Chalupnik, KamilX" <kamilx.chalupnik@intel.com>
> 
> Splitting Queue Groups into UL/DL Groups in Turbo Software
> Driver. The are independent for Decode/Encode
> 
> Signed-off-by: KamilX Chalupnik <kamilx.chalupnik@intel.com>

Acked-by: Amr Mokhtar <amr.mokhtar@intel.com>
  

Patch

diff --git a/app/test-bbdev/test_bbdev.c b/app/test-bbdev/test_bbdev.c
index 10579ea..a914817 100644
--- a/app/test-bbdev/test_bbdev.c
+++ b/app/test-bbdev/test_bbdev.c
@@ -273,7 +273,7 @@  test_bbdev_configure_stop_queue(void)
 
 	/* Valid queue configuration */
 	ts_params->qconf.queue_size = info.drv.queue_size_lim;
-	ts_params->qconf.priority = info.drv.max_queue_priority;
+	ts_params->qconf.priority = info.drv.max_ul_queue_priority;
 
 	/* Device - started; queue - started */
 	rte_bbdev_start(dev_id);
@@ -413,14 +413,7 @@  test_bbdev_configure_invalid_queue_configure(void)
 			ts_params->qconf.queue_size);
 
 	ts_params->qconf.queue_size = info.drv.queue_size_lim;
-	ts_params->qconf.priority = info.drv.max_queue_priority + 1;
-	TEST_ASSERT_FAIL(rte_bbdev_queue_configure(dev_id, queue_id,
-			&ts_params->qconf),
-			"Failed test for rte_bbdev_queue_configure: "
-			"invalid value qconf.queue_size: %u",
-			ts_params->qconf.queue_size);
-
-	ts_params->qconf.priority = info.drv.max_queue_priority;
+	ts_params->qconf.priority = info.drv.max_ul_queue_priority;
 	queue_id = info.num_queues;
 	TEST_ASSERT_FAIL(rte_bbdev_queue_configure(dev_id, queue_id,
 			&ts_params->qconf),
@@ -902,12 +895,12 @@  test_bbdev_callback(void)
 			"Failed to callback rgstr for RTE_BBDEV_EVENT_UNKNOWN");
 
 	rte_bbdev_pmd_callback_process(dev1, RTE_BBDEV_EVENT_UNKNOWN, NULL);
-	TEST_ASSERT(event_status == 0,
+	TEST_ASSERT(event_status == (int) RTE_BBDEV_EVENT_UNKNOWN,
 			"Failed test for rte_bbdev_pmd_callback_process "
 			"for RTE_BBDEV_EVENT_UNKNOWN ");
 
 	rte_bbdev_pmd_callback_process(dev1, RTE_BBDEV_EVENT_ERROR, NULL);
-	TEST_ASSERT(event_status == 0,
+	TEST_ASSERT(event_status == (int) RTE_BBDEV_EVENT_UNKNOWN,
 			"Failed test for rte_bbdev_pmd_callback_process: "
 			"event RTE_BBDEV_EVENT_ERROR was not registered ");
 
@@ -926,12 +919,12 @@  test_bbdev_callback(void)
 
 	event_status = -1;
 	rte_bbdev_pmd_callback_process(dev1, RTE_BBDEV_EVENT_UNKNOWN, NULL);
-	TEST_ASSERT(event_status == 0,
+	TEST_ASSERT(event_status == (int) RTE_BBDEV_EVENT_UNKNOWN,
 			"Failed test for rte_bbdev_pmd_callback_process "
 			"for RTE_BBDEV_EVENT_UNKNOWN ");
 
 	rte_bbdev_pmd_callback_process(dev1, RTE_BBDEV_EVENT_ERROR, NULL);
-	TEST_ASSERT(event_status == 1,
+	TEST_ASSERT(event_status == (int) RTE_BBDEV_EVENT_ERROR,
 			"Failed test for rte_bbdev_pmd_callback_process "
 			"for RTE_BBDEV_EVENT_ERROR ");
 
@@ -945,12 +938,12 @@  test_bbdev_callback(void)
 
 	event_status = -1;
 	rte_bbdev_pmd_callback_process(dev1, RTE_BBDEV_EVENT_UNKNOWN, NULL);
-	TEST_ASSERT(event_status == 0,
+	TEST_ASSERT(event_status == (int) RTE_BBDEV_EVENT_UNKNOWN,
 			"Failed test for rte_bbdev_pmd_callback_process "
 			"for RTE_BBDEV_EVENT_UNKNOWN ");
 
 	rte_bbdev_pmd_callback_process(dev1, RTE_BBDEV_EVENT_ERROR, NULL);
-	TEST_ASSERT(event_status == 0,
+	TEST_ASSERT(event_status == (int) RTE_BBDEV_EVENT_UNKNOWN,
 			"Failed test for rte_bbdev_pmd_callback_process: "
 			"event RTE_BBDEV_EVENT_ERROR was unregistered ");
 
@@ -999,7 +992,7 @@  test_bbdev_callback(void)
 		"for RTE_BBDEV_EVENT_ERROR ");
 
 	rte_bbdev_pmd_callback_process(dev2, RTE_BBDEV_EVENT_ERROR, NULL);
-	TEST_ASSERT(event_status == 1,
+	TEST_ASSERT(event_status == (int) RTE_BBDEV_EVENT_ERROR,
 		"Failed test for rte_bbdev_pmd_callback_process in dev2 "
 		"for RTE_BBDEV_EVENT_ERROR ");
 
@@ -1013,7 +1006,7 @@  test_bbdev_callback(void)
 			"in dev 2 ");
 
 	rte_bbdev_pmd_callback_process(dev2, RTE_BBDEV_EVENT_UNKNOWN, NULL);
-	TEST_ASSERT(event_status == 0,
+	TEST_ASSERT(event_status == (int) RTE_BBDEV_EVENT_UNKNOWN,
 			"Failed test for rte_bbdev_pmd_callback_process in dev2"
 			" for RTE_BBDEV_EVENT_UNKNOWN ");
 
@@ -1033,7 +1026,7 @@  test_bbdev_callback(void)
 		" for RTE_BBDEV_EVENT_UNKNOWN ");
 
 	rte_bbdev_pmd_callback_process(dev1, RTE_BBDEV_EVENT_UNKNOWN, NULL);
-	TEST_ASSERT(event_status == 0,
+	TEST_ASSERT(event_status == (int) RTE_BBDEV_EVENT_UNKNOWN,
 			"Failed test for rte_bbdev_pmd_callback_process in dev2 "
 			"for RTE_BBDEV_EVENT_UNKNOWN ");
 
diff --git a/drivers/baseband/null/bbdev_null.c b/drivers/baseband/null/bbdev_null.c
index 6bc8491..c2e58db 100644
--- a/drivers/baseband/null/bbdev_null.c
+++ b/drivers/baseband/null/bbdev_null.c
@@ -16,15 +16,11 @@ 
 #define DRIVER_NAME bbdev_null
 
 /* NULL BBDev logging ID */
-static int bbdev_null_logtype;
+static int null_pmd_logtype;
 
 /* Helper macro for logging */
-#define rte_bbdev_log(level, fmt, ...) \
-	rte_log(RTE_LOG_ ## level, bbdev_null_logtype, fmt "\n", ##__VA_ARGS__)
-
-#define rte_bbdev_log_debug(fmt, ...) \
-	rte_bbdev_log(DEBUG, RTE_STR(__LINE__) ":%s() " fmt, __func__, \
-		##__VA_ARGS__)
+#define null_pmd_log(level, fmt, ...) \
+	rte_log(RTE_LOG_ ## level, null_pmd_logtype, fmt "\n", ##__VA_ARGS__)
 
 /*  Initialisation params structure that can be used by null BBDEV driver */
 struct bbdev_null_params {
@@ -71,13 +67,14 @@  info_get(struct rte_bbdev *dev, struct rte_bbdev_driver_info *dev_info)
 	dev_info->max_num_queues = internals->max_nb_queues;
 	dev_info->queue_size_lim = RTE_BBDEV_QUEUE_SIZE_LIMIT;
 	dev_info->hardware_accelerated = false;
-	dev_info->max_queue_priority = 0;
+	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 = 0;
 
-	rte_bbdev_log_debug("got device info from %u", dev->data->dev_id);
+	null_pmd_log(DEBUG, "got device info from %u", dev->data->dev_id);
 }
 
 /* Release queue */
@@ -92,7 +89,7 @@  q_release(struct rte_bbdev *dev, uint16_t q_id)
 		dev->data->queues[q_id].queue_private = NULL;
 	}
 
-	rte_bbdev_log_debug("released device queue %u:%u",
+	null_pmd_log(DEBUG, "released device queue %u:%u",
 			dev->data->dev_id, q_id);
 	return 0;
 }
@@ -111,19 +108,19 @@  q_setup(struct rte_bbdev *dev, uint16_t q_id,
 	q = rte_zmalloc_socket(RTE_STR(DRIVER_NAME), sizeof(*q),
 			RTE_CACHE_LINE_SIZE, queue_conf->socket);
 	if (q == NULL) {
-		rte_bbdev_log(ERR, "Failed to allocate queue memory");
+		null_pmd_log(ERR, "Failed to allocate queue memory");
 		return -ENOMEM;
 	}
 
 	q->processed_pkts = rte_ring_create(ring_name, queue_conf->queue_size,
 			queue_conf->socket, RING_F_SP_ENQ | RING_F_SC_DEQ);
 	if (q->processed_pkts == NULL) {
-		rte_bbdev_log(ERR, "Failed to create ring");
+		null_pmd_log(ERR, "Failed to create ring");
 		goto free_q;
 	}
 
 	dev->data->queues[q_id].queue_private = q;
-	rte_bbdev_log_debug("setup device queue %s", ring_name);
+	null_pmd_log(DEBUG, "setup device queue %s", ring_name);
 	return 0;
 
 free_q:
@@ -205,7 +202,7 @@  parse_u16_arg(const char *key, const char *value, void *extra_args)
 	errno = 0;
 	result = strtoul(value, NULL, 0);
 	if ((result >= (1 << 16)) || (errno != 0)) {
-		rte_bbdev_log(ERR, "Invalid value %lu for %s", result, key);
+		null_pmd_log(ERR, "Invalid value %lu for %s", result, key);
 		return -ERANGE;
 	}
 	*u16 = (uint16_t)result;
@@ -238,7 +235,7 @@  parse_bbdev_null_params(struct bbdev_null_params *params,
 			goto exit;
 
 		if (params->socket_id >= RTE_MAX_NUMA_NODES) {
-			rte_bbdev_log(ERR, "Invalid socket, must be < %u",
+			null_pmd_log(ERR, "Invalid socket, must be < %u",
 					RTE_MAX_NUMA_NODES);
 			goto exit;
 		}
@@ -307,7 +304,7 @@  null_bbdev_probe(struct rte_vdev_device *vdev)
 	input_args = rte_vdev_device_args(vdev);
 	parse_bbdev_null_params(&init_params, input_args);
 
-	rte_bbdev_log_debug("Init %s on NUMA node %d with max queues: %d",
+	null_pmd_log(DEBUG, "Init %s on NUMA node %d with max queues: %d",
 			name, init_params.socket_id, init_params.queues_num);
 
 	return null_bbdev_create(vdev, &init_params);
@@ -350,7 +347,7 @@  RTE_INIT(null_bbdev_init_log);
 static void
 null_bbdev_init_log(void)
 {
-	bbdev_null_logtype = rte_log_register("pmd.bb.null");
-	if (bbdev_null_logtype >= 0)
-		rte_log_set_level(bbdev_null_logtype, RTE_LOG_NOTICE);
+	null_pmd_logtype = rte_log_register("pmd.bbdev.null");
+	if (null_pmd_logtype >= 0)
+		rte_log_set_level(null_pmd_logtype, RTE_LOG_NOTICE);
 }
diff --git a/drivers/baseband/turbo_sw/bbdev_turbo_software.c b/drivers/baseband/turbo_sw/bbdev_turbo_software.c
index 0d3b00f..2efcdc9 100644
--- a/drivers/baseband/turbo_sw/bbdev_turbo_software.c
+++ b/drivers/baseband/turbo_sw/bbdev_turbo_software.c
@@ -164,7 +164,8 @@  info_get(struct rte_bbdev *dev, struct rte_bbdev_driver_info *dev_info)
 	dev_info->max_num_queues = internals->max_nb_queues;
 	dev_info->queue_size_lim = RTE_BBDEV_QUEUE_SIZE_LIMIT;
 	dev_info->hardware_accelerated = false;
-	dev_info->max_queue_priority = 0;
+	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 = &cpu_flag;
diff --git a/lib/librte_bbdev/rte_bbdev.c b/lib/librte_bbdev/rte_bbdev.c
index 74ecc49..28434e0 100644
--- a/lib/librte_bbdev/rte_bbdev.c
+++ b/lib/librte_bbdev/rte_bbdev.c
@@ -495,11 +495,20 @@  rte_bbdev_queue_configure(uint16_t dev_id, uint16_t queue_id,
 					conf->queue_size, queue_id, dev_id);
 			return -EINVAL;
 		}
-		if (conf->priority > dev_info.max_queue_priority) {
+		if (conf->op_type == RTE_BBDEV_OP_TURBO_DEC &&
+			conf->priority > dev_info.max_ul_queue_priority) {
 			rte_bbdev_log(ERR,
 					"Priority (%u) of queue %u of bdev %u must be <= %u",
 					conf->priority, queue_id, dev_id,
-					dev_info.max_queue_priority);
+					dev_info.max_ul_queue_priority);
+			return -EINVAL;
+		}
+		if (conf->op_type == RTE_BBDEV_OP_TURBO_ENC &&
+			conf->priority > dev_info.max_dl_queue_priority) {
+			rte_bbdev_log(ERR,
+					"Priority (%u) of queue %u of bdev %u must be <= %u",
+					conf->priority, queue_id, dev_id,
+					dev_info.max_dl_queue_priority);
 			return -EINVAL;
 		}
 	}
diff --git a/lib/librte_bbdev/rte_bbdev.h b/lib/librte_bbdev/rte_bbdev.h
index 395acf6..dd3b0be 100644
--- a/lib/librte_bbdev/rte_bbdev.h
+++ b/lib/librte_bbdev/rte_bbdev.h
@@ -283,8 +283,10 @@  struct rte_bbdev_driver_info {
 	uint32_t queue_size_lim;
 	/** Set if device off-loads operation to hardware  */
 	bool hardware_accelerated;
-	/** Max value supported by queue priority */
-	uint8_t max_queue_priority;
+	/** Max value supported by queue priority for DL */
+	uint8_t max_dl_queue_priority;
+	/** Max value supported by queue priority for UL */
+	uint8_t max_ul_queue_priority;
 	/** Set if device supports per-queue interrupts */
 	bool queue_intr_supported;
 	/** Minimum alignment of buffers, in bytes */