Skip to content

Conversation

ti-mo
Copy link
Contributor

@ti-mo ti-mo commented May 13, 2025

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 the cilium_calls map. Use the __section_entry and __declare_tail() macros to mark programs as their respective types.

Remove iproute2 compatibility code from the bpf loader

@ti-mo ti-mo requested review from a team as code owners May 13, 2025 10:20
@ti-mo ti-mo requested a review from rgo3 May 13, 2025 10:20
@ti-mo ti-mo added the release-note/misc This PR makes changes that have no direct user impact. label May 13, 2025
@ti-mo ti-mo force-pushed the tb/remove-ip2-compat branch from 2ecee32 to 8bfecf6 Compare May 13, 2025 10:24
@ti-mo ti-mo requested a review from a team as a code owner May 13, 2025 10:24
@ti-mo ti-mo requested a review from bimmlerd May 13, 2025 10:24
@ti-mo
Copy link
Contributor Author

ti-mo commented May 13, 2025

/test

Copy link
Member

@dylandreimerink dylandreimerink left a 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

Copy link
Member

@YutaroHayakawa YutaroHayakawa left a 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.

@ti-mo ti-mo force-pushed the tb/remove-ip2-compat branch from 8bfecf6 to e234ba9 Compare May 15, 2025 15:29
@ti-mo
Copy link
Contributor Author

ti-mo commented May 15, 2025

/test

ti-mo added 5 commits May 19, 2025 10:16
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>
@ti-mo ti-mo force-pushed the tb/remove-ip2-compat branch from e234ba9 to 314a2b9 Compare May 19, 2025 08:16
@ti-mo
Copy link
Contributor Author

ti-mo commented May 19, 2025

/test

Copy link
Contributor

@rgo3 rgo3 left a 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!

@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label May 19, 2025
@ti-mo ti-mo added this pull request to the merge queue May 19, 2025
Merged via the queue into cilium:main with commit f31d3ba May 19, 2025
67 checks passed
@ti-mo ti-mo deleted the tb/remove-ip2-compat branch May 19, 2025 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants