blob: 4882e92dfa827530b2ef83442454dc38ad393fdd (
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
|
/* Copyright (c) 2017-2018, Linaro Limited
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/**
* @file
*
* Packet flag inline functions
*/
#ifndef _ODP_PLAT_PACKET_FLAG_INLINES_H_
#define _ODP_PLAT_PACKET_FLAG_INLINES_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <odp/api/abi/packet.h>
#include <odp/api/plat/packet_inline_types.h>
/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
extern const _odp_packet_inline_offset_t _odp_packet_inline;
static inline uint64_t _odp_packet_input_flags(odp_packet_t pkt)
{
return _odp_pkt_get(pkt, uint64_t, input_flags);
}
#ifndef _ODP_NO_INLINE
/* Inline functions by default */
#define _ODP_INLINE static inline
#define odp_packet_has_l2 __odp_packet_has_l2
#define odp_packet_has_eth __odp_packet_has_eth
#define odp_packet_has_jumbo __odp_packet_has_jumbo
#define odp_packet_has_flow_hash __odp_packet_has_flow_hash
#define odp_packet_has_flow_hash_clr __odp_packet_has_flow_hash_clr
#define odp_packet_has_ts __odp_packet_has_ts
#define odp_packet_has_ipsec __odp_packet_has_ipsec
#else
#undef _ODP_INLINE
#define _ODP_INLINE
#endif
_ODP_INLINE int odp_packet_has_l2(odp_packet_t pkt)
{
_odp_packet_input_flags_t flags;
flags.all = _odp_packet_input_flags(pkt);
return flags.l2;
}
_ODP_INLINE int odp_packet_has_eth(odp_packet_t pkt)
{
_odp_packet_input_flags_t flags;
flags.all = _odp_packet_input_flags(pkt);
return flags.eth;
}
_ODP_INLINE int odp_packet_has_jumbo(odp_packet_t pkt)
{
_odp_packet_input_flags_t flags;
flags.all = _odp_packet_input_flags(pkt);
return flags.jumbo;
}
_ODP_INLINE int odp_packet_has_flow_hash(odp_packet_t pkt)
{
return !!(_odp_pkt_get(pkt, uint64_t, ol_flags) & _odp_packet_inline.rss_flag);
}
_ODP_INLINE void odp_packet_has_flow_hash_clr(odp_packet_t pkt)
{
uint64_t *ol_flags = &_odp_pkt_get(pkt, uint64_t, ol_flags);
*ol_flags &= ~_odp_packet_inline.rss_flag;
}
_ODP_INLINE int odp_packet_has_ts(odp_packet_t pkt)
{
_odp_packet_input_flags_t flags;
flags.all = _odp_packet_input_flags(pkt);
return flags.timestamp;
}
_ODP_INLINE int odp_packet_has_ipsec(odp_packet_t pkt)
{
_odp_packet_input_flags_t flags;
flags.all = _odp_packet_input_flags(pkt);
return flags.ipsec;
}
/** @endcond */
#ifdef __cplusplus
}
#endif
#endif
|