summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/xdp_metadata.h
blob: 87318ad1117a1d677af121f11778178532e2a562 (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
/* SPDX-License-Identifier: GPL-2.0 */
#pragma once

#ifndef ETH_P_IP
#define ETH_P_IP 0x0800
#endif

#ifndef ETH_P_IPV6
#define ETH_P_IPV6 0x86DD
#endif

#ifndef ETH_P_8021Q
#define ETH_P_8021Q 0x8100
#endif

#ifndef ETH_P_8021AD
#define ETH_P_8021AD 0x88A8
#endif

#ifndef BIT
#define BIT(nr)			(1 << (nr))
#endif

/* Non-existent checksum status */
#define XDP_CHECKSUM_MAGIC	BIT(2)

enum xdp_meta_field {
	XDP_META_FIELD_TS	= BIT(0),
	XDP_META_FIELD_RSS	= BIT(1),
	XDP_META_FIELD_VLAN_TAG	= BIT(2),
};

struct xdp_meta {
	union {
		__u64 rx_timestamp;
		__s32 rx_timestamp_err;
	};
	__u64 xdp_timestamp;
	__u32 rx_hash;
	union {
		__u32 rx_hash_type;
		__s32 rx_hash_err;
	};
	union {
		struct {
			__be16 rx_vlan_proto;
			__u16 rx_vlan_tci;
		};
		__s32 rx_vlan_tag_err;
	};
	enum xdp_meta_field hint_valid;
};