-
Martin KaFai Lau authored
For BPF_PROG_TYPE_SCHED_CLS/ACT, the upstream kernel has recently added a feature to efficiently output skb + meta data: commit 555c8a8623a3 ("bpf: avoid stack copy and use skb ctx for event output") This patch adds perf_submit_skb to BPF_PERF_OUTPUT macro. It takes an extra u32 argument. perf_submit_skb will then be expanded to bpf_perf_event_output properly to consider the newly added u32 argument as the skb's len. Other than the above described changes, perf_submit_skb is almost a carbon copy of the perf_submit except the removal of the 'string name' variable since I cannot find a specific use of it. Note that the 3rd param type of bpf_perf_event_output has also been changed from u32 to u64. Added a sample program tc_perf_event.py. Here is how the output looks like: [root@arch-fb-vm1 networking]# ./tc_perf_event.py Try: "ping -6 ff02::1%me" CPU SRC IP DST IP Magic 0 fe80::982f:5dff:fec1:e52b ff02::1 0xfaceb00c 0 fe80::982f:5dff:fec1:e52b ff02::1 0xfaceb00c 0 fe80::982f:5dff:fec1:e52b ff02::1 0xfaceb00c 1 fe80::982f:5dff:fec1:e52b ff02::1 0xfaceb00c 1 fe80::982f:5dff:fec1:e52b ff02::1 0xfaceb00c 1 fe80::982f:5dff:fec1:e52b ff02::1 0xfaceb00c
bdad3840