blob: 4bc28d70835abe8b17a8e971d4dd69a293cf79f6 (
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
|
/* Copyright (c) 2021-2022, Nokia
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/**
* @file
*
* ODP event descriptor - implementation internal
*/
#ifndef ODP_EVENT_INTERNAL_H_
#define ODP_EVENT_INTERNAL_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <odp/api/debug.h>
#include <odp/api/event.h>
#include <odp/api/pool_types.h>
#include <odp/api/std_types.h>
#include <odp_config_internal.h>
/* Combined pool and event index */
typedef union _odp_event_index_t {
uint32_t u32;
struct {
uint32_t pool :8;
uint32_t event :24;
};
} _odp_event_index_t;
/* Check that pool index fit into bit field */
ODP_STATIC_ASSERT(ODP_CONFIG_POOLS <= (0xFF + 1), "TOO_MANY_POOLS");
/* Check that buffer index fit into bit field */
ODP_STATIC_ASSERT(CONFIG_POOL_MAX_NUM <= (0xFFFFFF + 1), "TOO_LARGE_POOL");
/* Type size limits number of flow IDs supported */
#define BUF_HDR_MAX_FLOW_ID 255
/* Common header for all event types without alignment constraints. */
typedef struct _odp_event_hdr_t {
/* Initial buffer data pointer */
uint8_t *base_data;
/* Pool handle */
odp_pool_t pool;
/* --- Mostly read only data --- */
/* Initial buffer tail pointer and endmark location (if enabled) */
uint8_t *buf_end;
/* Combined pool and event index */
_odp_event_index_t index;
/* Pool type */
int8_t type;
/* Event type. Maybe different than pool type (crypto compl event) */
int8_t event_type;
/* Event flow id */
uint8_t flow_id;
} _odp_event_hdr_t;
static inline odp_event_t _odp_event_from_hdr(_odp_event_hdr_t *hdr)
{
return (odp_event_t)hdr;
}
static inline _odp_event_hdr_t *_odp_event_hdr(odp_event_t event)
{
return (_odp_event_hdr_t *)(uintptr_t)event;
}
static inline void _odp_event_type_set(odp_event_t event, int ev)
{
_odp_event_hdr(event)->event_type = ev;
}
static inline uint64_t *_odp_event_endmark_get_ptr(odp_event_t event)
{
return (uint64_t *)(uintptr_t)_odp_event_hdr(event)->buf_end;
}
#ifdef __cplusplus
}
#endif
#endif
|