Skip to content
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 v1] api: event: add generic event vector API #2149

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions include/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ odpapiinclude_HEADERS = \
odp/api/errno.h \
odp/api/event.h \
odp/api/event_types.h \
odp/api/event_vector.h \
odp/api/event_vector_types.h \
odp/api/hash.h \
odp/api/hints.h \
odp/api/init.h \
Expand Down Expand Up @@ -99,6 +101,8 @@ odpapispecinclude_HEADERS = \
odp/api/spec/errno.h \
odp/api/spec/event.h \
odp/api/spec/event_types.h \
odp/api/spec/event_vector.h \
odp/api/spec/event_vector_types.h \
odp/api/spec/hash.h \
odp/api/spec/hints.h \
odp/api/spec/init.h \
Expand Down Expand Up @@ -171,6 +175,8 @@ odpapiabidefaultinclude_HEADERS = \
odp/api/abi-default/errno.h \
odp/api/abi-default/event.h \
odp/api/abi-default/event_types.h \
odp/api/abi-default/event_vector.h \
odp/api/abi-default/event_vector_types.h \
odp/api/abi-default/hash.h \
odp/api/abi-default/init.h \
odp/api/abi-default/ipsec.h \
Expand Down Expand Up @@ -235,6 +241,8 @@ odpapiabiarchinclude_HEADERS = \
odp/arch/arm32-linux/odp/api/abi/errno.h \
odp/arch/arm32-linux/odp/api/abi/event.h \
odp/arch/arm32-linux/odp/api/abi/event_types.h \
odp/arch/arm32-linux/odp/api/abi/event_vector.h \
odp/arch/arm32-linux/odp/api/abi/event_vector_types.h \
odp/arch/arm32-linux/odp/api/abi/hash.h \
odp/arch/arm32-linux/odp/api/abi/init.h \
odp/arch/arm32-linux/odp/api/abi/ipsec.h \
Expand Down Expand Up @@ -295,6 +303,8 @@ odpapiabiarchinclude_HEADERS = \
odp/arch/arm64-linux/odp/api/abi/errno.h \
odp/arch/arm64-linux/odp/api/abi/event.h \
odp/arch/arm64-linux/odp/api/abi/event_types.h \
odp/arch/arm64-linux/odp/api/abi/event_vector.h \
odp/arch/arm64-linux/odp/api/abi/event_vector_types.h \
odp/arch/arm64-linux/odp/api/abi/hash.h \
odp/arch/arm64-linux/odp/api/abi/init.h \
odp/arch/arm64-linux/odp/api/abi/ipsec.h \
Expand Down Expand Up @@ -355,6 +365,8 @@ odpapiabiarchinclude_HEADERS = \
odp/arch/default-linux/odp/api/abi/errno.h \
odp/arch/default-linux/odp/api/abi/event.h \
odp/arch/default-linux/odp/api/abi/event_types.h \
odp/arch/default-linux/odp/api/abi/event_vector.h \
odp/arch/default-linux/odp/api/abi/event_vector_types.h \
odp/arch/default-linux/odp/api/abi/hash.h \
odp/arch/default-linux/odp/api/abi/init.h \
odp/arch/default-linux/odp/api/abi/ipsec.h \
Expand Down Expand Up @@ -415,6 +427,8 @@ odpapiabiarchinclude_HEADERS = \
odp/arch/power64-linux/odp/api/abi/errno.h \
odp/arch/power64-linux/odp/api/abi/event.h \
odp/arch/power64-linux/odp/api/abi/event_types.h \
odp/arch/power64-linux/odp/api/abi/event_vector.h \
odp/arch/power64-linux/odp/api/abi/event_vector_types.h \
odp/arch/power64-linux/odp/api/abi/hash.h \
odp/arch/power64-linux/odp/api/abi/init.h \
odp/arch/power64-linux/odp/api/abi/ipsec.h \
Expand Down Expand Up @@ -475,6 +489,8 @@ odpapiabiarchinclude_HEADERS = \
odp/arch/x86_32-linux/odp/api/abi/errno.h \
odp/arch/x86_32-linux/odp/api/abi/event.h \
odp/arch/x86_32-linux/odp/api/abi/event_types.h \
odp/arch/x86_32-linux/odp/api/abi/event_vector.h \
odp/arch/x86_32-linux/odp/api/abi/event_vector_types.h \
odp/arch/x86_32-linux/odp/api/abi/hash.h \
odp/arch/x86_32-linux/odp/api/abi/init.h \
odp/arch/x86_32-linux/odp/api/abi/ipsec.h \
Expand Down Expand Up @@ -535,6 +551,8 @@ odpapiabiarchinclude_HEADERS = \
odp/arch/x86_64-linux/odp/api/abi/errno.h \
odp/arch/x86_64-linux/odp/api/abi/event.h \
odp/arch/x86_64-linux/odp/api/abi/event_types.h \
odp/arch/x86_64-linux/odp/api/abi/event_vector.h \
odp/arch/x86_64-linux/odp/api/abi/event_vector_types.h \
odp/arch/x86_64-linux/odp/api/abi/hash.h \
odp/arch/x86_64-linux/odp/api/abi/init.h \
odp/arch/x86_64-linux/odp/api/abi/ipsec.h \
Expand Down
3 changes: 2 additions & 1 deletion include/odp/api/abi-default/event_types.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright (c) 2017-2018 Linaro Limited
* Copyright (c) 2022-2023 Nokia
* Copyright (c) 2022-2024 Nokia
*/

#ifndef ODP_ABI_EVENT_TYPES_H_
Expand All @@ -27,6 +27,7 @@ typedef enum {
ODP_EVENT_BUFFER = 1,
ODP_EVENT_PACKET = 2,
ODP_EVENT_TIMEOUT = 3,
ODP_EVENT_VECTOR = 4,
ODP_EVENT_IPSEC_STATUS = 5,
ODP_EVENT_PACKET_VECTOR = 6,
ODP_EVENT_PACKET_TX_COMPL = 7,
Expand Down
18 changes: 18 additions & 0 deletions include/odp/api/abi-default/event_vector.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright (c) 2024 Nokia
*/

#ifndef ODP_ABI_EVENT_VECTOR_H_
#define ODP_ABI_EVENT_VECTOR_H_

#ifdef __cplusplus
extern "C" {
#endif

/* Empty header required due to the inline functions */

#ifdef __cplusplus
}
#endif

#endif
33 changes: 33 additions & 0 deletions include/odp/api/abi-default/event_vector_types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright (c) 2024 Nokia
*/

#ifndef ODP_ABI_EVENT_VECTOR_TYPES_H_
#define ODP_ABI_EVENT_VECTOR_TYPES_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>

/** @internal Dummy type for strong typing */
typedef struct { char dummy; /**< @internal Dummy */ } _odp_abi_event_vector_t;

/** @addtogroup odp_event_vector
* @{
*/

typedef _odp_abi_event_vector_t *odp_event_vector_t;

#define ODP_EVENT_VECTOR_INVALID ((odp_event_vector_t)0)

/**
* @}
*/

#ifdef __cplusplus
}
#endif

#endif
2 changes: 2 additions & 0 deletions include/odp/api/abi-default/queue_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ typedef _odp_abi_queue_t *odp_queue_t;

#define ODP_QUEUE_NAME_LEN 32

#define ODP_QUEUE_MAX_VECTOR_AGGR 8

/**
* @}
*/
Expand Down
26 changes: 26 additions & 0 deletions include/odp/api/event_vector.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright (c) 2024 Nokia
*/

/**
* @file
*
* ODP event vector
*/

#ifndef ODP_API_EVENT_VECTOR_H_
#define ODP_API_EVENT_VECTOR_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <odp/api/abi/event_vector.h>

#include <odp/api/spec/event_vector.h>

#ifdef __cplusplus
}
#endif

#endif
29 changes: 29 additions & 0 deletions include/odp/api/event_vector_types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright (c) 2024 Nokia
*/

/**
* @file
*
* ODP event vector API type definitions
*/

#ifndef ODP_API_EVENT_VECTOR_TYPES_H_
#define ODP_API_EVENT_VECTOR_TYPES_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <odp/api/abi/event_vector_types.h>

/* Include here to avoid circular dependency */
#include <odp/api/abi/pool_types.h>

#include <odp/api/spec/event_vector_types.h>

#ifdef __cplusplus
}
#endif

#endif
10 changes: 8 additions & 2 deletions include/odp/api/spec/classification.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright (c) 2014-2018 Linaro Limited
* Copyright (c) 2021-2023 Nokia
* Copyright (c) 2021-2024 Nokia
*/

/**
Expand Down Expand Up @@ -682,7 +682,13 @@ typedef struct odp_cls_cos_param {
/** Back Pressure configuration */
odp_bp_param_t bp;

/** Packet input vector configuration */
/** Packet input vector configuration
*
* Generating vectors of packets can be enabled either through this
* configuration or by using a destination queue(s) which has event
* vector generation enabled. Both options cannot be enabled
* simultaneously for the same pktio device.
*/
odp_pktin_vector_config_t vector;

} odp_cls_cos_param_t;
Expand Down
9 changes: 8 additions & 1 deletion include/odp/api/spec/event_types.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright (c) 2015-2018 Linaro Limited
* Copyright (c) 2022-2023 Nokia
* Copyright (c) 2022-2024 Nokia
*/

/**
Expand Down Expand Up @@ -42,6 +42,9 @@ extern "C" {
* Results are undefined, if conversion function of a wrong event type is used.
* Application cannot change event type by chaining conversion functions.
*
* The special event type ODP_EVENT_ANY does not match to any particular event
* type and can only be used when explicitly documented by the API.
*
* List of event types:
* - ODP_EVENT_BUFFER
* - Buffer event (odp_buffer_t) for simple data storage and message passing
Expand All @@ -52,6 +55,8 @@ extern "C" {
* - Timeout event (odp_timeout_t) from a timer
* - ODP_EVENT_IPSEC_STATUS
* - IPSEC status update event (odp_ipsec_status_t)
* - ODP_EVENT_VECTOR
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would the scheduled event always be ODP_EVENT_VECTOR or if odp_event_vector_config_t.event_type == ODP_EVENT_PACKET is it expeceted to be ODP_EVENT_PACKET_VECTOR

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case the event type would always be ODP_EVENT_VECTOR. I'd like to keep the event and packet vector APIs separate. Optimally, the whole old packet vector API would be deprecated, but we cannot do that without breaking backwards compatibility.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack

* - Vector of events (odp_event_t) as odp_event_vector_t
* - ODP_EVENT_PACKET_VECTOR
* - Vector of packet events (odp_packet_t) as odp_packet_vector_t
* - ODP_EVENT_PACKET_TX_COMPL
Expand All @@ -61,6 +66,8 @@ extern "C" {
* - DMA completion event (odp_dma_compl_t) indicates that a DMA transfer has finished
* - ODP_EVENT_ML_COMPL
* - ML completion event (odp_ml_compl_t) indicates that an ML operation has finished
* - ODP_EVENT_ANY
* - Special event type used only as function return value or configuration option
*/

/**
Expand Down
Loading
Loading