aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/odp_event.c
diff options
context:
space:
mode:
authorPetri Savolainen <petri.savolainen@nokia.com>2020-11-05 13:11:58 +0200
committerPetri Savolainen <petri.savolainen@nokia.com>2020-11-20 09:38:21 +0200
commit0284a9e6b44cf5bbee70a6d8a4f9de58eff6efa2 (patch)
tree7a18179ea6fe3a2e1e1095e73d6036554504619d /platform/linux-generic/odp_event.c
parent742a760850838ddc0955ed1dfe50ddc9dd49bd12 (diff)
linux-gen: event: implement odp_event_is_valid()
Implement the new event validity check function. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
Diffstat (limited to 'platform/linux-generic/odp_event.c')
-rw-r--r--platform/linux-generic/odp_event.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/platform/linux-generic/odp_event.c b/platform/linux-generic/odp_event.c
index 6985a592d..5398442d6 100644
--- a/platform/linux-generic/odp_event.c
+++ b/platform/linux-generic/odp_event.c
@@ -97,3 +97,34 @@ uint64_t odp_event_to_u64(odp_event_t hdl)
{
return _odp_pri(hdl);
}
+
+int odp_event_is_valid(odp_event_t event)
+{
+ odp_buffer_t buf;
+
+ if (event == ODP_EVENT_INVALID)
+ return 0;
+
+ buf = odp_buffer_from_event(event);
+ if (_odp_buffer_is_valid(buf) == 0)
+ return 0;
+
+ switch (odp_event_type(event)) {
+ case ODP_EVENT_BUFFER:
+ /* Fall through */
+ case ODP_EVENT_PACKET:
+ /* Fall through */
+ case ODP_EVENT_TIMEOUT:
+ /* Fall through */
+ case ODP_EVENT_CRYPTO_COMPL:
+ /* Fall through */
+ case ODP_EVENT_IPSEC_STATUS:
+ /* Fall through */
+ case ODP_EVENT_PACKET_VECTOR:
+ break;
+ default:
+ return 0;
+ }
+
+ return 1;
+}