about summary refs log tree commit diff
path: root/pkgs/os-specific
diff options
context:
space:
mode:
authorLassulus <github@lassul.us>2020-01-13 05:54:57 +0100
committerGitHub <noreply@github.com>2020-01-13 05:54:57 +0100
commitbc4921a584cf71b39871eea05ed9735e9e27e821 (patch)
tree9e026f05b0aa8b61787697514117b330c82ba2a8 /pkgs/os-specific
parent2d4f45188d0342c8c992084301e131aa60ed9979 (diff)
parentaf808bd826c54b13a39e6538d7b5b655de0f3ae3 (diff)
downloadnixlib-bc4921a584cf71b39871eea05ed9735e9e27e821.tar
nixlib-bc4921a584cf71b39871eea05ed9735e9e27e821.tar.gz
nixlib-bc4921a584cf71b39871eea05ed9735e9e27e821.tar.bz2
nixlib-bc4921a584cf71b39871eea05ed9735e9e27e821.tar.lz
nixlib-bc4921a584cf71b39871eea05ed9735e9e27e821.tar.xz
nixlib-bc4921a584cf71b39871eea05ed9735e9e27e821.tar.zst
nixlib-bc4921a584cf71b39871eea05ed9735e9e27e821.zip
Merge pull request #73328 from magenbluten/af_xdp
linux config: add support for xdp sockets and ebpf jit
Diffstat (limited to 'pkgs/os-specific')
-rw-r--r--pkgs/os-specific/linux/kernel/common-config.nix14
1 files changed, 13 insertions, 1 deletions
diff --git a/pkgs/os-specific/linux/kernel/common-config.nix b/pkgs/os-specific/linux/kernel/common-config.nix
index 4bd86a702672..4ce6a37e689c 100644
--- a/pkgs/os-specific/linux/kernel/common-config.nix
+++ b/pkgs/os-specific/linux/kernel/common-config.nix
@@ -24,6 +24,13 @@ let
   # configuration items have to be part of a subattrs
   flattenKConf =  nested: mapAttrs (_: head) (zipAttrs (attrValues nested));
 
+  whenPlatformHasEBPFJit =
+    mkIf (stdenv.hostPlatform.isAarch32 ||
+          stdenv.hostPlatform.isAarch64 ||
+          stdenv.hostPlatform.isx86_64 ||
+          (stdenv.hostPlatform.isPowerPC && stdenv.hostPlatform.is64bit) ||
+          (stdenv.hostPlatform.isMips && stdenv.hostPlatform.is64bit));
+
   options = {
 
     debug = {
@@ -106,7 +113,12 @@ let
       IP_DCCP_CCID3      = no; # experimental
       CLS_U32_PERF       = yes;
       CLS_U32_MARK       = yes;
-      BPF_JIT            = mkIf (stdenv.hostPlatform.system == "x86_64-linux") yes;
+      BPF_JIT            = whenPlatformHasEBPFJit yes;
+      BPF_JIT_ALWAYS_ON  = whenPlatformHasEBPFJit yes;
+      HAVE_EBPF_JIT      = whenPlatformHasEBPFJit yes;
+      BPF_STREAM_PARSER  = whenAtLeast "4.19" yes;
+      XDP_SOCKETS        = whenAtLeast "4.19" yes;
+      XDP_SOCKETS_DIAG   = whenAtLeast "4.19" yes;
       WAN                = yes;
       # Required by systemd per-cgroup firewalling
       CGROUP_BPF                  = option yes;