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 98b5c2c65c ("perf, bpf: allow bpf programs attach to tracepoints")

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jesper Dangaard Brouer 2017-10-06 10:41:41 +02:00 коммит произвёл David S. Miller
Родитель c6a157525b
Коммит f4ce0a0116
1 изменённых файлов: 9 добавлений и 13 удалений

Просмотреть файл

@ -17,11 +17,7 @@ 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;
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;