Skip to content
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

bpf: dynamic-width static data inlining #25195

Merged
merged 3 commits into from
May 5, 2023

Commits on May 3, 2023

  1. bpf/lib: sync endian.h with upstream

    Missing bpf_cpu_to_be64 for follow-up commit.
    
    Signed-off-by: Timo Beckers <timo@isovalent.com>
    ti-mo committed May 3, 2023
    Configuration menu
    Copy the full SHA
    22fb40b View commit details
    Browse the repository at this point in the history
  2. datapath,elf: support 64-bit ELF substitutions

    This patch adds support for 64-bit wide ELF substitutions, to be used in
    a follow-up patch.
    
    Signed-off-by: Timo Beckers <timo@isovalent.com>
    ti-mo committed May 3, 2023
    Configuration menu
    Copy the full SHA
    2765086 View commit details
    Browse the repository at this point in the history

Commits on May 4, 2023

  1. bpf: dynamic-width static data inlining

    Historically, the largest data type used for declaring global data was uint32.
    Cilium's iproute2 fork had patches that made the assumption all values are
    32 bits, so this behaviour was replicated when it was ported to Go. This only
    works well if the largest variable emitted to .data is 32 bits wide. Any
    smaller and the section's alignment would drop, causing the inliner to read
    part of the next variable. Any larger and only part of a u64 would be read.
    
    Since we now no longer rely on iproute2 for loading any ELFs, we can start
    changing the way this works. In Go, we have access to .data's BTF Datasec,
    so we can be a bit smarter about it and detect how wide each variable is,
    so we can accurately copy out the bits needed.
    
    This patch introduces a uint64 global data macro, DEFINE_U64, and updates
    DEFINE_IPV6 to use it. This cuts down on the amount of instructions needed
    to carry ipv6 values in the instruction stream from 8 to 4.
    
    Signed-off-by: Timo Beckers <timo@isovalent.com>
    ti-mo committed May 4, 2023
    Configuration menu
    Copy the full SHA
    e655805 View commit details
    Browse the repository at this point in the history