Re: [PATCH bpf-next v3 1/2] bpf, sockmap: Introduce tracing capability for sockmap
From: Cong Wang
Date: Thu Apr 17 2025 - 14:53:15 EST
On Tue, Apr 15, 2025 at 12:11:45AM +0800, Jiayuan Chen wrote:
> Sockmap has the same high-performance forwarding capability as XDP, but
> operates at Layer 7.
>
> Introduce tracing capability for sockmap, to trace the execution results
> of BPF programs without modifying the programs themselves, similar to
> the existing trace_xdp_redirect{_map}.
>
> It is crucial for debugging sockmap programs, especially in production
> environments.
>
> Additionally, the new header file has to be added to bpf_trace.h to
> automatically generate tracepoints.
>
> Test results:
> $ echo "1" > /sys/kernel/tracing/events/sockmap/enable
>
> msg/skb:
> '''
> sockmap_redirect: sk=000000000ec02a93, netns=4026531840, inode=318, \
> family=2, protocol=6, prog_id=59, len=8192, type=msg, action=REDIRECT, \
> redirect_type=ingress
>
> sockmap_redirect: sk=00000000d5d9c931, netns=4026531840, inode=64731, \
> family=2, protocol=6, prog_id=91, len=8221, type=skb, action=REDIRECT, \
> redirect_type=egress
>
> sockmap_redirect: sk=00000000106fc281, netns=4026531840, inode=64729, \
> family=2, protocol=6, prog_id=94, len=8192, type=msg, action=PASS, \
> redirect_type=none
> '''
>
> strparser:
> '''
> sockmap_strparser: sk=00000000f15fc1c8, netns=4026531840, inode=52396, \
> family=2, protocol=6, prog_id=143, in_len=1000, full_len=10
> '''
>
> Suggested-by: Jakub Sitnicki <jakub@xxxxxxxxxxxxxx>
> Suggested-by: Cong Wang <xiyou.wangcong@xxxxxxxxx>
> Suggested-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
> Signed-off-by: Jiayuan Chen <jiayuan.chen@xxxxxxxxx>
>
Reviewed-by: Cong Wang <xiyou.wangcong@xxxxxxxxx>
Thanks!