app/eventdev: add pipeline opt dump and check functions
authorPavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Tue, 16 Jan 2018 17:45:56 +0000 (23:15 +0530)
committerJerin Jacob <jerin.jacob@caviumnetworks.com>
Fri, 19 Jan 2018 15:09:56 +0000 (16:09 +0100)
Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
app/test-eventdev/test_pipeline_common.c
app/test-eventdev/test_pipeline_common.h

index ff60fc3..45e0652 100644 (file)
@@ -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)
 {
index 569db1d..0a8d66a 100644 (file)
@@ -51,8 +51,17 @@ struct test_pipeline {
        uint8_t sched_type_list[EVT_MAX_STAGES] __rte_cache_aligned;
 } __rte_cache_aligned;
 
+static inline int
+pipeline_nb_event_ports(struct evt_options *opt)
+{
+       return evt_nr_active_lcores(opt->wlcores);
+}
+
+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);