-
Notifications
You must be signed in to change notification settings - Fork 3.4k
bpf: mark tail calls using __declare_tail, remove iproute2 compat code #39510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
2ecee32
to
8bfecf6
Compare
/test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one sparks joy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! One nit.
8bfecf6
to
e234ba9
Compare
/test |
cilium_calls was the last map on the deprecated bpf_elf_map format. This patch converts the map definition to BTF and replaces the __section_tail macro with __declare_tail that implicitly uses cilium_calls, as it was only calls map left that was populated statically from the ELF. Drop reasons were moved out to drop_reasons.h to avoid including common.h from lib/tailcall.h, which would otherwise need a tc or xdp context defined. skb.h and xdp.h no longer declare __section_entry directly; instead, they now declare a common section name stem for other macros to use, like __declare_tail. Make sure a context header is included before tailcall.h to avoid ending up with the macro name in the section name like PROG_TYPE/tail. Signed-off-by: Timo Beckers <timo@isovalent.com>
common.h imports tailcall.h, which now requires a program type to be chosen before importing the header to avoid ending up with a section name like PROG_TYPE/entry. In many cases, the amount of explicit imports was slightly reduced and made more consistent. Signed-off-by: Timo Beckers <timo@isovalent.com>
…entry This was always meant as an off-ramp from the iproute2 loader, so now this code no longer needs to be there. Explicitly specify a type on every program. Remove the classifyProgramTypes helper in favor of a check with a helpful error message suggesting the right macros to use. Signed-off-by: Timo Beckers <timo@isovalent.com>
Since ebpf-go 1.17, the library automatically resizes the log buffer when needed. This test should've been removed during the upgrade. Signed-off-by: Timo Beckers <timo@isovalent.com>
…l tags This commit removes the venerable ip2 compat code. The new conventions are: - {tc,xdp}/entry section marks bpf entry points or mocked tail calls in bpf tests - {tc,xdp}/tail section marks tail calls to be inserted into cilium_calls - The tail:cilium_calls/<slot> decl tag format is now used to specify which slot the tail call is inserted to after loading The prior commits got the bpf C code base in shape to conform to these conventions. Signed-off-by: Timo Beckers <timo@isovalent.com>
e234ba9
to
314a2b9
Compare
/test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thank you!
Some highlights:
cilium_calls was the last map on the deprecated bpf_elf_map format. This patch converts the map definition to BTF and replaces the __section_tail macro with __declare_tail that implicitly uses cilium_calls, as it was only calls map left that was populated statically from the ELF.
The datapath now requires a program type to be chosen before importing the header to avoid ending up with a section name like PROG_TYPE/entry. The loader now rejects any programs of unspecified type. The loader used to pick one based on a 🪄 heuristic 🪄 (it was the object file name..).
Entrypoints now go into the
{tc,xdp}/entry
sections, tail calls go into the{tc,xdp}/tail
sections, and decl tags are used for specifying their slot in thecilium_calls
map. Use the__section_entry
and__declare_tail()
macros to mark programs as their respective types.