提交 f4ce0a01 编写于 作者: J Jesper Dangaard Brouer 提交者: David S. Miller

samples/bpf: xdp_monitor first 8 bytes are not accessible by bpf

The first 8 bytes of the tracepoint context struct are not accessible
by the bpf code.  This is a choice that dates back to the original
inclusion of this code.

See explaination in:
 commit 98b5c2c6 ("perf, bpf: allow bpf programs attach to tracepoints")
Signed-off-by: NJesper Dangaard Brouer <brouer@redhat.com>
Acked-by: NAlexei Starovoitov <ast@kernel.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 c6a15752
......@@ -17,19 +17,15 @@ struct bpf_map_def SEC("maps") redirect_err_cnt = {
* Code in: kernel/include/trace/events/xdp.h
*/
struct xdp_redirect_ctx {
unsigned short common_type; // offset:0; size:2; signed:0;
unsigned char common_flags; // offset:2; size:1; signed:0;
unsigned char common_preempt_count;// offset:3; size:1; signed:0;
int common_pid; // offset:4; size:4; signed:1;
int prog_id; // offset:8; size:4; signed:1;
u32 act; // offset:12 size:4; signed:0;
int ifindex; // offset:16 size:4; signed:1;
int err; // offset:20 size:4; signed:1;
int to_ifindex; // offset:24 size:4; signed:1;
u32 map_id; // offset:28 size:4; signed:0;
int map_index; // offset:32 size:4; signed:1;
}; // offset:36
u64 __pad; // First 8 bytes are not accessible by bpf code
int prog_id; // offset:8; size:4; signed:1;
u32 act; // offset:12 size:4; signed:0;
int ifindex; // offset:16 size:4; signed:1;
int err; // offset:20 size:4; signed:1;
int to_ifindex; // offset:24 size:4; signed:1;
u32 map_id; // offset:28 size:4; signed:0;
int map_index; // offset:32 size:4; signed:1;
}; // offset:36
enum {
XDP_REDIRECT_SUCCESS = 0,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册