blob: b52669387bdf455431685cf835d6c9593343885d (
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
/* Copyright (c) 2013, Linaro Limited
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/**
* @file
*
* ODP buffer descriptor - implementation internal
*/
#ifndef ODP_BUFFER_INTERNAL_H_
#define ODP_BUFFER_INTERNAL_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <odp/api/std_types.h>
#include <odp/api/atomic.h>
#include <odp/api/pool.h>
#include <odp/api/buffer.h>
#include <odp/api/debug.h>
#include <odp/api/align.h>
#include <odp_align_internal.h>
#include <odp_config_internal.h>
#include <odp/api/byteorder.h>
#include <odp/api/thread.h>
#include <odp/api/event.h>
#include <odp_forward_typedefs_internal.h>
#include <odp_schedule_if.h>
#include <stddef.h>
#define BUFFER_BURST_SIZE CONFIG_BURST_SIZE
typedef struct seg_entry_t {
void *hdr;
uint8_t *data;
uint32_t len;
} seg_entry_t;
/* Common buffer header */
struct ODP_ALIGNED_CACHE odp_buffer_hdr_t {
/* Buffer index in the pool */
uint32_t index;
/* Total segment count */
uint16_t segcount;
/* Pool type */
int8_t type;
/* Number of seg[] entries used */
uint8_t num_seg;
/* Next header which continues the segment list */
void *next_seg;
/* Last header of the segment list */
void *last_seg;
/* Initial buffer data pointer */
uint8_t *base_data;
/* Pool pointer */
void *pool_ptr;
/* --- 40 bytes --- */
/* Segments */
seg_entry_t seg[CONFIG_PACKET_SEGS_PER_HDR];
/* Burst counts */
uint8_t burst_num;
uint8_t burst_first;
/* Next buf in a list */
struct odp_buffer_hdr_t *next;
/* Burst table */
struct odp_buffer_hdr_t *burst[BUFFER_BURST_SIZE];
/* --- Mostly read only data --- */
/* User context pointer or u64 */
union {
uint64_t buf_u64;
void *buf_ctx;
const void *buf_cctx; /* const alias for ctx */
};
/* Reference count */
odp_atomic_u32_t ref_cnt;
/* Event type. Maybe different than pool type (crypto compl event) */
int8_t event_type;
/* Initial buffer tail pointer */
uint8_t *buf_end;
/* User area pointer */
void *uarea_addr;
/* ipc mapped process can not walk over pointers,
* offset has to be used */
uint64_t ipc_data_offset;
/* Data or next header */
uint8_t data[0];
};
ODP_STATIC_ASSERT(CONFIG_PACKET_SEGS_PER_HDR < 256,
"CONFIG_PACKET_SEGS_PER_HDR_TOO_LARGE");
ODP_STATIC_ASSERT(BUFFER_BURST_SIZE < 256, "BUFFER_BURST_SIZE_TOO_LARGE");
#ifdef __cplusplus
}
#endif
#endif
|