blob: cbe6d960b3deb9aa275e5f018f53ede4efa92eab (
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
|
/* Copyright (c) 2021-2023, 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/event.h>
#include <odp/api/pool_types.h>
#include <stdint.h>
/* DPDK */
#include <rte_config.h>
#if defined(__clang__)
#undef RTE_TOOLCHAIN_GCC
#endif
#include <rte_mbuf.h>
/* ppc64 rte_memcpy.h (included through rte_mbuf.h) may define vector */
#if defined(__PPC64__) && defined(vector)
#undef vector
#endif
typedef struct _odp_event_hdr_int_t {
/* Pool handle */
odp_pool_t pool;
/* Buffer index in the pool */
uint32_t index;
/* Pool type */
int8_t type;
/* Event type. Maybe different than pool type (crypto compl event) */
int8_t event_type;
/* Event subtype */
int8_t subtype;
/* Event flow id */
uint8_t flow_id;
} _odp_event_hdr_int_t;
/* Common header for all event types. Helper for casting, actual pool element types should begin
* with explicit struct rte_mbuf and _odp_event_hdr_int_t fields. */
typedef struct ODP_ALIGNED_CACHE _odp_event_hdr_t {
/* Underlying DPDK rte_mbuf */
struct rte_mbuf mb;
/* Common internal header */
_odp_event_hdr_int_t hdr;
} _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 odp_event_t _odp_event_from_mbuf(struct rte_mbuf *mbuf)
{
return (odp_event_t)(uintptr_t)mbuf;
}
static inline struct rte_mbuf *_odp_event_to_mbuf(odp_event_t event)
{
return (struct rte_mbuf *)(uintptr_t)event;
}
static inline void _odp_event_type_set(odp_event_t event, int ev)
{
_odp_event_hdr(event)->hdr.event_type = ev;
}
static inline uint64_t *_odp_event_endmark_get_ptr(odp_event_t event)
{
struct rte_mbuf *mbuf = _odp_event_to_mbuf(event);
return (uint64_t *)((uint8_t *)mbuf->buf_addr + mbuf->buf_len);
}
#ifdef __cplusplus
}
#endif
#endif
|