18 #include <odp/helper/odph_api.h>
20 #include <bench_common.h>
21 #include <export_results.h>
33 #define MAX_NAME_LEN 128
36 #define TEST_MAX_BENCH_NUM 10
38 #define BENCH_INFO(run_fn, init_fn, term_fn, cond_fn, rounds) \
39 {.name = #run_fn, .run = run_fn, .init = init_fn, .term = term_fn, .cond = cond_fn,\
52 char name[MAX_NAME_LEN];
61 uint32_t num_input_queues;
64 uint32_t num_output_queues;
99 bench_tm_suite_t suite;
105 bench_tm_result_t result[TEST_MAX_BENCH_NUM];
109 static appl_args_t *gbl_args;
113 if (gbl_args == NULL)
118 static int setup_sig_handler(
void)
120 struct sigaction action;
122 memset(&action, 0,
sizeof(action));
123 action.sa_handler = sig_handler;
127 if (sigemptyset(&action.sa_mask))
130 if (sigaction(SIGINT, &action, NULL))
136 static void clean_pending_events(
void)
156 ODPH_ABORT(
"Reading pool capabilities failed\n");
171 ODPH_ABORT(
"Creating packet pool failed\n");
178 appl_args_t *appl_args = gbl_args;
186 pool = create_packet_pool();
194 ODPH_ABORT(
"Opening pktio failed\n");
197 pktin_param.
num_queues = appl_args->opt.num_input_queues;
209 pktout_param.
num_queues = appl_args->opt.num_output_queues;
213 ODPH_ABORT(
"Configuring packet input queues failed: %d\n", ret);
217 ODPH_ABORT(
"Configuring packet output queues failed: %d\n", ret);
221 ODPH_ABORT(
"Starting pktio failed: %d\n", ret);
223 appl_args->pool = pool;
224 appl_args->pktio = pktio;
227 static void pktio_setup(
void)
229 pktio_setup_param(gbl_args->opt.in_mode, gbl_args->opt.out_mode,
false);
232 static void pktio_setup_direct_rx(
void)
237 static void pktio_setup_sched_rx(
void)
242 static void pktio_setup_cls(
void)
247 static void pktio_setup_direct_tx(
void)
252 static void pktio_setup_queue_tx(
void)
259 appl_args_t *appl_args = gbl_args;
264 ODPH_ABORT(
"Stopping pktio failed: %d\n", ret);
268 clean_pending_events();
272 ODPH_ABORT(
"Closing pktio failed: %d\n", ret);
276 ODPH_ABORT(
"Destroying pktio pool failed: %d\n", ret);
279 static void pktio_clean(
void)
281 pktio_clean_param(gbl_args->opt.in_mode);
284 static void pktio_clean_direct_rx(
void)
289 static void pktio_clean_sched_rx(
void)
294 static int pktio_capability(bench_tm_result_t *res,
int repeat_count)
296 appl_args_t *appl_args = gbl_args;
301 uint8_t id1 = bench_tm_func_register(res,
"odp_pktio_capability()");
303 for (
int i = 0; i < repeat_count; i++) {
309 ODPH_ERR(
"Reading pktio capa failed: %d\n", ret);
313 bench_tm_func_record(t2, t1, res, id1);
318 static int pktio_lookup(bench_tm_result_t *res,
int repeat_count)
320 appl_args_t *appl_args = gbl_args;
321 const char *name = appl_args->opt.name;
324 uint8_t id1 = bench_tm_func_register(res,
"odp_pktio_lookup()");
326 for (
int i = 0; i < repeat_count; i++) {
332 ODPH_ERR(
"Pktio lookup failed\n");
336 bench_tm_func_record(t2, t1, res, id1);
341 static int pktio_open_start_stop_close(bench_tm_result_t *res,
int repeat_count)
343 appl_args_t *appl_args = gbl_args;
351 uint8_t id1 = bench_tm_func_register(res,
"odp_pktio_open()");
352 uint8_t id2 = bench_tm_func_register(res,
"odp_pktin_queue_config()");
353 uint8_t id3 = bench_tm_func_register(res,
"odp_pktout_queue_config()");
354 uint8_t id4 = bench_tm_func_register(res,
"odp_pktio_start()");
355 uint8_t id5 = bench_tm_func_register(res,
"odp_pktio_stop()");
356 uint8_t id6 = bench_tm_func_register(res,
"odp_pktio_close()");
358 pool = create_packet_pool();
361 param.
in_mode = appl_args->opt.in_mode;
362 param.
out_mode = appl_args->opt.out_mode;
365 pktin_param.
num_queues = appl_args->opt.num_input_queues;
372 pktout_param.
num_queues = appl_args->opt.num_output_queues;
374 for (
int i = 0; i < repeat_count; i++) {
380 ODPH_ERR(
"Opening pktio failed\n");
388 ODPH_ERR(
"Configuring packet input queues failed: %d\n", ret);
396 ODPH_ERR(
"Configuring packet output queues failed: %d\n", ret);
404 ODPH_ERR(
"Starting pktio failed: %d\n", ret);
412 ODPH_ERR(
"Stopping pktio failed: %d\n", ret);
418 clean_pending_events();
424 ODPH_ERR(
"Closing pktio failed: %d\n", ret);
428 bench_tm_func_record(t2, t1, res, id1);
429 bench_tm_func_record(t3, t2, res, id2);
430 bench_tm_func_record(t4, t3, res, id3);
431 bench_tm_func_record(t5, t4, res, id4);
432 bench_tm_func_record(t6, t5, res, id5);
433 bench_tm_func_record(t8, t7, res, id6);
438 ODPH_ERR(
"Destroying pktio pool failed: %d\n", ret);
444 static int pktio_stats(bench_tm_result_t *res,
int repeat_count)
446 appl_args_t *appl_args = gbl_args;
451 uint8_t id1 = bench_tm_func_register(res,
"odp_pktio_stats()");
453 for (
int i = 0; i < repeat_count; i++) {
459 ODPH_ERR(
"Reading pktio stats failed\n");
463 bench_tm_func_record(t2, t1, res, id1);
468 static int pktio_stats_reset(bench_tm_result_t *res,
int repeat_count)
470 appl_args_t *appl_args = gbl_args;
474 int id1 = bench_tm_func_register(res,
"odp_pktio_stats_reset()");
476 for (
int i = 0; i < repeat_count; i++) {
482 ODPH_ERR(
"Resetting pktio stats failed\n");
486 bench_tm_func_record(t2, t1, res, id1);
491 static int pktin_queue_stats(bench_tm_result_t *res,
int repeat_count)
493 appl_args_t *appl_args = gbl_args;
499 uint8_t id1 = bench_tm_func_register(res,
"odp_pktin_queue_stats()");
503 ODPH_ERR(
"Reading pktio input queue failed\n");
507 for (
int i = 0; i < repeat_count; i++) {
513 ODPH_ERR(
"Reading pktio stats failed\n");
517 bench_tm_func_record(t2, t1, res, id1);
522 static int pktin_event_queue_stats(bench_tm_result_t *res,
int repeat_count)
524 appl_args_t *appl_args = gbl_args;
530 uint8_t id1 = bench_tm_func_register(res,
"odp_pktin_event_queue_stats()");
534 ODPH_ERR(
"Reading pktio input queue failed\n");
538 for (
int i = 0; i < repeat_count; i++) {
544 ODPH_ERR(
"Reading pktio stats failed\n");
548 bench_tm_func_record(t2, t1, res, id1);
553 static int pktout_queue_stats(bench_tm_result_t *res,
int repeat_count)
555 appl_args_t *appl_args = gbl_args;
561 uint8_t id1 = bench_tm_func_register(res,
"odp_pktout_queue_stats()");
565 ODPH_ERR(
"Reading pktio input queue failed\n");
569 for (
int i = 0; i < repeat_count; i++) {
575 ODPH_ERR(
"Reading pktio stats failed\n");
579 bench_tm_func_record(t2, t1, res, id1);
584 static int pktout_event_queue_stats(bench_tm_result_t *res,
int repeat_count)
586 appl_args_t *appl_args = gbl_args;
592 uint8_t id1 = bench_tm_func_register(res,
"odp_pktout_event_queue_stats()");
596 ODPH_ERR(
"Reading pktio input queue failed\n");
600 for (
int i = 0; i < repeat_count; i++) {
606 ODPH_ERR(
"Reading pktio stats failed\n");
610 bench_tm_func_record(t2, t1, res, id1);
634 static int check_cls_capa(
void)
636 appl_args_t *appl_args = gbl_args;
643 ODPH_ERR(
"Reading classifier capa failed: %d\n", ret);
649 ODPH_ERR(
"Reading scheduler capa failed: %d\n", ret);
653 if (!find_first_supported_l3_pmr(&cls_capa, &appl_args->cls_pmr_create.term)) {
654 ODPH_ERR(
"Implementations doesn't support any TCP/UDP PMRs\n");
659 if (appl_args->opt.num_pmr + 1 > cls_capa.
max_cos) {
660 ODPH_ERR(
"Not enough CoSes supported for PMR test: %u/%u\n",
661 appl_args->opt.num_pmr + 1, cls_capa.
max_cos);
665 if (appl_args->opt.num_pmr + 1 > sched_capa.
max_queues) {
666 ODPH_ERR(
"Not enough queues supported for PMR test: %u/%u\n",
667 appl_args->opt.num_pmr + 1, sched_capa.
max_queues);
671 appl_args->cls_pmr_create.enabled =
true;
676 static int check_cls_cond(
void)
678 return gbl_args->cls_pmr_create.enabled;
681 static int cls_pmr_create(bench_tm_result_t *res,
int repeat_count)
683 appl_args_t *appl_args = gbl_args;
689 uint32_t num_cos = appl_args->opt.num_pmr + 1;
690 uint32_t num_pmr = num_cos - 1;
691 uint32_t cos_created = 0;
692 uint32_t queue_created = 0;
694 uint16_t mask = 0xffff;
700 uint8_t id1 = bench_tm_func_register(res,
"odp_cls_pmr_create()");
701 uint8_t id2 = bench_tm_func_register(res,
"odp_cls_pmr_destroy()");
708 for (uint32_t i = 0; i < num_cos; i++) {
711 ODPH_ERR(
"odp_queue_create() failed %u / %u\n", i + 1, num_cos);
715 cos_param.
queue = queue[i];
720 ODPH_ERR(
"odp_cls_cos_create() failed %u / %u\n", i + 1, num_cos);
726 if (queue_created != num_cos)
727 ODPH_ERR(
"Unable to create all queues: %u/%u\n", queue_created, num_cos);
729 if (cos_created != num_cos) {
730 ODPH_ERR(
"Unable to create all CoSes: %u/%u\n", cos_created, num_cos);
734 default_cos = cos[0];
738 ODPH_ERR(
"Setting default CoS failed: %d\n", ret);
743 pmr_param.
term = appl_args->cls_pmr_create.term;
744 pmr_param.
match.value = &val;
745 pmr_param.
match.mask = &mask;
746 pmr_param.
val_sz =
sizeof(val);
748 for (uint32_t i = 0; i < (uint32_t)repeat_count; i++) {
749 uint32_t pmr_created = 0;
751 for (uint32_t j = 0; j < num_pmr; j++) {
758 bench_tm_func_record(t2, t1, res, id1);
764 for (uint32_t j = 0; j < pmr_created; j++) {
770 ODPH_ABORT(
"Destroying PMR failed: %d\n", ret);
772 bench_tm_func_record(t2, t1, res, id2);
776 ODPH_DBG(
"Created %u PMRs\n", pmr_created);
782 for (uint32_t i = 0; i < cos_created; i++)
785 for (uint32_t i = 0; i < queue_created; i++)
791 static int bench_pktio_sp_export(
void *data)
793 appl_args_t *gbl_args = data;
797 if (test_common_write(
"%s",
"Function name,Latency (nsec) per function call (min),"
798 "Latency (nsec) per function call (avg),"
799 "Latency (nsec) per function call (max)\n")) {
804 for (uint32_t i = 0; i < gbl_args->suite.num_bench; i++) {
805 for (
int j = 0; j < gbl_args->result[i].num; j++) {
806 num = gbl_args->result[i].func[j].num ? gbl_args->result[i].func[j].num : 1;
807 if (test_common_write(
"%s,%" PRIu64
",%" PRIu64
",%" PRIu64
"\n",
808 gbl_args->result[i].func[j].name,
819 test_common_write_term();
824 bench_tm_info_t test_suite[] = {
825 BENCH_INFO(pktio_capability, pktio_setup, pktio_clean, NULL, 0),
826 BENCH_INFO(pktio_lookup, pktio_setup, pktio_clean, NULL, 0),
827 BENCH_INFO(pktio_open_start_stop_close, NULL, NULL, NULL, 0),
828 BENCH_INFO(pktio_stats, pktio_setup, pktio_clean, NULL, 0),
829 BENCH_INFO(pktin_queue_stats, pktio_setup_direct_rx, pktio_clean_direct_rx, NULL, 0),
830 BENCH_INFO(pktin_event_queue_stats, pktio_setup_sched_rx, pktio_clean_sched_rx, NULL, 0),
831 BENCH_INFO(pktout_queue_stats, pktio_setup_direct_tx, pktio_clean, NULL, 0),
832 BENCH_INFO(pktout_event_queue_stats, pktio_setup_queue_tx, pktio_clean, NULL, 0),
833 BENCH_INFO(pktio_stats_reset, pktio_setup, pktio_clean, NULL, 0),
834 BENCH_INFO(cls_pmr_create, pktio_setup_cls, pktio_clean_sched_rx, check_cls_cond, 0)
838 "Result array is too small to hold all the results");
841 static void usage(
void)
844 "ODP pktio API slow path micro benchmarks\n"
847 " -i, --interface <name> Ethernet interface name (default loop).\n"
848 " -m, --in_mode <arg> Packet input mode\n"
849 " 0: Direct mode: PKTIN_MODE_DIRECT (default)\n"
850 " 1: Scheduler mode with parallel queues:\n"
851 " PKTIN_MODE_SCHED + SCHED_SYNC_PARALLEL\n"
852 " -o, --out_mode <arg> Packet output mode\n"
853 " 0: Direct mode: PKTOUT_MODE_DIRECT (default)\n"
854 " 1: Queue mode: PKTOUT_MODE_QUEUE\n"
855 " -p, --pmr <num> Number of PMRs to create/destroy per round (default 1)\n"
856 " -q, --rx_queues <num> Number of packet input queues (default 1)\n"
857 " -t, --tx_queues <num> Number of packet output queues (default 1)\n"
858 " -r, --rounds <num> Run each test case 'num' times (default %u).\n"
859 " -s, --select <idx> Run only selected test case.\n"
860 " -h, --help Display help and exit.\n\n"
864 static int parse_interface(appl_args_t *appl_args,
const char *optarg)
866 if (strlen(optarg) + 1 > MAX_NAME_LEN) {
867 ODPH_ERR(
"Unable to store interface name (MAX_NAME_LEN=%d)\n", MAX_NAME_LEN);
870 odph_strcpy(appl_args->opt.name, optarg, MAX_NAME_LEN);
875 static int parse_args(
int argc,
char *argv[])
879 static const struct option longopts[] = {
880 {
"interface", required_argument, NULL,
'i'},
881 {
"in_mode", required_argument, NULL,
'm'},
882 {
"out_mode", required_argument, NULL,
'o'},
883 {
"pmr", required_argument, NULL,
'p'},
884 {
"rx_queues", required_argument, NULL,
'q'},
885 {
"tx_queues", required_argument, NULL,
't'},
886 {
"rounds", required_argument, NULL,
'r'},
887 {
"select", required_argument, NULL,
's'},
888 {
"help", no_argument, NULL,
'h'},
892 static const char *shortopts =
"i:m:o:p:q:r:s:t:h";
894 odph_strcpy(gbl_args->opt.name,
"loop", MAX_NAME_LEN);
895 gbl_args->opt.rounds = ROUNDS;
898 gbl_args->opt.num_input_queues = 1;
899 gbl_args->opt.num_output_queues = 1;
900 gbl_args->opt.num_pmr = 1;
903 opt = getopt_long(argc, argv, shortopts, longopts, NULL);
910 if (parse_interface(gbl_args, optarg))
928 gbl_args->opt.num_pmr = atoi(optarg);
931 gbl_args->opt.num_input_queues = atoi(optarg);
934 gbl_args->opt.rounds = atoi(optarg);
937 gbl_args->opt.case_idx = atoi(optarg);
940 gbl_args->opt.num_output_queues = atoi(optarg);
946 ODPH_ERR(
"Bad option. Use -h for help.\n");
954 static int check_args(appl_args_t *appl_args)
962 if (gbl_args->opt.rounds < 1) {
963 ODPH_ERR(
"Invalid test repeat count: %u\n", gbl_args->opt.rounds);
967 if (gbl_args->opt.case_idx > ODPH_ARRAY_SIZE(test_suite)) {
968 ODPH_ERR(
"Invalid test case index: %u\n", gbl_args->opt.case_idx);
972 pool = create_packet_pool();
975 param.
in_mode = appl_args->opt.in_mode;
976 param.
out_mode = appl_args->opt.out_mode;
980 ODPH_ERR(
"Opening pktio failed\n");
986 ODPH_ERR(
"Reading pktio capa failed: %d\n", ret);
991 ODPH_ERR(
"Too many input queues: %u/%u\n", appl_args->opt.num_input_queues,
997 ODPH_ERR(
"Too many output queues: %u/%u\n", appl_args->opt.num_output_queues,
1004 ODPH_ERR(
"Closing pktio failed: %d\n", ret);
1010 ODPH_ERR(
"Destroying pktio pool failed: %d\n", ret);
1014 if (check_cls_capa() < 0)
1021 static void print_info(appl_args_t *appl_args)
1026 "odp_bench_pktio_sp options\n"
1027 "--------------------------\n");
1029 printf(
"CPU mask: %s\n", gbl_args->cpumask_str);
1030 printf(
"Interface: %s\n", gbl_args->opt.name);
1032 printf(
"Input mode: ");
1038 printf(
"Output mode: ");
1044 printf(
"Input queues: %u\n", gbl_args->opt.num_input_queues);
1045 printf(
"Output queues: %u\n", gbl_args->opt.num_output_queues);
1046 printf(
"PMRs: %u\n", gbl_args->opt.num_pmr);
1047 printf(
"Test rounds: %d\n", gbl_args->opt.rounds);
1051 int main(
int argc,
char *argv[])
1053 odph_helper_options_t helper_options;
1054 test_common_options_t common_options;
1055 odph_thread_t worker_thread;
1056 odph_thread_common_param_t thr_common;
1057 odph_thread_param_t thr_param;
1066 argc = odph_parse_options(argc, argv);
1067 if (odph_options(&helper_options)) {
1068 ODPH_ERR(
"Reading ODP helper options failed\n");
1072 argc = test_common_parse_options(argc, argv);
1073 if (test_common_options(&common_options)) {
1074 ODPH_ERR(
"Reading test options failed\n");
1079 init_param.
mem_model = helper_options.mem_model;
1083 ODPH_ERR(
"Global init failed\n");
1089 ODPH_ERR(
"Local init failed\n");
1095 ODPH_ERR(
"Schedule config failed: %d\n", ret);
1099 if (setup_sig_handler()) {
1100 ODPH_ERR(
"Signal handler setup failed\n");
1105 shm =
odp_shm_reserve(
"shm_args",
sizeof(appl_args_t), ODP_CACHE_LINE_SIZE, 0);
1107 ODPH_ERR(
"Shared mem reserve failed\n");
1112 if (gbl_args == NULL) {
1113 ODPH_ERR(
"Shared mem alloc failed\n");
1117 memset(gbl_args, 0,
sizeof(appl_args_t));
1120 ret = parse_args(argc, argv);
1124 if (check_args(gbl_args))
1127 bench_tm_suite_init(&gbl_args->suite);
1128 gbl_args->suite.bench = test_suite;
1129 gbl_args->suite.num_bench = ODPH_ARRAY_SIZE(test_suite);
1130 gbl_args->suite.rounds = gbl_args->opt.rounds;
1131 gbl_args->suite.bench_idx = gbl_args->opt.case_idx;
1132 if (common_options.is_export)
1133 gbl_args->suite.result = gbl_args->result;
1136 ODPH_ERR(
"Unable to allocate worker thread\n");
1142 sizeof(gbl_args->cpumask_str));
1144 print_info(gbl_args);
1146 memset(&worker_thread, 0,
sizeof(odph_thread_t));
1154 odph_thread_common_param_init(&thr_common);
1155 thr_common.instance = instance;
1156 thr_common.cpumask = &cpumask;
1157 thr_common.share_param = 1;
1159 odph_thread_param_init(&thr_param);
1160 thr_param.start = bench_tm_run;
1161 thr_param.arg = &gbl_args->suite;
1164 odph_thread_create(&worker_thread, &thr_common, &thr_param, 1);
1166 odph_thread_join(&worker_thread, 1);
1168 ret = gbl_args->suite.retval;
1170 if (ret == 0 && common_options.is_export) {
1171 if (bench_pktio_sp_export(gbl_args)) {
1172 ODPH_ERR(
"Error: Export failed\n");
1179 ODPH_ERR(
"Shared mem free failed\n");
1184 ODPH_ERR(
"Local term failed\n");
1189 ODPH_ERR(
"Global term failed\n");
1194 return EXIT_FAILURE;
1196 return EXIT_SUCCESS;
void odp_atomic_store_u32(odp_atomic_u32_t *atom, uint32_t val)
Store value to atomic uint32 variable.
int odp_cos_destroy(odp_cos_t cos)
Discard a class-of-service along with all its associated resources.
odp_pmr_t odp_cls_pmr_create(const odp_pmr_param_t *terms, int num_terms, odp_cos_t src_cos, odp_cos_t dst_cos)
Create Packet Matching Rule (PMR)
int odp_cls_capability(odp_cls_capability_t *capability)
Query classification capabilities.
odp_cls_pmr_term_t
Packet Matching Rule terms.
#define ODP_PMR_INVALID
Invalid packet matching rule handle.
int odp_cls_pmr_destroy(odp_pmr_t pmr)
Function to destroy a packet match rule.
#define ODP_COS_INVALID
Invalid class of service handle.
odp_cos_t odp_cls_cos_create(const char *name, const odp_cls_cos_param_t *param)
Create a class-of-service.
void odp_cls_cos_param_init(odp_cls_cos_param_t *param)
Initialize class of service parameters.
void odp_cls_pmr_param_init(odp_pmr_param_t *param)
Initialize packet matching rule parameters.
@ ODP_PMR_TCP_DPORT
Destination TCP port (val_sz = 2)
@ ODP_PMR_TCP_SPORT
Source TCP port (val_sz = 2)
@ ODP_PMR_UDP_SPORT
Source UDP port (val_sz = 2)
@ ODP_PMR_UDP_DPORT
Destination UDP port (val_sz = 2)
#define ODP_UNUSED
Intentionally unused variables of functions.
void odp_cpumask_set(odp_cpumask_t *mask, int cpu)
Add CPU to mask.
int odp_cpumask_default_worker(odp_cpumask_t *mask, int num)
Default CPU mask for worker threads.
int odp_cpumask_first(const odp_cpumask_t *mask)
Find first set CPU in mask.
void odp_cpumask_zero(odp_cpumask_t *mask)
Clear entire CPU mask.
int32_t odp_cpumask_to_str(const odp_cpumask_t *mask, char *str, int32_t size)
Format a string from CPU mask.
#define ODP_CPUMASK_STR_SIZE
The maximum number of characters needed to record any CPU mask as a string (output of odp_cpumask_to_...
void odp_event_free(odp_event_t event)
Free event.
#define ODP_EVENT_INVALID
Invalid event.
void odp_init_param_init(odp_init_t *param)
Initialize the odp_init_t to default values for all fields.
#define ODP_STATIC_ASSERT(cond, msg)
Compile time assertion macro.
int odp_init_local(odp_instance_t instance, odp_thread_type_t thr_type)
Thread local ODP initialization.
int odp_init_global(odp_instance_t *instance, const odp_init_t *params, const odp_platform_init_t *platform_params)
Global ODP initialization.
int odp_term_local(void)
Thread local ODP termination.
int odp_term_global(odp_instance_t instance)
Global ODP termination.
uint64_t odp_instance_t
ODP instance ID.
int odp_pktin_queue_stats(odp_pktin_queue_t queue, odp_pktin_queue_stats_t *stats)
Get statistics for direct packet input queue.
void odp_pktin_queue_param_init(odp_pktin_queue_param_t *param)
Initialize packet input queue parameters.
void odp_pktio_param_init(odp_pktio_param_t *param)
Initialize pktio params.
int odp_pktio_close(odp_pktio_t pktio)
Close a packet IO interface.
odp_pktio_t odp_pktio_lookup(const char *name)
Return a packet IO handle for an already open device.
int odp_pktout_queue(odp_pktio_t pktio, odp_pktout_queue_t queues[], int num)
Direct packet output queues.
odp_pktout_mode_t
Packet output mode.
int odp_pktin_event_queue(odp_pktio_t pktio, odp_queue_t queues[], int num)
Event queues for packet input.
odp_pktio_t odp_pktio_open(const char *name, odp_pool_t pool, const odp_pktio_param_t *param)
Open a packet IO interface.
int odp_pktin_event_queue_stats(odp_pktio_t pktio, odp_queue_t queue, odp_pktin_queue_stats_t *stats)
Get statistics for packet input event queue.
int odp_pktio_start(odp_pktio_t pktio)
Start packet receive and transmit.
#define ODP_PKTIO_INVALID
Invalid packet IO handle.
int odp_pktin_queue(odp_pktio_t pktio, odp_pktin_queue_t queues[], int num)
Direct packet input queues.
void odp_pktout_queue_param_init(odp_pktout_queue_param_t *param)
Initialize packet output queue parameters.
int odp_pktout_event_queue(odp_pktio_t pktio, odp_queue_t queues[], int num)
Event queues for packet output.
int odp_pktio_stop(odp_pktio_t pktio)
Stop packet receive and transmit.
int odp_pktio_capability(odp_pktio_t pktio, odp_pktio_capability_t *capa)
Query packet IO interface capabilities.
int odp_pktout_event_queue_stats(odp_pktio_t pktio, odp_queue_t queue, odp_pktout_queue_stats_t *stats)
Get statistics for packet output event queue.
int odp_pktout_queue_stats(odp_pktout_queue_t queue, odp_pktout_queue_stats_t *stats)
Get statistics for direct packet output queue.
int odp_pktio_stats(odp_pktio_t pktio, odp_pktio_stats_t *stats)
Get statistics for pktio handle.
int odp_pktio_default_cos_set(odp_pktio_t pktio, odp_cos_t default_cos)
Setup per-port default class-of-service.
int odp_pktio_stats_reset(odp_pktio_t pktio)
Reset statistics for pktio handle.
odp_pktin_mode_t
Packet input mode.
int odp_pktin_queue_config(odp_pktio_t pktio, const odp_pktin_queue_param_t *param)
Configure packet input queues.
int odp_pktout_queue_config(odp_pktio_t pktio, const odp_pktout_queue_param_t *param)
Configure packet output queues.
@ ODP_PKTOUT_MODE_DIRECT
Direct packet output on the interface.
@ ODP_PKTOUT_MODE_QUEUE
Packet output through event queues.
@ ODP_PKTIN_MODE_DIRECT
Direct packet input from the interface.
@ ODP_PKTIN_MODE_SCHED
Packet input through scheduler and scheduled event queues.
odp_pool_t odp_pool_create(const char *name, const odp_pool_param_t *param)
Create a pool.
int odp_pool_capability(odp_pool_capability_t *capa)
Query pool capabilities.
void odp_pool_param_init(odp_pool_param_t *param)
Initialize pool params.
int odp_pool_destroy(odp_pool_t pool)
Destroy a pool previously created by odp_pool_create()
#define ODP_POOL_INVALID
Invalid pool.
@ ODP_POOL_PACKET
Packet pool.
void odp_queue_param_init(odp_queue_param_t *param)
Initialize queue params.
#define ODP_QUEUE_INVALID
Invalid queue.
odp_queue_t odp_queue_create(const char *name, const odp_queue_param_t *param)
Queue create.
int odp_queue_destroy(odp_queue_t queue)
Destroy ODP queue.
@ ODP_QUEUE_TYPE_SCHED
Scheduled queue.
int odp_schedule_config(const odp_schedule_config_t *config)
Global schedule configuration.
uint64_t odp_schedule_wait_time(uint64_t ns)
Schedule wait time.
int odp_schedule_capability(odp_schedule_capability_t *capa)
Query scheduler capabilities.
odp_event_t odp_schedule(odp_queue_t *from, uint64_t wait)
Schedule an event.
int odp_shm_free(odp_shm_t shm)
Free a contiguous block of shared memory.
#define ODP_SHM_INVALID
Invalid shared memory block.
void * odp_shm_addr(odp_shm_t shm)
Shared memory block address.
odp_shm_t odp_shm_reserve(const char *name, uint64_t size, uint64_t align, uint32_t flags)
Reserve a contiguous block of shared memory.
bool odp_bool_t
Boolean type.
void odp_sys_info_print(void)
Print system info.
@ ODP_THREAD_WORKER
Worker thread.
@ ODP_THREAD_CONTROL
Control thread.
uint64_t odp_time_to_ns(odp_time_t time)
Convert time to nanoseconds.
#define ODP_TIME_MSEC_IN_NS
A millisecond in nanoseconds.
odp_time_t odp_time_local_strict(void)
Current local time (strict)
Dummy type for strong typing.
Classification capabilities This capability structure defines system level classification capability.
odp_cls_pmr_terms_t supported_terms
PMR terms supported by the classifier.
uint32_t max_cos
Maximum number of CoS supported.
Class of service parameters Used to communicate class of service creation options.
odp_queue_t queue
Mapping used when num_queue = 1, hashing is disabled in this case and application has to configure th...
Global initialization parameters.
odp_mem_model_t mem_model
Application memory model.
Packet input queue parameters.
uint32_t num_queues
Number of input queues to be created.
odp_pktin_hash_proto_t hash_proto
Protocol field selection for hashing.
odp_bool_t hash_enable
Enable flow hashing.
odp_bool_t classifier_enable
Enable classifier.
Packet IO input queue specific statistics counters.
uint32_t max_input_queues
Maximum number of input queues.
uint32_t max_output_queues
Maximum number of output queues.
odp_pktin_mode_t in_mode
Packet input mode.
odp_pktout_mode_t out_mode
Packet output mode.
Packet IO statistics counters.
Packet output queue parameters.
uint32_t num_queues
Number of output queues to be created.
Packet IO output queue specific statistics counters.
Packet Matching Rule parameter structure.
uint32_t val_sz
Size of the value to be matched.
struct odp_pmr_param_t::@8::@10 match
Parameters for single-valued matches.
odp_cls_pmr_term_t term
Packet Matching Rule term.
struct odp_pool_capability_t::@122 pkt
Packet pool capabilities
uint32_t max_num
Maximum number of buffers of any size.
uint32_t max_len
Maximum packet data length in bytes.
uint32_t num
Number of buffers in the pool.
odp_pool_type_t type
Pool type.
uint32_t len
Minimum length of 'num' packets.
struct odp_pool_param_t::@126 pkt
Parameters for packet pools.
odp_queue_type_t type
Queue type.
uint32_t max_queues
Maximum number of scheduled (ODP_BLOCKING) queues of the default size.
uint64_t udp_dport
Destination UDP port, implies IPPROTO=17.
uint64_t tcp_dport
Destination TCP port implies IPPROTO=6.
uint64_t udp_sport
Source UDP Port.
uint64_t tcp_sport
Source TCP port.
struct odp_cls_pmr_terms_t::@7 bit
Packet Matching Rule term fields.
uint32_t ipv4_udp
IPv4 addresses and UDP port numbers.
struct odp_pktin_hash_proto_t::@99 proto
Protocol header fields for hashing.