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

Extend K8sVerifier to maximize program sizes on 4.19 and net-next kernels #14451

Merged
merged 6 commits into from Jan 25, 2021

Commits on Jan 22, 2021

  1. bpf: Compile test with tunneling disabled

    On the datapath side, we often rely on ENCAP_IFINDEX to check if
    tunneling mode is enabled (in which case the macro is defined). This
    macro is defined in our test header files and therefore never compile
    tested.
    
    This commit removes it from the test header files and adds it to the
    Makefile targets to be compile tested. This is also needed to be able to
    load the generated bpf_xdp programs. If the ENCAP_IFINDEX macro is
    always defined, then bpf_xdp programs are compiled with calls to the
    ctx_{get,set}_tunnel_key BPF helpers, which don't exist for the XDP hook.
    
    Signed-off-by: Paul Chaignon <paul@cilium.io>
    pchaigno committed Jan 22, 2021
    Configuration menu
    Copy the full SHA
    3ea1af6 View commit details
    Browse the repository at this point in the history
  2. bpf: Refactor MAX_*_OPTIONS and enable more options

    The NAT46 change in node_config.h is required to define CONNTRACK is
    ENABLE_NAT46 is defined. This wasn't previously required because
    ENABLE_NAT46 was only defined for bpf_xxx files that have CONNTRACK
    defined in their own header file (e.g., ep_config.h).
    
    Signed-off-by: Paul Chaignon <paul@cilium.io>
    pchaigno committed Jan 22, 2021
    Configuration menu
    Copy the full SHA
    ba65fb7 View commit details
    Browse the repository at this point in the history
  3. bpf: Maximize compiled program size for each kernel

    The make target for the BPF programs takes a KERNEL environment variable.
    This variable is used to try and maximize the program size for each
    kernel, by enabling as many features as possible. This new environment
    variable is also used in the existing K8sVerifier test.
    
    Signed-off-by: Paul Chaignon <paul@cilium.io>
    pchaigno committed Jan 22, 2021
    Configuration menu
    Copy the full SHA
    93d6b71 View commit details
    Browse the repository at this point in the history
  4. bpf: Fix compile-tested macros used in is_defined

    In the datapath, we have two ways to check if a macro is defined:
    the usual defined()/#ifdef and is_defined(). The later is often used in
    C predicates or in tail call conditions. It expects the macro to be
    defined with a value, typically #define ENABLE_FEATURE_X 1. Without this
    non-zero value, is_defined(ENABLE_FEATURE_X) returns false.
    
    The list of macros that are used in is_defined can be extracted with
    the following command:
    
        git grep -hoP "(?<=is_defined\()[_A-Z0-9]+" bpf/ | sort | uniq
    
    Nevertheless, in this commit, to prevent mistakes in future addition,
    I've added a value to all macros. This is automatically achieved by
    replacing ':' by '=1 ' instead of just a space. It however requires that
    all macros be followed by ':'.
    
    Signed-off-by: Paul Chaignon <paul@cilium.io>
    pchaigno committed Jan 22, 2021
    Configuration menu
    Copy the full SHA
    eeab26d View commit details
    Browse the repository at this point in the history
  5. bpf: Compile test object files with same mcpu as cilium-agent

    When compiling our datapath (base and endpoint's), cilium-agent selects
    mcpu=v1 or v2 depending on the kernel version. Up until now, the object
    files generated for test-verifier.sh had mcpu=probe. This commit changes
    it to match what cilium-agent does.
    
    Signed-off-by: Paul Chaignon <paul@cilium.io>
    pchaigno committed Jan 22, 2021
    Configuration menu
    Copy the full SHA
    1431a7d View commit details
    Browse the repository at this point in the history
  6. bpf: Define ENABLE_HOST_SERVICES_FULL in verifier tests

    If ENABLE_HOST_SERVICES_FULL is undefined, additional code is compiled
    in our datapath, leading us to run into known complexity issue #14234.
    We only need to work around this issue on the latest kernels.
    
    Signed-off-by: Paul Chaignon <paul@cilium.io>
    pchaigno committed Jan 22, 2021
    Configuration menu
    Copy the full SHA
    1a59e53 View commit details
    Browse the repository at this point in the history