summaryrefslogtreecommitdiffstats
path: root/xdp-dump/xdpdump.h
blob: d4eaef233c8c118b9ea3c7afdd746fe43ee058e0 (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
// SPDX-License-Identifier: GPL-2.0

/******************************************************************************
 * Multiple include protection
 ******************************************************************************/
#ifndef _XDPDUMP_H_
#define _XDPDUMP_H_

/******************************************************************************
 * General definitions
 ******************************************************************************/
#define PERF_MAX_WAKEUP_EVENTS   64
#define PERF_MMAP_PAGE_COUNT	256
#define MAX_CPUS		256

/******************************************************************************
 * General used macros
 ******************************************************************************/
#ifndef __packed
#define __packed __attribute__((packed))
#endif

/*****************************************************************************
 * trace configuration structure
 *****************************************************************************/
struct trace_configuration {
	__u32 capture_if_ifindex;
	__u32 capture_snaplen;
	__u32 capture_prog_index;
};

/*****************************************************************************
 * perf data structures
 *****************************************************************************/
#define MDF_DIRECTION_FEXIT 1

struct pkt_trace_metadata {
	__u32 ifindex;
	__u32 rx_queue;
	__u16 pkt_len;
	__u16 cap_len;
	__u16 flags;
	__u16 prog_index;
	int   action;
} __packed;

#ifndef __bpf__
struct perf_sample_event {
	struct perf_event_header header;
	__u64 time;
	__u32 size;
	struct pkt_trace_metadata metadata;
	unsigned char packet[];
};

struct perf_lost_event {
	struct perf_event_header header;
	__u64 id;
	__u64 lost;
};
#endif

/******************************************************************************
 * End-of include file
 ******************************************************************************/
#endif /* _XDPDUMP_H_ */