aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-dpdk/include/odp/api/plat/packet_flags_inlines.h
blob: 03d9e0c4a3a665a6f9a6e3c39d4e42f0fa9fec59 (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
/* Copyright (c) 2016, Linaro Limited
 * All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

/**
 * @file
 *
 * ODP packet flags inline functions
 */

#ifndef ODP_PLAT_PACKET_FLAGS_INLINES_H_
#define ODP_PLAT_PACKET_FLAGS_INLINES_H_

#ifdef __cplusplus
extern "C" {
#endif

/** @internal Inline function offsets */
extern const _odp_packet_inline_offset_t _odp_packet_inline;

/*
 * NOTE: These functions are inlined because they are on a performance hot path.
 * As we can't force the application to directly include DPDK headers we have to
 * export these fields through constants calculated compile time in
 * odp_packet.c, where we can see the DPDK definitions.
 *
 */
_ODP_INLINE int odp_packet_has_flow_hash(odp_packet_t pkt)
{
	return *(uint64_t *)((char *)pkt + _odp_packet_inline.ol_flags) &
					   _odp_packet_inline.rss_flag;
}

_ODP_INLINE void odp_packet_has_flow_hash_clr(odp_packet_t pkt)
{
	*(uint64_t *)((char *)pkt + _odp_packet_inline.ol_flags) &=
				    ~_odp_packet_inline.rss_flag;
}

#ifdef __cplusplus
}
#endif

#endif /* ODP_PLAT_PACKET_FLAGS_INLINES_H_ */