[dpdk-dev] [PATCH v7 04/15] app/eventdev: add pipeline opt dump and check functions

Pavan Nikhilesh pbhagavatula at caviumnetworks.com
Tue Jan 16 18:45:56 CET 2018


Signed-off-by: Pavan Nikhilesh <pbhagavatula at caviumnetworks.com>
Acked-by: Harry van Haaren <harry.van.haaren at intel.com>
---
 app/test-eventdev/test_pipeline_common.c | 84 ++++++++++++++++++++++++++++++++
 app/test-eventdev/test_pipeline_common.h |  3 ++
 2 files changed, 87 insertions(+)

diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c
index ff60fc36c..45e0652b8 100644
--- a/app/test-eventdev/test_pipeline_common.c
+++ b/app/test-eventdev/test_pipeline_common.c
@@ -5,6 +5,90 @@
 
 #include "test_pipeline_common.h"
 
+int
+pipeline_test_result(struct evt_test *test, struct evt_options *opt)
+{
+	RTE_SET_USED(opt);
+	int i;
+	uint64_t total = 0;
+	struct test_pipeline *t = evt_test_priv(test);
+
+	printf("Packet distribution across worker cores :\n");
+	for (i = 0; i < t->nb_workers; i++)
+		total += t->worker[i].processed_pkts;
+	for (i = 0; i < t->nb_workers; i++)
+		printf("Worker %d packets: "CLGRN"%"PRIx64" "CLNRM"percentage:"
+				CLGRN" %3.2f\n"CLNRM, i,
+				t->worker[i].processed_pkts,
+				(((double)t->worker[i].processed_pkts)/total)
+				* 100);
+	return t->result;
+}
+
+void
+pipeline_opt_dump(struct evt_options *opt, uint8_t nb_queues)
+{
+	evt_dump("nb_worker_lcores", "%d", evt_nr_active_lcores(opt->wlcores));
+	evt_dump_worker_lcores(opt);
+	evt_dump_nb_stages(opt);
+	evt_dump("nb_evdev_ports", "%d", pipeline_nb_event_ports(opt));
+	evt_dump("nb_evdev_queues", "%d", nb_queues);
+	evt_dump_queue_priority(opt);
+	evt_dump_sched_type_list(opt);
+	evt_dump_producer_type(opt);
+}
+
+int
+pipeline_opt_check(struct evt_options *opt, uint64_t nb_queues)
+{
+	unsigned int lcores;
+	/*
+	 * N worker + 1 master
+	 */
+	lcores = 2;
+
+	if (!rte_eth_dev_count()) {
+		evt_err("test needs minimum 1 ethernet dev");
+		return -1;
+	}
+
+	if (rte_lcore_count() < lcores) {
+		evt_err("test need minimum %d lcores", lcores);
+		return -1;
+	}
+
+	/* Validate worker lcores */
+	if (evt_lcores_has_overlap(opt->wlcores, rte_get_master_lcore())) {
+		evt_err("worker lcores overlaps with master lcore");
+		return -1;
+	}
+	if (evt_has_disabled_lcore(opt->wlcores)) {
+		evt_err("one or more workers lcores are not enabled");
+		return -1;
+	}
+	if (!evt_has_active_lcore(opt->wlcores)) {
+		evt_err("minimum one worker is required");
+		return -1;
+	}
+
+	if (nb_queues > EVT_MAX_QUEUES) {
+		evt_err("number of queues exceeds %d", EVT_MAX_QUEUES);
+		return -1;
+	}
+	if (pipeline_nb_event_ports(opt) > EVT_MAX_PORTS) {
+		evt_err("number of ports exceeds %d", EVT_MAX_PORTS);
+		return -1;
+	}
+
+	if (evt_has_invalid_stage(opt))
+		return -1;
+
+	if (evt_has_invalid_sched_type(opt))
+		return -1;
+
+	return 0;
+}
+
 int
 pipeline_mempool_setup(struct evt_test *test, struct evt_options *opt)
 {
diff --git a/app/test-eventdev/test_pipeline_common.h b/app/test-eventdev/test_pipeline_common.h
index 569db1de5..6e43eea2b 100644
--- a/app/test-eventdev/test_pipeline_common.h
+++ b/app/test-eventdev/test_pipeline_common.h
@@ -51,8 +51,11 @@ struct test_pipeline {
 	uint8_t sched_type_list[EVT_MAX_STAGES] __rte_cache_aligned;
 } __rte_cache_aligned;
 
+int pipeline_test_result(struct evt_test *test, struct evt_options *opt);
+int pipeline_opt_check(struct evt_options *opt, uint64_t nb_queues);
 int pipeline_test_setup(struct evt_test *test, struct evt_options *opt);
 int pipeline_mempool_setup(struct evt_test *test, struct evt_options *opt);
+void pipeline_opt_dump(struct evt_options *opt, uint8_t nb_queues);
 void pipeline_test_destroy(struct evt_test *test, struct evt_options *opt);
 void pipeline_mempool_destroy(struct evt_test *test, struct evt_options *opt);
 
-- 
2.14.1



More information about the dev mailing list