blob: f96a80e99a3b3e67728dbbb6be785f51e8e5a65f (
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) 2013-2018, 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 <sys/types.h>
#include <odp/api/event.h>
#include <odp_forward_typedefs_internal.h>
#include <odp_schedule_if.h>
#include <stddef.h>
/* DPDK */
#include <rte_config.h>
#include <rte_mbuf.h>
ODP_STATIC_ASSERT(CONFIG_PACKET_SEG_LEN_MIN >= 256,
"ODP Segment size must be a minimum of 256 bytes");
ODP_STATIC_ASSERT(CONFIG_PACKET_MAX_SEGS < 256,
"Maximum of 255 segments supported");
struct odp_buffer_hdr_t {
/* Underlying DPDK rte_mbuf */
struct rte_mbuf mb;
/* Buffer index in the pool */
uint32_t index;
/* Total size of all allocated segs */
uint32_t totsize;
/* Pool type */
int8_t type;
/* Event type. Maybe different than pool type (crypto compl event) */
int8_t event_type;
/* --- Mostly read only data --- */
const void *user_ptr;
/* Pool pointer */
void *pool_ptr;
};
int odp_buffer_snprint(char *str, uint32_t n, odp_buffer_t buf);
/*
* Buffer type
*
* @param buf Buffer handle
*
* @return Buffer type
*/
int _odp_buffer_type(odp_buffer_t buf);
/*
* Buffer type set
*
* @param buf Buffer handle
* @param type New type value
*
*/
void _odp_buffer_type_set(odp_buffer_t buf, int type);
static inline struct rte_mbuf *buf_to_mbuf(odp_buffer_t buf)
{
return (struct rte_mbuf *)(uintptr_t)buf;
}
static inline odp_buffer_hdr_t *mbuf_to_buf_hdr(struct rte_mbuf *mbuf)
{
return (odp_buffer_hdr_t *)(uintptr_t)mbuf;
}
#ifdef __cplusplus
}
#endif
#endif
|