aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/include/odp/api/plat/packet_flag_inlines.h
blob: 6eb34a39bd684d05a24712f57c61454e47a858bf (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
/* Copyright (c) 2017-2018, Linaro Limited
 * All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

/**
 * @file
 *
 * Packet inline functions
 */

#ifndef _ODP_PLAT_PACKET_FLAG_INLINES_H_
#define _ODP_PLAT_PACKET_FLAG_INLINES_H_

#include <odp/api/abi/packet_types.h>
#include <odp/api/plat/packet_inline_types.h>
#include <odp/api/hints.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_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)
{
	_odp_packet_input_flags_t flags;

	flags.all = _odp_packet_input_flags(pkt);
	return flags.flow_hash;
}

_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 */

#endif