Skip to content

Unify datapath configuration infrastructure #30893

@ti-mo

Description

@ti-mo

There are currently multiple ways of configuring the datapath:

  • C macros written into node_config.h, ep_config.h and friends, baked into the bytecode by the compiler. Mostly used for #ifdef feature flags and datapath configurables present since the old days.
  • global vars overwritten at runtime using ELF substitutions, to be inlined into bytecode later
  • DEFINE_* macros declaring vars with some default value that may or may not be substituted at runtime, yet these are inlined into the bytecode by inlineGlobalData()! Hence, a combination of the above.

This issue is for establishing a single, understandable mechanism for configuring the datapath, and providing way for us to enforce some ground rules on how datapath config should look. This is already partially underway, see the new DECLARE_CONFIG and CONFIG macros, but on the userspace side, not much has been done to enable passing config values at load time.

Currently, a few DECLARE_CONFIG and ASSIGN_CONFIG macros are rendered into node_config.h and friends at compile time using Go code. This needs to be split: DECLARE_CONFIG declares a static volatile and such statements should be moved to normal headers.

ASSIGN_CONFIG should only be used from bpf tests; instead, these variables should be injected at runtime. This does not require any changes to where these values are used, just needs infrastructure added to the loader pipeline.

Edit: Paul has done some leg work on documenting many of the configurables in the datapath: #15379 (comment).

Metadata

Metadata

Assignees

Labels

area/datapathImpacts bpf/ or low-level forwarding details, including map management and monitor messages.area/loaderImpacts the loading of BPF programs into the kernel.kind/enhancementThis would improve or streamline existing functionality.pinnedThese issues are not marked stale by our issue bot.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions