-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PATCH v2] API: add event vectors and event aggregators #2187
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* SPDX-License-Identifier: BSD-3-Clause | ||
* Copyright (c) 2013-2018 Linaro Limited | ||
* Copyright (c) 2023 Nokia | ||
* Copyright (c) 2023-2025 Nokia | ||
*/ | ||
|
||
/** | ||
|
@@ -35,6 +35,9 @@ extern "C" { | |
* parameters into their default values. Default values are also used when | ||
* 'param' pointer is NULL. | ||
* | ||
* 'name' and 'param' and any configuration structures pointed to by 'param' | ||
* are used only during the call. They can be freed after queue creation. | ||
* | ||
Comment on lines
+38
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this necessary? The same holds true for many other APIs and now this single function would be a bit of an outlier. Potentially this could be stated somewhere in a single place, so it would cover all relevant APIs. |
||
* @param name Name of the queue or NULL. Maximum string length is | ||
* ODP_QUEUE_NAME_LEN, including the null character. | ||
* @param param Queue parameters. Uses defaults if NULL. | ||
|
@@ -155,6 +158,50 @@ int odp_queue_context_set(odp_queue_t queue, void *context, uint32_t len); | |
*/ | ||
void *odp_queue_context(odp_queue_t queue); | ||
|
||
/** | ||
* Get a queue handle of an event aggregator associated with a queue | ||
* | ||
* Returns a queue handle that can be used to refer to an event aggregator | ||
* associated with this queue. Unless otherwise noted, the returned queue | ||
* handle can be used in all contexts where queue handles are used. | ||
* In particular, the queue handle can be used in odp_queue_enq() to | ||
* enqueue events through an event aggregator to the underlying queue. | ||
* Similarly, the queue handle can be given to packet I/O, classifier, | ||
* crypto and IPsec to have the generated events be enqueued by ODP through | ||
* the event aggregator. | ||
* | ||
* This function does not create a new queue but merely returns a reference | ||
* to an aggregator queue which has the same life time as the underlying | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
* queue. The underlying queue must not be destroyed as long as any of its | ||
* aggregators is in use. The aggregator queue gets destroyed when the | ||
* underlying queue gets destroyed. An aggregator queue handle must not | ||
* be passed to odp_queue_destroy(). | ||
* | ||
* The aggregator queues have the same enq_mode as the underlying queue. | ||
* | ||
* The returned queue handle cannot be used for dequeuing events. It must | ||
* not be passed to odp_queue_deq() or similar. | ||
* | ||
* The returned queue handle must not be passed to any of the | ||
* odp_queue_context* or odp_queue_sched* functions and is never returned | ||
* by odp_queue_lookup(). | ||
Comment on lines
+182
to
+187
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps the forbidden functions could be listed explicitly in the same manner than for example in |
||
* | ||
* 'aggr_index' refers to the aggregator configured with the same index | ||
* in odp_queue_param_t::aggregator. | ||
* | ||
* If 'aggr_index' is greater than odp_queue_param_t::num_aggregators, | ||
* ODP_QUEUE_INVALID is returned. | ||
* | ||
* @param queue Queue handle | ||
* @param aggr_index Index of the event aggregator | ||
* | ||
* @return event aggregator queue handle | ||
* @retval ODP_QUEUE_INVALID on failure | ||
* | ||
* @see odp_queue_create() | ||
*/ | ||
odp_queue_t odp_queue_aggregator(odp_queue_t queue, uint32_t aggr_index); | ||
|
||
/** | ||
* Enqueue an event to a queue | ||
* | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/* SPDX-License-Identifier: BSD-3-Clause | ||
* Copyright (c) 2018 Linaro Limited | ||
* Copyright (c) 2024-2025 Nokia | ||
*/ | ||
|
||
/** | ||
|
@@ -16,6 +17,7 @@ | |
extern "C" { | ||
#endif | ||
|
||
#include <odp/api/event_vector_types.h> | ||
#include <odp/api/schedule_types.h> | ||
|
||
/** @defgroup odp_queue ODP QUEUE | ||
|
@@ -52,7 +54,17 @@ typedef enum odp_queue_type_t { | |
* Scheduled queues are connected to the scheduler. Application must | ||
* not dequeue events directly from these queues but use the scheduler | ||
* instead. */ | ||
ODP_QUEUE_TYPE_SCHED | ||
ODP_QUEUE_TYPE_SCHED, | ||
|
||
/** Aggregator queue | ||
* | ||
* Aggregator queues are connected to an underlyig plain or scheduled | ||
* queue. They cannot be created directly but through the creation | ||
* of the underlying queue. Application must not dequeue events | ||
* directly from these queues. | ||
*/ | ||
ODP_QUEUE_TYPE_AGGREGATOR, | ||
|
||
} odp_queue_type_t; | ||
|
||
/** | ||
|
@@ -214,6 +226,9 @@ typedef struct odp_queue_capability_t { | |
|
||
} waitfree; | ||
|
||
/** Event vector generation capabilities */ | ||
odp_event_aggregator_capability_t aggregator; | ||
Comment on lines
+229
to
+230
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here aggregator capabilities are under |
||
|
||
} plain; | ||
|
||
} odp_queue_capability_t; | ||
|
@@ -291,6 +306,28 @@ typedef struct odp_queue_param_t { | |
* default size. The default value is 0. */ | ||
uint32_t size; | ||
|
||
/** Number of event aggregators | ||
* | ||
* Event aggregators are queues which try to aggregate multiple | ||
* events into vector events before enqueuing the events or vector | ||
* events to this queue. When at least one event aggregator is | ||
* configured, event can be enqueued directly using the queue | ||
* handle of this queue or indirectly through an event aggregator | ||
* using the queue handle of the event aggregator (see | ||
* odp_queue_aggregator_get()). | ||
* | ||
* When >= 1, configuration must be provided for each aggregator | ||
* through the 'aggregator' array. | ||
*/ | ||
uint32_t num_aggregators; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it clear enough already or should it be still clarified that the source queue when calling e.g. |
||
|
||
/** Event aggregator configuration parameters | ||
* | ||
* When 'num_aggregators' is non-zero, 'aggregator' must point to | ||
* an array of size 'num_aggregators'. | ||
*/ | ||
const odp_event_aggregator_config_t *aggregator; | ||
|
||
} odp_queue_param_t; | ||
|
||
/** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
odp_event_aggregator_capability_t
is used withinodp_queue_capability_t
andodp_schedule_capability_t
, where the field name already refers to aggregators (e.g.odp_queue_capability_t.plain.aggregator
). So, I'd removeaggregators
from these field names to avoid repetition.