![]() |
EM-ODP 4.4.0
Event Machine on ODP
|
Data Structures | |
| struct | em_queue_conf_t |
| struct | em_output_queue_conf_t |
| struct | em_queue_aggr_conf_t |
| struct | em_queue_param_t |
| struct | em_queue_aggr_info_t |
Typedefs | |
| typedef uint32_t | em_queue_type_t |
| typedef enum em_queue_type_e | em_queue_type_e |
| typedef uint32_t | em_queue_prio_t |
| typedef enum em_queue_prio_e | em_queue_prio_e |
| typedef uint32_t | em_queue_flag_t |
| typedef int(* | em_output_func_t) (const em_event_t events[], const unsigned int num, const em_queue_t output_queue, void *output_fn_args) |
Enumerations | |
| enum | em_queue_type_e { EM_QUEUE_TYPE_UNDEF = 0 , EM_QUEUE_TYPE_ATOMIC = 1 , EM_QUEUE_TYPE_PARALLEL = 2 , EM_QUEUE_TYPE_ORDERED = 3 , EM_QUEUE_TYPE_PARALLEL_ORDERED = EM_QUEUE_TYPE_ORDERED , EM_QUEUE_TYPE_UNSCHEDULED = 4 , EM_QUEUE_TYPE_AGGR = 5 , EM_QUEUE_TYPE_LOCAL = 6 , EM_QUEUE_TYPE_OUTPUT = 7 } |
| enum | em_queue_prio_e { EM_QUEUE_PRIO_LOWEST = 0 , EM_QUEUE_PRIO_LOW = 2 , EM_QUEUE_PRIO_NORMAL = 4 , EM_QUEUE_PRIO_HIGH = 6 , EM_QUEUE_PRIO_HIGHEST = 7 } |
Functions | |
| em_queue_t | em_queue_create (const char *name, em_queue_type_t type, em_queue_prio_t prio, em_queue_group_t group, const em_queue_conf_t *conf) |
| em_status_t | em_queue_create_static (const char *name, em_queue_type_t type, em_queue_prio_t prio, em_queue_group_t group, em_queue_t queue, const em_queue_conf_t *conf) |
| void | em_queue_aggr_conf_init (uint32_t num_aggr, em_queue_aggr_conf_t aggr_conf[]) |
| void | em_queue_param_init (em_queue_param_t *param) |
| em_queue_t | em_queue_create_param (const char *name, const em_queue_param_t *param) |
| em_status_t | em_queue_delete (em_queue_t queue) |
| em_status_t | em_queue_set_context (em_queue_t queue, const void *context) |
| void * | em_queue_context (em_queue_t queue) |
| size_t | em_queue_name (em_queue_t queue, char *name, size_t maxlen) |
| em_queue_t | em_queue_find (const char *name) |
| em_queue_prio_t | em_queue_priority (em_queue_t queue) |
| em_queue_type_t | em_queue_type (em_queue_t queue) |
| em_queue_t | em_queue_static_handle (uint16_t static_offset) |
| em_queue_group_t | em_queue_qgroup (em_queue_t queue) |
| em_atomic_group_t | em_queue_agroup (em_queue_t queue) |
| em_event_t | em_queue_dequeue (em_queue_t queue) |
| int | em_queue_dequeue_multi (em_queue_t queue, em_event_t events[], int num) |
| em_queue_t | em_queue_current (void) |
| em_queue_t | em_queue_first (unsigned int *num) |
| em_queue_t | em_queue_next (void) |
| int | em_queue_index (em_queue_t queue) |
| int | em_queue_num_prio (int *num_runtime) |
| int | em_queue_max_num (void) |
| int | em_queue_internal_max_num (void) |
| int | em_queue_static_max_num (void) |
| int | em_queue_dynamic_max_num (void) |
| int | em_queue_aggr_max_num (void) |
| uint32_t | em_queue_aggr_num (em_queue_t parent_queue) |
| em_queue_t | em_queue_aggr (em_queue_t parent_queue, uint32_t aggr_index) |
| uint32_t | em_queue_aggr_list (em_queue_t parent_queue, em_queue_t aggr_list[], uint32_t max, uint32_t *num_aggr) |
| uint32_t | em_queue_aggr_info (em_queue_t parent_queue, em_queue_aggr_info_t aggr_info[], uint32_t max, uint32_t *num_aggr) |
| uint16_t | em_queue_device_id (em_queue_t queue) |
| uint16_t | em_queue_qid (em_queue_t queue) |
| void | em_queue_ids (em_queue_t queue, uint16_t *device_id, uint16_t *qid) |
| em_queue_t | em_queue_handle_raw (uint16_t device_id, uint16_t qid) |
| uint32_t | em_queue_to_u32 (em_queue_t queue) |
Operations on queues
Queues are the communication mechanism used by EM. Each queue is associated with one Execution Object (EO) (or HW functionality), but each EO can have multiple queues.
A queue can have one of seven (7) different scheduling modes / queue types:
Ordered queues are scheduled like parallel queues — multiple events can be processed concurrently — but the system preserves egress ordering. This enables high single-flow throughput without requiring the application to synchronize for ordering between threads.
Ordering context: When the scheduler dequeues an event (or burst) from an ordered queue, the receiving thread is associated with an ordering context that represents the event's sequence position in the queue. Contexts originating from the same ordered queue keep the mutual order of their corresponding events. The context is valid during the EO receive function and ends when the function returns, or earlier if em_ordered_processing_end() is called.
Sending under an ordering context: Any event sent during the context inherits its sequence position, including events not received from the ordered queue (e.g. newly allocated or previously stored). The first event sent occupies the position of the received event; subsequent sends occupy the consecutive positions after it. The received event itself does not need to be forwarded; if no event is sent at all, the position is implicitly skipped.
Destination queues: Events may be sent to any number of destination queues of any type. Ordering is enforced per destination queue (not between different destinations) and follows two rules:
Note that the guarantee covers enqueue, not processing: a non-atomic destination queue served by a multi-core EO may still process events out of order.
Compared to atomic queues, which also maintain order, ordered queues achieve higher throughput by allowing multiple cores to process events in parallel.
Local queues are special virtual queues bypassing the scheduler for fast core-local pipelining without load balancing or atomic processing. A local queue is connected (added) to an EO in the same way scheduled queues are. Events sent to a local queue are added to a per core (local) storage maintained by the EM dispatcher. This core local event storage is emptied by the dispatcher after the sending EO returns from the receive function. The local events are now immediately dispatched on the current core, i.e. handed to the receive function of the EO that owns the targeted local queue. Only when all local events have been handled is the scheduler allowed to schedule new events for the core. Local queues do not have an explicit ordered or atomic processing context, instead they inherit the context of the EO under which the event was sent (i.e. ordering could still be maintained with careful design). The sending EO's processing context is only released after the local queue is empty, unless the application explicitly ends the context earlier, thus effectively making local processing similar to handling the same function within the sending EO's receive. A local queue is not associated with a queue group and exists on all cores of the EM instance - the application must be able to handle events on all cores (unless sending to the local queue is controlled).
The local queue concept is a performance optimization and a way to logically split processing into separate EO's but due to the side effects (may delay context release of the sending EO) and limitations should not be used without a valid reason. Local queues are mainly suitable for stateless processing that does not need EM scheduling.
Currently EM does not define the exact queue behavior except that queues work like FIFOs. This means, e.g. that the maximum length of a queue is system specific (the conf parameter of queue create can be used to provide options)
Special queues towards asynchronous HW functions, e.g. a crypto accelerator, should look like any regular queue from the sender's point of view, i.e. em_send() and related functions work.
| #define em_atomic_group_get em_queue_agroup |
Definition at line 1030 of file event_machine_queue.h.
| #define EM_QUEUE_FLAG_BLOCKING 0 /* blocking, fastest (default) */ |
em_queue_flag_t value. Only combine flags with bitwise OR.
Blocking queue implementation. A suspending thread may block all other threads, i.e. no block freedom guarantees. Implied by EM_QUEUE_FLAG_DEFAULT for the implementation on this system.
Definition at line 341 of file event_machine_queue.h.
| #define EM_QUEUE_FLAG_DEFAULT 0 |
em_queue_flag_t default value. The EM queues will use implementation specific default values. The default values for this implementation values imply: EM_QUEUE_FLAG_DEFAULT = MTSAFE and BLOCKING queue implementation
Definition at line 330 of file event_machine_queue.h.
| #define EM_QUEUE_FLAG_DEQ_NOT_MTSAFE 8 |
em_queue_flag_t value. Only combine flags with bitwise OR.
Default multithread safe dequeue implementation not needed, the application guarantees there is no concurrent accesses in dequeue, i.e. em_queue_dequeue(). This can only be used with unscheduled queues and can potentially improve performance. The implementation may choose to ignore this flag. Use with care.
Definition at line 391 of file event_machine_queue.h.
| #define EM_QUEUE_FLAG_ENQ_NOT_MTSAFE 4 |
em_queue_flag_t value. Only combine flags with bitwise OR.
Default multithread safe enqueue implementation not needed, the application guarantees there is no concurrent accesses in enqueue, i.e. em_send(). This can only be used with unscheduled queues and can potentially improve performance. The implementation may choose to ignore this flag. Use with care.
Definition at line 378 of file event_machine_queue.h.
| #define EM_QUEUE_FLAG_MASK 0x0000FFFF |
The low 16 bits are reserved for EM, the upper bits are free for system-specific use.
Definition at line 320 of file event_machine_queue.h.
| #define EM_QUEUE_FLAG_NONBLOCKING_LF 1 /* non-blocking, lock-free */ |
em_queue_flag_t value. Only combine flags with bitwise OR.
Require a non-blocking and lock-free queue implementation. Other threads can make progress while a thread is suspended. Starvation freedom is not guaranteed. Queue creation will fail if set and not supported.
Definition at line 353 of file event_machine_queue.h.
| #define EM_QUEUE_FLAG_NONBLOCKING_WF 2 /* non-blocking, wait-free */ |
em_queue_flag_t value. Only combine flags with bitwise OR.
Require a non-blocking and wait-free queue implementation. Other threads can make progress while a thread is suspended. Starvation freedom is guaranteed. Queue creation will fail if set and not supported.
Definition at line 365 of file event_machine_queue.h.
| #define em_queue_get_context em_queue_context |
Definition at line 903 of file event_machine_queue.h.
| #define em_queue_get_device_id em_queue_device_id |
Definition at line 1436 of file event_machine_queue.h.
| #define em_queue_get_first em_queue_first |
Definition at line 1123 of file event_machine_queue.h.
| #define em_queue_get_group em_queue_qgroup |
Definition at line 1013 of file event_machine_queue.h.
| #define em_queue_get_ids em_queue_ids |
Definition at line 1468 of file event_machine_queue.h.
| #define em_queue_get_index em_queue_index |
Definition at line 1154 of file event_machine_queue.h.
| #define em_queue_get_max_num em_queue_max_num |
Definition at line 1203 of file event_machine_queue.h.
| #define em_queue_get_name em_queue_name |
Definition at line 927 of file event_machine_queue.h.
| #define em_queue_get_next em_queue_next |
Definition at line 1138 of file event_machine_queue.h.
| #define em_queue_get_num_prio em_queue_num_prio |
Definition at line 1178 of file event_machine_queue.h.
| #define em_queue_get_priority em_queue_priority |
Definition at line 957 of file event_machine_queue.h.
| #define em_queue_get_qid em_queue_qid |
Definition at line 1450 of file event_machine_queue.h.
| #define em_queue_get_type em_queue_type |
Definition at line 971 of file event_machine_queue.h.
| #define EM_QUEUE_PRIO_UNDEF 0xFF |
Undefined
Definition at line 301 of file event_machine_queue.h.
| #define PRI_QPRIO PRIu32 |
Definition at line 281 of file event_machine_queue.h.
| #define PRI_QTYPE PRIu32 |
em_queue_type_t printf format
Definition at line 206 of file event_machine_queue.h.
| typedef int(* em_output_func_t) (const em_event_t events[], const unsigned int num, const em_queue_t output_queue, void *output_fn_args) |
Output function, user provided callback for queues of type EM_QUEUE_TYPE_OUTPUT.
This function will be called by em_send*() when sending to a queue of type EM_QUEUE_TYPE_OUTPUT and EM will take care of correct function calling order based on the scheduling context type. The function can use em_sched_context_type_current() if it needs information about e.g. ordering requirements set by the parent scheduled queue.
| events | List of events to be sent out (ptr to array of events) |
| num | Number of events (positive integer) |
| output_queue | Output queue that the events were sent to (em_send*()) |
| output_fn_args | Extra arguments to indicate e.g. ordering requirement of the source context. |
Definition at line 441 of file event_machine_queue.h.
| typedef uint32_t em_queue_flag_t |
Queue flags
An unsigned integer with defined queue flags that can be combined by bitwise 'OR' only. EM_QUEUE_FLAG_DEFAULT can be used in most cases. Unused bits must be set to zero. The actual values are system specific, but the implementation need to define at least: EM_QUEUE_FLAG_DEFAULT, EM_QUEUE_FLAG_BLOCKING, EM_QUEUE_FLAG_NONBLOCKING_LF and EM_QUEUE_FLAG_NONBLOCKING_WF even if those would not be supported.
Definition at line 313 of file event_machine_queue.h.
| typedef enum em_queue_prio_e em_queue_prio_e |
Portable queue priorities.
These are generic portable values to use for priority with em_queue_prio_t.
Alternatively application may choose to use numeric values in the valid range (from 0 to em_queue_num_prio() - 1).
Queue priority
Queue priority defines implementation specific QoS class for event scheduling. Priority is an integer in range 0 (lowest) to num priorities - 1. Note, that the exact scheduling rules are not defined by EM and all available priorities may not be relative to the adjacent one (e.g. using dynamic priority, rate limiting or other more complex scheduling discipline). There are 5 generic predefined values (em_queue_prio_e) mapped to available runtime priorities for portability.
Definition at line 280 of file event_machine_queue.h.
| typedef enum em_queue_type_e em_queue_type_e |
Queue types used by em_queue_type_t
Queue type.
Affects the scheduling principle
Definition at line 204 of file event_machine_queue.h.
| enum em_queue_prio_e |
Portable queue priorities.
These are generic portable values to use for priority with em_queue_prio_t.
Alternatively application may choose to use numeric values in the valid range (from 0 to em_queue_num_prio() - 1).
| Enumerator | |
|---|---|
| EM_QUEUE_PRIO_LOWEST | Lowest |
| EM_QUEUE_PRIO_LOW | Low |
| EM_QUEUE_PRIO_NORMAL | Normal |
| EM_QUEUE_PRIO_HIGH | High |
| EM_QUEUE_PRIO_HIGHEST | Highest |
Definition at line 293 of file event_machine_queue.h.
| enum em_queue_type_e |
Queue types used by em_queue_type_t
| Enumerator | |
|---|---|
| EM_QUEUE_TYPE_UNDEF | Undefined |
| EM_QUEUE_TYPE_ATOMIC | Atomic queue. The application receives events one by one, non-concurrently to guarantee exclusive processing and ordering |
| EM_QUEUE_TYPE_PARALLEL | Parallel queue. The application may receive events fully concurrently, egress event ordering (when processed in parallel) not guaranteed |
| EM_QUEUE_TYPE_ORDERED | Ordered parallel queue. The application may receive events concurrently, but the system takes care of egress order (between two queues) |
| EM_QUEUE_TYPE_PARALLEL_ORDERED | backwards compatible alias |
| EM_QUEUE_TYPE_UNSCHEDULED | A queue which is not connected to scheduling. The application needs to explicitly dequeue events |
| EM_QUEUE_TYPE_AGGR | Aggregator queue. An aggregator queue is a child queue of a scheduled or unscheduled parent queue. Events sent to an aggregator queue are (possibly) bundled into vector events before being enqueued to the parent queue for delivery.
|
| EM_QUEUE_TYPE_LOCAL | A queue type for local virtual queue not connected to scheduling. |
| EM_QUEUE_TYPE_OUTPUT | A system specific queue type to abstract output from EM, e.g. packet output or output towards a HW accelerator. The application uses em_send() and variants to send an event 'out'. |
Definition at line 211 of file event_machine_queue.h.
| em_queue_t em_queue_aggr | ( | em_queue_t | parent_queue, |
| uint32_t | aggr_index | ||
| ) |
Get an aggregator queue handle by index for the given parent queue.
The parent queue can be a scheduled or unscheduled queue, but not an aggregator queue itself. The returned aggregator queue is associated with the parent queue and can be used as destination queue for sending/enqueuing events. Events sent to this queue may be aggregated into vector events before being enqueued to the parent queue. The parent queue must have been configured with aggregator queues when created with em_queue_create_param() to get any aggregator queue returned by this function.
| parent_queue | Parent queue handle |
| aggr_index | Aggregator queue index, range 0 to em_queue_aggr_num(parent_queue) - 1. |
| EM_QUEUE_UNDEF | Invalid 'parent_queue' (error reported). |
| EM_QUEUE_UNDEF | 'aggr_index' is out of range (no error). |
Definition at line 590 of file event_machine_queue.c.
| void em_queue_aggr_conf_init | ( | uint32_t | num_aggr, |
| em_queue_aggr_conf_t | aggr_conf[] | ||
| ) |
Initialize configuration parameters for aggregator queue(s).
Initialize an array of em_queue_aggr_conf_t:s to default values. Always call this before setting fields to ensure compatibility with potentially added new options. EM will enforce this and report an error if not done.
| num_aggr | Number of elements in aggr_conf[] (1..EM_QUEUE_MAX_AGGR) |
| aggr_conf | Address of the em_queue_aggr_conf_t array to initialize |
Definition at line 153 of file event_machine_queue.c.
| uint32_t em_queue_aggr_info | ( | em_queue_t | parent_queue, |
| em_queue_aggr_info_t | aggr_info[], | ||
| uint32_t | max, | ||
| uint32_t * | num_aggr | ||
| ) |
Get aggregator queue information for the given parent queue.
Returns information about the aggregator queues configured for the given parent queue. Each element in the output array 'aggr_info[]' contains the aggregator queue handle and the configuration that was used when the parent queue was created.
The parent queue can be a scheduled or unscheduled queue, but not an aggregator queue itself.
This is a heavier operation than em_queue_aggr() and em_queue_aggr_list() and should only be used when the additional information about the aggregator queues is needed.
| parent_queue | Parent queue handle | |
| [out] | aggr_info | Array for aggregator queue information output, must have room for 'max' entries. Use NULL if only interested in 'num_aggr'. |
| max | Maximum number of entries to write into 'aggr_info[]', ignored if 'aggr_info' is NULL. 'max' is in the range 0 .. EM_QUEUE_MAX_AGGR. | |
| [out] | num_aggr | Output for the total number of configured aggregator queues for 'parent_queue'. Optional, can be NULL if not needed. |
Definition at line 641 of file event_machine_queue.c.
| uint32_t em_queue_aggr_list | ( | em_queue_t | parent_queue, |
| em_queue_t | aggr_list[], | ||
| uint32_t | max, | ||
| uint32_t * | num_aggr | ||
| ) |
Get aggregator queue handles for a given parent queue.
This function outputs the total number of aggregator queues configured for the given parent queue via the output parameter 'num_aggr' and writes queue handles to 'aggr_list[]' up to the given 'max' length (<= EM_QUEUE_MAX_AGGR).
The parent queue can be a scheduled or unscheduled queue, but not an aggregator queue itself. The returned aggregator queues are associated with the parent queue and can be used as destination queues for sending/enqueuing events. Events sent to these queues may be aggregated into vector events before being enqueued to the parent queue. The parent queue must have been configured with aggregator queues when created with em_queue_create_param() to get any aggregator queues returned by this function.
To only get the number of aggregator queues without retrieving handles:
To get all aggregator queue handles for a parent queue:
| parent_queue | Parent queue handle for which to list the aggregator queues. | |
| [out] | aggr_list | Pointer to an aggregator queue handle array that can fit 'max' amount of handles. Use NULL if only interested in 'num_aggr'. |
| max | Max number of handles that can be written into 'aggr_list[]', ignored if 'aggr_list' is NULL. 'max' is in the range 0 .. EM_QUEUE_MAX_AGGR. 'max' is capped to EM_QUEUE_MAX_AGGR if greater. | |
| [out] | num_aggr | Output for the total number of configured aggregator queues for 'parent_queue'. Optional, can be NULL if not needed. |
Definition at line 608 of file event_machine_queue.c.
| int em_queue_aggr_max_num | ( | void | ) |
Get the maximum number of EM aggregator queues that can be created.
The maximum number of aggregator queues that can be created is configured via 'queue.num_aggr' in em-odp.conf.
Definition at line 568 of file event_machine_queue.c.
| uint32_t em_queue_aggr_num | ( | em_queue_t | parent_queue | ) |
Get the number of aggregator queues for the given parent queue.
The parent queue can be a scheduled or unscheduled queue, but not an aggregator queue itself.
| parent_queue | Parent queue handle |
Definition at line 573 of file event_machine_queue.c.
| em_atomic_group_t em_queue_agroup | ( | em_queue_t | queue | ) |
Get the associated atomic group (if any) of the given queue.
Returns the atomic group of the given queue.
| queue | Queue handle |
Definition at line 367 of file event_machine_queue.c.
| void * em_queue_context | ( | em_queue_t | queue | ) |
Get queue specific (application) context.
Returns the value application has earlier set with em_queue_set_context().
| queue | Queue for which the context is requested |
Definition at line 240 of file event_machine_queue.c.
| em_queue_t em_queue_create | ( | const char * | name, |
| em_queue_type_t | type, | ||
| em_queue_prio_t | prio, | ||
| em_queue_group_t | group, | ||
| const em_queue_conf_t * | conf | ||
| ) |
Create a new queue with a dynamic queue handle (i.e. handle given by EM)
The given name string is copied into an EM internal data structure. The maximum string length is EM_QUEUE_NAME_LEN.
Create scheduled atomic, parallel or ordered queues by using the types EM_QUEUE_TYPE_ATOMIC, EM_QUEUE_TYPE_PARALLEL or EM_QUEUE_TYPE_ORDERED.
To create an unscheduled queue, use the type EM_QUEUE_TYPE_UNSCHEDULED. The prio and queue group are not relevant, but need to be set to EM_QUEUE_PRIO_UNDEF and EM_QUEUE_GROUP_UNDEF. Unscheduled queues can't be associated with an EO (em_eo_add_queue() fails).
To create a local queue, use type EM_QUEUE_TYPE_LOCAL. The queue group is not relevant and must be set to EM_QUEUE_GROUP_UNDEF. The virtual local queue is created for all cores in this EM instance. Note also that the implementation may not implement priorities for local queues.
To create an output queue, use the type EM_QUEUE_TYPE_OUTPUT. Pass the needed information to bind a queue with an interface via the conf-argument (content is system and output-type specific). The queue group is not relevant and must be set to EM_QUEUE_GROUP_UNDEF. Note also that the implementation may not implement priorities for output queues.
The 'conf' argument is optional and can be used to pass extra attributes (e.g. require non-blocking behaviour, if supported) to the system specific implementation.
| name | Queue name (optional, NULL ok) |
| type | Queue type |
| prio | Queue priority class |
| group | Queue group for this queue |
| conf | Optional configuration data, NULL for defaults |
Definition at line 67 of file event_machine_queue.c.
| em_queue_t em_queue_create_param | ( | const char * | name, |
| const em_queue_param_t * | param | ||
| ) |
Create a new EM queue according to the given parameters.
The queue name is copied into queue internal data. The maximum length stored is EM_QUEUE_NAME_LEN. Duplicate names are allowed, but find will only match one of them.
Always initialize 'param' first with em_queue_param_init(¶m) to ensure backwards compatibility and default values for all fields before setting your own params and calling em_queue_create_param():
| name | Name of the queue (optional, NULL ok) |
| param | Queue parameters |
| EM_QUEUE_UNDEF | on error |
Definition at line 190 of file event_machine_queue.c.
| em_status_t em_queue_create_static | ( | const char * | name, |
| em_queue_type_t | type, | ||
| em_queue_prio_t | prio, | ||
| em_queue_group_t | group, | ||
| em_queue_t | queue, | ||
| const em_queue_conf_t * | conf | ||
| ) |
Create a new queue with a static queue handle (i.e. given by the user).
Note that the number of static queues is provided by the user through 'queue.num_static' in em-odp.conf at runtime. A valid static queue handle can be derived as follows:
The 'x' in above pseudocode must be in range 0 to 'queue.num_static' - 1.
Otherwise like em_queue_create().
| name | Queue name (optional, NULL ok) |
| type | Queue scheduling type |
| prio | Queue priority |
| group | Queue group for this queue |
| queue | Requested queue handle from the static range |
| conf | Optional configuration data, NULL for defaults |
Definition at line 95 of file event_machine_queue.c.
| em_queue_t em_queue_current | ( | void | ) |
Returns the current active queue
The 'current active queue' is the queue that delivered the input event to the EO-receive that is currently being run.
Only valid if called within an EO-receive context, will return EM_QUEUE_UNDEF otherwise, i.e. can be called from the EO-receive functions or subfunctions thereof. Note that calling em_queue_current() from an EO-start/stop function that was launched from within an EO's receive function will return EM_QUEUE_UNDEF.
Definition at line 454 of file event_machine_queue.c.
| em_status_t em_queue_delete | ( | em_queue_t | queue | ) |
Delete a queue.
Unallocates the queue handle. This is an immediate deletion and can only be done after the queue has been removed from scheduling using em_eo_remove_queue().
| queue | Queue handle to delete |
Definition at line 208 of file event_machine_queue.c.
| em_event_t em_queue_dequeue | ( | em_queue_t | queue | ) |
Dequeue an event from an unscheduled queue
This can only be used with unscheduled queues created with the type EM_QUEUE_TYPE_UNSCHEDULED. Events are added to these queues with em_send(), similar to queues of other types, but applications needs to explicitly dequeue the event(s). Unscheduled queues are general purpose FIFOs, i.e. send(enqueue) to tail and dequeue from head. The maximum length of an unscheduled queue is system specific.
An unscheduled queue can also have a context, but if used it needs to be asked separately using em_queue_context().
| queue | Unscheduled queue handle |
Definition at line 384 of file event_machine_queue.c.
| int em_queue_dequeue_multi | ( | em_queue_t | queue, |
| em_event_t | events[], | ||
| int | num | ||
| ) |
Dequeue multiple events from an unscheduled queue
This can only be used with unscheduled queues created with the type EM_QUEUE_TYPE_UNSCHEDULED. Events are added to these queues with em_send(), similar to queues of other types, but applications needs to explicitly dequeue the event(s). Unscheduled queues are general purpose FIFOs, i.e. send(enqueue) to tail and dequeue from head. The maximum length of an unscheduled queue is system specific.
An unscheduled queue can also have a context, but needs to be asked separately using em_queue_context().
| queue | Unscheduled queue handle | |
| [out] | events | Array of event handles for output |
| num | Maximum number of events to dequeue |
Definition at line 412 of file event_machine_queue.c.
| uint16_t em_queue_device_id | ( | em_queue_t | queue | ) |
Returns the device-id extracted from the given queue handle
An EM queue handle consists of a device-id and a queue-id. This function extracts the device-id from an EM queue handle and returns it.
| queue | EM queue handle |
Definition at line 701 of file event_machine_queue.c.
| int em_queue_dynamic_max_num | ( | void | ) |
Get the maximum number of EM dynamic queues that can be created.
The maximum number of dynamic queues that can be created is configured via 'queue.num_dynamic' in em-odp.conf.
Definition at line 563 of file event_machine_queue.c.
| em_queue_t em_queue_find | ( | const char * | name | ) |
Find a queue by name.
Finds a queue by the given name (exact match). An empty string will not match anything. The search is case sensitive. The function will return the first match only if there are duplicate names, Be aware of that the search may take a long time if there are many queues.
| name | name to look for |
Definition at line 283 of file event_machine_queue.c.
| em_queue_t em_queue_first | ( | unsigned int * | num | ) |
Initialize queue iteration and return the first queue handle.
Can be used to initialize the iteration to retrieve all created queues for debugging or management purposes. Use em_queue_next() after this call until it returns EM_QUEUE_UNDEF. A new call to em_queue_first() resets the iteration, which is maintained per core (thread). The operation should be completed in one go before returning from the EO's event receive function (or start/stop).
The number of queues (output arg 'num') may not match the amount of queues actually returned by iterating using em_queue_next() if queues are added or removed in parallel by another core. The order of the returned queue handles is undefined.
| [out] | num | Pointer to an unsigned int to store the amount of queues into |
Definition at line 459 of file event_machine_queue.c.
| em_queue_t em_queue_handle_raw | ( | uint16_t | device_id, |
| uint16_t | qid | ||
| ) |
Construct a raw EM queue handle from the provided device-id and queue-id.
An EM queue handle consists of a device-id and a queue-id. This function constructs an EM queue handle by combining the device-id and queue-id together into an EM queue handle.
| device_id | |
| qid |
Definition at line 725 of file event_machine_queue.c.
| void em_queue_ids | ( | em_queue_t | queue, |
| uint16_t * | device_id, | ||
| uint16_t * | qid | ||
| ) |
Extract and output both the device-id and the queue-id from the given queue handle.
An EM queue handle consists of a device-id and a queue-id. This function extracts both the device-id and the queue-id from an EM queue handle and returns them to the caller via the output arguments 'device_id' and 'qid'.
| queue | EM queue handle | |
| [out] | device_id | device-id |
| [out] | qid | queue-id |
Definition at line 715 of file event_machine_queue.c.
| int em_queue_index | ( | em_queue_t | queue | ) |
Get a unique index corresponding to the given EM queue handle.
Returns a unique index in the range 0 to em_queue_max_num() - 1. The same EM queue handle will always map to the same index.
Only meaningful for queues created within the current EM instance.
| queue | EM queue handle |
Definition at line 506 of file event_machine_queue.c.
| int em_queue_internal_max_num | ( | void | ) |
Get the maximum number of EM internal queues that EM might internally create.
EM reserves a number of internal queues for its own use (core-local and shared internal queues) - this function returns that number. Note that this is a maximum number and that the actual number of internal queues may be less depending on the EM configuration and runtime environment.
Definition at line 553 of file event_machine_queue.c.
| int em_queue_max_num | ( | void | ) |
Returns the maximum number of EM queues that can be created.
The maximum number of EM queues contains all EM queues (static and dynamic) created by the application as well as the internal EM queues. The number of static and dynamic queues can be configured via 'queue.num_static' and 'queue.num_dynamic' in em-odp.conf.
Note that the function returns the maximum number of queues that can be created, not the actual number of queues currently created nor the max number of queues that has been created at any point in time in the EM instance. The actual number of queues currently created can be obtained by calling em_queue_first(&num).
Definition at line 548 of file event_machine_queue.c.
| size_t em_queue_name | ( | em_queue_t | queue, |
| char * | name, | ||
| size_t | maxlen | ||
| ) |
Get the queue name.
Returns the name given to a queue when it was created. A copy of the queue name string (up to 'maxlen' characters) is written to the user given buffer. The string is always null terminated even if the given buffer length is less than the name length.
The function returns '0' and writes an empty string if the queue has no name.
| queue | Queue handle | |
| [out] | name | Destination buffer |
| maxlen | Maximum length (including the terminating '0') |
Definition at line 259 of file event_machine_queue.c.
| em_queue_t em_queue_next | ( | void | ) |
Return the next queue handle.
Continues the queue iteration started by em_queue_first() and returns the next queue handle.
Definition at line 485 of file event_machine_queue.c.
| int em_queue_num_prio | ( | int * | num_runtime | ) |
Returns the number of queue priorities available.
Optionally the amount of actual runtime priorities can be inquired. Valid queue priority range is from 0 (lowest priority) to em_queue_num_prio() - 1.
Runtime environment may provide different amount of levels. In that case EM priorities are mapped to the runtime values depending on mapping mode selected in the runtime configuration file.
| [out] | num_runtime | Pointer to an int to receive the number of actual runtime priorities. Set to NULL if not needed. |
Definition at line 535 of file event_machine_queue.c.
| void em_queue_param_init | ( | em_queue_param_t * | param | ) |
Initialize parameters for EM queue creation.
Initialize em_queue_param_t to default values for all fields. After initialization, the user further needs to set the mandatory fields of 'em_queue_param_t' before calling em_queue_create_param(). Always initialize 'param' first with em_queue_param_init(¶m) to ensure backwards compatibility with potentially added new options. EM will enforce this initialization and report an error if not done.
| param | Address of the em_queue_param_t to be initialized |
Definition at line 172 of file event_machine_queue.c.
| em_queue_prio_t em_queue_priority | ( | em_queue_t | queue | ) |
Get the queue priority.
| queue | Queue handle |
Definition at line 301 of file event_machine_queue.c.
| em_queue_group_t em_queue_qgroup | ( | em_queue_t | queue | ) |
Get the associated queue group of the given queue.
| queue | Queue handle |
Definition at line 350 of file event_machine_queue.c.
| uint16_t em_queue_qid | ( | em_queue_t | queue | ) |
Returns the queue-id extracted from the given queue handle
An EM queue handle consists of a device-id and a queue-id. This function extracts the queue-id from an EM queue handle and returns it.
| queue | EM queue handle |
Definition at line 708 of file event_machine_queue.c.
| em_status_t em_queue_set_context | ( | em_queue_t | queue, |
| const void * | context | ||
| ) |
Set queue specific (application) context.
This is a single pointer associated with a queue. The application can use it to access some context data quickly (without a lookup). The context is given as an argument to the EO receive function. EM does not dereference it.
| queue | Queue to which associate the context |
| context | Context pointer |
Definition at line 226 of file event_machine_queue.c.
| em_queue_t em_queue_static_handle | ( | uint16_t | static_offset | ) |
Construct a static queue handle from a given static offset.
The first static queue handle is em_queue_static_handle(0), and the last one is em_queue_static_handle(em_queue_static_max_num() - 1). The static offset must be in range 0 .. em_queue_static_max_num() - 1, otherwise EM_QUEUE_UNDEF is returned.
Use the constructed handle with em_queue_create_static() to create the corresponding queue if it has not been created already.
| static_offset | offset from the first static queue ID. Must be in range 0 to em_queue_static_max_num() - 1 |
Definition at line 329 of file event_machine_queue.c.
| int em_queue_static_max_num | ( | void | ) |
Get the maximum number of EM static queues that can be created.
The maximum number of EM static queues that can be created are configured via 'queue.num_static' in em-odp.conf.
Definition at line 558 of file event_machine_queue.c.
| uint32_t em_queue_to_u32 | ( | em_queue_t | queue | ) |
Convert an queue handle to an unsigned integer
| queue | queue handle to be converted |
Definition at line 732 of file event_machine_queue.c.
| em_queue_type_t em_queue_type | ( | em_queue_t | queue | ) |
Get the queue type.
| queue | Queue handle |
Definition at line 315 of file event_machine_queue.c.