blob: d8cc0051b80c7c773e2508478bb646aa843aba9b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
/* Copyright (c) 2015, Linaro Limited
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "config.h"
#include <odp/api/event.h>
#include <odp/api/buffer.h>
#include <odp/api/crypto.h>
#include <odp/api/packet.h>
#include <odp/api/timer.h>
#include <odp/api/pool.h>
#include <odp_buffer_internal.h>
#include <odp_ipsec_internal.h>
#include <odp_buffer_inlines.h>
#include <odp_debug_internal.h>
#include <odp_packet_internal.h>
odp_event_type_t odp_event_type(odp_event_t event)
{
return _odp_buffer_event_type(odp_buffer_from_event(event));
}
odp_event_subtype_t odp_event_subtype(odp_event_t event)
{
if (_odp_buffer_event_type(odp_buffer_from_event(event)) !=
ODP_EVENT_PACKET)
return ODP_EVENT_NO_SUBTYPE;
return packet_subtype(odp_packet_from_event(event));
}
odp_event_type_t odp_event_types(odp_event_t event,
odp_event_subtype_t *subtype)
{
odp_buffer_t buf = odp_buffer_from_event(event);
odp_event_type_t event_type = _odp_buffer_event_type(buf);
*subtype = event_type == ODP_EVENT_PACKET ?
packet_subtype(odp_packet_from_event(event)) :
ODP_EVENT_NO_SUBTYPE;
return event_type;
}
int odp_event_type_multi(const odp_event_t event[], int num,
odp_event_type_t *type_out)
{
int i;
odp_event_type_t type = odp_event_type(event[0]);
for (i = 1; i < num; i++) {
if (odp_event_type(event[i]) != type)
break;
}
*type_out = type;
return i;
}
void odp_event_free(odp_event_t event)
{
switch (odp_event_type(event)) {
case ODP_EVENT_BUFFER:
odp_buffer_free(odp_buffer_from_event(event));
break;
case ODP_EVENT_PACKET:
odp_packet_free(odp_packet_from_event(event));
break;
case ODP_EVENT_TIMEOUT:
odp_timeout_free(odp_timeout_from_event(event));
break;
case ODP_EVENT_CRYPTO_COMPL:
odp_crypto_compl_free(odp_crypto_compl_from_event(event));
break;
case ODP_EVENT_IPSEC_STATUS:
_odp_ipsec_status_free(_odp_ipsec_status_from_event(event));
break;
default:
ODP_ABORT("Invalid event type: %d\n", odp_event_type(event));
}
}
void odp_event_free_multi(const odp_event_t event[], int num)
{
int i;
for (i = 0; i < num; i++)
odp_event_free(event[i]);
}
void odp_event_free_sp(const odp_event_t event[], int num)
{
odp_event_free_multi(event, num);
}
uint64_t odp_event_to_u64(odp_event_t hdl)
{
return _odp_pri(hdl);
}
|