### Setup Packet I/O Interface (C) Source: https://context7.com/opendataplane/odp-dpdk/llms.txt Initializes and configures a packet I/O interface for network communication. Supports direct polling, queue-based, and scheduler-integrated modes. It opens the specified device, configures input and output queues based on the chosen mode, and starts the interface. Error handling is included for failed operations. ```c #include odp_pktio_t setup_pktio(const char *dev_name, odp_pool_t pool, int mode) { odp_pktio_t pktio; odp_pktio_param_t pktio_param; odp_pktin_queue_param_t pktin_param; odp_pktout_queue_param_t pktout_param; odp_pktio_capability_t capa; /* Initialize pktio parameters */ odp_pktio_param_init(&pktio_param); /* Select input mode */ switch (mode) { case 0: /* Direct polling mode */ pktio_param.in_mode = ODP_PKTIN_MODE_DIRECT; pktio_param.out_mode = ODP_PKTOUT_MODE_DIRECT; break; case 1: /* Queue mode */ pktio_param.in_mode = ODP_PKTIN_MODE_QUEUE; pktio_param.out_mode = ODP_PKTOUT_MODE_QUEUE; break; case 2: /* Scheduler mode */ pktio_param.in_mode = ODP_PKTIN_MODE_SCHED; pktio_param.out_mode = ODP_PKTOUT_MODE_DIRECT; break; } /* Open packet I/O interface */ pktio = odp_pktio_open(dev_name, pool, &pktio_param); if (pktio == ODP_PKTIO_INVALID) { printf("Failed to open pktio: %s\n", dev_name); return ODP_PKTIO_INVALID; } /* Query capabilities */ if (odp_pktio_capability(pktio, &capa) == 0) { printf("PktIO capabilities: max_input_queues=%u, max_output_queues=%u\n", capa.max_input_queues, capa.max_output_queues); } /* Configure input queues */ odp_pktin_queue_param_init(&pktin_param); pktin_param.num_queues = 1; pktin_param.hash_enable = 0; if (mode == 2) { /* Scheduler mode */ pktin_param.queue_param.sched.sync = ODP_SCHED_SYNC_ATOMIC; pktin_param.queue_param.sched.prio = odp_schedule_default_prio(); pktin_param.queue_param.sched.group = ODP_SCHED_GROUP_ALL; } if (odp_pktin_queue_config(pktio, &pktin_param)) { printf("Failed to configure pktin queues\n"); odp_pktio_close(pktio); return ODP_PKTIO_INVALID; } /* Configure output queues */ odp_pktout_queue_param_init(&pktout_param); pktout_param.num_queues = 1; if (odp_pktout_queue_config(pktio, &pktout_param)) { printf("Failed to configure pktout queues\n"); odp_pktio_close(pktio); return ODP_PKTIO_INVALID; } /* Start packet I/O */ if (odp_pktio_start(pktio)) { printf("Failed to start pktio\n"); odp_pktio_close(pktio); return ODP_PKTIO_INVALID; } printf("PktIO '%s' started successfully (index %d)\n", dev_name, odp_pktio_index(pktio)); return pktio; } ``` -------------------------------- ### Define Test Wrapper using LOG_COMPILER in Makefile.am Source: https://github.com/opendataplane/odp-dpdk/blob/master/doc/implementers-guide/implementers-guide.adoc This example demonstrates how to define a custom wrapper script for tests using the `LOG_COMPILER` variable in a `Makefile.am` file. This allows a single wrapper script to be applied to multiple tests, with the test name passed as an argument. This is useful for common setup or cleanup tasks. ```makefile if test_vald LOG_COMPILER = $(top_srcdir)/platform/linux-generic/test/wrapper-script TESTS = pktio/pktio_run \ ... ``` -------------------------------- ### Explore Model Information with Bash Source: https://github.com/opendataplane/odp-dpdk/blob/master/platform/linux-generic/example/ml/README.md Prints basic information about a given ONNX model, such as its name, version, inputs, and outputs. This example uses the 'model_explorer' executable. ```bash $ ./model_explorer simple_linear.onnx . . . Model info ---------- Model handle: 0x7fe8426ce1d8 Name: model-explorer Model version: 1 Model interface version: 0 Index: 0 Number of inputs: 1 Input[0]: Name: x, Data_type: int32, Shape: static [1], Size: 4 Number of outputs: 1 Output[0]: Name: y, Data_type: int32, Shape: static [1], Size: 4 . . . ``` -------------------------------- ### Run Simple Linear Inference with Bash Source: https://github.com/opendataplane/odp-dpdk/blob/master/platform/linux-generic/example/ml/README.md Executes the simple linear model for inference. It can accept a single integer or a list of integers as input for 'x'. ```bash $ ./simple_linear 3 . . . y = 3 * 3 + 4: 13 . ``` ```bash $ ./simple_linear [2,4,5] . . . y = 3 * 2 + 4: 10 y = 3 * 5 + 4: 19 y = 3 * 4 + 4: 16 . ``` -------------------------------- ### ODP DPDK Event Scheduler Example Source: https://context7.com/opendataplane/odp-dpdk/llms.txt Demonstrates how to use the ODP scheduler for event distribution and load balancing. It covers querying capabilities, configuration, setting wait times, and processing different event types like packets and timeouts. It also shows how to pause, drain, and resume scheduling. ```c #include void scheduler_example(volatile int *stop) { odp_schedule_capability_t sched_capa; odp_schedule_config_t sched_config; odp_event_t events[16]; odp_queue_t src_queue; uint64_t wait_time; int num_events; /* Query scheduler capabilities */ if (odp_schedule_capability(&sched_capa)) { printf("Scheduler capability query failed\n"); return; } printf("Scheduler: max_queues=%u, max_groups=%u\n", sched_capa.max_queues, sched_capa.max_groups); /* Initialize and configure scheduler */ odp_schedule_config_init(&sched_config); sched_config.num_queues = 64; sched_config.queue_size = 256; if (odp_schedule_config(&sched_config)) { printf("Scheduler configuration failed\n"); return; } /* Set wait time for schedule calls */ wait_time = odp_schedule_wait_time(100 * ODP_TIME_MSEC_IN_NS); printf("Priority levels: min=%d, max=%d, default=%d\n", odp_schedule_min_prio(), odp_schedule_max_prio(), odp_schedule_default_prio()); /* Main scheduling loop */ while (!*stop) { /* Wait indefinitely for a single event */ odp_event_t ev = odp_schedule(&src_queue, ODP_SCHED_WAIT); if (ev == ODP_EVENT_INVALID) continue; /* Process based on event type */ switch (odp_event_type(ev)) { case ODP_EVENT_PACKET: { odp_packet_t pkt = odp_packet_from_event(ev); /* Process packet... */ odp_packet_free(pkt); break; } case ODP_EVENT_TIMEOUT: { odp_timeout_t tmo = odp_timeout_from_event(ev); /* Handle timeout... */ odp_timeout_free(tmo); break; } default: odp_event_free(ev); break; } /* For atomic queues, release context early if done with critical section */ odp_schedule_release_atomic(); } /* Pause scheduling before exit */ odp_schedule_pause(); /* Drain remaining pre-scheduled events */ while (1) { odp_event_t ev = odp_schedule(&src_queue, ODP_SCHED_NO_WAIT); if (ev == ODP_EVENT_INVALID) break; odp_event_free(ev); } odp_schedule_resume(); } ``` -------------------------------- ### Variable Declaration Example in C Source: https://github.com/opendataplane/odp-dpdk/blob/master/doc/application-api-guide/api_guide_lines.dox Demonstrates the standard practice of declaring variables at the beginning of their respective scopes in C programming. This includes global, function, and block scopes. ```c int start_of_global_scope; main () { int start_of_function_scope; ... if (foo == bar) { int start_of_block_scope; ... } } ``` -------------------------------- ### ODP DPDK Bulk Scheduling Example Source: https://context7.com/opendataplane/odp-dpdk/llms.txt Illustrates how to perform bulk scheduling for higher throughput using the ODP scheduler. This function retrieves multiple events at once and processes them in a loop, freeing them after processing. ```c /* Bulk scheduling for higher throughput */ void bulk_schedule_loop(volatile int *stop) { odp_event_t events[32]; odp_queue_t src_queue; int num; while (!*stop) { num = odp_schedule_multi(&src_queue, ODP_SCHED_WAIT, events, 32); for (int i = 0; i < num; i++) { /* Process events */ odp_event_free(events[i]); } } } ``` -------------------------------- ### ODP Application Initialization, Pool Creation, and Event Processing (C) Source: https://context7.com/opendataplane/odp-dpdk/llms.txt This C code demonstrates a minimal ODP application. It initializes the ODP instance, creates a packet pool, allocates and frees a packet, configures the scheduler, and performs global and local termination. It requires the ODP library to be installed. ```c #include #include #include int main(int argc, char *argv[]) { odp_instance_t instance; odp_pool_t pool; odp_pool_param_t params; odp_packet_t pkt; int ret = 0; /* Global initialization */ if (odp_init_global(&instance, NULL, NULL)) { printf("Global init failed\n"); return -1; } /* Thread-local initialization */ if (odp_init_local(instance, ODP_THREAD_CONTROL)) { printf("Local init failed\n"); odp_term_global(instance); return -1; } /* Print version info */ printf("ODP %s (%s)\n", odp_version_api_str(), odp_version_impl_name()); printf("Running on CPU %d\n", odp_cpu_id()); /* Create packet pool */ odp_pool_param_init(¶ms); params.type = ODP_POOL_PACKET; params.pkt.num = 64; params.pkt.len = 1500; params.pkt.seg_len = 1500; pool = odp_pool_create("main_pool", ¶ms); if (pool == ODP_POOL_INVALID) { printf("Pool creation failed\n"); ret = -1; goto cleanup; } /* Allocate and use a packet */ pkt = odp_packet_alloc(pool, 100); if (pkt != ODP_PACKET_INVALID) { uint8_t *data = odp_packet_data(pkt); memset(data, 0x55, odp_packet_len(pkt)); printf("Packet allocated: len=%u, headroom=%u, tailroom=%u\n", odp_packet_len(pkt), odp_packet_headroom(pkt), odp_packet_tailroom(pkt)); odp_packet_free(pkt); } /* Configure and test scheduler */ odp_schedule_config(NULL); printf("Scheduler configured: priorities %d to %d\n", odp_schedule_min_prio(), odp_schedule_max_prio()); /* Destroy pool */ odp_pool_destroy(pool); cleanup: /* Thread-local termination */ if (odp_term_local()) { printf("Local termination failed\n"); ret = -1; } /* Global termination */ if (odp_term_global(instance)) { printf("Global termination failed\n"); ret = -1; } return ret; } ``` -------------------------------- ### Update Struct Initialization Function (C) Source: https://github.com/opendataplane/odp-dpdk/blob/master/doc/process-guide/release-guide.adoc Provides an example of updating a struct initialization function to accommodate changes in the struct definition. The `odp_foo_param_init` function is shown to be updated to initialize the new `number_of_control` member, ensuring that the struct is correctly initialized with the latest member values. ```c void odp_foo_param_init(foo_init_t param) { ... param->number_of_control = 20; } ``` -------------------------------- ### C: Setup and Manage Memory Pools Source: https://context7.com/opendataplane/odp-dpdk/llms.txt Demonstrates how to create and manage different types of memory pools (packet, buffer, timeout) using ODP API. It includes querying capabilities, initializing parameters, creating pools, retrieving pool information, and cleaning up by destroying pools. Errors during creation or capability queries are handled. ```c #include int setup_pools(void) { odp_pool_t pkt_pool, buf_pool, tmo_pool; odp_pool_param_t pool_params; odp_pool_capability_t capa; odp_pool_info_t info; /* Query pool capabilities */ if (odp_pool_capability(&capa)) { printf("Pool capability query failed\n"); return -1; } printf("Max packet pools: %u, max buffers per pool: %u\n", capa.pkt.max_pools, capa.pkt.max_num); /* Create a packet pool */ odp_pool_param_init(&pool_params); pool_params.type = ODP_POOL_PACKET; pool_params.pkt.num = 1024; /* Number of packets */ pool_params.pkt.len = 1856; /* Max packet data length */ pool_params.pkt.seg_len = 1856; /* Segment length */ pool_params.pkt.headroom = 128; /* Headroom per packet */ pkt_pool = odp_pool_create("packet_pool", &pool_params); if (pkt_pool == ODP_POOL_INVALID) { printf("Packet pool creation failed\n"); return -1; } /* Create a buffer pool for generic data */ odp_pool_param_init(&pool_params); pool_params.type = ODP_POOL_BUFFER; pool_params.buf.num = 512; pool_params.buf.size = 256; pool_params.buf.align = ODP_CACHE_LINE_SIZE; buf_pool = odp_pool_create("buffer_pool", &pool_params); if (buf_pool == ODP_POOL_INVALID) { printf("Buffer pool creation failed\n"); odp_pool_destroy(pkt_pool); return -1; } /* Create a timeout pool for timers */ odp_pool_param_init(&pool_params); pool_params.type = ODP_POOL_TIMEOUT; pool_params.tmo.num = 100; tmo_pool = odp_pool_create("timeout_pool", &pool_params); if (tmo_pool == ODP_POOL_INVALID) { printf("Timeout pool creation failed\n"); odp_pool_destroy(buf_pool); odp_pool_destroy(pkt_pool); return -1; } /* Get pool information */ if (odp_pool_info(pkt_pool, &info) == 0) { printf("Pool '%s' created with %u packets\n", info.name, info.params.pkt.num); } /* Print debug info about all pools */ odp_pool_print_all(); /* Cleanup */ odp_pool_destroy(tmo_pool); odp_pool_destroy(buf_pool); odp_pool_destroy(pkt_pool); return 0; } ``` -------------------------------- ### Create and Operate on PLAIN Queues in ODP Source: https://github.com/opendataplane/odp-dpdk/blob/master/doc/users-guide/users-guide.adoc Demonstrates the creation and basic operations of PLAIN queues in ODP. PLAIN queues require explicit application management for dequeuing and enqueuing events. ```c odp_queue_param_t qp; odp_queue_param_init(&qp); qp.type = ODP_QUEUE_TYPE_PLAIN; odp_queue_t plain_q1 = odp_queue_create("poll queue 1", &qp); odp_queue_t plain_q2 = odp_queue_create("poll queue 2", &qp); ... odp_event_t ev = odp_queue_deq(plain_q1); ...do something int rc = odp_queue_enq(plain_q2, ev); ``` -------------------------------- ### Run Convolution Inference with Bash Source: https://github.com/opendataplane/odp-dpdk/blob/master/platform/linux-generic/example/ml/README.md Runs inference using the generated convolution model. The model accepts a two-element vector and outputs the elements multiplied by 2. This example uses the 'odp_ml_conv.sh' script. ```bash $ ./odp_ml_conv.sh . . . Output matches reference ``` -------------------------------- ### Initialize ODP Global Instance (C) Source: https://github.com/opendataplane/odp-dpdk/blob/master/doc/users-guide/users-guide.adoc Initializes the ODP API framework globally. This function must be called before any other ODP API. It takes platform-independent and platform-specific initialization parameters. Both parameters are optional and can be NULL to use default values. ```c int odp_init_global(odp_instance_t *instance, const odp_init_t *param, const odp_platform_init_t *platform_param); ``` -------------------------------- ### Generate Convolution Model using Python Source: https://github.com/opendataplane/odp-dpdk/blob/master/platform/linux-generic/example/ml/README.md Generates a convolution model that multiplies each element of a two-element vector by 2. This script requires python3 and the 'onnx' module. ```bash python3 /platform/linux-generic/example/ml/conv_gen.py ``` -------------------------------- ### Generate Simple Linear Model using Python Source: https://github.com/opendataplane/odp-dpdk/blob/master/platform/linux-generic/example/ml/README.md Generates a simple linear model of the form y = 3 * x + 4. This script requires python3 and the 'onnx' module. ```bash python3 /platform/linux-generic/test/validation/api/ml/simple_linear_gen.py ``` -------------------------------- ### Build Commands for ODP Application (Shell) Source: https://context7.com/opendataplane/odp-dpdk/llms.txt These shell commands show how to compile the ODP application. The first command uses the generic Linux backend, while the second uses the DPDK backend. Both require the `pkg-config` tool and the corresponding ODP library development files. ```shell gcc -o odp_app main.c $(pkg-config --cflags --libs libodp-linux) Or with DPDK backend: gcc -o odp_app main.c $(pkg-config --cflags --libs libodp-dpdk) ``` -------------------------------- ### ODP API Scheduler Usage Sequence (C) Source: https://github.com/opendataplane/odp-dpdk/blob/master/doc/users-guide/users-guide.adoc Illustrates the standard sequence of ODP API calls for applications interacting with the scheduler. This includes querying capabilities, initializing configuration, applying configuration, and scheduling events. ```c odp_schedule_capability() odp_schedule_config_init() odp_schedule_config() odp_schedule() ``` -------------------------------- ### Create Packet Reference with Header Packet (C) Source: https://github.com/opendataplane/odp-dpdk/blob/master/doc/users-guide/users-guide-packet.adoc Creates a new packet reference by prefixing a header packet to a base packet. This allows for unique headers to be associated with each reference from the start. Dependencies: ODP library. ```c ref_pkt = odp_packet_ref_pkt(pkt, offset, hdr_pkt); ``` -------------------------------- ### Create Packet References with Different Offsets (C) Source: https://github.com/opendataplane/odp-dpdk/blob/master/doc/users-guide/users-guide-packet.adoc Demonstrates creating multiple packet references from a single base packet, each with a distinct offset and header packet. This allows for flexible data segmentation and unique header application. Dependencies: ODP library. ```c ref_pkt1 = odp_packet_ref_pkt(pkt, offset1, hdr_pkt1); ref_pkt2 = odp_packet_ref_pkt(pkt, offset2, hdr_pkt2); ``` -------------------------------- ### ODP Global Initialization (C) Source: https://github.com/opendataplane/odp-dpdk/blob/master/platform/linux-generic/doc/platform_specific.dox Initializes the ODP global environment. This function supports multiple ODP instances but imposes restrictions: each instance must run in a separate process, and instantiation processes cannot be descendants of each other. It takes a pointer to an instance identifier, initialization parameters, and platform-specific initialization parameters. ```c odp_instance_t *instance, const odp_init_t *params, const odp_platform_init_t *platform_params) ``` -------------------------------- ### Retrieve Crypto Operation Result in C Source: https://github.com/opendataplane/odp-dpdk/blob/master/doc/users-guide/users-guide-crypto.adoc Explains how to retrieve the results of a cryptographic operation in ODP. The `odp_crypto_result` function is used to get the status of cipher and authentication operations performed on a packet. ```c odp_packet_t crypto_packet; // ... obtain crypto_packet from async event or sync op ... odp_crypto_packet_result_t result; odp_crypto_result(crypto_packet, &result); if (result.cipher.status != ODP_CRYPTO_OP_SUCCESS) { // Handle cipher error } if (result.auth.status != ODP_CRYPTO_OP_SUCCESS) { // Handle auth error } ``` -------------------------------- ### ODP Deprecation Macro Example Source: https://github.com/opendataplane/odp-dpdk/blob/master/doc/application-api-guide/api_guide_lines.dox Illustrates the use of the ODP_DEPRECATE() macro to mark APIs as deprecated in the public API. Deprecated APIs remain for two major version cycles before removal. ```c #ODP_DEPRECATE() ``` -------------------------------- ### Create and Use ODP DPDK Queues (C) Source: https://context7.com/opendataplane/odp-dpdk/llms.txt This C code snippet demonstrates the creation and usage of both plain and scheduled queues within the ODP DPDK framework. It covers querying queue capabilities, creating buffer pools, initializing queue parameters, enqueuing and dequeuing events, and cleaning up resources. It highlights the differences in dequeueing from plain queues versus scheduled queues. ```c #include int queue_example(void) { odp_queue_t plain_queue, sched_queue; odp_queue_param_t queue_param; odp_queue_capability_t capa; odp_event_t ev; odp_buffer_t buf; odp_pool_t pool; odp_pool_param_t pool_param; /* Query queue capabilities */ if (odp_queue_capability(&capa)) { printf("Queue capability query failed\n"); return -1; } printf("Max queues: plain=%u, sched=%u\n", capa.plain.max_num, capa.sched.max_num); /* Create buffer pool for events */ odp_pool_param_init(&pool_param); pool_param.type = ODP_POOL_BUFFER; pool_param.buf.num = 64; pool_param.buf.size = 64; pool = odp_pool_create("event_pool", &pool_param); /* Create a plain queue (direct dequeue) */ odp_queue_param_init(&queue_param); queue_param.type = ODP_QUEUE_TYPE_PLAIN; queue_param.enq_mode = ODP_QUEUE_OP_MT; /* Multi-threaded safe */ queue_param.deq_mode = ODP_QUEUE_OP_MT; plain_queue = odp_queue_create("plain_queue", &queue_param); if (plain_queue == ODP_QUEUE_INVALID) { printf("Plain queue creation failed\n"); return -1; } /* Create a scheduled queue (atomic synchronization) */ odp_queue_param_init(&queue_param); queue_param.type = ODP_QUEUE_TYPE_SCHED; queue_param.sched.prio = odp_schedule_default_prio(); queue_param.sched.sync = ODP_SCHED_SYNC_ATOMIC; queue_param.sched.group = ODP_SCHED_GROUP_ALL; sched_queue = odp_queue_create("sched_queue", &queue_param); if (sched_queue == ODP_QUEUE_INVALID) { printf("Scheduled queue creation failed\n"); odp_queue_destroy(plain_queue); return -1; } /* Enqueue an event to plain queue */ buf = odp_buffer_alloc(pool); if (buf != ODP_BUFFER_INVALID) { ev = odp_buffer_to_event(buf); if (odp_queue_enq(plain_queue, ev) == 0) { printf("Event enqueued to plain queue\n"); } } /* Dequeue from plain queue */ ev = odp_queue_deq(plain_queue); if (ev != ODP_EVENT_INVALID) { printf("Event dequeued from plain queue\n"); odp_event_free(ev); } /* For scheduled queues, use odp_schedule() instead of odp_queue_deq() */ buf = odp_buffer_alloc(pool); if (buf != ODP_BUFFER_INVALID) { ev = odp_buffer_to_event(buf); odp_queue_enq(sched_queue, ev); } /* Cleanup */ odp_queue_destroy(sched_queue); odp_queue_destroy(plain_queue); odp_pool_destroy(pool); return 0; } ``` -------------------------------- ### Run MNIST Digit Prediction with Bash Source: https://github.com/opendataplane/odp-dpdk/blob/master/platform/linux-generic/example/ml/README.md Predicts a handwritten digit from an image using a pre-trained ONNX model. Requires the ONNX model file and a CSV file containing input image data. ```bash $ ./mnist mnist-12.onnx example_digit.csv . . . predicted_digit: 4, expected_digit: 4 . ``` -------------------------------- ### Initialize ODP Framework Globally and Locally (C) Source: https://context7.com/opendataplane/odp-dpdk/llms.txt Initializes the OpenDataPlane (ODP) framework globally and for the current thread. This is a prerequisite for all other ODP API calls. It configures parameters like worker and control thread counts, memory model, and prints version information. Proper termination is also demonstrated. ```c #include #include int main(int argc, char *argv[]) { odp_instance_t instance; odp_init_t init_params; /* Initialize parameters with defaults */ odp_init_param_init(&init_params); /* Optional: Configure thread limits */ init_params.num_worker = 4; init_params.num_control = 1; init_params.mem_model = ODP_MEM_MODEL_THREAD; /* Global initialization */ if (odp_init_global(&instance, &init_params, NULL)) { printf("Global init failed\n"); return -1; } /* Thread-local initialization (required for each thread) */ if (odp_init_local(instance, ODP_THREAD_CONTROL)) { printf("Local init failed\n"); return -1; } printf("ODP initialized - API version: %s\n", odp_version_api_str()); printf("Implementation: %s\n", odp_version_impl_name()); printf("Running on CPU %d, thread ID %d\n", odp_cpu_id(), odp_thread_id()); /* Application logic here... */ /* Cleanup: Thread-local termination */ if (odp_term_local()) { printf("Local termination failed\n"); return -1; } /* Global termination */ if (odp_term_global(instance)) { printf("Global termination failed\n"); return -1; } return 0; } /* Expected output: ODP initialized - API version: 1.48.0 Implementation: odp-linux Running on CPU 0, thread ID 0 */ ``` -------------------------------- ### Create and Operate on SCHED Queues in ODP Source: https://github.com/opendataplane/odp-dpdk/blob/master/doc/users-guide/users-guide.adoc Illustrates the creation of SCHED queues, which leverage the ODP scheduler for automatic dispatching. Events are scheduled and processed without direct application intervention for dequeueing. ```c odp_queue_param_t qp; odp_queue_param_init(&qp); qp.type = ODP_QUEUE_TYPE_SCHED; qp.sched.group = ODP_SCHED_GROUP_WORKER; qp.sched.prio = odp_schedule_max_prio(); qp.sched.sync = ODP_SCHED_SYNC_PARALLEL; odp_queue_t sched_q1 = odp_queue_create("sched queue 1", &qp); ...thread init processing while (1) { odp_event_t ev; odp_queue_t src_q; ev = odp_schedule(&src_q, ODP_SCHED_WAIT); ...process the event } ``` -------------------------------- ### Get Compression Operation Metadata (C) Source: https://github.com/opendataplane/odp-dpdk/blob/master/doc/users-guide/users-guide-comp.adoc Retrieves the metadata (odp_comp_packet_result_t) associated with a packet that was processed by an asynchronous compression operation. This metadata contains details about the compression result, such as data lengths and status. ```c odp_comp_packet_result_t odp_comp_result(odp_packet_t pkt); ``` -------------------------------- ### Get ODP API Version String Source: https://github.com/opendataplane/odp-dpdk/blob/master/doc/application-api-guide/release.dox Retrieves the ODP API version string, which follows a three-digit release number format (generation.major.minor). This function is used to identify the API source compatibility. ```c const char *odp_version_api_str(void); ```