From 2429853e71c824b2c5250766aa04477fd0c2b3c8 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 00:50:46 +0000 Subject: [PATCH 001/163] build(nix): introduce nix build system The goal of this series of commits is to migrate functionality from dpdk-sys (and give it a much needed refactor in the process). More specifically, this series of commits is intended to get the project to the point where you can do a sterile build of DPDK with the correct set of CFLAGS/LDFLAGS in both the debug and release profiles. Forming that build into a sysroot which can actually replace dpdk-sys will be left as future work. Signed-off-by: Daniel Noland --- nix/overlays/dataplane.nix | 1 + 1 file changed, 1 insertion(+) create mode 100644 nix/overlays/dataplane.nix diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix new file mode 100644 index 000000000..307698934 --- /dev/null +++ b/nix/overlays/dataplane.nix @@ -0,0 +1 @@ +{}: final: prev: {} From ee81a9d4b0e32bf7ca255d3e8483cf031b659ace Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 00:52:02 +0000 Subject: [PATCH 002/163] build(nix): intro addToEnv helper We begin the construction of our sysroot with a helper function designed to inject environment variables into a nixpkgs provided stdenv. This will (eventually) allow us to customize the flags used to compile each package needed for our sysroot. Signed-off-by: Daniel Noland --- nix/overlays/dataplane.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index 307698934..7d4670ae4 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -1 +1,11 @@ -{}: final: prev: {} +{ }: +final: prev: +let + helpers.addToEnv = + add: orig: + orig + // ( + with builtins; (mapAttrs (var: val: (toString (orig.${var} or "")) + " " + (toString val)) add) + ); +in +{ } From 3167008214702023192b526f0c930237a09aac4e Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 00:53:06 +0000 Subject: [PATCH 003/163] build(nix): introduce stdenv-llvm This commit introduces a nixpkgs provided stdenv based on the LLVM toolchain. We explicitly forswear GCC for this sysroot on the grounds that rustc is based on LLVM. Given that we want LTO to work properly, we need to ensure that all of our (modest list of) dataplane dependencies are built with LLVM. In a future commit we will add infrastructure to ensure that we are also always using the same version of LLVM used by our selected version of rustc. Signed-off-by: Daniel Noland --- nix/overlays/dataplane.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index 7d4670ae4..9559ec053 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -7,5 +7,7 @@ let // ( with builtins; (mapAttrs (var: val: (toString (orig.${var} or "")) + " " + (toString val)) add) ); + adapt = final.stdenvAdapters; + stdenv-llvm = adapt.makeStaticLibraries final.buildPackages.llvmPackages.stdenv; in { } From 086d3c3aa8eb4561f61692b516a4881aecf30f02 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 00:56:10 +0000 Subject: [PATCH 004/163] build(nix): add llvm's bintools and lld to stdenv For reasons which make no sense to me, llvmPackages.stdenv does not seem to add LLVM's bintools or linker to the nativeBuildInputs by default. If you attempt to pass `-fuse-ld=lld` to the compiler without explicitly adding them to the build time dependency list then you fail to link. The fix is easy: inject those packages as dependencies. Note that I deliberately don't use `pkgs.lld` as that version of lld is not wrapped by nix and will not ensure correct settings for the rpath in generated elf files. llvmPackages.lld is the version we need here, as that version of lld is wrapped. Signed-off-by: Daniel Noland --- nix/overlays/dataplane.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index 9559ec053..aa315257b 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -8,6 +8,13 @@ let with builtins; (mapAttrs (var: val: (toString (orig.${var} or "")) + " " + (toString val)) add) ); adapt = final.stdenvAdapters; - stdenv-llvm = adapt.makeStaticLibraries final.buildPackages.llvmPackages.stdenv; + bintools = final.buildPackages.llvmPackages.bintools; + lld = final.buildPackages.llvmPackages.lld; + stdenv-llvm = adapt.addAttrsToDerivation (orig: { + nativeBuildInputs = (orig.nativeBuildInputs or [ ]) ++ [ + bintools + lld + ]; + }) (adapt.makeStaticLibraries final.buildPackages.llvmPackages.stdenv); in { } From 522e2658382b076230cf92d03c769c14ec202a7d Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 00:56:43 +0000 Subject: [PATCH 005/163] build(nix): disable checks in stdenv It is neat that nixpkgs attempts to run unit tests for compiled packages, but in my experience those tests spuriously fail on the regular. The cause of these failures is almost uniformly due to insufficient permissions in the build environment. I will leave the testing of packages to the developers and package maintainers and simply disable those tests in our overlay. This is especially important in that we will (in the future) cross compile for aarch64 and our build machine would be unable to run the tests anyway. Signed-off-by: Daniel Noland --- nix/overlays/dataplane.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index aa315257b..ccc73195d 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -11,6 +11,7 @@ let bintools = final.buildPackages.llvmPackages.bintools; lld = final.buildPackages.llvmPackages.lld; stdenv-llvm = adapt.addAttrsToDerivation (orig: { + doCheck = false; nativeBuildInputs = (orig.nativeBuildInputs or [ ]) ++ [ bintools lld From 18dc2c5ecc2c4f067fc1cc56e0b8a812e1a3868f Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 00:57:47 +0000 Subject: [PATCH 006/163] build(nix): intro stdenv-llvm-with-flags Invoke or previously built helper function to pass user supplied flags into our new llvm stdenv. Signed-off-by: Daniel Noland --- nix/overlays/dataplane.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index ccc73195d..04debf274 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -1,4 +1,6 @@ -{ }: +{ + env ? { }, +}: final: prev: let helpers.addToEnv = @@ -17,5 +19,8 @@ let lld ]; }) (adapt.makeStaticLibraries final.buildPackages.llvmPackages.stdenv); + stdenv-llvm-with-flags = adapt.addAttrsToDerivation (orig: { + env = helpers.addToEnv env (orig.env or { }); + }) stdenv-llvm; in { } From 47e50935fe6c0d3a01b25284fd4795d62840e504 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 00:58:18 +0000 Subject: [PATCH 007/163] build(nix): intro dataplane-dep helper function Cook a quick helper function to override the stdenv of select packages with our static + llvm + user supplied flags stdenv. Signed-off-by: Daniel Noland --- nix/overlays/dataplane.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index 04debf274..8864d88f2 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -22,5 +22,6 @@ let stdenv-llvm-with-flags = adapt.addAttrsToDerivation (orig: { env = helpers.addToEnv env (orig.env or { }); }) stdenv-llvm; + dataplane-dep = pkg: pkg.override { stdenv = stdenv-llvm-with-flags; }; in { } From 525851ef41ed8f9d9df478a22cb5c0b67843a5b6 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 00:58:59 +0000 Subject: [PATCH 008/163] build(nix): null ethtool and iproute2 See comment for my reasoning. Signed-off-by: Daniel Noland --- nix/overlays/dataplane.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index 8864d88f2..e7d0d9d9c 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -24,4 +24,14 @@ let }) stdenv-llvm; dataplane-dep = pkg: pkg.override { stdenv = stdenv-llvm-with-flags; }; in -{ } +{ + # Don't bother adapting ethtool or iproute2's build to our custom flags / env. Failure to null this can trigger + # _massive_ builds because ethtool depends on libnl (et al), and we _do_ overlay libnl. Thus, the ethtool / iproute2 + # get rebuilt and you end up rebuilding the whole world. + # + # To be clear, we can still use ethtool / iproute2 if we want, we just don't need to optimize / lto it. + # If you want to include ethtool / iproute2, I recommend just cutting another small overlay and static linking them. + # Alternatively, you could skip that and just ship the default build of ethtool. + ethtool = null; + iproute2 = null; +} From 7f263fc832f8d59cd9bdde8987a53dc65d508293 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 00:59:24 +0000 Subject: [PATCH 009/163] build(nix): null heavy doc tools See comment for my reasoning. Signed-off-by: Daniel Noland --- nix/overlays/dataplane.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index e7d0d9d9c..476fdc207 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -34,4 +34,12 @@ in # Alternatively, you could skip that and just ship the default build of ethtool. ethtool = null; iproute2 = null; + + # These are only used in docs and can make our build explode in size if we let any of this rebuild in this overlay. + # It is much easier to just not build docs in this overlay. We don't care if the build depends on pandoc per se, but + # you will regret the need to rebuild ghc :shrug: + gd = null; + graphviz = null; + mscgen = null; + pandoc = null; } From 266b2a457b2f6c6e8d07dd12d139239f630e8403 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 00:59:57 +0000 Subject: [PATCH 010/163] build(nix): null systemd + helpers See comment for my reasoning. Signed-off-by: Daniel Noland --- nix/overlays/dataplane.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index 476fdc207..7527d2e20 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -42,4 +42,15 @@ in graphviz = null; mscgen = null; pandoc = null; + + # We should avoid accepting anything in our dpdk + friends pkgs which depends on udev / systemd; our deploy won't + # support any such mechanisms. + # + # Usually this type of dependency takes the form of udev rules / systemd service files being generated (which is no + # problem). That said, builds which hard and fast depend on systemd or udev are very suspicious in this context, so + # exceptions to this removal should be granted with care and some level of prejudice. At minimum, such exceptions + # tend to make it hard to cross compile which is an important test case for our sysroot. + systemd = null; + udev = null; + udevCheckHook = null; } From c4ebd6aa082bb89c38adb1e1b9a95896352a80ee Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 01:00:41 +0000 Subject: [PATCH 011/163] build(nix): introduce overlay for libmd This is an indirect dependency of DPDK, so we want to customize its build. Signed-off-by: Daniel Noland --- nix/overlays/dataplane.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index 7527d2e20..b2ff0274f 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -53,4 +53,24 @@ in systemd = null; udev = null; udevCheckHook = null; + + # libmd is used by libbsd (et al) which is an optional dependency of dpdk. + # + # We _might_ actually care about perf here, so we lto this package. + # At minimum, the provided functions are generally quite small and likely to benefit from inlining, so static linking + # is a solid plan. + libmd = (dataplane-dep prev.libmd).overrideAttrs (orig: { + outputs = (orig.outputs or [ "out" ]) ++ [ "static" ]; + # we need to enable shared libs (in addition to static) to make dpdk's build happy. Basically, DPDK's build has no + # means of disabling shared libraries, and it doesn't really make any sense to static link this into each .so + # file. Ideally we would just _not_ build those .so files, but that would require doing brain surgery on dpdk's + # meson build, and maintaining such a change set is not worth it to avoid building some .so files. + configureFlags = (orig.configureFlags or [ ]) ++ [ + "--enable-shared" + ]; + postInstall = (orig.postInstall or "") + '' + mkdir -p "$static/lib"; + mv $out/lib/*.a $static/lib; + ''; + }); } From dadde462a6aca49fb34752b72acb9dcc82a15d65 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 01:01:05 +0000 Subject: [PATCH 012/163] build(nix): introduce overlay for libbsd This is an indirect dependency of DPDK, so we want to customize its build. Signed-off-by: Daniel Noland --- nix/overlays/dataplane.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index b2ff0274f..725b9dab6 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -73,4 +73,22 @@ in mv $out/lib/*.a $static/lib; ''; }); + + # This is a (technically optional) dependency of DPDK used for secure string manipulation and some hashes we value; + # static link + lto for sure. + # + # This is also a reasonably important target for `-fsanitize=cfi` and or `-fsanitize=safe-stack` as libbsd provides + # more secure versions of classic C string manipulation utilities, and I'm all about that defense-in-depth. + libbsd = (dataplane-dep prev.libbsd).overrideAttrs (orig: { + outputs = (orig.outputs or [ "out" ]) ++ [ "static" ]; + # we need to enable shared (in addition to static) to build dpdk. + # See the note on libmd for reasoning. + configureFlags = orig.configureFlags ++ [ + "--enable-shared" + ]; + postInstall = (orig.postInstall or "") + '' + mkdir -p "$static/lib"; + mv $out/lib/*.a $static/lib; + ''; + }); } From eb0b56c66c5863d9c7b3593b4ad320cbf60bd62c Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 01:01:27 +0000 Subject: [PATCH 013/163] build(nix): introduce overlay for libnl This is an dependency of DPDK, so we want to customize its build. Signed-off-by: Daniel Noland --- nix/overlays/dataplane.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index 725b9dab6..f5140f384 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -91,4 +91,18 @@ in mv $out/lib/*.a $static/lib; ''; }); + + # This is (for better or worse) used by dpdk to parse / manipulate netlink messages. + # + # We don't care about performance here, so this may be a good candidate for size reduction compiler flags like -Os. + # + # That said, we don't currently have infrastructure to pass flags at a per package level and building that is more + # trouble than a minor reduction in binary size / instruction cache pressure is likely worth. Also, lto doesn't + # currently love size optimizations. The better option is likely to use PGO + BOLT to put these functions far away + # from the hot path in the final ELF file's layout and just ignore that this stuff is compiled with -O3 and friends. + # + # More, this is a very low level library designed to send messages between a privileged process and the kernel. + # The simple fact that this appears in our toolchain justifies sanitizers like safe-stack and cfi and/or flags like + # -fcf-protection=full. + libnl = dataplane-dep prev.libnl; } From c5be4afc6807adedd6f760308a8740553d0abb0f Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 01:01:49 +0000 Subject: [PATCH 014/163] build(nix): introduce overlay for numactl This is an dependency of DPDK, so we want to customize its build. Signed-off-by: Daniel Noland --- nix/overlays/dataplane.nix | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index f5140f384..3f162ff90 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -105,4 +105,30 @@ in # The simple fact that this appears in our toolchain justifies sanitizers like safe-stack and cfi and/or flags like # -fcf-protection=full. libnl = dataplane-dep prev.libnl; + + # This is needed by DPDK in order to determine which pinned core runs on which numa node and which NIC is most + # efficiently connected to which NUMA node. You can disable the need for this library entirely by editing dpdk's + # build to specify `-Dmax_numa_nodes=1`. + # + # While we don't currently hide NUMA mechanics from DPDK, there is something to be said for eliminating this library + # from our toolchain as a fair level of permissions and a lot of different low level trickery is required to make it + # function. In "the glorious future" we should bump all of this logic up to the dataplane's init process, compute + # what we need to, pre-mmap _all_ of our heap memory, configure our cgroups and CPU affinities, and then pin our cores + # and use memory pools local to the numa node of the pinned core. That would be a fair amount of work, but it would + # liminate a fairly large dependency and likely increase the performance and security of the dataplane. + # + # For now, we leave this on so DPDK can do some of that for us. That said, this logic is quite cold and would ideally + # be size optimized and punted far from all hot paths. BOLT should be helpful here. + numactl = (dataplane-dep prev.numactl).overrideAttrs (orig: { + outputs = (prev.lib.lists.remove "man" orig.outputs) ++ [ "static" ]; + # we need to enable shared (in addition to static) to build dpdk. + # See the note on libmd for reasoning. + configureFlags = (orig.configureFlags or [ ]) ++ [ + "--enable-shared" # dpdk does not like to build its .so files if we don't build numa.so as well + ]; + postInstall = (orig.postInstall or "") + '' + mkdir -p "$static/lib"; + mv $out/lib/*.a $static/lib; + ''; + }); } From ce7b2a9a08feeb5e05a30593ac92f7fbd7af3e75 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 01:02:36 +0000 Subject: [PATCH 015/163] build(nix): introduce overlay for rdma-core This is an dependency of DPDK, so we want to customize its build. Signed-off-by: Daniel Noland --- nix/overlays/dataplane.nix | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index 3f162ff90..95a01bc8c 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -131,4 +131,36 @@ in mv $out/lib/*.a $static/lib; ''; }); + + # This is one of the two most important to optimize components of the whole build (along with dpdk itself). + # + # RDMA-core is the low level building block for many of the PMDs within DPDK including the mlx5 PMD. It is a + # performance and security critical library which we will likely never be able to remove from our dependencies. + # + # Some of this library is almost always called in a very tight loop, especially as used by DPDK PMDs. It is happy to + # link dynamically or statically, and we should make a strong effort to make sure that we always pick static linking + # to enable inlining (wherever the compiler decides it makes sense). You very likely want to enable lto here in any + # release build. + rdma-core = (dataplane-dep prev.rdma-core).overrideAttrs (orig: { + outputs = [ + "dev" + "out" + "static" + ]; + cmakeFlags = orig.cmakeFlags ++ [ + "-DENABLE_STATIC=1" + # we don't need pyverbs, and turning it off reduces build time / complexity. + "-DNO_PYVERBS=1" + # no need for docs in container images. + "-DNO_MAN_PAGES=1" + # we don't care about this lib's exported symbols / compat situation _at all_ because we static link (which + # doesn't even have symbol versioning / compatibility in the first place). Turning this off just reduces the + # build's internal complexity and makes lto easier. + "-DNO_COMPAT_SYMS=1" + ]; + postInstall = (orig.postInstall or "") + '' + mkdir -p $static/lib; + mv $out/lib/*.a $static/lib/ + ''; + }); } From 488112c76921ae70d04b91521cd970d823030141 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 01:05:52 +0000 Subject: [PATCH 016/163] build(nix): introduce npins package management This is a handy tool for "pinning" our external dependencies to known versions with fixed cryptographic hashes. I tried to make this work with nix flakes, but I had an extremely difficult time making cross compile work, and I frankly don't understand what flakes does that npins doesn't do objectively better. Signed-off-by: Daniel Noland --- npins/default.nix | 146 +++++++++++++++++++++++++++++++++++++++++++++ npins/sources.json | 11 ++++ shell.nix | 1 + 3 files changed, 158 insertions(+) create mode 100644 npins/default.nix create mode 100644 npins/sources.json diff --git a/npins/default.nix b/npins/default.nix new file mode 100644 index 000000000..659247626 --- /dev/null +++ b/npins/default.nix @@ -0,0 +1,146 @@ +/* + This file is provided under the MIT licence: + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ +# Generated by npins. Do not modify; will be overwritten regularly +let + data = builtins.fromJSON (builtins.readFile ./sources.json); + version = data.version; + + # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295 + range = + first: last: if first > last then [ ] else builtins.genList (n: first + n) (last - first + 1); + + # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257 + stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1)); + + # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269 + stringAsChars = f: s: concatStrings (map f (stringToCharacters s)); + concatMapStrings = f: list: concatStrings (map f list); + concatStrings = builtins.concatStringsSep ""; + + # If the environment variable NPINS_OVERRIDE_${name} is set, then use + # the path directly as opposed to the fetched source. + # (Taken from Niv for compatibility) + mayOverride = + name: path: + let + envVarName = "NPINS_OVERRIDE_${saneName}"; + saneName = stringAsChars (c: if (builtins.match "[a-zA-Z0-9]" c) == null then "_" else c) name; + ersatz = builtins.getEnv envVarName; + in + if ersatz == "" then + path + else + # this turns the string into an actual Nix path (for both absolute and + # relative paths) + builtins.trace "Overriding path of \"${name}\" with \"${ersatz}\" due to set \"${envVarName}\"" ( + if builtins.substring 0 1 ersatz == "/" then + /. + ersatz + else + /. + builtins.getEnv "PWD" + "/${ersatz}" + ); + + mkSource = + name: spec: + assert spec ? type; + let + path = + if spec.type == "Git" then + mkGitSource spec + else if spec.type == "GitRelease" then + mkGitSource spec + else if spec.type == "PyPi" then + mkPyPiSource spec + else if spec.type == "Channel" then + mkChannelSource spec + else if spec.type == "Tarball" then + mkTarballSource spec + else + builtins.throw "Unknown source type ${spec.type}"; + in + spec // { outPath = mayOverride name path; }; + + mkGitSource = + { + repository, + revision, + url ? null, + submodules, + hash, + branch ? null, + ... + }: + assert repository ? type; + # At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository + # In the latter case, there we will always be an url to the tarball + if url != null && !submodules then + builtins.fetchTarball { + inherit url; + sha256 = hash; # FIXME: check nix version & use SRI hashes + } + else + let + url = + if repository.type == "Git" then + repository.url + else if repository.type == "GitHub" then + "https://github.com/${repository.owner}/${repository.repo}.git" + else if repository.type == "GitLab" then + "${repository.server}/${repository.repo_path}.git" + else + throw "Unrecognized repository type ${repository.type}"; + urlToName = + url: rev: + let + matched = builtins.match "^.*/([^/]*)(\\.git)?$" url; + + short = builtins.substring 0 7 rev; + + appendShort = if (builtins.match "[a-f0-9]*" rev) != null then "-${short}" else ""; + in + "${if matched == null then "source" else builtins.head matched}${appendShort}"; + name = urlToName url revision; + in + builtins.fetchGit { + rev = revision; + inherit name; + # hash = hash; + inherit url submodules; + }; + + mkPyPiSource = + { url, hash, ... }: + builtins.fetchurl { + inherit url; + sha256 = hash; + }; + + mkChannelSource = + { url, hash, ... }: + builtins.fetchTarball { + inherit url; + sha256 = hash; + }; + + mkTarballSource = + { + url, + locked_url ? url, + hash, + ... + }: + builtins.fetchTarball { + url = locked_url; + sha256 = hash; + }; +in +if version == 5 then + builtins.mapAttrs mkSource data.pins +else + throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`" diff --git a/npins/sources.json b/npins/sources.json new file mode 100644 index 000000000..ba6d59bfc --- /dev/null +++ b/npins/sources.json @@ -0,0 +1,11 @@ +{ + "pins": { + "nixpkgs": { + "type": "Channel", + "name": "nixpkgs-unstable", + "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.05pre911335.23735a82a828/nixexprs.tar.xz", + "hash": "03cv7yy3ldb3i50in6qkm98y68nlid874l52wayzgx0z7pbpq1rk" + } + }, + "version": 5 +} diff --git a/shell.nix b/shell.nix index 112c4b8a4..918e6cad1 100644 --- a/shell.nix +++ b/shell.nix @@ -12,6 +12,7 @@ just nil nixd + npins wget ]); }).env From ac0c9da7154ddd7e871cb59e14dffa17e1dc573c Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 01:07:22 +0000 Subject: [PATCH 017/163] build(nix): pin our version of rdma-core We want to have exact control over our version of rdma-core. We pin the version to use our fork of rdma-core which contains a minor patch sequence to help LTO compiles. This pin was added via ``` npins add github githedgehog rdma-core -b fix-lto-60.0 ``` Signed-off-by: Daniel Noland --- npins/sources.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/npins/sources.json b/npins/sources.json index ba6d59bfc..78425d3b3 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -5,6 +5,19 @@ "name": "nixpkgs-unstable", "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.05pre911335.23735a82a828/nixexprs.tar.xz", "hash": "03cv7yy3ldb3i50in6qkm98y68nlid874l52wayzgx0z7pbpq1rk" + }, + "rdma-core": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "githedgehog", + "repo": "rdma-core" + }, + "branch": "fix-lto-60.0", + "submodules": false, + "revision": "9ae1b26593e2cb53239e1124f88ce1698d53857e", + "url": "https://github.com/githedgehog/rdma-core/archive/9ae1b26593e2cb53239e1124f88ce1698d53857e.tar.gz", + "hash": "1djdsfga9if02pl8ynnyyf640xdd37fha6zp3xlylciy8apzn1r4" } }, "version": 5 From 60d760b4b5a825f567f0ffe01ce19a42e7bc225c Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 01:18:04 +0000 Subject: [PATCH 018/163] build(nix): import pinned sources into default.nix Now that we have our pinned version of nixpkgs and rdma-core set up we can pipe those sources into our build system for consumption by the rest of our overlay. Signed-off-by: Daniel Noland --- default.nix | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 default.nix diff --git a/default.nix b/default.nix new file mode 100644 index 000000000..a04a84bb5 --- /dev/null +++ b/default.nix @@ -0,0 +1,9 @@ +let + sources = import ./npins; +in +{ + +}: +{ + inherit sources; +} From 129ba17d0ff29407e2c616b1134b035242e977e5 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 01:18:20 +0000 Subject: [PATCH 019/163] build(nix): import nixpkgs from npins source Use the pinned version of nixpkgs. Signed-off-by: Daniel Noland --- default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/default.nix b/default.nix index a04a84bb5..3933bb4ce 100644 --- a/default.nix +++ b/default.nix @@ -1,5 +1,6 @@ let sources = import ./npins; + pkgs = import sources.nixpkgs { }; in { From e63103fb44115a7fc3e5c08ea4025927ebdbe4fb Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 01:20:18 +0000 Subject: [PATCH 020/163] build(nix): introduce default overlay We currently only have one overlay in play, but I expect that to change when I add additional logic for FRR. Regardless, there is little cost in making the set of selected overlays flexible. Signed-off-by: Daniel Noland --- nix/overlays/default.nix | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 nix/overlays/default.nix diff --git a/nix/overlays/default.nix b/nix/overlays/default.nix new file mode 100644 index 000000000..7f827c35b --- /dev/null +++ b/nix/overlays/default.nix @@ -0,0 +1,4 @@ +{ }: +{ + dataplane = import ./dataplane.nix { env = { }; }; +} From 18be22bf1efafe8877e528c908849c9d96550b8c Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 01:22:08 +0000 Subject: [PATCH 021/163] build(nix): pipe pinned sources to dataplane overlay These pinned sources need to be consumed by the dataplane overlay in order to pin our external dependencies, rdma-core and (soon) dpdk. Signed-off-by: Daniel Noland --- nix/overlays/dataplane.nix | 1 + nix/overlays/default.nix | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index 95a01bc8c..5b7b8ab76 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -1,4 +1,5 @@ { + sources, env ? { }, }: final: prev: diff --git a/nix/overlays/default.nix b/nix/overlays/default.nix index 7f827c35b..f112df68c 100644 --- a/nix/overlays/default.nix +++ b/nix/overlays/default.nix @@ -1,4 +1,9 @@ -{ }: { - dataplane = import ./dataplane.nix { env = { }; }; + sources, +}: +{ + dataplane = import ./dataplane.nix { + inherit sources; + env = { }; + }; } From 15021b8a904e04b3fc5d028afb500e3477ddd950 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 01:22:58 +0000 Subject: [PATCH 022/163] build(nix): use pinned rdma-core Use the newly piped in value of sources to fix rdma-core to our chosen version. Signed-off-by: Daniel Noland --- nix/overlays/dataplane.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index 5b7b8ab76..624e1ed36 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -143,6 +143,8 @@ in # to enable inlining (wherever the compiler decides it makes sense). You very likely want to enable lto here in any # release build. rdma-core = (dataplane-dep prev.rdma-core).overrideAttrs (orig: { + version = sources.rdma-core.branch; + src = sources.rdma-core.outPath; outputs = [ "dev" "out" From 3c2507abde89bb89ad48c680ca4bd5002913ff66 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 01:08:56 +0000 Subject: [PATCH 023/163] build(nix): pin DPDK to version 25.11 DPDK recently released a new LTS version (25.11). Given that we are reworking our build system anyway, there is little reason to stay on the (now) outdated 25.07 version. This process will (in a future commit series) require regenerating our rust bindings anyway. While that is a relatively easy task, I can't see any real reason to do it twice. This pin was generated with the command ``` npins add github DPDK dpdk -b 25.11 ``` Signed-off-by: Daniel Noland --- npins/sources.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/npins/sources.json b/npins/sources.json index 78425d3b3..bc55da807 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -1,5 +1,18 @@ { "pins": { + "dpdk": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "DPDK", + "repo": "dpdk" + }, + "branch": "25.11", + "submodules": false, + "revision": "ed957165eadbe60a47d5ec223578cdd1c13d0bd9", + "url": "https://github.com/DPDK/dpdk/archive/ed957165eadbe60a47d5ec223578cdd1c13d0bd9.tar.gz", + "hash": "09h7wnmq4c9xm1nsyv5mz1yf91c1l6vy9sdcamb09qjjx4wgs0q9" + }, "nixpkgs": { "type": "Channel", "name": "nixpkgs-unstable", From 09575cd7a8f695db64dda02ea8e1ce3e3ede499f Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 01:27:49 +0000 Subject: [PATCH 024/163] build(nix): introduce dpdk package This commit introduces a build recipe for DPDK optimized for our use case. This is largely just transferred over from dpdk-sys. The primary reason to focus on minimizing DPDK is to make it as easy as possible to bind DPDK to rust. In particular, enabling all of the drivers significantly complicates the binding process and significantly increases build times. Signed-off-by: Daniel Noland --- nix/pkgs/dpdk/default.nix | 284 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 284 insertions(+) create mode 100644 nix/pkgs/dpdk/default.nix diff --git a/nix/pkgs/dpdk/default.nix b/nix/pkgs/dpdk/default.nix new file mode 100644 index 000000000..44d4474bd --- /dev/null +++ b/nix/pkgs/dpdk/default.nix @@ -0,0 +1,284 @@ +{ + src, + stdenv, + lib, + pkg-config, + meson, + ninja, + libbsd, + numactl, + rdma-core, + libnl, + python3, + build-params ? { + lto = "true"; + build-type = "release"; # "debug" | "release" + }, +}: + +stdenv.mkDerivation { + pname = "dpdk"; + version = src.branch; + src = src.outPath; + nativeBuildInputs = [ + meson + ninja + pkg-config + python3 + python3.pkgs.pyelftools + ]; + + buildInputs = [ + libbsd + libnl + numactl + rdma-core + ]; + + postPatch = '' + patchShebangs config/arm buildtools + # We have no use for RTE_TRACE at all and it makes things more difficult from a security POV so disable it + sed -i 's/#define RTE_TRACE 1/#undef RTE_TRACE/g' config/rte_config.h + # We have no use for receive or transmit callbacks at this time so disable them + sed -i 's/#define RTE_ETHDEV_RXTX_CALLBACKS 1/#undef RTE_ETHDEV_RXTX_CALLBACKS/g' config/rte_config.h + ''; + + mesonFlags = + let + disabledLibs = [ + "acl" + "argparse" + "bbdev" + "bitratestats" + "bpf" + "cfgfile" + "compressdev" + "dispatcher" + "distributor" + "efd" + "fib" + "gpudev" + "graph" + "gro" + "gso" + "ip_frag" + "ipsec" + "jobstats" + "latencystats" + "lpm" + "member" + "metrics" + "mldev" + "node" + "pcapng" + "pdcp" + "pdump" + "pipeline" + "port" + "power" + "ptr_compress" + "rawdev" + "regexdev" + "reorder" + "rib" + "sched" + "table" + ]; + enabledLibs = [ + "cryptodev" # required for vhost + "dmadev" # required by vhost + "ethdev" + "eventdev" + "pci" + "security" + "timer" + "vhost" + ]; + disabledDrivers = [ + "baseband/*" + "bus/ifpga" + "bus/vdev" + "bus/vmbus" + "common/cnxk" + "common/cpt" + "common/dpaax" + "common/octeontx" + "common/octeontx2" + "common/qat" + "common/sfc_efx" + "compress/*" + "compress/mlx5" + "compress/zlib" + "crypto/*" + "crypto/aesni_gcm" + "crypto/aesni_mb" + "crypto/bcmfs" + "crypto/ccp" + "crypto/kasumi" + "crypto/mlx5" + "crypto/nitrox" + "crypto/null" + "crypto/openssl" + "crypto/scheduler" + "crypto/snow3g" + "crypto/virtio" + "crypto/zuc" + "event/dlb" + "event/dsw" + "event/opdl" + "event/skeleton" + "event/sw" + "net/acc100" + "net/af_packet" + "net/af_xdp" + "net/ark" + "net/atlantic" + "net/avp" + "net/axgbe" + "net/bcmfs" + "net/bnx2x" + "net/bnxt" + "net/bond" + "net/caam_jr" + "net/ccp" + "net/cnxk" + "net/cnxk_bphy" + "net/cpt" + "net/cxgbe" + "net/dlb2" + "net/dpaa" + "net/dpaa2" + "net/dpaa2_cmdif" + "net/dpaa2_qdma" + "net/dpaa2_sec" + "net/dpaa_sec" + "net/dpaax" + "net/dsw" + "net/ena" + "net/enetc" + "net/enic" + "net/failsafe" + "net/fm10k" + "net/fpga_5gnr_fec" + "net/fpga_lte_fec" + "net/fslmc" + "net/hinic" + "net/hns3" + "net/ifc" + "net/ifpga" + "net/igc" + "net/ioat" + "net/ionic" + "net/ipn3ke" + "net/kasumi" + "net/kni" + "net/liquidio" + "net/memif" + "net/mlx4" + "net/netvsc" + "net/nfp" + "net/ngbe" + "net/nitrox" + "net/ntb" + "net/null" + "net/octeontx" + "net/octeontx2" + "net/octeontx2_dma" + "net/octeontx2_ep" + "net/octeontx_ep" + "net/opdl" + "net/pcap" + "net/pfe" + "net/qede" + "net/sfc" + "net/sfc_efx" + "net/skeleton" + "net/snow3g" + "net/softnic" + "net/tap" + "net/thunderx" + "net/turbo_sw" + "net/txgbe" + "net/vdev" + "net/vdev_netvsc" + "net/vmbus" + "net/vmxnet3" + "net/zuc" + "raw/*" + "raw/ioat" + "raw/ntb" + "raw/skeleton" + "regex/*" + "regex/mlx5" + "vdpa/*" + "vdpa/ifc" + ]; + enabledDrivers = [ + "bus/auxiliary" + "bus/pci" + "common/mlx5" + "mempool/bucket" + "mempool/ring" + "mempool/stack" + "net/auxiliary" + "net/dmadev" + "net/intel/e1000" + "net/intel/i40e" + "net/intel/iavf" + "net/intel/ixgbe" + "net/mlx5" + "net/ring" + "net/vhost" + "net/virtio" + "vdpa/mlx5" + ]; + in + with build-params; + [ + "--buildtype=${build-type}" + "-Dauto_features=disabled" + "-Db_colorout=never" + "-Db_lto=${lto}" + "-Db_lundef=true" + "-Db_pgo=off" + "-Db_pie=true" + "-Dbackend=ninja" + "-Ddefault_library=static" + "-Denable_docs=false" + "-Denable_driver_sdk=false" + "-Dmax_numa_nodes=8" + "-Dtests=false" # Running DPDK tests in CI is usually silly + "-Duse_hpet=false" + "-Ddebug=false" + ''-Ddisable_drivers=${lib.concatStringsSep "," disabledDrivers}'' + ''-Denable_drivers=${lib.concatStringsSep "," enabledDrivers}'' + ''-Denable_libs=${lib.concatStringsSep "," enabledLibs}'' + ''-Ddisable_libs=${lib.concatStringsSep "," disabledLibs}'' + ]; + + outputs = [ + "out" + "static" + "dev" + "share" + ]; + + postInstall = '' + # Remove docs. We don't build these anyway + rm -rf $out/share/doc + mkdir -p $static/lib $share; + mv $out/lib/*.a $static/lib + mv $out/share $share + ''; + + meta = with lib; { + description = "Set of libraries and drivers for fast packet processing"; + homepage = "http://dpdk.org/"; + license = with licenses; [ + lgpl21 + gpl2 + bsd2 + ]; + platforms = platforms.linux; + }; +} From 28f6f1c2b329e8f1e5f95e12269cdaaef707bf37 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 01:30:34 +0000 Subject: [PATCH 025/163] build(nix): replace dpdk build in dataplane overlay Call dpdk package from this repo rather than using the upstream build instructions (which are somewhat unfriendly to bindgen). Signed-off-by: Daniel Noland --- nix/overlays/dataplane.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index 624e1ed36..3487cba14 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -166,4 +166,14 @@ in mv $out/lib/*.a $static/lib/ ''; }); + + # Compiling DPDK is the primary objective of this overlay. + # + # We care _a lot_ about how this is compiled and should always use flags which are either optimized for performance + # or debugging. After all, if you aren't doing something performance critical then I don't know why you want DPDK at + # all :) + # + # Also, while this library has a respectable security track record, this is also a super strong candidate for + # cfi, safe-stack, and cf-protection. + dpdk = dataplane-dep (final.callPackage ../pkgs/dpdk { src = sources.dpdk; }); } From 8439e02588a000531c14c2798b9c112f8e5caa04 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 01:31:18 +0000 Subject: [PATCH 026/163] build(nix): expose pkgs in default.nix Now that our overlay is mostly ready, we can re-export our overlay plus nixpkgs from default.nix. Signed-off-by: Daniel Noland --- default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default.nix b/default.nix index 3933bb4ce..b7c6f15e5 100644 --- a/default.nix +++ b/default.nix @@ -6,5 +6,5 @@ in }: { - inherit sources; + inherit sources pkgs; } From f9f55b3951b6cac94d1ed45621352b01840432f5 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 01:33:03 +0000 Subject: [PATCH 027/163] build(nix): add dataplane overlay to default.nix Now that our overlay is mostly cooked, we can inject it into our pinned version of nixpkgs. Signed-off-by: Daniel Noland --- default.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/default.nix b/default.nix index b7c6f15e5..ec67ab546 100644 --- a/default.nix +++ b/default.nix @@ -1,6 +1,13 @@ let sources = import ./npins; - pkgs = import sources.nixpkgs { }; + overlays = import ./nix/overlays { + inherit sources; + }; + pkgs = import sources.nixpkgs { + overlays = [ + overlays.dataplane + ]; + }; in { From 1850879ce7d466199e91613c1630668f00daf153 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 01:50:19 +0000 Subject: [PATCH 028/163] build(nix): pipe env into overlays We don't yet have the machinery to generate our compile flags, but we can pre-emptively wire up the system which will feed in those flags into our overlay. Signed-off-by: Daniel Noland --- nix/overlays/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nix/overlays/default.nix b/nix/overlays/default.nix index f112df68c..6139dfb3c 100644 --- a/nix/overlays/default.nix +++ b/nix/overlays/default.nix @@ -1,9 +1,9 @@ { sources, + env ? { }, }: { dataplane = import ./dataplane.nix { - inherit sources; - env = { }; + inherit sources env; }; } From c8d29b68f0f1b2ce04376b96f98020dc8a737416 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 02:52:56 +0000 Subject: [PATCH 029/163] build(nix): frame common profile Now that we have our overlay in a place where it can accept flags we can start constructing machinery to generate those flags. We start with the "common" profile. This profile consists of flags we expect to pass to each and every build environment on all target platforms. Flags should be added to this profile conservatively, as they apply globally. Do not add performance compromising flags here. Signed-off-by: Daniel Noland --- profiles.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 profiles.nix diff --git a/profiles.nix b/profiles.nix new file mode 100644 index 000000000..1dd895715 --- /dev/null +++ b/profiles.nix @@ -0,0 +1,20 @@ +let + common.NIX_CFLAGS_COMPILE = [ + "-glldb" + "-gdwarf-5" + # odr or strict-aliasing violations are indicative of LTO incompatibility, so check for that + "-Werror=odr" + "-Werror=strict-aliasing" + ]; + common.NIX_CXXFLAGS_COMPILE = common.NIX_CFLAGS_COMPILE; + common.NIX_CFLAGS_LINK = [ + # getting proper LTO from LLVM compiled objects is best done with lld rather than ld, mold, or wild (at least at the + # time of writing) + "-fuse-ld=lld" + # we always want pic/pie and GOT offsets should be computed at compile time whenever possible + "-Wl,-z,relro,-z,now" + ]; +in +{ + +} From 733d9a116fb7cbb0dc79bd16d756c0fc30a34116 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 02:53:19 +0000 Subject: [PATCH 030/163] build(nix): frame debug profile This commit constructs the "debug" profile. This profile should only be activated in environments where performance is of much less concern than debugging. Signed-off-by: Daniel Noland --- profiles.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/profiles.nix b/profiles.nix index 1dd895715..31d226f7b 100644 --- a/profiles.nix +++ b/profiles.nix @@ -14,6 +14,14 @@ let # we always want pic/pie and GOT offsets should be computed at compile time whenever possible "-Wl,-z,relro,-z,now" ]; + debug.NIX_CFLAGS_COMPILE = [ + "-fno-inline" + "-fno-omit-frame-pointer" + "-D_FORTIFY_SOURCE=0" # disable security stuff because the goal is to make the asm as easy to understand as possible + "-Wno-macro-redefined" # many apps opt in to _FORTIFY_SOURCE={1,2,3} explicitly, and -Wall errors when you redefine + ]; + debug.NIX_CXXFLAGS_COMPILE = debug.NIX_CFLAGS_COMPILE; + debug.NIX_CFLAGS_LINK = [ ]; in { From c8cd3bde895e64e3bf96bcbbda019afd294300ca Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 02:53:52 +0000 Subject: [PATCH 031/163] build(nix): frame optimize profile The optimize profile contains flags which optimize the performance of the generated artifacts. This build profile makes no attempt to preserve debugability and will greatly increase build times when activated. Signed-off-by: Daniel Noland --- profiles.nix | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/profiles.nix b/profiles.nix index 31d226f7b..daa527d25 100644 --- a/profiles.nix +++ b/profiles.nix @@ -22,6 +22,21 @@ let ]; debug.NIX_CXXFLAGS_COMPILE = debug.NIX_CFLAGS_COMPILE; debug.NIX_CFLAGS_LINK = [ ]; + optimize.NIX_CFLAGS_COMPILE = [ + "-O3" + "-flto=full" + "-fsplit-lto-unit" # important for compatibility with rust's LTO + ]; + optimize.NIX_CXXFLAGS_COMPILE = optimize.NIX_CFLAGS_COMPILE ++ [ + "-fwhole-program-vtables" + ]; + optimize.NIX_CFLAGS_LINK = [ + "-flto=full" + "-Wl,--lto-whole-program-visibility" + # just to keep the artifacts small, we don't currently use any linked artifact anyway + "-Wl,--gc-sections" + "-Wl,--as-needed" + ]; in { From c14d487e7b4fb1ee3c5907b23c39ccc76b15829d Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 02:54:19 +0000 Subject: [PATCH 032/163] build(nix): frame secure profile The secure profile is a set of flags intended to degrade security vulnerabilities into denial of service attacks. This should mostly be used in release builds, but can be applied to debug or (especially) to (future) fuzz environments as a means of instructing the fuzzer to hunt bugs with plausible security impacts. In particular, enabling safe-stack and or cfi (both future goals) should be done in future fuzz builds if possible. Signed-off-by: Daniel Noland --- profiles.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/profiles.nix b/profiles.nix index daa527d25..0e4ee1ac1 100644 --- a/profiles.nix +++ b/profiles.nix @@ -37,6 +37,13 @@ let "-Wl,--gc-sections" "-Wl,--as-needed" ]; + secure.NIX_CFLAGS_COMPILE = [ + "-fstack-protector-strong" + "-fstack-clash-protection" + ]; + secure.NIX_CXXFLAGS_COMPILE = secure.NIX_CFLAGS_COMPILE; + # handing the CFLAGS back to clang/lld is basically required for -fsanitize + secure.NIX_CFLAGS_LINK = secure.NIX_CFLAGS_COMPILE; in { From 73c18e3ebffbf003c804ece5f0fdb92b7a6fc784 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 02:54:47 +0000 Subject: [PATCH 033/163] build(nix): add notes about cf-protection, cfi, and safe-stack Signed-off-by: Daniel Noland --- profiles.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/profiles.nix b/profiles.nix index 0e4ee1ac1..512a384a4 100644 --- a/profiles.nix +++ b/profiles.nix @@ -40,6 +40,13 @@ let secure.NIX_CFLAGS_COMPILE = [ "-fstack-protector-strong" "-fstack-clash-protection" + # "-fcf-protection=full" # requires extra testing before we enable + # "-fsanitize=safe-stack" # requires extra testing before we enable (not compatible with musl) + # "-fsanitize=cfi" # requires extra testing before we enable + # enable if you turn on cfi to properly link with rust + # "-fsanitize-cfi-icall-experimental-normalize-integers" + # consider enabling if you turn on cfi (not compatible with cross DSO cfi) + # "-fsanitize-cfi-icall-generalize-pointers" ]; secure.NIX_CXXFLAGS_COMPILE = secure.NIX_CFLAGS_COMPILE; # handing the CFLAGS back to clang/lld is basically required for -fsanitize From 0fa5f5626d658ad5dc8a196b788b0a26c1916eb3 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 02:55:21 +0000 Subject: [PATCH 034/163] build(nix): intro combine-profiles This commit introduces a (regrettably opaque) helper function for composing build environments from an arbitrary combination of profiles. Signed-off-by: Daniel Noland --- profiles.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/profiles.nix b/profiles.nix index 512a384a4..633c236e7 100644 --- a/profiles.nix +++ b/profiles.nix @@ -51,6 +51,11 @@ let secure.NIX_CXXFLAGS_COMPILE = secure.NIX_CFLAGS_COMPILE; # handing the CFLAGS back to clang/lld is basically required for -fsanitize secure.NIX_CFLAGS_LINK = secure.NIX_CFLAGS_COMPILE; + combine-profiles = + features: + builtins.foldl' ( + acc: elem: builtins.mapAttrs (var: val: (acc.${var} or [ ]) ++ val) elem + ) { } features; in { From fd26b1af78abf0b09efe29cba8384d138a847fc7 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 02:55:44 +0000 Subject: [PATCH 035/163] build(nix): define debug environment Combine the common and debug profiles to define the debug environment. Signed-off-by: Daniel Noland --- profiles.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/profiles.nix b/profiles.nix index 633c236e7..65b63a08d 100644 --- a/profiles.nix +++ b/profiles.nix @@ -58,5 +58,8 @@ let ) { } features; in { - + debug = combine-profiles [ + common + debug + ]; } From ce71a5790d6ada702f216f0667c5c4cc95f86dd9 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 02:56:03 +0000 Subject: [PATCH 036/163] build(nix): define release environment Combine the common, optimize, and secure profiles to define the release environment. Signed-off-by: Daniel Noland --- profiles.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/profiles.nix b/profiles.nix index 65b63a08d..5fcc49979 100644 --- a/profiles.nix +++ b/profiles.nix @@ -62,4 +62,9 @@ in common debug ]; + release = combine-profiles [ + common + optimize + secure + ]; } From 3f046c466d59c60bf3a4178a519c7d793de89dc9 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 02:57:29 +0000 Subject: [PATCH 037/163] build(nix): pipe environments into build This commit (somewhat awkwardly) injects our build environments as top level children of the pkgs key. I am aware that I can do nix + fp tricks to make this more succinct and flexible, but I really am trying to keep this nix code basic where practical, and I don't expect us to have a very large number of environments. Signed-off-by: Daniel Noland --- default.nix | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/default.nix b/default.nix index ec67ab546..776d58bcf 100644 --- a/default.nix +++ b/default.nix @@ -1,11 +1,22 @@ let sources = import ./npins; - overlays = import ./nix/overlays { + profiles = import ./profiles.nix; + overlays.debug = import ./nix/overlays { inherit sources; + env = profiles.debug; }; - pkgs = import sources.nixpkgs { + overlays.release = import ./nix/overlays { + inherit sources; + env = profiles.release; + }; + pkgs.debug = import sources.nixpkgs { + overlays = [ + overlays.debug.dataplane + ]; + }; + pkgs.release = import sources.nixpkgs { overlays = [ - overlays.dataplane + overlays.release.dataplane ]; }; in From b795b36593b020536f31e46ddaa4d1d3e5c9a31e Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 15 Dec 2025 23:07:23 +0000 Subject: [PATCH 038/163] build(nix): introduce fat-lto-objects flag (for the moment) This flag allows builds which make use of tools like nm to build when lto is enabled. We enable it here (for the moment) to allow rdma-core to build on aarch64 / aarch64-musl. That said, I don't like this flag as it makes the object files and thus the archive files much bigger. It opens the window for LTO linking mistakes which are much easier avoided if this is off. Once I have cooked a patch for rdma-core to skip the nm step we can revert this commit. Signed-off-by: Daniel Noland --- profiles.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/profiles.nix b/profiles.nix index 5fcc49979..b3d52d626 100644 --- a/profiles.nix +++ b/profiles.nix @@ -25,6 +25,7 @@ let optimize.NIX_CFLAGS_COMPILE = [ "-O3" "-flto=full" + "-ffat-lto-objects" "-fsplit-lto-unit" # important for compatibility with rust's LTO ]; optimize.NIX_CXXFLAGS_COMPILE = optimize.NIX_CFLAGS_COMPILE ++ [ From 941ca3c82feebf2922c8374701c17b303fedfe48 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Fri, 19 Dec 2025 01:36:54 +0000 Subject: [PATCH 039/163] style(nix): sort outputs in dpdk build Signed-off-by: Daniel Noland --- nix/pkgs/dpdk/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nix/pkgs/dpdk/default.nix b/nix/pkgs/dpdk/default.nix index 44d4474bd..fd5abdab3 100644 --- a/nix/pkgs/dpdk/default.nix +++ b/nix/pkgs/dpdk/default.nix @@ -257,10 +257,10 @@ stdenv.mkDerivation { ]; outputs = [ - "out" - "static" "dev" + "out" "share" + "static" ]; postInstall = '' From a9f5037f09813d0e54e44c10382e7c10e4da26e7 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Fri, 19 Dec 2025 04:24:31 +0000 Subject: [PATCH 040/163] refactor(nix): move profiles.nix to nix folder I put the profiles at the top level to start, but in retrospect there is little reason to put them there. It just makes the top level directory listing more noisy and spreads the nix code around. Signed-off-by: Daniel Noland --- default.nix | 2 +- profiles.nix => nix/profiles.nix | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename profiles.nix => nix/profiles.nix (100%) diff --git a/default.nix b/default.nix index 776d58bcf..e0b3f7ab9 100644 --- a/default.nix +++ b/default.nix @@ -1,6 +1,6 @@ let sources = import ./npins; - profiles = import ./profiles.nix; + profiles = import ./nix/profiles.nix; overlays.debug = import ./nix/overlays { inherit sources; env = profiles.debug; diff --git a/profiles.nix b/nix/profiles.nix similarity index 100% rename from profiles.nix rename to nix/profiles.nix From 7fe5a9416d7e8ab68e4f73a2e0e63b206aba98ff Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Fri, 19 Dec 2025 04:31:24 +0000 Subject: [PATCH 041/163] build(nix): introduce x86_64 march flags These flags will be used in a follow up commit to build the x86_64 rust wrapper to dpdk. Signed-off-by: Daniel Noland --- nix/profiles.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nix/profiles.nix b/nix/profiles.nix index b3d52d626..491184e7d 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -52,6 +52,15 @@ let secure.NIX_CXXFLAGS_COMPILE = secure.NIX_CFLAGS_COMPILE; # handing the CFLAGS back to clang/lld is basically required for -fsanitize secure.NIX_CFLAGS_LINK = secure.NIX_CFLAGS_COMPILE; + march.x86_64.NIX_CFLAGS_COMPILE = [ + # DPDK functionally requires some -m flags on x86_64. + # These features have been available for a long time and can be found on any reasonably recent machine, so just + # enable them here for x86_64 builds. + "-mrtm" + "-mcrc32" + "-mssse3" + ]; + march.x86_64.NIX_CXXFLAGS_COMPILE = march.x86_64.NIX_CFLAGS_COMPILE; combine-profiles = features: builtins.foldl' ( From 51c93bb0bcab8a59db4bd759e82db4d31530d1a4 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Fri, 19 Dec 2025 04:32:20 +0000 Subject: [PATCH 042/163] build(nix): introduce aarch64 march flags These flags are empty for the moment, but may be needed in the future. They are included mostly for symmetry with the x86_64 build. Signed-off-by: Daniel Noland --- nix/profiles.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nix/profiles.nix b/nix/profiles.nix index 491184e7d..c85c2d8c8 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -61,6 +61,9 @@ let "-mssse3" ]; march.x86_64.NIX_CXXFLAGS_COMPILE = march.x86_64.NIX_CFLAGS_COMPILE; + march.aarch64.NIX_CFLAGS_COMPILE = [ ]; + march.aarch64.NIX_CXXFLAGS_COMPILE = march.aarch64.NIX_CFLAGS_COMPILE; + march.aarch64.NIX_CFLAGS_LINK = [ ]; combine-profiles = features: builtins.foldl' ( From 494278a41dca01dc602f64167ab5c9d78e80b3b5 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Fri, 19 Dec 2025 04:34:02 +0000 Subject: [PATCH 043/163] build(nix): introduce build profiles These are collections of commonly used C/CXX/LDFLAGS which can be recycled across other profiles. They will be connected to the build in a future commit. Signed-off-by: Daniel Noland --- nix/profiles.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/nix/profiles.nix b/nix/profiles.nix index c85c2d8c8..46aec3ec6 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -69,6 +69,17 @@ let builtins.foldl' ( acc: elem: builtins.mapAttrs (var: val: (acc.${var} or [ ]) ++ val) elem ) { } features; + profile = { + debug = combine-profiles [ + common + debug + ]; + release = combine-profiles [ + common + optimize + secure + ]; + }; in { debug = combine-profiles [ From 1d8133caa235abfd54207274cf53099efcbb98e6 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Fri, 19 Dec 2025 04:38:01 +0000 Subject: [PATCH 044/163] build(nix): introduce cross compile / profile infrastructure This commit builds on prior work to introduce a functioning cross compile infrastructure for the dataplane, complete C/CXX/LDFLAGS calculated based on the user supplied target and profile. As of this commit, you should be able to compile dpdk with any combination of debug / release profiles, x86_64 / aarch64 processors, and gnu / musl libc. All of the following commands should work and should continue to work unless stated otherwise. ``` nix-build -f default.nix pkgs.dpdk nix-build -f default.nix --argstr prof 'debug' pkgs.dpdk nix-build -f default.nix --argstr prof 'release' pkgs.dpdk nix-build -f default.nix --argstr target 'x86_64-unknown-linux-gnu' pkgs.dpdk nix-build -f default.nix --argstr target 'x86_64-unknown-linux-musl' pkgs.dpdk nix-build -f default.nix --argstr target 'aarch64-unknown-linux-gnu' pkgs.dpdk nix-build -f default.nix --argstr target 'aarch64-unknown-linux-musl' pkgs.dpdk nix-build -f default.nix --argstr prof 'debug' --argstr target x86_64-unknown-linux-gnu pkgs.dpdk nix-build -f default.nix --argstr prof 'debug' --argstr target x86_64-unknown-linux-musl pkgs.dpdk nix-build -f default.nix --argstr prof 'release' --argstr target x86_64-unknown-linux-gnu pkgs.dpdk nix-build -f default.nix --argstr prof 'release' --argstr target x86_64-unknown-linux-musl pkgs.dpdk nix-build -f default.nix --argstr prof 'debug' --argstr target aarch64-unknown-linux-gnu pkgs.dpdk nix-build -f default.nix --argstr prof 'debug' --argstr target aarch64-unknown-linux-musl pkgs.dpdk nix-build -f default.nix --argstr prof 'release' --argstr target aarch64-unknown-linux-gnu pkgs.dpdk nix-build -f default.nix --argstr prof 'release' --argstr target aarch64-unknown-linux-musl pkgs.dpdk ``` Signed-off-by: Daniel Noland --- default.nix | 58 ++++++++++++++++++++++++++++++++++-------------- nix/profiles.nix | 19 +++++++--------- 2 files changed, 49 insertions(+), 28 deletions(-) diff --git a/default.nix b/default.nix index e0b3f7ab9..b9761e3e5 100644 --- a/default.nix +++ b/default.nix @@ -1,28 +1,52 @@ +{ + target ? "x86_64-unknown-linux-gnu", + prof ? "debug", +}: let + arch = + { + "x86_64-unknown-linux-gnu" = { + target = "x86_64-unknown-linux-gnu"; + machine = "x86_64"; + nixarch = "gnu64"; + libc = "gnu"; + }; + "x86_64-unknown-linux-musl" = { + target = "x86_64-unknown-linux-musl"; + machine = "x86_64"; + nixarch = "musl64"; + libc = "musl"; + }; + "aarch64-unknown-linux-gnu" = { + target = "aarch64-unknown-linux-gnu"; + machine = "aarch64"; + nixarch = "aarch64-multiplatform"; + libc = "glibc"; + }; + "aarch64-unknown-linux-musl" = { + target = "aarch64-unknown-linux-musl"; + machine = "aarch64"; + nixarch = "aarch64-multiplatform-musl"; + libc = "musl"; + }; + } + .${target}; sources = import ./npins; - profiles = import ./nix/profiles.nix; - overlays.debug = import ./nix/overlays { - inherit sources; - env = profiles.debug; + profile = import ./nix/profiles.nix { + inherit prof; + arch = arch.machine; }; - overlays.release = import ./nix/overlays { + overlays = import ./nix/overlays { inherit sources; - env = profiles.release; - }; - pkgs.debug = import sources.nixpkgs { - overlays = [ - overlays.debug.dataplane - ]; + env = profile; }; - pkgs.release = import sources.nixpkgs { + pkgs = import sources.nixpkgs { overlays = [ - overlays.release.dataplane + overlays.dataplane ]; }; in { - -}: -{ - inherit sources pkgs; + inherit sources; + pkgs = pkgs.pkgsCross.${arch.nixarch}; } diff --git a/nix/profiles.nix b/nix/profiles.nix index 46aec3ec6..385983a96 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -1,3 +1,7 @@ +{ + arch, + prof, +}: let common.NIX_CFLAGS_COMPILE = [ "-glldb" @@ -81,14 +85,7 @@ let ]; }; in -{ - debug = combine-profiles [ - common - debug - ]; - release = combine-profiles [ - common - optimize - secure - ]; -} +(combine-profiles [ + profile."${prof}" + march."${arch}" +]) From 4eb38d7b9df82e1e7796a86b5ad022225fa5699c Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Fri, 19 Dec 2025 04:51:54 +0000 Subject: [PATCH 045/163] build(nix): compile dpdk_wrapper.a with nix Signed-off-by: Daniel Noland --- nix/overlays/dataplane.nix | 7 + nix/pkgs/dpdk-wrapper/default.nix | 35 + nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.c | 13 + nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.h | 1808 ++++++++++++++++++++++ 4 files changed, 1863 insertions(+) create mode 100644 nix/pkgs/dpdk-wrapper/default.nix create mode 100644 nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.c create mode 100644 nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.h diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index 3487cba14..ee22a0fbd 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -176,4 +176,11 @@ in # Also, while this library has a respectable security track record, this is also a super strong candidate for # cfi, safe-stack, and cf-protection. dpdk = dataplane-dep (final.callPackage ../pkgs/dpdk { src = sources.dpdk; }); + + # DPDK is largely composed of static-inline functions. + # We need to wrap those functions with "_w" variants so that we can actually call them from rust. + # + # This wrapping process does not really cause any performance issue due to lto; the compiler is going to "unwrap" + # these methods anyway. + dpdk-wrapper = dataplane-dep (final.callPackage ../pkgs/dpdk-wrapper { }); } diff --git a/nix/pkgs/dpdk-wrapper/default.nix b/nix/pkgs/dpdk-wrapper/default.nix new file mode 100644 index 000000000..46bf9a52d --- /dev/null +++ b/nix/pkgs/dpdk-wrapper/default.nix @@ -0,0 +1,35 @@ +{ + stdenv, + dpdk, + libbsd, +}: +stdenv.mkDerivation { + pname = "dpdk-wrapper"; + version = dpdk.version; + + src = ./src; + + nativeBuildInptus = [ + dpdk + libbsd + ]; + + outputs = [ + "dev" + "out" + ]; + + # DPDK marks all experimental apis as deprecated, but we wish to wrap such apis as well. Thus, turn off deprecation + # warnings. + CFLAGS = [ "-Wno-deprecated-declarations" ]; + + buildPhase = '' + set euxo pipefail + mkdir -p $dev/include $out/lib + $CC $CFLAGS -I${dpdk}/include -I${libbsd.dev}/include -c $src/dpdk_wrapper.c -o wrapper.o; + $AR rcs $out/lib/libdpdk_wrapper.a wrapper.o; + $RANLIB $out/lib/libdpdk_wrapper.a; + cp $src/*.h $dev/include + ''; + +} diff --git a/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.c b/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.c new file mode 100644 index 000000000..1e3f64324 --- /dev/null +++ b/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.c @@ -0,0 +1,13 @@ +#include "dpdk_wrapper.h" + +int wrte_errno() { + return rte_errno; +} + +uint16_t wrte_eth_rx_burst(uint16_t const port_id, uint16_t const queue_id, struct rte_mbuf **rx_pkts, uint16_t const nb_pkts) { + return rte_eth_rx_burst(port_id, queue_id, rx_pkts, nb_pkts); +} + +uint16_t wrte_eth_tx_burst(uint16_t const port_id, uint16_t const queue_id, struct rte_mbuf **tx_pkts, uint16_t const nb_pkts) { + return rte_eth_tx_burst(port_id, queue_id, tx_pkts, nb_pkts); +} diff --git a/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.h b/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.h new file mode 100644 index 000000000..96ec4cd0e --- /dev/null +++ b/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.h @@ -0,0 +1,1808 @@ +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Things which are either duplicated, totally inapplicable or not needed +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include // this is an internal header +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include + +// #include +// #include +// #include +// #include + +/** + * Thin wrapper to expose `rte_errno`. + * + * @return + * The last rte_errno value (thread local value). + */ +int rte_errno_get() { return rte_errno; } + +/** + * TX offloads to be set in [`rte_eth_tx_mode.offloads`]. + * + * This is a bitfield. Union these to enable multiple offloads. + * + * I wrapped these because the enum must be explicitly typed as 64 bit, but + * DPDK is not yet using the C23 standard (which would allow the inheritance + * notation with `uint64_t` seen here.). + */ +enum rte_eth_tx_offload : uint64_t { + TX_OFFLOAD_VLAN_INSERT = RTE_ETH_TX_OFFLOAD_VLAN_INSERT, + TX_OFFLOAD_IPV4_CKSUM = RTE_ETH_TX_OFFLOAD_IPV4_CKSUM, + TX_OFFLOAD_UDP_CKSUM = RTE_ETH_TX_OFFLOAD_UDP_CKSUM, + TX_OFFLOAD_TCP_CKSUM = RTE_ETH_TX_OFFLOAD_TCP_CKSUM, + TX_OFFLOAD_SCTP_CKSUM = RTE_ETH_TX_OFFLOAD_SCTP_CKSUM, + TX_OFFLOAD_TCP_TSO = RTE_ETH_TX_OFFLOAD_TCP_TSO, + TX_OFFLOAD_UDP_TSO = RTE_ETH_TX_OFFLOAD_UDP_TSO, + TX_OFFLOAD_OUTER_IPV4_CKSUM = RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM, + TX_OFFLOAD_QINQ_INSERT = RTE_ETH_TX_OFFLOAD_QINQ_INSERT, + TX_OFFLOAD_VXLAN_TNL_TSO = RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO, + TX_OFFLOAD_GRE_TNL_TSO = RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO, + TX_OFFLOAD_IPIP_TNL_TSO = RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO, + TX_OFFLOAD_GENEVE_TNL_TSO = RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO, + TX_OFFLOAD_MACSEC_INSERT = RTE_ETH_TX_OFFLOAD_MACSEC_INSERT, + TX_OFFLOAD_MT_LOCKFREE = RTE_ETH_TX_OFFLOAD_MT_LOCKFREE, + TX_OFFLOAD_MULTI_SEGS = RTE_ETH_TX_OFFLOAD_MULTI_SEGS, + TX_OFFLOAD_MBUF_FAST_FREE = RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE, + TX_OFFLOAD_SECURITY = RTE_ETH_TX_OFFLOAD_SECURITY, + TX_OFFLOAD_UDP_TNL_TSO = RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO, + TX_OFFLOAD_IP_TNL_TSO = RTE_ETH_TX_OFFLOAD_IP_TNL_TSO, + TX_OFFLOAD_OUTER_UDP_CKSUM = RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM, + TX_OFFLOAD_SEND_ON_TIMESTAMP = RTE_ETH_TX_OFFLOAD_SEND_ON_TIMESTAMP +}; + +/** + * RX offloads to be set in [`rte_eth_rx_mode.offloads`]. + * + * This is a bitfield. Union these to enable multiple offloads. + * + * I wrapped these because the enum must be explicitly typed as 64 bit, but + * DPDK is not yet using the C23 standard (which would allow the inheritance + * notation with `uint64_t` seen here.). + */ +enum wrte_eth_rx_offload : uint64_t { + RX_OFFLOAD_VLAN_STRIP = RTE_ETH_RX_OFFLOAD_VLAN_STRIP, + RX_OFFLOAD_IPV4_CKSUM = RTE_ETH_RX_OFFLOAD_IPV4_CKSUM, + RX_OFFLOAD_UDP_CKSUM = RTE_ETH_RX_OFFLOAD_UDP_CKSUM, + RX_OFFLOAD_TCP_CKSUM = RTE_ETH_RX_OFFLOAD_TCP_CKSUM, + RX_OFFLOAD_TCP_LRO = RTE_ETH_RX_OFFLOAD_TCP_LRO, + RX_OFFLOAD_QINQ_STRIP = RTE_ETH_RX_OFFLOAD_QINQ_STRIP, + RX_OFFLOAD_OUTER_IPV4_CKSUM = RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM, + RX_OFFLOAD_MACSEC_STRIP = RTE_ETH_RX_OFFLOAD_MACSEC_STRIP, + RX_OFFLOAD_VLAN_FILTER = RTE_ETH_RX_OFFLOAD_VLAN_FILTER, + RX_OFFLOAD_VLAN_EXTEND = RTE_ETH_RX_OFFLOAD_VLAN_EXTEND, + RX_OFFLOAD_SCATTER = RTE_ETH_RX_OFFLOAD_SCATTER, + RX_OFFLOAD_TIMESTAMP = RTE_ETH_RX_OFFLOAD_TIMESTAMP, + RX_OFFLOAD_SECURITY = RTE_ETH_RX_OFFLOAD_SECURITY, + RX_OFFLOAD_KEEP_CRC = RTE_ETH_RX_OFFLOAD_KEEP_CRC, + RX_OFFLOAD_SCTP_CKSUM = RTE_ETH_RX_OFFLOAD_SCTP_CKSUM, + RX_OFFLOAD_OUTER_UDP_CKSUM = RTE_ETH_RX_OFFLOAD_OUTER_UDP_CKSUM, + RX_OFFLOAD_RSS_HASH = RTE_ETH_RX_OFFLOAD_RSS_HASH, + RX_OFFLOAD_BUFFER_SPLIT = RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT, +}; + +// Static wrappers + +int rte_is_aligned_w(const const void *const ptr, const unsigned int align) { + return rte_is_aligned(ptr, align); +} +void rte_atomic_thread_fence_w(rte_memory_order memorder) { + rte_atomic_thread_fence(memorder); +} +int rte_atomic16_cmpset_w(uint16_t *dst, uint16_t exp, uint16_t src) { + return rte_atomic16_cmpset(dst, exp, src); +} +uint16_t rte_atomic16_exchange_w(uint16_t *dst, uint16_t val) { + return rte_atomic16_exchange(dst, val); +} +void rte_atomic16_init_w(rte_atomic16_t *v) { rte_atomic16_init(v); } +int16_t rte_atomic16_read_w(const rte_atomic16_t *v) { + return rte_atomic16_read(v); +} +void rte_atomic16_set_w(rte_atomic16_t *v, int16_t new_value) { + rte_atomic16_set(v, new_value); +} +void rte_atomic16_add_w(rte_atomic16_t *v, int16_t inc) { + rte_atomic16_add(v, inc); +} +void rte_atomic16_sub_w(rte_atomic16_t *v, int16_t dec) { + rte_atomic16_sub(v, dec); +} +void rte_atomic16_inc_w(rte_atomic16_t *v) { rte_atomic16_inc(v); } +void rte_atomic16_dec_w(rte_atomic16_t *v) { rte_atomic16_dec(v); } +int16_t rte_atomic16_add_return_w(rte_atomic16_t *v, int16_t inc) { + return rte_atomic16_add_return(v, inc); +} +int16_t rte_atomic16_sub_return_w(rte_atomic16_t *v, int16_t dec) { + return rte_atomic16_sub_return(v, dec); +} +int rte_atomic16_inc_and_test_w(rte_atomic16_t *v) { + return rte_atomic16_inc_and_test(v); +} +int rte_atomic16_dec_and_test_w(rte_atomic16_t *v) { + return rte_atomic16_dec_and_test(v); +} +int rte_atomic16_test_and_set_w(rte_atomic16_t *v) { + return rte_atomic16_test_and_set(v); +} +void rte_atomic16_clear_w(rte_atomic16_t *v) { rte_atomic16_clear(v); } +int rte_atomic32_cmpset_w(uint32_t *dst, uint32_t exp, uint32_t src) { + return rte_atomic32_cmpset(dst, exp, src); +} +uint32_t rte_atomic32_exchange_w(uint32_t *dst, uint32_t val) { + return rte_atomic32_exchange(dst, val); +} +void rte_atomic32_init_w(rte_atomic32_t *v) { rte_atomic32_init(v); } +int32_t rte_atomic32_read_w(const rte_atomic32_t *v) { + return rte_atomic32_read(v); +} +void rte_atomic32_set_w(rte_atomic32_t *v, int32_t new_value) { + rte_atomic32_set(v, new_value); +} +void rte_atomic32_add_w(rte_atomic32_t *v, int32_t inc) { + rte_atomic32_add(v, inc); +} +void rte_atomic32_sub_w(rte_atomic32_t *v, int32_t dec) { + rte_atomic32_sub(v, dec); +} +void rte_atomic32_inc_w(rte_atomic32_t *v) { rte_atomic32_inc(v); } +void rte_atomic32_dec_w(rte_atomic32_t *v) { rte_atomic32_dec(v); } +int32_t rte_atomic32_add_return_w(rte_atomic32_t *v, int32_t inc) { + return rte_atomic32_add_return(v, inc); +} +int32_t rte_atomic32_sub_return_w(rte_atomic32_t *v, int32_t dec) { + return rte_atomic32_sub_return(v, dec); +} +int rte_atomic32_inc_and_test_w(rte_atomic32_t *v) { + return rte_atomic32_inc_and_test(v); +} +int rte_atomic32_dec_and_test_w(rte_atomic32_t *v) { + return rte_atomic32_dec_and_test(v); +} +int rte_atomic32_test_and_set_w(rte_atomic32_t *v) { + return rte_atomic32_test_and_set(v); +} +void rte_atomic32_clear_w(rte_atomic32_t *v) { rte_atomic32_clear(v); } +int rte_atomic64_cmpset_w(uint64_t *dst, uint64_t exp, uint64_t src) { + return rte_atomic64_cmpset(dst, exp, src); +} +uint64_t rte_atomic64_exchange_w(uint64_t *dst, uint64_t val) { + return rte_atomic64_exchange(dst, val); +} +void rte_atomic64_init_w(rte_atomic64_t *v) { rte_atomic64_init(v); } +int64_t rte_atomic64_read_w(rte_atomic64_t *v) { return rte_atomic64_read(v); } +void rte_atomic64_set_w(rte_atomic64_t *v, int64_t new_value) { + rte_atomic64_set(v, new_value); +} +void rte_atomic64_add_w(rte_atomic64_t *v, int64_t inc) { + rte_atomic64_add(v, inc); +} +void rte_atomic64_sub_w(rte_atomic64_t *v, int64_t dec) { + rte_atomic64_sub(v, dec); +} +void rte_atomic64_inc_w(rte_atomic64_t *v) { rte_atomic64_inc(v); } +void rte_atomic64_dec_w(rte_atomic64_t *v) { rte_atomic64_dec(v); } +int64_t rte_atomic64_add_return_w(rte_atomic64_t *v, int64_t inc) { + return rte_atomic64_add_return(v, inc); +} +int64_t rte_atomic64_sub_return_w(rte_atomic64_t *v, int64_t dec) { + return rte_atomic64_sub_return(v, dec); +} +int rte_atomic64_inc_and_test_w(rte_atomic64_t *v) { + return rte_atomic64_inc_and_test(v); +} +int rte_atomic64_dec_and_test_w(rte_atomic64_t *v) { + return rte_atomic64_dec_and_test(v); +} +int rte_atomic64_test_and_set_w(rte_atomic64_t *v) { + return rte_atomic64_test_and_set(v); +} +void rte_atomic64_clear_w(rte_atomic64_t *v) { rte_atomic64_clear(v); } +void rte_smp_mb_w(void) { rte_smp_mb(); } +uint64_t rte_get_tsc_cycles_w(void) { return rte_get_tsc_cycles(); } +uint64_t rte_get_timer_cycles_w(void) { return rte_get_timer_cycles(); } +uint64_t rte_get_timer_hz_w(void) { return rte_get_timer_hz(); } +void rte_delay_ms_w(unsigned int ms) { rte_delay_ms(ms); } +uint64_t rte_rdtsc_w(void) { return rte_rdtsc(); } +uint64_t rte_rdtsc_precise_w(void) { return rte_rdtsc_precise(); } +size_t rte_strlcpy_w(char *dst, const char *src, size_t size) { + return rte_strlcpy(dst, src, size); +} +size_t rte_strlcat_w(char *dst, const char *src, size_t size) { + return rte_strlcat(dst, src, size); +} +const char *rte_str_skip_leading_spaces_w(const char *src) { + return rte_str_skip_leading_spaces(src); +} +void rte_uuid_copy_w(rte_uuid_t dst, const rte_uuid_t src) { + rte_uuid_copy(dst, src); +} +int rte_gettid_w(void) { return rte_gettid(); } +unsigned int rte_lcore_id_w(void) { return rte_lcore_id(); } +void rte_pause_w(void) { rte_pause(); } +void rte_wait_until_equal_16_w(uint16_t *addr, uint16_t expected, + rte_memory_order memorder) { + rte_wait_until_equal_16(addr, expected, memorder); +} +void rte_wait_until_equal_32_w(uint32_t *addr, uint32_t expected, + rte_memory_order memorder) { + rte_wait_until_equal_32(addr, expected, memorder); +} +void rte_wait_until_equal_64_w(uint64_t *addr, uint64_t expected, + rte_memory_order memorder) { + rte_wait_until_equal_64(addr, expected, memorder); +} +void rte_spinlock_init_w(rte_spinlock_t *sl) { rte_spinlock_init(sl); } +void rte_spinlock_lock_w(rte_spinlock_t *sl) { rte_spinlock_lock(sl); } +void rte_spinlock_unlock_w(rte_spinlock_t *sl) { rte_spinlock_unlock(sl); } +int rte_spinlock_trylock_w(rte_spinlock_t *sl) { + return rte_spinlock_trylock(sl); +} +int rte_spinlock_is_locked_w(rte_spinlock_t *sl) { + return rte_spinlock_is_locked(sl); +} +int rte_tm_supported_w(void) { return rte_tm_supported(); } +void rte_spinlock_lock_tm_w(rte_spinlock_t *sl) { rte_spinlock_lock_tm(sl); } +void rte_spinlock_unlock_tm_w(rte_spinlock_t *sl) { + rte_spinlock_unlock_tm(sl); +} +int rte_spinlock_trylock_tm_w(rte_spinlock_t *sl) { + return rte_spinlock_trylock_tm(sl); +} +void rte_spinlock_recursive_init_w(rte_spinlock_recursive_t *slr) { + rte_spinlock_recursive_init(slr); +} +void rte_spinlock_recursive_lock_w(rte_spinlock_recursive_t *slr) { + rte_spinlock_recursive_lock(slr); +} +void rte_spinlock_recursive_unlock_w(rte_spinlock_recursive_t *slr) { + rte_spinlock_recursive_unlock(slr); +} +int rte_spinlock_recursive_trylock_w(rte_spinlock_recursive_t *slr) { + return rte_spinlock_recursive_trylock(slr); +} +void rte_spinlock_recursive_lock_tm_w(rte_spinlock_recursive_t *slr) { + rte_spinlock_recursive_lock_tm(slr); +} +void rte_spinlock_recursive_unlock_tm_w(rte_spinlock_recursive_t *slr) { + rte_spinlock_recursive_unlock_tm(slr); +} +int rte_spinlock_recursive_trylock_tm_w(rte_spinlock_recursive_t *slr) { + return rte_spinlock_recursive_trylock_tm(slr); +} +unsigned int rte_xbegin_w(void) { return rte_xbegin(); } +void rte_xend_w(void) { rte_xend(); } +int rte_xtest_w(void) { return rte_xtest(); } +int rte_try_tm_w(int *lock) { return rte_try_tm(lock); } +uint32_t rte_bit_relaxed_get32_w(unsigned int nr, uint32_t *addr) { + return rte_bit_relaxed_get32(nr, addr); +} +void rte_bit_relaxed_set32_w(unsigned int nr, uint32_t *addr) { + rte_bit_relaxed_set32(nr, addr); +} +void rte_bit_relaxed_clear32_w(unsigned int nr, uint32_t *addr) { + rte_bit_relaxed_clear32(nr, addr); +} +uint32_t rte_bit_relaxed_test_and_set32_w(unsigned int nr, uint32_t *addr) { + return rte_bit_relaxed_test_and_set32(nr, addr); +} +uint32_t rte_bit_relaxed_test_and_clear32_w(unsigned int nr, uint32_t *addr) { + return rte_bit_relaxed_test_and_clear32(nr, addr); +} +uint64_t rte_bit_relaxed_get64_w(unsigned int nr, uint64_t *addr) { + return rte_bit_relaxed_get64(nr, addr); +} +void rte_bit_relaxed_set64_w(unsigned int nr, uint64_t *addr) { + rte_bit_relaxed_set64(nr, addr); +} +void rte_bit_relaxed_clear64_w(unsigned int nr, uint64_t *addr) { + rte_bit_relaxed_clear64(nr, addr); +} +uint64_t rte_bit_relaxed_test_and_set64_w(unsigned int nr, uint64_t *addr) { + return rte_bit_relaxed_test_and_set64(nr, addr); +} +uint64_t rte_bit_relaxed_test_and_clear64_w(unsigned int nr, uint64_t *addr) { + return rte_bit_relaxed_test_and_clear64(nr, addr); +} +unsigned int rte_clz32_w(uint32_t v) { return rte_clz32(v); } +unsigned int rte_clz64_w(uint64_t v) { return rte_clz64(v); } +unsigned int rte_ctz32_w(uint32_t v) { return rte_ctz32(v); } +unsigned int rte_ctz64_w(uint64_t v) { return rte_ctz64(v); } +unsigned int rte_popcount32_w(uint32_t v) { return rte_popcount32(v); } +unsigned int rte_popcount64_w(uint64_t v) { return rte_popcount64(v); } +uint32_t rte_combine32ms1b_w(uint32_t x) { return rte_combine32ms1b(x); } +uint64_t rte_combine64ms1b_w(uint64_t v) { return rte_combine64ms1b(v); } +uint32_t rte_bsf32_w(uint32_t v) { return rte_bsf32(v); } +int rte_bsf32_safe_w(uint32_t v, uint32_t *pos) { + return rte_bsf32_safe(v, pos); +} +uint32_t rte_bsf64_w(uint64_t v) { return rte_bsf64(v); } +int rte_bsf64_safe_w(uint64_t v, uint32_t *pos) { + return rte_bsf64_safe(v, pos); +} +uint32_t rte_fls_u32_w(uint32_t x) { return rte_fls_u32(x); } +uint32_t rte_fls_u64_w(uint64_t x) { return rte_fls_u64(x); } +int rte_is_power_of_2_w(uint32_t n) { return rte_is_power_of_2(n); } +uint32_t rte_align32pow2_w(uint32_t x) { return rte_align32pow2(x); } +uint32_t rte_align32prevpow2_w(uint32_t x) { return rte_align32prevpow2(x); } +uint64_t rte_align64pow2_w(uint64_t v) { return rte_align64pow2(v); } +uint64_t rte_align64prevpow2_w(uint64_t v) { return rte_align64prevpow2(v); } +uint32_t rte_log2_u32_w(uint32_t v) { return rte_log2_u32(v); } +uint32_t rte_log2_u64_w(uint64_t v) { return rte_log2_u64(v); } +void rte_rwlock_init_w(rte_rwlock_t *rwl) { rte_rwlock_init(rwl); } +void rte_rwlock_read_lock_w(rte_rwlock_t *rwl) { rte_rwlock_read_lock(rwl); } +int rte_rwlock_read_trylock_w(rte_rwlock_t *rwl) { + return rte_rwlock_read_trylock(rwl); +} +void rte_rwlock_read_unlock_w(rte_rwlock_t *rwl) { + rte_rwlock_read_unlock(rwl); +} +int rte_rwlock_write_trylock_w(rte_rwlock_t *rwl) { + return rte_rwlock_write_trylock(rwl); +} +void rte_rwlock_write_lock_w(rte_rwlock_t *rwl) { rte_rwlock_write_lock(rwl); } +void rte_rwlock_write_unlock_w(rte_rwlock_t *rwl) { + rte_rwlock_write_unlock(rwl); +} +int rte_rwlock_write_is_locked_w(rte_rwlock_t *rwl) { + return rte_rwlock_write_is_locked(rwl); +} +void rte_rwlock_read_lock_tm_w(rte_rwlock_t *rwl) { + rte_rwlock_read_lock_tm(rwl); +} +void rte_rwlock_read_unlock_tm_w(rte_rwlock_t *rwl) { + rte_rwlock_read_unlock_tm(rwl); +} +void rte_rwlock_write_lock_tm_w(rte_rwlock_t *rwl) { + rte_rwlock_write_lock_tm(rwl); +} +void rte_rwlock_write_unlock_tm_w(rte_rwlock_t *rwl) { + rte_rwlock_write_unlock_tm(rwl); +} +unsigned int rte_ring_mp_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_enqueue_bulk_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_sp_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space) { + return rte_ring_sp_enqueue_bulk_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_mp_hts_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_hts_enqueue_bulk_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_mc_hts_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_hts_dequeue_bulk_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_mp_hts_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_hts_enqueue_burst_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_mc_hts_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_hts_dequeue_burst_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_mp_hts_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_hts_enqueue_bulk(r, obj_table, n, free_space); +} +unsigned int rte_ring_mc_hts_dequeue_bulk_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available) { + return rte_ring_mc_hts_dequeue_bulk(r, obj_table, n, available); +} +unsigned int rte_ring_mp_hts_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_hts_enqueue_burst(r, obj_table, n, free_space); +} +unsigned int rte_ring_mc_hts_dequeue_burst_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available) { + return rte_ring_mc_hts_dequeue_burst(r, obj_table, n, available); +} +unsigned int rte_ring_mp_rts_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_rts_enqueue_bulk_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_mc_rts_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_rts_dequeue_bulk_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_mp_rts_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_rts_enqueue_burst_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_mc_rts_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_rts_dequeue_burst_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_mp_rts_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_rts_enqueue_bulk(r, obj_table, n, free_space); +} +unsigned int rte_ring_mc_rts_dequeue_bulk_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available) { + return rte_ring_mc_rts_dequeue_bulk(r, obj_table, n, available); +} +unsigned int rte_ring_mp_rts_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_rts_enqueue_burst(r, obj_table, n, free_space); +} +unsigned int rte_ring_mc_rts_dequeue_burst_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available) { + return rte_ring_mc_rts_dequeue_burst(r, obj_table, n, available); +} +uint32_t rte_ring_get_prod_htd_max_w(const struct rte_ring *r) { + return rte_ring_get_prod_htd_max(r); +} +int rte_ring_set_prod_htd_max_w(struct rte_ring *r, uint32_t v) { + return rte_ring_set_prod_htd_max(r, v); +} +uint32_t rte_ring_get_cons_htd_max_w(const struct rte_ring *r) { + return rte_ring_get_cons_htd_max(r); +} +int rte_ring_set_cons_htd_max_w(struct rte_ring *r, uint32_t v) { + return rte_ring_set_cons_htd_max(r, v); +} +unsigned int rte_ring_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_bulk_elem(r, obj_table, esize, n, free_space); +} +int rte_ring_mp_enqueue_elem_w(struct rte_ring *r, void *obj, + unsigned int esize) { + return rte_ring_mp_enqueue_elem(r, obj, esize); +} +int rte_ring_sp_enqueue_elem_w(struct rte_ring *r, void *obj, + unsigned int esize) { + return rte_ring_sp_enqueue_elem(r, obj, esize); +} +int rte_ring_enqueue_elem_w(struct rte_ring *r, void *obj, unsigned int esize) { + return rte_ring_enqueue_elem(r, obj, esize); +} +unsigned int rte_ring_mc_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available) { + return rte_ring_mc_dequeue_bulk_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_sc_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available) { + return rte_ring_sc_dequeue_bulk_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_dequeue_bulk_elem_w(struct rte_ring *r, void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available) { + return rte_ring_dequeue_bulk_elem(r, obj_table, esize, n, available); +} +int rte_ring_mc_dequeue_elem_w(struct rte_ring *r, void *obj_p, + unsigned int esize) { + return rte_ring_mc_dequeue_elem(r, obj_p, esize); +} +int rte_ring_sc_dequeue_elem_w(struct rte_ring *r, void *obj_p, + unsigned int esize) { + return rte_ring_sc_dequeue_elem(r, obj_p, esize); +} +int rte_ring_dequeue_elem_w(struct rte_ring *r, void *obj_p, + unsigned int esize) { + return rte_ring_dequeue_elem(r, obj_p, esize); +} +unsigned int rte_ring_mp_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_enqueue_burst_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_sp_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space) { + return rte_ring_sp_enqueue_burst_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_burst_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_mc_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_dequeue_burst_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_sc_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_sc_dequeue_burst_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_dequeue_burst_elem_w(struct rte_ring *r, void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available) { + return rte_ring_dequeue_burst_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_enqueue_bulk_elem_start_w(struct rte_ring *r, + unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_bulk_elem_start(r, n, free_space); +} +unsigned int rte_ring_enqueue_bulk_start_w(struct rte_ring *r, unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_bulk_start(r, n, free_space); +} +unsigned int rte_ring_enqueue_burst_elem_start_w(struct rte_ring *r, + unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_burst_elem_start(r, n, free_space); +} +unsigned int rte_ring_enqueue_burst_start_w(struct rte_ring *r, unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_burst_start(r, n, free_space); +} +void rte_ring_enqueue_elem_finish_w(struct rte_ring *r, const void *obj_table, + unsigned int esize, unsigned int n) { + rte_ring_enqueue_elem_finish(r, obj_table, esize, n); +} +void rte_ring_enqueue_finish_w(struct rte_ring *r, void *const *obj_table, + unsigned int n) { + rte_ring_enqueue_finish(r, obj_table, n); +} +unsigned int rte_ring_dequeue_bulk_elem_start_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_dequeue_bulk_elem_start(r, obj_table, esize, n, available); +} +unsigned int rte_ring_dequeue_bulk_start_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available) { + return rte_ring_dequeue_bulk_start(r, obj_table, n, available); +} +unsigned int rte_ring_dequeue_burst_elem_start_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_dequeue_burst_elem_start(r, obj_table, esize, n, available); +} +unsigned int rte_ring_dequeue_burst_start_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available) { + return rte_ring_dequeue_burst_start(r, obj_table, n, available); +} +void rte_ring_dequeue_elem_finish_w(struct rte_ring *r, unsigned int n) { + rte_ring_dequeue_elem_finish(r, n); +} +void rte_ring_dequeue_finish_w(struct rte_ring *r, unsigned int n) { + rte_ring_dequeue_finish(r, n); +} +unsigned int rte_ring_enqueue_zc_bulk_elem_start_w(struct rte_ring *r, + unsigned int esize, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *free_space) { + return rte_ring_enqueue_zc_bulk_elem_start(r, esize, n, zcd, free_space); +} +unsigned int rte_ring_enqueue_zc_bulk_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *free_space) { + return rte_ring_enqueue_zc_bulk_start(r, n, zcd, free_space); +} +unsigned int rte_ring_enqueue_zc_burst_elem_start_w( + struct rte_ring *r, unsigned int esize, unsigned int n, + struct rte_ring_zc_data *zcd, unsigned int *free_space) { + return rte_ring_enqueue_zc_burst_elem_start(r, esize, n, zcd, free_space); +} +unsigned int rte_ring_enqueue_zc_burst_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *free_space) { + return rte_ring_enqueue_zc_burst_start(r, n, zcd, free_space); +} +void rte_ring_enqueue_zc_elem_finish_w(struct rte_ring *r, unsigned int n) { + rte_ring_enqueue_zc_elem_finish(r, n); +} +void rte_ring_enqueue_zc_finish_w(struct rte_ring *r, unsigned int n) { + rte_ring_enqueue_zc_finish(r, n); +} +unsigned int rte_ring_dequeue_zc_bulk_elem_start_w(struct rte_ring *r, + unsigned int esize, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *available) { + return rte_ring_dequeue_zc_bulk_elem_start(r, esize, n, zcd, available); +} +unsigned int rte_ring_dequeue_zc_bulk_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *available) { + return rte_ring_dequeue_zc_bulk_start(r, n, zcd, available); +} +unsigned int rte_ring_dequeue_zc_burst_elem_start_w( + struct rte_ring *r, unsigned int esize, unsigned int n, + struct rte_ring_zc_data *zcd, unsigned int *available) { + return rte_ring_dequeue_zc_burst_elem_start(r, esize, n, zcd, available); +} +unsigned int rte_ring_dequeue_zc_burst_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *available) { + return rte_ring_dequeue_zc_burst_start(r, n, zcd, available); +} +void rte_ring_dequeue_zc_elem_finish_w(struct rte_ring *r, unsigned int n) { + rte_ring_dequeue_zc_elem_finish(r, n); +} +void rte_ring_dequeue_zc_finish_w(struct rte_ring *r, unsigned int n) { + rte_ring_dequeue_zc_finish(r, n); +} +unsigned int rte_ring_mp_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_enqueue_bulk(r, obj_table, n, free_space); +} +unsigned int rte_ring_sp_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space) { + return rte_ring_sp_enqueue_bulk(r, obj_table, n, free_space); +} +unsigned int rte_ring_enqueue_bulk_w(struct rte_ring *r, void *const *obj_table, + unsigned int n, unsigned int *free_space) { + return rte_ring_enqueue_bulk(r, obj_table, n, free_space); +} +int rte_ring_mp_enqueue_w(struct rte_ring *r, void *obj) { + return rte_ring_mp_enqueue(r, obj); +} +int rte_ring_sp_enqueue_w(struct rte_ring *r, void *obj) { + return rte_ring_sp_enqueue(r, obj); +} +int rte_ring_enqueue_w(struct rte_ring *r, void *obj) { + return rte_ring_enqueue(r, obj); +} +unsigned int rte_ring_mc_dequeue_bulk_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_dequeue_bulk(r, obj_table, n, available); +} +unsigned int rte_ring_sc_dequeue_bulk_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available) { + return rte_ring_sc_dequeue_bulk(r, obj_table, n, available); +} +unsigned int rte_ring_dequeue_bulk_w(struct rte_ring *r, void **obj_table, + unsigned int n, unsigned int *available) { + return rte_ring_dequeue_bulk(r, obj_table, n, available); +} +int rte_ring_mc_dequeue_w(struct rte_ring *r, void **obj_p) { + return rte_ring_mc_dequeue(r, obj_p); +} +int rte_ring_sc_dequeue_w(struct rte_ring *r, void **obj_p) { + return rte_ring_sc_dequeue(r, obj_p); +} +int rte_ring_dequeue_w(struct rte_ring *r, void **obj_p) { + return rte_ring_dequeue(r, obj_p); +} +unsigned int rte_ring_count_w(const struct rte_ring *r) { + return rte_ring_count(r); +} +unsigned int rte_ring_free_count_w(const struct rte_ring *r) { + return rte_ring_free_count(r); +} +int rte_ring_full_w(const struct rte_ring *r) { return rte_ring_full(r); } +int rte_ring_empty_w(const struct rte_ring *r) { return rte_ring_empty(r); } +unsigned int rte_ring_get_size_w(const struct rte_ring *r) { + return rte_ring_get_size(r); +} +unsigned int rte_ring_get_capacity_w(const struct rte_ring *r) { + return rte_ring_get_capacity(r); +} +enum rte_ring_sync_type +rte_ring_get_prod_sync_type_w(const struct rte_ring *r) { + return rte_ring_get_prod_sync_type(r); +} +int rte_ring_is_prod_single_w(const struct rte_ring *r) { + return rte_ring_is_prod_single(r); +} +enum rte_ring_sync_type +rte_ring_get_cons_sync_type_w(const struct rte_ring *r) { + return rte_ring_get_cons_sync_type(r); +} +int rte_ring_is_cons_single_w(const struct rte_ring *r) { + return rte_ring_is_cons_single(r); +} +unsigned int rte_ring_mp_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_enqueue_burst(r, obj_table, n, free_space); +} +unsigned int rte_ring_sp_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space) { + return rte_ring_sp_enqueue_burst(r, obj_table, n, free_space); +} +unsigned int rte_ring_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_burst(r, obj_table, n, free_space); +} +unsigned int rte_ring_mc_dequeue_burst_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_dequeue_burst(r, obj_table, n, available); +} +unsigned int rte_ring_sc_dequeue_burst_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available) { + return rte_ring_sc_dequeue_burst(r, obj_table, n, available); +} +unsigned int rte_ring_dequeue_burst_w(struct rte_ring *r, void **obj_table, + unsigned int n, unsigned int *available) { + return rte_ring_dequeue_burst(r, obj_table, n, available); +} +void *rte_memcpy_w(void *dst, const void *src, size_t n) { + return rte_memcpy(dst, src, n); +} +void *rte_mov15_or_less_w(void *dst, const void *src, size_t n) { + return rte_mov15_or_less(dst, src, n); +} +void rte_mov16_w(uint8_t *dst, const uint8_t *src) { rte_mov16(dst, src); } +void rte_mov32_w(uint8_t *dst, const uint8_t *src) { rte_mov32(dst, src); } +void rte_mov64_w(uint8_t *dst, const uint8_t *src) { rte_mov64(dst, src); } +void rte_mov256_w(uint8_t *dst, const uint8_t *src) { rte_mov256(dst, src); } +void *rte_memcpy_generic_w(void *dst, const void *src, size_t n) { + return rte_memcpy_generic(dst, src, n); +} +void *rte_memcpy_aligned_w(void *dst, const void *src, size_t n) { + return rte_memcpy_aligned(dst, src, n); +} +struct rte_mempool_objhdr *rte_mempool_get_header_w(void *obj) { + return rte_mempool_get_header(obj); +} +struct rte_mempool *rte_mempool_from_obj_w(void *obj) { + return rte_mempool_from_obj(obj); +} +struct rte_mempool_objtlr *rte_mempool_get_trailer_w(void *obj) { + return rte_mempool_get_trailer(obj); +} +struct rte_mempool_ops *rte_mempool_get_ops_w(int ops_index) { + return rte_mempool_get_ops(ops_index); +} +int rte_mempool_ops_dequeue_bulk_w(struct rte_mempool *mp, void **obj_table, + unsigned int n) { + return rte_mempool_ops_dequeue_bulk(mp, obj_table, n); +} +int rte_mempool_ops_dequeue_contig_blocks_w(struct rte_mempool *mp, + void **first_obj_table, + unsigned int n) { + return rte_mempool_ops_dequeue_contig_blocks(mp, first_obj_table, n); +} +int rte_mempool_ops_enqueue_bulk_w(struct rte_mempool *mp, + void *const *obj_table, unsigned int n) { + return rte_mempool_ops_enqueue_bulk(mp, obj_table, n); +} +struct rte_mempool_cache *rte_mempool_default_cache_w(struct rte_mempool *mp, + unsigned int lcore_id) { + return rte_mempool_default_cache(mp, lcore_id); +} +void rte_mempool_cache_flush_w(struct rte_mempool_cache *cache, + struct rte_mempool *mp) { + rte_mempool_cache_flush(cache, mp); +} +void rte_mempool_do_generic_put_w(struct rte_mempool *mp, + void *const *obj_table, unsigned int n, + struct rte_mempool_cache *cache) { + rte_mempool_do_generic_put(mp, obj_table, n, cache); +} +void rte_mempool_generic_put_w(struct rte_mempool *mp, void *const *obj_table, + unsigned int n, + struct rte_mempool_cache *cache) { + rte_mempool_generic_put(mp, obj_table, n, cache); +} +void rte_mempool_put_bulk_w(struct rte_mempool *mp, void *const *obj_table, + unsigned int n) { + rte_mempool_put_bulk(mp, obj_table, n); +} +void rte_mempool_put_w(struct rte_mempool *mp, void *obj) { + rte_mempool_put(mp, obj); +} +int rte_mempool_do_generic_get_w(struct rte_mempool *mp, void **obj_table, + unsigned int n, + struct rte_mempool_cache *cache) { + return rte_mempool_do_generic_get(mp, obj_table, n, cache); +} +int rte_mempool_generic_get_w(struct rte_mempool *mp, void **obj_table, + unsigned int n, struct rte_mempool_cache *cache) { + return rte_mempool_generic_get(mp, obj_table, n, cache); +} +int rte_mempool_get_bulk_w(struct rte_mempool *mp, void **obj_table, + unsigned int n) { + return rte_mempool_get_bulk(mp, obj_table, n); +} +int rte_mempool_get_w(struct rte_mempool *mp, void **obj_p) { + return rte_mempool_get(mp, obj_p); +} +int rte_mempool_get_contig_blocks_w(struct rte_mempool *mp, + void **first_obj_table, unsigned int n) { + return rte_mempool_get_contig_blocks(mp, first_obj_table, n); +} +int rte_mempool_full_w(const struct rte_mempool *mp) { + return rte_mempool_full(mp); +} +int rte_mempool_empty_w(const struct rte_mempool *mp) { + return rte_mempool_empty(mp); +} +rte_iova_t rte_mempool_virt2iova_w(const void *elt) { + return rte_mempool_virt2iova(elt); +} +void *rte_mempool_get_priv_w(struct rte_mempool *mp) { + return rte_mempool_get_priv(mp); +} +void rte_prefetch0_w(const void *p) { rte_prefetch0(p); } +void rte_prefetch1_w(const void *p) { rte_prefetch1(p); } +void rte_prefetch2_w(const void *p) { rte_prefetch2(p); } +void rte_prefetch_non_temporal_w(const void *p) { + rte_prefetch_non_temporal(p); +} +void rte_prefetch0_write_w(const void *p) { rte_prefetch0_write(p); } +void rte_prefetch1_write_w(const void *p) { rte_prefetch1_write(p); } +void rte_prefetch2_write_w(const void *p) { rte_prefetch2_write(p); } +void rte_cldemote_w(const void *p) { rte_cldemote(p); } +uint16_t rte_constant_bswap16_w(uint16_t x) { return rte_constant_bswap16(x); } +uint32_t rte_constant_bswap32_w(uint32_t x) { return rte_constant_bswap32(x); } +uint64_t rte_constant_bswap64_w(uint64_t x) { return rte_constant_bswap64(x); } +uint16_t rte_arch_bswap16_w(uint16_t _x) { return rte_arch_bswap16(_x); } +uint32_t rte_arch_bswap32_w(uint32_t _x) { return rte_arch_bswap32(_x); } +uint64_t rte_arch_bswap64_w(uint64_t _x) { return rte_arch_bswap64(_x); } +void rte_mbuf_prefetch_part1_w(struct rte_mbuf *m) { + rte_mbuf_prefetch_part1(m); +} +void rte_mbuf_prefetch_part2_w(struct rte_mbuf *m) { + rte_mbuf_prefetch_part2(m); +} +uint16_t rte_pktmbuf_priv_size_w(struct rte_mempool *mp) { + return rte_pktmbuf_priv_size(mp); +} +rte_iova_t rte_mbuf_iova_get_w(const struct rte_mbuf *m) { + return rte_mbuf_iova_get(m); +} +void rte_mbuf_iova_set_w(struct rte_mbuf *m, rte_iova_t iova) { + rte_mbuf_iova_set(m, iova); +} +rte_iova_t rte_mbuf_data_iova_w(const struct rte_mbuf *mb) { + return rte_mbuf_data_iova(mb); +} +rte_iova_t rte_mbuf_data_iova_default_w(const struct rte_mbuf *mb) { + return rte_mbuf_data_iova_default(mb); +} +struct rte_mbuf *rte_mbuf_from_indirect_w(struct rte_mbuf *mi) { + return rte_mbuf_from_indirect(mi); +} +char *rte_mbuf_buf_addr_w(struct rte_mbuf *mb, struct rte_mempool *mp) { + return rte_mbuf_buf_addr(mb, mp); +} +char *rte_mbuf_data_addr_default_w(struct rte_mbuf *mb) { + return rte_mbuf_data_addr_default(mb); +} +char *rte_mbuf_to_baddr_w(struct rte_mbuf *md) { return rte_mbuf_to_baddr(md); } +void *rte_mbuf_to_priv_w(struct rte_mbuf *m) { return rte_mbuf_to_priv(m); } +uint32_t rte_pktmbuf_priv_flags_w(struct rte_mempool *mp) { + return rte_pktmbuf_priv_flags(mp); +} +uint16_t rte_mbuf_refcnt_read_w(const struct rte_mbuf *m) { + return rte_mbuf_refcnt_read(m); +} +void rte_mbuf_refcnt_set_w(struct rte_mbuf *m, uint16_t new_value) { + rte_mbuf_refcnt_set(m, new_value); +} +uint16_t rte_mbuf_refcnt_update_w(struct rte_mbuf *m, int16_t value) { + return rte_mbuf_refcnt_update(m, value); +} +uint16_t +rte_mbuf_ext_refcnt_read_w(const struct rte_mbuf_ext_shared_info *shinfo) { + return rte_mbuf_ext_refcnt_read(shinfo); +} +void rte_mbuf_ext_refcnt_set_w(struct rte_mbuf_ext_shared_info *shinfo, + uint16_t new_value) { + rte_mbuf_ext_refcnt_set(shinfo, new_value); +} +uint16_t rte_mbuf_ext_refcnt_update_w(struct rte_mbuf_ext_shared_info *shinfo, + int16_t value) { + return rte_mbuf_ext_refcnt_update(shinfo, value); +} +struct rte_mbuf *rte_mbuf_raw_alloc_w(struct rte_mempool *mp) { + return rte_mbuf_raw_alloc(mp); +} +void rte_mbuf_raw_free_w(struct rte_mbuf *m) { rte_mbuf_raw_free(m); } +uint16_t rte_pktmbuf_data_room_size_w(struct rte_mempool *mp) { + return rte_pktmbuf_data_room_size(mp); +} +void rte_pktmbuf_reset_headroom_w(struct rte_mbuf *m) { + rte_pktmbuf_reset_headroom(m); +} +void rte_pktmbuf_reset_w(struct rte_mbuf *m) { rte_pktmbuf_reset(m); } +struct rte_mbuf *rte_pktmbuf_alloc_w(struct rte_mempool *mp) { + return rte_pktmbuf_alloc(mp); +} +int rte_pktmbuf_alloc_bulk_w(struct rte_mempool *pool, struct rte_mbuf **mbufs, + unsigned int count) { + return rte_pktmbuf_alloc_bulk(pool, mbufs, count); +} +struct rte_mbuf_ext_shared_info * +rte_pktmbuf_ext_shinfo_init_helper_w(void *buf_addr, uint16_t *buf_len, + rte_mbuf_extbuf_free_callback_t free_cb, + void *fcb_opaque) { + return rte_pktmbuf_ext_shinfo_init_helper(buf_addr, buf_len, free_cb, + fcb_opaque); +} +void rte_pktmbuf_attach_extbuf_w(struct rte_mbuf *m, void *buf_addr, + rte_iova_t buf_iova, uint16_t buf_len, + struct rte_mbuf_ext_shared_info *shinfo) { + rte_pktmbuf_attach_extbuf(m, buf_addr, buf_iova, buf_len, shinfo); +} +void rte_mbuf_dynfield_copy_w(struct rte_mbuf *mdst, + const struct rte_mbuf *msrc) { + rte_mbuf_dynfield_copy(mdst, msrc); +} +void rte_pktmbuf_attach_w(struct rte_mbuf *mi, struct rte_mbuf *m) { + rte_pktmbuf_attach(mi, m); +} +void rte_pktmbuf_detach_w(struct rte_mbuf *m) { rte_pktmbuf_detach(m); } +struct rte_mbuf *rte_pktmbuf_prefree_seg_w(struct rte_mbuf *m) { + return rte_pktmbuf_prefree_seg(m); +} +void rte_pktmbuf_free_seg_w(struct rte_mbuf *m) { rte_pktmbuf_free_seg(m); } +void rte_pktmbuf_free_w(struct rte_mbuf *m) { rte_pktmbuf_free(m); } +void rte_pktmbuf_refcnt_update_w(struct rte_mbuf *m, int16_t v) { + rte_pktmbuf_refcnt_update(m, v); +} +uint16_t rte_pktmbuf_headroom_w(const struct rte_mbuf *m) { + return rte_pktmbuf_headroom(m); +} +uint16_t rte_pktmbuf_tailroom_w(const struct rte_mbuf *m) { + return rte_pktmbuf_tailroom(m); +} +struct rte_mbuf *rte_pktmbuf_lastseg_w(struct rte_mbuf *m) { + return rte_pktmbuf_lastseg(m); +} +char *rte_pktmbuf_prepend_w(struct rte_mbuf *m, uint16_t len) { + return rte_pktmbuf_prepend(m, len); +} +char *rte_pktmbuf_append_w(struct rte_mbuf *m, uint16_t len) { + return rte_pktmbuf_append(m, len); +} +char *rte_pktmbuf_adj_w(struct rte_mbuf *m, uint16_t len) { + return rte_pktmbuf_adj(m, len); +} +int rte_pktmbuf_trim_w(struct rte_mbuf *m, uint16_t len) { + return rte_pktmbuf_trim(m, len); +} +int rte_pktmbuf_is_contiguous_w(const struct rte_mbuf *m) { + return rte_pktmbuf_is_contiguous(m); +} +const void *rte_pktmbuf_read_w(const struct rte_mbuf *m, uint32_t off, + uint32_t len, void *buf) { + return rte_pktmbuf_read(m, off, len, buf); +} +int rte_pktmbuf_chain_w(struct rte_mbuf *head, struct rte_mbuf *tail) { + return rte_pktmbuf_chain(head, tail); +} +uint64_t rte_mbuf_tx_offload_w(uint64_t il2, uint64_t il3, uint64_t il4, + uint64_t tso, uint64_t ol3, uint64_t ol2, + uint64_t unused) { + return rte_mbuf_tx_offload(il2, il3, il4, tso, ol3, ol2, unused); +} +int rte_validate_tx_offload_w(const struct rte_mbuf *m) { + return rte_validate_tx_offload(m); +} +int rte_pktmbuf_linearize_w(struct rte_mbuf *mbuf) { + return rte_pktmbuf_linearize(mbuf); +} +uint32_t rte_mbuf_sched_queue_get_w(const struct rte_mbuf *m) { + return rte_mbuf_sched_queue_get(m); +} +uint8_t rte_mbuf_sched_traffic_class_get_w(const struct rte_mbuf *m) { + return rte_mbuf_sched_traffic_class_get(m); +} +uint8_t rte_mbuf_sched_color_get_w(const struct rte_mbuf *m) { + return rte_mbuf_sched_color_get(m); +} +void rte_mbuf_sched_get_w(const struct rte_mbuf *m, uint32_t *queue_id, + uint8_t *traffic_class, uint8_t *color) { + rte_mbuf_sched_get(m, queue_id, traffic_class, color); +} +void rte_mbuf_sched_queue_set_w(struct rte_mbuf *m, uint32_t queue_id) { + rte_mbuf_sched_queue_set(m, queue_id); +} +void rte_mbuf_sched_traffic_class_set_w(struct rte_mbuf *m, + uint8_t traffic_class) { + rte_mbuf_sched_traffic_class_set(m, traffic_class); +} +void rte_mbuf_sched_color_set_w(struct rte_mbuf *m, uint8_t color) { + rte_mbuf_sched_color_set(m, color); +} +void rte_mbuf_sched_set_w(struct rte_mbuf *m, uint32_t queue_id, + uint8_t traffic_class, uint8_t color) { + rte_mbuf_sched_set(m, queue_id, traffic_class, color); +} +int rte_is_same_ether_addr_w(const struct rte_ether_addr *ea1, + const struct rte_ether_addr *ea2) { + return rte_is_same_ether_addr(ea1, ea2); +} +int rte_is_zero_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_zero_ether_addr(ea); +} +int rte_is_unicast_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_unicast_ether_addr(ea); +} +int rte_is_multicast_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_multicast_ether_addr(ea); +} +int rte_is_broadcast_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_broadcast_ether_addr(ea); +} +int rte_is_universal_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_universal_ether_addr(ea); +} +int rte_is_local_admin_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_local_admin_ether_addr(ea); +} +int rte_is_valid_assigned_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_valid_assigned_ether_addr(ea); +} +void rte_ether_addr_copy_w(const struct rte_ether_addr *ea_from, + struct rte_ether_addr *ea_to) { + rte_ether_addr_copy(ea_from, ea_to); +} +int rte_vlan_strip_w(struct rte_mbuf *m) { return rte_vlan_strip(m); } +int rte_vlan_insert_w(struct rte_mbuf **m) { return rte_vlan_insert(m); } +uint32_t rte_bitmap_get_memory_footprint_w(uint32_t n_bits) { + return rte_bitmap_get_memory_footprint(n_bits); +} +struct rte_bitmap *rte_bitmap_init_w(uint32_t n_bits, uint8_t *mem, + uint32_t mem_size) { + return rte_bitmap_init(n_bits, mem, mem_size); +} +struct rte_bitmap *rte_bitmap_init_with_all_set_w(uint32_t n_bits, uint8_t *mem, + uint32_t mem_size) { + return rte_bitmap_init_with_all_set(n_bits, mem, mem_size); +} +void rte_bitmap_free_w(struct rte_bitmap *bmp) { return rte_bitmap_free(bmp); } +void rte_bitmap_reset_w(struct rte_bitmap *bmp) { rte_bitmap_reset(bmp); } +void rte_bitmap_prefetch0_w(struct rte_bitmap *bmp, uint32_t pos) { + rte_bitmap_prefetch0(bmp, pos); +} +uint64_t rte_bitmap_get_w(struct rte_bitmap *bmp, uint32_t pos) { + return rte_bitmap_get(bmp, pos); +} +void rte_bitmap_set_w(struct rte_bitmap *bmp, uint32_t pos) { + rte_bitmap_set(bmp, pos); +} +void rte_bitmap_set_slab_w(struct rte_bitmap *bmp, uint32_t pos, + uint64_t slab) { + rte_bitmap_set_slab(bmp, pos, slab); +} +void rte_bitmap_clear_w(struct rte_bitmap *bmp, uint32_t pos) { + rte_bitmap_clear(bmp, pos); +} +int rte_bitmap_scan_w(struct rte_bitmap *bmp, uint32_t *pos, uint64_t *slab) { + return rte_bitmap_scan(bmp, pos, slab); +} +uint16_t rte_raw_cksum_w(const void *buf, size_t len) { + return rte_raw_cksum(buf, len); +} +int rte_raw_cksum_mbuf_w(const struct rte_mbuf *m, uint32_t off, uint32_t len, + uint16_t *cksum) { + return rte_raw_cksum_mbuf(m, off, len, cksum); +} +uint8_t rte_ipv4_hdr_len_w(const struct rte_ipv4_hdr *ipv4_hdr) { + return rte_ipv4_hdr_len(ipv4_hdr); +} +uint16_t rte_ipv4_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr) { + return rte_ipv4_cksum(ipv4_hdr); +} +uint16_t rte_ipv4_cksum_simple_w(const struct rte_ipv4_hdr *ipv4_hdr) { + return rte_ipv4_cksum_simple(ipv4_hdr); +} +uint16_t rte_ipv4_phdr_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr, + uint64_t ol_flags) { + return rte_ipv4_phdr_cksum(ipv4_hdr, ol_flags); +} +uint16_t rte_ipv4_udptcp_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr, + const void *l4_hdr) { + return rte_ipv4_udptcp_cksum(ipv4_hdr, l4_hdr); +} +uint16_t rte_ipv4_udptcp_cksum_mbuf_w(const struct rte_mbuf *m, + const struct rte_ipv4_hdr *ipv4_hdr, + uint16_t l4_off) { + return rte_ipv4_udptcp_cksum_mbuf(m, ipv4_hdr, l4_off); +} +int rte_ipv4_udptcp_cksum_verify_w(const struct rte_ipv4_hdr *ipv4_hdr, + const void *l4_hdr) { + return rte_ipv4_udptcp_cksum_verify(ipv4_hdr, l4_hdr); +} +int rte_ipv4_udptcp_cksum_mbuf_verify_w(const struct rte_mbuf *m, + const struct rte_ipv4_hdr *ipv4_hdr, + uint16_t l4_off) { + return rte_ipv4_udptcp_cksum_mbuf_verify(m, ipv4_hdr, l4_off); +} +bool rte_ipv6_addr_eq_w(const struct rte_ipv6_addr *a, + const struct rte_ipv6_addr *b) { + return rte_ipv6_addr_eq(a, b); +} +void rte_ipv6_addr_mask_w(struct rte_ipv6_addr *ip, uint8_t depth) { + rte_ipv6_addr_mask(ip, depth); +} +bool rte_ipv6_addr_eq_prefix_w(const struct rte_ipv6_addr *a, + const struct rte_ipv6_addr *b, uint8_t depth) { + return rte_ipv6_addr_eq_prefix(a, b, depth); +} +uint8_t rte_ipv6_mask_depth_w(const struct rte_ipv6_addr *mask) { + return rte_ipv6_mask_depth(mask); +} +bool rte_ipv6_addr_is_unspec_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_unspec(ip); +} +bool rte_ipv6_addr_is_loopback_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_loopback(ip); +} +bool rte_ipv6_addr_is_linklocal_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_linklocal(ip); +} +bool rte_ipv6_addr_is_sitelocal_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_sitelocal(ip); +} +bool rte_ipv6_addr_is_v4compat_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_v4compat(ip); +} +bool rte_ipv6_addr_is_v4mapped_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_v4mapped(ip); +} +bool rte_ipv6_addr_is_mcast_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_mcast(ip); +} +enum rte_ipv6_mc_scope rte_ipv6_mc_scope_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_mc_scope(ip); +} +void rte_ipv6_llocal_from_ethernet_w(struct rte_ipv6_addr *ip, + const struct rte_ether_addr *mac) { + rte_ipv6_llocal_from_ethernet(ip, mac); +} +void rte_ipv6_solnode_from_addr_w(struct rte_ipv6_addr *sol, + const struct rte_ipv6_addr *ip) { + rte_ipv6_solnode_from_addr(sol, ip); +} +void rte_ether_mcast_from_ipv6_w(struct rte_ether_addr *mac, + const struct rte_ipv6_addr *ip) { + rte_ether_mcast_from_ipv6(mac, ip); +} +int rte_ipv6_check_version_w(const struct rte_ipv6_hdr *ip) { + return rte_ipv6_check_version(ip); +} +uint16_t rte_ipv6_phdr_cksum_w(const struct rte_ipv6_hdr *ipv6_hdr, + uint64_t ol_flags) { + return rte_ipv6_phdr_cksum(ipv6_hdr, ol_flags); +} +uint16_t rte_ipv6_udptcp_cksum_w(const struct rte_ipv6_hdr *ipv6_hdr, + const void *l4_hdr) { + return rte_ipv6_udptcp_cksum(ipv6_hdr, l4_hdr); +} +uint16_t rte_ipv6_udptcp_cksum_mbuf_w(const struct rte_mbuf *m, + const struct rte_ipv6_hdr *ipv6_hdr, + uint16_t l4_off) { + return rte_ipv6_udptcp_cksum_mbuf(m, ipv6_hdr, l4_off); +} +int rte_ipv6_udptcp_cksum_verify_w(const struct rte_ipv6_hdr *ipv6_hdr, + const void *l4_hdr) { + return rte_ipv6_udptcp_cksum_verify(ipv6_hdr, l4_hdr); +} +int rte_ipv6_udptcp_cksum_mbuf_verify_w(const struct rte_mbuf *m, + const struct rte_ipv6_hdr *ipv6_hdr, + uint16_t l4_off) { + return rte_ipv6_udptcp_cksum_mbuf_verify(m, ipv6_hdr, l4_off); +} +int rte_ipv6_get_next_ext_w(const uint8_t *p, int proto, size_t *ext_len) { + return rte_ipv6_get_next_ext(p, proto, ext_len); +} +enum rte_color +rte_meter_srtcm_color_blind_check_w(struct rte_meter_srtcm *m, + struct rte_meter_srtcm_profile *p, + uint64_t time, uint32_t pkt_len) { + return rte_meter_srtcm_color_blind_check(m, p, time, pkt_len); +} +enum rte_color rte_meter_srtcm_color_aware_check_w( + struct rte_meter_srtcm *m, struct rte_meter_srtcm_profile *p, uint64_t time, + uint32_t pkt_len, enum rte_color pkt_color) { + return rte_meter_srtcm_color_aware_check(m, p, time, pkt_len, pkt_color); +} +enum rte_color +rte_meter_trtcm_color_blind_check_w(struct rte_meter_trtcm *m, + struct rte_meter_trtcm_profile *p, + uint64_t time, uint32_t pkt_len) { + return rte_meter_trtcm_color_blind_check(m, p, time, pkt_len); +} +enum rte_color rte_meter_trtcm_color_aware_check_w( + struct rte_meter_trtcm *m, struct rte_meter_trtcm_profile *p, uint64_t time, + uint32_t pkt_len, enum rte_color pkt_color) { + return rte_meter_trtcm_color_aware_check(m, p, time, pkt_len, pkt_color); +} +enum rte_color rte_meter_trtcm_rfc4115_color_blind_check_w( + struct rte_meter_trtcm_rfc4115 *m, + struct rte_meter_trtcm_rfc4115_profile *p, uint64_t time, + uint32_t pkt_len) { + return rte_meter_trtcm_rfc4115_color_blind_check(m, p, time, pkt_len); +} +enum rte_color rte_meter_trtcm_rfc4115_color_aware_check_w( + struct rte_meter_trtcm_rfc4115 *m, + struct rte_meter_trtcm_rfc4115_profile *p, uint64_t time, uint32_t pkt_len, + enum rte_color pkt_color) { + return rte_meter_trtcm_rfc4115_color_aware_check(m, p, time, pkt_len, + pkt_color); +} +uint64_t rte_eth_rss_hf_refine_w(uint64_t rss_hf) { + return rte_eth_rss_hf_refine(rss_hf); +} + +uint16_t rte_eth_rx_burst_w(uint16_t port_id, uint16_t queue_id, + struct rte_mbuf **rx_pkts, const uint16_t nb_pkts) { + return rte_eth_rx_burst(port_id, queue_id, rx_pkts, nb_pkts); +} +int rte_eth_rx_queue_count_w(uint16_t port_id, uint16_t queue_id) { + return rte_eth_rx_queue_count(port_id, queue_id); +} +int rte_eth_rx_descriptor_status_w(uint16_t port_id, uint16_t queue_id, + uint16_t offset) { + return rte_eth_rx_descriptor_status(port_id, queue_id, offset); +} +int rte_eth_tx_descriptor_status_w(uint16_t port_id, uint16_t queue_id, + uint16_t offset) { + return rte_eth_tx_descriptor_status(port_id, queue_id, offset); +} +uint16_t rte_eth_tx_burst_w(uint16_t port_id, uint16_t queue_id, + struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { + return rte_eth_tx_burst(port_id, queue_id, tx_pkts, nb_pkts); +} +uint16_t rte_eth_tx_prepare_w(uint16_t port_id, uint16_t queue_id, + struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { + return rte_eth_tx_prepare(port_id, queue_id, tx_pkts, nb_pkts); +} +uint16_t rte_eth_tx_buffer_flush_w(uint16_t port_id, uint16_t queue_id, + struct rte_eth_dev_tx_buffer *buffer) { + return rte_eth_tx_buffer_flush(port_id, queue_id, buffer); +} +uint16_t rte_eth_tx_buffer_w(uint16_t port_id, uint16_t queue_id, + struct rte_eth_dev_tx_buffer *buffer, + struct rte_mbuf *tx_pkt) { + return rte_eth_tx_buffer(port_id, queue_id, buffer, tx_pkt); +} +uint16_t +rte_eth_recycle_mbufs_w(uint16_t rx_port_id, uint16_t rx_queue_id, + uint16_t tx_port_id, uint16_t tx_queue_id, + struct rte_eth_recycle_rxq_info *recycle_rxq_info) { + return rte_eth_recycle_mbufs(rx_port_id, rx_queue_id, tx_port_id, tx_queue_id, + recycle_rxq_info); +} +int rte_eth_tx_queue_count_w(uint16_t port_id, uint16_t queue_id) { + return rte_eth_tx_queue_count(port_id, queue_id); +} +uint32_t rte_flow_dynf_metadata_get_w(struct rte_mbuf *m) { + return rte_flow_dynf_metadata_get(m); +} +void rte_flow_dynf_metadata_set_w(struct rte_mbuf *m, uint32_t v) { + rte_flow_dynf_metadata_set(m, v); +} +int rte_flow_dynf_metadata_avail_w(void) { + return rte_flow_dynf_metadata_avail(); +} +uint32_t rte_hash_crc_1byte_w(uint8_t data, uint32_t init_val) { + return rte_hash_crc_1byte(data, init_val); +} +uint32_t rte_hash_crc_2byte_w(uint16_t data, uint32_t init_val) { + return rte_hash_crc_2byte(data, init_val); +} +uint32_t rte_hash_crc_4byte_w(uint32_t data, uint32_t init_val) { + return rte_hash_crc_4byte(data, init_val); +} +uint32_t rte_hash_crc_8byte_w(uint64_t data, uint32_t init_val) { + return rte_hash_crc_8byte(data, init_val); +} +uint32_t rte_hash_crc_w(const void *data, uint32_t data_len, + uint32_t init_val) { + return rte_hash_crc(data, data_len, init_val); +} +void rte_jhash_2hashes_w(const void *key, uint32_t length, uint32_t *pc, + uint32_t *pb) { + rte_jhash_2hashes(key, length, pc, pb); +} +void rte_jhash_32b_2hashes_w(const uint32_t *k, uint32_t length, uint32_t *pc, + uint32_t *pb) { + rte_jhash_32b_2hashes(k, length, pc, pb); +} +uint32_t rte_jhash_w(const void *key, uint32_t length, uint32_t initval) { + return rte_jhash(key, length, initval); +} +uint32_t rte_jhash_32b_w(const uint32_t *k, uint32_t length, uint32_t initval) { + return rte_jhash_32b(k, length, initval); +} +uint32_t rte_jhash_3words_w(uint32_t a, uint32_t b, uint32_t c, + uint32_t initval) { + return rte_jhash_3words(a, b, c, initval); +} +uint32_t rte_jhash_2words_w(uint32_t a, uint32_t b, uint32_t initval) { + return rte_jhash_2words(a, b, initval); +} +uint32_t rte_jhash_1word_w(uint32_t a, uint32_t initval) { + return rte_jhash_1word(a, initval); +} +uint32_t rte_fbk_hash_get_bucket_w(const struct rte_fbk_hash_table *ht, + uint32_t key) { + return rte_fbk_hash_get_bucket(ht, key); +} +int rte_fbk_hash_add_key_with_bucket_w(struct rte_fbk_hash_table *ht, + uint32_t key, uint16_t value, + uint32_t bucket) { + return rte_fbk_hash_add_key_with_bucket(ht, key, value, bucket); +} +int rte_fbk_hash_add_key_w(struct rte_fbk_hash_table *ht, uint32_t key, + uint16_t value) { + return rte_fbk_hash_add_key(ht, key, value); +} +int rte_fbk_hash_delete_key_with_bucket_w(struct rte_fbk_hash_table *ht, + uint32_t key, uint32_t bucket) { + return rte_fbk_hash_delete_key_with_bucket(ht, key, bucket); +} +int rte_fbk_hash_delete_key_w(struct rte_fbk_hash_table *ht, uint32_t key) { + return rte_fbk_hash_delete_key(ht, key); +} +int rte_fbk_hash_lookup_with_bucket_w(const struct rte_fbk_hash_table *ht, + uint32_t key, uint32_t bucket) { + return rte_fbk_hash_lookup_with_bucket(ht, key, bucket); +} +int rte_fbk_hash_lookup_w(const struct rte_fbk_hash_table *ht, uint32_t key) { + return rte_fbk_hash_lookup(ht, key); +} +void rte_fbk_hash_clear_all_w(struct rte_fbk_hash_table *ht) { + rte_fbk_hash_clear_all(ht); +} +double rte_fbk_hash_get_load_factor_w(struct rte_fbk_hash_table *ht) { + return rte_fbk_hash_get_load_factor(ht); +} +void rte_rcu_qsbr_thread_online_w(struct rte_rcu_qsbr *v, + unsigned int thread_id) { + rte_rcu_qsbr_thread_online(v, thread_id); +} +void rte_rcu_qsbr_thread_offline_w(struct rte_rcu_qsbr *v, + unsigned int thread_id) { + rte_rcu_qsbr_thread_offline(v, thread_id); +} +void rte_rcu_qsbr_lock_w(struct rte_rcu_qsbr *v, unsigned int thread_id) { + rte_rcu_qsbr_lock(v, thread_id); +} +void rte_rcu_qsbr_unlock_w(struct rte_rcu_qsbr *v, unsigned int thread_id) { + rte_rcu_qsbr_unlock(v, thread_id); +} +uint64_t rte_rcu_qsbr_start_w(struct rte_rcu_qsbr *v) { + return rte_rcu_qsbr_start(v); +} +void rte_rcu_qsbr_quiescent_w(struct rte_rcu_qsbr *v, unsigned int thread_id) { + rte_rcu_qsbr_quiescent(v, thread_id); +} +int rte_rcu_qsbr_check_w(struct rte_rcu_qsbr *v, uint64_t t, bool wait) { + return rte_rcu_qsbr_check(v, t, wait); +} +uint8_t rte_read8_relaxed_w(const void *addr) { + return rte_read8_relaxed(addr); +} +uint16_t rte_read16_relaxed_w(const void *addr) { + return rte_read16_relaxed(addr); +} +uint32_t rte_read32_relaxed_w(const void *addr) { + return rte_read32_relaxed(addr); +} +uint64_t rte_read64_relaxed_w(const void *addr) { + return rte_read64_relaxed(addr); +} +void rte_write8_relaxed_w(uint8_t value, void *addr) { + rte_write8_relaxed(value, addr); +} +void rte_write16_relaxed_w(uint16_t value, void *addr) { + rte_write16_relaxed(value, addr); +} +void rte_write32_relaxed_w(uint32_t value, void *addr) { + rte_write32_relaxed(value, addr); +} +void rte_write64_relaxed_w(uint64_t value, void *addr) { + rte_write64_relaxed(value, addr); +} +uint8_t rte_read8_w(const void *addr) { return rte_read8(addr); } +uint16_t rte_read16_w(const void *addr) { return rte_read16(addr); } +uint32_t rte_read32_w(const void *addr) { return rte_read32(addr); } +uint64_t rte_read64_w(const void *addr) { return rte_read64(addr); } +void rte_write8_w(uint8_t value, void *addr) { rte_write8(value, addr); } +void rte_write16_w(uint16_t value, void *addr) { rte_write16(value, addr); } +void rte_write32_w(uint32_t value, void *addr) { rte_write32(value, addr); } +void rte_write64_w(uint64_t value, void *addr) { rte_write64(value, addr); } +void rte_write32_wc_relaxed_w(uint32_t value, void *addr) { + rte_write32_wc_relaxed(value, addr); +} +void rte_write32_wc_w(uint32_t value, void *addr) { + rte_write32_wc(value, addr); +} +void rte_mcslock_lock_w(rte_mcslock_t **msl, rte_mcslock_t *me) { + rte_mcslock_lock(msl, me); +} +void rte_mcslock_unlock_w(rte_mcslock_t **msl, rte_mcslock_t *me) { + rte_mcslock_unlock(msl, me); +} +int rte_mcslock_trylock_w(rte_mcslock_t **msl, rte_mcslock_t *me) { + return rte_mcslock_trylock(msl, me); +} +int rte_mcslock_is_locked_w(rte_mcslock_t *msl) { + return rte_mcslock_is_locked(msl); +} +void rte_pflock_init_w(struct rte_pflock *pf) { rte_pflock_init(pf); } +void rte_pflock_read_lock_w(rte_pflock_t *pf) { rte_pflock_read_lock(pf); } +void rte_pflock_read_unlock_w(rte_pflock_t *pf) { rte_pflock_read_unlock(pf); } +void rte_pflock_write_lock_w(rte_pflock_t *pf) { rte_pflock_write_lock(pf); } +void rte_pflock_write_unlock_w(rte_pflock_t *pf) { + rte_pflock_write_unlock(pf); +} +uint32_t rte_reciprocal_divide_w(uint32_t a, struct rte_reciprocal R) { + return rte_reciprocal_divide(a, R); +} +uint64_t rte_reciprocal_divide_u64_w(uint64_t a, + const struct rte_reciprocal_u64 *R) { + return rte_reciprocal_divide_u64(a, R); +} +void rte_seqcount_init_w(rte_seqcount_t *seqcount) { + rte_seqcount_init(seqcount); +} +uint32_t rte_seqcount_read_begin_w(const rte_seqcount_t *seqcount) { + return rte_seqcount_read_begin(seqcount); +} +bool rte_seqcount_read_retry_w(const rte_seqcount_t *seqcount, + uint32_t begin_sn) { + return rte_seqcount_read_retry(seqcount, begin_sn); +} +void rte_seqcount_write_begin_w(rte_seqcount_t *seqcount) { + rte_seqcount_write_begin(seqcount); +} +void rte_seqcount_write_end_w(rte_seqcount_t *seqcount) { + rte_seqcount_write_end(seqcount); +} +void rte_seqlock_init_w(rte_seqlock_t *seqlock) { rte_seqlock_init(seqlock); } +uint32_t rte_seqlock_read_begin_w(const rte_seqlock_t *seqlock) { + return rte_seqlock_read_begin(seqlock); +} +bool rte_seqlock_read_retry_w(const rte_seqlock_t *seqlock, uint32_t begin_sn) { + return rte_seqlock_read_retry(seqlock, begin_sn); +} +void rte_seqlock_write_lock_w(rte_seqlock_t *seqlock) { + rte_seqlock_write_lock(seqlock); +} +void rte_seqlock_write_unlock_w(rte_seqlock_t *seqlock) { + rte_seqlock_write_unlock(seqlock); +} +unsigned int rte_stack_push_w(struct rte_stack *s, void *const *obj_table, + unsigned int n) { + return rte_stack_push(s, obj_table, n); +} +unsigned int rte_stack_pop_w(struct rte_stack *s, void **obj_table, + unsigned int n) { + return rte_stack_pop(s, obj_table, n); +} +unsigned int rte_stack_count_w(struct rte_stack *s) { + return rte_stack_count(s); +} +unsigned int rte_stack_free_count_w(struct rte_stack *s) { + return rte_stack_free_count(s); +} +uint32_t rte_softrss_w(uint32_t *input_tuple, uint32_t input_len, + const uint8_t *rss_key) { + return rte_softrss(input_tuple, input_len, rss_key); +} +uint32_t rte_softrss_be_w(uint32_t *input_tuple, uint32_t input_len, + const uint8_t *rss_key) { + return rte_softrss_be(input_tuple, input_len, rss_key); +} +void rte_ticketlock_init_w(rte_ticketlock_t *tl) { rte_ticketlock_init(tl); } +void rte_ticketlock_lock_w(rte_ticketlock_t *tl) { rte_ticketlock_lock(tl); } +void rte_ticketlock_unlock_w(rte_ticketlock_t *tl) { + rte_ticketlock_unlock(tl); +} +int rte_ticketlock_trylock_w(rte_ticketlock_t *tl) { + return rte_ticketlock_trylock(tl); +} +int rte_ticketlock_is_locked_w(rte_ticketlock_t *tl) { + return rte_ticketlock_is_locked(tl); +} +void rte_ticketlock_recursive_init_w(rte_ticketlock_recursive_t *tlr) { + rte_ticketlock_recursive_init(tlr); +} +void rte_ticketlock_recursive_lock_w(rte_ticketlock_recursive_t *tlr) { + rte_ticketlock_recursive_lock(tlr); +} +void rte_ticketlock_recursive_unlock_w(rte_ticketlock_recursive_t *tlr) { + rte_ticketlock_recursive_unlock(tlr); +} +int rte_ticketlock_recursive_trylock_w(rte_ticketlock_recursive_t *tlr) { + return rte_ticketlock_recursive_trylock(tlr); +} +uint64_t rte_cyclecounter_cycles_to_ns_w(struct rte_timecounter *tc, + uint64_t cycles) { + return rte_cyclecounter_cycles_to_ns(tc, cycles); +} +uint64_t rte_timecounter_update_w(struct rte_timecounter *tc, + uint64_t cycle_now) { + return rte_timecounter_update(tc, cycle_now); +} +uint64_t rte_timespec_to_ns_w(const struct timespec *ts) { + return rte_timespec_to_ns(ts); +} +struct timespec rte_ns_to_timespec_w(uint64_t nsec) { + return rte_ns_to_timespec(nsec); +} +bool rte_trace_feature_is_enabled_w(void) { + return rte_trace_feature_is_enabled(); +} From 6de393c5b31bc79337ace26427b3d67aeb3b4241 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Fri, 19 Dec 2025 04:39:24 +0000 Subject: [PATCH 046/163] build(nix): make overlay user selectable Signed-off-by: Daniel Noland --- default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/default.nix b/default.nix index b9761e3e5..f00c69de9 100644 --- a/default.nix +++ b/default.nix @@ -1,4 +1,5 @@ { + overlay ? "dataplane", target ? "x86_64-unknown-linux-gnu", prof ? "debug", }: @@ -42,7 +43,7 @@ let }; pkgs = import sources.nixpkgs { overlays = [ - overlays.dataplane + overlays.${overlay} ]; }; in From ec93642735adbbf4db4314f79b42720a756ef7ef Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Fri, 19 Dec 2025 16:11:36 +0000 Subject: [PATCH 047/163] build(nix): add address sanitize profile Signed-off-by: Daniel Noland --- nix/profiles.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nix/profiles.nix b/nix/profiles.nix index 385983a96..8b8a5187a 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -68,6 +68,13 @@ let march.aarch64.NIX_CFLAGS_COMPILE = [ ]; march.aarch64.NIX_CXXFLAGS_COMPILE = march.aarch64.NIX_CFLAGS_COMPILE; march.aarch64.NIX_CFLAGS_LINK = [ ]; + sanitize.address.NIX_CFLAGS_COMPILE = [ + "-fsanitize=address,local-bounds" + ]; + sanitize.address.NIX_CXXFLAGS_COMPILE = sanitize.address.NIX_CFLAGS_COMPILE; + sanitize.address.NIX_CFLAGS_LINK = sanitize.address.NIX_CFLAGS_COMPILE ++ [ + "-static-libasan" + ]; combine-profiles = features: builtins.foldl' ( From 7ba060a22ad93fc78cb3bbfefefb43575a635568 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Fri, 19 Dec 2025 16:12:03 +0000 Subject: [PATCH 048/163] build(nix): add leak sanitize profile Signed-off-by: Daniel Noland --- nix/profiles.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nix/profiles.nix b/nix/profiles.nix index 8b8a5187a..1d315876f 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -75,6 +75,11 @@ let sanitize.address.NIX_CFLAGS_LINK = sanitize.address.NIX_CFLAGS_COMPILE ++ [ "-static-libasan" ]; + sanitize.leak.NIX_CFLAGS_COMPILE = [ + "-fsanitize=leak" + ]; + sanitize.leak.NIX_CXXFLAGS_COMPILE = sanitize.leak.NIX_CFLAGS_COMPILE; + sanitize.leak.NIX_CFLAGS_LINK = sanitize.leak.NIX_CFLAGS_COMPILE; combine-profiles = features: builtins.foldl' ( From a7e4bfa63053916ef8286126b6319358d8ed0afa Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Fri, 19 Dec 2025 20:41:18 +0000 Subject: [PATCH 049/163] build(nix): add cfi sanitize profile Signed-off-by: Daniel Noland --- nix/profiles.nix | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/nix/profiles.nix b/nix/profiles.nix index 1d315876f..81ceef29e 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -47,11 +47,6 @@ let "-fstack-clash-protection" # "-fcf-protection=full" # requires extra testing before we enable # "-fsanitize=safe-stack" # requires extra testing before we enable (not compatible with musl) - # "-fsanitize=cfi" # requires extra testing before we enable - # enable if you turn on cfi to properly link with rust - # "-fsanitize-cfi-icall-experimental-normalize-integers" - # consider enabling if you turn on cfi (not compatible with cross DSO cfi) - # "-fsanitize-cfi-icall-generalize-pointers" ]; secure.NIX_CXXFLAGS_COMPILE = secure.NIX_CFLAGS_COMPILE; # handing the CFLAGS back to clang/lld is basically required for -fsanitize @@ -80,6 +75,26 @@ let ]; sanitize.leak.NIX_CXXFLAGS_COMPILE = sanitize.leak.NIX_CFLAGS_COMPILE; sanitize.leak.NIX_CFLAGS_LINK = sanitize.leak.NIX_CFLAGS_COMPILE; + # note: cfi _requires_ LTO and is fundamentally ill suited to debug builds + sanitize.cfi.NIX_CFLAGS_COMPILE = [ + "-fsanitize=cfi" + # visibility=default is functionally required if you use basically any cfi higher than icall. + # In theory we could set -fvisibility=hidden, but in practice that doesn't work because too many dependencies + # fail to build with that setting enabled. + # NOTE: you also want to enable -Wl,--lto-whole-program-visibility in the linker flags if visibility=default so that + # symbols can be refined to hidden visibility at link time. + # This "whole-program-visibility" flag is already enabled by the optimize profile, and + # given that the optimize profile is required for cfi to even bild, we don't explicitly enable it again here. + "-fvisibility=default" + # required to properly link with rust + "-fsanitize-cfi-icall-experimental-normalize-integers" + # required in cases where perfect type strictness is not maintained but you still want to use CFI. + # Type fudging is common in C code, especially in cases where function pointers are used with lax const correctness. + # Ideally we wouldn't enable this, but we can't really re-write all of the C code in the world. + "-fsanitize-cfi-icall-generalize-pointers" + ]; + sanitize.cfi.NIX_CXXFLAGS_COMPILE = sanitize.cfi.NIX_CFLAGS_COMPILE; + sanitize.cfi.NIX_CFLAGS_LINK = sanitize.cfi.NIX_CFLAGS_COMPILE; combine-profiles = features: builtins.foldl' ( From e80a3b840a3fa35c9804ed568ffdeaf46b1479b7 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Fri, 19 Dec 2025 20:41:35 +0000 Subject: [PATCH 050/163] build(nix): add safe-stack sanitize profile Signed-off-by: Daniel Noland --- nix/profiles.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nix/profiles.nix b/nix/profiles.nix index 81ceef29e..e31461678 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -46,7 +46,6 @@ let "-fstack-protector-strong" "-fstack-clash-protection" # "-fcf-protection=full" # requires extra testing before we enable - # "-fsanitize=safe-stack" # requires extra testing before we enable (not compatible with musl) ]; secure.NIX_CXXFLAGS_COMPILE = secure.NIX_CFLAGS_COMPILE; # handing the CFLAGS back to clang/lld is basically required for -fsanitize @@ -95,6 +94,13 @@ let ]; sanitize.cfi.NIX_CXXFLAGS_COMPILE = sanitize.cfi.NIX_CFLAGS_COMPILE; sanitize.cfi.NIX_CFLAGS_LINK = sanitize.cfi.NIX_CFLAGS_COMPILE; + sanitize.safe-stack.NIX_CFLAGS_COMPILE = [ + "-fsanitize=safe-stack" + ]; + sanitize.safe-stack.NIX_CXXFLAGS_COMPILE = sanitize.safe-stack.NIX_CFLAGS_COMPILE; + sanitize.safe-stack.NIX_CFLAGS_LINK = sanitize.safe-stack.NIX_CFLAGS_COMPILE ++ [ + "-Wl,--allow-shlib-undefined" + ]; combine-profiles = features: builtins.foldl' ( From c06df8638c0fe18dbcb0c24882c10eed12c1850e Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Fri, 19 Dec 2025 20:42:17 +0000 Subject: [PATCH 051/163] build(nix): add instrumentation profiles Signed-off-by: Daniel Noland --- nix/profiles.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nix/profiles.nix b/nix/profiles.nix index e31461678..aa96e9b3d 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -101,6 +101,16 @@ let sanitize.safe-stack.NIX_CFLAGS_LINK = sanitize.safe-stack.NIX_CFLAGS_COMPILE ++ [ "-Wl,--allow-shlib-undefined" ]; + instrument.none.NIX_CFLAGS_COMPILE = [ ]; + instrument.none.NIX_CXXFLAGS_COMPILE = instrument.none.NIX_CFLAGS_COMPILE; + instrument.none.NIX_CFLAGS_LINK = instrument.none.NIX_CFLAGS_COMPILE; + instrument.produce.NIX_CFLAGS_COMPILE = [ + "-fprofile-instr-generate" + "-fcoverage-mapping" + "-fno-omit-frame-pointer" + ]; + instrument.produce.NIX_CXXFLAGS_COMPILE = instrument.produce.NIX_CFLAGS_COMPILE; + instrument.produce.NIX_CFLAGS_LINK = instrument.produce.NIX_CFLAGS_COMPILE; combine-profiles = features: builtins.foldl' ( From 296584b76804306cfbe6c7f02c487dedc91bbd55 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Fri, 19 Dec 2025 20:43:10 +0000 Subject: [PATCH 052/163] build(nix): pipe sanitizer and instrumentation into profile Signed-off-by: Daniel Noland --- default.nix | 9 +++++++-- nix/profiles.nix | 14 ++++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/default.nix b/default.nix index f00c69de9..3b76eedb3 100644 --- a/default.nix +++ b/default.nix @@ -2,6 +2,8 @@ overlay ? "dataplane", target ? "x86_64-unknown-linux-gnu", prof ? "debug", + instrumentation ? "none", + sanitize ? "", }: let arch = @@ -32,9 +34,12 @@ let }; } .${target}; + # helper method to work around nix's contrived builtin string split function. + split-str = split: str: builtins.filter (elm: builtins.isString elm) (builtins.split split str); + sanitizers = if sanitize == null || sanitize == "" then [ ] else split-str ",+" sanitize; sources = import ./npins; profile = import ./nix/profiles.nix { - inherit prof; + inherit prof sanitizers instrumentation; arch = arch.machine; }; overlays = import ./nix/overlays { @@ -48,6 +53,6 @@ let }; in { - inherit sources; + inherit sources profile; pkgs = pkgs.pkgsCross.${arch.nixarch}; } diff --git a/nix/profiles.nix b/nix/profiles.nix index aa96e9b3d..3e2fad97e 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -1,6 +1,8 @@ { arch, prof, + sanitizers, + instrumentation, }: let common.NIX_CFLAGS_COMPILE = [ @@ -128,7 +130,11 @@ let ]; }; in -(combine-profiles [ - profile."${prof}" - march."${arch}" -]) +combine-profiles ( + [ + profile."${prof}" + march."${arch}" + instrument."${instrumentation}" + ] + ++ (builtins.map (s: sanitize.${s}) sanitizers) +) From 409bea5e1b836cb8d0b9000b66417ece7c6d2f71 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Fri, 19 Dec 2025 23:29:40 +0000 Subject: [PATCH 053/163] build(nix): add thread sanitize profile --- nix/profiles.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nix/profiles.nix b/nix/profiles.nix index 3e2fad97e..9a2cb62e1 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -76,6 +76,13 @@ let ]; sanitize.leak.NIX_CXXFLAGS_COMPILE = sanitize.leak.NIX_CFLAGS_COMPILE; sanitize.leak.NIX_CFLAGS_LINK = sanitize.leak.NIX_CFLAGS_COMPILE; + sanitize.thread.NIX_CFLAGS_COMPILE = [ + "-fsanitize=thread" + ]; + sanitize.thread.NIX_CXXFLAGS_COMPILE = sanitize.thread.NIX_CFLAGS_COMPILE; + sanitize.thread.NIX_CFLAGS_LINK = sanitize.thread.NIX_CFLAGS_COMPILE ++ [ + "-Wl,--allow-shlib-undefined" + ]; # note: cfi _requires_ LTO and is fundamentally ill suited to debug builds sanitize.cfi.NIX_CFLAGS_COMPILE = [ "-fsanitize=cfi" From 216e62e46df2f354e3465c94772322ed792bccfd Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Fri, 19 Dec 2025 23:31:11 +0000 Subject: [PATCH 054/163] build(nix): forward cflags back to linker in optimize --- nix/profiles.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nix/profiles.nix b/nix/profiles.nix index 9a2cb62e1..3780dbb52 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -37,8 +37,7 @@ let optimize.NIX_CXXFLAGS_COMPILE = optimize.NIX_CFLAGS_COMPILE ++ [ "-fwhole-program-vtables" ]; - optimize.NIX_CFLAGS_LINK = [ - "-flto=full" + optimize.NIX_CFLAGS_LINK = optimize.NIX_CXXFLAGS_COMPILE ++ [ "-Wl,--lto-whole-program-visibility" # just to keep the artifacts small, we don't currently use any linked artifact anyway "-Wl,--gc-sections" From eba10ef6ab810eb202ead3112a8556a5aac14d95 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Fri, 19 Dec 2025 23:31:46 +0000 Subject: [PATCH 055/163] fix(nix): missing acc // for one offs --- nix/profiles.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/profiles.nix b/nix/profiles.nix index 3780dbb52..3a9f7533b 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -122,7 +122,7 @@ let combine-profiles = features: builtins.foldl' ( - acc: elem: builtins.mapAttrs (var: val: (acc.${var} or [ ]) ++ val) elem + acc: elem: acc // (builtins.mapAttrs (var: val: (acc.${var} or [ ]) ++ val) elem) ) { } features; profile = { debug = combine-profiles [ From 9d4098cbdd8a514f35424dbffacd45d6c3f1ffb9 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Fri, 19 Dec 2025 23:32:52 +0000 Subject: [PATCH 056/163] build(nix): make most sanitizers work --- nix/overlays/dataplane.nix | 4 ++++ nix/pkgs/dpdk/default.nix | 2 +- nix/profiles.nix | 1 - 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index ee22a0fbd..a6fd559c9 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -160,6 +160,10 @@ in # doesn't even have symbol versioning / compatibility in the first place). Turning this off just reduces the # build's internal complexity and makes lto easier. "-DNO_COMPAT_SYMS=1" + # this allows thread sanitizer to build (thread/ub sanitizers do not like -Wl,-z,defs or -Wl,--no-undefined) + # Normally I would say that disabling -Wl,--no-undefined is a bad idea, but we throw away all the shared + # libs and executables from this build anwyway, so it it should be harmless. + "-DSUPPORTS_NO_UNDEFINED=0" # todo: find a way to enable this for only {thread,ub}san builds. ]; postInstall = (orig.postInstall or "") + '' mkdir -p $static/lib; diff --git a/nix/pkgs/dpdk/default.nix b/nix/pkgs/dpdk/default.nix index fd5abdab3..362711760 100644 --- a/nix/pkgs/dpdk/default.nix +++ b/nix/pkgs/dpdk/default.nix @@ -239,7 +239,7 @@ stdenv.mkDerivation { "-Dauto_features=disabled" "-Db_colorout=never" "-Db_lto=${lto}" - "-Db_lundef=true" + "-Db_lundef=false" "-Db_pgo=off" "-Db_pie=true" "-Dbackend=ninja" diff --git a/nix/profiles.nix b/nix/profiles.nix index 3a9f7533b..caad8e6d5 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -31,7 +31,6 @@ let optimize.NIX_CFLAGS_COMPILE = [ "-O3" "-flto=full" - "-ffat-lto-objects" "-fsplit-lto-unit" # important for compatibility with rust's LTO ]; optimize.NIX_CXXFLAGS_COMPILE = optimize.NIX_CFLAGS_COMPILE ++ [ From 61e4078e2b9147ae0032ff44232b5f8fdcd75597 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sat, 20 Dec 2025 00:00:09 +0000 Subject: [PATCH 057/163] build(nix): add copyright headers --- default.nix | 2 ++ nix/overlays/dataplane.nix | 2 ++ nix/overlays/default.nix | 2 ++ nix/pkgs/dpdk-wrapper/default.nix | 2 ++ nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.c | 3 +++ nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.h | 3 +++ nix/pkgs/dpdk/default.nix | 2 ++ nix/profiles.nix | 2 ++ shell.nix | 2 ++ 9 files changed, 20 insertions(+) diff --git a/default.nix b/default.nix index 3b76eedb3..7cfde5625 100644 --- a/default.nix +++ b/default.nix @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright Open Network Fabric Authors { overlay ? "dataplane", target ? "x86_64-unknown-linux-gnu", diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index a6fd559c9..8634c4dae 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright Open Network Fabric Authors { sources, env ? { }, diff --git a/nix/overlays/default.nix b/nix/overlays/default.nix index 6139dfb3c..d6d69a8f7 100644 --- a/nix/overlays/default.nix +++ b/nix/overlays/default.nix @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright Open Network Fabric Authors { sources, env ? { }, diff --git a/nix/pkgs/dpdk-wrapper/default.nix b/nix/pkgs/dpdk-wrapper/default.nix index 46bf9a52d..60ffe4623 100644 --- a/nix/pkgs/dpdk-wrapper/default.nix +++ b/nix/pkgs/dpdk-wrapper/default.nix @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright Open Network Fabric Authors { stdenv, dpdk, diff --git a/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.c b/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.c index 1e3f64324..58e2f4df7 100644 --- a/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.c +++ b/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.c @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Open Network Fabric Authors + #include "dpdk_wrapper.h" int wrte_errno() { diff --git a/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.h b/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.h index 96ec4cd0e..2d4e77c47 100644 --- a/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.h +++ b/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.h @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Open Network Fabric Authors + #include #include diff --git a/nix/pkgs/dpdk/default.nix b/nix/pkgs/dpdk/default.nix index 362711760..6028b8c2a 100644 --- a/nix/pkgs/dpdk/default.nix +++ b/nix/pkgs/dpdk/default.nix @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright Open Network Fabric Authors { src, stdenv, diff --git a/nix/profiles.nix b/nix/profiles.nix index caad8e6d5..7e47d8b8f 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright Open Network Fabric Authors { arch, prof, diff --git a/shell.nix b/shell.nix index 918e6cad1..afa7cc93c 100644 --- a/shell.nix +++ b/shell.nix @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright Open Network Fabric Authors { pkgs ? import { }, }: From da03e9fde83373a3811c88783e5a8d723c351ae8 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sat, 20 Dec 2025 03:24:40 +0000 Subject: [PATCH 058/163] wip --- .sysroot-man | 1 + .sysroot-static | 1 + default.nix | 37 ++++++++++++++++++++++------- nix/overlays/dataplane.nix | 24 +++++++++++++++---- nix/pkgs/dpdk/cross/bluefield3 | 17 +++++++++++++ nix/pkgs/dpdk/cross/bluefield3.gnu | 19 +++++++++++++++ nix/pkgs/dpdk/cross/bluefield3.musl | 19 +++++++++++++++ nix/pkgs/dpdk/default.nix | 17 ++++++++++--- nix/pkgs/dpdk/src | 1 + result | 1 + result-bin | 1 + shell.nix | 6 +++++ sysroot | 1 + 13 files changed, 128 insertions(+), 17 deletions(-) create mode 120000 .sysroot-man create mode 120000 .sysroot-static create mode 100644 nix/pkgs/dpdk/cross/bluefield3 create mode 100644 nix/pkgs/dpdk/cross/bluefield3.gnu create mode 100644 nix/pkgs/dpdk/cross/bluefield3.musl create mode 160000 nix/pkgs/dpdk/src create mode 120000 result create mode 120000 result-bin create mode 120000 sysroot diff --git a/.sysroot-man b/.sysroot-man new file mode 120000 index 000000000..35825c4a6 --- /dev/null +++ b/.sysroot-man @@ -0,0 +1 @@ +/nix/store/fvf13rk7bimfzqwqyx73zxy132aqcqwj-aarch64-unknown-linux-gnu-pkg-config-wrapper-0.29.2-man \ No newline at end of file diff --git a/.sysroot-static b/.sysroot-static new file mode 120000 index 000000000..2cc68f664 --- /dev/null +++ b/.sysroot-static @@ -0,0 +1 @@ +/nix/store/4155d64l46f8qdl49dh3mpf81f9h4ivl-dpdk-aarch64-unknown-linux-gnu-25.11-static \ No newline at end of file diff --git a/default.nix b/default.nix index 7cfde5625..a4451f3e6 100644 --- a/default.nix +++ b/default.nix @@ -48,13 +48,32 @@ let inherit sources; env = profile; }; - pkgs = import sources.nixpkgs { - overlays = [ - overlays.${overlay} - ]; - }; + pkgs = + (import sources.nixpkgs { + overlays = [ + overlays.${overlay} + ]; + }).pkgsCross.${arch.nixarch}; in -{ - inherit sources profile; - pkgs = pkgs.pkgsCross.${arch.nixarch}; -} +pkgs.lib.fix (final: { + inherit pkgs sources profile; + sysroot-list = with final.pkgs; [ + libc.static + libc.out + libmd.static + libbsd.static + libnl.out + numactl.dev + numactl.static + rdma-core.static + dpdk.dev + dpdk.out + dpdk.static + dpdk-wrapper.dev + dpdk-wrapper.out + ]; + sysroot = pkgs.symlinkJoin { + name = "sysroot"; + paths = final.sysroot-list; + }; +}) diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index 8634c4dae..516c66e60 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -21,13 +21,15 @@ let bintools lld ]; - }) (adapt.makeStaticLibraries final.buildPackages.llvmPackages.stdenv); + }) final.llvmPackages.stdenv; + # }) (adapt.makeStaticLibraries final.buildPackages.llvmPackages.stdenv); stdenv-llvm-with-flags = adapt.addAttrsToDerivation (orig: { env = helpers.addToEnv env (orig.env or { }); }) stdenv-llvm; dataplane-dep = pkg: pkg.override { stdenv = stdenv-llvm-with-flags; }; in { + stdenv' = stdenv-llvm-with-flags; # Don't bother adapting ethtool or iproute2's build to our custom flags / env. Failure to null this can trigger # _massive_ builds because ethtool depends on libnl (et al), and we _do_ overlay libnl. Thus, the ethtool / iproute2 # get rebuilt and you end up rebuilding the whole world. @@ -69,7 +71,7 @@ in # file. Ideally we would just _not_ build those .so files, but that would require doing brain surgery on dpdk's # meson build, and maintaining such a change set is not worth it to avoid building some .so files. configureFlags = (orig.configureFlags or [ ]) ++ [ - "--enable-shared" + "--enable-static" ]; postInstall = (orig.postInstall or "") + '' mkdir -p "$static/lib"; @@ -87,7 +89,7 @@ in # we need to enable shared (in addition to static) to build dpdk. # See the note on libmd for reasoning. configureFlags = orig.configureFlags ++ [ - "--enable-shared" + "--enable-static" ]; postInstall = (orig.postInstall or "") + '' mkdir -p "$static/lib"; @@ -107,7 +109,17 @@ in # More, this is a very low level library designed to send messages between a privileged process and the kernel. # The simple fact that this appears in our toolchain justifies sanitizers like safe-stack and cfi and/or flags like # -fcf-protection=full. - libnl = dataplane-dep prev.libnl; + libnl = (dataplane-dep prev.libnl).overrideAttrs (orig: { + outputs = (orig.outputs or [ "out" ]) ++ [ "static" ]; + configureFlags = (orig.configureFlags or [ ]) ++ [ + "--enable-static" + ]; + postInstall = (orig.postInstall or "") + '' + mkdir -p $static/lib + find $out/lib -name '*.la' -exec rm {} \; + mv $out/lib/*.a $static/lib/ + ''; + }); # This is needed by DPDK in order to determine which pinned core runs on which numa node and which NIC is most # efficiently connected to which NUMA node. You can disable the need for this library entirely by editing dpdk's @@ -127,7 +139,7 @@ in # we need to enable shared (in addition to static) to build dpdk. # See the note on libmd for reasoning. configureFlags = (orig.configureFlags or [ ]) ++ [ - "--enable-shared" # dpdk does not like to build its .so files if we don't build numa.so as well + "--enable-static" # dpdk does not like to build its .so files if we don't build numa.so as well ]; postInstall = (orig.postInstall or "") + '' mkdir -p "$static/lib"; @@ -189,4 +201,6 @@ in # This wrapping process does not really cause any performance issue due to lto; the compiler is going to "unwrap" # these methods anyway. dpdk-wrapper = dataplane-dep (final.callPackage ../pkgs/dpdk-wrapper { }); + + inherit env; } diff --git a/nix/pkgs/dpdk/cross/bluefield3 b/nix/pkgs/dpdk/cross/bluefield3 new file mode 100644 index 000000000..783a14210 --- /dev/null +++ b/nix/pkgs/dpdk/cross/bluefield3 @@ -0,0 +1,17 @@ +[binaries] +c = 'aarch64-unknown-linux-gnu-cc' +cpp = 'aarch64-unknown-linux-gnu-c++' +ar = 'aarch64-unknown-linux-gnu-ar' +strip = 'aarch64-unknown-linux-gnu-strip' +pkgconfig = 'aarch64-unknown-linux-gnu-pkg-config' +pkg-config = 'aarch64-unknown-linux-gnu-pkg-config' +pcap-config = '' + +[host_machine] +system = 'linux' +cpu_family = 'aarch64' +cpu = 'armv8.4-a' +endian = 'little' + +[properties] +platform = 'bluefield3' diff --git a/nix/pkgs/dpdk/cross/bluefield3.gnu b/nix/pkgs/dpdk/cross/bluefield3.gnu new file mode 100644 index 000000000..56fd5ae8b --- /dev/null +++ b/nix/pkgs/dpdk/cross/bluefield3.gnu @@ -0,0 +1,19 @@ +[binaries] +c = 'aarch64-unknown-linux-gnu-cc' +cpp = 'aarch64-unknown-linux-gnu-c++' +ar = 'aarch64-unknown-linux-gnu-ar' +strip = 'aarch64-unknown-linux-gnu-strip' +pkgconfig = 'aarch64-unknown-linux-gnu-pkg-config' +pkg-config = 'aarch64-unknown-linux-gnu-pkg-config' +pcap-config = '' + +[host_machine] +system = 'linux' +cpu_family = 'aarch64' +cpu = 'armv8.4-a' +endian = 'little' + +[properties] +platform = 'bluefield3' +libc = 'gnu' +ar = 'aarch64-unknown-linux-gnu-ar' diff --git a/nix/pkgs/dpdk/cross/bluefield3.musl b/nix/pkgs/dpdk/cross/bluefield3.musl new file mode 100644 index 000000000..7247ed091 --- /dev/null +++ b/nix/pkgs/dpdk/cross/bluefield3.musl @@ -0,0 +1,19 @@ +[binaries] +c = 'aarch64-unknown-linux-musl-cc' +cpp = 'aarch64-unknown-linux-musl-c++' +ar = 'aarch64-unknown-linux-musl-ar' +strip = 'aarch64-unknown-linux-musl-strip' +pkgconfig = 'aarch64-unknown-linux-musl-pkg-config' +pkg-config = 'aarch64-unknown-linux-musl-pkg-config' +pcap-config = '' + +[host_machine] +system = 'linux' +cpu_family = 'aarch64' +cpu = 'armv8.4-a' +endian = 'little' + +[properties] +platform = 'bluefield3' +libc = 'musl' +ar = 'aarch64-unknown-linux-musl-ar' diff --git a/nix/pkgs/dpdk/default.nix b/nix/pkgs/dpdk/default.nix index 6028b8c2a..165ee8506 100644 --- a/nix/pkgs/dpdk/default.nix +++ b/nix/pkgs/dpdk/default.nix @@ -13,15 +13,16 @@ libnl, python3, build-params ? { - lto = "true"; - build-type = "release"; # "debug" | "release" + lto = "false"; + build-type = "debug"; # "debug" | "release" }, }: stdenv.mkDerivation { pname = "dpdk"; version = src.branch; - src = src.outPath; + # src = src.outPath; + src = ./src; nativeBuildInputs = [ meson ninja @@ -256,6 +257,7 @@ stdenv.mkDerivation { ''-Denable_drivers=${lib.concatStringsSep "," enabledDrivers}'' ''-Denable_libs=${lib.concatStringsSep "," enabledLibs}'' ''-Ddisable_libs=${lib.concatStringsSep "," disabledLibs}'' + ''--cross-file=${./cross/bluefield3.gnu}'' ]; outputs = [ @@ -265,6 +267,15 @@ stdenv.mkDerivation { "static" ]; + # AR = "aarch64-unknown-linux-gnu-ar"; + + # configurePhase = '' + # meson setup arm-build --cross-file ${./cross/bluefield3} + # cd build + # ''; + # + CFLAGS = "-ffat-lto-objects -O1 -Wno-#warnings"; + postInstall = '' # Remove docs. We don't build these anyway rm -rf $out/share/doc diff --git a/nix/pkgs/dpdk/src b/nix/pkgs/dpdk/src new file mode 160000 index 000000000..cd60dcd50 --- /dev/null +++ b/nix/pkgs/dpdk/src @@ -0,0 +1 @@ +Subproject commit cd60dcd503b91956f966a1f6d595b35d256ac00f diff --git a/result b/result new file mode 120000 index 000000000..a40bbe7e4 --- /dev/null +++ b/result @@ -0,0 +1 @@ +/nix/store/xx7cm72qy2c0643cm1ipngd87aqwkcdp-glibc-2.40-66 \ No newline at end of file diff --git a/result-bin b/result-bin new file mode 120000 index 000000000..24bd090c0 --- /dev/null +++ b/result-bin @@ -0,0 +1 @@ +/nix/store/q6wgv06q39bfhx2xl8ysc05wi6m2zdss-glibc-2.40-66-bin \ No newline at end of file diff --git a/shell.nix b/shell.nix index afa7cc93c..07970296c 100644 --- a/shell.nix +++ b/shell.nix @@ -1,6 +1,12 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright Open Network Fabric Authors { + overlay ? "dataplane", + target ? "x86_64-unknown-linux-gnu", + prof ? "debug", + instrumentation ? "none", + sanitize ? "", + sources ? import ./npins, pkgs ? import { }, }: (pkgs.buildFHSEnv { diff --git a/sysroot b/sysroot new file mode 120000 index 000000000..761f3e8ec --- /dev/null +++ b/sysroot @@ -0,0 +1 @@ +/nix/store/m1gsdy5xjrc396yk2m1h7nrdly5d6jw9-sysroot \ No newline at end of file From a969708f106b074b67ef4c4d9f43302dcd30f653 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sat, 20 Dec 2025 16:05:10 +0000 Subject: [PATCH 059/163] wip --- .sysroot-man | 1 - .sysroot-static | 1 - nix/pkgs/dpdk/cross/bluefield3.gnu | 19 -------- .../cross/{bluefield3 => bluefield3.gnu.ini} | 3 +- .../{bluefield3.musl => bluefield3.musl.ini} | 3 +- nix/pkgs/dpdk/default.nix | 45 ++++++++++++++----- nix/profiles.nix | 6 ++- result | 1 - result-bin | 1 - 9 files changed, 41 insertions(+), 39 deletions(-) delete mode 120000 .sysroot-man delete mode 120000 .sysroot-static delete mode 100644 nix/pkgs/dpdk/cross/bluefield3.gnu rename nix/pkgs/dpdk/cross/{bluefield3 => bluefield3.gnu.ini} (92%) rename nix/pkgs/dpdk/cross/{bluefield3.musl => bluefield3.musl.ini} (88%) delete mode 120000 result delete mode 120000 result-bin diff --git a/.sysroot-man b/.sysroot-man deleted file mode 120000 index 35825c4a6..000000000 --- a/.sysroot-man +++ /dev/null @@ -1 +0,0 @@ -/nix/store/fvf13rk7bimfzqwqyx73zxy132aqcqwj-aarch64-unknown-linux-gnu-pkg-config-wrapper-0.29.2-man \ No newline at end of file diff --git a/.sysroot-static b/.sysroot-static deleted file mode 120000 index 2cc68f664..000000000 --- a/.sysroot-static +++ /dev/null @@ -1 +0,0 @@ -/nix/store/4155d64l46f8qdl49dh3mpf81f9h4ivl-dpdk-aarch64-unknown-linux-gnu-25.11-static \ No newline at end of file diff --git a/nix/pkgs/dpdk/cross/bluefield3.gnu b/nix/pkgs/dpdk/cross/bluefield3.gnu deleted file mode 100644 index 56fd5ae8b..000000000 --- a/nix/pkgs/dpdk/cross/bluefield3.gnu +++ /dev/null @@ -1,19 +0,0 @@ -[binaries] -c = 'aarch64-unknown-linux-gnu-cc' -cpp = 'aarch64-unknown-linux-gnu-c++' -ar = 'aarch64-unknown-linux-gnu-ar' -strip = 'aarch64-unknown-linux-gnu-strip' -pkgconfig = 'aarch64-unknown-linux-gnu-pkg-config' -pkg-config = 'aarch64-unknown-linux-gnu-pkg-config' -pcap-config = '' - -[host_machine] -system = 'linux' -cpu_family = 'aarch64' -cpu = 'armv8.4-a' -endian = 'little' - -[properties] -platform = 'bluefield3' -libc = 'gnu' -ar = 'aarch64-unknown-linux-gnu-ar' diff --git a/nix/pkgs/dpdk/cross/bluefield3 b/nix/pkgs/dpdk/cross/bluefield3.gnu.ini similarity index 92% rename from nix/pkgs/dpdk/cross/bluefield3 rename to nix/pkgs/dpdk/cross/bluefield3.gnu.ini index 783a14210..fec17cf95 100644 --- a/nix/pkgs/dpdk/cross/bluefield3 +++ b/nix/pkgs/dpdk/cross/bluefield3.gnu.ini @@ -10,8 +10,9 @@ pcap-config = '' [host_machine] system = 'linux' cpu_family = 'aarch64' -cpu = 'armv8.4-a' +cpu = 'armv8.6-a' endian = 'little' [properties] platform = 'bluefield3' +libc = 'gnu' diff --git a/nix/pkgs/dpdk/cross/bluefield3.musl b/nix/pkgs/dpdk/cross/bluefield3.musl.ini similarity index 88% rename from nix/pkgs/dpdk/cross/bluefield3.musl rename to nix/pkgs/dpdk/cross/bluefield3.musl.ini index 7247ed091..eb433ad26 100644 --- a/nix/pkgs/dpdk/cross/bluefield3.musl +++ b/nix/pkgs/dpdk/cross/bluefield3.musl.ini @@ -10,10 +10,9 @@ pcap-config = '' [host_machine] system = 'linux' cpu_family = 'aarch64' -cpu = 'armv8.4-a' +cpu = 'armv8.6-a' endian = 'little' [properties] platform = 'bluefield3' libc = 'musl' -ar = 'aarch64-unknown-linux-musl-ar' diff --git a/nix/pkgs/dpdk/default.nix b/nix/pkgs/dpdk/default.nix index 165ee8506..a942502ff 100644 --- a/nix/pkgs/dpdk/default.nix +++ b/nix/pkgs/dpdk/default.nix @@ -13,9 +13,11 @@ libnl, python3, build-params ? { - lto = "false"; - build-type = "debug"; # "debug" | "release" + lto = "true"; + build-type = "release"; # "debug" | "release" + platform = "bluefield3"; }, + writeText, }: stdenv.mkDerivation { @@ -235,6 +237,32 @@ stdenv.mkDerivation { "net/virtio" "vdpa/mlx5" ]; + arch = stdenv.hostPlatform.parsed.cpu.name; + cpu = stdenv.hostPlatform.parsed.cpu.arch; + kernel = stdenv.hostPlatform.parsed.kernel.name; + endian = + if stdenv.hostPlatform.parsed.cpu.significantByte.name == "littleEndian" then "little" else "big"; + libc = if stdenv.hostPlatform.libc == "glibc" then "gnu" else stdenv.hostPlatform.libc; + isCrossCompile = stdenv.buildPlatform.parsed != stdenv.hostPlatform.parsed; + cross-file = writeText "cross-file.ini" '' + [binaries] + c = '${arch}-unknown-${kernel}-${libc}-cc' + cpp = '${arch}-unknown-${kernel}-${libc}-c++' + ar = '${arch}-unknown-${kernel}-${libc}-ar' + strip = '${arch}-unknown-${kernel}-${libc}-strip' + pkgconfig = '${arch}-unknown-${kernel}-${libc}-pkg-config' + pkg-config = '${arch}-unknown-${kernel}-${libc}-pkg-config' + + [host_machine] + system = '${kernel}' + cpu_family = '${arch}' + cpu = '${cpu}' + endian = '${endian}' + + [properties] + platform = '${build-params.platform}' + libc = '${libc}' + ''; in with build-params; [ @@ -257,8 +285,8 @@ stdenv.mkDerivation { ''-Denable_drivers=${lib.concatStringsSep "," enabledDrivers}'' ''-Denable_libs=${lib.concatStringsSep "," enabledLibs}'' ''-Ddisable_libs=${lib.concatStringsSep "," disabledLibs}'' - ''--cross-file=${./cross/bluefield3.gnu}'' - ]; + ] + ++ (if isCrossCompile then [ ''--cross-file=${cross-file}'' ] else [ ]); outputs = [ "dev" @@ -267,14 +295,7 @@ stdenv.mkDerivation { "static" ]; - # AR = "aarch64-unknown-linux-gnu-ar"; - - # configurePhase = '' - # meson setup arm-build --cross-file ${./cross/bluefield3} - # cd build - # ''; - # - CFLAGS = "-ffat-lto-objects -O1 -Wno-#warnings"; + CFLAGS = if stdenv.targetPlatform.parsed.cpu.name == "aarch64" then "-ffat-lto-objects" else ""; postInstall = '' # Remove docs. We don't build these anyway diff --git a/nix/profiles.nix b/nix/profiles.nix index 7e47d8b8f..e978e7b32 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -61,7 +61,11 @@ let "-mssse3" ]; march.x86_64.NIX_CXXFLAGS_COMPILE = march.x86_64.NIX_CFLAGS_COMPILE; - march.aarch64.NIX_CFLAGS_COMPILE = [ ]; + march.aarch64.NIX_CFLAGS_COMPILE = [ + "-march=armv8.6-a" + "-mcpu=cortex-a78" + "-mtune=cortex-a78" + ]; march.aarch64.NIX_CXXFLAGS_COMPILE = march.aarch64.NIX_CFLAGS_COMPILE; march.aarch64.NIX_CFLAGS_LINK = [ ]; sanitize.address.NIX_CFLAGS_COMPILE = [ diff --git a/result b/result deleted file mode 120000 index a40bbe7e4..000000000 --- a/result +++ /dev/null @@ -1 +0,0 @@ -/nix/store/xx7cm72qy2c0643cm1ipngd87aqwkcdp-glibc-2.40-66 \ No newline at end of file diff --git a/result-bin b/result-bin deleted file mode 120000 index 24bd090c0..000000000 --- a/result-bin +++ /dev/null @@ -1 +0,0 @@ -/nix/store/q6wgv06q39bfhx2xl8ysc05wi6m2zdss-glibc-2.40-66-bin \ No newline at end of file From 25058acedec7d0aa4a388ef59bfcaf02e0cd9c74 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sat, 20 Dec 2025 20:38:08 +0000 Subject: [PATCH 060/163] wip --- default.nix | 19 +++++++-- nix/machine.nix | 80 ++++++++++++++++++++++++++++++++++++++ nix/overlays/dataplane.nix | 80 +++++++++++++++++++++----------------- nix/overlays/default.nix | 5 ++- nix/pkgs/dpdk/default.nix | 28 ++++++++----- nix/profiles.nix | 6 +-- 6 files changed, 163 insertions(+), 55 deletions(-) create mode 100644 nix/machine.nix diff --git a/default.nix b/default.nix index a4451f3e6..d9920afb6 100644 --- a/default.nix +++ b/default.nix @@ -2,12 +2,16 @@ # Copyright Open Network Fabric Authors { overlay ? "dataplane", - target ? "x86_64-unknown-linux-gnu", + platform ? "x86-64-v3", + libc ? "gnu", prof ? "debug", instrumentation ? "none", sanitize ? "", }: let + lib = (import sources.nixpkgs { }).lib; + platform' = (import ./nix/machine.nix lib.recursiveUpdate).${platform}; + target = "${platform'.arch}-unknown-linux-${libc}"; arch = { "x86_64-unknown-linux-gnu" = { @@ -38,14 +42,14 @@ let .${target}; # helper method to work around nix's contrived builtin string split function. split-str = split: str: builtins.filter (elm: builtins.isString elm) (builtins.split split str); - sanitizers = if sanitize == null || sanitize == "" then [ ] else split-str ",+" sanitize; + sanitizers = split-str ",+" sanitize; sources = import ./npins; profile = import ./nix/profiles.nix { inherit prof sanitizers instrumentation; arch = arch.machine; }; overlays = import ./nix/overlays { - inherit sources; + inherit sources sanitizers; env = profile; }; pkgs = @@ -56,7 +60,14 @@ let }).pkgsCross.${arch.nixarch}; in pkgs.lib.fix (final: { - inherit pkgs sources profile; + inherit + pkgs + sources + profile + target + arch + ; + platform = platform'; sysroot-list = with final.pkgs; [ libc.static libc.out diff --git a/nix/machine.nix b/nix/machine.nix new file mode 100644 index 000000000..98c122343 --- /dev/null +++ b/nix/machine.nix @@ -0,0 +1,80 @@ +recursiveUpdate: rec { + x86-64-v3 = rec { + arch = "x86_64"; + march = "x86-64-v3"; + numa = { + max-nodes = 8; + }; + override = { + stdenv'.env = rec { + NIX_CFLAGS_COMPILE = [ "-march=${march}" ]; + NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; + NIX_CFLAGS_LINK = [ ]; + }; + dpdk = { + buildInputs = { + rdma-core = true; + libbsd = true; + libnl = true; + numactl = true; + }; + }; + }; + }; + x86-64-v4 = recursiveUpdate x86-64-v3 rec { + march = "x86-64-v4"; + override.stdenv'.env = rec { + NIX_CFLAGS_COMPILE = [ "-march=${march}" ]; + NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; + NIX_CFLAGS_LINK = [ ]; + }; + }; + zen4 = recursiveUpdate x86-64-v4 rec { + march = "zen4"; + override.stdenv'.env = rec { + NIX_CFLAGS_COMPILE = [ "-march=${march}" ]; + NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; + NIX_CFLAGS_LINK = [ ]; + }; + }; + zen5 = recursiveUpdate zen4 rec { + march = "zen5"; + override.stdenv'.env = rec { + NIX_CFLAGS_COMPILE = [ "-march=${march}" ]; + NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; + NIX_CFLAGS_LINK = [ ]; + }; + }; + bluefield2 = rec { + arch = "aarch64"; + march = "armv8.2-a"; + mcpu = "cortex-a72"; + numa = { + max-nodes = 1; + }; + override = { + stdenv'.env = rec { + NIX_CFLAGS_COMPILE = [ "-mcpu=${mcpu}" ]; + NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; + NIX_CFLAGS_LINK = [ ]; + }; + dpdk = { + buildInputs = { + rdma-core = true; + libbsd = true; + libnl = true; + numactl = false; + }; + }; + }; + }; + bluefield3 = recursiveUpdate bluefield2 rec { + march = "armv8.6-a"; + mcpu = "cortex-a78ae"; + override.stdenv'.env = rec { + NIX_CFLAGS_COMPILE = [ "-mcpu=${mcpu}" ]; + NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; + NIX_CFLAGS_LINK = [ ]; + }; + }; +} diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index 516c66e60..e4244c5e0 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -2,7 +2,8 @@ # Copyright Open Network Fabric Authors { sources, - env ? { }, + sanitizers, + env, }: final: prev: let @@ -15,21 +16,18 @@ let adapt = final.stdenvAdapters; bintools = final.buildPackages.llvmPackages.bintools; lld = final.buildPackages.llvmPackages.lld; - stdenv-llvm = adapt.addAttrsToDerivation (orig: { + stdenv' = adapt.addAttrsToDerivation (orig: { doCheck = false; + env = helpers.addToEnv env (orig.env or { }); nativeBuildInputs = (orig.nativeBuildInputs or [ ]) ++ [ bintools lld ]; }) final.llvmPackages.stdenv; - # }) (adapt.makeStaticLibraries final.buildPackages.llvmPackages.stdenv); - stdenv-llvm-with-flags = adapt.addAttrsToDerivation (orig: { - env = helpers.addToEnv env (orig.env or { }); - }) stdenv-llvm; - dataplane-dep = pkg: pkg.override { stdenv = stdenv-llvm-with-flags; }; + dataplane-dep = pkg: pkg.override { stdenv = stdenv'; }; in { - stdenv' = stdenv-llvm-with-flags; + inherit env stdenv'; # Don't bother adapting ethtool or iproute2's build to our custom flags / env. Failure to null this can trigger # _massive_ builds because ethtool depends on libnl (et al), and we _do_ overlay libnl. Thus, the ethtool / iproute2 # get rebuilt and you end up rebuilding the whole world. @@ -48,8 +46,8 @@ in mscgen = null; pandoc = null; - # We should avoid accepting anything in our dpdk + friends pkgs which depends on udev / systemd; our deploy won't - # support any such mechanisms. + # We should avoid accepting anything in our dpdk + friends pkgs which depends on udev / systemd; our deploy simply + # won't support any such mechanisms. # # Usually this type of dependency takes the form of udev rules / systemd service files being generated (which is no # problem). That said, builds which hard and fast depend on systemd or udev are very suspicious in this context, so @@ -130,16 +128,14 @@ in # function. In "the glorious future" we should bump all of this logic up to the dataplane's init process, compute # what we need to, pre-mmap _all_ of our heap memory, configure our cgroups and CPU affinities, and then pin our cores # and use memory pools local to the numa node of the pinned core. That would be a fair amount of work, but it would - # liminate a fairly large dependency and likely increase the performance and security of the dataplane. + # eliminate a dependency and likely increase the performance and security of the dataplane. # # For now, we leave this on so DPDK can do some of that for us. That said, this logic is quite cold and would ideally # be size optimized and punted far from all hot paths. BOLT should be helpful here. numactl = (dataplane-dep prev.numactl).overrideAttrs (orig: { outputs = (prev.lib.lists.remove "man" orig.outputs) ++ [ "static" ]; - # we need to enable shared (in addition to static) to build dpdk. - # See the note on libmd for reasoning. configureFlags = (orig.configureFlags or [ ]) ++ [ - "--enable-static" # dpdk does not like to build its .so files if we don't build numa.so as well + "--enable-static" ]; postInstall = (orig.postInstall or "") + '' mkdir -p "$static/lib"; @@ -159,29 +155,45 @@ in rdma-core = (dataplane-dep prev.rdma-core).overrideAttrs (orig: { version = sources.rdma-core.branch; src = sources.rdma-core.outPath; - outputs = [ - "dev" - "out" + outputs = (orig.outputs or [ ]) ++ [ "static" ]; - cmakeFlags = orig.cmakeFlags ++ [ - "-DENABLE_STATIC=1" - # we don't need pyverbs, and turning it off reduces build time / complexity. - "-DNO_PYVERBS=1" - # no need for docs in container images. - "-DNO_MAN_PAGES=1" - # we don't care about this lib's exported symbols / compat situation _at all_ because we static link (which - # doesn't even have symbol versioning / compatibility in the first place). Turning this off just reduces the - # build's internal complexity and makes lto easier. - "-DNO_COMPAT_SYMS=1" - # this allows thread sanitizer to build (thread/ub sanitizers do not like -Wl,-z,defs or -Wl,--no-undefined) - # Normally I would say that disabling -Wl,--no-undefined is a bad idea, but we throw away all the shared - # libs and executables from this build anwyway, so it it should be harmless. - "-DSUPPORTS_NO_UNDEFINED=0" # todo: find a way to enable this for only {thread,ub}san builds. - ]; + cmakeFlags = + orig.cmakeFlags + ++ [ + "-DENABLE_STATIC=1" + # we don't need pyverbs, and turning it off reduces build time / complexity. + "-DNO_PYVERBS=1" + # no need for docs in container images. + "-DNO_MAN_PAGES=1" + # we don't care about this lib's exported symbols / compat situation _at all_ because we static link (which + # doesn't even have symbol versioning / compatibility in the first place). Turning this off just reduces the + # build's internal complexity and makes lto easier. + "-DNO_COMPAT_SYMS=1" + # Very old versions of rdma-core used what they call the "legacy write path" to support rdma-operations. + # These have (long) since been superseded by the ioctl mode, but the library generates both code paths by + # default due to rdma-core's fairly aggressive backwards compatibility stance. + # We have absolutely no need or desire to support the legacy mode, and we can potentially save ourselves some + # instruction cache pressure by disabling that old code at compile time. + "-DIOCTL_MODE=ioctl" + ] + ++ + final.lib.optionals + ( + (builtins.elem "thread" sanitizers) + || (builtins.elem "address" sanitizers) + || (builtins.elem "safe-stack" sanitizers) + ) + [ + # This allows address / thread sanitizer to build (thread/ub sanitizers do not like -Wl,-z,defs or + # -Wl,--no-undefined). + # This isn't a hack: undefined symbols from sanitizers is a known issue and is not unique to us. + "-DSUPPORTS_NO_UNDEFINED=0" + ]; postInstall = (orig.postInstall or "") + '' - mkdir -p $static/lib; + mkdir -p $static/lib $man; mv $out/lib/*.a $static/lib/ + mv $out/share $man/ ''; }); @@ -201,6 +213,4 @@ in # This wrapping process does not really cause any performance issue due to lto; the compiler is going to "unwrap" # these methods anyway. dpdk-wrapper = dataplane-dep (final.callPackage ../pkgs/dpdk-wrapper { }); - - inherit env; } diff --git a/nix/overlays/default.nix b/nix/overlays/default.nix index d6d69a8f7..8bc0891c6 100644 --- a/nix/overlays/default.nix +++ b/nix/overlays/default.nix @@ -2,10 +2,11 @@ # Copyright Open Network Fabric Authors { sources, - env ? { }, + sanitizers, + env, }: { dataplane = import ./dataplane.nix { - inherit sources env; + inherit sources sanitizers env; }; } diff --git a/nix/pkgs/dpdk/default.nix b/nix/pkgs/dpdk/default.nix index a942502ff..bc7b394de 100644 --- a/nix/pkgs/dpdk/default.nix +++ b/nix/pkgs/dpdk/default.nix @@ -241,17 +241,27 @@ stdenv.mkDerivation { cpu = stdenv.hostPlatform.parsed.cpu.arch; kernel = stdenv.hostPlatform.parsed.kernel.name; endian = - if stdenv.hostPlatform.parsed.cpu.significantByte.name == "littleEndian" then "little" else "big"; - libc = if stdenv.hostPlatform.libc == "glibc" then "gnu" else stdenv.hostPlatform.libc; + { + littleEndian = "little"; + bigEndian = "big"; + } + .${stdenv.hostPlatform.parsed.cpu.significantByte.name}; + libc-vendor = + { + glibc = "gnu"; + musl = "musl"; + } + .${stdenv.hostPlatform.libc}; isCrossCompile = stdenv.buildPlatform.parsed != stdenv.hostPlatform.parsed; + cross-prefix = "${arch}-unknown-${kernel}-${libc-vendor}"; cross-file = writeText "cross-file.ini" '' [binaries] - c = '${arch}-unknown-${kernel}-${libc}-cc' - cpp = '${arch}-unknown-${kernel}-${libc}-c++' - ar = '${arch}-unknown-${kernel}-${libc}-ar' - strip = '${arch}-unknown-${kernel}-${libc}-strip' - pkgconfig = '${arch}-unknown-${kernel}-${libc}-pkg-config' - pkg-config = '${arch}-unknown-${kernel}-${libc}-pkg-config' + c = '${cross-prefix}-cc' + cpp = '${cross-prefix}-c++' + ar = '${cross-prefix}-ar' + strip = '${cross-prefix}-strip' + pkgconfig = '${cross-prefix}-pkg-config' + pkg-config = '${cross-prefix}-pkg-config' [host_machine] system = '${kernel}' @@ -261,7 +271,7 @@ stdenv.mkDerivation { [properties] platform = '${build-params.platform}' - libc = '${libc}' + libc = '${libc-vendor}' ''; in with build-params; diff --git a/nix/profiles.nix b/nix/profiles.nix index e978e7b32..7e47d8b8f 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -61,11 +61,7 @@ let "-mssse3" ]; march.x86_64.NIX_CXXFLAGS_COMPILE = march.x86_64.NIX_CFLAGS_COMPILE; - march.aarch64.NIX_CFLAGS_COMPILE = [ - "-march=armv8.6-a" - "-mcpu=cortex-a78" - "-mtune=cortex-a78" - ]; + march.aarch64.NIX_CFLAGS_COMPILE = [ ]; march.aarch64.NIX_CXXFLAGS_COMPILE = march.aarch64.NIX_CFLAGS_COMPILE; march.aarch64.NIX_CFLAGS_LINK = [ ]; sanitize.address.NIX_CFLAGS_COMPILE = [ From 4353592d1efe0ee4fa37848dda731b204a2fb7f7 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sat, 20 Dec 2025 22:47:08 +0000 Subject: [PATCH 061/163] wip --- default.nix | 44 ++--------- nix/overlays/dataplane.nix | 8 +- nix/overlays/default.nix | 9 ++- nix/{machine.nix => platform.nix} | 15 ++-- nix/profiles.nix | 2 +- nix/target.nix | 127 ++++++++++++++++++++++++++++++ 6 files changed, 155 insertions(+), 50 deletions(-) rename nix/{machine.nix => platform.nix} (87%) create mode 100644 nix/target.nix diff --git a/default.nix b/default.nix index d9920afb6..f69dda8ed 100644 --- a/default.nix +++ b/default.nix @@ -10,54 +10,26 @@ }: let lib = (import sources.nixpkgs { }).lib; - platform' = (import ./nix/machine.nix lib.recursiveUpdate).${platform}; - target = "${platform'.arch}-unknown-linux-${libc}"; - arch = - { - "x86_64-unknown-linux-gnu" = { - target = "x86_64-unknown-linux-gnu"; - machine = "x86_64"; - nixarch = "gnu64"; - libc = "gnu"; - }; - "x86_64-unknown-linux-musl" = { - target = "x86_64-unknown-linux-musl"; - machine = "x86_64"; - nixarch = "musl64"; - libc = "musl"; - }; - "aarch64-unknown-linux-gnu" = { - target = "aarch64-unknown-linux-gnu"; - machine = "aarch64"; - nixarch = "aarch64-multiplatform"; - libc = "glibc"; - }; - "aarch64-unknown-linux-musl" = { - target = "aarch64-unknown-linux-musl"; - machine = "aarch64"; - nixarch = "aarch64-multiplatform-musl"; - libc = "musl"; - }; - } - .${target}; # helper method to work around nix's contrived builtin string split function. split-str = split: str: builtins.filter (elm: builtins.isString elm) (builtins.split split str); - sanitizers = split-str ",+" sanitize; + sanitizers = if sanitize == "" then [] else split-str ",+" sanitize; sources = import ./npins; + target = import ./nix/target.nix { + inherit lib platform libc; + }; profile = import ./nix/profiles.nix { inherit prof sanitizers instrumentation; - arch = arch.machine; + arch = target.platform.arch; }; overlays = import ./nix/overlays { - inherit sources sanitizers; - env = profile; + inherit sources sanitizers target profile; }; pkgs = (import sources.nixpkgs { overlays = [ overlays.${overlay} ]; - }).pkgsCross.${arch.nixarch}; + }).pkgsCross.${target.info.nixarch}; in pkgs.lib.fix (final: { inherit @@ -65,9 +37,7 @@ pkgs.lib.fix (final: { sources profile target - arch ; - platform = platform'; sysroot-list = with final.pkgs; [ libc.static libc.out diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index e4244c5e0..a8e1bddeb 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -3,7 +3,8 @@ { sources, sanitizers, - env, + target, + profile, }: final: prev: let @@ -16,9 +17,12 @@ let adapt = final.stdenvAdapters; bintools = final.buildPackages.llvmPackages.bintools; lld = final.buildPackages.llvmPackages.lld; + env = helpers.addToEnv target.platform.override.stdenv.env profile; stdenv' = adapt.addAttrsToDerivation (orig: { doCheck = false; - env = helpers.addToEnv env (orig.env or { }); + env = helpers.addToEnv target.platform.override.stdenv.env ( + helpers.addToEnv env (orig.env or { }) + ); nativeBuildInputs = (orig.nativeBuildInputs or [ ]) ++ [ bintools lld diff --git a/nix/overlays/default.nix b/nix/overlays/default.nix index 8bc0891c6..488472a3c 100644 --- a/nix/overlays/default.nix +++ b/nix/overlays/default.nix @@ -1,12 +1,13 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright Open Network Fabric Authors { - sources, - sanitizers, - env, + sources, + sanitizers, + target, + profile, }: { dataplane = import ./dataplane.nix { - inherit sources sanitizers env; + inherit sources sanitizers target profile; }; } diff --git a/nix/machine.nix b/nix/platform.nix similarity index 87% rename from nix/machine.nix rename to nix/platform.nix index 98c122343..94b1122c0 100644 --- a/nix/machine.nix +++ b/nix/platform.nix @@ -1,4 +1,7 @@ -recursiveUpdate: rec { +{ + lib ? (import { }).lib, +}: +rec { x86-64-v3 = rec { arch = "x86_64"; march = "x86-64-v3"; @@ -21,7 +24,7 @@ recursiveUpdate: rec { }; }; }; - x86-64-v4 = recursiveUpdate x86-64-v3 rec { + x86-64-v4 = lib.recursiveUpdate x86-64-v3 rec { march = "x86-64-v4"; override.stdenv'.env = rec { NIX_CFLAGS_COMPILE = [ "-march=${march}" ]; @@ -29,7 +32,7 @@ recursiveUpdate: rec { NIX_CFLAGS_LINK = [ ]; }; }; - zen4 = recursiveUpdate x86-64-v4 rec { + zen4 = lib.recursiveUpdate x86-64-v4 rec { march = "zen4"; override.stdenv'.env = rec { NIX_CFLAGS_COMPILE = [ "-march=${march}" ]; @@ -37,7 +40,7 @@ recursiveUpdate: rec { NIX_CFLAGS_LINK = [ ]; }; }; - zen5 = recursiveUpdate zen4 rec { + zen5 = lib.recursiveUpdate zen4 rec { march = "zen5"; override.stdenv'.env = rec { NIX_CFLAGS_COMPILE = [ "-march=${march}" ]; @@ -68,8 +71,8 @@ recursiveUpdate: rec { }; }; }; - bluefield3 = recursiveUpdate bluefield2 rec { - march = "armv8.6-a"; + bluefield3 = lib.recursiveUpdate bluefield2 rec { + march = "armv8.4-a"; mcpu = "cortex-a78ae"; override.stdenv'.env = rec { NIX_CFLAGS_COMPILE = [ "-mcpu=${mcpu}" ]; diff --git a/nix/profiles.nix b/nix/profiles.nix index 7e47d8b8f..eaa14c67f 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -55,7 +55,7 @@ let march.x86_64.NIX_CFLAGS_COMPILE = [ # DPDK functionally requires some -m flags on x86_64. # These features have been available for a long time and can be found on any reasonably recent machine, so just - # enable them here for x86_64 builds. + # enable them here for all x86_64 builds. "-mrtm" "-mcrc32" "-mssse3" diff --git a/nix/target.nix b/nix/target.nix new file mode 100644 index 000000000..7bd0ebb0a --- /dev/null +++ b/nix/target.nix @@ -0,0 +1,127 @@ +{ + lib ? (import { }).lib, + platform, + kernel ? "linux", + libc, +}: +let + platforms = rec { + x86-64-v3 = rec { + arch = "x86_64"; + march = "x86-64-v3"; + numa = { + max-nodes = 8; + }; + override = { + stdenv.env = rec { + NIX_CFLAGS_COMPILE = [ "-march=${march}" ]; + NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; + NIX_CFLAGS_LINK = [ ]; + }; + dpdk = { + buildInputs = { + rdma-core = true; + libbsd = true; + libnl = true; + numactl = true; + }; + }; + }; + }; + x86-64-v4 = lib.recursiveUpdate x86-64-v3 rec { + march = "x86-64-v4"; + override.stdenv.env = rec { + NIX_CFLAGS_COMPILE = [ "-march=${march}" ]; + NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; + NIX_CFLAGS_LINK = [ ]; + }; + }; + zen4 = lib.recursiveUpdate x86-64-v4 rec { + march = "znver4"; + override.stdenv.env = rec { + NIX_CFLAGS_COMPILE = [ "-march=${march}" ]; + NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; + NIX_CFLAGS_LINK = [ ]; + }; + }; + zen5 = lib.recursiveUpdate zen4 rec { + march = "znver5"; + override.stdenv.env = rec { + NIX_CFLAGS_COMPILE = [ "-march=${march}" ]; + NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; + NIX_CFLAGS_LINK = [ ]; + }; + }; + bluefield2 = rec { + arch = "aarch64"; + march = "armv8.2-a"; + mcpu = "cortex-a72"; + numa = { + max-nodes = 1; + }; + override = { + stdenv.env = rec { + NIX_CFLAGS_COMPILE = [ "-mcpu=${mcpu}" ]; + NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; + NIX_CFLAGS_LINK = [ ]; + }; + dpdk = { + buildInputs = { + rdma-core = true; + libbsd = true; + libnl = true; + numactl = false; + }; + }; + }; + }; + bluefield3 = lib.recursiveUpdate bluefield2 rec { + march = "armv8.4-a"; + mcpu = "cortex-a78ae"; + override.stdenv.env = rec { + NIX_CFLAGS_COMPILE = [ "-mcpu=${mcpu}" ]; + NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; + NIX_CFLAGS_LINK = [ ]; + }; + }; + }; +in +lib.fix (final: { + platform = platforms.${platform}; + info = + { + x86_64 = { + linux = { + gnu = { + target = "x86_64-unknown-linux-gnu"; + machine = "x86_64"; + nixarch = "gnu64"; + libc = "gnu"; + }; + musl = { + target = "x86_64-unknown-linux-musl"; + machine = "x86_64"; + nixarch = "musl64"; + libc = "musl"; + }; + }; + }; + aarch64 = { + linux = { + gnu = { + target = "aarch64-unknown-linux-gnu"; + machine = "aarch64"; + nixarch = "aarch64-multiplatform"; + libc = "gnu"; + }; + musl = { + target = "aarch64-unknown-linux-musl"; + machine = "aarch64"; + nixarch = "aarch64-multiplatform-musl"; + libc = "musl"; + }; + }; + }; + } + .${final.platform.arch}.${kernel}.${libc}; +}) From f07f3a0f4d9754540373e117c39a412657787e28 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 21 Dec 2025 04:12:21 +0000 Subject: [PATCH 062/163] wip --- .clangd | 3 + default.nix | 65 +- nix/overlays/dataplane.nix | 23 +- nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.c | 1516 +++++++++++++++++++++- nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.h | 1516 +--------------------- nix/pkgs/dpdk/default.nix | 1 + nix/target.nix | 12 +- shell.nix | 65 +- sysroot | 2 +- 9 files changed, 1628 insertions(+), 1575 deletions(-) create mode 100644 .clangd diff --git a/.clangd b/.clangd new file mode 100644 index 000000000..bb03d2f22 --- /dev/null +++ b/.clangd @@ -0,0 +1,3 @@ +CompileFlags: + Add: + - "-I/home/dnoland/code/githedgehog/dataplane/sysroot/include" diff --git a/default.nix b/default.nix index f69dda8ed..e5ade058e 100644 --- a/default.nix +++ b/default.nix @@ -11,8 +11,10 @@ let lib = (import sources.nixpkgs { }).lib; # helper method to work around nix's contrived builtin string split function. - split-str = split: str: builtins.filter (elm: builtins.isString elm) (builtins.split split str); - sanitizers = if sanitize == "" then [] else split-str ",+" sanitize; + split-str = + split: str: + if str == "" then [ ] else builtins.filter (elm: builtins.isString elm) (builtins.split split str); + sanitizers = split-str ",+" sanitize; sources = import ./npins; target = import ./nix/target.nix { inherit lib platform libc; @@ -22,7 +24,12 @@ let arch = target.platform.arch; }; overlays = import ./nix/overlays { - inherit sources sanitizers target profile; + inherit + sources + sanitizers + target + profile + ; }; pkgs = (import sources.nixpkgs { @@ -30,31 +37,51 @@ let overlays.${overlay} ]; }).pkgsCross.${target.info.nixarch}; -in -pkgs.lib.fix (final: { - inherit - pkgs - sources - profile - target - ; - sysroot-list = with final.pkgs; [ - libc.static - libc.out + + sysroot-list = with pkgs; [ + stdenv'.cc.libc.dev + stdenv'.cc.libc.out + libmd.dev libmd.static + libbsd.dev libbsd.static - libnl.out numactl.dev numactl.static + rdma-core.dev rdma-core.static dpdk.dev - dpdk.out dpdk.static dpdk-wrapper.dev dpdk-wrapper.out ]; - sysroot = pkgs.symlinkJoin { - name = "sysroot"; - paths = final.sysroot-list; + build-tools-list = with pkgs.buildPackages.llvmPackages; [ + bintools + clang + libclang.lib + lld + ]; +in +pkgs.lib.fix (final: { + inherit + pkgs + sources + profile + target + ; + sysroot = + with final.pkgs; + symlinkJoin { + name = "sysroot"; + paths = sysroot-list; + }; + build-tools = + with final.pkgs.buildPackages; + symlinkJoin { + name = "build-tools"; + paths = build-tools-list; + }; + dev-shell = final.pkgs.symlinkJoin { + name = "dataplane-dev-shell"; + paths = sysroot-list ++ build-tools-list; }; }) diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index a8e1bddeb..3415552c2 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -17,12 +17,11 @@ let adapt = final.stdenvAdapters; bintools = final.buildPackages.llvmPackages.bintools; lld = final.buildPackages.llvmPackages.lld; - env = helpers.addToEnv target.platform.override.stdenv.env profile; + added-to-env = helpers.addToEnv target.platform.override.stdenv.env profile; stdenv' = adapt.addAttrsToDerivation (orig: { doCheck = false; - env = helpers.addToEnv target.platform.override.stdenv.env ( - helpers.addToEnv env (orig.env or { }) - ); + separateDebugInfo = true; + env = helpers.addToEnv added-to-env (orig.env or { }); nativeBuildInputs = (orig.nativeBuildInputs or [ ]) ++ [ bintools lld @@ -31,7 +30,7 @@ let dataplane-dep = pkg: pkg.override { stdenv = stdenv'; }; in { - inherit env stdenv'; + inherit stdenv' added-to-env; # Don't bother adapting ethtool or iproute2's build to our custom flags / env. Failure to null this can trigger # _massive_ builds because ethtool depends on libnl (et al), and we _do_ overlay libnl. Thus, the ethtool / iproute2 # get rebuilt and you end up rebuilding the whole world. @@ -67,7 +66,7 @@ in # At minimum, the provided functions are generally quite small and likely to benefit from inlining, so static linking # is a solid plan. libmd = (dataplane-dep prev.libmd).overrideAttrs (orig: { - outputs = (orig.outputs or [ "out" ]) ++ [ "static" ]; + outputs = (orig.outputs or [ "out" ]) ++ [ "man" "dev" "static" ]; # we need to enable shared libs (in addition to static) to make dpdk's build happy. Basically, DPDK's build has no # means of disabling shared libraries, and it doesn't really make any sense to static link this into each .so # file. Ideally we would just _not_ build those .so files, but that would require doing brain surgery on dpdk's @@ -162,6 +161,12 @@ in outputs = (orig.outputs or [ ]) ++ [ "static" ]; + # CMake depends on -Werror to function, but the test program it uses to confirm that -Werror works "always produces + # warnings." The reason for this is that we have injected our own CFLAGS and they have nothing to do with the + # trivial program. This causes the unused-command-line-argument warning to trigger. + # We disable that warning here to make sure rdma-core can build (more specifically, to make sure that it can build + # with debug symbols). + CFLAGS = "-Wno-unused-command-line-argument"; cmakeFlags = orig.cmakeFlags ++ [ @@ -209,7 +214,11 @@ in # # Also, while this library has a respectable security track record, this is also a super strong candidate for # cfi, safe-stack, and cf-protection. - dpdk = dataplane-dep (final.callPackage ../pkgs/dpdk { src = sources.dpdk; }); + dpdk = dataplane-dep ( + final.callPackage ../pkgs/dpdk ( + target.platform.override.dpdk.buildInputs // { src = sources.dpdk; } + ) + ); # DPDK is largely composed of static-inline functions. # We need to wrap those functions with "_w" variants so that we can actually call them from rust. diff --git a/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.c b/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.c index 58e2f4df7..118e3fc13 100644 --- a/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.c +++ b/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.c @@ -3,14 +3,1516 @@ #include "dpdk_wrapper.h" -int wrte_errno() { - return rte_errno; -} +int rte_errno_get() { return rte_errno; } + +// Static wrappers -uint16_t wrte_eth_rx_burst(uint16_t const port_id, uint16_t const queue_id, struct rte_mbuf **rx_pkts, uint16_t const nb_pkts) { - return rte_eth_rx_burst(port_id, queue_id, rx_pkts, nb_pkts); +int rte_is_aligned_w(const const void *const ptr, const unsigned int align) { + return rte_is_aligned(ptr, align); +} +void rte_atomic_thread_fence_w(rte_memory_order memorder) { + rte_atomic_thread_fence(memorder); +} +int rte_atomic16_cmpset_w(uint16_t *dst, uint16_t exp, uint16_t src) { + return rte_atomic16_cmpset(dst, exp, src); +} +uint16_t rte_atomic16_exchange_w(uint16_t *dst, uint16_t val) { + return rte_atomic16_exchange(dst, val); +} +void rte_atomic16_init_w(rte_atomic16_t *v) { rte_atomic16_init(v); } +int16_t rte_atomic16_read_w(const rte_atomic16_t *v) { + return rte_atomic16_read(v); +} +void rte_atomic16_set_w(rte_atomic16_t *v, int16_t new_value) { + rte_atomic16_set(v, new_value); +} +void rte_atomic16_add_w(rte_atomic16_t *v, int16_t inc) { + rte_atomic16_add(v, inc); +} +void rte_atomic16_sub_w(rte_atomic16_t *v, int16_t dec) { + rte_atomic16_sub(v, dec); +} +void rte_atomic16_inc_w(rte_atomic16_t *v) { rte_atomic16_inc(v); } +void rte_atomic16_dec_w(rte_atomic16_t *v) { rte_atomic16_dec(v); } +int16_t rte_atomic16_add_return_w(rte_atomic16_t *v, int16_t inc) { + return rte_atomic16_add_return(v, inc); +} +int16_t rte_atomic16_sub_return_w(rte_atomic16_t *v, int16_t dec) { + return rte_atomic16_sub_return(v, dec); +} +int rte_atomic16_inc_and_test_w(rte_atomic16_t *v) { + return rte_atomic16_inc_and_test(v); +} +int rte_atomic16_dec_and_test_w(rte_atomic16_t *v) { + return rte_atomic16_dec_and_test(v); +} +int rte_atomic16_test_and_set_w(rte_atomic16_t *v) { + return rte_atomic16_test_and_set(v); +} +void rte_atomic16_clear_w(rte_atomic16_t *v) { rte_atomic16_clear(v); } +int rte_atomic32_cmpset_w(uint32_t *dst, uint32_t exp, uint32_t src) { + return rte_atomic32_cmpset(dst, exp, src); +} +uint32_t rte_atomic32_exchange_w(uint32_t *dst, uint32_t val) { + return rte_atomic32_exchange(dst, val); +} +void rte_atomic32_init_w(rte_atomic32_t *v) { rte_atomic32_init(v); } +int32_t rte_atomic32_read_w(const rte_atomic32_t *v) { + return rte_atomic32_read(v); +} +void rte_atomic32_set_w(rte_atomic32_t *v, int32_t new_value) { + rte_atomic32_set(v, new_value); +} +void rte_atomic32_add_w(rte_atomic32_t *v, int32_t inc) { + rte_atomic32_add(v, inc); +} +void rte_atomic32_sub_w(rte_atomic32_t *v, int32_t dec) { + rte_atomic32_sub(v, dec); +} +void rte_atomic32_inc_w(rte_atomic32_t *v) { rte_atomic32_inc(v); } +void rte_atomic32_dec_w(rte_atomic32_t *v) { rte_atomic32_dec(v); } +int32_t rte_atomic32_add_return_w(rte_atomic32_t *v, int32_t inc) { + return rte_atomic32_add_return(v, inc); +} +int32_t rte_atomic32_sub_return_w(rte_atomic32_t *v, int32_t dec) { + return rte_atomic32_sub_return(v, dec); +} +int rte_atomic32_inc_and_test_w(rte_atomic32_t *v) { + return rte_atomic32_inc_and_test(v); +} +int rte_atomic32_dec_and_test_w(rte_atomic32_t *v) { + return rte_atomic32_dec_and_test(v); +} +int rte_atomic32_test_and_set_w(rte_atomic32_t *v) { + return rte_atomic32_test_and_set(v); +} +void rte_atomic32_clear_w(rte_atomic32_t *v) { rte_atomic32_clear(v); } +int rte_atomic64_cmpset_w(uint64_t *dst, uint64_t exp, uint64_t src) { + return rte_atomic64_cmpset(dst, exp, src); +} +uint64_t rte_atomic64_exchange_w(uint64_t *dst, uint64_t val) { + return rte_atomic64_exchange(dst, val); +} +void rte_atomic64_init_w(rte_atomic64_t *v) { rte_atomic64_init(v); } +int64_t rte_atomic64_read_w(rte_atomic64_t *v) { return rte_atomic64_read(v); } +void rte_atomic64_set_w(rte_atomic64_t *v, int64_t new_value) { + rte_atomic64_set(v, new_value); +} +void rte_atomic64_add_w(rte_atomic64_t *v, int64_t inc) { + rte_atomic64_add(v, inc); +} +void rte_atomic64_sub_w(rte_atomic64_t *v, int64_t dec) { + rte_atomic64_sub(v, dec); +} +void rte_atomic64_inc_w(rte_atomic64_t *v) { rte_atomic64_inc(v); } +void rte_atomic64_dec_w(rte_atomic64_t *v) { rte_atomic64_dec(v); } +int64_t rte_atomic64_add_return_w(rte_atomic64_t *v, int64_t inc) { + return rte_atomic64_add_return(v, inc); +} +int64_t rte_atomic64_sub_return_w(rte_atomic64_t *v, int64_t dec) { + return rte_atomic64_sub_return(v, dec); +} +int rte_atomic64_inc_and_test_w(rte_atomic64_t *v) { + return rte_atomic64_inc_and_test(v); +} +int rte_atomic64_dec_and_test_w(rte_atomic64_t *v) { + return rte_atomic64_dec_and_test(v); +} +int rte_atomic64_test_and_set_w(rte_atomic64_t *v) { + return rte_atomic64_test_and_set(v); +} +void rte_atomic64_clear_w(rte_atomic64_t *v) { rte_atomic64_clear(v); } +void rte_smp_mb_w(void) { rte_smp_mb(); } +uint64_t rte_get_tsc_cycles_w(void) { return rte_get_tsc_cycles(); } +uint64_t rte_get_timer_cycles_w(void) { return rte_get_timer_cycles(); } +uint64_t rte_get_timer_hz_w(void) { return rte_get_timer_hz(); } +void rte_delay_ms_w(unsigned int ms) { rte_delay_ms(ms); } +uint64_t rte_rdtsc_w(void) { return rte_rdtsc(); } +uint64_t rte_rdtsc_precise_w(void) { return rte_rdtsc_precise(); } +size_t rte_strlcpy_w(char *dst, const char *src, size_t size) { + return rte_strlcpy(dst, src, size); +} +size_t rte_strlcat_w(char *dst, const char *src, size_t size) { + return rte_strlcat(dst, src, size); +} +const char *rte_str_skip_leading_spaces_w(const char *src) { + return rte_str_skip_leading_spaces(src); +} +void rte_uuid_copy_w(rte_uuid_t dst, const rte_uuid_t src) { + rte_uuid_copy(dst, src); +} +int rte_gettid_w(void) { return rte_gettid(); } +unsigned int rte_lcore_id_w(void) { return rte_lcore_id(); } +void rte_pause_w(void) { rte_pause(); } +void rte_wait_until_equal_16_w(uint16_t *addr, uint16_t expected, + rte_memory_order memorder) { + rte_wait_until_equal_16(addr, expected, memorder); +} +void rte_wait_until_equal_32_w(uint32_t *addr, uint32_t expected, + rte_memory_order memorder) { + rte_wait_until_equal_32(addr, expected, memorder); +} +void rte_wait_until_equal_64_w(uint64_t *addr, uint64_t expected, + rte_memory_order memorder) { + rte_wait_until_equal_64(addr, expected, memorder); +} +void rte_spinlock_init_w(rte_spinlock_t *sl) { rte_spinlock_init(sl); } +void rte_spinlock_lock_w(rte_spinlock_t *sl) { rte_spinlock_lock(sl); } +void rte_spinlock_unlock_w(rte_spinlock_t *sl) { rte_spinlock_unlock(sl); } +int rte_spinlock_trylock_w(rte_spinlock_t *sl) { + return rte_spinlock_trylock(sl); +} +int rte_spinlock_is_locked_w(rte_spinlock_t *sl) { + return rte_spinlock_is_locked(sl); +} +int rte_tm_supported_w(void) { return rte_tm_supported(); } +void rte_spinlock_lock_tm_w(rte_spinlock_t *sl) { rte_spinlock_lock_tm(sl); } +void rte_spinlock_unlock_tm_w(rte_spinlock_t *sl) { + rte_spinlock_unlock_tm(sl); +} +int rte_spinlock_trylock_tm_w(rte_spinlock_t *sl) { + return rte_spinlock_trylock_tm(sl); +} +void rte_spinlock_recursive_init_w(rte_spinlock_recursive_t *slr) { + rte_spinlock_recursive_init(slr); +} +void rte_spinlock_recursive_lock_w(rte_spinlock_recursive_t *slr) { + rte_spinlock_recursive_lock(slr); +} +void rte_spinlock_recursive_unlock_w(rte_spinlock_recursive_t *slr) { + rte_spinlock_recursive_unlock(slr); +} +int rte_spinlock_recursive_trylock_w(rte_spinlock_recursive_t *slr) { + return rte_spinlock_recursive_trylock(slr); +} +void rte_spinlock_recursive_lock_tm_w(rte_spinlock_recursive_t *slr) { + rte_spinlock_recursive_lock_tm(slr); +} +void rte_spinlock_recursive_unlock_tm_w(rte_spinlock_recursive_t *slr) { + rte_spinlock_recursive_unlock_tm(slr); +} +int rte_spinlock_recursive_trylock_tm_w(rte_spinlock_recursive_t *slr) { + return rte_spinlock_recursive_trylock_tm(slr); +} +// unsigned int rte_xbegin_w(void) { return rte_xbegin(); } +// void rte_xend_w(void) { rte_xend(); } +// int rte_xtest_w(void) { return rte_xtest(); } +// int rte_try_tm_w(int *lock) { return rte_try_tm(lock); } +uint32_t rte_bit_relaxed_get32_w(unsigned int nr, uint32_t *addr) { + return rte_bit_relaxed_get32(nr, addr); +} +void rte_bit_relaxed_set32_w(unsigned int nr, uint32_t *addr) { + rte_bit_relaxed_set32(nr, addr); +} +void rte_bit_relaxed_clear32_w(unsigned int nr, uint32_t *addr) { + rte_bit_relaxed_clear32(nr, addr); +} +uint32_t rte_bit_relaxed_test_and_set32_w(unsigned int nr, uint32_t *addr) { + return rte_bit_relaxed_test_and_set32(nr, addr); +} +uint32_t rte_bit_relaxed_test_and_clear32_w(unsigned int nr, uint32_t *addr) { + return rte_bit_relaxed_test_and_clear32(nr, addr); +} +uint64_t rte_bit_relaxed_get64_w(unsigned int nr, uint64_t *addr) { + return rte_bit_relaxed_get64(nr, addr); +} +void rte_bit_relaxed_set64_w(unsigned int nr, uint64_t *addr) { + rte_bit_relaxed_set64(nr, addr); +} +void rte_bit_relaxed_clear64_w(unsigned int nr, uint64_t *addr) { + rte_bit_relaxed_clear64(nr, addr); +} +uint64_t rte_bit_relaxed_test_and_set64_w(unsigned int nr, uint64_t *addr) { + return rte_bit_relaxed_test_and_set64(nr, addr); +} +uint64_t rte_bit_relaxed_test_and_clear64_w(unsigned int nr, uint64_t *addr) { + return rte_bit_relaxed_test_and_clear64(nr, addr); +} +unsigned int rte_clz32_w(uint32_t v) { return rte_clz32(v); } +unsigned int rte_clz64_w(uint64_t v) { return rte_clz64(v); } +unsigned int rte_ctz32_w(uint32_t v) { return rte_ctz32(v); } +unsigned int rte_ctz64_w(uint64_t v) { return rte_ctz64(v); } +unsigned int rte_popcount32_w(uint32_t v) { return rte_popcount32(v); } +unsigned int rte_popcount64_w(uint64_t v) { return rte_popcount64(v); } +uint32_t rte_combine32ms1b_w(uint32_t x) { return rte_combine32ms1b(x); } +uint64_t rte_combine64ms1b_w(uint64_t v) { return rte_combine64ms1b(v); } +uint32_t rte_bsf32_w(uint32_t v) { return rte_bsf32(v); } +int rte_bsf32_safe_w(uint32_t v, uint32_t *pos) { + return rte_bsf32_safe(v, pos); +} +uint32_t rte_bsf64_w(uint64_t v) { return rte_bsf64(v); } +int rte_bsf64_safe_w(uint64_t v, uint32_t *pos) { + return rte_bsf64_safe(v, pos); +} +uint32_t rte_fls_u32_w(uint32_t x) { return rte_fls_u32(x); } +uint32_t rte_fls_u64_w(uint64_t x) { return rte_fls_u64(x); } +int rte_is_power_of_2_w(uint32_t n) { return rte_is_power_of_2(n); } +uint32_t rte_align32pow2_w(uint32_t x) { return rte_align32pow2(x); } +uint32_t rte_align32prevpow2_w(uint32_t x) { return rte_align32prevpow2(x); } +uint64_t rte_align64pow2_w(uint64_t v) { return rte_align64pow2(v); } +uint64_t rte_align64prevpow2_w(uint64_t v) { return rte_align64prevpow2(v); } +uint32_t rte_log2_u32_w(uint32_t v) { return rte_log2_u32(v); } +uint32_t rte_log2_u64_w(uint64_t v) { return rte_log2_u64(v); } +void rte_rwlock_init_w(rte_rwlock_t *rwl) { rte_rwlock_init(rwl); } +void rte_rwlock_read_lock_w(rte_rwlock_t *rwl) { rte_rwlock_read_lock(rwl); } +int rte_rwlock_read_trylock_w(rte_rwlock_t *rwl) { + return rte_rwlock_read_trylock(rwl); +} +void rte_rwlock_read_unlock_w(rte_rwlock_t *rwl) { + rte_rwlock_read_unlock(rwl); +} +int rte_rwlock_write_trylock_w(rte_rwlock_t *rwl) { + return rte_rwlock_write_trylock(rwl); +} +void rte_rwlock_write_lock_w(rte_rwlock_t *rwl) { rte_rwlock_write_lock(rwl); } +void rte_rwlock_write_unlock_w(rte_rwlock_t *rwl) { + rte_rwlock_write_unlock(rwl); +} +int rte_rwlock_write_is_locked_w(rte_rwlock_t *rwl) { + return rte_rwlock_write_is_locked(rwl); +} +void rte_rwlock_read_lock_tm_w(rte_rwlock_t *rwl) { + rte_rwlock_read_lock_tm(rwl); +} +void rte_rwlock_read_unlock_tm_w(rte_rwlock_t *rwl) { + rte_rwlock_read_unlock_tm(rwl); +} +void rte_rwlock_write_lock_tm_w(rte_rwlock_t *rwl) { + rte_rwlock_write_lock_tm(rwl); +} +void rte_rwlock_write_unlock_tm_w(rte_rwlock_t *rwl) { + rte_rwlock_write_unlock_tm(rwl); +} +unsigned int rte_ring_mp_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_enqueue_bulk_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_sp_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space) { + return rte_ring_sp_enqueue_bulk_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_mp_hts_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_hts_enqueue_bulk_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_mc_hts_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_hts_dequeue_bulk_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_mp_hts_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_hts_enqueue_burst_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_mc_hts_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_hts_dequeue_burst_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_mp_hts_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_hts_enqueue_bulk(r, obj_table, n, free_space); +} +unsigned int rte_ring_mc_hts_dequeue_bulk_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available) { + return rte_ring_mc_hts_dequeue_bulk(r, obj_table, n, available); +} +unsigned int rte_ring_mp_hts_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_hts_enqueue_burst(r, obj_table, n, free_space); +} +unsigned int rte_ring_mc_hts_dequeue_burst_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available) { + return rte_ring_mc_hts_dequeue_burst(r, obj_table, n, available); +} +unsigned int rte_ring_mp_rts_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_rts_enqueue_bulk_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_mc_rts_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_rts_dequeue_bulk_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_mp_rts_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_rts_enqueue_burst_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_mc_rts_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_rts_dequeue_burst_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_mp_rts_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_rts_enqueue_bulk(r, obj_table, n, free_space); +} +unsigned int rte_ring_mc_rts_dequeue_bulk_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available) { + return rte_ring_mc_rts_dequeue_bulk(r, obj_table, n, available); +} +unsigned int rte_ring_mp_rts_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_rts_enqueue_burst(r, obj_table, n, free_space); +} +unsigned int rte_ring_mc_rts_dequeue_burst_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available) { + return rte_ring_mc_rts_dequeue_burst(r, obj_table, n, available); +} +uint32_t rte_ring_get_prod_htd_max_w(const struct rte_ring *r) { + return rte_ring_get_prod_htd_max(r); +} +int rte_ring_set_prod_htd_max_w(struct rte_ring *r, uint32_t v) { + return rte_ring_set_prod_htd_max(r, v); +} +uint32_t rte_ring_get_cons_htd_max_w(const struct rte_ring *r) { + return rte_ring_get_cons_htd_max(r); +} +int rte_ring_set_cons_htd_max_w(struct rte_ring *r, uint32_t v) { + return rte_ring_set_cons_htd_max(r, v); +} +unsigned int rte_ring_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_bulk_elem(r, obj_table, esize, n, free_space); +} +int rte_ring_mp_enqueue_elem_w(struct rte_ring *r, void *obj, + unsigned int esize) { + return rte_ring_mp_enqueue_elem(r, obj, esize); +} +int rte_ring_sp_enqueue_elem_w(struct rte_ring *r, void *obj, + unsigned int esize) { + return rte_ring_sp_enqueue_elem(r, obj, esize); +} +int rte_ring_enqueue_elem_w(struct rte_ring *r, void *obj, unsigned int esize) { + return rte_ring_enqueue_elem(r, obj, esize); +} +unsigned int rte_ring_mc_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available) { + return rte_ring_mc_dequeue_bulk_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_sc_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available) { + return rte_ring_sc_dequeue_bulk_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_dequeue_bulk_elem_w(struct rte_ring *r, void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available) { + return rte_ring_dequeue_bulk_elem(r, obj_table, esize, n, available); +} +int rte_ring_mc_dequeue_elem_w(struct rte_ring *r, void *obj_p, + unsigned int esize) { + return rte_ring_mc_dequeue_elem(r, obj_p, esize); +} +int rte_ring_sc_dequeue_elem_w(struct rte_ring *r, void *obj_p, + unsigned int esize) { + return rte_ring_sc_dequeue_elem(r, obj_p, esize); +} +int rte_ring_dequeue_elem_w(struct rte_ring *r, void *obj_p, + unsigned int esize) { + return rte_ring_dequeue_elem(r, obj_p, esize); +} +unsigned int rte_ring_mp_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_enqueue_burst_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_sp_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space) { + return rte_ring_sp_enqueue_burst_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_burst_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_mc_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_dequeue_burst_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_sc_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_sc_dequeue_burst_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_dequeue_burst_elem_w(struct rte_ring *r, void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available) { + return rte_ring_dequeue_burst_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_enqueue_bulk_elem_start_w(struct rte_ring *r, + unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_bulk_elem_start(r, n, free_space); +} +unsigned int rte_ring_enqueue_bulk_start_w(struct rte_ring *r, unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_bulk_start(r, n, free_space); +} +unsigned int rte_ring_enqueue_burst_elem_start_w(struct rte_ring *r, + unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_burst_elem_start(r, n, free_space); +} +unsigned int rte_ring_enqueue_burst_start_w(struct rte_ring *r, unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_burst_start(r, n, free_space); +} +void rte_ring_enqueue_elem_finish_w(struct rte_ring *r, const void *obj_table, + unsigned int esize, unsigned int n) { + rte_ring_enqueue_elem_finish(r, obj_table, esize, n); +} +void rte_ring_enqueue_finish_w(struct rte_ring *r, void *const *obj_table, + unsigned int n) { + rte_ring_enqueue_finish(r, obj_table, n); +} +unsigned int rte_ring_dequeue_bulk_elem_start_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_dequeue_bulk_elem_start(r, obj_table, esize, n, available); +} +unsigned int rte_ring_dequeue_bulk_start_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available) { + return rte_ring_dequeue_bulk_start(r, obj_table, n, available); +} +unsigned int rte_ring_dequeue_burst_elem_start_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_dequeue_burst_elem_start(r, obj_table, esize, n, available); +} +unsigned int rte_ring_dequeue_burst_start_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available) { + return rte_ring_dequeue_burst_start(r, obj_table, n, available); +} +void rte_ring_dequeue_elem_finish_w(struct rte_ring *r, unsigned int n) { + rte_ring_dequeue_elem_finish(r, n); +} +void rte_ring_dequeue_finish_w(struct rte_ring *r, unsigned int n) { + rte_ring_dequeue_finish(r, n); +} +unsigned int rte_ring_enqueue_zc_bulk_elem_start_w(struct rte_ring *r, + unsigned int esize, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *free_space) { + return rte_ring_enqueue_zc_bulk_elem_start(r, esize, n, zcd, free_space); +} +unsigned int rte_ring_enqueue_zc_bulk_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *free_space) { + return rte_ring_enqueue_zc_bulk_start(r, n, zcd, free_space); +} +unsigned int rte_ring_enqueue_zc_burst_elem_start_w( + struct rte_ring *r, unsigned int esize, unsigned int n, + struct rte_ring_zc_data *zcd, unsigned int *free_space) { + return rte_ring_enqueue_zc_burst_elem_start(r, esize, n, zcd, free_space); +} +unsigned int rte_ring_enqueue_zc_burst_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *free_space) { + return rte_ring_enqueue_zc_burst_start(r, n, zcd, free_space); +} +void rte_ring_enqueue_zc_elem_finish_w(struct rte_ring *r, unsigned int n) { + rte_ring_enqueue_zc_elem_finish(r, n); +} +void rte_ring_enqueue_zc_finish_w(struct rte_ring *r, unsigned int n) { + rte_ring_enqueue_zc_finish(r, n); +} +unsigned int rte_ring_dequeue_zc_bulk_elem_start_w(struct rte_ring *r, + unsigned int esize, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *available) { + return rte_ring_dequeue_zc_bulk_elem_start(r, esize, n, zcd, available); +} +unsigned int rte_ring_dequeue_zc_bulk_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *available) { + return rte_ring_dequeue_zc_bulk_start(r, n, zcd, available); +} +unsigned int rte_ring_dequeue_zc_burst_elem_start_w( + struct rte_ring *r, unsigned int esize, unsigned int n, + struct rte_ring_zc_data *zcd, unsigned int *available) { + return rte_ring_dequeue_zc_burst_elem_start(r, esize, n, zcd, available); +} +unsigned int rte_ring_dequeue_zc_burst_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *available) { + return rte_ring_dequeue_zc_burst_start(r, n, zcd, available); +} +void rte_ring_dequeue_zc_elem_finish_w(struct rte_ring *r, unsigned int n) { + rte_ring_dequeue_zc_elem_finish(r, n); +} +void rte_ring_dequeue_zc_finish_w(struct rte_ring *r, unsigned int n) { + rte_ring_dequeue_zc_finish(r, n); +} +unsigned int rte_ring_mp_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_enqueue_bulk(r, obj_table, n, free_space); +} +unsigned int rte_ring_sp_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space) { + return rte_ring_sp_enqueue_bulk(r, obj_table, n, free_space); +} +unsigned int rte_ring_enqueue_bulk_w(struct rte_ring *r, void *const *obj_table, + unsigned int n, unsigned int *free_space) { + return rte_ring_enqueue_bulk(r, obj_table, n, free_space); +} +int rte_ring_mp_enqueue_w(struct rte_ring *r, void *obj) { + return rte_ring_mp_enqueue(r, obj); +} +int rte_ring_sp_enqueue_w(struct rte_ring *r, void *obj) { + return rte_ring_sp_enqueue(r, obj); +} +int rte_ring_enqueue_w(struct rte_ring *r, void *obj) { + return rte_ring_enqueue(r, obj); +} +unsigned int rte_ring_mc_dequeue_bulk_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_dequeue_bulk(r, obj_table, n, available); +} +unsigned int rte_ring_sc_dequeue_bulk_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available) { + return rte_ring_sc_dequeue_bulk(r, obj_table, n, available); +} +unsigned int rte_ring_dequeue_bulk_w(struct rte_ring *r, void **obj_table, + unsigned int n, unsigned int *available) { + return rte_ring_dequeue_bulk(r, obj_table, n, available); +} +int rte_ring_mc_dequeue_w(struct rte_ring *r, void **obj_p) { + return rte_ring_mc_dequeue(r, obj_p); +} +int rte_ring_sc_dequeue_w(struct rte_ring *r, void **obj_p) { + return rte_ring_sc_dequeue(r, obj_p); +} +int rte_ring_dequeue_w(struct rte_ring *r, void **obj_p) { + return rte_ring_dequeue(r, obj_p); +} +unsigned int rte_ring_count_w(const struct rte_ring *r) { + return rte_ring_count(r); +} +unsigned int rte_ring_free_count_w(const struct rte_ring *r) { + return rte_ring_free_count(r); +} +int rte_ring_full_w(const struct rte_ring *r) { return rte_ring_full(r); } +int rte_ring_empty_w(const struct rte_ring *r) { return rte_ring_empty(r); } +unsigned int rte_ring_get_size_w(const struct rte_ring *r) { + return rte_ring_get_size(r); +} +unsigned int rte_ring_get_capacity_w(const struct rte_ring *r) { + return rte_ring_get_capacity(r); +} +enum rte_ring_sync_type +rte_ring_get_prod_sync_type_w(const struct rte_ring *r) { + return rte_ring_get_prod_sync_type(r); +} +int rte_ring_is_prod_single_w(const struct rte_ring *r) { + return rte_ring_is_prod_single(r); +} +enum rte_ring_sync_type +rte_ring_get_cons_sync_type_w(const struct rte_ring *r) { + return rte_ring_get_cons_sync_type(r); +} +int rte_ring_is_cons_single_w(const struct rte_ring *r) { + return rte_ring_is_cons_single(r); +} +unsigned int rte_ring_mp_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_enqueue_burst(r, obj_table, n, free_space); +} +unsigned int rte_ring_sp_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space) { + return rte_ring_sp_enqueue_burst(r, obj_table, n, free_space); +} +unsigned int rte_ring_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_burst(r, obj_table, n, free_space); +} +unsigned int rte_ring_mc_dequeue_burst_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_dequeue_burst(r, obj_table, n, available); +} +unsigned int rte_ring_sc_dequeue_burst_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available) { + return rte_ring_sc_dequeue_burst(r, obj_table, n, available); +} +unsigned int rte_ring_dequeue_burst_w(struct rte_ring *r, void **obj_table, + unsigned int n, unsigned int *available) { + return rte_ring_dequeue_burst(r, obj_table, n, available); +} +void *rte_memcpy_w(void *dst, const void *src, size_t n) { + return rte_memcpy(dst, src, n); +} +// void *rte_mov15_or_less_w(void *dst, const void *src, size_t n) { +// return rte_mov15_or_less(dst, src, n); +// } +void rte_mov16_w(uint8_t *dst, const uint8_t *src) { rte_mov16(dst, src); } +void rte_mov32_w(uint8_t *dst, const uint8_t *src) { rte_mov32(dst, src); } +void rte_mov64_w(uint8_t *dst, const uint8_t *src) { rte_mov64(dst, src); } +void rte_mov256_w(uint8_t *dst, const uint8_t *src) { rte_mov256(dst, src); } +// void *rte_memcpy_generic_w(void *dst, const void *src, size_t n) { +// return rte_memcpy_generic(dst, src, n); +// } +// void *rte_memcpy_aligned_w(void *dst, const void *src, size_t n) { +// return rte_memcpy_aligned(dst, src, n); +// } +struct rte_mempool_objhdr *rte_mempool_get_header_w(void *obj) { + return rte_mempool_get_header(obj); +} +struct rte_mempool *rte_mempool_from_obj_w(void *obj) { + return rte_mempool_from_obj(obj); +} +struct rte_mempool_objtlr *rte_mempool_get_trailer_w(void *obj) { + return rte_mempool_get_trailer(obj); +} +struct rte_mempool_ops *rte_mempool_get_ops_w(int ops_index) { + return rte_mempool_get_ops(ops_index); +} +int rte_mempool_ops_dequeue_bulk_w(struct rte_mempool *mp, void **obj_table, + unsigned int n) { + return rte_mempool_ops_dequeue_bulk(mp, obj_table, n); +} +int rte_mempool_ops_dequeue_contig_blocks_w(struct rte_mempool *mp, + void **first_obj_table, + unsigned int n) { + return rte_mempool_ops_dequeue_contig_blocks(mp, first_obj_table, n); +} +int rte_mempool_ops_enqueue_bulk_w(struct rte_mempool *mp, + void *const *obj_table, unsigned int n) { + return rte_mempool_ops_enqueue_bulk(mp, obj_table, n); +} +struct rte_mempool_cache *rte_mempool_default_cache_w(struct rte_mempool *mp, + unsigned int lcore_id) { + return rte_mempool_default_cache(mp, lcore_id); +} +void rte_mempool_cache_flush_w(struct rte_mempool_cache *cache, + struct rte_mempool *mp) { + rte_mempool_cache_flush(cache, mp); +} +void rte_mempool_do_generic_put_w(struct rte_mempool *mp, + void *const *obj_table, unsigned int n, + struct rte_mempool_cache *cache) { + rte_mempool_do_generic_put(mp, obj_table, n, cache); +} +void rte_mempool_generic_put_w(struct rte_mempool *mp, void *const *obj_table, + unsigned int n, + struct rte_mempool_cache *cache) { + rte_mempool_generic_put(mp, obj_table, n, cache); +} +void rte_mempool_put_bulk_w(struct rte_mempool *mp, void *const *obj_table, + unsigned int n) { + rte_mempool_put_bulk(mp, obj_table, n); +} +void rte_mempool_put_w(struct rte_mempool *mp, void *obj) { + rte_mempool_put(mp, obj); +} +int rte_mempool_do_generic_get_w(struct rte_mempool *mp, void **obj_table, + unsigned int n, + struct rte_mempool_cache *cache) { + return rte_mempool_do_generic_get(mp, obj_table, n, cache); +} +int rte_mempool_generic_get_w(struct rte_mempool *mp, void **obj_table, + unsigned int n, struct rte_mempool_cache *cache) { + return rte_mempool_generic_get(mp, obj_table, n, cache); +} +int rte_mempool_get_bulk_w(struct rte_mempool *mp, void **obj_table, + unsigned int n) { + return rte_mempool_get_bulk(mp, obj_table, n); +} +int rte_mempool_get_w(struct rte_mempool *mp, void **obj_p) { + return rte_mempool_get(mp, obj_p); +} +int rte_mempool_get_contig_blocks_w(struct rte_mempool *mp, + void **first_obj_table, unsigned int n) { + return rte_mempool_get_contig_blocks(mp, first_obj_table, n); +} +int rte_mempool_full_w(const struct rte_mempool *mp) { + return rte_mempool_full(mp); +} +int rte_mempool_empty_w(const struct rte_mempool *mp) { + return rte_mempool_empty(mp); +} +rte_iova_t rte_mempool_virt2iova_w(const void *elt) { + return rte_mempool_virt2iova(elt); +} +void *rte_mempool_get_priv_w(struct rte_mempool *mp) { + return rte_mempool_get_priv(mp); +} +void rte_prefetch0_w(const void *p) { rte_prefetch0(p); } +void rte_prefetch1_w(const void *p) { rte_prefetch1(p); } +void rte_prefetch2_w(const void *p) { rte_prefetch2(p); } +void rte_prefetch_non_temporal_w(const void *p) { + rte_prefetch_non_temporal(p); +} +void rte_prefetch0_write_w(const void *p) { rte_prefetch0_write(p); } +void rte_prefetch1_write_w(const void *p) { rte_prefetch1_write(p); } +void rte_prefetch2_write_w(const void *p) { rte_prefetch2_write(p); } +void rte_cldemote_w(const void *p) { rte_cldemote(p); } +uint16_t rte_constant_bswap16_w(uint16_t x) { return rte_constant_bswap16(x); } +uint32_t rte_constant_bswap32_w(uint32_t x) { return rte_constant_bswap32(x); } +uint64_t rte_constant_bswap64_w(uint64_t x) { return rte_constant_bswap64(x); } +// uint16_t rte_arch_bswap16_w(uint16_t _x) { return rte_arch_bswap16(_x); } +// uint32_t rte_arch_bswap32_w(uint32_t _x) { return rte_arch_bswap32(_x); } +// uint64_t rte_arch_bswap64_w(uint64_t _x) { return rte_arch_bswap64(_x); } +void rte_mbuf_prefetch_part1_w(struct rte_mbuf *m) { + rte_mbuf_prefetch_part1(m); +} +void rte_mbuf_prefetch_part2_w(struct rte_mbuf *m) { + rte_mbuf_prefetch_part2(m); +} +uint16_t rte_pktmbuf_priv_size_w(struct rte_mempool *mp) { + return rte_pktmbuf_priv_size(mp); +} +rte_iova_t rte_mbuf_iova_get_w(const struct rte_mbuf *m) { + return rte_mbuf_iova_get(m); +} +void rte_mbuf_iova_set_w(struct rte_mbuf *m, rte_iova_t iova) { + rte_mbuf_iova_set(m, iova); +} +rte_iova_t rte_mbuf_data_iova_w(const struct rte_mbuf *mb) { + return rte_mbuf_data_iova(mb); +} +rte_iova_t rte_mbuf_data_iova_default_w(const struct rte_mbuf *mb) { + return rte_mbuf_data_iova_default(mb); +} +struct rte_mbuf *rte_mbuf_from_indirect_w(struct rte_mbuf *mi) { + return rte_mbuf_from_indirect(mi); +} +char *rte_mbuf_buf_addr_w(struct rte_mbuf *mb, struct rte_mempool *mp) { + return rte_mbuf_buf_addr(mb, mp); +} +char *rte_mbuf_data_addr_default_w(struct rte_mbuf *mb) { + return rte_mbuf_data_addr_default(mb); +} +char *rte_mbuf_to_baddr_w(struct rte_mbuf *md) { return rte_mbuf_to_baddr(md); } +void *rte_mbuf_to_priv_w(struct rte_mbuf *m) { return rte_mbuf_to_priv(m); } +uint32_t rte_pktmbuf_priv_flags_w(struct rte_mempool *mp) { + return rte_pktmbuf_priv_flags(mp); +} +uint16_t rte_mbuf_refcnt_read_w(const struct rte_mbuf *m) { + return rte_mbuf_refcnt_read(m); +} +void rte_mbuf_refcnt_set_w(struct rte_mbuf *m, uint16_t new_value) { + rte_mbuf_refcnt_set(m, new_value); +} +uint16_t rte_mbuf_refcnt_update_w(struct rte_mbuf *m, int16_t value) { + return rte_mbuf_refcnt_update(m, value); +} +uint16_t +rte_mbuf_ext_refcnt_read_w(const struct rte_mbuf_ext_shared_info *shinfo) { + return rte_mbuf_ext_refcnt_read(shinfo); +} +void rte_mbuf_ext_refcnt_set_w(struct rte_mbuf_ext_shared_info *shinfo, + uint16_t new_value) { + rte_mbuf_ext_refcnt_set(shinfo, new_value); +} +uint16_t rte_mbuf_ext_refcnt_update_w(struct rte_mbuf_ext_shared_info *shinfo, + int16_t value) { + return rte_mbuf_ext_refcnt_update(shinfo, value); +} +struct rte_mbuf *rte_mbuf_raw_alloc_w(struct rte_mempool *mp) { + return rte_mbuf_raw_alloc(mp); +} +void rte_mbuf_raw_free_w(struct rte_mbuf *m) { rte_mbuf_raw_free(m); } +uint16_t rte_pktmbuf_data_room_size_w(struct rte_mempool *mp) { + return rte_pktmbuf_data_room_size(mp); +} +void rte_pktmbuf_reset_headroom_w(struct rte_mbuf *m) { + rte_pktmbuf_reset_headroom(m); +} +void rte_pktmbuf_reset_w(struct rte_mbuf *m) { rte_pktmbuf_reset(m); } +struct rte_mbuf *rte_pktmbuf_alloc_w(struct rte_mempool *mp) { + return rte_pktmbuf_alloc(mp); +} +int rte_pktmbuf_alloc_bulk_w(struct rte_mempool *pool, struct rte_mbuf **mbufs, + unsigned int count) { + return rte_pktmbuf_alloc_bulk(pool, mbufs, count); +} +struct rte_mbuf_ext_shared_info * +rte_pktmbuf_ext_shinfo_init_helper_w(void *buf_addr, uint16_t *buf_len, + rte_mbuf_extbuf_free_callback_t free_cb, + void *fcb_opaque) { + return rte_pktmbuf_ext_shinfo_init_helper(buf_addr, buf_len, free_cb, + fcb_opaque); +} +void rte_pktmbuf_attach_extbuf_w(struct rte_mbuf *m, void *buf_addr, + rte_iova_t buf_iova, uint16_t buf_len, + struct rte_mbuf_ext_shared_info *shinfo) { + rte_pktmbuf_attach_extbuf(m, buf_addr, buf_iova, buf_len, shinfo); +} +void rte_mbuf_dynfield_copy_w(struct rte_mbuf *mdst, + const struct rte_mbuf *msrc) { + rte_mbuf_dynfield_copy(mdst, msrc); +} +void rte_pktmbuf_attach_w(struct rte_mbuf *mi, struct rte_mbuf *m) { + rte_pktmbuf_attach(mi, m); +} +void rte_pktmbuf_detach_w(struct rte_mbuf *m) { rte_pktmbuf_detach(m); } +struct rte_mbuf *rte_pktmbuf_prefree_seg_w(struct rte_mbuf *m) { + return rte_pktmbuf_prefree_seg(m); +} +void rte_pktmbuf_free_seg_w(struct rte_mbuf *m) { rte_pktmbuf_free_seg(m); } +void rte_pktmbuf_free_w(struct rte_mbuf *m) { rte_pktmbuf_free(m); } +void rte_pktmbuf_refcnt_update_w(struct rte_mbuf *m, int16_t v) { + rte_pktmbuf_refcnt_update(m, v); +} +uint16_t rte_pktmbuf_headroom_w(const struct rte_mbuf *m) { + return rte_pktmbuf_headroom(m); +} +uint16_t rte_pktmbuf_tailroom_w(const struct rte_mbuf *m) { + return rte_pktmbuf_tailroom(m); +} +struct rte_mbuf *rte_pktmbuf_lastseg_w(struct rte_mbuf *m) { + return rte_pktmbuf_lastseg(m); +} +char *rte_pktmbuf_prepend_w(struct rte_mbuf *m, uint16_t len) { + return rte_pktmbuf_prepend(m, len); +} +char *rte_pktmbuf_append_w(struct rte_mbuf *m, uint16_t len) { + return rte_pktmbuf_append(m, len); +} +char *rte_pktmbuf_adj_w(struct rte_mbuf *m, uint16_t len) { + return rte_pktmbuf_adj(m, len); +} +int rte_pktmbuf_trim_w(struct rte_mbuf *m, uint16_t len) { + return rte_pktmbuf_trim(m, len); +} +int rte_pktmbuf_is_contiguous_w(const struct rte_mbuf *m) { + return rte_pktmbuf_is_contiguous(m); +} +const void *rte_pktmbuf_read_w(const struct rte_mbuf *m, uint32_t off, + uint32_t len, void *buf) { + return rte_pktmbuf_read(m, off, len, buf); +} +int rte_pktmbuf_chain_w(struct rte_mbuf *head, struct rte_mbuf *tail) { + return rte_pktmbuf_chain(head, tail); +} +uint64_t rte_mbuf_tx_offload_w(uint64_t il2, uint64_t il3, uint64_t il4, + uint64_t tso, uint64_t ol3, uint64_t ol2, + uint64_t unused) { + return rte_mbuf_tx_offload(il2, il3, il4, tso, ol3, ol2, unused); +} +int rte_validate_tx_offload_w(const struct rte_mbuf *m) { + return rte_validate_tx_offload(m); +} +int rte_pktmbuf_linearize_w(struct rte_mbuf *mbuf) { + return rte_pktmbuf_linearize(mbuf); +} +uint32_t rte_mbuf_sched_queue_get_w(const struct rte_mbuf *m) { + return rte_mbuf_sched_queue_get(m); +} +uint8_t rte_mbuf_sched_traffic_class_get_w(const struct rte_mbuf *m) { + return rte_mbuf_sched_traffic_class_get(m); +} +uint8_t rte_mbuf_sched_color_get_w(const struct rte_mbuf *m) { + return rte_mbuf_sched_color_get(m); +} +void rte_mbuf_sched_get_w(const struct rte_mbuf *m, uint32_t *queue_id, + uint8_t *traffic_class, uint8_t *color) { + rte_mbuf_sched_get(m, queue_id, traffic_class, color); +} +void rte_mbuf_sched_queue_set_w(struct rte_mbuf *m, uint32_t queue_id) { + rte_mbuf_sched_queue_set(m, queue_id); +} +void rte_mbuf_sched_traffic_class_set_w(struct rte_mbuf *m, + uint8_t traffic_class) { + rte_mbuf_sched_traffic_class_set(m, traffic_class); +} +void rte_mbuf_sched_color_set_w(struct rte_mbuf *m, uint8_t color) { + rte_mbuf_sched_color_set(m, color); +} +void rte_mbuf_sched_set_w(struct rte_mbuf *m, uint32_t queue_id, + uint8_t traffic_class, uint8_t color) { + rte_mbuf_sched_set(m, queue_id, traffic_class, color); +} +int rte_is_same_ether_addr_w(const struct rte_ether_addr *ea1, + const struct rte_ether_addr *ea2) { + return rte_is_same_ether_addr(ea1, ea2); +} +int rte_is_zero_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_zero_ether_addr(ea); +} +int rte_is_unicast_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_unicast_ether_addr(ea); +} +int rte_is_multicast_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_multicast_ether_addr(ea); +} +int rte_is_broadcast_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_broadcast_ether_addr(ea); +} +int rte_is_universal_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_universal_ether_addr(ea); +} +int rte_is_local_admin_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_local_admin_ether_addr(ea); +} +int rte_is_valid_assigned_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_valid_assigned_ether_addr(ea); +} +void rte_ether_addr_copy_w(const struct rte_ether_addr *ea_from, + struct rte_ether_addr *ea_to) { + rte_ether_addr_copy(ea_from, ea_to); +} +int rte_vlan_strip_w(struct rte_mbuf *m) { return rte_vlan_strip(m); } +int rte_vlan_insert_w(struct rte_mbuf **m) { return rte_vlan_insert(m); } +uint32_t rte_bitmap_get_memory_footprint_w(uint32_t n_bits) { + return rte_bitmap_get_memory_footprint(n_bits); +} +struct rte_bitmap *rte_bitmap_init_w(uint32_t n_bits, uint8_t *mem, + uint32_t mem_size) { + return rte_bitmap_init(n_bits, mem, mem_size); +} +struct rte_bitmap *rte_bitmap_init_with_all_set_w(uint32_t n_bits, uint8_t *mem, + uint32_t mem_size) { + return rte_bitmap_init_with_all_set(n_bits, mem, mem_size); +} +void rte_bitmap_free_w(struct rte_bitmap *bmp) { return rte_bitmap_free(bmp); } +void rte_bitmap_reset_w(struct rte_bitmap *bmp) { rte_bitmap_reset(bmp); } +void rte_bitmap_prefetch0_w(struct rte_bitmap *bmp, uint32_t pos) { + rte_bitmap_prefetch0(bmp, pos); +} +uint64_t rte_bitmap_get_w(struct rte_bitmap *bmp, uint32_t pos) { + return rte_bitmap_get(bmp, pos); +} +void rte_bitmap_set_w(struct rte_bitmap *bmp, uint32_t pos) { + rte_bitmap_set(bmp, pos); +} +void rte_bitmap_set_slab_w(struct rte_bitmap *bmp, uint32_t pos, + uint64_t slab) { + rte_bitmap_set_slab(bmp, pos, slab); +} +void rte_bitmap_clear_w(struct rte_bitmap *bmp, uint32_t pos) { + rte_bitmap_clear(bmp, pos); +} +int rte_bitmap_scan_w(struct rte_bitmap *bmp, uint32_t *pos, uint64_t *slab) { + return rte_bitmap_scan(bmp, pos, slab); +} +uint16_t rte_raw_cksum_w(const void *buf, size_t len) { + return rte_raw_cksum(buf, len); +} +int rte_raw_cksum_mbuf_w(const struct rte_mbuf *m, uint32_t off, uint32_t len, + uint16_t *cksum) { + return rte_raw_cksum_mbuf(m, off, len, cksum); +} +uint8_t rte_ipv4_hdr_len_w(const struct rte_ipv4_hdr *ipv4_hdr) { + return rte_ipv4_hdr_len(ipv4_hdr); +} +uint16_t rte_ipv4_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr) { + return rte_ipv4_cksum(ipv4_hdr); +} +uint16_t rte_ipv4_cksum_simple_w(const struct rte_ipv4_hdr *ipv4_hdr) { + return rte_ipv4_cksum_simple(ipv4_hdr); +} +uint16_t rte_ipv4_phdr_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr, + uint64_t ol_flags) { + return rte_ipv4_phdr_cksum(ipv4_hdr, ol_flags); +} +uint16_t rte_ipv4_udptcp_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr, + const void *l4_hdr) { + return rte_ipv4_udptcp_cksum(ipv4_hdr, l4_hdr); +} +uint16_t rte_ipv4_udptcp_cksum_mbuf_w(const struct rte_mbuf *m, + const struct rte_ipv4_hdr *ipv4_hdr, + uint16_t l4_off) { + return rte_ipv4_udptcp_cksum_mbuf(m, ipv4_hdr, l4_off); +} +int rte_ipv4_udptcp_cksum_verify_w(const struct rte_ipv4_hdr *ipv4_hdr, + const void *l4_hdr) { + return rte_ipv4_udptcp_cksum_verify(ipv4_hdr, l4_hdr); +} +int rte_ipv4_udptcp_cksum_mbuf_verify_w(const struct rte_mbuf *m, + const struct rte_ipv4_hdr *ipv4_hdr, + uint16_t l4_off) { + return rte_ipv4_udptcp_cksum_mbuf_verify(m, ipv4_hdr, l4_off); +} +bool rte_ipv6_addr_eq_w(const struct rte_ipv6_addr *a, + const struct rte_ipv6_addr *b) { + return rte_ipv6_addr_eq(a, b); +} +void rte_ipv6_addr_mask_w(struct rte_ipv6_addr *ip, uint8_t depth) { + rte_ipv6_addr_mask(ip, depth); +} +bool rte_ipv6_addr_eq_prefix_w(const struct rte_ipv6_addr *a, + const struct rte_ipv6_addr *b, uint8_t depth) { + return rte_ipv6_addr_eq_prefix(a, b, depth); +} +uint8_t rte_ipv6_mask_depth_w(const struct rte_ipv6_addr *mask) { + return rte_ipv6_mask_depth(mask); +} +bool rte_ipv6_addr_is_unspec_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_unspec(ip); +} +bool rte_ipv6_addr_is_loopback_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_loopback(ip); +} +bool rte_ipv6_addr_is_linklocal_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_linklocal(ip); +} +bool rte_ipv6_addr_is_sitelocal_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_sitelocal(ip); +} +bool rte_ipv6_addr_is_v4compat_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_v4compat(ip); +} +bool rte_ipv6_addr_is_v4mapped_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_v4mapped(ip); +} +bool rte_ipv6_addr_is_mcast_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_mcast(ip); +} +enum rte_ipv6_mc_scope rte_ipv6_mc_scope_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_mc_scope(ip); +} +void rte_ipv6_llocal_from_ethernet_w(struct rte_ipv6_addr *ip, + const struct rte_ether_addr *mac) { + rte_ipv6_llocal_from_ethernet(ip, mac); +} +void rte_ipv6_solnode_from_addr_w(struct rte_ipv6_addr *sol, + const struct rte_ipv6_addr *ip) { + rte_ipv6_solnode_from_addr(sol, ip); +} +void rte_ether_mcast_from_ipv6_w(struct rte_ether_addr *mac, + const struct rte_ipv6_addr *ip) { + rte_ether_mcast_from_ipv6(mac, ip); +} +int rte_ipv6_check_version_w(const struct rte_ipv6_hdr *ip) { + return rte_ipv6_check_version(ip); +} +uint16_t rte_ipv6_phdr_cksum_w(const struct rte_ipv6_hdr *ipv6_hdr, + uint64_t ol_flags) { + return rte_ipv6_phdr_cksum(ipv6_hdr, ol_flags); +} +uint16_t rte_ipv6_udptcp_cksum_w(const struct rte_ipv6_hdr *ipv6_hdr, + const void *l4_hdr) { + return rte_ipv6_udptcp_cksum(ipv6_hdr, l4_hdr); +} +uint16_t rte_ipv6_udptcp_cksum_mbuf_w(const struct rte_mbuf *m, + const struct rte_ipv6_hdr *ipv6_hdr, + uint16_t l4_off) { + return rte_ipv6_udptcp_cksum_mbuf(m, ipv6_hdr, l4_off); +} +int rte_ipv6_udptcp_cksum_verify_w(const struct rte_ipv6_hdr *ipv6_hdr, + const void *l4_hdr) { + return rte_ipv6_udptcp_cksum_verify(ipv6_hdr, l4_hdr); +} +int rte_ipv6_udptcp_cksum_mbuf_verify_w(const struct rte_mbuf *m, + const struct rte_ipv6_hdr *ipv6_hdr, + uint16_t l4_off) { + return rte_ipv6_udptcp_cksum_mbuf_verify(m, ipv6_hdr, l4_off); +} +int rte_ipv6_get_next_ext_w(const uint8_t *p, int proto, size_t *ext_len) { + return rte_ipv6_get_next_ext(p, proto, ext_len); +} +enum rte_color +rte_meter_srtcm_color_blind_check_w(struct rte_meter_srtcm *m, + struct rte_meter_srtcm_profile *p, + uint64_t time, uint32_t pkt_len) { + return rte_meter_srtcm_color_blind_check(m, p, time, pkt_len); +} +enum rte_color rte_meter_srtcm_color_aware_check_w( + struct rte_meter_srtcm *m, struct rte_meter_srtcm_profile *p, uint64_t time, + uint32_t pkt_len, enum rte_color pkt_color) { + return rte_meter_srtcm_color_aware_check(m, p, time, pkt_len, pkt_color); +} +enum rte_color +rte_meter_trtcm_color_blind_check_w(struct rte_meter_trtcm *m, + struct rte_meter_trtcm_profile *p, + uint64_t time, uint32_t pkt_len) { + return rte_meter_trtcm_color_blind_check(m, p, time, pkt_len); +} +enum rte_color rte_meter_trtcm_color_aware_check_w( + struct rte_meter_trtcm *m, struct rte_meter_trtcm_profile *p, uint64_t time, + uint32_t pkt_len, enum rte_color pkt_color) { + return rte_meter_trtcm_color_aware_check(m, p, time, pkt_len, pkt_color); +} +enum rte_color rte_meter_trtcm_rfc4115_color_blind_check_w( + struct rte_meter_trtcm_rfc4115 *m, + struct rte_meter_trtcm_rfc4115_profile *p, uint64_t time, + uint32_t pkt_len) { + return rte_meter_trtcm_rfc4115_color_blind_check(m, p, time, pkt_len); +} +enum rte_color rte_meter_trtcm_rfc4115_color_aware_check_w( + struct rte_meter_trtcm_rfc4115 *m, + struct rte_meter_trtcm_rfc4115_profile *p, uint64_t time, uint32_t pkt_len, + enum rte_color pkt_color) { + return rte_meter_trtcm_rfc4115_color_aware_check(m, p, time, pkt_len, + pkt_color); +} +uint64_t rte_eth_rss_hf_refine_w(uint64_t rss_hf) { + return rte_eth_rss_hf_refine(rss_hf); } -uint16_t wrte_eth_tx_burst(uint16_t const port_id, uint16_t const queue_id, struct rte_mbuf **tx_pkts, uint16_t const nb_pkts) { - return rte_eth_tx_burst(port_id, queue_id, tx_pkts, nb_pkts); +uint16_t rte_eth_rx_burst_w(uint16_t port_id, uint16_t queue_id, + struct rte_mbuf **rx_pkts, const uint16_t nb_pkts) { + return rte_eth_rx_burst(port_id, queue_id, rx_pkts, nb_pkts); +} +int rte_eth_rx_queue_count_w(uint16_t port_id, uint16_t queue_id) { + return rte_eth_rx_queue_count(port_id, queue_id); +} +int rte_eth_rx_descriptor_status_w(uint16_t port_id, uint16_t queue_id, + uint16_t offset) { + return rte_eth_rx_descriptor_status(port_id, queue_id, offset); +} +int rte_eth_tx_descriptor_status_w(uint16_t port_id, uint16_t queue_id, + uint16_t offset) { + return rte_eth_tx_descriptor_status(port_id, queue_id, offset); +} +uint16_t rte_eth_tx_burst_w(uint16_t port_id, uint16_t queue_id, + struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { + return rte_eth_tx_burst(port_id, queue_id, tx_pkts, nb_pkts); +} +uint16_t rte_eth_tx_prepare_w(uint16_t port_id, uint16_t queue_id, + struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { + return rte_eth_tx_prepare(port_id, queue_id, tx_pkts, nb_pkts); +} +uint16_t rte_eth_tx_buffer_flush_w(uint16_t port_id, uint16_t queue_id, + struct rte_eth_dev_tx_buffer *buffer) { + return rte_eth_tx_buffer_flush(port_id, queue_id, buffer); +} +uint16_t rte_eth_tx_buffer_w(uint16_t port_id, uint16_t queue_id, + struct rte_eth_dev_tx_buffer *buffer, + struct rte_mbuf *tx_pkt) { + return rte_eth_tx_buffer(port_id, queue_id, buffer, tx_pkt); +} +uint16_t +rte_eth_recycle_mbufs_w(uint16_t rx_port_id, uint16_t rx_queue_id, + uint16_t tx_port_id, uint16_t tx_queue_id, + struct rte_eth_recycle_rxq_info *recycle_rxq_info) { + return rte_eth_recycle_mbufs(rx_port_id, rx_queue_id, tx_port_id, tx_queue_id, + recycle_rxq_info); +} +int rte_eth_tx_queue_count_w(uint16_t port_id, uint16_t queue_id) { + return rte_eth_tx_queue_count(port_id, queue_id); +} +uint32_t rte_flow_dynf_metadata_get_w(struct rte_mbuf *m) { + return rte_flow_dynf_metadata_get(m); +} +void rte_flow_dynf_metadata_set_w(struct rte_mbuf *m, uint32_t v) { + rte_flow_dynf_metadata_set(m, v); +} +int rte_flow_dynf_metadata_avail_w(void) { + return rte_flow_dynf_metadata_avail(); +} +uint32_t rte_hash_crc_1byte_w(uint8_t data, uint32_t init_val) { + return rte_hash_crc_1byte(data, init_val); +} +uint32_t rte_hash_crc_2byte_w(uint16_t data, uint32_t init_val) { + return rte_hash_crc_2byte(data, init_val); +} +uint32_t rte_hash_crc_4byte_w(uint32_t data, uint32_t init_val) { + return rte_hash_crc_4byte(data, init_val); +} +uint32_t rte_hash_crc_8byte_w(uint64_t data, uint32_t init_val) { + return rte_hash_crc_8byte(data, init_val); +} +uint32_t rte_hash_crc_w(const void *data, uint32_t data_len, + uint32_t init_val) { + return rte_hash_crc(data, data_len, init_val); +} +void rte_jhash_2hashes_w(const void *key, uint32_t length, uint32_t *pc, + uint32_t *pb) { + rte_jhash_2hashes(key, length, pc, pb); +} +void rte_jhash_32b_2hashes_w(const uint32_t *k, uint32_t length, uint32_t *pc, + uint32_t *pb) { + rte_jhash_32b_2hashes(k, length, pc, pb); +} +uint32_t rte_jhash_w(const void *key, uint32_t length, uint32_t initval) { + return rte_jhash(key, length, initval); +} +uint32_t rte_jhash_32b_w(const uint32_t *k, uint32_t length, uint32_t initval) { + return rte_jhash_32b(k, length, initval); +} +uint32_t rte_jhash_3words_w(uint32_t a, uint32_t b, uint32_t c, + uint32_t initval) { + return rte_jhash_3words(a, b, c, initval); +} +uint32_t rte_jhash_2words_w(uint32_t a, uint32_t b, uint32_t initval) { + return rte_jhash_2words(a, b, initval); +} +uint32_t rte_jhash_1word_w(uint32_t a, uint32_t initval) { + return rte_jhash_1word(a, initval); +} +uint32_t rte_fbk_hash_get_bucket_w(const struct rte_fbk_hash_table *ht, + uint32_t key) { + return rte_fbk_hash_get_bucket(ht, key); +} +int rte_fbk_hash_add_key_with_bucket_w(struct rte_fbk_hash_table *ht, + uint32_t key, uint16_t value, + uint32_t bucket) { + return rte_fbk_hash_add_key_with_bucket(ht, key, value, bucket); +} +int rte_fbk_hash_add_key_w(struct rte_fbk_hash_table *ht, uint32_t key, + uint16_t value) { + return rte_fbk_hash_add_key(ht, key, value); +} +int rte_fbk_hash_delete_key_with_bucket_w(struct rte_fbk_hash_table *ht, + uint32_t key, uint32_t bucket) { + return rte_fbk_hash_delete_key_with_bucket(ht, key, bucket); +} +int rte_fbk_hash_delete_key_w(struct rte_fbk_hash_table *ht, uint32_t key) { + return rte_fbk_hash_delete_key(ht, key); +} +int rte_fbk_hash_lookup_with_bucket_w(const struct rte_fbk_hash_table *ht, + uint32_t key, uint32_t bucket) { + return rte_fbk_hash_lookup_with_bucket(ht, key, bucket); +} +int rte_fbk_hash_lookup_w(const struct rte_fbk_hash_table *ht, uint32_t key) { + return rte_fbk_hash_lookup(ht, key); +} +void rte_fbk_hash_clear_all_w(struct rte_fbk_hash_table *ht) { + rte_fbk_hash_clear_all(ht); +} +double rte_fbk_hash_get_load_factor_w(struct rte_fbk_hash_table *ht) { + return rte_fbk_hash_get_load_factor(ht); +} +void rte_rcu_qsbr_thread_online_w(struct rte_rcu_qsbr *v, + unsigned int thread_id) { + rte_rcu_qsbr_thread_online(v, thread_id); +} +void rte_rcu_qsbr_thread_offline_w(struct rte_rcu_qsbr *v, + unsigned int thread_id) { + rte_rcu_qsbr_thread_offline(v, thread_id); +} +void rte_rcu_qsbr_lock_w(struct rte_rcu_qsbr *v, unsigned int thread_id) { + rte_rcu_qsbr_lock(v, thread_id); +} +void rte_rcu_qsbr_unlock_w(struct rte_rcu_qsbr *v, unsigned int thread_id) { + rte_rcu_qsbr_unlock(v, thread_id); +} +uint64_t rte_rcu_qsbr_start_w(struct rte_rcu_qsbr *v) { + return rte_rcu_qsbr_start(v); +} +void rte_rcu_qsbr_quiescent_w(struct rte_rcu_qsbr *v, unsigned int thread_id) { + rte_rcu_qsbr_quiescent(v, thread_id); +} +int rte_rcu_qsbr_check_w(struct rte_rcu_qsbr *v, uint64_t t, bool wait) { + return rte_rcu_qsbr_check(v, t, wait); +} +uint8_t rte_read8_relaxed_w(const void *addr) { + return rte_read8_relaxed(addr); +} +uint16_t rte_read16_relaxed_w(const void *addr) { + return rte_read16_relaxed(addr); +} +uint32_t rte_read32_relaxed_w(const void *addr) { + return rte_read32_relaxed(addr); +} +uint64_t rte_read64_relaxed_w(const void *addr) { + return rte_read64_relaxed(addr); +} +void rte_write8_relaxed_w(uint8_t value, void *addr) { + rte_write8_relaxed(value, addr); +} +void rte_write16_relaxed_w(uint16_t value, void *addr) { + rte_write16_relaxed(value, addr); +} +void rte_write32_relaxed_w(uint32_t value, void *addr) { + rte_write32_relaxed(value, addr); +} +void rte_write64_relaxed_w(uint64_t value, void *addr) { + rte_write64_relaxed(value, addr); +} +uint8_t rte_read8_w(const void *addr) { return rte_read8(addr); } +uint16_t rte_read16_w(const void *addr) { return rte_read16(addr); } +uint32_t rte_read32_w(const void *addr) { return rte_read32(addr); } +uint64_t rte_read64_w(const void *addr) { return rte_read64(addr); } +void rte_write8_w(uint8_t value, void *addr) { rte_write8(value, addr); } +void rte_write16_w(uint16_t value, void *addr) { rte_write16(value, addr); } +void rte_write32_w(uint32_t value, void *addr) { rte_write32(value, addr); } +void rte_write64_w(uint64_t value, void *addr) { rte_write64(value, addr); } +void rte_write32_wc_relaxed_w(uint32_t value, void *addr) { + rte_write32_wc_relaxed(value, addr); +} +void rte_write32_wc_w(uint32_t value, void *addr) { + rte_write32_wc(value, addr); +} +void rte_mcslock_lock_w(rte_mcslock_t **msl, rte_mcslock_t *me) { + rte_mcslock_lock(msl, me); +} +void rte_mcslock_unlock_w(rte_mcslock_t **msl, rte_mcslock_t *me) { + rte_mcslock_unlock(msl, me); +} +int rte_mcslock_trylock_w(rte_mcslock_t **msl, rte_mcslock_t *me) { + return rte_mcslock_trylock(msl, me); +} +int rte_mcslock_is_locked_w(rte_mcslock_t *msl) { + return rte_mcslock_is_locked(msl); +} +void rte_pflock_init_w(struct rte_pflock *pf) { rte_pflock_init(pf); } +void rte_pflock_read_lock_w(rte_pflock_t *pf) { rte_pflock_read_lock(pf); } +void rte_pflock_read_unlock_w(rte_pflock_t *pf) { rte_pflock_read_unlock(pf); } +void rte_pflock_write_lock_w(rte_pflock_t *pf) { rte_pflock_write_lock(pf); } +void rte_pflock_write_unlock_w(rte_pflock_t *pf) { + rte_pflock_write_unlock(pf); +} +uint32_t rte_reciprocal_divide_w(uint32_t a, struct rte_reciprocal R) { + return rte_reciprocal_divide(a, R); +} +uint64_t rte_reciprocal_divide_u64_w(uint64_t a, + const struct rte_reciprocal_u64 *R) { + return rte_reciprocal_divide_u64(a, R); +} +void rte_seqcount_init_w(rte_seqcount_t *seqcount) { + rte_seqcount_init(seqcount); +} +uint32_t rte_seqcount_read_begin_w(const rte_seqcount_t *seqcount) { + return rte_seqcount_read_begin(seqcount); +} +bool rte_seqcount_read_retry_w(const rte_seqcount_t *seqcount, + uint32_t begin_sn) { + return rte_seqcount_read_retry(seqcount, begin_sn); +} +void rte_seqcount_write_begin_w(rte_seqcount_t *seqcount) { + rte_seqcount_write_begin(seqcount); +} +void rte_seqcount_write_end_w(rte_seqcount_t *seqcount) { + rte_seqcount_write_end(seqcount); +} +void rte_seqlock_init_w(rte_seqlock_t *seqlock) { rte_seqlock_init(seqlock); } +uint32_t rte_seqlock_read_begin_w(const rte_seqlock_t *seqlock) { + return rte_seqlock_read_begin(seqlock); +} +bool rte_seqlock_read_retry_w(const rte_seqlock_t *seqlock, uint32_t begin_sn) { + return rte_seqlock_read_retry(seqlock, begin_sn); +} +void rte_seqlock_write_lock_w(rte_seqlock_t *seqlock) { + rte_seqlock_write_lock(seqlock); +} +void rte_seqlock_write_unlock_w(rte_seqlock_t *seqlock) { + rte_seqlock_write_unlock(seqlock); +} +unsigned int rte_stack_push_w(struct rte_stack *s, void *const *obj_table, + unsigned int n) { + return rte_stack_push(s, obj_table, n); +} +unsigned int rte_stack_pop_w(struct rte_stack *s, void **obj_table, + unsigned int n) { + return rte_stack_pop(s, obj_table, n); +} +unsigned int rte_stack_count_w(struct rte_stack *s) { + return rte_stack_count(s); +} +unsigned int rte_stack_free_count_w(struct rte_stack *s) { + return rte_stack_free_count(s); +} +uint32_t rte_softrss_w(uint32_t *input_tuple, uint32_t input_len, + const uint8_t *rss_key) { + return rte_softrss(input_tuple, input_len, rss_key); +} +uint32_t rte_softrss_be_w(uint32_t *input_tuple, uint32_t input_len, + const uint8_t *rss_key) { + return rte_softrss_be(input_tuple, input_len, rss_key); +} +void rte_ticketlock_init_w(rte_ticketlock_t *tl) { rte_ticketlock_init(tl); } +void rte_ticketlock_lock_w(rte_ticketlock_t *tl) { rte_ticketlock_lock(tl); } +void rte_ticketlock_unlock_w(rte_ticketlock_t *tl) { + rte_ticketlock_unlock(tl); +} +int rte_ticketlock_trylock_w(rte_ticketlock_t *tl) { + return rte_ticketlock_trylock(tl); +} +int rte_ticketlock_is_locked_w(rte_ticketlock_t *tl) { + return rte_ticketlock_is_locked(tl); +} +void rte_ticketlock_recursive_init_w(rte_ticketlock_recursive_t *tlr) { + rte_ticketlock_recursive_init(tlr); +} +void rte_ticketlock_recursive_lock_w(rte_ticketlock_recursive_t *tlr) { + rte_ticketlock_recursive_lock(tlr); +} +void rte_ticketlock_recursive_unlock_w(rte_ticketlock_recursive_t *tlr) { + rte_ticketlock_recursive_unlock(tlr); +} +int rte_ticketlock_recursive_trylock_w(rte_ticketlock_recursive_t *tlr) { + return rte_ticketlock_recursive_trylock(tlr); +} +uint64_t rte_cyclecounter_cycles_to_ns_w(struct rte_timecounter *tc, + uint64_t cycles) { + return rte_cyclecounter_cycles_to_ns(tc, cycles); +} +uint64_t rte_timecounter_update_w(struct rte_timecounter *tc, + uint64_t cycle_now) { + return rte_timecounter_update(tc, cycle_now); +} +uint64_t rte_timespec_to_ns_w(const struct timespec *ts) { + return rte_timespec_to_ns(ts); +} +struct timespec rte_ns_to_timespec_w(uint64_t nsec) { + return rte_ns_to_timespec(nsec); +} +bool rte_trace_feature_is_enabled_w(void) { + return rte_trace_feature_is_enabled(); } diff --git a/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.h b/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.h index 2d4e77c47..53b05b961 100644 --- a/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.h +++ b/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.h @@ -116,7 +116,7 @@ #include #include #include -#include +// #include #include #include #include @@ -232,7 +232,7 @@ * @return * The last rte_errno value (thread local value). */ -int rte_errno_get() { return rte_errno; } +int rte_errno_get(); /** * TX offloads to be set in [`rte_eth_tx_mode.offloads`]. @@ -297,1515 +297,3 @@ enum wrte_eth_rx_offload : uint64_t { RX_OFFLOAD_RSS_HASH = RTE_ETH_RX_OFFLOAD_RSS_HASH, RX_OFFLOAD_BUFFER_SPLIT = RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT, }; - -// Static wrappers - -int rte_is_aligned_w(const const void *const ptr, const unsigned int align) { - return rte_is_aligned(ptr, align); -} -void rte_atomic_thread_fence_w(rte_memory_order memorder) { - rte_atomic_thread_fence(memorder); -} -int rte_atomic16_cmpset_w(uint16_t *dst, uint16_t exp, uint16_t src) { - return rte_atomic16_cmpset(dst, exp, src); -} -uint16_t rte_atomic16_exchange_w(uint16_t *dst, uint16_t val) { - return rte_atomic16_exchange(dst, val); -} -void rte_atomic16_init_w(rte_atomic16_t *v) { rte_atomic16_init(v); } -int16_t rte_atomic16_read_w(const rte_atomic16_t *v) { - return rte_atomic16_read(v); -} -void rte_atomic16_set_w(rte_atomic16_t *v, int16_t new_value) { - rte_atomic16_set(v, new_value); -} -void rte_atomic16_add_w(rte_atomic16_t *v, int16_t inc) { - rte_atomic16_add(v, inc); -} -void rte_atomic16_sub_w(rte_atomic16_t *v, int16_t dec) { - rte_atomic16_sub(v, dec); -} -void rte_atomic16_inc_w(rte_atomic16_t *v) { rte_atomic16_inc(v); } -void rte_atomic16_dec_w(rte_atomic16_t *v) { rte_atomic16_dec(v); } -int16_t rte_atomic16_add_return_w(rte_atomic16_t *v, int16_t inc) { - return rte_atomic16_add_return(v, inc); -} -int16_t rte_atomic16_sub_return_w(rte_atomic16_t *v, int16_t dec) { - return rte_atomic16_sub_return(v, dec); -} -int rte_atomic16_inc_and_test_w(rte_atomic16_t *v) { - return rte_atomic16_inc_and_test(v); -} -int rte_atomic16_dec_and_test_w(rte_atomic16_t *v) { - return rte_atomic16_dec_and_test(v); -} -int rte_atomic16_test_and_set_w(rte_atomic16_t *v) { - return rte_atomic16_test_and_set(v); -} -void rte_atomic16_clear_w(rte_atomic16_t *v) { rte_atomic16_clear(v); } -int rte_atomic32_cmpset_w(uint32_t *dst, uint32_t exp, uint32_t src) { - return rte_atomic32_cmpset(dst, exp, src); -} -uint32_t rte_atomic32_exchange_w(uint32_t *dst, uint32_t val) { - return rte_atomic32_exchange(dst, val); -} -void rte_atomic32_init_w(rte_atomic32_t *v) { rte_atomic32_init(v); } -int32_t rte_atomic32_read_w(const rte_atomic32_t *v) { - return rte_atomic32_read(v); -} -void rte_atomic32_set_w(rte_atomic32_t *v, int32_t new_value) { - rte_atomic32_set(v, new_value); -} -void rte_atomic32_add_w(rte_atomic32_t *v, int32_t inc) { - rte_atomic32_add(v, inc); -} -void rte_atomic32_sub_w(rte_atomic32_t *v, int32_t dec) { - rte_atomic32_sub(v, dec); -} -void rte_atomic32_inc_w(rte_atomic32_t *v) { rte_atomic32_inc(v); } -void rte_atomic32_dec_w(rte_atomic32_t *v) { rte_atomic32_dec(v); } -int32_t rte_atomic32_add_return_w(rte_atomic32_t *v, int32_t inc) { - return rte_atomic32_add_return(v, inc); -} -int32_t rte_atomic32_sub_return_w(rte_atomic32_t *v, int32_t dec) { - return rte_atomic32_sub_return(v, dec); -} -int rte_atomic32_inc_and_test_w(rte_atomic32_t *v) { - return rte_atomic32_inc_and_test(v); -} -int rte_atomic32_dec_and_test_w(rte_atomic32_t *v) { - return rte_atomic32_dec_and_test(v); -} -int rte_atomic32_test_and_set_w(rte_atomic32_t *v) { - return rte_atomic32_test_and_set(v); -} -void rte_atomic32_clear_w(rte_atomic32_t *v) { rte_atomic32_clear(v); } -int rte_atomic64_cmpset_w(uint64_t *dst, uint64_t exp, uint64_t src) { - return rte_atomic64_cmpset(dst, exp, src); -} -uint64_t rte_atomic64_exchange_w(uint64_t *dst, uint64_t val) { - return rte_atomic64_exchange(dst, val); -} -void rte_atomic64_init_w(rte_atomic64_t *v) { rte_atomic64_init(v); } -int64_t rte_atomic64_read_w(rte_atomic64_t *v) { return rte_atomic64_read(v); } -void rte_atomic64_set_w(rte_atomic64_t *v, int64_t new_value) { - rte_atomic64_set(v, new_value); -} -void rte_atomic64_add_w(rte_atomic64_t *v, int64_t inc) { - rte_atomic64_add(v, inc); -} -void rte_atomic64_sub_w(rte_atomic64_t *v, int64_t dec) { - rte_atomic64_sub(v, dec); -} -void rte_atomic64_inc_w(rte_atomic64_t *v) { rte_atomic64_inc(v); } -void rte_atomic64_dec_w(rte_atomic64_t *v) { rte_atomic64_dec(v); } -int64_t rte_atomic64_add_return_w(rte_atomic64_t *v, int64_t inc) { - return rte_atomic64_add_return(v, inc); -} -int64_t rte_atomic64_sub_return_w(rte_atomic64_t *v, int64_t dec) { - return rte_atomic64_sub_return(v, dec); -} -int rte_atomic64_inc_and_test_w(rte_atomic64_t *v) { - return rte_atomic64_inc_and_test(v); -} -int rte_atomic64_dec_and_test_w(rte_atomic64_t *v) { - return rte_atomic64_dec_and_test(v); -} -int rte_atomic64_test_and_set_w(rte_atomic64_t *v) { - return rte_atomic64_test_and_set(v); -} -void rte_atomic64_clear_w(rte_atomic64_t *v) { rte_atomic64_clear(v); } -void rte_smp_mb_w(void) { rte_smp_mb(); } -uint64_t rte_get_tsc_cycles_w(void) { return rte_get_tsc_cycles(); } -uint64_t rte_get_timer_cycles_w(void) { return rte_get_timer_cycles(); } -uint64_t rte_get_timer_hz_w(void) { return rte_get_timer_hz(); } -void rte_delay_ms_w(unsigned int ms) { rte_delay_ms(ms); } -uint64_t rte_rdtsc_w(void) { return rte_rdtsc(); } -uint64_t rte_rdtsc_precise_w(void) { return rte_rdtsc_precise(); } -size_t rte_strlcpy_w(char *dst, const char *src, size_t size) { - return rte_strlcpy(dst, src, size); -} -size_t rte_strlcat_w(char *dst, const char *src, size_t size) { - return rte_strlcat(dst, src, size); -} -const char *rte_str_skip_leading_spaces_w(const char *src) { - return rte_str_skip_leading_spaces(src); -} -void rte_uuid_copy_w(rte_uuid_t dst, const rte_uuid_t src) { - rte_uuid_copy(dst, src); -} -int rte_gettid_w(void) { return rte_gettid(); } -unsigned int rte_lcore_id_w(void) { return rte_lcore_id(); } -void rte_pause_w(void) { rte_pause(); } -void rte_wait_until_equal_16_w(uint16_t *addr, uint16_t expected, - rte_memory_order memorder) { - rte_wait_until_equal_16(addr, expected, memorder); -} -void rte_wait_until_equal_32_w(uint32_t *addr, uint32_t expected, - rte_memory_order memorder) { - rte_wait_until_equal_32(addr, expected, memorder); -} -void rte_wait_until_equal_64_w(uint64_t *addr, uint64_t expected, - rte_memory_order memorder) { - rte_wait_until_equal_64(addr, expected, memorder); -} -void rte_spinlock_init_w(rte_spinlock_t *sl) { rte_spinlock_init(sl); } -void rte_spinlock_lock_w(rte_spinlock_t *sl) { rte_spinlock_lock(sl); } -void rte_spinlock_unlock_w(rte_spinlock_t *sl) { rte_spinlock_unlock(sl); } -int rte_spinlock_trylock_w(rte_spinlock_t *sl) { - return rte_spinlock_trylock(sl); -} -int rte_spinlock_is_locked_w(rte_spinlock_t *sl) { - return rte_spinlock_is_locked(sl); -} -int rte_tm_supported_w(void) { return rte_tm_supported(); } -void rte_spinlock_lock_tm_w(rte_spinlock_t *sl) { rte_spinlock_lock_tm(sl); } -void rte_spinlock_unlock_tm_w(rte_spinlock_t *sl) { - rte_spinlock_unlock_tm(sl); -} -int rte_spinlock_trylock_tm_w(rte_spinlock_t *sl) { - return rte_spinlock_trylock_tm(sl); -} -void rte_spinlock_recursive_init_w(rte_spinlock_recursive_t *slr) { - rte_spinlock_recursive_init(slr); -} -void rte_spinlock_recursive_lock_w(rte_spinlock_recursive_t *slr) { - rte_spinlock_recursive_lock(slr); -} -void rte_spinlock_recursive_unlock_w(rte_spinlock_recursive_t *slr) { - rte_spinlock_recursive_unlock(slr); -} -int rte_spinlock_recursive_trylock_w(rte_spinlock_recursive_t *slr) { - return rte_spinlock_recursive_trylock(slr); -} -void rte_spinlock_recursive_lock_tm_w(rte_spinlock_recursive_t *slr) { - rte_spinlock_recursive_lock_tm(slr); -} -void rte_spinlock_recursive_unlock_tm_w(rte_spinlock_recursive_t *slr) { - rte_spinlock_recursive_unlock_tm(slr); -} -int rte_spinlock_recursive_trylock_tm_w(rte_spinlock_recursive_t *slr) { - return rte_spinlock_recursive_trylock_tm(slr); -} -unsigned int rte_xbegin_w(void) { return rte_xbegin(); } -void rte_xend_w(void) { rte_xend(); } -int rte_xtest_w(void) { return rte_xtest(); } -int rte_try_tm_w(int *lock) { return rte_try_tm(lock); } -uint32_t rte_bit_relaxed_get32_w(unsigned int nr, uint32_t *addr) { - return rte_bit_relaxed_get32(nr, addr); -} -void rte_bit_relaxed_set32_w(unsigned int nr, uint32_t *addr) { - rte_bit_relaxed_set32(nr, addr); -} -void rte_bit_relaxed_clear32_w(unsigned int nr, uint32_t *addr) { - rte_bit_relaxed_clear32(nr, addr); -} -uint32_t rte_bit_relaxed_test_and_set32_w(unsigned int nr, uint32_t *addr) { - return rte_bit_relaxed_test_and_set32(nr, addr); -} -uint32_t rte_bit_relaxed_test_and_clear32_w(unsigned int nr, uint32_t *addr) { - return rte_bit_relaxed_test_and_clear32(nr, addr); -} -uint64_t rte_bit_relaxed_get64_w(unsigned int nr, uint64_t *addr) { - return rte_bit_relaxed_get64(nr, addr); -} -void rte_bit_relaxed_set64_w(unsigned int nr, uint64_t *addr) { - rte_bit_relaxed_set64(nr, addr); -} -void rte_bit_relaxed_clear64_w(unsigned int nr, uint64_t *addr) { - rte_bit_relaxed_clear64(nr, addr); -} -uint64_t rte_bit_relaxed_test_and_set64_w(unsigned int nr, uint64_t *addr) { - return rte_bit_relaxed_test_and_set64(nr, addr); -} -uint64_t rte_bit_relaxed_test_and_clear64_w(unsigned int nr, uint64_t *addr) { - return rte_bit_relaxed_test_and_clear64(nr, addr); -} -unsigned int rte_clz32_w(uint32_t v) { return rte_clz32(v); } -unsigned int rte_clz64_w(uint64_t v) { return rte_clz64(v); } -unsigned int rte_ctz32_w(uint32_t v) { return rte_ctz32(v); } -unsigned int rte_ctz64_w(uint64_t v) { return rte_ctz64(v); } -unsigned int rte_popcount32_w(uint32_t v) { return rte_popcount32(v); } -unsigned int rte_popcount64_w(uint64_t v) { return rte_popcount64(v); } -uint32_t rte_combine32ms1b_w(uint32_t x) { return rte_combine32ms1b(x); } -uint64_t rte_combine64ms1b_w(uint64_t v) { return rte_combine64ms1b(v); } -uint32_t rte_bsf32_w(uint32_t v) { return rte_bsf32(v); } -int rte_bsf32_safe_w(uint32_t v, uint32_t *pos) { - return rte_bsf32_safe(v, pos); -} -uint32_t rte_bsf64_w(uint64_t v) { return rte_bsf64(v); } -int rte_bsf64_safe_w(uint64_t v, uint32_t *pos) { - return rte_bsf64_safe(v, pos); -} -uint32_t rte_fls_u32_w(uint32_t x) { return rte_fls_u32(x); } -uint32_t rte_fls_u64_w(uint64_t x) { return rte_fls_u64(x); } -int rte_is_power_of_2_w(uint32_t n) { return rte_is_power_of_2(n); } -uint32_t rte_align32pow2_w(uint32_t x) { return rte_align32pow2(x); } -uint32_t rte_align32prevpow2_w(uint32_t x) { return rte_align32prevpow2(x); } -uint64_t rte_align64pow2_w(uint64_t v) { return rte_align64pow2(v); } -uint64_t rte_align64prevpow2_w(uint64_t v) { return rte_align64prevpow2(v); } -uint32_t rte_log2_u32_w(uint32_t v) { return rte_log2_u32(v); } -uint32_t rte_log2_u64_w(uint64_t v) { return rte_log2_u64(v); } -void rte_rwlock_init_w(rte_rwlock_t *rwl) { rte_rwlock_init(rwl); } -void rte_rwlock_read_lock_w(rte_rwlock_t *rwl) { rte_rwlock_read_lock(rwl); } -int rte_rwlock_read_trylock_w(rte_rwlock_t *rwl) { - return rte_rwlock_read_trylock(rwl); -} -void rte_rwlock_read_unlock_w(rte_rwlock_t *rwl) { - rte_rwlock_read_unlock(rwl); -} -int rte_rwlock_write_trylock_w(rte_rwlock_t *rwl) { - return rte_rwlock_write_trylock(rwl); -} -void rte_rwlock_write_lock_w(rte_rwlock_t *rwl) { rte_rwlock_write_lock(rwl); } -void rte_rwlock_write_unlock_w(rte_rwlock_t *rwl) { - rte_rwlock_write_unlock(rwl); -} -int rte_rwlock_write_is_locked_w(rte_rwlock_t *rwl) { - return rte_rwlock_write_is_locked(rwl); -} -void rte_rwlock_read_lock_tm_w(rte_rwlock_t *rwl) { - rte_rwlock_read_lock_tm(rwl); -} -void rte_rwlock_read_unlock_tm_w(rte_rwlock_t *rwl) { - rte_rwlock_read_unlock_tm(rwl); -} -void rte_rwlock_write_lock_tm_w(rte_rwlock_t *rwl) { - rte_rwlock_write_lock_tm(rwl); -} -void rte_rwlock_write_unlock_tm_w(rte_rwlock_t *rwl) { - rte_rwlock_write_unlock_tm(rwl); -} -unsigned int rte_ring_mp_enqueue_bulk_elem_w(struct rte_ring *r, - const void *obj_table, - unsigned int esize, unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_enqueue_bulk_elem(r, obj_table, esize, n, free_space); -} -unsigned int rte_ring_sp_enqueue_bulk_elem_w(struct rte_ring *r, - const void *obj_table, - unsigned int esize, unsigned int n, - unsigned int *free_space) { - return rte_ring_sp_enqueue_bulk_elem(r, obj_table, esize, n, free_space); -} -unsigned int rte_ring_mp_hts_enqueue_bulk_elem_w(struct rte_ring *r, - const void *obj_table, - unsigned int esize, - unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_hts_enqueue_bulk_elem(r, obj_table, esize, n, free_space); -} -unsigned int rte_ring_mc_hts_dequeue_bulk_elem_w(struct rte_ring *r, - void *obj_table, - unsigned int esize, - unsigned int n, - unsigned int *available) { - return rte_ring_mc_hts_dequeue_bulk_elem(r, obj_table, esize, n, available); -} -unsigned int rte_ring_mp_hts_enqueue_burst_elem_w(struct rte_ring *r, - const void *obj_table, - unsigned int esize, - unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_hts_enqueue_burst_elem(r, obj_table, esize, n, free_space); -} -unsigned int rte_ring_mc_hts_dequeue_burst_elem_w(struct rte_ring *r, - void *obj_table, - unsigned int esize, - unsigned int n, - unsigned int *available) { - return rte_ring_mc_hts_dequeue_burst_elem(r, obj_table, esize, n, available); -} -unsigned int rte_ring_mp_hts_enqueue_bulk_w(struct rte_ring *r, - void *const *obj_table, - unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_hts_enqueue_bulk(r, obj_table, n, free_space); -} -unsigned int rte_ring_mc_hts_dequeue_bulk_w(struct rte_ring *r, - void **obj_table, unsigned int n, - unsigned int *available) { - return rte_ring_mc_hts_dequeue_bulk(r, obj_table, n, available); -} -unsigned int rte_ring_mp_hts_enqueue_burst_w(struct rte_ring *r, - void *const *obj_table, - unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_hts_enqueue_burst(r, obj_table, n, free_space); -} -unsigned int rte_ring_mc_hts_dequeue_burst_w(struct rte_ring *r, - void **obj_table, unsigned int n, - unsigned int *available) { - return rte_ring_mc_hts_dequeue_burst(r, obj_table, n, available); -} -unsigned int rte_ring_mp_rts_enqueue_bulk_elem_w(struct rte_ring *r, - const void *obj_table, - unsigned int esize, - unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_rts_enqueue_bulk_elem(r, obj_table, esize, n, free_space); -} -unsigned int rte_ring_mc_rts_dequeue_bulk_elem_w(struct rte_ring *r, - void *obj_table, - unsigned int esize, - unsigned int n, - unsigned int *available) { - return rte_ring_mc_rts_dequeue_bulk_elem(r, obj_table, esize, n, available); -} -unsigned int rte_ring_mp_rts_enqueue_burst_elem_w(struct rte_ring *r, - const void *obj_table, - unsigned int esize, - unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_rts_enqueue_burst_elem(r, obj_table, esize, n, free_space); -} -unsigned int rte_ring_mc_rts_dequeue_burst_elem_w(struct rte_ring *r, - void *obj_table, - unsigned int esize, - unsigned int n, - unsigned int *available) { - return rte_ring_mc_rts_dequeue_burst_elem(r, obj_table, esize, n, available); -} -unsigned int rte_ring_mp_rts_enqueue_bulk_w(struct rte_ring *r, - void *const *obj_table, - unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_rts_enqueue_bulk(r, obj_table, n, free_space); -} -unsigned int rte_ring_mc_rts_dequeue_bulk_w(struct rte_ring *r, - void **obj_table, unsigned int n, - unsigned int *available) { - return rte_ring_mc_rts_dequeue_bulk(r, obj_table, n, available); -} -unsigned int rte_ring_mp_rts_enqueue_burst_w(struct rte_ring *r, - void *const *obj_table, - unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_rts_enqueue_burst(r, obj_table, n, free_space); -} -unsigned int rte_ring_mc_rts_dequeue_burst_w(struct rte_ring *r, - void **obj_table, unsigned int n, - unsigned int *available) { - return rte_ring_mc_rts_dequeue_burst(r, obj_table, n, available); -} -uint32_t rte_ring_get_prod_htd_max_w(const struct rte_ring *r) { - return rte_ring_get_prod_htd_max(r); -} -int rte_ring_set_prod_htd_max_w(struct rte_ring *r, uint32_t v) { - return rte_ring_set_prod_htd_max(r, v); -} -uint32_t rte_ring_get_cons_htd_max_w(const struct rte_ring *r) { - return rte_ring_get_cons_htd_max(r); -} -int rte_ring_set_cons_htd_max_w(struct rte_ring *r, uint32_t v) { - return rte_ring_set_cons_htd_max(r, v); -} -unsigned int rte_ring_enqueue_bulk_elem_w(struct rte_ring *r, - const void *obj_table, - unsigned int esize, unsigned int n, - unsigned int *free_space) { - return rte_ring_enqueue_bulk_elem(r, obj_table, esize, n, free_space); -} -int rte_ring_mp_enqueue_elem_w(struct rte_ring *r, void *obj, - unsigned int esize) { - return rte_ring_mp_enqueue_elem(r, obj, esize); -} -int rte_ring_sp_enqueue_elem_w(struct rte_ring *r, void *obj, - unsigned int esize) { - return rte_ring_sp_enqueue_elem(r, obj, esize); -} -int rte_ring_enqueue_elem_w(struct rte_ring *r, void *obj, unsigned int esize) { - return rte_ring_enqueue_elem(r, obj, esize); -} -unsigned int rte_ring_mc_dequeue_bulk_elem_w(struct rte_ring *r, - void *obj_table, - unsigned int esize, unsigned int n, - unsigned int *available) { - return rte_ring_mc_dequeue_bulk_elem(r, obj_table, esize, n, available); -} -unsigned int rte_ring_sc_dequeue_bulk_elem_w(struct rte_ring *r, - void *obj_table, - unsigned int esize, unsigned int n, - unsigned int *available) { - return rte_ring_sc_dequeue_bulk_elem(r, obj_table, esize, n, available); -} -unsigned int rte_ring_dequeue_bulk_elem_w(struct rte_ring *r, void *obj_table, - unsigned int esize, unsigned int n, - unsigned int *available) { - return rte_ring_dequeue_bulk_elem(r, obj_table, esize, n, available); -} -int rte_ring_mc_dequeue_elem_w(struct rte_ring *r, void *obj_p, - unsigned int esize) { - return rte_ring_mc_dequeue_elem(r, obj_p, esize); -} -int rte_ring_sc_dequeue_elem_w(struct rte_ring *r, void *obj_p, - unsigned int esize) { - return rte_ring_sc_dequeue_elem(r, obj_p, esize); -} -int rte_ring_dequeue_elem_w(struct rte_ring *r, void *obj_p, - unsigned int esize) { - return rte_ring_dequeue_elem(r, obj_p, esize); -} -unsigned int rte_ring_mp_enqueue_burst_elem_w(struct rte_ring *r, - const void *obj_table, - unsigned int esize, - unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_enqueue_burst_elem(r, obj_table, esize, n, free_space); -} -unsigned int rte_ring_sp_enqueue_burst_elem_w(struct rte_ring *r, - const void *obj_table, - unsigned int esize, - unsigned int n, - unsigned int *free_space) { - return rte_ring_sp_enqueue_burst_elem(r, obj_table, esize, n, free_space); -} -unsigned int rte_ring_enqueue_burst_elem_w(struct rte_ring *r, - const void *obj_table, - unsigned int esize, unsigned int n, - unsigned int *free_space) { - return rte_ring_enqueue_burst_elem(r, obj_table, esize, n, free_space); -} -unsigned int rte_ring_mc_dequeue_burst_elem_w(struct rte_ring *r, - void *obj_table, - unsigned int esize, - unsigned int n, - unsigned int *available) { - return rte_ring_mc_dequeue_burst_elem(r, obj_table, esize, n, available); -} -unsigned int rte_ring_sc_dequeue_burst_elem_w(struct rte_ring *r, - void *obj_table, - unsigned int esize, - unsigned int n, - unsigned int *available) { - return rte_ring_sc_dequeue_burst_elem(r, obj_table, esize, n, available); -} -unsigned int rte_ring_dequeue_burst_elem_w(struct rte_ring *r, void *obj_table, - unsigned int esize, unsigned int n, - unsigned int *available) { - return rte_ring_dequeue_burst_elem(r, obj_table, esize, n, available); -} -unsigned int rte_ring_enqueue_bulk_elem_start_w(struct rte_ring *r, - unsigned int n, - unsigned int *free_space) { - return rte_ring_enqueue_bulk_elem_start(r, n, free_space); -} -unsigned int rte_ring_enqueue_bulk_start_w(struct rte_ring *r, unsigned int n, - unsigned int *free_space) { - return rte_ring_enqueue_bulk_start(r, n, free_space); -} -unsigned int rte_ring_enqueue_burst_elem_start_w(struct rte_ring *r, - unsigned int n, - unsigned int *free_space) { - return rte_ring_enqueue_burst_elem_start(r, n, free_space); -} -unsigned int rte_ring_enqueue_burst_start_w(struct rte_ring *r, unsigned int n, - unsigned int *free_space) { - return rte_ring_enqueue_burst_start(r, n, free_space); -} -void rte_ring_enqueue_elem_finish_w(struct rte_ring *r, const void *obj_table, - unsigned int esize, unsigned int n) { - rte_ring_enqueue_elem_finish(r, obj_table, esize, n); -} -void rte_ring_enqueue_finish_w(struct rte_ring *r, void *const *obj_table, - unsigned int n) { - rte_ring_enqueue_finish(r, obj_table, n); -} -unsigned int rte_ring_dequeue_bulk_elem_start_w(struct rte_ring *r, - void *obj_table, - unsigned int esize, - unsigned int n, - unsigned int *available) { - return rte_ring_dequeue_bulk_elem_start(r, obj_table, esize, n, available); -} -unsigned int rte_ring_dequeue_bulk_start_w(struct rte_ring *r, void **obj_table, - unsigned int n, - unsigned int *available) { - return rte_ring_dequeue_bulk_start(r, obj_table, n, available); -} -unsigned int rte_ring_dequeue_burst_elem_start_w(struct rte_ring *r, - void *obj_table, - unsigned int esize, - unsigned int n, - unsigned int *available) { - return rte_ring_dequeue_burst_elem_start(r, obj_table, esize, n, available); -} -unsigned int rte_ring_dequeue_burst_start_w(struct rte_ring *r, - void **obj_table, unsigned int n, - unsigned int *available) { - return rte_ring_dequeue_burst_start(r, obj_table, n, available); -} -void rte_ring_dequeue_elem_finish_w(struct rte_ring *r, unsigned int n) { - rte_ring_dequeue_elem_finish(r, n); -} -void rte_ring_dequeue_finish_w(struct rte_ring *r, unsigned int n) { - rte_ring_dequeue_finish(r, n); -} -unsigned int rte_ring_enqueue_zc_bulk_elem_start_w(struct rte_ring *r, - unsigned int esize, - unsigned int n, - struct rte_ring_zc_data *zcd, - unsigned int *free_space) { - return rte_ring_enqueue_zc_bulk_elem_start(r, esize, n, zcd, free_space); -} -unsigned int rte_ring_enqueue_zc_bulk_start_w(struct rte_ring *r, - unsigned int n, - struct rte_ring_zc_data *zcd, - unsigned int *free_space) { - return rte_ring_enqueue_zc_bulk_start(r, n, zcd, free_space); -} -unsigned int rte_ring_enqueue_zc_burst_elem_start_w( - struct rte_ring *r, unsigned int esize, unsigned int n, - struct rte_ring_zc_data *zcd, unsigned int *free_space) { - return rte_ring_enqueue_zc_burst_elem_start(r, esize, n, zcd, free_space); -} -unsigned int rte_ring_enqueue_zc_burst_start_w(struct rte_ring *r, - unsigned int n, - struct rte_ring_zc_data *zcd, - unsigned int *free_space) { - return rte_ring_enqueue_zc_burst_start(r, n, zcd, free_space); -} -void rte_ring_enqueue_zc_elem_finish_w(struct rte_ring *r, unsigned int n) { - rte_ring_enqueue_zc_elem_finish(r, n); -} -void rte_ring_enqueue_zc_finish_w(struct rte_ring *r, unsigned int n) { - rte_ring_enqueue_zc_finish(r, n); -} -unsigned int rte_ring_dequeue_zc_bulk_elem_start_w(struct rte_ring *r, - unsigned int esize, - unsigned int n, - struct rte_ring_zc_data *zcd, - unsigned int *available) { - return rte_ring_dequeue_zc_bulk_elem_start(r, esize, n, zcd, available); -} -unsigned int rte_ring_dequeue_zc_bulk_start_w(struct rte_ring *r, - unsigned int n, - struct rte_ring_zc_data *zcd, - unsigned int *available) { - return rte_ring_dequeue_zc_bulk_start(r, n, zcd, available); -} -unsigned int rte_ring_dequeue_zc_burst_elem_start_w( - struct rte_ring *r, unsigned int esize, unsigned int n, - struct rte_ring_zc_data *zcd, unsigned int *available) { - return rte_ring_dequeue_zc_burst_elem_start(r, esize, n, zcd, available); -} -unsigned int rte_ring_dequeue_zc_burst_start_w(struct rte_ring *r, - unsigned int n, - struct rte_ring_zc_data *zcd, - unsigned int *available) { - return rte_ring_dequeue_zc_burst_start(r, n, zcd, available); -} -void rte_ring_dequeue_zc_elem_finish_w(struct rte_ring *r, unsigned int n) { - rte_ring_dequeue_zc_elem_finish(r, n); -} -void rte_ring_dequeue_zc_finish_w(struct rte_ring *r, unsigned int n) { - rte_ring_dequeue_zc_finish(r, n); -} -unsigned int rte_ring_mp_enqueue_bulk_w(struct rte_ring *r, - void *const *obj_table, unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_enqueue_bulk(r, obj_table, n, free_space); -} -unsigned int rte_ring_sp_enqueue_bulk_w(struct rte_ring *r, - void *const *obj_table, unsigned int n, - unsigned int *free_space) { - return rte_ring_sp_enqueue_bulk(r, obj_table, n, free_space); -} -unsigned int rte_ring_enqueue_bulk_w(struct rte_ring *r, void *const *obj_table, - unsigned int n, unsigned int *free_space) { - return rte_ring_enqueue_bulk(r, obj_table, n, free_space); -} -int rte_ring_mp_enqueue_w(struct rte_ring *r, void *obj) { - return rte_ring_mp_enqueue(r, obj); -} -int rte_ring_sp_enqueue_w(struct rte_ring *r, void *obj) { - return rte_ring_sp_enqueue(r, obj); -} -int rte_ring_enqueue_w(struct rte_ring *r, void *obj) { - return rte_ring_enqueue(r, obj); -} -unsigned int rte_ring_mc_dequeue_bulk_w(struct rte_ring *r, void **obj_table, - unsigned int n, - unsigned int *available) { - return rte_ring_mc_dequeue_bulk(r, obj_table, n, available); -} -unsigned int rte_ring_sc_dequeue_bulk_w(struct rte_ring *r, void **obj_table, - unsigned int n, - unsigned int *available) { - return rte_ring_sc_dequeue_bulk(r, obj_table, n, available); -} -unsigned int rte_ring_dequeue_bulk_w(struct rte_ring *r, void **obj_table, - unsigned int n, unsigned int *available) { - return rte_ring_dequeue_bulk(r, obj_table, n, available); -} -int rte_ring_mc_dequeue_w(struct rte_ring *r, void **obj_p) { - return rte_ring_mc_dequeue(r, obj_p); -} -int rte_ring_sc_dequeue_w(struct rte_ring *r, void **obj_p) { - return rte_ring_sc_dequeue(r, obj_p); -} -int rte_ring_dequeue_w(struct rte_ring *r, void **obj_p) { - return rte_ring_dequeue(r, obj_p); -} -unsigned int rte_ring_count_w(const struct rte_ring *r) { - return rte_ring_count(r); -} -unsigned int rte_ring_free_count_w(const struct rte_ring *r) { - return rte_ring_free_count(r); -} -int rte_ring_full_w(const struct rte_ring *r) { return rte_ring_full(r); } -int rte_ring_empty_w(const struct rte_ring *r) { return rte_ring_empty(r); } -unsigned int rte_ring_get_size_w(const struct rte_ring *r) { - return rte_ring_get_size(r); -} -unsigned int rte_ring_get_capacity_w(const struct rte_ring *r) { - return rte_ring_get_capacity(r); -} -enum rte_ring_sync_type -rte_ring_get_prod_sync_type_w(const struct rte_ring *r) { - return rte_ring_get_prod_sync_type(r); -} -int rte_ring_is_prod_single_w(const struct rte_ring *r) { - return rte_ring_is_prod_single(r); -} -enum rte_ring_sync_type -rte_ring_get_cons_sync_type_w(const struct rte_ring *r) { - return rte_ring_get_cons_sync_type(r); -} -int rte_ring_is_cons_single_w(const struct rte_ring *r) { - return rte_ring_is_cons_single(r); -} -unsigned int rte_ring_mp_enqueue_burst_w(struct rte_ring *r, - void *const *obj_table, unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_enqueue_burst(r, obj_table, n, free_space); -} -unsigned int rte_ring_sp_enqueue_burst_w(struct rte_ring *r, - void *const *obj_table, unsigned int n, - unsigned int *free_space) { - return rte_ring_sp_enqueue_burst(r, obj_table, n, free_space); -} -unsigned int rte_ring_enqueue_burst_w(struct rte_ring *r, - void *const *obj_table, unsigned int n, - unsigned int *free_space) { - return rte_ring_enqueue_burst(r, obj_table, n, free_space); -} -unsigned int rte_ring_mc_dequeue_burst_w(struct rte_ring *r, void **obj_table, - unsigned int n, - unsigned int *available) { - return rte_ring_mc_dequeue_burst(r, obj_table, n, available); -} -unsigned int rte_ring_sc_dequeue_burst_w(struct rte_ring *r, void **obj_table, - unsigned int n, - unsigned int *available) { - return rte_ring_sc_dequeue_burst(r, obj_table, n, available); -} -unsigned int rte_ring_dequeue_burst_w(struct rte_ring *r, void **obj_table, - unsigned int n, unsigned int *available) { - return rte_ring_dequeue_burst(r, obj_table, n, available); -} -void *rte_memcpy_w(void *dst, const void *src, size_t n) { - return rte_memcpy(dst, src, n); -} -void *rte_mov15_or_less_w(void *dst, const void *src, size_t n) { - return rte_mov15_or_less(dst, src, n); -} -void rte_mov16_w(uint8_t *dst, const uint8_t *src) { rte_mov16(dst, src); } -void rte_mov32_w(uint8_t *dst, const uint8_t *src) { rte_mov32(dst, src); } -void rte_mov64_w(uint8_t *dst, const uint8_t *src) { rte_mov64(dst, src); } -void rte_mov256_w(uint8_t *dst, const uint8_t *src) { rte_mov256(dst, src); } -void *rte_memcpy_generic_w(void *dst, const void *src, size_t n) { - return rte_memcpy_generic(dst, src, n); -} -void *rte_memcpy_aligned_w(void *dst, const void *src, size_t n) { - return rte_memcpy_aligned(dst, src, n); -} -struct rte_mempool_objhdr *rte_mempool_get_header_w(void *obj) { - return rte_mempool_get_header(obj); -} -struct rte_mempool *rte_mempool_from_obj_w(void *obj) { - return rte_mempool_from_obj(obj); -} -struct rte_mempool_objtlr *rte_mempool_get_trailer_w(void *obj) { - return rte_mempool_get_trailer(obj); -} -struct rte_mempool_ops *rte_mempool_get_ops_w(int ops_index) { - return rte_mempool_get_ops(ops_index); -} -int rte_mempool_ops_dequeue_bulk_w(struct rte_mempool *mp, void **obj_table, - unsigned int n) { - return rte_mempool_ops_dequeue_bulk(mp, obj_table, n); -} -int rte_mempool_ops_dequeue_contig_blocks_w(struct rte_mempool *mp, - void **first_obj_table, - unsigned int n) { - return rte_mempool_ops_dequeue_contig_blocks(mp, first_obj_table, n); -} -int rte_mempool_ops_enqueue_bulk_w(struct rte_mempool *mp, - void *const *obj_table, unsigned int n) { - return rte_mempool_ops_enqueue_bulk(mp, obj_table, n); -} -struct rte_mempool_cache *rte_mempool_default_cache_w(struct rte_mempool *mp, - unsigned int lcore_id) { - return rte_mempool_default_cache(mp, lcore_id); -} -void rte_mempool_cache_flush_w(struct rte_mempool_cache *cache, - struct rte_mempool *mp) { - rte_mempool_cache_flush(cache, mp); -} -void rte_mempool_do_generic_put_w(struct rte_mempool *mp, - void *const *obj_table, unsigned int n, - struct rte_mempool_cache *cache) { - rte_mempool_do_generic_put(mp, obj_table, n, cache); -} -void rte_mempool_generic_put_w(struct rte_mempool *mp, void *const *obj_table, - unsigned int n, - struct rte_mempool_cache *cache) { - rte_mempool_generic_put(mp, obj_table, n, cache); -} -void rte_mempool_put_bulk_w(struct rte_mempool *mp, void *const *obj_table, - unsigned int n) { - rte_mempool_put_bulk(mp, obj_table, n); -} -void rte_mempool_put_w(struct rte_mempool *mp, void *obj) { - rte_mempool_put(mp, obj); -} -int rte_mempool_do_generic_get_w(struct rte_mempool *mp, void **obj_table, - unsigned int n, - struct rte_mempool_cache *cache) { - return rte_mempool_do_generic_get(mp, obj_table, n, cache); -} -int rte_mempool_generic_get_w(struct rte_mempool *mp, void **obj_table, - unsigned int n, struct rte_mempool_cache *cache) { - return rte_mempool_generic_get(mp, obj_table, n, cache); -} -int rte_mempool_get_bulk_w(struct rte_mempool *mp, void **obj_table, - unsigned int n) { - return rte_mempool_get_bulk(mp, obj_table, n); -} -int rte_mempool_get_w(struct rte_mempool *mp, void **obj_p) { - return rte_mempool_get(mp, obj_p); -} -int rte_mempool_get_contig_blocks_w(struct rte_mempool *mp, - void **first_obj_table, unsigned int n) { - return rte_mempool_get_contig_blocks(mp, first_obj_table, n); -} -int rte_mempool_full_w(const struct rte_mempool *mp) { - return rte_mempool_full(mp); -} -int rte_mempool_empty_w(const struct rte_mempool *mp) { - return rte_mempool_empty(mp); -} -rte_iova_t rte_mempool_virt2iova_w(const void *elt) { - return rte_mempool_virt2iova(elt); -} -void *rte_mempool_get_priv_w(struct rte_mempool *mp) { - return rte_mempool_get_priv(mp); -} -void rte_prefetch0_w(const void *p) { rte_prefetch0(p); } -void rte_prefetch1_w(const void *p) { rte_prefetch1(p); } -void rte_prefetch2_w(const void *p) { rte_prefetch2(p); } -void rte_prefetch_non_temporal_w(const void *p) { - rte_prefetch_non_temporal(p); -} -void rte_prefetch0_write_w(const void *p) { rte_prefetch0_write(p); } -void rte_prefetch1_write_w(const void *p) { rte_prefetch1_write(p); } -void rte_prefetch2_write_w(const void *p) { rte_prefetch2_write(p); } -void rte_cldemote_w(const void *p) { rte_cldemote(p); } -uint16_t rte_constant_bswap16_w(uint16_t x) { return rte_constant_bswap16(x); } -uint32_t rte_constant_bswap32_w(uint32_t x) { return rte_constant_bswap32(x); } -uint64_t rte_constant_bswap64_w(uint64_t x) { return rte_constant_bswap64(x); } -uint16_t rte_arch_bswap16_w(uint16_t _x) { return rte_arch_bswap16(_x); } -uint32_t rte_arch_bswap32_w(uint32_t _x) { return rte_arch_bswap32(_x); } -uint64_t rte_arch_bswap64_w(uint64_t _x) { return rte_arch_bswap64(_x); } -void rte_mbuf_prefetch_part1_w(struct rte_mbuf *m) { - rte_mbuf_prefetch_part1(m); -} -void rte_mbuf_prefetch_part2_w(struct rte_mbuf *m) { - rte_mbuf_prefetch_part2(m); -} -uint16_t rte_pktmbuf_priv_size_w(struct rte_mempool *mp) { - return rte_pktmbuf_priv_size(mp); -} -rte_iova_t rte_mbuf_iova_get_w(const struct rte_mbuf *m) { - return rte_mbuf_iova_get(m); -} -void rte_mbuf_iova_set_w(struct rte_mbuf *m, rte_iova_t iova) { - rte_mbuf_iova_set(m, iova); -} -rte_iova_t rte_mbuf_data_iova_w(const struct rte_mbuf *mb) { - return rte_mbuf_data_iova(mb); -} -rte_iova_t rte_mbuf_data_iova_default_w(const struct rte_mbuf *mb) { - return rte_mbuf_data_iova_default(mb); -} -struct rte_mbuf *rte_mbuf_from_indirect_w(struct rte_mbuf *mi) { - return rte_mbuf_from_indirect(mi); -} -char *rte_mbuf_buf_addr_w(struct rte_mbuf *mb, struct rte_mempool *mp) { - return rte_mbuf_buf_addr(mb, mp); -} -char *rte_mbuf_data_addr_default_w(struct rte_mbuf *mb) { - return rte_mbuf_data_addr_default(mb); -} -char *rte_mbuf_to_baddr_w(struct rte_mbuf *md) { return rte_mbuf_to_baddr(md); } -void *rte_mbuf_to_priv_w(struct rte_mbuf *m) { return rte_mbuf_to_priv(m); } -uint32_t rte_pktmbuf_priv_flags_w(struct rte_mempool *mp) { - return rte_pktmbuf_priv_flags(mp); -} -uint16_t rte_mbuf_refcnt_read_w(const struct rte_mbuf *m) { - return rte_mbuf_refcnt_read(m); -} -void rte_mbuf_refcnt_set_w(struct rte_mbuf *m, uint16_t new_value) { - rte_mbuf_refcnt_set(m, new_value); -} -uint16_t rte_mbuf_refcnt_update_w(struct rte_mbuf *m, int16_t value) { - return rte_mbuf_refcnt_update(m, value); -} -uint16_t -rte_mbuf_ext_refcnt_read_w(const struct rte_mbuf_ext_shared_info *shinfo) { - return rte_mbuf_ext_refcnt_read(shinfo); -} -void rte_mbuf_ext_refcnt_set_w(struct rte_mbuf_ext_shared_info *shinfo, - uint16_t new_value) { - rte_mbuf_ext_refcnt_set(shinfo, new_value); -} -uint16_t rte_mbuf_ext_refcnt_update_w(struct rte_mbuf_ext_shared_info *shinfo, - int16_t value) { - return rte_mbuf_ext_refcnt_update(shinfo, value); -} -struct rte_mbuf *rte_mbuf_raw_alloc_w(struct rte_mempool *mp) { - return rte_mbuf_raw_alloc(mp); -} -void rte_mbuf_raw_free_w(struct rte_mbuf *m) { rte_mbuf_raw_free(m); } -uint16_t rte_pktmbuf_data_room_size_w(struct rte_mempool *mp) { - return rte_pktmbuf_data_room_size(mp); -} -void rte_pktmbuf_reset_headroom_w(struct rte_mbuf *m) { - rte_pktmbuf_reset_headroom(m); -} -void rte_pktmbuf_reset_w(struct rte_mbuf *m) { rte_pktmbuf_reset(m); } -struct rte_mbuf *rte_pktmbuf_alloc_w(struct rte_mempool *mp) { - return rte_pktmbuf_alloc(mp); -} -int rte_pktmbuf_alloc_bulk_w(struct rte_mempool *pool, struct rte_mbuf **mbufs, - unsigned int count) { - return rte_pktmbuf_alloc_bulk(pool, mbufs, count); -} -struct rte_mbuf_ext_shared_info * -rte_pktmbuf_ext_shinfo_init_helper_w(void *buf_addr, uint16_t *buf_len, - rte_mbuf_extbuf_free_callback_t free_cb, - void *fcb_opaque) { - return rte_pktmbuf_ext_shinfo_init_helper(buf_addr, buf_len, free_cb, - fcb_opaque); -} -void rte_pktmbuf_attach_extbuf_w(struct rte_mbuf *m, void *buf_addr, - rte_iova_t buf_iova, uint16_t buf_len, - struct rte_mbuf_ext_shared_info *shinfo) { - rte_pktmbuf_attach_extbuf(m, buf_addr, buf_iova, buf_len, shinfo); -} -void rte_mbuf_dynfield_copy_w(struct rte_mbuf *mdst, - const struct rte_mbuf *msrc) { - rte_mbuf_dynfield_copy(mdst, msrc); -} -void rte_pktmbuf_attach_w(struct rte_mbuf *mi, struct rte_mbuf *m) { - rte_pktmbuf_attach(mi, m); -} -void rte_pktmbuf_detach_w(struct rte_mbuf *m) { rte_pktmbuf_detach(m); } -struct rte_mbuf *rte_pktmbuf_prefree_seg_w(struct rte_mbuf *m) { - return rte_pktmbuf_prefree_seg(m); -} -void rte_pktmbuf_free_seg_w(struct rte_mbuf *m) { rte_pktmbuf_free_seg(m); } -void rte_pktmbuf_free_w(struct rte_mbuf *m) { rte_pktmbuf_free(m); } -void rte_pktmbuf_refcnt_update_w(struct rte_mbuf *m, int16_t v) { - rte_pktmbuf_refcnt_update(m, v); -} -uint16_t rte_pktmbuf_headroom_w(const struct rte_mbuf *m) { - return rte_pktmbuf_headroom(m); -} -uint16_t rte_pktmbuf_tailroom_w(const struct rte_mbuf *m) { - return rte_pktmbuf_tailroom(m); -} -struct rte_mbuf *rte_pktmbuf_lastseg_w(struct rte_mbuf *m) { - return rte_pktmbuf_lastseg(m); -} -char *rte_pktmbuf_prepend_w(struct rte_mbuf *m, uint16_t len) { - return rte_pktmbuf_prepend(m, len); -} -char *rte_pktmbuf_append_w(struct rte_mbuf *m, uint16_t len) { - return rte_pktmbuf_append(m, len); -} -char *rte_pktmbuf_adj_w(struct rte_mbuf *m, uint16_t len) { - return rte_pktmbuf_adj(m, len); -} -int rte_pktmbuf_trim_w(struct rte_mbuf *m, uint16_t len) { - return rte_pktmbuf_trim(m, len); -} -int rte_pktmbuf_is_contiguous_w(const struct rte_mbuf *m) { - return rte_pktmbuf_is_contiguous(m); -} -const void *rte_pktmbuf_read_w(const struct rte_mbuf *m, uint32_t off, - uint32_t len, void *buf) { - return rte_pktmbuf_read(m, off, len, buf); -} -int rte_pktmbuf_chain_w(struct rte_mbuf *head, struct rte_mbuf *tail) { - return rte_pktmbuf_chain(head, tail); -} -uint64_t rte_mbuf_tx_offload_w(uint64_t il2, uint64_t il3, uint64_t il4, - uint64_t tso, uint64_t ol3, uint64_t ol2, - uint64_t unused) { - return rte_mbuf_tx_offload(il2, il3, il4, tso, ol3, ol2, unused); -} -int rte_validate_tx_offload_w(const struct rte_mbuf *m) { - return rte_validate_tx_offload(m); -} -int rte_pktmbuf_linearize_w(struct rte_mbuf *mbuf) { - return rte_pktmbuf_linearize(mbuf); -} -uint32_t rte_mbuf_sched_queue_get_w(const struct rte_mbuf *m) { - return rte_mbuf_sched_queue_get(m); -} -uint8_t rte_mbuf_sched_traffic_class_get_w(const struct rte_mbuf *m) { - return rte_mbuf_sched_traffic_class_get(m); -} -uint8_t rte_mbuf_sched_color_get_w(const struct rte_mbuf *m) { - return rte_mbuf_sched_color_get(m); -} -void rte_mbuf_sched_get_w(const struct rte_mbuf *m, uint32_t *queue_id, - uint8_t *traffic_class, uint8_t *color) { - rte_mbuf_sched_get(m, queue_id, traffic_class, color); -} -void rte_mbuf_sched_queue_set_w(struct rte_mbuf *m, uint32_t queue_id) { - rte_mbuf_sched_queue_set(m, queue_id); -} -void rte_mbuf_sched_traffic_class_set_w(struct rte_mbuf *m, - uint8_t traffic_class) { - rte_mbuf_sched_traffic_class_set(m, traffic_class); -} -void rte_mbuf_sched_color_set_w(struct rte_mbuf *m, uint8_t color) { - rte_mbuf_sched_color_set(m, color); -} -void rte_mbuf_sched_set_w(struct rte_mbuf *m, uint32_t queue_id, - uint8_t traffic_class, uint8_t color) { - rte_mbuf_sched_set(m, queue_id, traffic_class, color); -} -int rte_is_same_ether_addr_w(const struct rte_ether_addr *ea1, - const struct rte_ether_addr *ea2) { - return rte_is_same_ether_addr(ea1, ea2); -} -int rte_is_zero_ether_addr_w(const struct rte_ether_addr *ea) { - return rte_is_zero_ether_addr(ea); -} -int rte_is_unicast_ether_addr_w(const struct rte_ether_addr *ea) { - return rte_is_unicast_ether_addr(ea); -} -int rte_is_multicast_ether_addr_w(const struct rte_ether_addr *ea) { - return rte_is_multicast_ether_addr(ea); -} -int rte_is_broadcast_ether_addr_w(const struct rte_ether_addr *ea) { - return rte_is_broadcast_ether_addr(ea); -} -int rte_is_universal_ether_addr_w(const struct rte_ether_addr *ea) { - return rte_is_universal_ether_addr(ea); -} -int rte_is_local_admin_ether_addr_w(const struct rte_ether_addr *ea) { - return rte_is_local_admin_ether_addr(ea); -} -int rte_is_valid_assigned_ether_addr_w(const struct rte_ether_addr *ea) { - return rte_is_valid_assigned_ether_addr(ea); -} -void rte_ether_addr_copy_w(const struct rte_ether_addr *ea_from, - struct rte_ether_addr *ea_to) { - rte_ether_addr_copy(ea_from, ea_to); -} -int rte_vlan_strip_w(struct rte_mbuf *m) { return rte_vlan_strip(m); } -int rte_vlan_insert_w(struct rte_mbuf **m) { return rte_vlan_insert(m); } -uint32_t rte_bitmap_get_memory_footprint_w(uint32_t n_bits) { - return rte_bitmap_get_memory_footprint(n_bits); -} -struct rte_bitmap *rte_bitmap_init_w(uint32_t n_bits, uint8_t *mem, - uint32_t mem_size) { - return rte_bitmap_init(n_bits, mem, mem_size); -} -struct rte_bitmap *rte_bitmap_init_with_all_set_w(uint32_t n_bits, uint8_t *mem, - uint32_t mem_size) { - return rte_bitmap_init_with_all_set(n_bits, mem, mem_size); -} -void rte_bitmap_free_w(struct rte_bitmap *bmp) { return rte_bitmap_free(bmp); } -void rte_bitmap_reset_w(struct rte_bitmap *bmp) { rte_bitmap_reset(bmp); } -void rte_bitmap_prefetch0_w(struct rte_bitmap *bmp, uint32_t pos) { - rte_bitmap_prefetch0(bmp, pos); -} -uint64_t rte_bitmap_get_w(struct rte_bitmap *bmp, uint32_t pos) { - return rte_bitmap_get(bmp, pos); -} -void rte_bitmap_set_w(struct rte_bitmap *bmp, uint32_t pos) { - rte_bitmap_set(bmp, pos); -} -void rte_bitmap_set_slab_w(struct rte_bitmap *bmp, uint32_t pos, - uint64_t slab) { - rte_bitmap_set_slab(bmp, pos, slab); -} -void rte_bitmap_clear_w(struct rte_bitmap *bmp, uint32_t pos) { - rte_bitmap_clear(bmp, pos); -} -int rte_bitmap_scan_w(struct rte_bitmap *bmp, uint32_t *pos, uint64_t *slab) { - return rte_bitmap_scan(bmp, pos, slab); -} -uint16_t rte_raw_cksum_w(const void *buf, size_t len) { - return rte_raw_cksum(buf, len); -} -int rte_raw_cksum_mbuf_w(const struct rte_mbuf *m, uint32_t off, uint32_t len, - uint16_t *cksum) { - return rte_raw_cksum_mbuf(m, off, len, cksum); -} -uint8_t rte_ipv4_hdr_len_w(const struct rte_ipv4_hdr *ipv4_hdr) { - return rte_ipv4_hdr_len(ipv4_hdr); -} -uint16_t rte_ipv4_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr) { - return rte_ipv4_cksum(ipv4_hdr); -} -uint16_t rte_ipv4_cksum_simple_w(const struct rte_ipv4_hdr *ipv4_hdr) { - return rte_ipv4_cksum_simple(ipv4_hdr); -} -uint16_t rte_ipv4_phdr_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr, - uint64_t ol_flags) { - return rte_ipv4_phdr_cksum(ipv4_hdr, ol_flags); -} -uint16_t rte_ipv4_udptcp_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr, - const void *l4_hdr) { - return rte_ipv4_udptcp_cksum(ipv4_hdr, l4_hdr); -} -uint16_t rte_ipv4_udptcp_cksum_mbuf_w(const struct rte_mbuf *m, - const struct rte_ipv4_hdr *ipv4_hdr, - uint16_t l4_off) { - return rte_ipv4_udptcp_cksum_mbuf(m, ipv4_hdr, l4_off); -} -int rte_ipv4_udptcp_cksum_verify_w(const struct rte_ipv4_hdr *ipv4_hdr, - const void *l4_hdr) { - return rte_ipv4_udptcp_cksum_verify(ipv4_hdr, l4_hdr); -} -int rte_ipv4_udptcp_cksum_mbuf_verify_w(const struct rte_mbuf *m, - const struct rte_ipv4_hdr *ipv4_hdr, - uint16_t l4_off) { - return rte_ipv4_udptcp_cksum_mbuf_verify(m, ipv4_hdr, l4_off); -} -bool rte_ipv6_addr_eq_w(const struct rte_ipv6_addr *a, - const struct rte_ipv6_addr *b) { - return rte_ipv6_addr_eq(a, b); -} -void rte_ipv6_addr_mask_w(struct rte_ipv6_addr *ip, uint8_t depth) { - rte_ipv6_addr_mask(ip, depth); -} -bool rte_ipv6_addr_eq_prefix_w(const struct rte_ipv6_addr *a, - const struct rte_ipv6_addr *b, uint8_t depth) { - return rte_ipv6_addr_eq_prefix(a, b, depth); -} -uint8_t rte_ipv6_mask_depth_w(const struct rte_ipv6_addr *mask) { - return rte_ipv6_mask_depth(mask); -} -bool rte_ipv6_addr_is_unspec_w(const struct rte_ipv6_addr *ip) { - return rte_ipv6_addr_is_unspec(ip); -} -bool rte_ipv6_addr_is_loopback_w(const struct rte_ipv6_addr *ip) { - return rte_ipv6_addr_is_loopback(ip); -} -bool rte_ipv6_addr_is_linklocal_w(const struct rte_ipv6_addr *ip) { - return rte_ipv6_addr_is_linklocal(ip); -} -bool rte_ipv6_addr_is_sitelocal_w(const struct rte_ipv6_addr *ip) { - return rte_ipv6_addr_is_sitelocal(ip); -} -bool rte_ipv6_addr_is_v4compat_w(const struct rte_ipv6_addr *ip) { - return rte_ipv6_addr_is_v4compat(ip); -} -bool rte_ipv6_addr_is_v4mapped_w(const struct rte_ipv6_addr *ip) { - return rte_ipv6_addr_is_v4mapped(ip); -} -bool rte_ipv6_addr_is_mcast_w(const struct rte_ipv6_addr *ip) { - return rte_ipv6_addr_is_mcast(ip); -} -enum rte_ipv6_mc_scope rte_ipv6_mc_scope_w(const struct rte_ipv6_addr *ip) { - return rte_ipv6_mc_scope(ip); -} -void rte_ipv6_llocal_from_ethernet_w(struct rte_ipv6_addr *ip, - const struct rte_ether_addr *mac) { - rte_ipv6_llocal_from_ethernet(ip, mac); -} -void rte_ipv6_solnode_from_addr_w(struct rte_ipv6_addr *sol, - const struct rte_ipv6_addr *ip) { - rte_ipv6_solnode_from_addr(sol, ip); -} -void rte_ether_mcast_from_ipv6_w(struct rte_ether_addr *mac, - const struct rte_ipv6_addr *ip) { - rte_ether_mcast_from_ipv6(mac, ip); -} -int rte_ipv6_check_version_w(const struct rte_ipv6_hdr *ip) { - return rte_ipv6_check_version(ip); -} -uint16_t rte_ipv6_phdr_cksum_w(const struct rte_ipv6_hdr *ipv6_hdr, - uint64_t ol_flags) { - return rte_ipv6_phdr_cksum(ipv6_hdr, ol_flags); -} -uint16_t rte_ipv6_udptcp_cksum_w(const struct rte_ipv6_hdr *ipv6_hdr, - const void *l4_hdr) { - return rte_ipv6_udptcp_cksum(ipv6_hdr, l4_hdr); -} -uint16_t rte_ipv6_udptcp_cksum_mbuf_w(const struct rte_mbuf *m, - const struct rte_ipv6_hdr *ipv6_hdr, - uint16_t l4_off) { - return rte_ipv6_udptcp_cksum_mbuf(m, ipv6_hdr, l4_off); -} -int rte_ipv6_udptcp_cksum_verify_w(const struct rte_ipv6_hdr *ipv6_hdr, - const void *l4_hdr) { - return rte_ipv6_udptcp_cksum_verify(ipv6_hdr, l4_hdr); -} -int rte_ipv6_udptcp_cksum_mbuf_verify_w(const struct rte_mbuf *m, - const struct rte_ipv6_hdr *ipv6_hdr, - uint16_t l4_off) { - return rte_ipv6_udptcp_cksum_mbuf_verify(m, ipv6_hdr, l4_off); -} -int rte_ipv6_get_next_ext_w(const uint8_t *p, int proto, size_t *ext_len) { - return rte_ipv6_get_next_ext(p, proto, ext_len); -} -enum rte_color -rte_meter_srtcm_color_blind_check_w(struct rte_meter_srtcm *m, - struct rte_meter_srtcm_profile *p, - uint64_t time, uint32_t pkt_len) { - return rte_meter_srtcm_color_blind_check(m, p, time, pkt_len); -} -enum rte_color rte_meter_srtcm_color_aware_check_w( - struct rte_meter_srtcm *m, struct rte_meter_srtcm_profile *p, uint64_t time, - uint32_t pkt_len, enum rte_color pkt_color) { - return rte_meter_srtcm_color_aware_check(m, p, time, pkt_len, pkt_color); -} -enum rte_color -rte_meter_trtcm_color_blind_check_w(struct rte_meter_trtcm *m, - struct rte_meter_trtcm_profile *p, - uint64_t time, uint32_t pkt_len) { - return rte_meter_trtcm_color_blind_check(m, p, time, pkt_len); -} -enum rte_color rte_meter_trtcm_color_aware_check_w( - struct rte_meter_trtcm *m, struct rte_meter_trtcm_profile *p, uint64_t time, - uint32_t pkt_len, enum rte_color pkt_color) { - return rte_meter_trtcm_color_aware_check(m, p, time, pkt_len, pkt_color); -} -enum rte_color rte_meter_trtcm_rfc4115_color_blind_check_w( - struct rte_meter_trtcm_rfc4115 *m, - struct rte_meter_trtcm_rfc4115_profile *p, uint64_t time, - uint32_t pkt_len) { - return rte_meter_trtcm_rfc4115_color_blind_check(m, p, time, pkt_len); -} -enum rte_color rte_meter_trtcm_rfc4115_color_aware_check_w( - struct rte_meter_trtcm_rfc4115 *m, - struct rte_meter_trtcm_rfc4115_profile *p, uint64_t time, uint32_t pkt_len, - enum rte_color pkt_color) { - return rte_meter_trtcm_rfc4115_color_aware_check(m, p, time, pkt_len, - pkt_color); -} -uint64_t rte_eth_rss_hf_refine_w(uint64_t rss_hf) { - return rte_eth_rss_hf_refine(rss_hf); -} - -uint16_t rte_eth_rx_burst_w(uint16_t port_id, uint16_t queue_id, - struct rte_mbuf **rx_pkts, const uint16_t nb_pkts) { - return rte_eth_rx_burst(port_id, queue_id, rx_pkts, nb_pkts); -} -int rte_eth_rx_queue_count_w(uint16_t port_id, uint16_t queue_id) { - return rte_eth_rx_queue_count(port_id, queue_id); -} -int rte_eth_rx_descriptor_status_w(uint16_t port_id, uint16_t queue_id, - uint16_t offset) { - return rte_eth_rx_descriptor_status(port_id, queue_id, offset); -} -int rte_eth_tx_descriptor_status_w(uint16_t port_id, uint16_t queue_id, - uint16_t offset) { - return rte_eth_tx_descriptor_status(port_id, queue_id, offset); -} -uint16_t rte_eth_tx_burst_w(uint16_t port_id, uint16_t queue_id, - struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { - return rte_eth_tx_burst(port_id, queue_id, tx_pkts, nb_pkts); -} -uint16_t rte_eth_tx_prepare_w(uint16_t port_id, uint16_t queue_id, - struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { - return rte_eth_tx_prepare(port_id, queue_id, tx_pkts, nb_pkts); -} -uint16_t rte_eth_tx_buffer_flush_w(uint16_t port_id, uint16_t queue_id, - struct rte_eth_dev_tx_buffer *buffer) { - return rte_eth_tx_buffer_flush(port_id, queue_id, buffer); -} -uint16_t rte_eth_tx_buffer_w(uint16_t port_id, uint16_t queue_id, - struct rte_eth_dev_tx_buffer *buffer, - struct rte_mbuf *tx_pkt) { - return rte_eth_tx_buffer(port_id, queue_id, buffer, tx_pkt); -} -uint16_t -rte_eth_recycle_mbufs_w(uint16_t rx_port_id, uint16_t rx_queue_id, - uint16_t tx_port_id, uint16_t tx_queue_id, - struct rte_eth_recycle_rxq_info *recycle_rxq_info) { - return rte_eth_recycle_mbufs(rx_port_id, rx_queue_id, tx_port_id, tx_queue_id, - recycle_rxq_info); -} -int rte_eth_tx_queue_count_w(uint16_t port_id, uint16_t queue_id) { - return rte_eth_tx_queue_count(port_id, queue_id); -} -uint32_t rte_flow_dynf_metadata_get_w(struct rte_mbuf *m) { - return rte_flow_dynf_metadata_get(m); -} -void rte_flow_dynf_metadata_set_w(struct rte_mbuf *m, uint32_t v) { - rte_flow_dynf_metadata_set(m, v); -} -int rte_flow_dynf_metadata_avail_w(void) { - return rte_flow_dynf_metadata_avail(); -} -uint32_t rte_hash_crc_1byte_w(uint8_t data, uint32_t init_val) { - return rte_hash_crc_1byte(data, init_val); -} -uint32_t rte_hash_crc_2byte_w(uint16_t data, uint32_t init_val) { - return rte_hash_crc_2byte(data, init_val); -} -uint32_t rte_hash_crc_4byte_w(uint32_t data, uint32_t init_val) { - return rte_hash_crc_4byte(data, init_val); -} -uint32_t rte_hash_crc_8byte_w(uint64_t data, uint32_t init_val) { - return rte_hash_crc_8byte(data, init_val); -} -uint32_t rte_hash_crc_w(const void *data, uint32_t data_len, - uint32_t init_val) { - return rte_hash_crc(data, data_len, init_val); -} -void rte_jhash_2hashes_w(const void *key, uint32_t length, uint32_t *pc, - uint32_t *pb) { - rte_jhash_2hashes(key, length, pc, pb); -} -void rte_jhash_32b_2hashes_w(const uint32_t *k, uint32_t length, uint32_t *pc, - uint32_t *pb) { - rte_jhash_32b_2hashes(k, length, pc, pb); -} -uint32_t rte_jhash_w(const void *key, uint32_t length, uint32_t initval) { - return rte_jhash(key, length, initval); -} -uint32_t rte_jhash_32b_w(const uint32_t *k, uint32_t length, uint32_t initval) { - return rte_jhash_32b(k, length, initval); -} -uint32_t rte_jhash_3words_w(uint32_t a, uint32_t b, uint32_t c, - uint32_t initval) { - return rte_jhash_3words(a, b, c, initval); -} -uint32_t rte_jhash_2words_w(uint32_t a, uint32_t b, uint32_t initval) { - return rte_jhash_2words(a, b, initval); -} -uint32_t rte_jhash_1word_w(uint32_t a, uint32_t initval) { - return rte_jhash_1word(a, initval); -} -uint32_t rte_fbk_hash_get_bucket_w(const struct rte_fbk_hash_table *ht, - uint32_t key) { - return rte_fbk_hash_get_bucket(ht, key); -} -int rte_fbk_hash_add_key_with_bucket_w(struct rte_fbk_hash_table *ht, - uint32_t key, uint16_t value, - uint32_t bucket) { - return rte_fbk_hash_add_key_with_bucket(ht, key, value, bucket); -} -int rte_fbk_hash_add_key_w(struct rte_fbk_hash_table *ht, uint32_t key, - uint16_t value) { - return rte_fbk_hash_add_key(ht, key, value); -} -int rte_fbk_hash_delete_key_with_bucket_w(struct rte_fbk_hash_table *ht, - uint32_t key, uint32_t bucket) { - return rte_fbk_hash_delete_key_with_bucket(ht, key, bucket); -} -int rte_fbk_hash_delete_key_w(struct rte_fbk_hash_table *ht, uint32_t key) { - return rte_fbk_hash_delete_key(ht, key); -} -int rte_fbk_hash_lookup_with_bucket_w(const struct rte_fbk_hash_table *ht, - uint32_t key, uint32_t bucket) { - return rte_fbk_hash_lookup_with_bucket(ht, key, bucket); -} -int rte_fbk_hash_lookup_w(const struct rte_fbk_hash_table *ht, uint32_t key) { - return rte_fbk_hash_lookup(ht, key); -} -void rte_fbk_hash_clear_all_w(struct rte_fbk_hash_table *ht) { - rte_fbk_hash_clear_all(ht); -} -double rte_fbk_hash_get_load_factor_w(struct rte_fbk_hash_table *ht) { - return rte_fbk_hash_get_load_factor(ht); -} -void rte_rcu_qsbr_thread_online_w(struct rte_rcu_qsbr *v, - unsigned int thread_id) { - rte_rcu_qsbr_thread_online(v, thread_id); -} -void rte_rcu_qsbr_thread_offline_w(struct rte_rcu_qsbr *v, - unsigned int thread_id) { - rte_rcu_qsbr_thread_offline(v, thread_id); -} -void rte_rcu_qsbr_lock_w(struct rte_rcu_qsbr *v, unsigned int thread_id) { - rte_rcu_qsbr_lock(v, thread_id); -} -void rte_rcu_qsbr_unlock_w(struct rte_rcu_qsbr *v, unsigned int thread_id) { - rte_rcu_qsbr_unlock(v, thread_id); -} -uint64_t rte_rcu_qsbr_start_w(struct rte_rcu_qsbr *v) { - return rte_rcu_qsbr_start(v); -} -void rte_rcu_qsbr_quiescent_w(struct rte_rcu_qsbr *v, unsigned int thread_id) { - rte_rcu_qsbr_quiescent(v, thread_id); -} -int rte_rcu_qsbr_check_w(struct rte_rcu_qsbr *v, uint64_t t, bool wait) { - return rte_rcu_qsbr_check(v, t, wait); -} -uint8_t rte_read8_relaxed_w(const void *addr) { - return rte_read8_relaxed(addr); -} -uint16_t rte_read16_relaxed_w(const void *addr) { - return rte_read16_relaxed(addr); -} -uint32_t rte_read32_relaxed_w(const void *addr) { - return rte_read32_relaxed(addr); -} -uint64_t rte_read64_relaxed_w(const void *addr) { - return rte_read64_relaxed(addr); -} -void rte_write8_relaxed_w(uint8_t value, void *addr) { - rte_write8_relaxed(value, addr); -} -void rte_write16_relaxed_w(uint16_t value, void *addr) { - rte_write16_relaxed(value, addr); -} -void rte_write32_relaxed_w(uint32_t value, void *addr) { - rte_write32_relaxed(value, addr); -} -void rte_write64_relaxed_w(uint64_t value, void *addr) { - rte_write64_relaxed(value, addr); -} -uint8_t rte_read8_w(const void *addr) { return rte_read8(addr); } -uint16_t rte_read16_w(const void *addr) { return rte_read16(addr); } -uint32_t rte_read32_w(const void *addr) { return rte_read32(addr); } -uint64_t rte_read64_w(const void *addr) { return rte_read64(addr); } -void rte_write8_w(uint8_t value, void *addr) { rte_write8(value, addr); } -void rte_write16_w(uint16_t value, void *addr) { rte_write16(value, addr); } -void rte_write32_w(uint32_t value, void *addr) { rte_write32(value, addr); } -void rte_write64_w(uint64_t value, void *addr) { rte_write64(value, addr); } -void rte_write32_wc_relaxed_w(uint32_t value, void *addr) { - rte_write32_wc_relaxed(value, addr); -} -void rte_write32_wc_w(uint32_t value, void *addr) { - rte_write32_wc(value, addr); -} -void rte_mcslock_lock_w(rte_mcslock_t **msl, rte_mcslock_t *me) { - rte_mcslock_lock(msl, me); -} -void rte_mcslock_unlock_w(rte_mcslock_t **msl, rte_mcslock_t *me) { - rte_mcslock_unlock(msl, me); -} -int rte_mcslock_trylock_w(rte_mcslock_t **msl, rte_mcslock_t *me) { - return rte_mcslock_trylock(msl, me); -} -int rte_mcslock_is_locked_w(rte_mcslock_t *msl) { - return rte_mcslock_is_locked(msl); -} -void rte_pflock_init_w(struct rte_pflock *pf) { rte_pflock_init(pf); } -void rte_pflock_read_lock_w(rte_pflock_t *pf) { rte_pflock_read_lock(pf); } -void rte_pflock_read_unlock_w(rte_pflock_t *pf) { rte_pflock_read_unlock(pf); } -void rte_pflock_write_lock_w(rte_pflock_t *pf) { rte_pflock_write_lock(pf); } -void rte_pflock_write_unlock_w(rte_pflock_t *pf) { - rte_pflock_write_unlock(pf); -} -uint32_t rte_reciprocal_divide_w(uint32_t a, struct rte_reciprocal R) { - return rte_reciprocal_divide(a, R); -} -uint64_t rte_reciprocal_divide_u64_w(uint64_t a, - const struct rte_reciprocal_u64 *R) { - return rte_reciprocal_divide_u64(a, R); -} -void rte_seqcount_init_w(rte_seqcount_t *seqcount) { - rte_seqcount_init(seqcount); -} -uint32_t rte_seqcount_read_begin_w(const rte_seqcount_t *seqcount) { - return rte_seqcount_read_begin(seqcount); -} -bool rte_seqcount_read_retry_w(const rte_seqcount_t *seqcount, - uint32_t begin_sn) { - return rte_seqcount_read_retry(seqcount, begin_sn); -} -void rte_seqcount_write_begin_w(rte_seqcount_t *seqcount) { - rte_seqcount_write_begin(seqcount); -} -void rte_seqcount_write_end_w(rte_seqcount_t *seqcount) { - rte_seqcount_write_end(seqcount); -} -void rte_seqlock_init_w(rte_seqlock_t *seqlock) { rte_seqlock_init(seqlock); } -uint32_t rte_seqlock_read_begin_w(const rte_seqlock_t *seqlock) { - return rte_seqlock_read_begin(seqlock); -} -bool rte_seqlock_read_retry_w(const rte_seqlock_t *seqlock, uint32_t begin_sn) { - return rte_seqlock_read_retry(seqlock, begin_sn); -} -void rte_seqlock_write_lock_w(rte_seqlock_t *seqlock) { - rte_seqlock_write_lock(seqlock); -} -void rte_seqlock_write_unlock_w(rte_seqlock_t *seqlock) { - rte_seqlock_write_unlock(seqlock); -} -unsigned int rte_stack_push_w(struct rte_stack *s, void *const *obj_table, - unsigned int n) { - return rte_stack_push(s, obj_table, n); -} -unsigned int rte_stack_pop_w(struct rte_stack *s, void **obj_table, - unsigned int n) { - return rte_stack_pop(s, obj_table, n); -} -unsigned int rte_stack_count_w(struct rte_stack *s) { - return rte_stack_count(s); -} -unsigned int rte_stack_free_count_w(struct rte_stack *s) { - return rte_stack_free_count(s); -} -uint32_t rte_softrss_w(uint32_t *input_tuple, uint32_t input_len, - const uint8_t *rss_key) { - return rte_softrss(input_tuple, input_len, rss_key); -} -uint32_t rte_softrss_be_w(uint32_t *input_tuple, uint32_t input_len, - const uint8_t *rss_key) { - return rte_softrss_be(input_tuple, input_len, rss_key); -} -void rte_ticketlock_init_w(rte_ticketlock_t *tl) { rte_ticketlock_init(tl); } -void rte_ticketlock_lock_w(rte_ticketlock_t *tl) { rte_ticketlock_lock(tl); } -void rte_ticketlock_unlock_w(rte_ticketlock_t *tl) { - rte_ticketlock_unlock(tl); -} -int rte_ticketlock_trylock_w(rte_ticketlock_t *tl) { - return rte_ticketlock_trylock(tl); -} -int rte_ticketlock_is_locked_w(rte_ticketlock_t *tl) { - return rte_ticketlock_is_locked(tl); -} -void rte_ticketlock_recursive_init_w(rte_ticketlock_recursive_t *tlr) { - rte_ticketlock_recursive_init(tlr); -} -void rte_ticketlock_recursive_lock_w(rte_ticketlock_recursive_t *tlr) { - rte_ticketlock_recursive_lock(tlr); -} -void rte_ticketlock_recursive_unlock_w(rte_ticketlock_recursive_t *tlr) { - rte_ticketlock_recursive_unlock(tlr); -} -int rte_ticketlock_recursive_trylock_w(rte_ticketlock_recursive_t *tlr) { - return rte_ticketlock_recursive_trylock(tlr); -} -uint64_t rte_cyclecounter_cycles_to_ns_w(struct rte_timecounter *tc, - uint64_t cycles) { - return rte_cyclecounter_cycles_to_ns(tc, cycles); -} -uint64_t rte_timecounter_update_w(struct rte_timecounter *tc, - uint64_t cycle_now) { - return rte_timecounter_update(tc, cycle_now); -} -uint64_t rte_timespec_to_ns_w(const struct timespec *ts) { - return rte_timespec_to_ns(ts); -} -struct timespec rte_ns_to_timespec_w(uint64_t nsec) { - return rte_ns_to_timespec(nsec); -} -bool rte_trace_feature_is_enabled_w(void) { - return rte_trace_feature_is_enabled(); -} diff --git a/nix/pkgs/dpdk/default.nix b/nix/pkgs/dpdk/default.nix index bc7b394de..ab1e0010d 100644 --- a/nix/pkgs/dpdk/default.nix +++ b/nix/pkgs/dpdk/default.nix @@ -294,6 +294,7 @@ stdenv.mkDerivation { ''-Ddisable_drivers=${lib.concatStringsSep "," disabledDrivers}'' ''-Denable_drivers=${lib.concatStringsSep "," enabledDrivers}'' ''-Denable_libs=${lib.concatStringsSep "," enabledLibs}'' + ''-Ddisable_apps=*'' ''-Ddisable_libs=${lib.concatStringsSep "," disabledLibs}'' ] ++ (if isCrossCompile then [ ''--cross-file=${cross-file}'' ] else [ ]); diff --git a/nix/target.nix b/nix/target.nix index 7bd0ebb0a..36cbe22ee 100644 --- a/nix/target.nix +++ b/nix/target.nix @@ -19,12 +19,7 @@ let NIX_CFLAGS_LINK = [ ]; }; dpdk = { - buildInputs = { - rdma-core = true; - libbsd = true; - libnl = true; - numactl = true; - }; + buildInputs = { }; }; }; }; @@ -67,10 +62,7 @@ let }; dpdk = { buildInputs = { - rdma-core = true; - libbsd = true; - libnl = true; - numactl = false; + numactl = null; }; }; }; diff --git a/shell.nix b/shell.nix index 07970296c..ef124bdb4 100644 --- a/shell.nix +++ b/shell.nix @@ -2,25 +2,56 @@ # Copyright Open Network Fabric Authors { overlay ? "dataplane", - target ? "x86_64-unknown-linux-gnu", + platform ? "x86-64-v3", + libc ? "gnu", prof ? "debug", instrumentation ? "none", - sanitize ? "", - sources ? import ./npins, - pkgs ? import { }, + sanitize ? "address", }: -(pkgs.buildFHSEnv { - name = "dataplane-shell"; +let + d = import ./default.nix { + inherit + overlay + platform + libc + prof + instrumentation + sanitize + ; + }; + pkgs = import {}; +in +(d.pkgs-super.buildPackages.buildFHSEnv { + name = "dataplane-dev"; targetPkgs = - pkgs: - (with pkgs; [ - # dev tools - bash - direnv - just - nil - nixd - npins - wget - ]); + pkgs: with pkgs; [ + stdenv.cc.libc.dev + stdenv.cc.libc.out + # libmd.dev + # libmd.static + libbsd.dev + # libbsd.static + numactl.dev + # numactl.static + rdma-core.dev + # rdma-core.static + # dpdk.dev + # dpdk.static + # dpdk-wrapper.dev + # dpdk-wrapper.out + ]; + # (with pkgs.buildPackages; [ + # # dev tools + # bash + # direnv + # just + # nil + # nixd + # npins + # wget + # llvmPackages.bintools + # llvmPackages.clang + # llvmPackages.libclang.lib + # llvmPackages.lld + # ]); }).env diff --git a/sysroot b/sysroot index 761f3e8ec..22ffe82ea 120000 --- a/sysroot +++ b/sysroot @@ -1 +1 @@ -/nix/store/m1gsdy5xjrc396yk2m1h7nrdly5d6jw9-sysroot \ No newline at end of file +/nix/store/40gcqs5h4gbs9ixw16wbg9161mrxb0k2-sysroot \ No newline at end of file From a5f2ae2bfeb057dd82e5bb5cb059cd0d7770ce33 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 21 Dec 2025 17:29:01 +0000 Subject: [PATCH 063/163] wip --- .cargo/config.toml | 2 +- .clangd | 4 +- cli/build.rs | 2 +- dataplane/build.rs | 2 +- default.nix | 16 +- dpdk-sys/build.rs | 3 +- dpdk/build.rs | 2 +- dpdk/src/lcore.rs | 2 +- hardware/build.rs | 2 +- init/build.rs | 2 +- nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.c | 1513 --------------------- nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.h | 1517 +++++++++++++++++++++- nix/target.nix | 10 +- sysfs/build.rs | 2 +- sysroot | 1 - 15 files changed, 1551 insertions(+), 1529 deletions(-) mode change 100644 => 120000 .clangd delete mode 120000 sysroot diff --git a/.cargo/config.toml b/.cargo/config.toml index 5cafed729..32fb6467d 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,5 +1,5 @@ [env] -COMPILE_ENV = { value = "compile-env", relative = true, force = false } +COMPILE_ENV = { value = "sysroot", relative = true, force = false } PATH = { value = "compile-env/bin", relative = true, force = true } LIBCLANG_PATH = { value = "compile-env/lib", relative = true, force = true } PKG_CONFIG_PATH = { value = "compile-env/sysroot/x86_64-unknown-linux-gnu/release/lib/pkgconfig", relative = true, force = true } diff --git a/.clangd b/.clangd deleted file mode 100644 index bb03d2f22..000000000 --- a/.clangd +++ /dev/null @@ -1,3 +0,0 @@ -CompileFlags: - Add: - - "-I/home/dnoland/code/githedgehog/dataplane/sysroot/include" diff --git a/.clangd b/.clangd new file mode 120000 index 000000000..841886296 --- /dev/null +++ b/.clangd @@ -0,0 +1 @@ +./build-tools/.clangd \ No newline at end of file diff --git a/cli/build.rs b/cli/build.rs index 52f5b0197..9d7c9069b 100644 --- a/cli/build.rs +++ b/cli/build.rs @@ -4,5 +4,5 @@ fn main() { let sysroot = dpdk_sysroot_helper::get_sysroot(); println!("cargo:rustc-link-search=all={sysroot}/lib"); - println!("cargo:rustc-link-arg=--sysroot={sysroot}"); + // println!("cargo:rustc-link-arg=--sysroot={sysroot}"); } diff --git a/dataplane/build.rs b/dataplane/build.rs index 52f5b0197..9d7c9069b 100644 --- a/dataplane/build.rs +++ b/dataplane/build.rs @@ -4,5 +4,5 @@ fn main() { let sysroot = dpdk_sysroot_helper::get_sysroot(); println!("cargo:rustc-link-search=all={sysroot}/lib"); - println!("cargo:rustc-link-arg=--sysroot={sysroot}"); + // println!("cargo:rustc-link-arg=--sysroot={sysroot}"); } diff --git a/default.nix b/default.nix index e5ade058e..1fde49210 100644 --- a/default.nix +++ b/default.nix @@ -45,6 +45,8 @@ let libmd.static libbsd.dev libbsd.static + libnl.dev + libnl.static numactl.dev numactl.static rdma-core.dev @@ -74,11 +76,23 @@ pkgs.lib.fix (final: { name = "sysroot"; paths = sysroot-list; }; + clangd = pkgs.writeTextFile { + name = ".clangd"; + text = '' + CompileFlags: + Add: + - "-I${final.sysroot}/include" + - "-I${final.pkgs.dpdk.dev}/include" + - "-Wno-deprecated-declarations" + ''; + executable = false; + destination = "/.clangd"; + }; build-tools = with final.pkgs.buildPackages; symlinkJoin { name = "build-tools"; - paths = build-tools-list; + paths = build-tools-list ++ [ final.clangd ]; }; dev-shell = final.pkgs.symlinkJoin { name = "dataplane-dev-shell"; diff --git a/dpdk-sys/build.rs b/dpdk-sys/build.rs index 556af520a..1eac21991 100644 --- a/dpdk-sys/build.rs +++ b/dpdk-sys/build.rs @@ -71,7 +71,7 @@ fn main() { let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); let sysroot = dpdk_sysroot_helper::get_sysroot(); - println!("cargo:rustc-link-arg=--sysroot={sysroot}"); + // println!("cargo:rustc-link-arg=--sysroot={sysroot}"); println!("cargo:rustc-link-search=all={sysroot}/lib"); // NOTE: DPDK absolutely requires whole-archive in the linking command. @@ -100,6 +100,7 @@ fn main() { "rte_rcu", "rte_ring", "rte_eal", + "rte_argparse", "rte_kvargs", "rte_telemetry", "rte_log", diff --git a/dpdk/build.rs b/dpdk/build.rs index 52f5b0197..9d7c9069b 100644 --- a/dpdk/build.rs +++ b/dpdk/build.rs @@ -4,5 +4,5 @@ fn main() { let sysroot = dpdk_sysroot_helper::get_sysroot(); println!("cargo:rustc-link-search=all={sysroot}/lib"); - println!("cargo:rustc-link-arg=--sysroot={sysroot}"); + // println!("cargo:rustc-link-arg=--sysroot={sysroot}"); } diff --git a/dpdk/src/lcore.rs b/dpdk/src/lcore.rs index 7c35c7b97..12a4dbc48 100644 --- a/dpdk/src/lcore.rs +++ b/dpdk/src/lcore.rs @@ -237,7 +237,7 @@ impl LCoreId { #[tracing::instrument(level = "trace")] pub fn current() -> LCoreId { - LCoreId(unsafe { dpdk_sys::rte_lcore_id_w() }) + LCoreId(unsafe { dpdk_sys::rte_lcore_id() }) } #[tracing::instrument(level = "trace")] diff --git a/hardware/build.rs b/hardware/build.rs index 52f5b0197..9d7c9069b 100644 --- a/hardware/build.rs +++ b/hardware/build.rs @@ -4,5 +4,5 @@ fn main() { let sysroot = dpdk_sysroot_helper::get_sysroot(); println!("cargo:rustc-link-search=all={sysroot}/lib"); - println!("cargo:rustc-link-arg=--sysroot={sysroot}"); + // println!("cargo:rustc-link-arg=--sysroot={sysroot}"); } diff --git a/init/build.rs b/init/build.rs index 52f5b0197..9d7c9069b 100644 --- a/init/build.rs +++ b/init/build.rs @@ -4,5 +4,5 @@ fn main() { let sysroot = dpdk_sysroot_helper::get_sysroot(); println!("cargo:rustc-link-search=all={sysroot}/lib"); - println!("cargo:rustc-link-arg=--sysroot={sysroot}"); + // println!("cargo:rustc-link-arg=--sysroot={sysroot}"); } diff --git a/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.c b/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.c index 118e3fc13..c9a6f09b7 100644 --- a/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.c +++ b/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.c @@ -3,1516 +3,3 @@ #include "dpdk_wrapper.h" -int rte_errno_get() { return rte_errno; } - -// Static wrappers - -int rte_is_aligned_w(const const void *const ptr, const unsigned int align) { - return rte_is_aligned(ptr, align); -} -void rte_atomic_thread_fence_w(rte_memory_order memorder) { - rte_atomic_thread_fence(memorder); -} -int rte_atomic16_cmpset_w(uint16_t *dst, uint16_t exp, uint16_t src) { - return rte_atomic16_cmpset(dst, exp, src); -} -uint16_t rte_atomic16_exchange_w(uint16_t *dst, uint16_t val) { - return rte_atomic16_exchange(dst, val); -} -void rte_atomic16_init_w(rte_atomic16_t *v) { rte_atomic16_init(v); } -int16_t rte_atomic16_read_w(const rte_atomic16_t *v) { - return rte_atomic16_read(v); -} -void rte_atomic16_set_w(rte_atomic16_t *v, int16_t new_value) { - rte_atomic16_set(v, new_value); -} -void rte_atomic16_add_w(rte_atomic16_t *v, int16_t inc) { - rte_atomic16_add(v, inc); -} -void rte_atomic16_sub_w(rte_atomic16_t *v, int16_t dec) { - rte_atomic16_sub(v, dec); -} -void rte_atomic16_inc_w(rte_atomic16_t *v) { rte_atomic16_inc(v); } -void rte_atomic16_dec_w(rte_atomic16_t *v) { rte_atomic16_dec(v); } -int16_t rte_atomic16_add_return_w(rte_atomic16_t *v, int16_t inc) { - return rte_atomic16_add_return(v, inc); -} -int16_t rte_atomic16_sub_return_w(rte_atomic16_t *v, int16_t dec) { - return rte_atomic16_sub_return(v, dec); -} -int rte_atomic16_inc_and_test_w(rte_atomic16_t *v) { - return rte_atomic16_inc_and_test(v); -} -int rte_atomic16_dec_and_test_w(rte_atomic16_t *v) { - return rte_atomic16_dec_and_test(v); -} -int rte_atomic16_test_and_set_w(rte_atomic16_t *v) { - return rte_atomic16_test_and_set(v); -} -void rte_atomic16_clear_w(rte_atomic16_t *v) { rte_atomic16_clear(v); } -int rte_atomic32_cmpset_w(uint32_t *dst, uint32_t exp, uint32_t src) { - return rte_atomic32_cmpset(dst, exp, src); -} -uint32_t rte_atomic32_exchange_w(uint32_t *dst, uint32_t val) { - return rte_atomic32_exchange(dst, val); -} -void rte_atomic32_init_w(rte_atomic32_t *v) { rte_atomic32_init(v); } -int32_t rte_atomic32_read_w(const rte_atomic32_t *v) { - return rte_atomic32_read(v); -} -void rte_atomic32_set_w(rte_atomic32_t *v, int32_t new_value) { - rte_atomic32_set(v, new_value); -} -void rte_atomic32_add_w(rte_atomic32_t *v, int32_t inc) { - rte_atomic32_add(v, inc); -} -void rte_atomic32_sub_w(rte_atomic32_t *v, int32_t dec) { - rte_atomic32_sub(v, dec); -} -void rte_atomic32_inc_w(rte_atomic32_t *v) { rte_atomic32_inc(v); } -void rte_atomic32_dec_w(rte_atomic32_t *v) { rte_atomic32_dec(v); } -int32_t rte_atomic32_add_return_w(rte_atomic32_t *v, int32_t inc) { - return rte_atomic32_add_return(v, inc); -} -int32_t rte_atomic32_sub_return_w(rte_atomic32_t *v, int32_t dec) { - return rte_atomic32_sub_return(v, dec); -} -int rte_atomic32_inc_and_test_w(rte_atomic32_t *v) { - return rte_atomic32_inc_and_test(v); -} -int rte_atomic32_dec_and_test_w(rte_atomic32_t *v) { - return rte_atomic32_dec_and_test(v); -} -int rte_atomic32_test_and_set_w(rte_atomic32_t *v) { - return rte_atomic32_test_and_set(v); -} -void rte_atomic32_clear_w(rte_atomic32_t *v) { rte_atomic32_clear(v); } -int rte_atomic64_cmpset_w(uint64_t *dst, uint64_t exp, uint64_t src) { - return rte_atomic64_cmpset(dst, exp, src); -} -uint64_t rte_atomic64_exchange_w(uint64_t *dst, uint64_t val) { - return rte_atomic64_exchange(dst, val); -} -void rte_atomic64_init_w(rte_atomic64_t *v) { rte_atomic64_init(v); } -int64_t rte_atomic64_read_w(rte_atomic64_t *v) { return rte_atomic64_read(v); } -void rte_atomic64_set_w(rte_atomic64_t *v, int64_t new_value) { - rte_atomic64_set(v, new_value); -} -void rte_atomic64_add_w(rte_atomic64_t *v, int64_t inc) { - rte_atomic64_add(v, inc); -} -void rte_atomic64_sub_w(rte_atomic64_t *v, int64_t dec) { - rte_atomic64_sub(v, dec); -} -void rte_atomic64_inc_w(rte_atomic64_t *v) { rte_atomic64_inc(v); } -void rte_atomic64_dec_w(rte_atomic64_t *v) { rte_atomic64_dec(v); } -int64_t rte_atomic64_add_return_w(rte_atomic64_t *v, int64_t inc) { - return rte_atomic64_add_return(v, inc); -} -int64_t rte_atomic64_sub_return_w(rte_atomic64_t *v, int64_t dec) { - return rte_atomic64_sub_return(v, dec); -} -int rte_atomic64_inc_and_test_w(rte_atomic64_t *v) { - return rte_atomic64_inc_and_test(v); -} -int rte_atomic64_dec_and_test_w(rte_atomic64_t *v) { - return rte_atomic64_dec_and_test(v); -} -int rte_atomic64_test_and_set_w(rte_atomic64_t *v) { - return rte_atomic64_test_and_set(v); -} -void rte_atomic64_clear_w(rte_atomic64_t *v) { rte_atomic64_clear(v); } -void rte_smp_mb_w(void) { rte_smp_mb(); } -uint64_t rte_get_tsc_cycles_w(void) { return rte_get_tsc_cycles(); } -uint64_t rte_get_timer_cycles_w(void) { return rte_get_timer_cycles(); } -uint64_t rte_get_timer_hz_w(void) { return rte_get_timer_hz(); } -void rte_delay_ms_w(unsigned int ms) { rte_delay_ms(ms); } -uint64_t rte_rdtsc_w(void) { return rte_rdtsc(); } -uint64_t rte_rdtsc_precise_w(void) { return rte_rdtsc_precise(); } -size_t rte_strlcpy_w(char *dst, const char *src, size_t size) { - return rte_strlcpy(dst, src, size); -} -size_t rte_strlcat_w(char *dst, const char *src, size_t size) { - return rte_strlcat(dst, src, size); -} -const char *rte_str_skip_leading_spaces_w(const char *src) { - return rte_str_skip_leading_spaces(src); -} -void rte_uuid_copy_w(rte_uuid_t dst, const rte_uuid_t src) { - rte_uuid_copy(dst, src); -} -int rte_gettid_w(void) { return rte_gettid(); } -unsigned int rte_lcore_id_w(void) { return rte_lcore_id(); } -void rte_pause_w(void) { rte_pause(); } -void rte_wait_until_equal_16_w(uint16_t *addr, uint16_t expected, - rte_memory_order memorder) { - rte_wait_until_equal_16(addr, expected, memorder); -} -void rte_wait_until_equal_32_w(uint32_t *addr, uint32_t expected, - rte_memory_order memorder) { - rte_wait_until_equal_32(addr, expected, memorder); -} -void rte_wait_until_equal_64_w(uint64_t *addr, uint64_t expected, - rte_memory_order memorder) { - rte_wait_until_equal_64(addr, expected, memorder); -} -void rte_spinlock_init_w(rte_spinlock_t *sl) { rte_spinlock_init(sl); } -void rte_spinlock_lock_w(rte_spinlock_t *sl) { rte_spinlock_lock(sl); } -void rte_spinlock_unlock_w(rte_spinlock_t *sl) { rte_spinlock_unlock(sl); } -int rte_spinlock_trylock_w(rte_spinlock_t *sl) { - return rte_spinlock_trylock(sl); -} -int rte_spinlock_is_locked_w(rte_spinlock_t *sl) { - return rte_spinlock_is_locked(sl); -} -int rte_tm_supported_w(void) { return rte_tm_supported(); } -void rte_spinlock_lock_tm_w(rte_spinlock_t *sl) { rte_spinlock_lock_tm(sl); } -void rte_spinlock_unlock_tm_w(rte_spinlock_t *sl) { - rte_spinlock_unlock_tm(sl); -} -int rte_spinlock_trylock_tm_w(rte_spinlock_t *sl) { - return rte_spinlock_trylock_tm(sl); -} -void rte_spinlock_recursive_init_w(rte_spinlock_recursive_t *slr) { - rte_spinlock_recursive_init(slr); -} -void rte_spinlock_recursive_lock_w(rte_spinlock_recursive_t *slr) { - rte_spinlock_recursive_lock(slr); -} -void rte_spinlock_recursive_unlock_w(rte_spinlock_recursive_t *slr) { - rte_spinlock_recursive_unlock(slr); -} -int rte_spinlock_recursive_trylock_w(rte_spinlock_recursive_t *slr) { - return rte_spinlock_recursive_trylock(slr); -} -void rte_spinlock_recursive_lock_tm_w(rte_spinlock_recursive_t *slr) { - rte_spinlock_recursive_lock_tm(slr); -} -void rte_spinlock_recursive_unlock_tm_w(rte_spinlock_recursive_t *slr) { - rte_spinlock_recursive_unlock_tm(slr); -} -int rte_spinlock_recursive_trylock_tm_w(rte_spinlock_recursive_t *slr) { - return rte_spinlock_recursive_trylock_tm(slr); -} -// unsigned int rte_xbegin_w(void) { return rte_xbegin(); } -// void rte_xend_w(void) { rte_xend(); } -// int rte_xtest_w(void) { return rte_xtest(); } -// int rte_try_tm_w(int *lock) { return rte_try_tm(lock); } -uint32_t rte_bit_relaxed_get32_w(unsigned int nr, uint32_t *addr) { - return rte_bit_relaxed_get32(nr, addr); -} -void rte_bit_relaxed_set32_w(unsigned int nr, uint32_t *addr) { - rte_bit_relaxed_set32(nr, addr); -} -void rte_bit_relaxed_clear32_w(unsigned int nr, uint32_t *addr) { - rte_bit_relaxed_clear32(nr, addr); -} -uint32_t rte_bit_relaxed_test_and_set32_w(unsigned int nr, uint32_t *addr) { - return rte_bit_relaxed_test_and_set32(nr, addr); -} -uint32_t rte_bit_relaxed_test_and_clear32_w(unsigned int nr, uint32_t *addr) { - return rte_bit_relaxed_test_and_clear32(nr, addr); -} -uint64_t rte_bit_relaxed_get64_w(unsigned int nr, uint64_t *addr) { - return rte_bit_relaxed_get64(nr, addr); -} -void rte_bit_relaxed_set64_w(unsigned int nr, uint64_t *addr) { - rte_bit_relaxed_set64(nr, addr); -} -void rte_bit_relaxed_clear64_w(unsigned int nr, uint64_t *addr) { - rte_bit_relaxed_clear64(nr, addr); -} -uint64_t rte_bit_relaxed_test_and_set64_w(unsigned int nr, uint64_t *addr) { - return rte_bit_relaxed_test_and_set64(nr, addr); -} -uint64_t rte_bit_relaxed_test_and_clear64_w(unsigned int nr, uint64_t *addr) { - return rte_bit_relaxed_test_and_clear64(nr, addr); -} -unsigned int rte_clz32_w(uint32_t v) { return rte_clz32(v); } -unsigned int rte_clz64_w(uint64_t v) { return rte_clz64(v); } -unsigned int rte_ctz32_w(uint32_t v) { return rte_ctz32(v); } -unsigned int rte_ctz64_w(uint64_t v) { return rte_ctz64(v); } -unsigned int rte_popcount32_w(uint32_t v) { return rte_popcount32(v); } -unsigned int rte_popcount64_w(uint64_t v) { return rte_popcount64(v); } -uint32_t rte_combine32ms1b_w(uint32_t x) { return rte_combine32ms1b(x); } -uint64_t rte_combine64ms1b_w(uint64_t v) { return rte_combine64ms1b(v); } -uint32_t rte_bsf32_w(uint32_t v) { return rte_bsf32(v); } -int rte_bsf32_safe_w(uint32_t v, uint32_t *pos) { - return rte_bsf32_safe(v, pos); -} -uint32_t rte_bsf64_w(uint64_t v) { return rte_bsf64(v); } -int rte_bsf64_safe_w(uint64_t v, uint32_t *pos) { - return rte_bsf64_safe(v, pos); -} -uint32_t rte_fls_u32_w(uint32_t x) { return rte_fls_u32(x); } -uint32_t rte_fls_u64_w(uint64_t x) { return rte_fls_u64(x); } -int rte_is_power_of_2_w(uint32_t n) { return rte_is_power_of_2(n); } -uint32_t rte_align32pow2_w(uint32_t x) { return rte_align32pow2(x); } -uint32_t rte_align32prevpow2_w(uint32_t x) { return rte_align32prevpow2(x); } -uint64_t rte_align64pow2_w(uint64_t v) { return rte_align64pow2(v); } -uint64_t rte_align64prevpow2_w(uint64_t v) { return rte_align64prevpow2(v); } -uint32_t rte_log2_u32_w(uint32_t v) { return rte_log2_u32(v); } -uint32_t rte_log2_u64_w(uint64_t v) { return rte_log2_u64(v); } -void rte_rwlock_init_w(rte_rwlock_t *rwl) { rte_rwlock_init(rwl); } -void rte_rwlock_read_lock_w(rte_rwlock_t *rwl) { rte_rwlock_read_lock(rwl); } -int rte_rwlock_read_trylock_w(rte_rwlock_t *rwl) { - return rte_rwlock_read_trylock(rwl); -} -void rte_rwlock_read_unlock_w(rte_rwlock_t *rwl) { - rte_rwlock_read_unlock(rwl); -} -int rte_rwlock_write_trylock_w(rte_rwlock_t *rwl) { - return rte_rwlock_write_trylock(rwl); -} -void rte_rwlock_write_lock_w(rte_rwlock_t *rwl) { rte_rwlock_write_lock(rwl); } -void rte_rwlock_write_unlock_w(rte_rwlock_t *rwl) { - rte_rwlock_write_unlock(rwl); -} -int rte_rwlock_write_is_locked_w(rte_rwlock_t *rwl) { - return rte_rwlock_write_is_locked(rwl); -} -void rte_rwlock_read_lock_tm_w(rte_rwlock_t *rwl) { - rte_rwlock_read_lock_tm(rwl); -} -void rte_rwlock_read_unlock_tm_w(rte_rwlock_t *rwl) { - rte_rwlock_read_unlock_tm(rwl); -} -void rte_rwlock_write_lock_tm_w(rte_rwlock_t *rwl) { - rte_rwlock_write_lock_tm(rwl); -} -void rte_rwlock_write_unlock_tm_w(rte_rwlock_t *rwl) { - rte_rwlock_write_unlock_tm(rwl); -} -unsigned int rte_ring_mp_enqueue_bulk_elem_w(struct rte_ring *r, - const void *obj_table, - unsigned int esize, unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_enqueue_bulk_elem(r, obj_table, esize, n, free_space); -} -unsigned int rte_ring_sp_enqueue_bulk_elem_w(struct rte_ring *r, - const void *obj_table, - unsigned int esize, unsigned int n, - unsigned int *free_space) { - return rte_ring_sp_enqueue_bulk_elem(r, obj_table, esize, n, free_space); -} -unsigned int rte_ring_mp_hts_enqueue_bulk_elem_w(struct rte_ring *r, - const void *obj_table, - unsigned int esize, - unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_hts_enqueue_bulk_elem(r, obj_table, esize, n, free_space); -} -unsigned int rte_ring_mc_hts_dequeue_bulk_elem_w(struct rte_ring *r, - void *obj_table, - unsigned int esize, - unsigned int n, - unsigned int *available) { - return rte_ring_mc_hts_dequeue_bulk_elem(r, obj_table, esize, n, available); -} -unsigned int rte_ring_mp_hts_enqueue_burst_elem_w(struct rte_ring *r, - const void *obj_table, - unsigned int esize, - unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_hts_enqueue_burst_elem(r, obj_table, esize, n, free_space); -} -unsigned int rte_ring_mc_hts_dequeue_burst_elem_w(struct rte_ring *r, - void *obj_table, - unsigned int esize, - unsigned int n, - unsigned int *available) { - return rte_ring_mc_hts_dequeue_burst_elem(r, obj_table, esize, n, available); -} -unsigned int rte_ring_mp_hts_enqueue_bulk_w(struct rte_ring *r, - void *const *obj_table, - unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_hts_enqueue_bulk(r, obj_table, n, free_space); -} -unsigned int rte_ring_mc_hts_dequeue_bulk_w(struct rte_ring *r, - void **obj_table, unsigned int n, - unsigned int *available) { - return rte_ring_mc_hts_dequeue_bulk(r, obj_table, n, available); -} -unsigned int rte_ring_mp_hts_enqueue_burst_w(struct rte_ring *r, - void *const *obj_table, - unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_hts_enqueue_burst(r, obj_table, n, free_space); -} -unsigned int rte_ring_mc_hts_dequeue_burst_w(struct rte_ring *r, - void **obj_table, unsigned int n, - unsigned int *available) { - return rte_ring_mc_hts_dequeue_burst(r, obj_table, n, available); -} -unsigned int rte_ring_mp_rts_enqueue_bulk_elem_w(struct rte_ring *r, - const void *obj_table, - unsigned int esize, - unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_rts_enqueue_bulk_elem(r, obj_table, esize, n, free_space); -} -unsigned int rte_ring_mc_rts_dequeue_bulk_elem_w(struct rte_ring *r, - void *obj_table, - unsigned int esize, - unsigned int n, - unsigned int *available) { - return rte_ring_mc_rts_dequeue_bulk_elem(r, obj_table, esize, n, available); -} -unsigned int rte_ring_mp_rts_enqueue_burst_elem_w(struct rte_ring *r, - const void *obj_table, - unsigned int esize, - unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_rts_enqueue_burst_elem(r, obj_table, esize, n, free_space); -} -unsigned int rte_ring_mc_rts_dequeue_burst_elem_w(struct rte_ring *r, - void *obj_table, - unsigned int esize, - unsigned int n, - unsigned int *available) { - return rte_ring_mc_rts_dequeue_burst_elem(r, obj_table, esize, n, available); -} -unsigned int rte_ring_mp_rts_enqueue_bulk_w(struct rte_ring *r, - void *const *obj_table, - unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_rts_enqueue_bulk(r, obj_table, n, free_space); -} -unsigned int rte_ring_mc_rts_dequeue_bulk_w(struct rte_ring *r, - void **obj_table, unsigned int n, - unsigned int *available) { - return rte_ring_mc_rts_dequeue_bulk(r, obj_table, n, available); -} -unsigned int rte_ring_mp_rts_enqueue_burst_w(struct rte_ring *r, - void *const *obj_table, - unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_rts_enqueue_burst(r, obj_table, n, free_space); -} -unsigned int rte_ring_mc_rts_dequeue_burst_w(struct rte_ring *r, - void **obj_table, unsigned int n, - unsigned int *available) { - return rte_ring_mc_rts_dequeue_burst(r, obj_table, n, available); -} -uint32_t rte_ring_get_prod_htd_max_w(const struct rte_ring *r) { - return rte_ring_get_prod_htd_max(r); -} -int rte_ring_set_prod_htd_max_w(struct rte_ring *r, uint32_t v) { - return rte_ring_set_prod_htd_max(r, v); -} -uint32_t rte_ring_get_cons_htd_max_w(const struct rte_ring *r) { - return rte_ring_get_cons_htd_max(r); -} -int rte_ring_set_cons_htd_max_w(struct rte_ring *r, uint32_t v) { - return rte_ring_set_cons_htd_max(r, v); -} -unsigned int rte_ring_enqueue_bulk_elem_w(struct rte_ring *r, - const void *obj_table, - unsigned int esize, unsigned int n, - unsigned int *free_space) { - return rte_ring_enqueue_bulk_elem(r, obj_table, esize, n, free_space); -} -int rte_ring_mp_enqueue_elem_w(struct rte_ring *r, void *obj, - unsigned int esize) { - return rte_ring_mp_enqueue_elem(r, obj, esize); -} -int rte_ring_sp_enqueue_elem_w(struct rte_ring *r, void *obj, - unsigned int esize) { - return rte_ring_sp_enqueue_elem(r, obj, esize); -} -int rte_ring_enqueue_elem_w(struct rte_ring *r, void *obj, unsigned int esize) { - return rte_ring_enqueue_elem(r, obj, esize); -} -unsigned int rte_ring_mc_dequeue_bulk_elem_w(struct rte_ring *r, - void *obj_table, - unsigned int esize, unsigned int n, - unsigned int *available) { - return rte_ring_mc_dequeue_bulk_elem(r, obj_table, esize, n, available); -} -unsigned int rte_ring_sc_dequeue_bulk_elem_w(struct rte_ring *r, - void *obj_table, - unsigned int esize, unsigned int n, - unsigned int *available) { - return rte_ring_sc_dequeue_bulk_elem(r, obj_table, esize, n, available); -} -unsigned int rte_ring_dequeue_bulk_elem_w(struct rte_ring *r, void *obj_table, - unsigned int esize, unsigned int n, - unsigned int *available) { - return rte_ring_dequeue_bulk_elem(r, obj_table, esize, n, available); -} -int rte_ring_mc_dequeue_elem_w(struct rte_ring *r, void *obj_p, - unsigned int esize) { - return rte_ring_mc_dequeue_elem(r, obj_p, esize); -} -int rte_ring_sc_dequeue_elem_w(struct rte_ring *r, void *obj_p, - unsigned int esize) { - return rte_ring_sc_dequeue_elem(r, obj_p, esize); -} -int rte_ring_dequeue_elem_w(struct rte_ring *r, void *obj_p, - unsigned int esize) { - return rte_ring_dequeue_elem(r, obj_p, esize); -} -unsigned int rte_ring_mp_enqueue_burst_elem_w(struct rte_ring *r, - const void *obj_table, - unsigned int esize, - unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_enqueue_burst_elem(r, obj_table, esize, n, free_space); -} -unsigned int rte_ring_sp_enqueue_burst_elem_w(struct rte_ring *r, - const void *obj_table, - unsigned int esize, - unsigned int n, - unsigned int *free_space) { - return rte_ring_sp_enqueue_burst_elem(r, obj_table, esize, n, free_space); -} -unsigned int rte_ring_enqueue_burst_elem_w(struct rte_ring *r, - const void *obj_table, - unsigned int esize, unsigned int n, - unsigned int *free_space) { - return rte_ring_enqueue_burst_elem(r, obj_table, esize, n, free_space); -} -unsigned int rte_ring_mc_dequeue_burst_elem_w(struct rte_ring *r, - void *obj_table, - unsigned int esize, - unsigned int n, - unsigned int *available) { - return rte_ring_mc_dequeue_burst_elem(r, obj_table, esize, n, available); -} -unsigned int rte_ring_sc_dequeue_burst_elem_w(struct rte_ring *r, - void *obj_table, - unsigned int esize, - unsigned int n, - unsigned int *available) { - return rte_ring_sc_dequeue_burst_elem(r, obj_table, esize, n, available); -} -unsigned int rte_ring_dequeue_burst_elem_w(struct rte_ring *r, void *obj_table, - unsigned int esize, unsigned int n, - unsigned int *available) { - return rte_ring_dequeue_burst_elem(r, obj_table, esize, n, available); -} -unsigned int rte_ring_enqueue_bulk_elem_start_w(struct rte_ring *r, - unsigned int n, - unsigned int *free_space) { - return rte_ring_enqueue_bulk_elem_start(r, n, free_space); -} -unsigned int rte_ring_enqueue_bulk_start_w(struct rte_ring *r, unsigned int n, - unsigned int *free_space) { - return rte_ring_enqueue_bulk_start(r, n, free_space); -} -unsigned int rte_ring_enqueue_burst_elem_start_w(struct rte_ring *r, - unsigned int n, - unsigned int *free_space) { - return rte_ring_enqueue_burst_elem_start(r, n, free_space); -} -unsigned int rte_ring_enqueue_burst_start_w(struct rte_ring *r, unsigned int n, - unsigned int *free_space) { - return rte_ring_enqueue_burst_start(r, n, free_space); -} -void rte_ring_enqueue_elem_finish_w(struct rte_ring *r, const void *obj_table, - unsigned int esize, unsigned int n) { - rte_ring_enqueue_elem_finish(r, obj_table, esize, n); -} -void rte_ring_enqueue_finish_w(struct rte_ring *r, void *const *obj_table, - unsigned int n) { - rte_ring_enqueue_finish(r, obj_table, n); -} -unsigned int rte_ring_dequeue_bulk_elem_start_w(struct rte_ring *r, - void *obj_table, - unsigned int esize, - unsigned int n, - unsigned int *available) { - return rte_ring_dequeue_bulk_elem_start(r, obj_table, esize, n, available); -} -unsigned int rte_ring_dequeue_bulk_start_w(struct rte_ring *r, void **obj_table, - unsigned int n, - unsigned int *available) { - return rte_ring_dequeue_bulk_start(r, obj_table, n, available); -} -unsigned int rte_ring_dequeue_burst_elem_start_w(struct rte_ring *r, - void *obj_table, - unsigned int esize, - unsigned int n, - unsigned int *available) { - return rte_ring_dequeue_burst_elem_start(r, obj_table, esize, n, available); -} -unsigned int rte_ring_dequeue_burst_start_w(struct rte_ring *r, - void **obj_table, unsigned int n, - unsigned int *available) { - return rte_ring_dequeue_burst_start(r, obj_table, n, available); -} -void rte_ring_dequeue_elem_finish_w(struct rte_ring *r, unsigned int n) { - rte_ring_dequeue_elem_finish(r, n); -} -void rte_ring_dequeue_finish_w(struct rte_ring *r, unsigned int n) { - rte_ring_dequeue_finish(r, n); -} -unsigned int rte_ring_enqueue_zc_bulk_elem_start_w(struct rte_ring *r, - unsigned int esize, - unsigned int n, - struct rte_ring_zc_data *zcd, - unsigned int *free_space) { - return rte_ring_enqueue_zc_bulk_elem_start(r, esize, n, zcd, free_space); -} -unsigned int rte_ring_enqueue_zc_bulk_start_w(struct rte_ring *r, - unsigned int n, - struct rte_ring_zc_data *zcd, - unsigned int *free_space) { - return rte_ring_enqueue_zc_bulk_start(r, n, zcd, free_space); -} -unsigned int rte_ring_enqueue_zc_burst_elem_start_w( - struct rte_ring *r, unsigned int esize, unsigned int n, - struct rte_ring_zc_data *zcd, unsigned int *free_space) { - return rte_ring_enqueue_zc_burst_elem_start(r, esize, n, zcd, free_space); -} -unsigned int rte_ring_enqueue_zc_burst_start_w(struct rte_ring *r, - unsigned int n, - struct rte_ring_zc_data *zcd, - unsigned int *free_space) { - return rte_ring_enqueue_zc_burst_start(r, n, zcd, free_space); -} -void rte_ring_enqueue_zc_elem_finish_w(struct rte_ring *r, unsigned int n) { - rte_ring_enqueue_zc_elem_finish(r, n); -} -void rte_ring_enqueue_zc_finish_w(struct rte_ring *r, unsigned int n) { - rte_ring_enqueue_zc_finish(r, n); -} -unsigned int rte_ring_dequeue_zc_bulk_elem_start_w(struct rte_ring *r, - unsigned int esize, - unsigned int n, - struct rte_ring_zc_data *zcd, - unsigned int *available) { - return rte_ring_dequeue_zc_bulk_elem_start(r, esize, n, zcd, available); -} -unsigned int rte_ring_dequeue_zc_bulk_start_w(struct rte_ring *r, - unsigned int n, - struct rte_ring_zc_data *zcd, - unsigned int *available) { - return rte_ring_dequeue_zc_bulk_start(r, n, zcd, available); -} -unsigned int rte_ring_dequeue_zc_burst_elem_start_w( - struct rte_ring *r, unsigned int esize, unsigned int n, - struct rte_ring_zc_data *zcd, unsigned int *available) { - return rte_ring_dequeue_zc_burst_elem_start(r, esize, n, zcd, available); -} -unsigned int rte_ring_dequeue_zc_burst_start_w(struct rte_ring *r, - unsigned int n, - struct rte_ring_zc_data *zcd, - unsigned int *available) { - return rte_ring_dequeue_zc_burst_start(r, n, zcd, available); -} -void rte_ring_dequeue_zc_elem_finish_w(struct rte_ring *r, unsigned int n) { - rte_ring_dequeue_zc_elem_finish(r, n); -} -void rte_ring_dequeue_zc_finish_w(struct rte_ring *r, unsigned int n) { - rte_ring_dequeue_zc_finish(r, n); -} -unsigned int rte_ring_mp_enqueue_bulk_w(struct rte_ring *r, - void *const *obj_table, unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_enqueue_bulk(r, obj_table, n, free_space); -} -unsigned int rte_ring_sp_enqueue_bulk_w(struct rte_ring *r, - void *const *obj_table, unsigned int n, - unsigned int *free_space) { - return rte_ring_sp_enqueue_bulk(r, obj_table, n, free_space); -} -unsigned int rte_ring_enqueue_bulk_w(struct rte_ring *r, void *const *obj_table, - unsigned int n, unsigned int *free_space) { - return rte_ring_enqueue_bulk(r, obj_table, n, free_space); -} -int rte_ring_mp_enqueue_w(struct rte_ring *r, void *obj) { - return rte_ring_mp_enqueue(r, obj); -} -int rte_ring_sp_enqueue_w(struct rte_ring *r, void *obj) { - return rte_ring_sp_enqueue(r, obj); -} -int rte_ring_enqueue_w(struct rte_ring *r, void *obj) { - return rte_ring_enqueue(r, obj); -} -unsigned int rte_ring_mc_dequeue_bulk_w(struct rte_ring *r, void **obj_table, - unsigned int n, - unsigned int *available) { - return rte_ring_mc_dequeue_bulk(r, obj_table, n, available); -} -unsigned int rte_ring_sc_dequeue_bulk_w(struct rte_ring *r, void **obj_table, - unsigned int n, - unsigned int *available) { - return rte_ring_sc_dequeue_bulk(r, obj_table, n, available); -} -unsigned int rte_ring_dequeue_bulk_w(struct rte_ring *r, void **obj_table, - unsigned int n, unsigned int *available) { - return rte_ring_dequeue_bulk(r, obj_table, n, available); -} -int rte_ring_mc_dequeue_w(struct rte_ring *r, void **obj_p) { - return rte_ring_mc_dequeue(r, obj_p); -} -int rte_ring_sc_dequeue_w(struct rte_ring *r, void **obj_p) { - return rte_ring_sc_dequeue(r, obj_p); -} -int rte_ring_dequeue_w(struct rte_ring *r, void **obj_p) { - return rte_ring_dequeue(r, obj_p); -} -unsigned int rte_ring_count_w(const struct rte_ring *r) { - return rte_ring_count(r); -} -unsigned int rte_ring_free_count_w(const struct rte_ring *r) { - return rte_ring_free_count(r); -} -int rte_ring_full_w(const struct rte_ring *r) { return rte_ring_full(r); } -int rte_ring_empty_w(const struct rte_ring *r) { return rte_ring_empty(r); } -unsigned int rte_ring_get_size_w(const struct rte_ring *r) { - return rte_ring_get_size(r); -} -unsigned int rte_ring_get_capacity_w(const struct rte_ring *r) { - return rte_ring_get_capacity(r); -} -enum rte_ring_sync_type -rte_ring_get_prod_sync_type_w(const struct rte_ring *r) { - return rte_ring_get_prod_sync_type(r); -} -int rte_ring_is_prod_single_w(const struct rte_ring *r) { - return rte_ring_is_prod_single(r); -} -enum rte_ring_sync_type -rte_ring_get_cons_sync_type_w(const struct rte_ring *r) { - return rte_ring_get_cons_sync_type(r); -} -int rte_ring_is_cons_single_w(const struct rte_ring *r) { - return rte_ring_is_cons_single(r); -} -unsigned int rte_ring_mp_enqueue_burst_w(struct rte_ring *r, - void *const *obj_table, unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_enqueue_burst(r, obj_table, n, free_space); -} -unsigned int rte_ring_sp_enqueue_burst_w(struct rte_ring *r, - void *const *obj_table, unsigned int n, - unsigned int *free_space) { - return rte_ring_sp_enqueue_burst(r, obj_table, n, free_space); -} -unsigned int rte_ring_enqueue_burst_w(struct rte_ring *r, - void *const *obj_table, unsigned int n, - unsigned int *free_space) { - return rte_ring_enqueue_burst(r, obj_table, n, free_space); -} -unsigned int rte_ring_mc_dequeue_burst_w(struct rte_ring *r, void **obj_table, - unsigned int n, - unsigned int *available) { - return rte_ring_mc_dequeue_burst(r, obj_table, n, available); -} -unsigned int rte_ring_sc_dequeue_burst_w(struct rte_ring *r, void **obj_table, - unsigned int n, - unsigned int *available) { - return rte_ring_sc_dequeue_burst(r, obj_table, n, available); -} -unsigned int rte_ring_dequeue_burst_w(struct rte_ring *r, void **obj_table, - unsigned int n, unsigned int *available) { - return rte_ring_dequeue_burst(r, obj_table, n, available); -} -void *rte_memcpy_w(void *dst, const void *src, size_t n) { - return rte_memcpy(dst, src, n); -} -// void *rte_mov15_or_less_w(void *dst, const void *src, size_t n) { -// return rte_mov15_or_less(dst, src, n); -// } -void rte_mov16_w(uint8_t *dst, const uint8_t *src) { rte_mov16(dst, src); } -void rte_mov32_w(uint8_t *dst, const uint8_t *src) { rte_mov32(dst, src); } -void rte_mov64_w(uint8_t *dst, const uint8_t *src) { rte_mov64(dst, src); } -void rte_mov256_w(uint8_t *dst, const uint8_t *src) { rte_mov256(dst, src); } -// void *rte_memcpy_generic_w(void *dst, const void *src, size_t n) { -// return rte_memcpy_generic(dst, src, n); -// } -// void *rte_memcpy_aligned_w(void *dst, const void *src, size_t n) { -// return rte_memcpy_aligned(dst, src, n); -// } -struct rte_mempool_objhdr *rte_mempool_get_header_w(void *obj) { - return rte_mempool_get_header(obj); -} -struct rte_mempool *rte_mempool_from_obj_w(void *obj) { - return rte_mempool_from_obj(obj); -} -struct rte_mempool_objtlr *rte_mempool_get_trailer_w(void *obj) { - return rte_mempool_get_trailer(obj); -} -struct rte_mempool_ops *rte_mempool_get_ops_w(int ops_index) { - return rte_mempool_get_ops(ops_index); -} -int rte_mempool_ops_dequeue_bulk_w(struct rte_mempool *mp, void **obj_table, - unsigned int n) { - return rte_mempool_ops_dequeue_bulk(mp, obj_table, n); -} -int rte_mempool_ops_dequeue_contig_blocks_w(struct rte_mempool *mp, - void **first_obj_table, - unsigned int n) { - return rte_mempool_ops_dequeue_contig_blocks(mp, first_obj_table, n); -} -int rte_mempool_ops_enqueue_bulk_w(struct rte_mempool *mp, - void *const *obj_table, unsigned int n) { - return rte_mempool_ops_enqueue_bulk(mp, obj_table, n); -} -struct rte_mempool_cache *rte_mempool_default_cache_w(struct rte_mempool *mp, - unsigned int lcore_id) { - return rte_mempool_default_cache(mp, lcore_id); -} -void rte_mempool_cache_flush_w(struct rte_mempool_cache *cache, - struct rte_mempool *mp) { - rte_mempool_cache_flush(cache, mp); -} -void rte_mempool_do_generic_put_w(struct rte_mempool *mp, - void *const *obj_table, unsigned int n, - struct rte_mempool_cache *cache) { - rte_mempool_do_generic_put(mp, obj_table, n, cache); -} -void rte_mempool_generic_put_w(struct rte_mempool *mp, void *const *obj_table, - unsigned int n, - struct rte_mempool_cache *cache) { - rte_mempool_generic_put(mp, obj_table, n, cache); -} -void rte_mempool_put_bulk_w(struct rte_mempool *mp, void *const *obj_table, - unsigned int n) { - rte_mempool_put_bulk(mp, obj_table, n); -} -void rte_mempool_put_w(struct rte_mempool *mp, void *obj) { - rte_mempool_put(mp, obj); -} -int rte_mempool_do_generic_get_w(struct rte_mempool *mp, void **obj_table, - unsigned int n, - struct rte_mempool_cache *cache) { - return rte_mempool_do_generic_get(mp, obj_table, n, cache); -} -int rte_mempool_generic_get_w(struct rte_mempool *mp, void **obj_table, - unsigned int n, struct rte_mempool_cache *cache) { - return rte_mempool_generic_get(mp, obj_table, n, cache); -} -int rte_mempool_get_bulk_w(struct rte_mempool *mp, void **obj_table, - unsigned int n) { - return rte_mempool_get_bulk(mp, obj_table, n); -} -int rte_mempool_get_w(struct rte_mempool *mp, void **obj_p) { - return rte_mempool_get(mp, obj_p); -} -int rte_mempool_get_contig_blocks_w(struct rte_mempool *mp, - void **first_obj_table, unsigned int n) { - return rte_mempool_get_contig_blocks(mp, first_obj_table, n); -} -int rte_mempool_full_w(const struct rte_mempool *mp) { - return rte_mempool_full(mp); -} -int rte_mempool_empty_w(const struct rte_mempool *mp) { - return rte_mempool_empty(mp); -} -rte_iova_t rte_mempool_virt2iova_w(const void *elt) { - return rte_mempool_virt2iova(elt); -} -void *rte_mempool_get_priv_w(struct rte_mempool *mp) { - return rte_mempool_get_priv(mp); -} -void rte_prefetch0_w(const void *p) { rte_prefetch0(p); } -void rte_prefetch1_w(const void *p) { rte_prefetch1(p); } -void rte_prefetch2_w(const void *p) { rte_prefetch2(p); } -void rte_prefetch_non_temporal_w(const void *p) { - rte_prefetch_non_temporal(p); -} -void rte_prefetch0_write_w(const void *p) { rte_prefetch0_write(p); } -void rte_prefetch1_write_w(const void *p) { rte_prefetch1_write(p); } -void rte_prefetch2_write_w(const void *p) { rte_prefetch2_write(p); } -void rte_cldemote_w(const void *p) { rte_cldemote(p); } -uint16_t rte_constant_bswap16_w(uint16_t x) { return rte_constant_bswap16(x); } -uint32_t rte_constant_bswap32_w(uint32_t x) { return rte_constant_bswap32(x); } -uint64_t rte_constant_bswap64_w(uint64_t x) { return rte_constant_bswap64(x); } -// uint16_t rte_arch_bswap16_w(uint16_t _x) { return rte_arch_bswap16(_x); } -// uint32_t rte_arch_bswap32_w(uint32_t _x) { return rte_arch_bswap32(_x); } -// uint64_t rte_arch_bswap64_w(uint64_t _x) { return rte_arch_bswap64(_x); } -void rte_mbuf_prefetch_part1_w(struct rte_mbuf *m) { - rte_mbuf_prefetch_part1(m); -} -void rte_mbuf_prefetch_part2_w(struct rte_mbuf *m) { - rte_mbuf_prefetch_part2(m); -} -uint16_t rte_pktmbuf_priv_size_w(struct rte_mempool *mp) { - return rte_pktmbuf_priv_size(mp); -} -rte_iova_t rte_mbuf_iova_get_w(const struct rte_mbuf *m) { - return rte_mbuf_iova_get(m); -} -void rte_mbuf_iova_set_w(struct rte_mbuf *m, rte_iova_t iova) { - rte_mbuf_iova_set(m, iova); -} -rte_iova_t rte_mbuf_data_iova_w(const struct rte_mbuf *mb) { - return rte_mbuf_data_iova(mb); -} -rte_iova_t rte_mbuf_data_iova_default_w(const struct rte_mbuf *mb) { - return rte_mbuf_data_iova_default(mb); -} -struct rte_mbuf *rte_mbuf_from_indirect_w(struct rte_mbuf *mi) { - return rte_mbuf_from_indirect(mi); -} -char *rte_mbuf_buf_addr_w(struct rte_mbuf *mb, struct rte_mempool *mp) { - return rte_mbuf_buf_addr(mb, mp); -} -char *rte_mbuf_data_addr_default_w(struct rte_mbuf *mb) { - return rte_mbuf_data_addr_default(mb); -} -char *rte_mbuf_to_baddr_w(struct rte_mbuf *md) { return rte_mbuf_to_baddr(md); } -void *rte_mbuf_to_priv_w(struct rte_mbuf *m) { return rte_mbuf_to_priv(m); } -uint32_t rte_pktmbuf_priv_flags_w(struct rte_mempool *mp) { - return rte_pktmbuf_priv_flags(mp); -} -uint16_t rte_mbuf_refcnt_read_w(const struct rte_mbuf *m) { - return rte_mbuf_refcnt_read(m); -} -void rte_mbuf_refcnt_set_w(struct rte_mbuf *m, uint16_t new_value) { - rte_mbuf_refcnt_set(m, new_value); -} -uint16_t rte_mbuf_refcnt_update_w(struct rte_mbuf *m, int16_t value) { - return rte_mbuf_refcnt_update(m, value); -} -uint16_t -rte_mbuf_ext_refcnt_read_w(const struct rte_mbuf_ext_shared_info *shinfo) { - return rte_mbuf_ext_refcnt_read(shinfo); -} -void rte_mbuf_ext_refcnt_set_w(struct rte_mbuf_ext_shared_info *shinfo, - uint16_t new_value) { - rte_mbuf_ext_refcnt_set(shinfo, new_value); -} -uint16_t rte_mbuf_ext_refcnt_update_w(struct rte_mbuf_ext_shared_info *shinfo, - int16_t value) { - return rte_mbuf_ext_refcnt_update(shinfo, value); -} -struct rte_mbuf *rte_mbuf_raw_alloc_w(struct rte_mempool *mp) { - return rte_mbuf_raw_alloc(mp); -} -void rte_mbuf_raw_free_w(struct rte_mbuf *m) { rte_mbuf_raw_free(m); } -uint16_t rte_pktmbuf_data_room_size_w(struct rte_mempool *mp) { - return rte_pktmbuf_data_room_size(mp); -} -void rte_pktmbuf_reset_headroom_w(struct rte_mbuf *m) { - rte_pktmbuf_reset_headroom(m); -} -void rte_pktmbuf_reset_w(struct rte_mbuf *m) { rte_pktmbuf_reset(m); } -struct rte_mbuf *rte_pktmbuf_alloc_w(struct rte_mempool *mp) { - return rte_pktmbuf_alloc(mp); -} -int rte_pktmbuf_alloc_bulk_w(struct rte_mempool *pool, struct rte_mbuf **mbufs, - unsigned int count) { - return rte_pktmbuf_alloc_bulk(pool, mbufs, count); -} -struct rte_mbuf_ext_shared_info * -rte_pktmbuf_ext_shinfo_init_helper_w(void *buf_addr, uint16_t *buf_len, - rte_mbuf_extbuf_free_callback_t free_cb, - void *fcb_opaque) { - return rte_pktmbuf_ext_shinfo_init_helper(buf_addr, buf_len, free_cb, - fcb_opaque); -} -void rte_pktmbuf_attach_extbuf_w(struct rte_mbuf *m, void *buf_addr, - rte_iova_t buf_iova, uint16_t buf_len, - struct rte_mbuf_ext_shared_info *shinfo) { - rte_pktmbuf_attach_extbuf(m, buf_addr, buf_iova, buf_len, shinfo); -} -void rte_mbuf_dynfield_copy_w(struct rte_mbuf *mdst, - const struct rte_mbuf *msrc) { - rte_mbuf_dynfield_copy(mdst, msrc); -} -void rte_pktmbuf_attach_w(struct rte_mbuf *mi, struct rte_mbuf *m) { - rte_pktmbuf_attach(mi, m); -} -void rte_pktmbuf_detach_w(struct rte_mbuf *m) { rte_pktmbuf_detach(m); } -struct rte_mbuf *rte_pktmbuf_prefree_seg_w(struct rte_mbuf *m) { - return rte_pktmbuf_prefree_seg(m); -} -void rte_pktmbuf_free_seg_w(struct rte_mbuf *m) { rte_pktmbuf_free_seg(m); } -void rte_pktmbuf_free_w(struct rte_mbuf *m) { rte_pktmbuf_free(m); } -void rte_pktmbuf_refcnt_update_w(struct rte_mbuf *m, int16_t v) { - rte_pktmbuf_refcnt_update(m, v); -} -uint16_t rte_pktmbuf_headroom_w(const struct rte_mbuf *m) { - return rte_pktmbuf_headroom(m); -} -uint16_t rte_pktmbuf_tailroom_w(const struct rte_mbuf *m) { - return rte_pktmbuf_tailroom(m); -} -struct rte_mbuf *rte_pktmbuf_lastseg_w(struct rte_mbuf *m) { - return rte_pktmbuf_lastseg(m); -} -char *rte_pktmbuf_prepend_w(struct rte_mbuf *m, uint16_t len) { - return rte_pktmbuf_prepend(m, len); -} -char *rte_pktmbuf_append_w(struct rte_mbuf *m, uint16_t len) { - return rte_pktmbuf_append(m, len); -} -char *rte_pktmbuf_adj_w(struct rte_mbuf *m, uint16_t len) { - return rte_pktmbuf_adj(m, len); -} -int rte_pktmbuf_trim_w(struct rte_mbuf *m, uint16_t len) { - return rte_pktmbuf_trim(m, len); -} -int rte_pktmbuf_is_contiguous_w(const struct rte_mbuf *m) { - return rte_pktmbuf_is_contiguous(m); -} -const void *rte_pktmbuf_read_w(const struct rte_mbuf *m, uint32_t off, - uint32_t len, void *buf) { - return rte_pktmbuf_read(m, off, len, buf); -} -int rte_pktmbuf_chain_w(struct rte_mbuf *head, struct rte_mbuf *tail) { - return rte_pktmbuf_chain(head, tail); -} -uint64_t rte_mbuf_tx_offload_w(uint64_t il2, uint64_t il3, uint64_t il4, - uint64_t tso, uint64_t ol3, uint64_t ol2, - uint64_t unused) { - return rte_mbuf_tx_offload(il2, il3, il4, tso, ol3, ol2, unused); -} -int rte_validate_tx_offload_w(const struct rte_mbuf *m) { - return rte_validate_tx_offload(m); -} -int rte_pktmbuf_linearize_w(struct rte_mbuf *mbuf) { - return rte_pktmbuf_linearize(mbuf); -} -uint32_t rte_mbuf_sched_queue_get_w(const struct rte_mbuf *m) { - return rte_mbuf_sched_queue_get(m); -} -uint8_t rte_mbuf_sched_traffic_class_get_w(const struct rte_mbuf *m) { - return rte_mbuf_sched_traffic_class_get(m); -} -uint8_t rte_mbuf_sched_color_get_w(const struct rte_mbuf *m) { - return rte_mbuf_sched_color_get(m); -} -void rte_mbuf_sched_get_w(const struct rte_mbuf *m, uint32_t *queue_id, - uint8_t *traffic_class, uint8_t *color) { - rte_mbuf_sched_get(m, queue_id, traffic_class, color); -} -void rte_mbuf_sched_queue_set_w(struct rte_mbuf *m, uint32_t queue_id) { - rte_mbuf_sched_queue_set(m, queue_id); -} -void rte_mbuf_sched_traffic_class_set_w(struct rte_mbuf *m, - uint8_t traffic_class) { - rte_mbuf_sched_traffic_class_set(m, traffic_class); -} -void rte_mbuf_sched_color_set_w(struct rte_mbuf *m, uint8_t color) { - rte_mbuf_sched_color_set(m, color); -} -void rte_mbuf_sched_set_w(struct rte_mbuf *m, uint32_t queue_id, - uint8_t traffic_class, uint8_t color) { - rte_mbuf_sched_set(m, queue_id, traffic_class, color); -} -int rte_is_same_ether_addr_w(const struct rte_ether_addr *ea1, - const struct rte_ether_addr *ea2) { - return rte_is_same_ether_addr(ea1, ea2); -} -int rte_is_zero_ether_addr_w(const struct rte_ether_addr *ea) { - return rte_is_zero_ether_addr(ea); -} -int rte_is_unicast_ether_addr_w(const struct rte_ether_addr *ea) { - return rte_is_unicast_ether_addr(ea); -} -int rte_is_multicast_ether_addr_w(const struct rte_ether_addr *ea) { - return rte_is_multicast_ether_addr(ea); -} -int rte_is_broadcast_ether_addr_w(const struct rte_ether_addr *ea) { - return rte_is_broadcast_ether_addr(ea); -} -int rte_is_universal_ether_addr_w(const struct rte_ether_addr *ea) { - return rte_is_universal_ether_addr(ea); -} -int rte_is_local_admin_ether_addr_w(const struct rte_ether_addr *ea) { - return rte_is_local_admin_ether_addr(ea); -} -int rte_is_valid_assigned_ether_addr_w(const struct rte_ether_addr *ea) { - return rte_is_valid_assigned_ether_addr(ea); -} -void rte_ether_addr_copy_w(const struct rte_ether_addr *ea_from, - struct rte_ether_addr *ea_to) { - rte_ether_addr_copy(ea_from, ea_to); -} -int rte_vlan_strip_w(struct rte_mbuf *m) { return rte_vlan_strip(m); } -int rte_vlan_insert_w(struct rte_mbuf **m) { return rte_vlan_insert(m); } -uint32_t rte_bitmap_get_memory_footprint_w(uint32_t n_bits) { - return rte_bitmap_get_memory_footprint(n_bits); -} -struct rte_bitmap *rte_bitmap_init_w(uint32_t n_bits, uint8_t *mem, - uint32_t mem_size) { - return rte_bitmap_init(n_bits, mem, mem_size); -} -struct rte_bitmap *rte_bitmap_init_with_all_set_w(uint32_t n_bits, uint8_t *mem, - uint32_t mem_size) { - return rte_bitmap_init_with_all_set(n_bits, mem, mem_size); -} -void rte_bitmap_free_w(struct rte_bitmap *bmp) { return rte_bitmap_free(bmp); } -void rte_bitmap_reset_w(struct rte_bitmap *bmp) { rte_bitmap_reset(bmp); } -void rte_bitmap_prefetch0_w(struct rte_bitmap *bmp, uint32_t pos) { - rte_bitmap_prefetch0(bmp, pos); -} -uint64_t rte_bitmap_get_w(struct rte_bitmap *bmp, uint32_t pos) { - return rte_bitmap_get(bmp, pos); -} -void rte_bitmap_set_w(struct rte_bitmap *bmp, uint32_t pos) { - rte_bitmap_set(bmp, pos); -} -void rte_bitmap_set_slab_w(struct rte_bitmap *bmp, uint32_t pos, - uint64_t slab) { - rte_bitmap_set_slab(bmp, pos, slab); -} -void rte_bitmap_clear_w(struct rte_bitmap *bmp, uint32_t pos) { - rte_bitmap_clear(bmp, pos); -} -int rte_bitmap_scan_w(struct rte_bitmap *bmp, uint32_t *pos, uint64_t *slab) { - return rte_bitmap_scan(bmp, pos, slab); -} -uint16_t rte_raw_cksum_w(const void *buf, size_t len) { - return rte_raw_cksum(buf, len); -} -int rte_raw_cksum_mbuf_w(const struct rte_mbuf *m, uint32_t off, uint32_t len, - uint16_t *cksum) { - return rte_raw_cksum_mbuf(m, off, len, cksum); -} -uint8_t rte_ipv4_hdr_len_w(const struct rte_ipv4_hdr *ipv4_hdr) { - return rte_ipv4_hdr_len(ipv4_hdr); -} -uint16_t rte_ipv4_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr) { - return rte_ipv4_cksum(ipv4_hdr); -} -uint16_t rte_ipv4_cksum_simple_w(const struct rte_ipv4_hdr *ipv4_hdr) { - return rte_ipv4_cksum_simple(ipv4_hdr); -} -uint16_t rte_ipv4_phdr_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr, - uint64_t ol_flags) { - return rte_ipv4_phdr_cksum(ipv4_hdr, ol_flags); -} -uint16_t rte_ipv4_udptcp_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr, - const void *l4_hdr) { - return rte_ipv4_udptcp_cksum(ipv4_hdr, l4_hdr); -} -uint16_t rte_ipv4_udptcp_cksum_mbuf_w(const struct rte_mbuf *m, - const struct rte_ipv4_hdr *ipv4_hdr, - uint16_t l4_off) { - return rte_ipv4_udptcp_cksum_mbuf(m, ipv4_hdr, l4_off); -} -int rte_ipv4_udptcp_cksum_verify_w(const struct rte_ipv4_hdr *ipv4_hdr, - const void *l4_hdr) { - return rte_ipv4_udptcp_cksum_verify(ipv4_hdr, l4_hdr); -} -int rte_ipv4_udptcp_cksum_mbuf_verify_w(const struct rte_mbuf *m, - const struct rte_ipv4_hdr *ipv4_hdr, - uint16_t l4_off) { - return rte_ipv4_udptcp_cksum_mbuf_verify(m, ipv4_hdr, l4_off); -} -bool rte_ipv6_addr_eq_w(const struct rte_ipv6_addr *a, - const struct rte_ipv6_addr *b) { - return rte_ipv6_addr_eq(a, b); -} -void rte_ipv6_addr_mask_w(struct rte_ipv6_addr *ip, uint8_t depth) { - rte_ipv6_addr_mask(ip, depth); -} -bool rte_ipv6_addr_eq_prefix_w(const struct rte_ipv6_addr *a, - const struct rte_ipv6_addr *b, uint8_t depth) { - return rte_ipv6_addr_eq_prefix(a, b, depth); -} -uint8_t rte_ipv6_mask_depth_w(const struct rte_ipv6_addr *mask) { - return rte_ipv6_mask_depth(mask); -} -bool rte_ipv6_addr_is_unspec_w(const struct rte_ipv6_addr *ip) { - return rte_ipv6_addr_is_unspec(ip); -} -bool rte_ipv6_addr_is_loopback_w(const struct rte_ipv6_addr *ip) { - return rte_ipv6_addr_is_loopback(ip); -} -bool rte_ipv6_addr_is_linklocal_w(const struct rte_ipv6_addr *ip) { - return rte_ipv6_addr_is_linklocal(ip); -} -bool rte_ipv6_addr_is_sitelocal_w(const struct rte_ipv6_addr *ip) { - return rte_ipv6_addr_is_sitelocal(ip); -} -bool rte_ipv6_addr_is_v4compat_w(const struct rte_ipv6_addr *ip) { - return rte_ipv6_addr_is_v4compat(ip); -} -bool rte_ipv6_addr_is_v4mapped_w(const struct rte_ipv6_addr *ip) { - return rte_ipv6_addr_is_v4mapped(ip); -} -bool rte_ipv6_addr_is_mcast_w(const struct rte_ipv6_addr *ip) { - return rte_ipv6_addr_is_mcast(ip); -} -enum rte_ipv6_mc_scope rte_ipv6_mc_scope_w(const struct rte_ipv6_addr *ip) { - return rte_ipv6_mc_scope(ip); -} -void rte_ipv6_llocal_from_ethernet_w(struct rte_ipv6_addr *ip, - const struct rte_ether_addr *mac) { - rte_ipv6_llocal_from_ethernet(ip, mac); -} -void rte_ipv6_solnode_from_addr_w(struct rte_ipv6_addr *sol, - const struct rte_ipv6_addr *ip) { - rte_ipv6_solnode_from_addr(sol, ip); -} -void rte_ether_mcast_from_ipv6_w(struct rte_ether_addr *mac, - const struct rte_ipv6_addr *ip) { - rte_ether_mcast_from_ipv6(mac, ip); -} -int rte_ipv6_check_version_w(const struct rte_ipv6_hdr *ip) { - return rte_ipv6_check_version(ip); -} -uint16_t rte_ipv6_phdr_cksum_w(const struct rte_ipv6_hdr *ipv6_hdr, - uint64_t ol_flags) { - return rte_ipv6_phdr_cksum(ipv6_hdr, ol_flags); -} -uint16_t rte_ipv6_udptcp_cksum_w(const struct rte_ipv6_hdr *ipv6_hdr, - const void *l4_hdr) { - return rte_ipv6_udptcp_cksum(ipv6_hdr, l4_hdr); -} -uint16_t rte_ipv6_udptcp_cksum_mbuf_w(const struct rte_mbuf *m, - const struct rte_ipv6_hdr *ipv6_hdr, - uint16_t l4_off) { - return rte_ipv6_udptcp_cksum_mbuf(m, ipv6_hdr, l4_off); -} -int rte_ipv6_udptcp_cksum_verify_w(const struct rte_ipv6_hdr *ipv6_hdr, - const void *l4_hdr) { - return rte_ipv6_udptcp_cksum_verify(ipv6_hdr, l4_hdr); -} -int rte_ipv6_udptcp_cksum_mbuf_verify_w(const struct rte_mbuf *m, - const struct rte_ipv6_hdr *ipv6_hdr, - uint16_t l4_off) { - return rte_ipv6_udptcp_cksum_mbuf_verify(m, ipv6_hdr, l4_off); -} -int rte_ipv6_get_next_ext_w(const uint8_t *p, int proto, size_t *ext_len) { - return rte_ipv6_get_next_ext(p, proto, ext_len); -} -enum rte_color -rte_meter_srtcm_color_blind_check_w(struct rte_meter_srtcm *m, - struct rte_meter_srtcm_profile *p, - uint64_t time, uint32_t pkt_len) { - return rte_meter_srtcm_color_blind_check(m, p, time, pkt_len); -} -enum rte_color rte_meter_srtcm_color_aware_check_w( - struct rte_meter_srtcm *m, struct rte_meter_srtcm_profile *p, uint64_t time, - uint32_t pkt_len, enum rte_color pkt_color) { - return rte_meter_srtcm_color_aware_check(m, p, time, pkt_len, pkt_color); -} -enum rte_color -rte_meter_trtcm_color_blind_check_w(struct rte_meter_trtcm *m, - struct rte_meter_trtcm_profile *p, - uint64_t time, uint32_t pkt_len) { - return rte_meter_trtcm_color_blind_check(m, p, time, pkt_len); -} -enum rte_color rte_meter_trtcm_color_aware_check_w( - struct rte_meter_trtcm *m, struct rte_meter_trtcm_profile *p, uint64_t time, - uint32_t pkt_len, enum rte_color pkt_color) { - return rte_meter_trtcm_color_aware_check(m, p, time, pkt_len, pkt_color); -} -enum rte_color rte_meter_trtcm_rfc4115_color_blind_check_w( - struct rte_meter_trtcm_rfc4115 *m, - struct rte_meter_trtcm_rfc4115_profile *p, uint64_t time, - uint32_t pkt_len) { - return rte_meter_trtcm_rfc4115_color_blind_check(m, p, time, pkt_len); -} -enum rte_color rte_meter_trtcm_rfc4115_color_aware_check_w( - struct rte_meter_trtcm_rfc4115 *m, - struct rte_meter_trtcm_rfc4115_profile *p, uint64_t time, uint32_t pkt_len, - enum rte_color pkt_color) { - return rte_meter_trtcm_rfc4115_color_aware_check(m, p, time, pkt_len, - pkt_color); -} -uint64_t rte_eth_rss_hf_refine_w(uint64_t rss_hf) { - return rte_eth_rss_hf_refine(rss_hf); -} - -uint16_t rte_eth_rx_burst_w(uint16_t port_id, uint16_t queue_id, - struct rte_mbuf **rx_pkts, const uint16_t nb_pkts) { - return rte_eth_rx_burst(port_id, queue_id, rx_pkts, nb_pkts); -} -int rte_eth_rx_queue_count_w(uint16_t port_id, uint16_t queue_id) { - return rte_eth_rx_queue_count(port_id, queue_id); -} -int rte_eth_rx_descriptor_status_w(uint16_t port_id, uint16_t queue_id, - uint16_t offset) { - return rte_eth_rx_descriptor_status(port_id, queue_id, offset); -} -int rte_eth_tx_descriptor_status_w(uint16_t port_id, uint16_t queue_id, - uint16_t offset) { - return rte_eth_tx_descriptor_status(port_id, queue_id, offset); -} -uint16_t rte_eth_tx_burst_w(uint16_t port_id, uint16_t queue_id, - struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { - return rte_eth_tx_burst(port_id, queue_id, tx_pkts, nb_pkts); -} -uint16_t rte_eth_tx_prepare_w(uint16_t port_id, uint16_t queue_id, - struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { - return rte_eth_tx_prepare(port_id, queue_id, tx_pkts, nb_pkts); -} -uint16_t rte_eth_tx_buffer_flush_w(uint16_t port_id, uint16_t queue_id, - struct rte_eth_dev_tx_buffer *buffer) { - return rte_eth_tx_buffer_flush(port_id, queue_id, buffer); -} -uint16_t rte_eth_tx_buffer_w(uint16_t port_id, uint16_t queue_id, - struct rte_eth_dev_tx_buffer *buffer, - struct rte_mbuf *tx_pkt) { - return rte_eth_tx_buffer(port_id, queue_id, buffer, tx_pkt); -} -uint16_t -rte_eth_recycle_mbufs_w(uint16_t rx_port_id, uint16_t rx_queue_id, - uint16_t tx_port_id, uint16_t tx_queue_id, - struct rte_eth_recycle_rxq_info *recycle_rxq_info) { - return rte_eth_recycle_mbufs(rx_port_id, rx_queue_id, tx_port_id, tx_queue_id, - recycle_rxq_info); -} -int rte_eth_tx_queue_count_w(uint16_t port_id, uint16_t queue_id) { - return rte_eth_tx_queue_count(port_id, queue_id); -} -uint32_t rte_flow_dynf_metadata_get_w(struct rte_mbuf *m) { - return rte_flow_dynf_metadata_get(m); -} -void rte_flow_dynf_metadata_set_w(struct rte_mbuf *m, uint32_t v) { - rte_flow_dynf_metadata_set(m, v); -} -int rte_flow_dynf_metadata_avail_w(void) { - return rte_flow_dynf_metadata_avail(); -} -uint32_t rte_hash_crc_1byte_w(uint8_t data, uint32_t init_val) { - return rte_hash_crc_1byte(data, init_val); -} -uint32_t rte_hash_crc_2byte_w(uint16_t data, uint32_t init_val) { - return rte_hash_crc_2byte(data, init_val); -} -uint32_t rte_hash_crc_4byte_w(uint32_t data, uint32_t init_val) { - return rte_hash_crc_4byte(data, init_val); -} -uint32_t rte_hash_crc_8byte_w(uint64_t data, uint32_t init_val) { - return rte_hash_crc_8byte(data, init_val); -} -uint32_t rte_hash_crc_w(const void *data, uint32_t data_len, - uint32_t init_val) { - return rte_hash_crc(data, data_len, init_val); -} -void rte_jhash_2hashes_w(const void *key, uint32_t length, uint32_t *pc, - uint32_t *pb) { - rte_jhash_2hashes(key, length, pc, pb); -} -void rte_jhash_32b_2hashes_w(const uint32_t *k, uint32_t length, uint32_t *pc, - uint32_t *pb) { - rte_jhash_32b_2hashes(k, length, pc, pb); -} -uint32_t rte_jhash_w(const void *key, uint32_t length, uint32_t initval) { - return rte_jhash(key, length, initval); -} -uint32_t rte_jhash_32b_w(const uint32_t *k, uint32_t length, uint32_t initval) { - return rte_jhash_32b(k, length, initval); -} -uint32_t rte_jhash_3words_w(uint32_t a, uint32_t b, uint32_t c, - uint32_t initval) { - return rte_jhash_3words(a, b, c, initval); -} -uint32_t rte_jhash_2words_w(uint32_t a, uint32_t b, uint32_t initval) { - return rte_jhash_2words(a, b, initval); -} -uint32_t rte_jhash_1word_w(uint32_t a, uint32_t initval) { - return rte_jhash_1word(a, initval); -} -uint32_t rte_fbk_hash_get_bucket_w(const struct rte_fbk_hash_table *ht, - uint32_t key) { - return rte_fbk_hash_get_bucket(ht, key); -} -int rte_fbk_hash_add_key_with_bucket_w(struct rte_fbk_hash_table *ht, - uint32_t key, uint16_t value, - uint32_t bucket) { - return rte_fbk_hash_add_key_with_bucket(ht, key, value, bucket); -} -int rte_fbk_hash_add_key_w(struct rte_fbk_hash_table *ht, uint32_t key, - uint16_t value) { - return rte_fbk_hash_add_key(ht, key, value); -} -int rte_fbk_hash_delete_key_with_bucket_w(struct rte_fbk_hash_table *ht, - uint32_t key, uint32_t bucket) { - return rte_fbk_hash_delete_key_with_bucket(ht, key, bucket); -} -int rte_fbk_hash_delete_key_w(struct rte_fbk_hash_table *ht, uint32_t key) { - return rte_fbk_hash_delete_key(ht, key); -} -int rte_fbk_hash_lookup_with_bucket_w(const struct rte_fbk_hash_table *ht, - uint32_t key, uint32_t bucket) { - return rte_fbk_hash_lookup_with_bucket(ht, key, bucket); -} -int rte_fbk_hash_lookup_w(const struct rte_fbk_hash_table *ht, uint32_t key) { - return rte_fbk_hash_lookup(ht, key); -} -void rte_fbk_hash_clear_all_w(struct rte_fbk_hash_table *ht) { - rte_fbk_hash_clear_all(ht); -} -double rte_fbk_hash_get_load_factor_w(struct rte_fbk_hash_table *ht) { - return rte_fbk_hash_get_load_factor(ht); -} -void rte_rcu_qsbr_thread_online_w(struct rte_rcu_qsbr *v, - unsigned int thread_id) { - rte_rcu_qsbr_thread_online(v, thread_id); -} -void rte_rcu_qsbr_thread_offline_w(struct rte_rcu_qsbr *v, - unsigned int thread_id) { - rte_rcu_qsbr_thread_offline(v, thread_id); -} -void rte_rcu_qsbr_lock_w(struct rte_rcu_qsbr *v, unsigned int thread_id) { - rte_rcu_qsbr_lock(v, thread_id); -} -void rte_rcu_qsbr_unlock_w(struct rte_rcu_qsbr *v, unsigned int thread_id) { - rte_rcu_qsbr_unlock(v, thread_id); -} -uint64_t rte_rcu_qsbr_start_w(struct rte_rcu_qsbr *v) { - return rte_rcu_qsbr_start(v); -} -void rte_rcu_qsbr_quiescent_w(struct rte_rcu_qsbr *v, unsigned int thread_id) { - rte_rcu_qsbr_quiescent(v, thread_id); -} -int rte_rcu_qsbr_check_w(struct rte_rcu_qsbr *v, uint64_t t, bool wait) { - return rte_rcu_qsbr_check(v, t, wait); -} -uint8_t rte_read8_relaxed_w(const void *addr) { - return rte_read8_relaxed(addr); -} -uint16_t rte_read16_relaxed_w(const void *addr) { - return rte_read16_relaxed(addr); -} -uint32_t rte_read32_relaxed_w(const void *addr) { - return rte_read32_relaxed(addr); -} -uint64_t rte_read64_relaxed_w(const void *addr) { - return rte_read64_relaxed(addr); -} -void rte_write8_relaxed_w(uint8_t value, void *addr) { - rte_write8_relaxed(value, addr); -} -void rte_write16_relaxed_w(uint16_t value, void *addr) { - rte_write16_relaxed(value, addr); -} -void rte_write32_relaxed_w(uint32_t value, void *addr) { - rte_write32_relaxed(value, addr); -} -void rte_write64_relaxed_w(uint64_t value, void *addr) { - rte_write64_relaxed(value, addr); -} -uint8_t rte_read8_w(const void *addr) { return rte_read8(addr); } -uint16_t rte_read16_w(const void *addr) { return rte_read16(addr); } -uint32_t rte_read32_w(const void *addr) { return rte_read32(addr); } -uint64_t rte_read64_w(const void *addr) { return rte_read64(addr); } -void rte_write8_w(uint8_t value, void *addr) { rte_write8(value, addr); } -void rte_write16_w(uint16_t value, void *addr) { rte_write16(value, addr); } -void rte_write32_w(uint32_t value, void *addr) { rte_write32(value, addr); } -void rte_write64_w(uint64_t value, void *addr) { rte_write64(value, addr); } -void rte_write32_wc_relaxed_w(uint32_t value, void *addr) { - rte_write32_wc_relaxed(value, addr); -} -void rte_write32_wc_w(uint32_t value, void *addr) { - rte_write32_wc(value, addr); -} -void rte_mcslock_lock_w(rte_mcslock_t **msl, rte_mcslock_t *me) { - rte_mcslock_lock(msl, me); -} -void rte_mcslock_unlock_w(rte_mcslock_t **msl, rte_mcslock_t *me) { - rte_mcslock_unlock(msl, me); -} -int rte_mcslock_trylock_w(rte_mcslock_t **msl, rte_mcslock_t *me) { - return rte_mcslock_trylock(msl, me); -} -int rte_mcslock_is_locked_w(rte_mcslock_t *msl) { - return rte_mcslock_is_locked(msl); -} -void rte_pflock_init_w(struct rte_pflock *pf) { rte_pflock_init(pf); } -void rte_pflock_read_lock_w(rte_pflock_t *pf) { rte_pflock_read_lock(pf); } -void rte_pflock_read_unlock_w(rte_pflock_t *pf) { rte_pflock_read_unlock(pf); } -void rte_pflock_write_lock_w(rte_pflock_t *pf) { rte_pflock_write_lock(pf); } -void rte_pflock_write_unlock_w(rte_pflock_t *pf) { - rte_pflock_write_unlock(pf); -} -uint32_t rte_reciprocal_divide_w(uint32_t a, struct rte_reciprocal R) { - return rte_reciprocal_divide(a, R); -} -uint64_t rte_reciprocal_divide_u64_w(uint64_t a, - const struct rte_reciprocal_u64 *R) { - return rte_reciprocal_divide_u64(a, R); -} -void rte_seqcount_init_w(rte_seqcount_t *seqcount) { - rte_seqcount_init(seqcount); -} -uint32_t rte_seqcount_read_begin_w(const rte_seqcount_t *seqcount) { - return rte_seqcount_read_begin(seqcount); -} -bool rte_seqcount_read_retry_w(const rte_seqcount_t *seqcount, - uint32_t begin_sn) { - return rte_seqcount_read_retry(seqcount, begin_sn); -} -void rte_seqcount_write_begin_w(rte_seqcount_t *seqcount) { - rte_seqcount_write_begin(seqcount); -} -void rte_seqcount_write_end_w(rte_seqcount_t *seqcount) { - rte_seqcount_write_end(seqcount); -} -void rte_seqlock_init_w(rte_seqlock_t *seqlock) { rte_seqlock_init(seqlock); } -uint32_t rte_seqlock_read_begin_w(const rte_seqlock_t *seqlock) { - return rte_seqlock_read_begin(seqlock); -} -bool rte_seqlock_read_retry_w(const rte_seqlock_t *seqlock, uint32_t begin_sn) { - return rte_seqlock_read_retry(seqlock, begin_sn); -} -void rte_seqlock_write_lock_w(rte_seqlock_t *seqlock) { - rte_seqlock_write_lock(seqlock); -} -void rte_seqlock_write_unlock_w(rte_seqlock_t *seqlock) { - rte_seqlock_write_unlock(seqlock); -} -unsigned int rte_stack_push_w(struct rte_stack *s, void *const *obj_table, - unsigned int n) { - return rte_stack_push(s, obj_table, n); -} -unsigned int rte_stack_pop_w(struct rte_stack *s, void **obj_table, - unsigned int n) { - return rte_stack_pop(s, obj_table, n); -} -unsigned int rte_stack_count_w(struct rte_stack *s) { - return rte_stack_count(s); -} -unsigned int rte_stack_free_count_w(struct rte_stack *s) { - return rte_stack_free_count(s); -} -uint32_t rte_softrss_w(uint32_t *input_tuple, uint32_t input_len, - const uint8_t *rss_key) { - return rte_softrss(input_tuple, input_len, rss_key); -} -uint32_t rte_softrss_be_w(uint32_t *input_tuple, uint32_t input_len, - const uint8_t *rss_key) { - return rte_softrss_be(input_tuple, input_len, rss_key); -} -void rte_ticketlock_init_w(rte_ticketlock_t *tl) { rte_ticketlock_init(tl); } -void rte_ticketlock_lock_w(rte_ticketlock_t *tl) { rte_ticketlock_lock(tl); } -void rte_ticketlock_unlock_w(rte_ticketlock_t *tl) { - rte_ticketlock_unlock(tl); -} -int rte_ticketlock_trylock_w(rte_ticketlock_t *tl) { - return rte_ticketlock_trylock(tl); -} -int rte_ticketlock_is_locked_w(rte_ticketlock_t *tl) { - return rte_ticketlock_is_locked(tl); -} -void rte_ticketlock_recursive_init_w(rte_ticketlock_recursive_t *tlr) { - rte_ticketlock_recursive_init(tlr); -} -void rte_ticketlock_recursive_lock_w(rte_ticketlock_recursive_t *tlr) { - rte_ticketlock_recursive_lock(tlr); -} -void rte_ticketlock_recursive_unlock_w(rte_ticketlock_recursive_t *tlr) { - rte_ticketlock_recursive_unlock(tlr); -} -int rte_ticketlock_recursive_trylock_w(rte_ticketlock_recursive_t *tlr) { - return rte_ticketlock_recursive_trylock(tlr); -} -uint64_t rte_cyclecounter_cycles_to_ns_w(struct rte_timecounter *tc, - uint64_t cycles) { - return rte_cyclecounter_cycles_to_ns(tc, cycles); -} -uint64_t rte_timecounter_update_w(struct rte_timecounter *tc, - uint64_t cycle_now) { - return rte_timecounter_update(tc, cycle_now); -} -uint64_t rte_timespec_to_ns_w(const struct timespec *ts) { - return rte_timespec_to_ns(ts); -} -struct timespec rte_ns_to_timespec_w(uint64_t nsec) { - return rte_ns_to_timespec(nsec); -} -bool rte_trace_feature_is_enabled_w(void) { - return rte_trace_feature_is_enabled(); -} diff --git a/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.h b/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.h index 53b05b961..5a57ffc6d 100644 --- a/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.h +++ b/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.h @@ -277,7 +277,7 @@ enum rte_eth_tx_offload : uint64_t { * DPDK is not yet using the C23 standard (which would allow the inheritance * notation with `uint64_t` seen here.). */ -enum wrte_eth_rx_offload : uint64_t { +enum rte_eth_rx_offload : uint64_t { RX_OFFLOAD_VLAN_STRIP = RTE_ETH_RX_OFFLOAD_VLAN_STRIP, RX_OFFLOAD_IPV4_CKSUM = RTE_ETH_RX_OFFLOAD_IPV4_CKSUM, RX_OFFLOAD_UDP_CKSUM = RTE_ETH_RX_OFFLOAD_UDP_CKSUM, @@ -297,3 +297,1518 @@ enum wrte_eth_rx_offload : uint64_t { RX_OFFLOAD_RSS_HASH = RTE_ETH_RX_OFFLOAD_RSS_HASH, RX_OFFLOAD_BUFFER_SPLIT = RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT, }; + + +int rte_errno_get() { return rte_errno; } + +// Static wrappers + +int rte_is_aligned_w(const void *const ptr, const unsigned int align) { + return rte_is_aligned(ptr, align); +} +void rte_atomic_thread_fence_w(rte_memory_order memorder) { + rte_atomic_thread_fence(memorder); +} +int rte_atomic16_cmpset_w(uint16_t *dst, uint16_t exp, uint16_t src) { + return rte_atomic16_cmpset(dst, exp, src); +} +uint16_t rte_atomic16_exchange_w(uint16_t *dst, uint16_t val) { + return rte_atomic16_exchange(dst, val); +} +void rte_atomic16_init_w(rte_atomic16_t *v) { rte_atomic16_init(v); } +int16_t rte_atomic16_read_w(const rte_atomic16_t *v) { + return rte_atomic16_read(v); +} +void rte_atomic16_set_w(rte_atomic16_t *v, int16_t new_value) { + rte_atomic16_set(v, new_value); +} +void rte_atomic16_add_w(rte_atomic16_t *v, int16_t inc) { + rte_atomic16_add(v, inc); +} +void rte_atomic16_sub_w(rte_atomic16_t *v, int16_t dec) { + rte_atomic16_sub(v, dec); +} +void rte_atomic16_inc_w(rte_atomic16_t *v) { rte_atomic16_inc(v); } +void rte_atomic16_dec_w(rte_atomic16_t *v) { rte_atomic16_dec(v); } +int16_t rte_atomic16_add_return_w(rte_atomic16_t *v, int16_t inc) { + return rte_atomic16_add_return(v, inc); +} +int16_t rte_atomic16_sub_return_w(rte_atomic16_t *v, int16_t dec) { + return rte_atomic16_sub_return(v, dec); +} +int rte_atomic16_inc_and_test_w(rte_atomic16_t *v) { + return rte_atomic16_inc_and_test(v); +} +int rte_atomic16_dec_and_test_w(rte_atomic16_t *v) { + return rte_atomic16_dec_and_test(v); +} +int rte_atomic16_test_and_set_w(rte_atomic16_t *v) { + return rte_atomic16_test_and_set(v); +} +void rte_atomic16_clear_w(rte_atomic16_t *v) { rte_atomic16_clear(v); } +int rte_atomic32_cmpset_w(uint32_t *dst, uint32_t exp, uint32_t src) { + return rte_atomic32_cmpset(dst, exp, src); +} +uint32_t rte_atomic32_exchange_w(uint32_t *dst, uint32_t val) { + return rte_atomic32_exchange(dst, val); +} +void rte_atomic32_init_w(rte_atomic32_t *v) { rte_atomic32_init(v); } +int32_t rte_atomic32_read_w(const rte_atomic32_t *v) { + return rte_atomic32_read(v); +} +void rte_atomic32_set_w(rte_atomic32_t *v, int32_t new_value) { + rte_atomic32_set(v, new_value); +} +void rte_atomic32_add_w(rte_atomic32_t *v, int32_t inc) { + rte_atomic32_add(v, inc); +} +void rte_atomic32_sub_w(rte_atomic32_t *v, int32_t dec) { + rte_atomic32_sub(v, dec); +} +void rte_atomic32_inc_w(rte_atomic32_t *v) { rte_atomic32_inc(v); } +void rte_atomic32_dec_w(rte_atomic32_t *v) { rte_atomic32_dec(v); } +int32_t rte_atomic32_add_return_w(rte_atomic32_t *v, int32_t inc) { + return rte_atomic32_add_return(v, inc); +} +int32_t rte_atomic32_sub_return_w(rte_atomic32_t *v, int32_t dec) { + return rte_atomic32_sub_return(v, dec); +} +int rte_atomic32_inc_and_test_w(rte_atomic32_t *v) { + return rte_atomic32_inc_and_test(v); +} +int rte_atomic32_dec_and_test_w(rte_atomic32_t *v) { + return rte_atomic32_dec_and_test(v); +} +int rte_atomic32_test_and_set_w(rte_atomic32_t *v) { + return rte_atomic32_test_and_set(v); +} +void rte_atomic32_clear_w(rte_atomic32_t *v) { rte_atomic32_clear(v); } +int rte_atomic64_cmpset_w(uint64_t *dst, uint64_t exp, uint64_t src) { + return rte_atomic64_cmpset(dst, exp, src); +} +uint64_t rte_atomic64_exchange_w(uint64_t *dst, uint64_t val) { + return rte_atomic64_exchange(dst, val); +} +void rte_atomic64_init_w(rte_atomic64_t *v) { rte_atomic64_init(v); } +int64_t rte_atomic64_read_w(rte_atomic64_t *v) { return rte_atomic64_read(v); } +void rte_atomic64_set_w(rte_atomic64_t *v, int64_t new_value) { + rte_atomic64_set(v, new_value); +} +void rte_atomic64_add_w(rte_atomic64_t *v, int64_t inc) { + rte_atomic64_add(v, inc); +} +void rte_atomic64_sub_w(rte_atomic64_t *v, int64_t dec) { + rte_atomic64_sub(v, dec); +} +void rte_atomic64_inc_w(rte_atomic64_t *v) { rte_atomic64_inc(v); } +void rte_atomic64_dec_w(rte_atomic64_t *v) { rte_atomic64_dec(v); } +int64_t rte_atomic64_add_return_w(rte_atomic64_t *v, int64_t inc) { + return rte_atomic64_add_return(v, inc); +} +int64_t rte_atomic64_sub_return_w(rte_atomic64_t *v, int64_t dec) { + return rte_atomic64_sub_return(v, dec); +} +int rte_atomic64_inc_and_test_w(rte_atomic64_t *v) { + return rte_atomic64_inc_and_test(v); +} +int rte_atomic64_dec_and_test_w(rte_atomic64_t *v) { + return rte_atomic64_dec_and_test(v); +} +int rte_atomic64_test_and_set_w(rte_atomic64_t *v) { + return rte_atomic64_test_and_set(v); +} +void rte_atomic64_clear_w(rte_atomic64_t *v) { rte_atomic64_clear(v); } +void rte_smp_mb_w(void) { rte_smp_mb(); } +uint64_t rte_get_tsc_cycles_w(void) { return rte_get_tsc_cycles(); } +uint64_t rte_get_timer_cycles_w(void) { return rte_get_timer_cycles(); } +uint64_t rte_get_timer_hz_w(void) { return rte_get_timer_hz(); } +void rte_delay_ms_w(unsigned int ms) { rte_delay_ms(ms); } +uint64_t rte_rdtsc_w(void) { return rte_rdtsc(); } +uint64_t rte_rdtsc_precise_w(void) { return rte_rdtsc_precise(); } +size_t rte_strlcpy_w(char *dst, const char *src, size_t size) { + return rte_strlcpy(dst, src, size); +} +size_t rte_strlcat_w(char *dst, const char *src, size_t size) { + return rte_strlcat(dst, src, size); +} +const char *rte_str_skip_leading_spaces_w(const char *src) { + return rte_str_skip_leading_spaces(src); +} +void rte_uuid_copy_w(rte_uuid_t dst, const rte_uuid_t src) { + rte_uuid_copy(dst, src); +} +int rte_gettid_w(void) { return rte_gettid(); } +unsigned int rte_lcore_id_w(void) { return rte_lcore_id(); } +void rte_pause_w(void) { rte_pause(); } +void rte_wait_until_equal_16_w(uint16_t *addr, uint16_t expected, + rte_memory_order memorder) { + rte_wait_until_equal_16(addr, expected, memorder); +} +void rte_wait_until_equal_32_w(uint32_t *addr, uint32_t expected, + rte_memory_order memorder) { + rte_wait_until_equal_32(addr, expected, memorder); +} +void rte_wait_until_equal_64_w(uint64_t *addr, uint64_t expected, + rte_memory_order memorder) { + rte_wait_until_equal_64(addr, expected, memorder); +} +void rte_spinlock_init_w(rte_spinlock_t *sl) { rte_spinlock_init(sl); } +void rte_spinlock_lock_w(rte_spinlock_t *sl) { rte_spinlock_lock(sl); } +void rte_spinlock_unlock_w(rte_spinlock_t *sl) { rte_spinlock_unlock(sl); } +int rte_spinlock_trylock_w(rte_spinlock_t *sl) { + return rte_spinlock_trylock(sl); +} +int rte_spinlock_is_locked_w(rte_spinlock_t *sl) { + return rte_spinlock_is_locked(sl); +} +int rte_tm_supported_w(void) { return rte_tm_supported(); } +void rte_spinlock_lock_tm_w(rte_spinlock_t *sl) { rte_spinlock_lock_tm(sl); } +void rte_spinlock_unlock_tm_w(rte_spinlock_t *sl) { + rte_spinlock_unlock_tm(sl); +} +int rte_spinlock_trylock_tm_w(rte_spinlock_t *sl) { + return rte_spinlock_trylock_tm(sl); +} +void rte_spinlock_recursive_init_w(rte_spinlock_recursive_t *slr) { + rte_spinlock_recursive_init(slr); +} +void rte_spinlock_recursive_lock_w(rte_spinlock_recursive_t *slr) { + rte_spinlock_recursive_lock(slr); +} +void rte_spinlock_recursive_unlock_w(rte_spinlock_recursive_t *slr) { + rte_spinlock_recursive_unlock(slr); +} +int rte_spinlock_recursive_trylock_w(rte_spinlock_recursive_t *slr) { + return rte_spinlock_recursive_trylock(slr); +} +void rte_spinlock_recursive_lock_tm_w(rte_spinlock_recursive_t *slr) { + rte_spinlock_recursive_lock_tm(slr); +} +void rte_spinlock_recursive_unlock_tm_w(rte_spinlock_recursive_t *slr) { + rte_spinlock_recursive_unlock_tm(slr); +} +int rte_spinlock_recursive_trylock_tm_w(rte_spinlock_recursive_t *slr) { + return rte_spinlock_recursive_trylock_tm(slr); +} +// unsigned int rte_xbegin_w(void) { return rte_xbegin(); } +// void rte_xend_w(void) { rte_xend(); } +// int rte_xtest_w(void) { return rte_xtest(); } +// int rte_try_tm_w(int *lock) { return rte_try_tm(lock); } +uint32_t rte_bit_relaxed_get32_w(unsigned int nr, uint32_t *addr) { + return rte_bit_relaxed_get32(nr, addr); +} +void rte_bit_relaxed_set32_w(unsigned int nr, uint32_t *addr) { + rte_bit_relaxed_set32(nr, addr); +} +void rte_bit_relaxed_clear32_w(unsigned int nr, uint32_t *addr) { + rte_bit_relaxed_clear32(nr, addr); +} +uint32_t rte_bit_relaxed_test_and_set32_w(unsigned int nr, uint32_t *addr) { + return rte_bit_relaxed_test_and_set32(nr, addr); +} +uint32_t rte_bit_relaxed_test_and_clear32_w(unsigned int nr, uint32_t *addr) { + return rte_bit_relaxed_test_and_clear32(nr, addr); +} +uint64_t rte_bit_relaxed_get64_w(unsigned int nr, uint64_t *addr) { + return rte_bit_relaxed_get64(nr, addr); +} +void rte_bit_relaxed_set64_w(unsigned int nr, uint64_t *addr) { + rte_bit_relaxed_set64(nr, addr); +} +void rte_bit_relaxed_clear64_w(unsigned int nr, uint64_t *addr) { + rte_bit_relaxed_clear64(nr, addr); +} +uint64_t rte_bit_relaxed_test_and_set64_w(unsigned int nr, uint64_t *addr) { + return rte_bit_relaxed_test_and_set64(nr, addr); +} +uint64_t rte_bit_relaxed_test_and_clear64_w(unsigned int nr, uint64_t *addr) { + return rte_bit_relaxed_test_and_clear64(nr, addr); +} +unsigned int rte_clz32_w(uint32_t v) { return rte_clz32(v); } +unsigned int rte_clz64_w(uint64_t v) { return rte_clz64(v); } +unsigned int rte_ctz32_w(uint32_t v) { return rte_ctz32(v); } +unsigned int rte_ctz64_w(uint64_t v) { return rte_ctz64(v); } +unsigned int rte_popcount32_w(uint32_t v) { return rte_popcount32(v); } +unsigned int rte_popcount64_w(uint64_t v) { return rte_popcount64(v); } +uint32_t rte_combine32ms1b_w(uint32_t x) { return rte_combine32ms1b(x); } +uint64_t rte_combine64ms1b_w(uint64_t v) { return rte_combine64ms1b(v); } +uint32_t rte_bsf32_w(uint32_t v) { return rte_bsf32(v); } +int rte_bsf32_safe_w(uint32_t v, uint32_t *pos) { + return rte_bsf32_safe(v, pos); +} +uint32_t rte_bsf64_w(uint64_t v) { return rte_bsf64(v); } +int rte_bsf64_safe_w(uint64_t v, uint32_t *pos) { + return rte_bsf64_safe(v, pos); +} +uint32_t rte_fls_u32_w(uint32_t x) { return rte_fls_u32(x); } +uint32_t rte_fls_u64_w(uint64_t x) { return rte_fls_u64(x); } +int rte_is_power_of_2_w(uint32_t n) { return rte_is_power_of_2(n); } +uint32_t rte_align32pow2_w(uint32_t x) { return rte_align32pow2(x); } +uint32_t rte_align32prevpow2_w(uint32_t x) { return rte_align32prevpow2(x); } +uint64_t rte_align64pow2_w(uint64_t v) { return rte_align64pow2(v); } +uint64_t rte_align64prevpow2_w(uint64_t v) { return rte_align64prevpow2(v); } +uint32_t rte_log2_u32_w(uint32_t v) { return rte_log2_u32(v); } +uint32_t rte_log2_u64_w(uint64_t v) { return rte_log2_u64(v); } +void rte_rwlock_init_w(rte_rwlock_t *rwl) { rte_rwlock_init(rwl); } +void rte_rwlock_read_lock_w(rte_rwlock_t *rwl) { rte_rwlock_read_lock(rwl); } +int rte_rwlock_read_trylock_w(rte_rwlock_t *rwl) { + return rte_rwlock_read_trylock(rwl); +} +void rte_rwlock_read_unlock_w(rte_rwlock_t *rwl) { + rte_rwlock_read_unlock(rwl); +} +int rte_rwlock_write_trylock_w(rte_rwlock_t *rwl) { + return rte_rwlock_write_trylock(rwl); +} +void rte_rwlock_write_lock_w(rte_rwlock_t *rwl) { rte_rwlock_write_lock(rwl); } +void rte_rwlock_write_unlock_w(rte_rwlock_t *rwl) { + rte_rwlock_write_unlock(rwl); +} +int rte_rwlock_write_is_locked_w(rte_rwlock_t *rwl) { + return rte_rwlock_write_is_locked(rwl); +} +void rte_rwlock_read_lock_tm_w(rte_rwlock_t *rwl) { + rte_rwlock_read_lock_tm(rwl); +} +void rte_rwlock_read_unlock_tm_w(rte_rwlock_t *rwl) { + rte_rwlock_read_unlock_tm(rwl); +} +void rte_rwlock_write_lock_tm_w(rte_rwlock_t *rwl) { + rte_rwlock_write_lock_tm(rwl); +} +void rte_rwlock_write_unlock_tm_w(rte_rwlock_t *rwl) { + rte_rwlock_write_unlock_tm(rwl); +} +unsigned int rte_ring_mp_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_enqueue_bulk_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_sp_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space) { + return rte_ring_sp_enqueue_bulk_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_mp_hts_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_hts_enqueue_bulk_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_mc_hts_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_hts_dequeue_bulk_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_mp_hts_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_hts_enqueue_burst_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_mc_hts_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_hts_dequeue_burst_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_mp_hts_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_hts_enqueue_bulk(r, obj_table, n, free_space); +} +unsigned int rte_ring_mc_hts_dequeue_bulk_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available) { + return rte_ring_mc_hts_dequeue_bulk(r, obj_table, n, available); +} +unsigned int rte_ring_mp_hts_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_hts_enqueue_burst(r, obj_table, n, free_space); +} +unsigned int rte_ring_mc_hts_dequeue_burst_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available) { + return rte_ring_mc_hts_dequeue_burst(r, obj_table, n, available); +} +unsigned int rte_ring_mp_rts_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_rts_enqueue_bulk_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_mc_rts_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_rts_dequeue_bulk_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_mp_rts_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_rts_enqueue_burst_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_mc_rts_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_rts_dequeue_burst_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_mp_rts_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_rts_enqueue_bulk(r, obj_table, n, free_space); +} +unsigned int rte_ring_mc_rts_dequeue_bulk_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available) { + return rte_ring_mc_rts_dequeue_bulk(r, obj_table, n, available); +} +unsigned int rte_ring_mp_rts_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_rts_enqueue_burst(r, obj_table, n, free_space); +} +unsigned int rte_ring_mc_rts_dequeue_burst_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available) { + return rte_ring_mc_rts_dequeue_burst(r, obj_table, n, available); +} +uint32_t rte_ring_get_prod_htd_max_w(const struct rte_ring *r) { + return rte_ring_get_prod_htd_max(r); +} +int rte_ring_set_prod_htd_max_w(struct rte_ring *r, uint32_t v) { + return rte_ring_set_prod_htd_max(r, v); +} +uint32_t rte_ring_get_cons_htd_max_w(const struct rte_ring *r) { + return rte_ring_get_cons_htd_max(r); +} +int rte_ring_set_cons_htd_max_w(struct rte_ring *r, uint32_t v) { + return rte_ring_set_cons_htd_max(r, v); +} +unsigned int rte_ring_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_bulk_elem(r, obj_table, esize, n, free_space); +} +int rte_ring_mp_enqueue_elem_w(struct rte_ring *r, void *obj, + unsigned int esize) { + return rte_ring_mp_enqueue_elem(r, obj, esize); +} +int rte_ring_sp_enqueue_elem_w(struct rte_ring *r, void *obj, + unsigned int esize) { + return rte_ring_sp_enqueue_elem(r, obj, esize); +} +int rte_ring_enqueue_elem_w(struct rte_ring *r, void *obj, unsigned int esize) { + return rte_ring_enqueue_elem(r, obj, esize); +} +unsigned int rte_ring_mc_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available) { + return rte_ring_mc_dequeue_bulk_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_sc_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available) { + return rte_ring_sc_dequeue_bulk_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_dequeue_bulk_elem_w(struct rte_ring *r, void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available) { + return rte_ring_dequeue_bulk_elem(r, obj_table, esize, n, available); +} +int rte_ring_mc_dequeue_elem_w(struct rte_ring *r, void *obj_p, + unsigned int esize) { + return rte_ring_mc_dequeue_elem(r, obj_p, esize); +} +int rte_ring_sc_dequeue_elem_w(struct rte_ring *r, void *obj_p, + unsigned int esize) { + return rte_ring_sc_dequeue_elem(r, obj_p, esize); +} +int rte_ring_dequeue_elem_w(struct rte_ring *r, void *obj_p, + unsigned int esize) { + return rte_ring_dequeue_elem(r, obj_p, esize); +} +unsigned int rte_ring_mp_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_enqueue_burst_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_sp_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space) { + return rte_ring_sp_enqueue_burst_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_burst_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_mc_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_dequeue_burst_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_sc_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_sc_dequeue_burst_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_dequeue_burst_elem_w(struct rte_ring *r, void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available) { + return rte_ring_dequeue_burst_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_enqueue_bulk_elem_start_w(struct rte_ring *r, + unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_bulk_elem_start(r, n, free_space); +} +unsigned int rte_ring_enqueue_bulk_start_w(struct rte_ring *r, unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_bulk_start(r, n, free_space); +} +unsigned int rte_ring_enqueue_burst_elem_start_w(struct rte_ring *r, + unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_burst_elem_start(r, n, free_space); +} +unsigned int rte_ring_enqueue_burst_start_w(struct rte_ring *r, unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_burst_start(r, n, free_space); +} +void rte_ring_enqueue_elem_finish_w(struct rte_ring *r, const void *obj_table, + unsigned int esize, unsigned int n) { + rte_ring_enqueue_elem_finish(r, obj_table, esize, n); +} +void rte_ring_enqueue_finish_w(struct rte_ring *r, void *const *obj_table, + unsigned int n) { + rte_ring_enqueue_finish(r, obj_table, n); +} +unsigned int rte_ring_dequeue_bulk_elem_start_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_dequeue_bulk_elem_start(r, obj_table, esize, n, available); +} +unsigned int rte_ring_dequeue_bulk_start_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available) { + return rte_ring_dequeue_bulk_start(r, obj_table, n, available); +} +unsigned int rte_ring_dequeue_burst_elem_start_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_dequeue_burst_elem_start(r, obj_table, esize, n, available); +} +unsigned int rte_ring_dequeue_burst_start_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available) { + return rte_ring_dequeue_burst_start(r, obj_table, n, available); +} +void rte_ring_dequeue_elem_finish_w(struct rte_ring *r, unsigned int n) { + rte_ring_dequeue_elem_finish(r, n); +} +void rte_ring_dequeue_finish_w(struct rte_ring *r, unsigned int n) { + rte_ring_dequeue_finish(r, n); +} +unsigned int rte_ring_enqueue_zc_bulk_elem_start_w(struct rte_ring *r, + unsigned int esize, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *free_space) { + return rte_ring_enqueue_zc_bulk_elem_start(r, esize, n, zcd, free_space); +} +unsigned int rte_ring_enqueue_zc_bulk_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *free_space) { + return rte_ring_enqueue_zc_bulk_start(r, n, zcd, free_space); +} +unsigned int rte_ring_enqueue_zc_burst_elem_start_w( + struct rte_ring *r, unsigned int esize, unsigned int n, + struct rte_ring_zc_data *zcd, unsigned int *free_space) { + return rte_ring_enqueue_zc_burst_elem_start(r, esize, n, zcd, free_space); +} +unsigned int rte_ring_enqueue_zc_burst_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *free_space) { + return rte_ring_enqueue_zc_burst_start(r, n, zcd, free_space); +} +void rte_ring_enqueue_zc_elem_finish_w(struct rte_ring *r, unsigned int n) { + rte_ring_enqueue_zc_elem_finish(r, n); +} +void rte_ring_enqueue_zc_finish_w(struct rte_ring *r, unsigned int n) { + rte_ring_enqueue_zc_finish(r, n); +} +unsigned int rte_ring_dequeue_zc_bulk_elem_start_w(struct rte_ring *r, + unsigned int esize, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *available) { + return rte_ring_dequeue_zc_bulk_elem_start(r, esize, n, zcd, available); +} +unsigned int rte_ring_dequeue_zc_bulk_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *available) { + return rte_ring_dequeue_zc_bulk_start(r, n, zcd, available); +} +unsigned int rte_ring_dequeue_zc_burst_elem_start_w( + struct rte_ring *r, unsigned int esize, unsigned int n, + struct rte_ring_zc_data *zcd, unsigned int *available) { + return rte_ring_dequeue_zc_burst_elem_start(r, esize, n, zcd, available); +} +unsigned int rte_ring_dequeue_zc_burst_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *available) { + return rte_ring_dequeue_zc_burst_start(r, n, zcd, available); +} +void rte_ring_dequeue_zc_elem_finish_w(struct rte_ring *r, unsigned int n) { + rte_ring_dequeue_zc_elem_finish(r, n); +} +void rte_ring_dequeue_zc_finish_w(struct rte_ring *r, unsigned int n) { + rte_ring_dequeue_zc_finish(r, n); +} +unsigned int rte_ring_mp_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_enqueue_bulk(r, obj_table, n, free_space); +} +unsigned int rte_ring_sp_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space) { + return rte_ring_sp_enqueue_bulk(r, obj_table, n, free_space); +} +unsigned int rte_ring_enqueue_bulk_w(struct rte_ring *r, void *const *obj_table, + unsigned int n, unsigned int *free_space) { + return rte_ring_enqueue_bulk(r, obj_table, n, free_space); +} +int rte_ring_mp_enqueue_w(struct rte_ring *r, void *obj) { + return rte_ring_mp_enqueue(r, obj); +} +int rte_ring_sp_enqueue_w(struct rte_ring *r, void *obj) { + return rte_ring_sp_enqueue(r, obj); +} +int rte_ring_enqueue_w(struct rte_ring *r, void *obj) { + return rte_ring_enqueue(r, obj); +} +unsigned int rte_ring_mc_dequeue_bulk_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_dequeue_bulk(r, obj_table, n, available); +} +unsigned int rte_ring_sc_dequeue_bulk_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available) { + return rte_ring_sc_dequeue_bulk(r, obj_table, n, available); +} +unsigned int rte_ring_dequeue_bulk_w(struct rte_ring *r, void **obj_table, + unsigned int n, unsigned int *available) { + return rte_ring_dequeue_bulk(r, obj_table, n, available); +} +int rte_ring_mc_dequeue_w(struct rte_ring *r, void **obj_p) { + return rte_ring_mc_dequeue(r, obj_p); +} +int rte_ring_sc_dequeue_w(struct rte_ring *r, void **obj_p) { + return rte_ring_sc_dequeue(r, obj_p); +} +int rte_ring_dequeue_w(struct rte_ring *r, void **obj_p) { + return rte_ring_dequeue(r, obj_p); +} +unsigned int rte_ring_count_w(const struct rte_ring *r) { + return rte_ring_count(r); +} +unsigned int rte_ring_free_count_w(const struct rte_ring *r) { + return rte_ring_free_count(r); +} +int rte_ring_full_w(const struct rte_ring *r) { return rte_ring_full(r); } +int rte_ring_empty_w(const struct rte_ring *r) { return rte_ring_empty(r); } +unsigned int rte_ring_get_size_w(const struct rte_ring *r) { + return rte_ring_get_size(r); +} +unsigned int rte_ring_get_capacity_w(const struct rte_ring *r) { + return rte_ring_get_capacity(r); +} +enum rte_ring_sync_type +rte_ring_get_prod_sync_type_w(const struct rte_ring *r) { + return rte_ring_get_prod_sync_type(r); +} +int rte_ring_is_prod_single_w(const struct rte_ring *r) { + return rte_ring_is_prod_single(r); +} +enum rte_ring_sync_type +rte_ring_get_cons_sync_type_w(const struct rte_ring *r) { + return rte_ring_get_cons_sync_type(r); +} +int rte_ring_is_cons_single_w(const struct rte_ring *r) { + return rte_ring_is_cons_single(r); +} +unsigned int rte_ring_mp_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_enqueue_burst(r, obj_table, n, free_space); +} +unsigned int rte_ring_sp_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space) { + return rte_ring_sp_enqueue_burst(r, obj_table, n, free_space); +} +unsigned int rte_ring_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_burst(r, obj_table, n, free_space); +} +unsigned int rte_ring_mc_dequeue_burst_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_dequeue_burst(r, obj_table, n, available); +} +unsigned int rte_ring_sc_dequeue_burst_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available) { + return rte_ring_sc_dequeue_burst(r, obj_table, n, available); +} +unsigned int rte_ring_dequeue_burst_w(struct rte_ring *r, void **obj_table, + unsigned int n, unsigned int *available) { + return rte_ring_dequeue_burst(r, obj_table, n, available); +} +void *rte_memcpy_w(void *dst, const void *src, size_t n) { + return rte_memcpy(dst, src, n); +} +// void *rte_mov15_or_less_w(void *dst, const void *src, size_t n) { +// return rte_mov15_or_less(dst, src, n); +// } +void rte_mov16_w(uint8_t *dst, const uint8_t *src) { rte_mov16(dst, src); } +void rte_mov32_w(uint8_t *dst, const uint8_t *src) { rte_mov32(dst, src); } +void rte_mov64_w(uint8_t *dst, const uint8_t *src) { rte_mov64(dst, src); } +void rte_mov256_w(uint8_t *dst, const uint8_t *src) { rte_mov256(dst, src); } +// void *rte_memcpy_generic_w(void *dst, const void *src, size_t n) { +// return rte_memcpy_generic(dst, src, n); +// } +// void *rte_memcpy_aligned_w(void *dst, const void *src, size_t n) { +// return rte_memcpy_aligned(dst, src, n); +// } +struct rte_mempool_objhdr *rte_mempool_get_header_w(void *obj) { + return rte_mempool_get_header(obj); +} +struct rte_mempool *rte_mempool_from_obj_w(void *obj) { + return rte_mempool_from_obj(obj); +} +struct rte_mempool_objtlr *rte_mempool_get_trailer_w(void *obj) { + return rte_mempool_get_trailer(obj); +} +struct rte_mempool_ops *rte_mempool_get_ops_w(int ops_index) { + return rte_mempool_get_ops(ops_index); +} +int rte_mempool_ops_dequeue_bulk_w(struct rte_mempool *mp, void **obj_table, + unsigned int n) { + return rte_mempool_ops_dequeue_bulk(mp, obj_table, n); +} +int rte_mempool_ops_dequeue_contig_blocks_w(struct rte_mempool *mp, + void **first_obj_table, + unsigned int n) { + return rte_mempool_ops_dequeue_contig_blocks(mp, first_obj_table, n); +} +int rte_mempool_ops_enqueue_bulk_w(struct rte_mempool *mp, + void *const *obj_table, unsigned int n) { + return rte_mempool_ops_enqueue_bulk(mp, obj_table, n); +} +struct rte_mempool_cache *rte_mempool_default_cache_w(struct rte_mempool *mp, + unsigned int lcore_id) { + return rte_mempool_default_cache(mp, lcore_id); +} +void rte_mempool_cache_flush_w(struct rte_mempool_cache *cache, + struct rte_mempool *mp) { + rte_mempool_cache_flush(cache, mp); +} +void rte_mempool_do_generic_put_w(struct rte_mempool *mp, + void *const *obj_table, unsigned int n, + struct rte_mempool_cache *cache) { + rte_mempool_do_generic_put(mp, obj_table, n, cache); +} +void rte_mempool_generic_put_w(struct rte_mempool *mp, void *const *obj_table, + unsigned int n, + struct rte_mempool_cache *cache) { + rte_mempool_generic_put(mp, obj_table, n, cache); +} +void rte_mempool_put_bulk_w(struct rte_mempool *mp, void *const *obj_table, + unsigned int n) { + rte_mempool_put_bulk(mp, obj_table, n); +} +void rte_mempool_put_w(struct rte_mempool *mp, void *obj) { + rte_mempool_put(mp, obj); +} +int rte_mempool_do_generic_get_w(struct rte_mempool *mp, void **obj_table, + unsigned int n, + struct rte_mempool_cache *cache) { + return rte_mempool_do_generic_get(mp, obj_table, n, cache); +} +int rte_mempool_generic_get_w(struct rte_mempool *mp, void **obj_table, + unsigned int n, struct rte_mempool_cache *cache) { + return rte_mempool_generic_get(mp, obj_table, n, cache); +} +int rte_mempool_get_bulk_w(struct rte_mempool *mp, void **obj_table, + unsigned int n) { + return rte_mempool_get_bulk(mp, obj_table, n); +} +int rte_mempool_get_w(struct rte_mempool *mp, void **obj_p) { + return rte_mempool_get(mp, obj_p); +} +int rte_mempool_get_contig_blocks_w(struct rte_mempool *mp, + void **first_obj_table, unsigned int n) { + return rte_mempool_get_contig_blocks(mp, first_obj_table, n); +} +int rte_mempool_full_w(const struct rte_mempool *mp) { + return rte_mempool_full(mp); +} +int rte_mempool_empty_w(const struct rte_mempool *mp) { + return rte_mempool_empty(mp); +} +rte_iova_t rte_mempool_virt2iova_w(const void *elt) { + return rte_mempool_virt2iova(elt); +} +void *rte_mempool_get_priv_w(struct rte_mempool *mp) { + return rte_mempool_get_priv(mp); +} +void rte_prefetch0_w(const void *p) { rte_prefetch0(p); } +void rte_prefetch1_w(const void *p) { rte_prefetch1(p); } +void rte_prefetch2_w(const void *p) { rte_prefetch2(p); } +void rte_prefetch_non_temporal_w(const void *p) { + rte_prefetch_non_temporal(p); +} +void rte_prefetch0_write_w(const void *p) { rte_prefetch0_write(p); } +void rte_prefetch1_write_w(const void *p) { rte_prefetch1_write(p); } +void rte_prefetch2_write_w(const void *p) { rte_prefetch2_write(p); } +void rte_cldemote_w(const void *p) { rte_cldemote(p); } +uint16_t rte_constant_bswap16_w(uint16_t x) { return rte_constant_bswap16(x); } +uint32_t rte_constant_bswap32_w(uint32_t x) { return rte_constant_bswap32(x); } +uint64_t rte_constant_bswap64_w(uint64_t x) { return rte_constant_bswap64(x); } +// uint16_t rte_arch_bswap16_w(uint16_t _x) { return rte_arch_bswap16(_x); } +// uint32_t rte_arch_bswap32_w(uint32_t _x) { return rte_arch_bswap32(_x); } +// uint64_t rte_arch_bswap64_w(uint64_t _x) { return rte_arch_bswap64(_x); } +void rte_mbuf_prefetch_part1_w(struct rte_mbuf *m) { + rte_mbuf_prefetch_part1(m); +} +void rte_mbuf_prefetch_part2_w(struct rte_mbuf *m) { + rte_mbuf_prefetch_part2(m); +} +uint16_t rte_pktmbuf_priv_size_w(struct rte_mempool *mp) { + return rte_pktmbuf_priv_size(mp); +} +rte_iova_t rte_mbuf_iova_get_w(const struct rte_mbuf *m) { + return rte_mbuf_iova_get(m); +} +void rte_mbuf_iova_set_w(struct rte_mbuf *m, rte_iova_t iova) { + rte_mbuf_iova_set(m, iova); +} +rte_iova_t rte_mbuf_data_iova_w(const struct rte_mbuf *mb) { + return rte_mbuf_data_iova(mb); +} +rte_iova_t rte_mbuf_data_iova_default_w(const struct rte_mbuf *mb) { + return rte_mbuf_data_iova_default(mb); +} +struct rte_mbuf *rte_mbuf_from_indirect_w(struct rte_mbuf *mi) { + return rte_mbuf_from_indirect(mi); +} +char *rte_mbuf_buf_addr_w(struct rte_mbuf *mb, struct rte_mempool *mp) { + return rte_mbuf_buf_addr(mb, mp); +} +char *rte_mbuf_data_addr_default_w(struct rte_mbuf *mb) { + return rte_mbuf_data_addr_default(mb); +} +char *rte_mbuf_to_baddr_w(struct rte_mbuf *md) { return rte_mbuf_to_baddr(md); } +void *rte_mbuf_to_priv_w(struct rte_mbuf *m) { return rte_mbuf_to_priv(m); } +uint32_t rte_pktmbuf_priv_flags_w(struct rte_mempool *mp) { + return rte_pktmbuf_priv_flags(mp); +} +uint16_t rte_mbuf_refcnt_read_w(const struct rte_mbuf *m) { + return rte_mbuf_refcnt_read(m); +} +void rte_mbuf_refcnt_set_w(struct rte_mbuf *m, uint16_t new_value) { + rte_mbuf_refcnt_set(m, new_value); +} +uint16_t rte_mbuf_refcnt_update_w(struct rte_mbuf *m, int16_t value) { + return rte_mbuf_refcnt_update(m, value); +} +uint16_t +rte_mbuf_ext_refcnt_read_w(const struct rte_mbuf_ext_shared_info *shinfo) { + return rte_mbuf_ext_refcnt_read(shinfo); +} +void rte_mbuf_ext_refcnt_set_w(struct rte_mbuf_ext_shared_info *shinfo, + uint16_t new_value) { + rte_mbuf_ext_refcnt_set(shinfo, new_value); +} +uint16_t rte_mbuf_ext_refcnt_update_w(struct rte_mbuf_ext_shared_info *shinfo, + int16_t value) { + return rte_mbuf_ext_refcnt_update(shinfo, value); +} +struct rte_mbuf *rte_mbuf_raw_alloc_w(struct rte_mempool *mp) { + return rte_mbuf_raw_alloc(mp); +} +void rte_mbuf_raw_free_w(struct rte_mbuf *m) { rte_mbuf_raw_free(m); } +uint16_t rte_pktmbuf_data_room_size_w(struct rte_mempool *mp) { + return rte_pktmbuf_data_room_size(mp); +} +void rte_pktmbuf_reset_headroom_w(struct rte_mbuf *m) { + rte_pktmbuf_reset_headroom(m); +} +void rte_pktmbuf_reset_w(struct rte_mbuf *m) { rte_pktmbuf_reset(m); } +struct rte_mbuf *rte_pktmbuf_alloc_w(struct rte_mempool *mp) { + return rte_pktmbuf_alloc(mp); +} +int rte_pktmbuf_alloc_bulk_w(struct rte_mempool *pool, struct rte_mbuf **mbufs, + unsigned int count) { + return rte_pktmbuf_alloc_bulk(pool, mbufs, count); +} +struct rte_mbuf_ext_shared_info * +rte_pktmbuf_ext_shinfo_init_helper_w(void *buf_addr, uint16_t *buf_len, + rte_mbuf_extbuf_free_callback_t free_cb, + void *fcb_opaque) { + return rte_pktmbuf_ext_shinfo_init_helper(buf_addr, buf_len, free_cb, + fcb_opaque); +} +void rte_pktmbuf_attach_extbuf_w(struct rte_mbuf *m, void *buf_addr, + rte_iova_t buf_iova, uint16_t buf_len, + struct rte_mbuf_ext_shared_info *shinfo) { + rte_pktmbuf_attach_extbuf(m, buf_addr, buf_iova, buf_len, shinfo); +} +void rte_mbuf_dynfield_copy_w(struct rte_mbuf *mdst, + const struct rte_mbuf *msrc) { + rte_mbuf_dynfield_copy(mdst, msrc); +} +void rte_pktmbuf_attach_w(struct rte_mbuf *mi, struct rte_mbuf *m) { + rte_pktmbuf_attach(mi, m); +} +void rte_pktmbuf_detach_w(struct rte_mbuf *m) { rte_pktmbuf_detach(m); } +struct rte_mbuf *rte_pktmbuf_prefree_seg_w(struct rte_mbuf *m) { + return rte_pktmbuf_prefree_seg(m); +} +void rte_pktmbuf_free_seg_w(struct rte_mbuf *m) { rte_pktmbuf_free_seg(m); } +void rte_pktmbuf_free_w(struct rte_mbuf *m) { rte_pktmbuf_free(m); } +void rte_pktmbuf_refcnt_update_w(struct rte_mbuf *m, int16_t v) { + rte_pktmbuf_refcnt_update(m, v); +} +uint16_t rte_pktmbuf_headroom_w(const struct rte_mbuf *m) { + return rte_pktmbuf_headroom(m); +} +uint16_t rte_pktmbuf_tailroom_w(const struct rte_mbuf *m) { + return rte_pktmbuf_tailroom(m); +} +struct rte_mbuf *rte_pktmbuf_lastseg_w(struct rte_mbuf *m) { + return rte_pktmbuf_lastseg(m); +} +char *rte_pktmbuf_prepend_w(struct rte_mbuf *m, uint16_t len) { + return rte_pktmbuf_prepend(m, len); +} +char *rte_pktmbuf_append_w(struct rte_mbuf *m, uint16_t len) { + return rte_pktmbuf_append(m, len); +} +char *rte_pktmbuf_adj_w(struct rte_mbuf *m, uint16_t len) { + return rte_pktmbuf_adj(m, len); +} +int rte_pktmbuf_trim_w(struct rte_mbuf *m, uint16_t len) { + return rte_pktmbuf_trim(m, len); +} +int rte_pktmbuf_is_contiguous_w(const struct rte_mbuf *m) { + return rte_pktmbuf_is_contiguous(m); +} +const void *rte_pktmbuf_read_w(const struct rte_mbuf *m, uint32_t off, + uint32_t len, void *buf) { + return rte_pktmbuf_read(m, off, len, buf); +} +int rte_pktmbuf_chain_w(struct rte_mbuf *head, struct rte_mbuf *tail) { + return rte_pktmbuf_chain(head, tail); +} +uint64_t rte_mbuf_tx_offload_w(uint64_t il2, uint64_t il3, uint64_t il4, + uint64_t tso, uint64_t ol3, uint64_t ol2, + uint64_t unused) { + return rte_mbuf_tx_offload(il2, il3, il4, tso, ol3, ol2, unused); +} +int rte_validate_tx_offload_w(const struct rte_mbuf *m) { + return rte_validate_tx_offload(m); +} +int rte_pktmbuf_linearize_w(struct rte_mbuf *mbuf) { + return rte_pktmbuf_linearize(mbuf); +} +uint32_t rte_mbuf_sched_queue_get_w(const struct rte_mbuf *m) { + return rte_mbuf_sched_queue_get(m); +} +uint8_t rte_mbuf_sched_traffic_class_get_w(const struct rte_mbuf *m) { + return rte_mbuf_sched_traffic_class_get(m); +} +uint8_t rte_mbuf_sched_color_get_w(const struct rte_mbuf *m) { + return rte_mbuf_sched_color_get(m); +} +void rte_mbuf_sched_get_w(const struct rte_mbuf *m, uint32_t *queue_id, + uint8_t *traffic_class, uint8_t *color) { + rte_mbuf_sched_get(m, queue_id, traffic_class, color); +} +void rte_mbuf_sched_queue_set_w(struct rte_mbuf *m, uint32_t queue_id) { + rte_mbuf_sched_queue_set(m, queue_id); +} +void rte_mbuf_sched_traffic_class_set_w(struct rte_mbuf *m, + uint8_t traffic_class) { + rte_mbuf_sched_traffic_class_set(m, traffic_class); +} +void rte_mbuf_sched_color_set_w(struct rte_mbuf *m, uint8_t color) { + rte_mbuf_sched_color_set(m, color); +} +void rte_mbuf_sched_set_w(struct rte_mbuf *m, uint32_t queue_id, + uint8_t traffic_class, uint8_t color) { + rte_mbuf_sched_set(m, queue_id, traffic_class, color); +} +int rte_is_same_ether_addr_w(const struct rte_ether_addr *ea1, + const struct rte_ether_addr *ea2) { + return rte_is_same_ether_addr(ea1, ea2); +} +int rte_is_zero_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_zero_ether_addr(ea); +} +int rte_is_unicast_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_unicast_ether_addr(ea); +} +int rte_is_multicast_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_multicast_ether_addr(ea); +} +int rte_is_broadcast_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_broadcast_ether_addr(ea); +} +int rte_is_universal_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_universal_ether_addr(ea); +} +int rte_is_local_admin_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_local_admin_ether_addr(ea); +} +int rte_is_valid_assigned_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_valid_assigned_ether_addr(ea); +} +void rte_ether_addr_copy_w(const struct rte_ether_addr *ea_from, + struct rte_ether_addr *ea_to) { + rte_ether_addr_copy(ea_from, ea_to); +} +int rte_vlan_strip_w(struct rte_mbuf *m) { return rte_vlan_strip(m); } +int rte_vlan_insert_w(struct rte_mbuf **m) { return rte_vlan_insert(m); } +uint32_t rte_bitmap_get_memory_footprint_w(uint32_t n_bits) { + return rte_bitmap_get_memory_footprint(n_bits); +} +struct rte_bitmap *rte_bitmap_init_w(uint32_t n_bits, uint8_t *mem, + uint32_t mem_size) { + return rte_bitmap_init(n_bits, mem, mem_size); +} +struct rte_bitmap *rte_bitmap_init_with_all_set_w(uint32_t n_bits, uint8_t *mem, + uint32_t mem_size) { + return rte_bitmap_init_with_all_set(n_bits, mem, mem_size); +} +void rte_bitmap_free_w(struct rte_bitmap *bmp) { return rte_bitmap_free(bmp); } +void rte_bitmap_reset_w(struct rte_bitmap *bmp) { rte_bitmap_reset(bmp); } +void rte_bitmap_prefetch0_w(struct rte_bitmap *bmp, uint32_t pos) { + rte_bitmap_prefetch0(bmp, pos); +} +uint64_t rte_bitmap_get_w(struct rte_bitmap *bmp, uint32_t pos) { + return rte_bitmap_get(bmp, pos); +} +void rte_bitmap_set_w(struct rte_bitmap *bmp, uint32_t pos) { + rte_bitmap_set(bmp, pos); +} +void rte_bitmap_set_slab_w(struct rte_bitmap *bmp, uint32_t pos, + uint64_t slab) { + rte_bitmap_set_slab(bmp, pos, slab); +} +void rte_bitmap_clear_w(struct rte_bitmap *bmp, uint32_t pos) { + rte_bitmap_clear(bmp, pos); +} +int rte_bitmap_scan_w(struct rte_bitmap *bmp, uint32_t *pos, uint64_t *slab) { + return rte_bitmap_scan(bmp, pos, slab); +} +uint16_t rte_raw_cksum_w(const void *buf, size_t len) { + return rte_raw_cksum(buf, len); +} +int rte_raw_cksum_mbuf_w(const struct rte_mbuf *m, uint32_t off, uint32_t len, + uint16_t *cksum) { + return rte_raw_cksum_mbuf(m, off, len, cksum); +} +uint8_t rte_ipv4_hdr_len_w(const struct rte_ipv4_hdr *ipv4_hdr) { + return rte_ipv4_hdr_len(ipv4_hdr); +} +uint16_t rte_ipv4_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr) { + return rte_ipv4_cksum(ipv4_hdr); +} +uint16_t rte_ipv4_cksum_simple_w(const struct rte_ipv4_hdr *ipv4_hdr) { + return rte_ipv4_cksum_simple(ipv4_hdr); +} +uint16_t rte_ipv4_phdr_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr, + uint64_t ol_flags) { + return rte_ipv4_phdr_cksum(ipv4_hdr, ol_flags); +} +uint16_t rte_ipv4_udptcp_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr, + const void *l4_hdr) { + return rte_ipv4_udptcp_cksum(ipv4_hdr, l4_hdr); +} +uint16_t rte_ipv4_udptcp_cksum_mbuf_w(const struct rte_mbuf *m, + const struct rte_ipv4_hdr *ipv4_hdr, + uint16_t l4_off) { + return rte_ipv4_udptcp_cksum_mbuf(m, ipv4_hdr, l4_off); +} +int rte_ipv4_udptcp_cksum_verify_w(const struct rte_ipv4_hdr *ipv4_hdr, + const void *l4_hdr) { + return rte_ipv4_udptcp_cksum_verify(ipv4_hdr, l4_hdr); +} +int rte_ipv4_udptcp_cksum_mbuf_verify_w(const struct rte_mbuf *m, + const struct rte_ipv4_hdr *ipv4_hdr, + uint16_t l4_off) { + return rte_ipv4_udptcp_cksum_mbuf_verify(m, ipv4_hdr, l4_off); +} +bool rte_ipv6_addr_eq_w(const struct rte_ipv6_addr *a, + const struct rte_ipv6_addr *b) { + return rte_ipv6_addr_eq(a, b); +} +void rte_ipv6_addr_mask_w(struct rte_ipv6_addr *ip, uint8_t depth) { + rte_ipv6_addr_mask(ip, depth); +} +bool rte_ipv6_addr_eq_prefix_w(const struct rte_ipv6_addr *a, + const struct rte_ipv6_addr *b, uint8_t depth) { + return rte_ipv6_addr_eq_prefix(a, b, depth); +} +uint8_t rte_ipv6_mask_depth_w(const struct rte_ipv6_addr *mask) { + return rte_ipv6_mask_depth(mask); +} +bool rte_ipv6_addr_is_unspec_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_unspec(ip); +} +bool rte_ipv6_addr_is_loopback_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_loopback(ip); +} +bool rte_ipv6_addr_is_linklocal_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_linklocal(ip); +} +bool rte_ipv6_addr_is_sitelocal_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_sitelocal(ip); +} +bool rte_ipv6_addr_is_v4compat_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_v4compat(ip); +} +bool rte_ipv6_addr_is_v4mapped_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_v4mapped(ip); +} +bool rte_ipv6_addr_is_mcast_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_mcast(ip); +} +enum rte_ipv6_mc_scope rte_ipv6_mc_scope_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_mc_scope(ip); +} +void rte_ipv6_llocal_from_ethernet_w(struct rte_ipv6_addr *ip, + const struct rte_ether_addr *mac) { + rte_ipv6_llocal_from_ethernet(ip, mac); +} +void rte_ipv6_solnode_from_addr_w(struct rte_ipv6_addr *sol, + const struct rte_ipv6_addr *ip) { + rte_ipv6_solnode_from_addr(sol, ip); +} +void rte_ether_mcast_from_ipv6_w(struct rte_ether_addr *mac, + const struct rte_ipv6_addr *ip) { + rte_ether_mcast_from_ipv6(mac, ip); +} +int rte_ipv6_check_version_w(const struct rte_ipv6_hdr *ip) { + return rte_ipv6_check_version(ip); +} +uint16_t rte_ipv6_phdr_cksum_w(const struct rte_ipv6_hdr *ipv6_hdr, + uint64_t ol_flags) { + return rte_ipv6_phdr_cksum(ipv6_hdr, ol_flags); +} +uint16_t rte_ipv6_udptcp_cksum_w(const struct rte_ipv6_hdr *ipv6_hdr, + const void *l4_hdr) { + return rte_ipv6_udptcp_cksum(ipv6_hdr, l4_hdr); +} +uint16_t rte_ipv6_udptcp_cksum_mbuf_w(const struct rte_mbuf *m, + const struct rte_ipv6_hdr *ipv6_hdr, + uint16_t l4_off) { + return rte_ipv6_udptcp_cksum_mbuf(m, ipv6_hdr, l4_off); +} +int rte_ipv6_udptcp_cksum_verify_w(const struct rte_ipv6_hdr *ipv6_hdr, + const void *l4_hdr) { + return rte_ipv6_udptcp_cksum_verify(ipv6_hdr, l4_hdr); +} +int rte_ipv6_udptcp_cksum_mbuf_verify_w(const struct rte_mbuf *m, + const struct rte_ipv6_hdr *ipv6_hdr, + uint16_t l4_off) { + return rte_ipv6_udptcp_cksum_mbuf_verify(m, ipv6_hdr, l4_off); +} +int rte_ipv6_get_next_ext_w(const uint8_t *p, int proto, size_t *ext_len) { + return rte_ipv6_get_next_ext(p, proto, ext_len); +} +enum rte_color +rte_meter_srtcm_color_blind_check_w(struct rte_meter_srtcm *m, + struct rte_meter_srtcm_profile *p, + uint64_t time, uint32_t pkt_len) { + return rte_meter_srtcm_color_blind_check(m, p, time, pkt_len); +} +enum rte_color rte_meter_srtcm_color_aware_check_w( + struct rte_meter_srtcm *m, struct rte_meter_srtcm_profile *p, uint64_t time, + uint32_t pkt_len, enum rte_color pkt_color) { + return rte_meter_srtcm_color_aware_check(m, p, time, pkt_len, pkt_color); +} +enum rte_color +rte_meter_trtcm_color_blind_check_w(struct rte_meter_trtcm *m, + struct rte_meter_trtcm_profile *p, + uint64_t time, uint32_t pkt_len) { + return rte_meter_trtcm_color_blind_check(m, p, time, pkt_len); +} +enum rte_color rte_meter_trtcm_color_aware_check_w( + struct rte_meter_trtcm *m, struct rte_meter_trtcm_profile *p, uint64_t time, + uint32_t pkt_len, enum rte_color pkt_color) { + return rte_meter_trtcm_color_aware_check(m, p, time, pkt_len, pkt_color); +} +enum rte_color rte_meter_trtcm_rfc4115_color_blind_check_w( + struct rte_meter_trtcm_rfc4115 *m, + struct rte_meter_trtcm_rfc4115_profile *p, uint64_t time, + uint32_t pkt_len) { + return rte_meter_trtcm_rfc4115_color_blind_check(m, p, time, pkt_len); +} +enum rte_color rte_meter_trtcm_rfc4115_color_aware_check_w( + struct rte_meter_trtcm_rfc4115 *m, + struct rte_meter_trtcm_rfc4115_profile *p, uint64_t time, uint32_t pkt_len, + enum rte_color pkt_color) { + return rte_meter_trtcm_rfc4115_color_aware_check(m, p, time, pkt_len, + pkt_color); +} +uint64_t rte_eth_rss_hf_refine_w(uint64_t rss_hf) { + return rte_eth_rss_hf_refine(rss_hf); +} + +uint16_t rte_eth_rx_burst_w(uint16_t port_id, uint16_t queue_id, + struct rte_mbuf **rx_pkts, const uint16_t nb_pkts) { + return rte_eth_rx_burst(port_id, queue_id, rx_pkts, nb_pkts); +} +int rte_eth_rx_queue_count_w(uint16_t port_id, uint16_t queue_id) { + return rte_eth_rx_queue_count(port_id, queue_id); +} +int rte_eth_rx_descriptor_status_w(uint16_t port_id, uint16_t queue_id, + uint16_t offset) { + return rte_eth_rx_descriptor_status(port_id, queue_id, offset); +} +int rte_eth_tx_descriptor_status_w(uint16_t port_id, uint16_t queue_id, + uint16_t offset) { + return rte_eth_tx_descriptor_status(port_id, queue_id, offset); +} +uint16_t rte_eth_tx_burst_w(uint16_t port_id, uint16_t queue_id, + struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { + return rte_eth_tx_burst(port_id, queue_id, tx_pkts, nb_pkts); +} +uint16_t rte_eth_tx_prepare_w(uint16_t port_id, uint16_t queue_id, + struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { + return rte_eth_tx_prepare(port_id, queue_id, tx_pkts, nb_pkts); +} +uint16_t rte_eth_tx_buffer_flush_w(uint16_t port_id, uint16_t queue_id, + struct rte_eth_dev_tx_buffer *buffer) { + return rte_eth_tx_buffer_flush(port_id, queue_id, buffer); +} +uint16_t rte_eth_tx_buffer_w(uint16_t port_id, uint16_t queue_id, + struct rte_eth_dev_tx_buffer *buffer, + struct rte_mbuf *tx_pkt) { + return rte_eth_tx_buffer(port_id, queue_id, buffer, tx_pkt); +} +uint16_t +rte_eth_recycle_mbufs_w(uint16_t rx_port_id, uint16_t rx_queue_id, + uint16_t tx_port_id, uint16_t tx_queue_id, + struct rte_eth_recycle_rxq_info *recycle_rxq_info) { + return rte_eth_recycle_mbufs(rx_port_id, rx_queue_id, tx_port_id, tx_queue_id, + recycle_rxq_info); +} +int rte_eth_tx_queue_count_w(uint16_t port_id, uint16_t queue_id) { + return rte_eth_tx_queue_count(port_id, queue_id); +} +uint32_t rte_flow_dynf_metadata_get_w(struct rte_mbuf *m) { + return rte_flow_dynf_metadata_get(m); +} +void rte_flow_dynf_metadata_set_w(struct rte_mbuf *m, uint32_t v) { + rte_flow_dynf_metadata_set(m, v); +} +int rte_flow_dynf_metadata_avail_w(void) { + return rte_flow_dynf_metadata_avail(); +} +uint32_t rte_hash_crc_1byte_w(uint8_t data, uint32_t init_val) { + return rte_hash_crc_1byte(data, init_val); +} +uint32_t rte_hash_crc_2byte_w(uint16_t data, uint32_t init_val) { + return rte_hash_crc_2byte(data, init_val); +} +uint32_t rte_hash_crc_4byte_w(uint32_t data, uint32_t init_val) { + return rte_hash_crc_4byte(data, init_val); +} +uint32_t rte_hash_crc_8byte_w(uint64_t data, uint32_t init_val) { + return rte_hash_crc_8byte(data, init_val); +} +uint32_t rte_hash_crc_w(const void *data, uint32_t data_len, + uint32_t init_val) { + return rte_hash_crc(data, data_len, init_val); +} +void rte_jhash_2hashes_w(const void *key, uint32_t length, uint32_t *pc, + uint32_t *pb) { + rte_jhash_2hashes(key, length, pc, pb); +} +void rte_jhash_32b_2hashes_w(const uint32_t *k, uint32_t length, uint32_t *pc, + uint32_t *pb) { + rte_jhash_32b_2hashes(k, length, pc, pb); +} +uint32_t rte_jhash_w(const void *key, uint32_t length, uint32_t initval) { + return rte_jhash(key, length, initval); +} +uint32_t rte_jhash_32b_w(const uint32_t *k, uint32_t length, uint32_t initval) { + return rte_jhash_32b(k, length, initval); +} +uint32_t rte_jhash_3words_w(uint32_t a, uint32_t b, uint32_t c, + uint32_t initval) { + return rte_jhash_3words(a, b, c, initval); +} +uint32_t rte_jhash_2words_w(uint32_t a, uint32_t b, uint32_t initval) { + return rte_jhash_2words(a, b, initval); +} +uint32_t rte_jhash_1word_w(uint32_t a, uint32_t initval) { + return rte_jhash_1word(a, initval); +} +uint32_t rte_fbk_hash_get_bucket_w(const struct rte_fbk_hash_table *ht, + uint32_t key) { + return rte_fbk_hash_get_bucket(ht, key); +} +int rte_fbk_hash_add_key_with_bucket_w(struct rte_fbk_hash_table *ht, + uint32_t key, uint16_t value, + uint32_t bucket) { + return rte_fbk_hash_add_key_with_bucket(ht, key, value, bucket); +} +int rte_fbk_hash_add_key_w(struct rte_fbk_hash_table *ht, uint32_t key, + uint16_t value) { + return rte_fbk_hash_add_key(ht, key, value); +} +int rte_fbk_hash_delete_key_with_bucket_w(struct rte_fbk_hash_table *ht, + uint32_t key, uint32_t bucket) { + return rte_fbk_hash_delete_key_with_bucket(ht, key, bucket); +} +int rte_fbk_hash_delete_key_w(struct rte_fbk_hash_table *ht, uint32_t key) { + return rte_fbk_hash_delete_key(ht, key); +} +int rte_fbk_hash_lookup_with_bucket_w(const struct rte_fbk_hash_table *ht, + uint32_t key, uint32_t bucket) { + return rte_fbk_hash_lookup_with_bucket(ht, key, bucket); +} +int rte_fbk_hash_lookup_w(const struct rte_fbk_hash_table *ht, uint32_t key) { + return rte_fbk_hash_lookup(ht, key); +} +void rte_fbk_hash_clear_all_w(struct rte_fbk_hash_table *ht) { + rte_fbk_hash_clear_all(ht); +} +double rte_fbk_hash_get_load_factor_w(struct rte_fbk_hash_table *ht) { + return rte_fbk_hash_get_load_factor(ht); +} +void rte_rcu_qsbr_thread_online_w(struct rte_rcu_qsbr *v, + unsigned int thread_id) { + rte_rcu_qsbr_thread_online(v, thread_id); +} +void rte_rcu_qsbr_thread_offline_w(struct rte_rcu_qsbr *v, + unsigned int thread_id) { + rte_rcu_qsbr_thread_offline(v, thread_id); +} +void rte_rcu_qsbr_lock_w(struct rte_rcu_qsbr *v, unsigned int thread_id) { + rte_rcu_qsbr_lock(v, thread_id); +} +void rte_rcu_qsbr_unlock_w(struct rte_rcu_qsbr *v, unsigned int thread_id) { + rte_rcu_qsbr_unlock(v, thread_id); +} +uint64_t rte_rcu_qsbr_start_w(struct rte_rcu_qsbr *v) { + return rte_rcu_qsbr_start(v); +} +void rte_rcu_qsbr_quiescent_w(struct rte_rcu_qsbr *v, unsigned int thread_id) { + rte_rcu_qsbr_quiescent(v, thread_id); +} +int rte_rcu_qsbr_check_w(struct rte_rcu_qsbr *v, uint64_t t, bool wait) { + return rte_rcu_qsbr_check(v, t, wait); +} +uint8_t rte_read8_relaxed_w(const void *addr) { + return rte_read8_relaxed(addr); +} +uint16_t rte_read16_relaxed_w(const void *addr) { + return rte_read16_relaxed(addr); +} +uint32_t rte_read32_relaxed_w(const void *addr) { + return rte_read32_relaxed(addr); +} +uint64_t rte_read64_relaxed_w(const void *addr) { + return rte_read64_relaxed(addr); +} +void rte_write8_relaxed_w(uint8_t value, void *addr) { + rte_write8_relaxed(value, addr); +} +void rte_write16_relaxed_w(uint16_t value, void *addr) { + rte_write16_relaxed(value, addr); +} +void rte_write32_relaxed_w(uint32_t value, void *addr) { + rte_write32_relaxed(value, addr); +} +void rte_write64_relaxed_w(uint64_t value, void *addr) { + rte_write64_relaxed(value, addr); +} +uint8_t rte_read8_w(const void *addr) { return rte_read8(addr); } +uint16_t rte_read16_w(const void *addr) { return rte_read16(addr); } +uint32_t rte_read32_w(const void *addr) { return rte_read32(addr); } +uint64_t rte_read64_w(const void *addr) { return rte_read64(addr); } +void rte_write8_w(uint8_t value, void *addr) { rte_write8(value, addr); } +void rte_write16_w(uint16_t value, void *addr) { rte_write16(value, addr); } +void rte_write32_w(uint32_t value, void *addr) { rte_write32(value, addr); } +void rte_write64_w(uint64_t value, void *addr) { rte_write64(value, addr); } +void rte_write32_wc_relaxed_w(uint32_t value, void *addr) { + rte_write32_wc_relaxed(value, addr); +} +void rte_write32_wc_w(uint32_t value, void *addr) { + rte_write32_wc(value, addr); +} +void rte_mcslock_lock_w(rte_mcslock_t **msl, rte_mcslock_t *me) { + rte_mcslock_lock(msl, me); +} +void rte_mcslock_unlock_w(rte_mcslock_t **msl, rte_mcslock_t *me) { + rte_mcslock_unlock(msl, me); +} +int rte_mcslock_trylock_w(rte_mcslock_t **msl, rte_mcslock_t *me) { + return rte_mcslock_trylock(msl, me); +} +int rte_mcslock_is_locked_w(rte_mcslock_t *msl) { + return rte_mcslock_is_locked(msl); +} +void rte_pflock_init_w(struct rte_pflock *pf) { rte_pflock_init(pf); } +void rte_pflock_read_lock_w(rte_pflock_t *pf) { rte_pflock_read_lock(pf); } +void rte_pflock_read_unlock_w(rte_pflock_t *pf) { rte_pflock_read_unlock(pf); } +void rte_pflock_write_lock_w(rte_pflock_t *pf) { rte_pflock_write_lock(pf); } +void rte_pflock_write_unlock_w(rte_pflock_t *pf) { + rte_pflock_write_unlock(pf); +} +uint32_t rte_reciprocal_divide_w(uint32_t a, struct rte_reciprocal R) { + return rte_reciprocal_divide(a, R); +} +uint64_t rte_reciprocal_divide_u64_w(uint64_t a, + const struct rte_reciprocal_u64 *R) { + return rte_reciprocal_divide_u64(a, R); +} +void rte_seqcount_init_w(rte_seqcount_t *seqcount) { + rte_seqcount_init(seqcount); +} +uint32_t rte_seqcount_read_begin_w(const rte_seqcount_t *seqcount) { + return rte_seqcount_read_begin(seqcount); +} +bool rte_seqcount_read_retry_w(const rte_seqcount_t *seqcount, + uint32_t begin_sn) { + return rte_seqcount_read_retry(seqcount, begin_sn); +} +void rte_seqcount_write_begin_w(rte_seqcount_t *seqcount) { + rte_seqcount_write_begin(seqcount); +} +void rte_seqcount_write_end_w(rte_seqcount_t *seqcount) { + rte_seqcount_write_end(seqcount); +} +void rte_seqlock_init_w(rte_seqlock_t *seqlock) { rte_seqlock_init(seqlock); } +uint32_t rte_seqlock_read_begin_w(const rte_seqlock_t *seqlock) { + return rte_seqlock_read_begin(seqlock); +} +bool rte_seqlock_read_retry_w(const rte_seqlock_t *seqlock, uint32_t begin_sn) { + return rte_seqlock_read_retry(seqlock, begin_sn); +} +void rte_seqlock_write_lock_w(rte_seqlock_t *seqlock) { + rte_seqlock_write_lock(seqlock); +} +void rte_seqlock_write_unlock_w(rte_seqlock_t *seqlock) { + rte_seqlock_write_unlock(seqlock); +} +unsigned int rte_stack_push_w(struct rte_stack *s, void *const *obj_table, + unsigned int n) { + return rte_stack_push(s, obj_table, n); +} +unsigned int rte_stack_pop_w(struct rte_stack *s, void **obj_table, + unsigned int n) { + return rte_stack_pop(s, obj_table, n); +} +unsigned int rte_stack_count_w(struct rte_stack *s) { + return rte_stack_count(s); +} +unsigned int rte_stack_free_count_w(struct rte_stack *s) { + return rte_stack_free_count(s); +} +uint32_t rte_softrss_w(uint32_t *input_tuple, uint32_t input_len, + const uint8_t *rss_key) { + return rte_softrss(input_tuple, input_len, rss_key); +} +uint32_t rte_softrss_be_w(uint32_t *input_tuple, uint32_t input_len, + const uint8_t *rss_key) { + return rte_softrss_be(input_tuple, input_len, rss_key); +} +void rte_ticketlock_init_w(rte_ticketlock_t *tl) { rte_ticketlock_init(tl); } +void rte_ticketlock_lock_w(rte_ticketlock_t *tl) { rte_ticketlock_lock(tl); } +void rte_ticketlock_unlock_w(rte_ticketlock_t *tl) { + rte_ticketlock_unlock(tl); +} +int rte_ticketlock_trylock_w(rte_ticketlock_t *tl) { + return rte_ticketlock_trylock(tl); +} +int rte_ticketlock_is_locked_w(rte_ticketlock_t *tl) { + return rte_ticketlock_is_locked(tl); +} +void rte_ticketlock_recursive_init_w(rte_ticketlock_recursive_t *tlr) { + rte_ticketlock_recursive_init(tlr); +} +void rte_ticketlock_recursive_lock_w(rte_ticketlock_recursive_t *tlr) { + rte_ticketlock_recursive_lock(tlr); +} +void rte_ticketlock_recursive_unlock_w(rte_ticketlock_recursive_t *tlr) { + rte_ticketlock_recursive_unlock(tlr); +} +int rte_ticketlock_recursive_trylock_w(rte_ticketlock_recursive_t *tlr) { + return rte_ticketlock_recursive_trylock(tlr); +} +uint64_t rte_cyclecounter_cycles_to_ns_w(struct rte_timecounter *tc, + uint64_t cycles) { + return rte_cyclecounter_cycles_to_ns(tc, cycles); +} +uint64_t rte_timecounter_update_w(struct rte_timecounter *tc, + uint64_t cycle_now) { + return rte_timecounter_update(tc, cycle_now); +} +uint64_t rte_timespec_to_ns_w(const struct timespec *ts) { + return rte_timespec_to_ns(ts); +} +struct timespec rte_ns_to_timespec_w(uint64_t nsec) { + return rte_ns_to_timespec(nsec); +} +bool rte_trace_feature_is_enabled_w(void) { + return rte_trace_feature_is_enabled(); +} diff --git a/nix/target.nix b/nix/target.nix index 36cbe22ee..14c0f88e0 100644 --- a/nix/target.nix +++ b/nix/target.nix @@ -31,7 +31,15 @@ let NIX_CFLAGS_LINK = [ ]; }; }; - zen4 = lib.recursiveUpdate x86-64-v4 rec { + zen3 = lib.recursiveUpdate x86-64-v4 rec { + march = "znver3"; + override.stdenv.env = rec { + NIX_CFLAGS_COMPILE = [ "-march=${march}" ]; + NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; + NIX_CFLAGS_LINK = [ ]; + }; + }; + zen4 = lib.recursiveUpdate zen3 rec { march = "znver4"; override.stdenv.env = rec { NIX_CFLAGS_COMPILE = [ "-march=${march}" ]; diff --git a/sysfs/build.rs b/sysfs/build.rs index 52f5b0197..9d7c9069b 100644 --- a/sysfs/build.rs +++ b/sysfs/build.rs @@ -4,5 +4,5 @@ fn main() { let sysroot = dpdk_sysroot_helper::get_sysroot(); println!("cargo:rustc-link-search=all={sysroot}/lib"); - println!("cargo:rustc-link-arg=--sysroot={sysroot}"); + // println!("cargo:rustc-link-arg=--sysroot={sysroot}"); } diff --git a/sysroot b/sysroot deleted file mode 120000 index 22ffe82ea..000000000 --- a/sysroot +++ /dev/null @@ -1 +0,0 @@ -/nix/store/40gcqs5h4gbs9ixw16wbg9161mrxb0k2-sysroot \ No newline at end of file From a0d64a47ce9fe60e0e1b87be5928f49908a0a5fc Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 21 Dec 2025 18:23:13 +0000 Subject: [PATCH 064/163] wip --- default.nix | 17 +- nix/overlays/dataplane.nix | 6 +- nix/overlays/default.nix | 15 +- nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.c | 1513 +++++++++++++++++++ nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.h | 1716 ++++++---------------- nix/platform.nix | 83 -- npins/sources.json | 4 +- 7 files changed, 2009 insertions(+), 1345 deletions(-) delete mode 100644 nix/platform.nix diff --git a/default.nix b/default.nix index 1fde49210..04d3d9edc 100644 --- a/default.nix +++ b/default.nix @@ -56,12 +56,17 @@ let dpdk-wrapper.dev dpdk-wrapper.out ]; - build-tools-list = with pkgs.buildPackages.llvmPackages; [ - bintools - clang - libclang.lib - lld - ]; + build-tools-list = + with pkgs.buildPackages; + [ + llvmPackages.bintools + llvmPackages.clang + llvmPackages.libclang.lib + llvmPackages.lld + ] + ++ [ + npins + ]; in pkgs.lib.fix (final: { inherit diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index 3415552c2..44aef8cfb 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -66,7 +66,11 @@ in # At minimum, the provided functions are generally quite small and likely to benefit from inlining, so static linking # is a solid plan. libmd = (dataplane-dep prev.libmd).overrideAttrs (orig: { - outputs = (orig.outputs or [ "out" ]) ++ [ "man" "dev" "static" ]; + outputs = (orig.outputs or [ "out" ]) ++ [ + "man" + "dev" + "static" + ]; # we need to enable shared libs (in addition to static) to make dpdk's build happy. Basically, DPDK's build has no # means of disabling shared libraries, and it doesn't really make any sense to static link this into each .so # file. Ideally we would just _not_ build those .so files, but that would require doing brain surgery on dpdk's diff --git a/nix/overlays/default.nix b/nix/overlays/default.nix index 488472a3c..ecb927248 100644 --- a/nix/overlays/default.nix +++ b/nix/overlays/default.nix @@ -1,13 +1,18 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright Open Network Fabric Authors { - sources, - sanitizers, - target, - profile, + sources, + sanitizers, + target, + profile, }: { dataplane = import ./dataplane.nix { - inherit sources sanitizers target profile; + inherit + sources + sanitizers + target + profile + ; }; } diff --git a/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.c b/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.c index c9a6f09b7..2309a4ec9 100644 --- a/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.c +++ b/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.c @@ -3,3 +3,1516 @@ #include "dpdk_wrapper.h" +int rte_errno_get() { return rte_errno; } + +// Static wrappers + +int rte_is_aligned_w(const void *const ptr, const unsigned int align) { + return rte_is_aligned(ptr, align); +} +void rte_atomic_thread_fence_w(rte_memory_order memorder) { + rte_atomic_thread_fence(memorder); +} +int rte_atomic16_cmpset_w(uint16_t *dst, uint16_t exp, uint16_t src) { + return rte_atomic16_cmpset(dst, exp, src); +} +uint16_t rte_atomic16_exchange_w(uint16_t *dst, uint16_t val) { + return rte_atomic16_exchange(dst, val); +} +void rte_atomic16_init_w(rte_atomic16_t *v) { rte_atomic16_init(v); } +int16_t rte_atomic16_read_w(const rte_atomic16_t *v) { + return rte_atomic16_read(v); +} +void rte_atomic16_set_w(rte_atomic16_t *v, int16_t new_value) { + rte_atomic16_set(v, new_value); +} +void rte_atomic16_add_w(rte_atomic16_t *v, int16_t inc) { + rte_atomic16_add(v, inc); +} +void rte_atomic16_sub_w(rte_atomic16_t *v, int16_t dec) { + rte_atomic16_sub(v, dec); +} +void rte_atomic16_inc_w(rte_atomic16_t *v) { rte_atomic16_inc(v); } +void rte_atomic16_dec_w(rte_atomic16_t *v) { rte_atomic16_dec(v); } +int16_t rte_atomic16_add_return_w(rte_atomic16_t *v, int16_t inc) { + return rte_atomic16_add_return(v, inc); +} +int16_t rte_atomic16_sub_return_w(rte_atomic16_t *v, int16_t dec) { + return rte_atomic16_sub_return(v, dec); +} +int rte_atomic16_inc_and_test_w(rte_atomic16_t *v) { + return rte_atomic16_inc_and_test(v); +} +int rte_atomic16_dec_and_test_w(rte_atomic16_t *v) { + return rte_atomic16_dec_and_test(v); +} +int rte_atomic16_test_and_set_w(rte_atomic16_t *v) { + return rte_atomic16_test_and_set(v); +} +void rte_atomic16_clear_w(rte_atomic16_t *v) { rte_atomic16_clear(v); } +int rte_atomic32_cmpset_w(uint32_t *dst, uint32_t exp, uint32_t src) { + return rte_atomic32_cmpset(dst, exp, src); +} +uint32_t rte_atomic32_exchange_w(uint32_t *dst, uint32_t val) { + return rte_atomic32_exchange(dst, val); +} +void rte_atomic32_init_w(rte_atomic32_t *v) { rte_atomic32_init(v); } +int32_t rte_atomic32_read_w(const rte_atomic32_t *v) { + return rte_atomic32_read(v); +} +void rte_atomic32_set_w(rte_atomic32_t *v, int32_t new_value) { + rte_atomic32_set(v, new_value); +} +void rte_atomic32_add_w(rte_atomic32_t *v, int32_t inc) { + rte_atomic32_add(v, inc); +} +void rte_atomic32_sub_w(rte_atomic32_t *v, int32_t dec) { + rte_atomic32_sub(v, dec); +} +void rte_atomic32_inc_w(rte_atomic32_t *v) { rte_atomic32_inc(v); } +void rte_atomic32_dec_w(rte_atomic32_t *v) { rte_atomic32_dec(v); } +int32_t rte_atomic32_add_return_w(rte_atomic32_t *v, int32_t inc) { + return rte_atomic32_add_return(v, inc); +} +int32_t rte_atomic32_sub_return_w(rte_atomic32_t *v, int32_t dec) { + return rte_atomic32_sub_return(v, dec); +} +int rte_atomic32_inc_and_test_w(rte_atomic32_t *v) { + return rte_atomic32_inc_and_test(v); +} +int rte_atomic32_dec_and_test_w(rte_atomic32_t *v) { + return rte_atomic32_dec_and_test(v); +} +int rte_atomic32_test_and_set_w(rte_atomic32_t *v) { + return rte_atomic32_test_and_set(v); +} +void rte_atomic32_clear_w(rte_atomic32_t *v) { rte_atomic32_clear(v); } +int rte_atomic64_cmpset_w(uint64_t *dst, uint64_t exp, uint64_t src) { + return rte_atomic64_cmpset(dst, exp, src); +} +uint64_t rte_atomic64_exchange_w(uint64_t *dst, uint64_t val) { + return rte_atomic64_exchange(dst, val); +} +void rte_atomic64_init_w(rte_atomic64_t *v) { rte_atomic64_init(v); } +int64_t rte_atomic64_read_w(rte_atomic64_t *v) { return rte_atomic64_read(v); } +void rte_atomic64_set_w(rte_atomic64_t *v, int64_t new_value) { + rte_atomic64_set(v, new_value); +} +void rte_atomic64_add_w(rte_atomic64_t *v, int64_t inc) { + rte_atomic64_add(v, inc); +} +void rte_atomic64_sub_w(rte_atomic64_t *v, int64_t dec) { + rte_atomic64_sub(v, dec); +} +void rte_atomic64_inc_w(rte_atomic64_t *v) { rte_atomic64_inc(v); } +void rte_atomic64_dec_w(rte_atomic64_t *v) { rte_atomic64_dec(v); } +int64_t rte_atomic64_add_return_w(rte_atomic64_t *v, int64_t inc) { + return rte_atomic64_add_return(v, inc); +} +int64_t rte_atomic64_sub_return_w(rte_atomic64_t *v, int64_t dec) { + return rte_atomic64_sub_return(v, dec); +} +int rte_atomic64_inc_and_test_w(rte_atomic64_t *v) { + return rte_atomic64_inc_and_test(v); +} +int rte_atomic64_dec_and_test_w(rte_atomic64_t *v) { + return rte_atomic64_dec_and_test(v); +} +int rte_atomic64_test_and_set_w(rte_atomic64_t *v) { + return rte_atomic64_test_and_set(v); +} +void rte_atomic64_clear_w(rte_atomic64_t *v) { rte_atomic64_clear(v); } +void rte_smp_mb_w(void) { rte_smp_mb(); } +uint64_t rte_get_tsc_cycles_w(void) { return rte_get_tsc_cycles(); } +uint64_t rte_get_timer_cycles_w(void) { return rte_get_timer_cycles(); } +uint64_t rte_get_timer_hz_w(void) { return rte_get_timer_hz(); } +void rte_delay_ms_w(unsigned int ms) { rte_delay_ms(ms); } +uint64_t rte_rdtsc_w(void) { return rte_rdtsc(); } +uint64_t rte_rdtsc_precise_w(void) { return rte_rdtsc_precise(); } +size_t rte_strlcpy_w(char *dst, const char *src, size_t size) { + return rte_strlcpy(dst, src, size); +} +size_t rte_strlcat_w(char *dst, const char *src, size_t size) { + return rte_strlcat(dst, src, size); +} +const char *rte_str_skip_leading_spaces_w(const char *src) { + return rte_str_skip_leading_spaces(src); +} +void rte_uuid_copy_w(rte_uuid_t dst, const rte_uuid_t src) { + rte_uuid_copy(dst, src); +} +int rte_gettid_w(void) { return rte_gettid(); } +unsigned int rte_lcore_id_w(void) { return rte_lcore_id(); } +void rte_pause_w(void) { rte_pause(); } +void rte_wait_until_equal_16_w(uint16_t *addr, uint16_t expected, + rte_memory_order memorder) { + rte_wait_until_equal_16(addr, expected, memorder); +} +void rte_wait_until_equal_32_w(uint32_t *addr, uint32_t expected, + rte_memory_order memorder) { + rte_wait_until_equal_32(addr, expected, memorder); +} +void rte_wait_until_equal_64_w(uint64_t *addr, uint64_t expected, + rte_memory_order memorder) { + rte_wait_until_equal_64(addr, expected, memorder); +} +void rte_spinlock_init_w(rte_spinlock_t *sl) { rte_spinlock_init(sl); } +void rte_spinlock_lock_w(rte_spinlock_t *sl) { rte_spinlock_lock(sl); } +void rte_spinlock_unlock_w(rte_spinlock_t *sl) { rte_spinlock_unlock(sl); } +int rte_spinlock_trylock_w(rte_spinlock_t *sl) { + return rte_spinlock_trylock(sl); +} +int rte_spinlock_is_locked_w(rte_spinlock_t *sl) { + return rte_spinlock_is_locked(sl); +} +int rte_tm_supported_w(void) { return rte_tm_supported(); } +void rte_spinlock_lock_tm_w(rte_spinlock_t *sl) { rte_spinlock_lock_tm(sl); } +void rte_spinlock_unlock_tm_w(rte_spinlock_t *sl) { + rte_spinlock_unlock_tm(sl); +} +int rte_spinlock_trylock_tm_w(rte_spinlock_t *sl) { + return rte_spinlock_trylock_tm(sl); +} +void rte_spinlock_recursive_init_w(rte_spinlock_recursive_t *slr) { + rte_spinlock_recursive_init(slr); +} +void rte_spinlock_recursive_lock_w(rte_spinlock_recursive_t *slr) { + rte_spinlock_recursive_lock(slr); +} +void rte_spinlock_recursive_unlock_w(rte_spinlock_recursive_t *slr) { + rte_spinlock_recursive_unlock(slr); +} +int rte_spinlock_recursive_trylock_w(rte_spinlock_recursive_t *slr) { + return rte_spinlock_recursive_trylock(slr); +} +void rte_spinlock_recursive_lock_tm_w(rte_spinlock_recursive_t *slr) { + rte_spinlock_recursive_lock_tm(slr); +} +void rte_spinlock_recursive_unlock_tm_w(rte_spinlock_recursive_t *slr) { + rte_spinlock_recursive_unlock_tm(slr); +} +int rte_spinlock_recursive_trylock_tm_w(rte_spinlock_recursive_t *slr) { + return rte_spinlock_recursive_trylock_tm(slr); +} +// unsigned int rte_xbegin_w(void) { return rte_xbegin(); } +// void rte_xend_w(void) { rte_xend(); } +// int rte_xtest_w(void) { return rte_xtest(); } +// int rte_try_tm_w(int *lock) { return rte_try_tm(lock); } +uint32_t rte_bit_relaxed_get32_w(unsigned int nr, uint32_t *addr) { + return rte_bit_relaxed_get32(nr, addr); +} +void rte_bit_relaxed_set32_w(unsigned int nr, uint32_t *addr) { + rte_bit_relaxed_set32(nr, addr); +} +void rte_bit_relaxed_clear32_w(unsigned int nr, uint32_t *addr) { + rte_bit_relaxed_clear32(nr, addr); +} +uint32_t rte_bit_relaxed_test_and_set32_w(unsigned int nr, uint32_t *addr) { + return rte_bit_relaxed_test_and_set32(nr, addr); +} +uint32_t rte_bit_relaxed_test_and_clear32_w(unsigned int nr, uint32_t *addr) { + return rte_bit_relaxed_test_and_clear32(nr, addr); +} +uint64_t rte_bit_relaxed_get64_w(unsigned int nr, uint64_t *addr) { + return rte_bit_relaxed_get64(nr, addr); +} +void rte_bit_relaxed_set64_w(unsigned int nr, uint64_t *addr) { + rte_bit_relaxed_set64(nr, addr); +} +void rte_bit_relaxed_clear64_w(unsigned int nr, uint64_t *addr) { + rte_bit_relaxed_clear64(nr, addr); +} +uint64_t rte_bit_relaxed_test_and_set64_w(unsigned int nr, uint64_t *addr) { + return rte_bit_relaxed_test_and_set64(nr, addr); +} +uint64_t rte_bit_relaxed_test_and_clear64_w(unsigned int nr, uint64_t *addr) { + return rte_bit_relaxed_test_and_clear64(nr, addr); +} +unsigned int rte_clz32_w(uint32_t v) { return rte_clz32(v); } +unsigned int rte_clz64_w(uint64_t v) { return rte_clz64(v); } +unsigned int rte_ctz32_w(uint32_t v) { return rte_ctz32(v); } +unsigned int rte_ctz64_w(uint64_t v) { return rte_ctz64(v); } +unsigned int rte_popcount32_w(uint32_t v) { return rte_popcount32(v); } +unsigned int rte_popcount64_w(uint64_t v) { return rte_popcount64(v); } +uint32_t rte_combine32ms1b_w(uint32_t x) { return rte_combine32ms1b(x); } +uint64_t rte_combine64ms1b_w(uint64_t v) { return rte_combine64ms1b(v); } +uint32_t rte_bsf32_w(uint32_t v) { return rte_bsf32(v); } +int rte_bsf32_safe_w(uint32_t v, uint32_t *pos) { + return rte_bsf32_safe(v, pos); +} +uint32_t rte_bsf64_w(uint64_t v) { return rte_bsf64(v); } +int rte_bsf64_safe_w(uint64_t v, uint32_t *pos) { + return rte_bsf64_safe(v, pos); +} +uint32_t rte_fls_u32_w(uint32_t x) { return rte_fls_u32(x); } +uint32_t rte_fls_u64_w(uint64_t x) { return rte_fls_u64(x); } +int rte_is_power_of_2_w(uint32_t n) { return rte_is_power_of_2(n); } +uint32_t rte_align32pow2_w(uint32_t x) { return rte_align32pow2(x); } +uint32_t rte_align32prevpow2_w(uint32_t x) { return rte_align32prevpow2(x); } +uint64_t rte_align64pow2_w(uint64_t v) { return rte_align64pow2(v); } +uint64_t rte_align64prevpow2_w(uint64_t v) { return rte_align64prevpow2(v); } +uint32_t rte_log2_u32_w(uint32_t v) { return rte_log2_u32(v); } +uint32_t rte_log2_u64_w(uint64_t v) { return rte_log2_u64(v); } +void rte_rwlock_init_w(rte_rwlock_t *rwl) { rte_rwlock_init(rwl); } +void rte_rwlock_read_lock_w(rte_rwlock_t *rwl) { rte_rwlock_read_lock(rwl); } +int rte_rwlock_read_trylock_w(rte_rwlock_t *rwl) { + return rte_rwlock_read_trylock(rwl); +} +void rte_rwlock_read_unlock_w(rte_rwlock_t *rwl) { + rte_rwlock_read_unlock(rwl); +} +int rte_rwlock_write_trylock_w(rte_rwlock_t *rwl) { + return rte_rwlock_write_trylock(rwl); +} +void rte_rwlock_write_lock_w(rte_rwlock_t *rwl) { rte_rwlock_write_lock(rwl); } +void rte_rwlock_write_unlock_w(rte_rwlock_t *rwl) { + rte_rwlock_write_unlock(rwl); +} +int rte_rwlock_write_is_locked_w(rte_rwlock_t *rwl) { + return rte_rwlock_write_is_locked(rwl); +} +void rte_rwlock_read_lock_tm_w(rte_rwlock_t *rwl) { + rte_rwlock_read_lock_tm(rwl); +} +void rte_rwlock_read_unlock_tm_w(rte_rwlock_t *rwl) { + rte_rwlock_read_unlock_tm(rwl); +} +void rte_rwlock_write_lock_tm_w(rte_rwlock_t *rwl) { + rte_rwlock_write_lock_tm(rwl); +} +void rte_rwlock_write_unlock_tm_w(rte_rwlock_t *rwl) { + rte_rwlock_write_unlock_tm(rwl); +} +unsigned int rte_ring_mp_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_enqueue_bulk_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_sp_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space) { + return rte_ring_sp_enqueue_bulk_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_mp_hts_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_hts_enqueue_bulk_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_mc_hts_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_hts_dequeue_bulk_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_mp_hts_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_hts_enqueue_burst_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_mc_hts_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_hts_dequeue_burst_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_mp_hts_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_hts_enqueue_bulk(r, obj_table, n, free_space); +} +unsigned int rte_ring_mc_hts_dequeue_bulk_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available) { + return rte_ring_mc_hts_dequeue_bulk(r, obj_table, n, available); +} +unsigned int rte_ring_mp_hts_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_hts_enqueue_burst(r, obj_table, n, free_space); +} +unsigned int rte_ring_mc_hts_dequeue_burst_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available) { + return rte_ring_mc_hts_dequeue_burst(r, obj_table, n, available); +} +unsigned int rte_ring_mp_rts_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_rts_enqueue_bulk_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_mc_rts_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_rts_dequeue_bulk_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_mp_rts_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_rts_enqueue_burst_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_mc_rts_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_rts_dequeue_burst_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_mp_rts_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_rts_enqueue_bulk(r, obj_table, n, free_space); +} +unsigned int rte_ring_mc_rts_dequeue_bulk_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available) { + return rte_ring_mc_rts_dequeue_bulk(r, obj_table, n, available); +} +unsigned int rte_ring_mp_rts_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_rts_enqueue_burst(r, obj_table, n, free_space); +} +unsigned int rte_ring_mc_rts_dequeue_burst_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available) { + return rte_ring_mc_rts_dequeue_burst(r, obj_table, n, available); +} +uint32_t rte_ring_get_prod_htd_max_w(const struct rte_ring *r) { + return rte_ring_get_prod_htd_max(r); +} +int rte_ring_set_prod_htd_max_w(struct rte_ring *r, uint32_t v) { + return rte_ring_set_prod_htd_max(r, v); +} +uint32_t rte_ring_get_cons_htd_max_w(const struct rte_ring *r) { + return rte_ring_get_cons_htd_max(r); +} +int rte_ring_set_cons_htd_max_w(struct rte_ring *r, uint32_t v) { + return rte_ring_set_cons_htd_max(r, v); +} +unsigned int rte_ring_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_bulk_elem(r, obj_table, esize, n, free_space); +} +int rte_ring_mp_enqueue_elem_w(struct rte_ring *r, void *obj, + unsigned int esize) { + return rte_ring_mp_enqueue_elem(r, obj, esize); +} +int rte_ring_sp_enqueue_elem_w(struct rte_ring *r, void *obj, + unsigned int esize) { + return rte_ring_sp_enqueue_elem(r, obj, esize); +} +int rte_ring_enqueue_elem_w(struct rte_ring *r, void *obj, unsigned int esize) { + return rte_ring_enqueue_elem(r, obj, esize); +} +unsigned int rte_ring_mc_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available) { + return rte_ring_mc_dequeue_bulk_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_sc_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available) { + return rte_ring_sc_dequeue_bulk_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_dequeue_bulk_elem_w(struct rte_ring *r, void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available) { + return rte_ring_dequeue_bulk_elem(r, obj_table, esize, n, available); +} +int rte_ring_mc_dequeue_elem_w(struct rte_ring *r, void *obj_p, + unsigned int esize) { + return rte_ring_mc_dequeue_elem(r, obj_p, esize); +} +int rte_ring_sc_dequeue_elem_w(struct rte_ring *r, void *obj_p, + unsigned int esize) { + return rte_ring_sc_dequeue_elem(r, obj_p, esize); +} +int rte_ring_dequeue_elem_w(struct rte_ring *r, void *obj_p, + unsigned int esize) { + return rte_ring_dequeue_elem(r, obj_p, esize); +} +unsigned int rte_ring_mp_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_enqueue_burst_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_sp_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space) { + return rte_ring_sp_enqueue_burst_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_burst_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_mc_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_dequeue_burst_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_sc_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_sc_dequeue_burst_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_dequeue_burst_elem_w(struct rte_ring *r, void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available) { + return rte_ring_dequeue_burst_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_enqueue_bulk_elem_start_w(struct rte_ring *r, + unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_bulk_elem_start(r, n, free_space); +} +unsigned int rte_ring_enqueue_bulk_start_w(struct rte_ring *r, unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_bulk_start(r, n, free_space); +} +unsigned int rte_ring_enqueue_burst_elem_start_w(struct rte_ring *r, + unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_burst_elem_start(r, n, free_space); +} +unsigned int rte_ring_enqueue_burst_start_w(struct rte_ring *r, unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_burst_start(r, n, free_space); +} +void rte_ring_enqueue_elem_finish_w(struct rte_ring *r, const void *obj_table, + unsigned int esize, unsigned int n) { + rte_ring_enqueue_elem_finish(r, obj_table, esize, n); +} +void rte_ring_enqueue_finish_w(struct rte_ring *r, void *const *obj_table, + unsigned int n) { + rte_ring_enqueue_finish(r, obj_table, n); +} +unsigned int rte_ring_dequeue_bulk_elem_start_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_dequeue_bulk_elem_start(r, obj_table, esize, n, available); +} +unsigned int rte_ring_dequeue_bulk_start_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available) { + return rte_ring_dequeue_bulk_start(r, obj_table, n, available); +} +unsigned int rte_ring_dequeue_burst_elem_start_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_dequeue_burst_elem_start(r, obj_table, esize, n, available); +} +unsigned int rte_ring_dequeue_burst_start_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available) { + return rte_ring_dequeue_burst_start(r, obj_table, n, available); +} +void rte_ring_dequeue_elem_finish_w(struct rte_ring *r, unsigned int n) { + rte_ring_dequeue_elem_finish(r, n); +} +void rte_ring_dequeue_finish_w(struct rte_ring *r, unsigned int n) { + rte_ring_dequeue_finish(r, n); +} +unsigned int rte_ring_enqueue_zc_bulk_elem_start_w(struct rte_ring *r, + unsigned int esize, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *free_space) { + return rte_ring_enqueue_zc_bulk_elem_start(r, esize, n, zcd, free_space); +} +unsigned int rte_ring_enqueue_zc_bulk_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *free_space) { + return rte_ring_enqueue_zc_bulk_start(r, n, zcd, free_space); +} +unsigned int rte_ring_enqueue_zc_burst_elem_start_w( + struct rte_ring *r, unsigned int esize, unsigned int n, + struct rte_ring_zc_data *zcd, unsigned int *free_space) { + return rte_ring_enqueue_zc_burst_elem_start(r, esize, n, zcd, free_space); +} +unsigned int rte_ring_enqueue_zc_burst_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *free_space) { + return rte_ring_enqueue_zc_burst_start(r, n, zcd, free_space); +} +void rte_ring_enqueue_zc_elem_finish_w(struct rte_ring *r, unsigned int n) { + rte_ring_enqueue_zc_elem_finish(r, n); +} +void rte_ring_enqueue_zc_finish_w(struct rte_ring *r, unsigned int n) { + rte_ring_enqueue_zc_finish(r, n); +} +unsigned int rte_ring_dequeue_zc_bulk_elem_start_w(struct rte_ring *r, + unsigned int esize, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *available) { + return rte_ring_dequeue_zc_bulk_elem_start(r, esize, n, zcd, available); +} +unsigned int rte_ring_dequeue_zc_bulk_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *available) { + return rte_ring_dequeue_zc_bulk_start(r, n, zcd, available); +} +unsigned int rte_ring_dequeue_zc_burst_elem_start_w( + struct rte_ring *r, unsigned int esize, unsigned int n, + struct rte_ring_zc_data *zcd, unsigned int *available) { + return rte_ring_dequeue_zc_burst_elem_start(r, esize, n, zcd, available); +} +unsigned int rte_ring_dequeue_zc_burst_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *available) { + return rte_ring_dequeue_zc_burst_start(r, n, zcd, available); +} +void rte_ring_dequeue_zc_elem_finish_w(struct rte_ring *r, unsigned int n) { + rte_ring_dequeue_zc_elem_finish(r, n); +} +void rte_ring_dequeue_zc_finish_w(struct rte_ring *r, unsigned int n) { + rte_ring_dequeue_zc_finish(r, n); +} +unsigned int rte_ring_mp_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_enqueue_bulk(r, obj_table, n, free_space); +} +unsigned int rte_ring_sp_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space) { + return rte_ring_sp_enqueue_bulk(r, obj_table, n, free_space); +} +unsigned int rte_ring_enqueue_bulk_w(struct rte_ring *r, void *const *obj_table, + unsigned int n, unsigned int *free_space) { + return rte_ring_enqueue_bulk(r, obj_table, n, free_space); +} +int rte_ring_mp_enqueue_w(struct rte_ring *r, void *obj) { + return rte_ring_mp_enqueue(r, obj); +} +int rte_ring_sp_enqueue_w(struct rte_ring *r, void *obj) { + return rte_ring_sp_enqueue(r, obj); +} +int rte_ring_enqueue_w(struct rte_ring *r, void *obj) { + return rte_ring_enqueue(r, obj); +} +unsigned int rte_ring_mc_dequeue_bulk_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_dequeue_bulk(r, obj_table, n, available); +} +unsigned int rte_ring_sc_dequeue_bulk_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available) { + return rte_ring_sc_dequeue_bulk(r, obj_table, n, available); +} +unsigned int rte_ring_dequeue_bulk_w(struct rte_ring *r, void **obj_table, + unsigned int n, unsigned int *available) { + return rte_ring_dequeue_bulk(r, obj_table, n, available); +} +int rte_ring_mc_dequeue_w(struct rte_ring *r, void **obj_p) { + return rte_ring_mc_dequeue(r, obj_p); +} +int rte_ring_sc_dequeue_w(struct rte_ring *r, void **obj_p) { + return rte_ring_sc_dequeue(r, obj_p); +} +int rte_ring_dequeue_w(struct rte_ring *r, void **obj_p) { + return rte_ring_dequeue(r, obj_p); +} +unsigned int rte_ring_count_w(const struct rte_ring *r) { + return rte_ring_count(r); +} +unsigned int rte_ring_free_count_w(const struct rte_ring *r) { + return rte_ring_free_count(r); +} +int rte_ring_full_w(const struct rte_ring *r) { return rte_ring_full(r); } +int rte_ring_empty_w(const struct rte_ring *r) { return rte_ring_empty(r); } +unsigned int rte_ring_get_size_w(const struct rte_ring *r) { + return rte_ring_get_size(r); +} +unsigned int rte_ring_get_capacity_w(const struct rte_ring *r) { + return rte_ring_get_capacity(r); +} +enum rte_ring_sync_type +rte_ring_get_prod_sync_type_w(const struct rte_ring *r) { + return rte_ring_get_prod_sync_type(r); +} +int rte_ring_is_prod_single_w(const struct rte_ring *r) { + return rte_ring_is_prod_single(r); +} +enum rte_ring_sync_type +rte_ring_get_cons_sync_type_w(const struct rte_ring *r) { + return rte_ring_get_cons_sync_type(r); +} +int rte_ring_is_cons_single_w(const struct rte_ring *r) { + return rte_ring_is_cons_single(r); +} +unsigned int rte_ring_mp_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_enqueue_burst(r, obj_table, n, free_space); +} +unsigned int rte_ring_sp_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space) { + return rte_ring_sp_enqueue_burst(r, obj_table, n, free_space); +} +unsigned int rte_ring_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_burst(r, obj_table, n, free_space); +} +unsigned int rte_ring_mc_dequeue_burst_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_dequeue_burst(r, obj_table, n, available); +} +unsigned int rte_ring_sc_dequeue_burst_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available) { + return rte_ring_sc_dequeue_burst(r, obj_table, n, available); +} +unsigned int rte_ring_dequeue_burst_w(struct rte_ring *r, void **obj_table, + unsigned int n, unsigned int *available) { + return rte_ring_dequeue_burst(r, obj_table, n, available); +} +void *rte_memcpy_w(void *dst, const void *src, size_t n) { + return rte_memcpy(dst, src, n); +} +// void *rte_mov15_or_less_w(void *dst, const void *src, size_t n) { +// return rte_mov15_or_less(dst, src, n); +// } +void rte_mov16_w(uint8_t *dst, const uint8_t *src) { rte_mov16(dst, src); } +void rte_mov32_w(uint8_t *dst, const uint8_t *src) { rte_mov32(dst, src); } +void rte_mov64_w(uint8_t *dst, const uint8_t *src) { rte_mov64(dst, src); } +void rte_mov256_w(uint8_t *dst, const uint8_t *src) { rte_mov256(dst, src); } +// void *rte_memcpy_generic_w(void *dst, const void *src, size_t n) { +// return rte_memcpy_generic(dst, src, n); +// } +// void *rte_memcpy_aligned_w(void *dst, const void *src, size_t n) { +// return rte_memcpy_aligned(dst, src, n); +// } +struct rte_mempool_objhdr *rte_mempool_get_header_w(void *obj) { + return rte_mempool_get_header(obj); +} +struct rte_mempool *rte_mempool_from_obj_w(void *obj) { + return rte_mempool_from_obj(obj); +} +struct rte_mempool_objtlr *rte_mempool_get_trailer_w(void *obj) { + return rte_mempool_get_trailer(obj); +} +struct rte_mempool_ops *rte_mempool_get_ops_w(int ops_index) { + return rte_mempool_get_ops(ops_index); +} +int rte_mempool_ops_dequeue_bulk_w(struct rte_mempool *mp, void **obj_table, + unsigned int n) { + return rte_mempool_ops_dequeue_bulk(mp, obj_table, n); +} +int rte_mempool_ops_dequeue_contig_blocks_w(struct rte_mempool *mp, + void **first_obj_table, + unsigned int n) { + return rte_mempool_ops_dequeue_contig_blocks(mp, first_obj_table, n); +} +int rte_mempool_ops_enqueue_bulk_w(struct rte_mempool *mp, + void *const *obj_table, unsigned int n) { + return rte_mempool_ops_enqueue_bulk(mp, obj_table, n); +} +struct rte_mempool_cache *rte_mempool_default_cache_w(struct rte_mempool *mp, + unsigned int lcore_id) { + return rte_mempool_default_cache(mp, lcore_id); +} +void rte_mempool_cache_flush_w(struct rte_mempool_cache *cache, + struct rte_mempool *mp) { + rte_mempool_cache_flush(cache, mp); +} +void rte_mempool_do_generic_put_w(struct rte_mempool *mp, + void *const *obj_table, unsigned int n, + struct rte_mempool_cache *cache) { + rte_mempool_do_generic_put(mp, obj_table, n, cache); +} +void rte_mempool_generic_put_w(struct rte_mempool *mp, void *const *obj_table, + unsigned int n, + struct rte_mempool_cache *cache) { + rte_mempool_generic_put(mp, obj_table, n, cache); +} +void rte_mempool_put_bulk_w(struct rte_mempool *mp, void *const *obj_table, + unsigned int n) { + rte_mempool_put_bulk(mp, obj_table, n); +} +void rte_mempool_put_w(struct rte_mempool *mp, void *obj) { + rte_mempool_put(mp, obj); +} +int rte_mempool_do_generic_get_w(struct rte_mempool *mp, void **obj_table, + unsigned int n, + struct rte_mempool_cache *cache) { + return rte_mempool_do_generic_get(mp, obj_table, n, cache); +} +int rte_mempool_generic_get_w(struct rte_mempool *mp, void **obj_table, + unsigned int n, struct rte_mempool_cache *cache) { + return rte_mempool_generic_get(mp, obj_table, n, cache); +} +int rte_mempool_get_bulk_w(struct rte_mempool *mp, void **obj_table, + unsigned int n) { + return rte_mempool_get_bulk(mp, obj_table, n); +} +int rte_mempool_get_w(struct rte_mempool *mp, void **obj_p) { + return rte_mempool_get(mp, obj_p); +} +int rte_mempool_get_contig_blocks_w(struct rte_mempool *mp, + void **first_obj_table, unsigned int n) { + return rte_mempool_get_contig_blocks(mp, first_obj_table, n); +} +int rte_mempool_full_w(const struct rte_mempool *mp) { + return rte_mempool_full(mp); +} +int rte_mempool_empty_w(const struct rte_mempool *mp) { + return rte_mempool_empty(mp); +} +rte_iova_t rte_mempool_virt2iova_w(const void *elt) { + return rte_mempool_virt2iova(elt); +} +void *rte_mempool_get_priv_w(struct rte_mempool *mp) { + return rte_mempool_get_priv(mp); +} +void rte_prefetch0_w(const void *p) { rte_prefetch0(p); } +void rte_prefetch1_w(const void *p) { rte_prefetch1(p); } +void rte_prefetch2_w(const void *p) { rte_prefetch2(p); } +void rte_prefetch_non_temporal_w(const void *p) { + rte_prefetch_non_temporal(p); +} +void rte_prefetch0_write_w(const void *p) { rte_prefetch0_write(p); } +void rte_prefetch1_write_w(const void *p) { rte_prefetch1_write(p); } +void rte_prefetch2_write_w(const void *p) { rte_prefetch2_write(p); } +void rte_cldemote_w(const void *p) { rte_cldemote(p); } +uint16_t rte_constant_bswap16_w(uint16_t x) { return rte_constant_bswap16(x); } +uint32_t rte_constant_bswap32_w(uint32_t x) { return rte_constant_bswap32(x); } +uint64_t rte_constant_bswap64_w(uint64_t x) { return rte_constant_bswap64(x); } +// uint16_t rte_arch_bswap16_w(uint16_t _x) { return rte_arch_bswap16(_x); } +// uint32_t rte_arch_bswap32_w(uint32_t _x) { return rte_arch_bswap32(_x); } +// uint64_t rte_arch_bswap64_w(uint64_t _x) { return rte_arch_bswap64(_x); } +void rte_mbuf_prefetch_part1_w(struct rte_mbuf *m) { + rte_mbuf_prefetch_part1(m); +} +void rte_mbuf_prefetch_part2_w(struct rte_mbuf *m) { + rte_mbuf_prefetch_part2(m); +} +uint16_t rte_pktmbuf_priv_size_w(struct rte_mempool *mp) { + return rte_pktmbuf_priv_size(mp); +} +rte_iova_t rte_mbuf_iova_get_w(const struct rte_mbuf *m) { + return rte_mbuf_iova_get(m); +} +void rte_mbuf_iova_set_w(struct rte_mbuf *m, rte_iova_t iova) { + rte_mbuf_iova_set(m, iova); +} +rte_iova_t rte_mbuf_data_iova_w(const struct rte_mbuf *mb) { + return rte_mbuf_data_iova(mb); +} +rte_iova_t rte_mbuf_data_iova_default_w(const struct rte_mbuf *mb) { + return rte_mbuf_data_iova_default(mb); +} +struct rte_mbuf *rte_mbuf_from_indirect_w(struct rte_mbuf *mi) { + return rte_mbuf_from_indirect(mi); +} +char *rte_mbuf_buf_addr_w(struct rte_mbuf *mb, struct rte_mempool *mp) { + return rte_mbuf_buf_addr(mb, mp); +} +char *rte_mbuf_data_addr_default_w(struct rte_mbuf *mb) { + return rte_mbuf_data_addr_default(mb); +} +char *rte_mbuf_to_baddr_w(struct rte_mbuf *md) { return rte_mbuf_to_baddr(md); } +void *rte_mbuf_to_priv_w(struct rte_mbuf *m) { return rte_mbuf_to_priv(m); } +uint32_t rte_pktmbuf_priv_flags_w(struct rte_mempool *mp) { + return rte_pktmbuf_priv_flags(mp); +} +uint16_t rte_mbuf_refcnt_read_w(const struct rte_mbuf *m) { + return rte_mbuf_refcnt_read(m); +} +void rte_mbuf_refcnt_set_w(struct rte_mbuf *m, uint16_t new_value) { + rte_mbuf_refcnt_set(m, new_value); +} +uint16_t rte_mbuf_refcnt_update_w(struct rte_mbuf *m, int16_t value) { + return rte_mbuf_refcnt_update(m, value); +} +uint16_t +rte_mbuf_ext_refcnt_read_w(const struct rte_mbuf_ext_shared_info *shinfo) { + return rte_mbuf_ext_refcnt_read(shinfo); +} +void rte_mbuf_ext_refcnt_set_w(struct rte_mbuf_ext_shared_info *shinfo, + uint16_t new_value) { + rte_mbuf_ext_refcnt_set(shinfo, new_value); +} +uint16_t rte_mbuf_ext_refcnt_update_w(struct rte_mbuf_ext_shared_info *shinfo, + int16_t value) { + return rte_mbuf_ext_refcnt_update(shinfo, value); +} +struct rte_mbuf *rte_mbuf_raw_alloc_w(struct rte_mempool *mp) { + return rte_mbuf_raw_alloc(mp); +} +void rte_mbuf_raw_free_w(struct rte_mbuf *m) { rte_mbuf_raw_free(m); } +uint16_t rte_pktmbuf_data_room_size_w(struct rte_mempool *mp) { + return rte_pktmbuf_data_room_size(mp); +} +void rte_pktmbuf_reset_headroom_w(struct rte_mbuf *m) { + rte_pktmbuf_reset_headroom(m); +} +void rte_pktmbuf_reset_w(struct rte_mbuf *m) { rte_pktmbuf_reset(m); } +struct rte_mbuf *rte_pktmbuf_alloc_w(struct rte_mempool *mp) { + return rte_pktmbuf_alloc(mp); +} +int rte_pktmbuf_alloc_bulk_w(struct rte_mempool *pool, struct rte_mbuf **mbufs, + unsigned int count) { + return rte_pktmbuf_alloc_bulk(pool, mbufs, count); +} +struct rte_mbuf_ext_shared_info * +rte_pktmbuf_ext_shinfo_init_helper_w(void *buf_addr, uint16_t *buf_len, + rte_mbuf_extbuf_free_callback_t free_cb, + void *fcb_opaque) { + return rte_pktmbuf_ext_shinfo_init_helper(buf_addr, buf_len, free_cb, + fcb_opaque); +} +void rte_pktmbuf_attach_extbuf_w(struct rte_mbuf *m, void *buf_addr, + rte_iova_t buf_iova, uint16_t buf_len, + struct rte_mbuf_ext_shared_info *shinfo) { + rte_pktmbuf_attach_extbuf(m, buf_addr, buf_iova, buf_len, shinfo); +} +void rte_mbuf_dynfield_copy_w(struct rte_mbuf *mdst, + const struct rte_mbuf *msrc) { + rte_mbuf_dynfield_copy(mdst, msrc); +} +void rte_pktmbuf_attach_w(struct rte_mbuf *mi, struct rte_mbuf *m) { + rte_pktmbuf_attach(mi, m); +} +void rte_pktmbuf_detach_w(struct rte_mbuf *m) { rte_pktmbuf_detach(m); } +struct rte_mbuf *rte_pktmbuf_prefree_seg_w(struct rte_mbuf *m) { + return rte_pktmbuf_prefree_seg(m); +} +void rte_pktmbuf_free_seg_w(struct rte_mbuf *m) { rte_pktmbuf_free_seg(m); } +void rte_pktmbuf_free_w(struct rte_mbuf *m) { rte_pktmbuf_free(m); } +void rte_pktmbuf_refcnt_update_w(struct rte_mbuf *m, int16_t v) { + rte_pktmbuf_refcnt_update(m, v); +} +uint16_t rte_pktmbuf_headroom_w(const struct rte_mbuf *m) { + return rte_pktmbuf_headroom(m); +} +uint16_t rte_pktmbuf_tailroom_w(const struct rte_mbuf *m) { + return rte_pktmbuf_tailroom(m); +} +struct rte_mbuf *rte_pktmbuf_lastseg_w(struct rte_mbuf *m) { + return rte_pktmbuf_lastseg(m); +} +char *rte_pktmbuf_prepend_w(struct rte_mbuf *m, uint16_t len) { + return rte_pktmbuf_prepend(m, len); +} +char *rte_pktmbuf_append_w(struct rte_mbuf *m, uint16_t len) { + return rte_pktmbuf_append(m, len); +} +char *rte_pktmbuf_adj_w(struct rte_mbuf *m, uint16_t len) { + return rte_pktmbuf_adj(m, len); +} +int rte_pktmbuf_trim_w(struct rte_mbuf *m, uint16_t len) { + return rte_pktmbuf_trim(m, len); +} +int rte_pktmbuf_is_contiguous_w(const struct rte_mbuf *m) { + return rte_pktmbuf_is_contiguous(m); +} +const void *rte_pktmbuf_read_w(const struct rte_mbuf *m, uint32_t off, + uint32_t len, void *buf) { + return rte_pktmbuf_read(m, off, len, buf); +} +int rte_pktmbuf_chain_w(struct rte_mbuf *head, struct rte_mbuf *tail) { + return rte_pktmbuf_chain(head, tail); +} +uint64_t rte_mbuf_tx_offload_w(uint64_t il2, uint64_t il3, uint64_t il4, + uint64_t tso, uint64_t ol3, uint64_t ol2, + uint64_t unused) { + return rte_mbuf_tx_offload(il2, il3, il4, tso, ol3, ol2, unused); +} +int rte_validate_tx_offload_w(const struct rte_mbuf *m) { + return rte_validate_tx_offload(m); +} +int rte_pktmbuf_linearize_w(struct rte_mbuf *mbuf) { + return rte_pktmbuf_linearize(mbuf); +} +uint32_t rte_mbuf_sched_queue_get_w(const struct rte_mbuf *m) { + return rte_mbuf_sched_queue_get(m); +} +uint8_t rte_mbuf_sched_traffic_class_get_w(const struct rte_mbuf *m) { + return rte_mbuf_sched_traffic_class_get(m); +} +uint8_t rte_mbuf_sched_color_get_w(const struct rte_mbuf *m) { + return rte_mbuf_sched_color_get(m); +} +void rte_mbuf_sched_get_w(const struct rte_mbuf *m, uint32_t *queue_id, + uint8_t *traffic_class, uint8_t *color) { + rte_mbuf_sched_get(m, queue_id, traffic_class, color); +} +void rte_mbuf_sched_queue_set_w(struct rte_mbuf *m, uint32_t queue_id) { + rte_mbuf_sched_queue_set(m, queue_id); +} +void rte_mbuf_sched_traffic_class_set_w(struct rte_mbuf *m, + uint8_t traffic_class) { + rte_mbuf_sched_traffic_class_set(m, traffic_class); +} +void rte_mbuf_sched_color_set_w(struct rte_mbuf *m, uint8_t color) { + rte_mbuf_sched_color_set(m, color); +} +void rte_mbuf_sched_set_w(struct rte_mbuf *m, uint32_t queue_id, + uint8_t traffic_class, uint8_t color) { + rte_mbuf_sched_set(m, queue_id, traffic_class, color); +} +int rte_is_same_ether_addr_w(const struct rte_ether_addr *ea1, + const struct rte_ether_addr *ea2) { + return rte_is_same_ether_addr(ea1, ea2); +} +int rte_is_zero_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_zero_ether_addr(ea); +} +int rte_is_unicast_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_unicast_ether_addr(ea); +} +int rte_is_multicast_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_multicast_ether_addr(ea); +} +int rte_is_broadcast_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_broadcast_ether_addr(ea); +} +int rte_is_universal_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_universal_ether_addr(ea); +} +int rte_is_local_admin_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_local_admin_ether_addr(ea); +} +int rte_is_valid_assigned_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_valid_assigned_ether_addr(ea); +} +void rte_ether_addr_copy_w(const struct rte_ether_addr *ea_from, + struct rte_ether_addr *ea_to) { + rte_ether_addr_copy(ea_from, ea_to); +} +int rte_vlan_strip_w(struct rte_mbuf *m) { return rte_vlan_strip(m); } +int rte_vlan_insert_w(struct rte_mbuf **m) { return rte_vlan_insert(m); } +uint32_t rte_bitmap_get_memory_footprint_w(uint32_t n_bits) { + return rte_bitmap_get_memory_footprint(n_bits); +} +struct rte_bitmap *rte_bitmap_init_w(uint32_t n_bits, uint8_t *mem, + uint32_t mem_size) { + return rte_bitmap_init(n_bits, mem, mem_size); +} +struct rte_bitmap *rte_bitmap_init_with_all_set_w(uint32_t n_bits, uint8_t *mem, + uint32_t mem_size) { + return rte_bitmap_init_with_all_set(n_bits, mem, mem_size); +} +void rte_bitmap_free_w(struct rte_bitmap *bmp) { return rte_bitmap_free(bmp); } +void rte_bitmap_reset_w(struct rte_bitmap *bmp) { rte_bitmap_reset(bmp); } +void rte_bitmap_prefetch0_w(struct rte_bitmap *bmp, uint32_t pos) { + rte_bitmap_prefetch0(bmp, pos); +} +uint64_t rte_bitmap_get_w(struct rte_bitmap *bmp, uint32_t pos) { + return rte_bitmap_get(bmp, pos); +} +void rte_bitmap_set_w(struct rte_bitmap *bmp, uint32_t pos) { + rte_bitmap_set(bmp, pos); +} +void rte_bitmap_set_slab_w(struct rte_bitmap *bmp, uint32_t pos, + uint64_t slab) { + rte_bitmap_set_slab(bmp, pos, slab); +} +void rte_bitmap_clear_w(struct rte_bitmap *bmp, uint32_t pos) { + rte_bitmap_clear(bmp, pos); +} +int rte_bitmap_scan_w(struct rte_bitmap *bmp, uint32_t *pos, uint64_t *slab) { + return rte_bitmap_scan(bmp, pos, slab); +} +uint16_t rte_raw_cksum_w(const void *buf, size_t len) { + return rte_raw_cksum(buf, len); +} +int rte_raw_cksum_mbuf_w(const struct rte_mbuf *m, uint32_t off, uint32_t len, + uint16_t *cksum) { + return rte_raw_cksum_mbuf(m, off, len, cksum); +} +uint8_t rte_ipv4_hdr_len_w(const struct rte_ipv4_hdr *ipv4_hdr) { + return rte_ipv4_hdr_len(ipv4_hdr); +} +uint16_t rte_ipv4_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr) { + return rte_ipv4_cksum(ipv4_hdr); +} +uint16_t rte_ipv4_cksum_simple_w(const struct rte_ipv4_hdr *ipv4_hdr) { + return rte_ipv4_cksum_simple(ipv4_hdr); +} +uint16_t rte_ipv4_phdr_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr, + uint64_t ol_flags) { + return rte_ipv4_phdr_cksum(ipv4_hdr, ol_flags); +} +uint16_t rte_ipv4_udptcp_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr, + const void *l4_hdr) { + return rte_ipv4_udptcp_cksum(ipv4_hdr, l4_hdr); +} +uint16_t rte_ipv4_udptcp_cksum_mbuf_w(const struct rte_mbuf *m, + const struct rte_ipv4_hdr *ipv4_hdr, + uint16_t l4_off) { + return rte_ipv4_udptcp_cksum_mbuf(m, ipv4_hdr, l4_off); +} +int rte_ipv4_udptcp_cksum_verify_w(const struct rte_ipv4_hdr *ipv4_hdr, + const void *l4_hdr) { + return rte_ipv4_udptcp_cksum_verify(ipv4_hdr, l4_hdr); +} +int rte_ipv4_udptcp_cksum_mbuf_verify_w(const struct rte_mbuf *m, + const struct rte_ipv4_hdr *ipv4_hdr, + uint16_t l4_off) { + return rte_ipv4_udptcp_cksum_mbuf_verify(m, ipv4_hdr, l4_off); +} +bool rte_ipv6_addr_eq_w(const struct rte_ipv6_addr *a, + const struct rte_ipv6_addr *b) { + return rte_ipv6_addr_eq(a, b); +} +void rte_ipv6_addr_mask_w(struct rte_ipv6_addr *ip, uint8_t depth) { + rte_ipv6_addr_mask(ip, depth); +} +bool rte_ipv6_addr_eq_prefix_w(const struct rte_ipv6_addr *a, + const struct rte_ipv6_addr *b, uint8_t depth) { + return rte_ipv6_addr_eq_prefix(a, b, depth); +} +uint8_t rte_ipv6_mask_depth_w(const struct rte_ipv6_addr *mask) { + return rte_ipv6_mask_depth(mask); +} +bool rte_ipv6_addr_is_unspec_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_unspec(ip); +} +bool rte_ipv6_addr_is_loopback_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_loopback(ip); +} +bool rte_ipv6_addr_is_linklocal_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_linklocal(ip); +} +bool rte_ipv6_addr_is_sitelocal_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_sitelocal(ip); +} +bool rte_ipv6_addr_is_v4compat_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_v4compat(ip); +} +bool rte_ipv6_addr_is_v4mapped_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_v4mapped(ip); +} +bool rte_ipv6_addr_is_mcast_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_mcast(ip); +} +enum rte_ipv6_mc_scope rte_ipv6_mc_scope_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_mc_scope(ip); +} +void rte_ipv6_llocal_from_ethernet_w(struct rte_ipv6_addr *ip, + const struct rte_ether_addr *mac) { + rte_ipv6_llocal_from_ethernet(ip, mac); +} +void rte_ipv6_solnode_from_addr_w(struct rte_ipv6_addr *sol, + const struct rte_ipv6_addr *ip) { + rte_ipv6_solnode_from_addr(sol, ip); +} +void rte_ether_mcast_from_ipv6_w(struct rte_ether_addr *mac, + const struct rte_ipv6_addr *ip) { + rte_ether_mcast_from_ipv6(mac, ip); +} +int rte_ipv6_check_version_w(const struct rte_ipv6_hdr *ip) { + return rte_ipv6_check_version(ip); +} +uint16_t rte_ipv6_phdr_cksum_w(const struct rte_ipv6_hdr *ipv6_hdr, + uint64_t ol_flags) { + return rte_ipv6_phdr_cksum(ipv6_hdr, ol_flags); +} +uint16_t rte_ipv6_udptcp_cksum_w(const struct rte_ipv6_hdr *ipv6_hdr, + const void *l4_hdr) { + return rte_ipv6_udptcp_cksum(ipv6_hdr, l4_hdr); +} +uint16_t rte_ipv6_udptcp_cksum_mbuf_w(const struct rte_mbuf *m, + const struct rte_ipv6_hdr *ipv6_hdr, + uint16_t l4_off) { + return rte_ipv6_udptcp_cksum_mbuf(m, ipv6_hdr, l4_off); +} +int rte_ipv6_udptcp_cksum_verify_w(const struct rte_ipv6_hdr *ipv6_hdr, + const void *l4_hdr) { + return rte_ipv6_udptcp_cksum_verify(ipv6_hdr, l4_hdr); +} +int rte_ipv6_udptcp_cksum_mbuf_verify_w(const struct rte_mbuf *m, + const struct rte_ipv6_hdr *ipv6_hdr, + uint16_t l4_off) { + return rte_ipv6_udptcp_cksum_mbuf_verify(m, ipv6_hdr, l4_off); +} +int rte_ipv6_get_next_ext_w(const uint8_t *p, int proto, size_t *ext_len) { + return rte_ipv6_get_next_ext(p, proto, ext_len); +} +enum rte_color +rte_meter_srtcm_color_blind_check_w(struct rte_meter_srtcm *m, + struct rte_meter_srtcm_profile *p, + uint64_t time, uint32_t pkt_len) { + return rte_meter_srtcm_color_blind_check(m, p, time, pkt_len); +} +enum rte_color rte_meter_srtcm_color_aware_check_w( + struct rte_meter_srtcm *m, struct rte_meter_srtcm_profile *p, uint64_t time, + uint32_t pkt_len, enum rte_color pkt_color) { + return rte_meter_srtcm_color_aware_check(m, p, time, pkt_len, pkt_color); +} +enum rte_color +rte_meter_trtcm_color_blind_check_w(struct rte_meter_trtcm *m, + struct rte_meter_trtcm_profile *p, + uint64_t time, uint32_t pkt_len) { + return rte_meter_trtcm_color_blind_check(m, p, time, pkt_len); +} +enum rte_color rte_meter_trtcm_color_aware_check_w( + struct rte_meter_trtcm *m, struct rte_meter_trtcm_profile *p, uint64_t time, + uint32_t pkt_len, enum rte_color pkt_color) { + return rte_meter_trtcm_color_aware_check(m, p, time, pkt_len, pkt_color); +} +enum rte_color rte_meter_trtcm_rfc4115_color_blind_check_w( + struct rte_meter_trtcm_rfc4115 *m, + struct rte_meter_trtcm_rfc4115_profile *p, uint64_t time, + uint32_t pkt_len) { + return rte_meter_trtcm_rfc4115_color_blind_check(m, p, time, pkt_len); +} +enum rte_color rte_meter_trtcm_rfc4115_color_aware_check_w( + struct rte_meter_trtcm_rfc4115 *m, + struct rte_meter_trtcm_rfc4115_profile *p, uint64_t time, uint32_t pkt_len, + enum rte_color pkt_color) { + return rte_meter_trtcm_rfc4115_color_aware_check(m, p, time, pkt_len, + pkt_color); +} +uint64_t rte_eth_rss_hf_refine_w(uint64_t rss_hf) { + return rte_eth_rss_hf_refine(rss_hf); +} + +uint16_t rte_eth_rx_burst_w(uint16_t port_id, uint16_t queue_id, + struct rte_mbuf **rx_pkts, const uint16_t nb_pkts) { + return rte_eth_rx_burst(port_id, queue_id, rx_pkts, nb_pkts); +} +int rte_eth_rx_queue_count_w(uint16_t port_id, uint16_t queue_id) { + return rte_eth_rx_queue_count(port_id, queue_id); +} +int rte_eth_rx_descriptor_status_w(uint16_t port_id, uint16_t queue_id, + uint16_t offset) { + return rte_eth_rx_descriptor_status(port_id, queue_id, offset); +} +int rte_eth_tx_descriptor_status_w(uint16_t port_id, uint16_t queue_id, + uint16_t offset) { + return rte_eth_tx_descriptor_status(port_id, queue_id, offset); +} +uint16_t rte_eth_tx_burst_w(uint16_t port_id, uint16_t queue_id, + struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { + return rte_eth_tx_burst(port_id, queue_id, tx_pkts, nb_pkts); +} +uint16_t rte_eth_tx_prepare_w(uint16_t port_id, uint16_t queue_id, + struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { + return rte_eth_tx_prepare(port_id, queue_id, tx_pkts, nb_pkts); +} +uint16_t rte_eth_tx_buffer_flush_w(uint16_t port_id, uint16_t queue_id, + struct rte_eth_dev_tx_buffer *buffer) { + return rte_eth_tx_buffer_flush(port_id, queue_id, buffer); +} +uint16_t rte_eth_tx_buffer_w(uint16_t port_id, uint16_t queue_id, + struct rte_eth_dev_tx_buffer *buffer, + struct rte_mbuf *tx_pkt) { + return rte_eth_tx_buffer(port_id, queue_id, buffer, tx_pkt); +} +uint16_t +rte_eth_recycle_mbufs_w(uint16_t rx_port_id, uint16_t rx_queue_id, + uint16_t tx_port_id, uint16_t tx_queue_id, + struct rte_eth_recycle_rxq_info *recycle_rxq_info) { + return rte_eth_recycle_mbufs(rx_port_id, rx_queue_id, tx_port_id, tx_queue_id, + recycle_rxq_info); +} +int rte_eth_tx_queue_count_w(uint16_t port_id, uint16_t queue_id) { + return rte_eth_tx_queue_count(port_id, queue_id); +} +uint32_t rte_flow_dynf_metadata_get_w(struct rte_mbuf *m) { + return rte_flow_dynf_metadata_get(m); +} +void rte_flow_dynf_metadata_set_w(struct rte_mbuf *m, uint32_t v) { + rte_flow_dynf_metadata_set(m, v); +} +int rte_flow_dynf_metadata_avail_w(void) { + return rte_flow_dynf_metadata_avail(); +} +uint32_t rte_hash_crc_1byte_w(uint8_t data, uint32_t init_val) { + return rte_hash_crc_1byte(data, init_val); +} +uint32_t rte_hash_crc_2byte_w(uint16_t data, uint32_t init_val) { + return rte_hash_crc_2byte(data, init_val); +} +uint32_t rte_hash_crc_4byte_w(uint32_t data, uint32_t init_val) { + return rte_hash_crc_4byte(data, init_val); +} +uint32_t rte_hash_crc_8byte_w(uint64_t data, uint32_t init_val) { + return rte_hash_crc_8byte(data, init_val); +} +uint32_t rte_hash_crc_w(const void *data, uint32_t data_len, + uint32_t init_val) { + return rte_hash_crc(data, data_len, init_val); +} +void rte_jhash_2hashes_w(const void *key, uint32_t length, uint32_t *pc, + uint32_t *pb) { + rte_jhash_2hashes(key, length, pc, pb); +} +void rte_jhash_32b_2hashes_w(const uint32_t *k, uint32_t length, uint32_t *pc, + uint32_t *pb) { + rte_jhash_32b_2hashes(k, length, pc, pb); +} +uint32_t rte_jhash_w(const void *key, uint32_t length, uint32_t initval) { + return rte_jhash(key, length, initval); +} +uint32_t rte_jhash_32b_w(const uint32_t *k, uint32_t length, uint32_t initval) { + return rte_jhash_32b(k, length, initval); +} +uint32_t rte_jhash_3words_w(uint32_t a, uint32_t b, uint32_t c, + uint32_t initval) { + return rte_jhash_3words(a, b, c, initval); +} +uint32_t rte_jhash_2words_w(uint32_t a, uint32_t b, uint32_t initval) { + return rte_jhash_2words(a, b, initval); +} +uint32_t rte_jhash_1word_w(uint32_t a, uint32_t initval) { + return rte_jhash_1word(a, initval); +} +uint32_t rte_fbk_hash_get_bucket_w(const struct rte_fbk_hash_table *ht, + uint32_t key) { + return rte_fbk_hash_get_bucket(ht, key); +} +int rte_fbk_hash_add_key_with_bucket_w(struct rte_fbk_hash_table *ht, + uint32_t key, uint16_t value, + uint32_t bucket) { + return rte_fbk_hash_add_key_with_bucket(ht, key, value, bucket); +} +int rte_fbk_hash_add_key_w(struct rte_fbk_hash_table *ht, uint32_t key, + uint16_t value) { + return rte_fbk_hash_add_key(ht, key, value); +} +int rte_fbk_hash_delete_key_with_bucket_w(struct rte_fbk_hash_table *ht, + uint32_t key, uint32_t bucket) { + return rte_fbk_hash_delete_key_with_bucket(ht, key, bucket); +} +int rte_fbk_hash_delete_key_w(struct rte_fbk_hash_table *ht, uint32_t key) { + return rte_fbk_hash_delete_key(ht, key); +} +int rte_fbk_hash_lookup_with_bucket_w(const struct rte_fbk_hash_table *ht, + uint32_t key, uint32_t bucket) { + return rte_fbk_hash_lookup_with_bucket(ht, key, bucket); +} +int rte_fbk_hash_lookup_w(const struct rte_fbk_hash_table *ht, uint32_t key) { + return rte_fbk_hash_lookup(ht, key); +} +void rte_fbk_hash_clear_all_w(struct rte_fbk_hash_table *ht) { + rte_fbk_hash_clear_all(ht); +} +double rte_fbk_hash_get_load_factor_w(struct rte_fbk_hash_table *ht) { + return rte_fbk_hash_get_load_factor(ht); +} +void rte_rcu_qsbr_thread_online_w(struct rte_rcu_qsbr *v, + unsigned int thread_id) { + rte_rcu_qsbr_thread_online(v, thread_id); +} +void rte_rcu_qsbr_thread_offline_w(struct rte_rcu_qsbr *v, + unsigned int thread_id) { + rte_rcu_qsbr_thread_offline(v, thread_id); +} +void rte_rcu_qsbr_lock_w(struct rte_rcu_qsbr *v, unsigned int thread_id) { + rte_rcu_qsbr_lock(v, thread_id); +} +void rte_rcu_qsbr_unlock_w(struct rte_rcu_qsbr *v, unsigned int thread_id) { + rte_rcu_qsbr_unlock(v, thread_id); +} +uint64_t rte_rcu_qsbr_start_w(struct rte_rcu_qsbr *v) { + return rte_rcu_qsbr_start(v); +} +void rte_rcu_qsbr_quiescent_w(struct rte_rcu_qsbr *v, unsigned int thread_id) { + rte_rcu_qsbr_quiescent(v, thread_id); +} +int rte_rcu_qsbr_check_w(struct rte_rcu_qsbr *v, uint64_t t, bool wait) { + return rte_rcu_qsbr_check(v, t, wait); +} +uint8_t rte_read8_relaxed_w(const void *addr) { + return rte_read8_relaxed(addr); +} +uint16_t rte_read16_relaxed_w(const void *addr) { + return rte_read16_relaxed(addr); +} +uint32_t rte_read32_relaxed_w(const void *addr) { + return rte_read32_relaxed(addr); +} +uint64_t rte_read64_relaxed_w(const void *addr) { + return rte_read64_relaxed(addr); +} +void rte_write8_relaxed_w(uint8_t value, void *addr) { + rte_write8_relaxed(value, addr); +} +void rte_write16_relaxed_w(uint16_t value, void *addr) { + rte_write16_relaxed(value, addr); +} +void rte_write32_relaxed_w(uint32_t value, void *addr) { + rte_write32_relaxed(value, addr); +} +void rte_write64_relaxed_w(uint64_t value, void *addr) { + rte_write64_relaxed(value, addr); +} +uint8_t rte_read8_w(const void *addr) { return rte_read8(addr); } +uint16_t rte_read16_w(const void *addr) { return rte_read16(addr); } +uint32_t rte_read32_w(const void *addr) { return rte_read32(addr); } +uint64_t rte_read64_w(const void *addr) { return rte_read64(addr); } +void rte_write8_w(uint8_t value, void *addr) { rte_write8(value, addr); } +void rte_write16_w(uint16_t value, void *addr) { rte_write16(value, addr); } +void rte_write32_w(uint32_t value, void *addr) { rte_write32(value, addr); } +void rte_write64_w(uint64_t value, void *addr) { rte_write64(value, addr); } +void rte_write32_wc_relaxed_w(uint32_t value, void *addr) { + rte_write32_wc_relaxed(value, addr); +} +void rte_write32_wc_w(uint32_t value, void *addr) { + rte_write32_wc(value, addr); +} +void rte_mcslock_lock_w(rte_mcslock_t **msl, rte_mcslock_t *me) { + rte_mcslock_lock(msl, me); +} +void rte_mcslock_unlock_w(rte_mcslock_t **msl, rte_mcslock_t *me) { + rte_mcslock_unlock(msl, me); +} +int rte_mcslock_trylock_w(rte_mcslock_t **msl, rte_mcslock_t *me) { + return rte_mcslock_trylock(msl, me); +} +int rte_mcslock_is_locked_w(rte_mcslock_t *msl) { + return rte_mcslock_is_locked(msl); +} +void rte_pflock_init_w(struct rte_pflock *pf) { rte_pflock_init(pf); } +void rte_pflock_read_lock_w(rte_pflock_t *pf) { rte_pflock_read_lock(pf); } +void rte_pflock_read_unlock_w(rte_pflock_t *pf) { rte_pflock_read_unlock(pf); } +void rte_pflock_write_lock_w(rte_pflock_t *pf) { rte_pflock_write_lock(pf); } +void rte_pflock_write_unlock_w(rte_pflock_t *pf) { + rte_pflock_write_unlock(pf); +} +uint32_t rte_reciprocal_divide_w(uint32_t a, struct rte_reciprocal R) { + return rte_reciprocal_divide(a, R); +} +uint64_t rte_reciprocal_divide_u64_w(uint64_t a, + const struct rte_reciprocal_u64 *R) { + return rte_reciprocal_divide_u64(a, R); +} +void rte_seqcount_init_w(rte_seqcount_t *seqcount) { + rte_seqcount_init(seqcount); +} +uint32_t rte_seqcount_read_begin_w(const rte_seqcount_t *seqcount) { + return rte_seqcount_read_begin(seqcount); +} +bool rte_seqcount_read_retry_w(const rte_seqcount_t *seqcount, + uint32_t begin_sn) { + return rte_seqcount_read_retry(seqcount, begin_sn); +} +void rte_seqcount_write_begin_w(rte_seqcount_t *seqcount) { + rte_seqcount_write_begin(seqcount); +} +void rte_seqcount_write_end_w(rte_seqcount_t *seqcount) { + rte_seqcount_write_end(seqcount); +} +void rte_seqlock_init_w(rte_seqlock_t *seqlock) { rte_seqlock_init(seqlock); } +uint32_t rte_seqlock_read_begin_w(const rte_seqlock_t *seqlock) { + return rte_seqlock_read_begin(seqlock); +} +bool rte_seqlock_read_retry_w(const rte_seqlock_t *seqlock, uint32_t begin_sn) { + return rte_seqlock_read_retry(seqlock, begin_sn); +} +void rte_seqlock_write_lock_w(rte_seqlock_t *seqlock) { + rte_seqlock_write_lock(seqlock); +} +void rte_seqlock_write_unlock_w(rte_seqlock_t *seqlock) { + rte_seqlock_write_unlock(seqlock); +} +unsigned int rte_stack_push_w(struct rte_stack *s, void *const *obj_table, + unsigned int n) { + return rte_stack_push(s, obj_table, n); +} +unsigned int rte_stack_pop_w(struct rte_stack *s, void **obj_table, + unsigned int n) { + return rte_stack_pop(s, obj_table, n); +} +unsigned int rte_stack_count_w(struct rte_stack *s) { + return rte_stack_count(s); +} +unsigned int rte_stack_free_count_w(struct rte_stack *s) { + return rte_stack_free_count(s); +} +uint32_t rte_softrss_w(uint32_t *input_tuple, uint32_t input_len, + const uint8_t *rss_key) { + return rte_softrss(input_tuple, input_len, rss_key); +} +uint32_t rte_softrss_be_w(uint32_t *input_tuple, uint32_t input_len, + const uint8_t *rss_key) { + return rte_softrss_be(input_tuple, input_len, rss_key); +} +void rte_ticketlock_init_w(rte_ticketlock_t *tl) { rte_ticketlock_init(tl); } +void rte_ticketlock_lock_w(rte_ticketlock_t *tl) { rte_ticketlock_lock(tl); } +void rte_ticketlock_unlock_w(rte_ticketlock_t *tl) { + rte_ticketlock_unlock(tl); +} +int rte_ticketlock_trylock_w(rte_ticketlock_t *tl) { + return rte_ticketlock_trylock(tl); +} +int rte_ticketlock_is_locked_w(rte_ticketlock_t *tl) { + return rte_ticketlock_is_locked(tl); +} +void rte_ticketlock_recursive_init_w(rte_ticketlock_recursive_t *tlr) { + rte_ticketlock_recursive_init(tlr); +} +void rte_ticketlock_recursive_lock_w(rte_ticketlock_recursive_t *tlr) { + rte_ticketlock_recursive_lock(tlr); +} +void rte_ticketlock_recursive_unlock_w(rte_ticketlock_recursive_t *tlr) { + rte_ticketlock_recursive_unlock(tlr); +} +int rte_ticketlock_recursive_trylock_w(rte_ticketlock_recursive_t *tlr) { + return rte_ticketlock_recursive_trylock(tlr); +} +uint64_t rte_cyclecounter_cycles_to_ns_w(struct rte_timecounter *tc, + uint64_t cycles) { + return rte_cyclecounter_cycles_to_ns(tc, cycles); +} +uint64_t rte_timecounter_update_w(struct rte_timecounter *tc, + uint64_t cycle_now) { + return rte_timecounter_update(tc, cycle_now); +} +uint64_t rte_timespec_to_ns_w(const struct timespec *ts) { + return rte_timespec_to_ns(ts); +} +struct timespec rte_ns_to_timespec_w(uint64_t nsec) { + return rte_ns_to_timespec(nsec); +} +bool rte_trace_feature_is_enabled_w(void) { + return rte_trace_feature_is_enabled(); +} diff --git a/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.h b/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.h index 5a57ffc6d..3ebfe21e7 100644 --- a/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.h +++ b/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.h @@ -298,1517 +298,737 @@ enum rte_eth_rx_offload : uint64_t { RX_OFFLOAD_BUFFER_SPLIT = RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT, }; - -int rte_errno_get() { return rte_errno; } +int rte_errno_get(); // Static wrappers -int rte_is_aligned_w(const void *const ptr, const unsigned int align) { - return rte_is_aligned(ptr, align); -} -void rte_atomic_thread_fence_w(rte_memory_order memorder) { - rte_atomic_thread_fence(memorder); -} -int rte_atomic16_cmpset_w(uint16_t *dst, uint16_t exp, uint16_t src) { - return rte_atomic16_cmpset(dst, exp, src); -} -uint16_t rte_atomic16_exchange_w(uint16_t *dst, uint16_t val) { - return rte_atomic16_exchange(dst, val); -} -void rte_atomic16_init_w(rte_atomic16_t *v) { rte_atomic16_init(v); } -int16_t rte_atomic16_read_w(const rte_atomic16_t *v) { - return rte_atomic16_read(v); -} -void rte_atomic16_set_w(rte_atomic16_t *v, int16_t new_value) { - rte_atomic16_set(v, new_value); -} -void rte_atomic16_add_w(rte_atomic16_t *v, int16_t inc) { - rte_atomic16_add(v, inc); -} -void rte_atomic16_sub_w(rte_atomic16_t *v, int16_t dec) { - rte_atomic16_sub(v, dec); -} -void rte_atomic16_inc_w(rte_atomic16_t *v) { rte_atomic16_inc(v); } -void rte_atomic16_dec_w(rte_atomic16_t *v) { rte_atomic16_dec(v); } -int16_t rte_atomic16_add_return_w(rte_atomic16_t *v, int16_t inc) { - return rte_atomic16_add_return(v, inc); -} -int16_t rte_atomic16_sub_return_w(rte_atomic16_t *v, int16_t dec) { - return rte_atomic16_sub_return(v, dec); -} -int rte_atomic16_inc_and_test_w(rte_atomic16_t *v) { - return rte_atomic16_inc_and_test(v); -} -int rte_atomic16_dec_and_test_w(rte_atomic16_t *v) { - return rte_atomic16_dec_and_test(v); -} -int rte_atomic16_test_and_set_w(rte_atomic16_t *v) { - return rte_atomic16_test_and_set(v); -} -void rte_atomic16_clear_w(rte_atomic16_t *v) { rte_atomic16_clear(v); } -int rte_atomic32_cmpset_w(uint32_t *dst, uint32_t exp, uint32_t src) { - return rte_atomic32_cmpset(dst, exp, src); -} -uint32_t rte_atomic32_exchange_w(uint32_t *dst, uint32_t val) { - return rte_atomic32_exchange(dst, val); -} -void rte_atomic32_init_w(rte_atomic32_t *v) { rte_atomic32_init(v); } -int32_t rte_atomic32_read_w(const rte_atomic32_t *v) { - return rte_atomic32_read(v); -} -void rte_atomic32_set_w(rte_atomic32_t *v, int32_t new_value) { - rte_atomic32_set(v, new_value); -} -void rte_atomic32_add_w(rte_atomic32_t *v, int32_t inc) { - rte_atomic32_add(v, inc); -} -void rte_atomic32_sub_w(rte_atomic32_t *v, int32_t dec) { - rte_atomic32_sub(v, dec); -} -void rte_atomic32_inc_w(rte_atomic32_t *v) { rte_atomic32_inc(v); } -void rte_atomic32_dec_w(rte_atomic32_t *v) { rte_atomic32_dec(v); } -int32_t rte_atomic32_add_return_w(rte_atomic32_t *v, int32_t inc) { - return rte_atomic32_add_return(v, inc); -} -int32_t rte_atomic32_sub_return_w(rte_atomic32_t *v, int32_t dec) { - return rte_atomic32_sub_return(v, dec); -} -int rte_atomic32_inc_and_test_w(rte_atomic32_t *v) { - return rte_atomic32_inc_and_test(v); -} -int rte_atomic32_dec_and_test_w(rte_atomic32_t *v) { - return rte_atomic32_dec_and_test(v); -} -int rte_atomic32_test_and_set_w(rte_atomic32_t *v) { - return rte_atomic32_test_and_set(v); -} -void rte_atomic32_clear_w(rte_atomic32_t *v) { rte_atomic32_clear(v); } -int rte_atomic64_cmpset_w(uint64_t *dst, uint64_t exp, uint64_t src) { - return rte_atomic64_cmpset(dst, exp, src); -} -uint64_t rte_atomic64_exchange_w(uint64_t *dst, uint64_t val) { - return rte_atomic64_exchange(dst, val); -} -void rte_atomic64_init_w(rte_atomic64_t *v) { rte_atomic64_init(v); } -int64_t rte_atomic64_read_w(rte_atomic64_t *v) { return rte_atomic64_read(v); } -void rte_atomic64_set_w(rte_atomic64_t *v, int64_t new_value) { - rte_atomic64_set(v, new_value); -} -void rte_atomic64_add_w(rte_atomic64_t *v, int64_t inc) { - rte_atomic64_add(v, inc); -} -void rte_atomic64_sub_w(rte_atomic64_t *v, int64_t dec) { - rte_atomic64_sub(v, dec); -} -void rte_atomic64_inc_w(rte_atomic64_t *v) { rte_atomic64_inc(v); } -void rte_atomic64_dec_w(rte_atomic64_t *v) { rte_atomic64_dec(v); } -int64_t rte_atomic64_add_return_w(rte_atomic64_t *v, int64_t inc) { - return rte_atomic64_add_return(v, inc); -} -int64_t rte_atomic64_sub_return_w(rte_atomic64_t *v, int64_t dec) { - return rte_atomic64_sub_return(v, dec); -} -int rte_atomic64_inc_and_test_w(rte_atomic64_t *v) { - return rte_atomic64_inc_and_test(v); -} -int rte_atomic64_dec_and_test_w(rte_atomic64_t *v) { - return rte_atomic64_dec_and_test(v); -} -int rte_atomic64_test_and_set_w(rte_atomic64_t *v) { - return rte_atomic64_test_and_set(v); -} -void rte_atomic64_clear_w(rte_atomic64_t *v) { rte_atomic64_clear(v); } -void rte_smp_mb_w(void) { rte_smp_mb(); } -uint64_t rte_get_tsc_cycles_w(void) { return rte_get_tsc_cycles(); } -uint64_t rte_get_timer_cycles_w(void) { return rte_get_timer_cycles(); } -uint64_t rte_get_timer_hz_w(void) { return rte_get_timer_hz(); } -void rte_delay_ms_w(unsigned int ms) { rte_delay_ms(ms); } -uint64_t rte_rdtsc_w(void) { return rte_rdtsc(); } -uint64_t rte_rdtsc_precise_w(void) { return rte_rdtsc_precise(); } -size_t rte_strlcpy_w(char *dst, const char *src, size_t size) { - return rte_strlcpy(dst, src, size); -} -size_t rte_strlcat_w(char *dst, const char *src, size_t size) { - return rte_strlcat(dst, src, size); -} -const char *rte_str_skip_leading_spaces_w(const char *src) { - return rte_str_skip_leading_spaces(src); -} -void rte_uuid_copy_w(rte_uuid_t dst, const rte_uuid_t src) { - rte_uuid_copy(dst, src); -} -int rte_gettid_w(void) { return rte_gettid(); } -unsigned int rte_lcore_id_w(void) { return rte_lcore_id(); } -void rte_pause_w(void) { rte_pause(); } +void rte_atomic_thread_fence_w(rte_memory_order memorder); +int rte_atomic16_cmpset_w(uint16_t *dst, uint16_t exp, uint16_t src); +uint16_t rte_atomic16_exchange_w(uint16_t *dst, uint16_t val); +void rte_atomic16_init_w(rte_atomic16_t *v); +int16_t rte_atomic16_read_w(const rte_atomic16_t *v); +void rte_atomic16_set_w(rte_atomic16_t *v, int16_t new_value); +void rte_atomic16_add_w(rte_atomic16_t *v, int16_t inc); +void rte_atomic16_sub_w(rte_atomic16_t *v, int16_t dec); +void rte_atomic16_inc_w(rte_atomic16_t *v); +void rte_atomic16_dec_w(rte_atomic16_t *v); +int16_t rte_atomic16_add_return_w(rte_atomic16_t *v, int16_t inc); +int16_t rte_atomic16_sub_return_w(rte_atomic16_t *v, int16_t dec); +int rte_atomic16_inc_and_test_w(rte_atomic16_t *v); +int rte_atomic16_dec_and_test_w(rte_atomic16_t *v); +int rte_atomic16_test_and_set_w(rte_atomic16_t *v); +void rte_atomic16_clear_w(rte_atomic16_t *v); +int rte_atomic32_cmpset_w(uint32_t *dst, uint32_t exp, uint32_t src); +uint32_t rte_atomic32_exchange_w(uint32_t *dst, uint32_t val); +void rte_atomic32_init_w(rte_atomic32_t *v); +int32_t rte_atomic32_read_w(const rte_atomic32_t *v); +void rte_atomic32_set_w(rte_atomic32_t *v, int32_t new_value); +void rte_atomic32_add_w(rte_atomic32_t *v, int32_t inc); +void rte_atomic32_sub_w(rte_atomic32_t *v, int32_t dec); +void rte_atomic32_inc_w(rte_atomic32_t *v); +void rte_atomic32_dec_w(rte_atomic32_t *v); +int32_t rte_atomic32_add_return_w(rte_atomic32_t *v, int32_t inc); +int32_t rte_atomic32_sub_return_w(rte_atomic32_t *v, int32_t dec); +int rte_atomic32_inc_and_test_w(rte_atomic32_t *v); +int rte_atomic32_dec_and_test_w(rte_atomic32_t *v); +int rte_atomic32_test_and_set_w(rte_atomic32_t *v); +void rte_atomic32_clear_w(rte_atomic32_t *v); +int rte_atomic64_cmpset_w(uint64_t *dst, uint64_t exp, uint64_t src); +uint64_t rte_atomic64_exchange_w(uint64_t *dst, uint64_t val); +void rte_atomic64_init_w(rte_atomic64_t *v); +int64_t rte_atomic64_read_w(rte_atomic64_t *v); +void rte_atomic64_set_w(rte_atomic64_t *v, int64_t new_value); +void rte_atomic64_add_w(rte_atomic64_t *v, int64_t inc); +void rte_atomic64_sub_w(rte_atomic64_t *v, int64_t dec); +void rte_atomic64_inc_w(rte_atomic64_t *v); +void rte_atomic64_dec_w(rte_atomic64_t *v); +int64_t rte_atomic64_add_return_w(rte_atomic64_t *v, int64_t inc); +int64_t rte_atomic64_sub_return_w(rte_atomic64_t *v, int64_t dec); +int rte_atomic64_inc_and_test_w(rte_atomic64_t *v); +int rte_atomic64_dec_and_test_w(rte_atomic64_t *v); +int rte_atomic64_test_and_set_w(rte_atomic64_t *v); +void rte_atomic64_clear_w(rte_atomic64_t *v); +void rte_smp_mb_w(void); +uint64_t rte_get_tsc_cycles_w(void); +uint64_t rte_get_timer_cycles_w(void); +uint64_t rte_get_timer_hz_w(void); +void rte_delay_ms_w(unsigned int ms); +uint64_t rte_rdtsc_w(void); +uint64_t rte_rdtsc_precise_w(void); +size_t rte_strlcpy_w(char *dst, const char *src, size_t size); +size_t rte_strlcat_w(char *dst, const char *src, size_t size); +const char *rte_str_skip_leading_spaces_w(const char *src); +void rte_uuid_copy_w(rte_uuid_t dst, const rte_uuid_t src); +int rte_gettid_w(void); +unsigned int rte_lcore_id_w(void); +void rte_pause_w(void); void rte_wait_until_equal_16_w(uint16_t *addr, uint16_t expected, - rte_memory_order memorder) { - rte_wait_until_equal_16(addr, expected, memorder); -} + rte_memory_order memorder); void rte_wait_until_equal_32_w(uint32_t *addr, uint32_t expected, - rte_memory_order memorder) { - rte_wait_until_equal_32(addr, expected, memorder); -} + rte_memory_order memorder); void rte_wait_until_equal_64_w(uint64_t *addr, uint64_t expected, - rte_memory_order memorder) { - rte_wait_until_equal_64(addr, expected, memorder); -} -void rte_spinlock_init_w(rte_spinlock_t *sl) { rte_spinlock_init(sl); } -void rte_spinlock_lock_w(rte_spinlock_t *sl) { rte_spinlock_lock(sl); } -void rte_spinlock_unlock_w(rte_spinlock_t *sl) { rte_spinlock_unlock(sl); } -int rte_spinlock_trylock_w(rte_spinlock_t *sl) { - return rte_spinlock_trylock(sl); -} -int rte_spinlock_is_locked_w(rte_spinlock_t *sl) { - return rte_spinlock_is_locked(sl); -} -int rte_tm_supported_w(void) { return rte_tm_supported(); } -void rte_spinlock_lock_tm_w(rte_spinlock_t *sl) { rte_spinlock_lock_tm(sl); } -void rte_spinlock_unlock_tm_w(rte_spinlock_t *sl) { - rte_spinlock_unlock_tm(sl); -} -int rte_spinlock_trylock_tm_w(rte_spinlock_t *sl) { - return rte_spinlock_trylock_tm(sl); -} -void rte_spinlock_recursive_init_w(rte_spinlock_recursive_t *slr) { - rte_spinlock_recursive_init(slr); -} -void rte_spinlock_recursive_lock_w(rte_spinlock_recursive_t *slr) { - rte_spinlock_recursive_lock(slr); -} -void rte_spinlock_recursive_unlock_w(rte_spinlock_recursive_t *slr) { - rte_spinlock_recursive_unlock(slr); -} -int rte_spinlock_recursive_trylock_w(rte_spinlock_recursive_t *slr) { - return rte_spinlock_recursive_trylock(slr); -} -void rte_spinlock_recursive_lock_tm_w(rte_spinlock_recursive_t *slr) { - rte_spinlock_recursive_lock_tm(slr); -} -void rte_spinlock_recursive_unlock_tm_w(rte_spinlock_recursive_t *slr) { - rte_spinlock_recursive_unlock_tm(slr); -} -int rte_spinlock_recursive_trylock_tm_w(rte_spinlock_recursive_t *slr) { - return rte_spinlock_recursive_trylock_tm(slr); -} -// unsigned int rte_xbegin_w(void) { return rte_xbegin(); } -// void rte_xend_w(void) { rte_xend(); } -// int rte_xtest_w(void) { return rte_xtest(); } -// int rte_try_tm_w(int *lock) { return rte_try_tm(lock); } -uint32_t rte_bit_relaxed_get32_w(unsigned int nr, uint32_t *addr) { - return rte_bit_relaxed_get32(nr, addr); -} -void rte_bit_relaxed_set32_w(unsigned int nr, uint32_t *addr) { - rte_bit_relaxed_set32(nr, addr); -} -void rte_bit_relaxed_clear32_w(unsigned int nr, uint32_t *addr) { - rte_bit_relaxed_clear32(nr, addr); -} -uint32_t rte_bit_relaxed_test_and_set32_w(unsigned int nr, uint32_t *addr) { - return rte_bit_relaxed_test_and_set32(nr, addr); -} -uint32_t rte_bit_relaxed_test_and_clear32_w(unsigned int nr, uint32_t *addr) { - return rte_bit_relaxed_test_and_clear32(nr, addr); -} -uint64_t rte_bit_relaxed_get64_w(unsigned int nr, uint64_t *addr) { - return rte_bit_relaxed_get64(nr, addr); -} -void rte_bit_relaxed_set64_w(unsigned int nr, uint64_t *addr) { - rte_bit_relaxed_set64(nr, addr); -} -void rte_bit_relaxed_clear64_w(unsigned int nr, uint64_t *addr) { - rte_bit_relaxed_clear64(nr, addr); -} -uint64_t rte_bit_relaxed_test_and_set64_w(unsigned int nr, uint64_t *addr) { - return rte_bit_relaxed_test_and_set64(nr, addr); -} -uint64_t rte_bit_relaxed_test_and_clear64_w(unsigned int nr, uint64_t *addr) { - return rte_bit_relaxed_test_and_clear64(nr, addr); -} -unsigned int rte_clz32_w(uint32_t v) { return rte_clz32(v); } -unsigned int rte_clz64_w(uint64_t v) { return rte_clz64(v); } -unsigned int rte_ctz32_w(uint32_t v) { return rte_ctz32(v); } -unsigned int rte_ctz64_w(uint64_t v) { return rte_ctz64(v); } -unsigned int rte_popcount32_w(uint32_t v) { return rte_popcount32(v); } -unsigned int rte_popcount64_w(uint64_t v) { return rte_popcount64(v); } -uint32_t rte_combine32ms1b_w(uint32_t x) { return rte_combine32ms1b(x); } -uint64_t rte_combine64ms1b_w(uint64_t v) { return rte_combine64ms1b(v); } -uint32_t rte_bsf32_w(uint32_t v) { return rte_bsf32(v); } -int rte_bsf32_safe_w(uint32_t v, uint32_t *pos) { - return rte_bsf32_safe(v, pos); -} -uint32_t rte_bsf64_w(uint64_t v) { return rte_bsf64(v); } -int rte_bsf64_safe_w(uint64_t v, uint32_t *pos) { - return rte_bsf64_safe(v, pos); -} -uint32_t rte_fls_u32_w(uint32_t x) { return rte_fls_u32(x); } -uint32_t rte_fls_u64_w(uint64_t x) { return rte_fls_u64(x); } -int rte_is_power_of_2_w(uint32_t n) { return rte_is_power_of_2(n); } -uint32_t rte_align32pow2_w(uint32_t x) { return rte_align32pow2(x); } -uint32_t rte_align32prevpow2_w(uint32_t x) { return rte_align32prevpow2(x); } -uint64_t rte_align64pow2_w(uint64_t v) { return rte_align64pow2(v); } -uint64_t rte_align64prevpow2_w(uint64_t v) { return rte_align64prevpow2(v); } -uint32_t rte_log2_u32_w(uint32_t v) { return rte_log2_u32(v); } -uint32_t rte_log2_u64_w(uint64_t v) { return rte_log2_u64(v); } -void rte_rwlock_init_w(rte_rwlock_t *rwl) { rte_rwlock_init(rwl); } -void rte_rwlock_read_lock_w(rte_rwlock_t *rwl) { rte_rwlock_read_lock(rwl); } -int rte_rwlock_read_trylock_w(rte_rwlock_t *rwl) { - return rte_rwlock_read_trylock(rwl); -} -void rte_rwlock_read_unlock_w(rte_rwlock_t *rwl) { - rte_rwlock_read_unlock(rwl); -} -int rte_rwlock_write_trylock_w(rte_rwlock_t *rwl) { - return rte_rwlock_write_trylock(rwl); -} -void rte_rwlock_write_lock_w(rte_rwlock_t *rwl) { rte_rwlock_write_lock(rwl); } -void rte_rwlock_write_unlock_w(rte_rwlock_t *rwl) { - rte_rwlock_write_unlock(rwl); -} -int rte_rwlock_write_is_locked_w(rte_rwlock_t *rwl) { - return rte_rwlock_write_is_locked(rwl); -} -void rte_rwlock_read_lock_tm_w(rte_rwlock_t *rwl) { - rte_rwlock_read_lock_tm(rwl); -} -void rte_rwlock_read_unlock_tm_w(rte_rwlock_t *rwl) { - rte_rwlock_read_unlock_tm(rwl); -} -void rte_rwlock_write_lock_tm_w(rte_rwlock_t *rwl) { - rte_rwlock_write_lock_tm(rwl); -} -void rte_rwlock_write_unlock_tm_w(rte_rwlock_t *rwl) { - rte_rwlock_write_unlock_tm(rwl); -} + rte_memory_order memorder); +void rte_spinlock_init_w(rte_spinlock_t *sl); +void rte_spinlock_lock_w(rte_spinlock_t *sl); +void rte_spinlock_unlock_w(rte_spinlock_t *sl); +int rte_spinlock_trylock_w(rte_spinlock_t *sl); +int rte_spinlock_is_locked_w(rte_spinlock_t *sl); +int rte_tm_supported_w(void); +void rte_spinlock_lock_tm_w(rte_spinlock_t *sl); +void rte_spinlock_unlock_tm_w(rte_spinlock_t *sl); +int rte_spinlock_trylock_tm_w(rte_spinlock_t *sl); +void rte_spinlock_recursive_init_w(rte_spinlock_recursive_t *slr); +void rte_spinlock_recursive_lock_w(rte_spinlock_recursive_t *slr); +void rte_spinlock_recursive_unlock_w(rte_spinlock_recursive_t *slr); +int rte_spinlock_recursive_trylock_w(rte_spinlock_recursive_t *slr); +void rte_spinlock_recursive_lock_tm_w(rte_spinlock_recursive_t *slr); +void rte_spinlock_recursive_unlock_tm_w(rte_spinlock_recursive_t *slr); +int rte_spinlock_recursive_trylock_tm_w(rte_spinlock_recursive_t *slr); +uint32_t rte_bit_relaxed_get32_w(unsigned int nr, uint32_t *addr); +void rte_bit_relaxed_set32_w(unsigned int nr, uint32_t *addr); +void rte_bit_relaxed_clear32_w(unsigned int nr, uint32_t *addr); +uint32_t rte_bit_relaxed_test_and_set32_w(unsigned int nr, uint32_t *addr); +uint32_t rte_bit_relaxed_test_and_clear32_w(unsigned int nr, uint32_t *addr); +uint64_t rte_bit_relaxed_get64_w(unsigned int nr, uint64_t *addr); +void rte_bit_relaxed_set64_w(unsigned int nr, uint64_t *addr); +void rte_bit_relaxed_clear64_w(unsigned int nr, uint64_t *addr); +uint64_t rte_bit_relaxed_test_and_set64_w(unsigned int nr, uint64_t *addr); +uint64_t rte_bit_relaxed_test_and_clear64_w(unsigned int nr, uint64_t *addr); +unsigned int rte_clz32_w(uint32_t v); +unsigned int rte_clz64_w(uint64_t v); +unsigned int rte_ctz32_w(uint32_t v); +unsigned int rte_ctz64_w(uint64_t v); +unsigned int rte_popcount32_w(uint32_t v); +unsigned int rte_popcount64_w(uint64_t v); +uint32_t rte_combine32ms1b_w(uint32_t x); +uint64_t rte_combine64ms1b_w(uint64_t v); +uint32_t rte_bsf32_w(uint32_t v); +int rte_bsf32_safe_w(uint32_t v, uint32_t *pos); +uint32_t rte_bsf64_w(uint64_t v); +int rte_bsf64_safe_w(uint64_t v, uint32_t *pos); +uint32_t rte_fls_u32_w(uint32_t x); +uint32_t rte_fls_u64_w(uint64_t x); +int rte_is_power_of_2_w(uint32_t n); +uint32_t rte_align32pow2_w(uint32_t x); +uint32_t rte_align32prevpow2_w(uint32_t x); +uint64_t rte_align64pow2_w(uint64_t v); +uint64_t rte_align64prevpow2_w(uint64_t v); +uint32_t rte_log2_u32_w(uint32_t v); +uint32_t rte_log2_u64_w(uint64_t v); +void rte_rwlock_init_w(rte_rwlock_t *rwl); +void rte_rwlock_read_lock_w(rte_rwlock_t *rwl); +int rte_rwlock_read_trylock_w(rte_rwlock_t *rwl); +void rte_rwlock_read_unlock_w(rte_rwlock_t *rwl); +int rte_rwlock_write_trylock_w(rte_rwlock_t *rwl); +void rte_rwlock_write_lock_w(rte_rwlock_t *rwl); +void rte_rwlock_write_unlock_w(rte_rwlock_t *rwl); +int rte_rwlock_write_is_locked_w(rte_rwlock_t *rwl); +void rte_rwlock_read_lock_tm_w(rte_rwlock_t *rwl); +void rte_rwlock_read_unlock_tm_w(rte_rwlock_t *rwl); +void rte_rwlock_write_lock_tm_w(rte_rwlock_t *rwl); +void rte_rwlock_write_unlock_tm_w(rte_rwlock_t *rwl); unsigned int rte_ring_mp_enqueue_bulk_elem_w(struct rte_ring *r, const void *obj_table, unsigned int esize, unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_enqueue_bulk_elem(r, obj_table, esize, n, free_space); -} + unsigned int *free_space); unsigned int rte_ring_sp_enqueue_bulk_elem_w(struct rte_ring *r, const void *obj_table, unsigned int esize, unsigned int n, - unsigned int *free_space) { - return rte_ring_sp_enqueue_bulk_elem(r, obj_table, esize, n, free_space); -} + unsigned int *free_space); unsigned int rte_ring_mp_hts_enqueue_bulk_elem_w(struct rte_ring *r, const void *obj_table, unsigned int esize, unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_hts_enqueue_bulk_elem(r, obj_table, esize, n, free_space); -} + unsigned int *free_space); unsigned int rte_ring_mc_hts_dequeue_bulk_elem_w(struct rte_ring *r, void *obj_table, unsigned int esize, unsigned int n, - unsigned int *available) { - return rte_ring_mc_hts_dequeue_bulk_elem(r, obj_table, esize, n, available); -} + unsigned int *available); unsigned int rte_ring_mp_hts_enqueue_burst_elem_w(struct rte_ring *r, const void *obj_table, unsigned int esize, unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_hts_enqueue_burst_elem(r, obj_table, esize, n, free_space); -} + unsigned int *free_space); unsigned int rte_ring_mc_hts_dequeue_burst_elem_w(struct rte_ring *r, void *obj_table, unsigned int esize, unsigned int n, - unsigned int *available) { - return rte_ring_mc_hts_dequeue_burst_elem(r, obj_table, esize, n, available); -} + unsigned int *available); unsigned int rte_ring_mp_hts_enqueue_bulk_w(struct rte_ring *r, void *const *obj_table, unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_hts_enqueue_bulk(r, obj_table, n, free_space); -} + unsigned int *free_space); unsigned int rte_ring_mc_hts_dequeue_bulk_w(struct rte_ring *r, void **obj_table, unsigned int n, - unsigned int *available) { - return rte_ring_mc_hts_dequeue_bulk(r, obj_table, n, available); -} + unsigned int *available); unsigned int rte_ring_mp_hts_enqueue_burst_w(struct rte_ring *r, void *const *obj_table, unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_hts_enqueue_burst(r, obj_table, n, free_space); -} + unsigned int *free_space); unsigned int rte_ring_mc_hts_dequeue_burst_w(struct rte_ring *r, void **obj_table, unsigned int n, - unsigned int *available) { - return rte_ring_mc_hts_dequeue_burst(r, obj_table, n, available); -} + unsigned int *available); unsigned int rte_ring_mp_rts_enqueue_bulk_elem_w(struct rte_ring *r, const void *obj_table, unsigned int esize, unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_rts_enqueue_bulk_elem(r, obj_table, esize, n, free_space); -} + unsigned int *free_space); unsigned int rte_ring_mc_rts_dequeue_bulk_elem_w(struct rte_ring *r, void *obj_table, unsigned int esize, unsigned int n, - unsigned int *available) { - return rte_ring_mc_rts_dequeue_bulk_elem(r, obj_table, esize, n, available); -} + unsigned int *available); unsigned int rte_ring_mp_rts_enqueue_burst_elem_w(struct rte_ring *r, const void *obj_table, unsigned int esize, unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_rts_enqueue_burst_elem(r, obj_table, esize, n, free_space); -} + unsigned int *free_space); unsigned int rte_ring_mc_rts_dequeue_burst_elem_w(struct rte_ring *r, void *obj_table, unsigned int esize, unsigned int n, - unsigned int *available) { - return rte_ring_mc_rts_dequeue_burst_elem(r, obj_table, esize, n, available); -} + unsigned int *available); unsigned int rte_ring_mp_rts_enqueue_bulk_w(struct rte_ring *r, void *const *obj_table, unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_rts_enqueue_bulk(r, obj_table, n, free_space); -} + unsigned int *free_space); unsigned int rte_ring_mc_rts_dequeue_bulk_w(struct rte_ring *r, void **obj_table, unsigned int n, - unsigned int *available) { - return rte_ring_mc_rts_dequeue_bulk(r, obj_table, n, available); -} + unsigned int *available); unsigned int rte_ring_mp_rts_enqueue_burst_w(struct rte_ring *r, void *const *obj_table, unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_rts_enqueue_burst(r, obj_table, n, free_space); -} + unsigned int *free_space); unsigned int rte_ring_mc_rts_dequeue_burst_w(struct rte_ring *r, void **obj_table, unsigned int n, - unsigned int *available) { - return rte_ring_mc_rts_dequeue_burst(r, obj_table, n, available); -} -uint32_t rte_ring_get_prod_htd_max_w(const struct rte_ring *r) { - return rte_ring_get_prod_htd_max(r); -} -int rte_ring_set_prod_htd_max_w(struct rte_ring *r, uint32_t v) { - return rte_ring_set_prod_htd_max(r, v); -} -uint32_t rte_ring_get_cons_htd_max_w(const struct rte_ring *r) { - return rte_ring_get_cons_htd_max(r); -} -int rte_ring_set_cons_htd_max_w(struct rte_ring *r, uint32_t v) { - return rte_ring_set_cons_htd_max(r, v); -} + unsigned int *available); +uint32_t rte_ring_get_prod_htd_max_w(const struct rte_ring *r); +int rte_ring_set_prod_htd_max_w(struct rte_ring *r, uint32_t v); +uint32_t rte_ring_get_cons_htd_max_w(const struct rte_ring *r); +int rte_ring_set_cons_htd_max_w(struct rte_ring *r, uint32_t v); unsigned int rte_ring_enqueue_bulk_elem_w(struct rte_ring *r, const void *obj_table, unsigned int esize, unsigned int n, - unsigned int *free_space) { - return rte_ring_enqueue_bulk_elem(r, obj_table, esize, n, free_space); -} + unsigned int *free_space); int rte_ring_mp_enqueue_elem_w(struct rte_ring *r, void *obj, - unsigned int esize) { - return rte_ring_mp_enqueue_elem(r, obj, esize); -} + unsigned int esize); int rte_ring_sp_enqueue_elem_w(struct rte_ring *r, void *obj, - unsigned int esize) { - return rte_ring_sp_enqueue_elem(r, obj, esize); -} -int rte_ring_enqueue_elem_w(struct rte_ring *r, void *obj, unsigned int esize) { - return rte_ring_enqueue_elem(r, obj, esize); -} + unsigned int esize); +int rte_ring_enqueue_elem_w(struct rte_ring *r, void *obj, unsigned int esize); unsigned int rte_ring_mc_dequeue_bulk_elem_w(struct rte_ring *r, void *obj_table, unsigned int esize, unsigned int n, - unsigned int *available) { - return rte_ring_mc_dequeue_bulk_elem(r, obj_table, esize, n, available); -} + unsigned int *available); unsigned int rte_ring_sc_dequeue_bulk_elem_w(struct rte_ring *r, void *obj_table, unsigned int esize, unsigned int n, - unsigned int *available) { - return rte_ring_sc_dequeue_bulk_elem(r, obj_table, esize, n, available); -} + unsigned int *available); unsigned int rte_ring_dequeue_bulk_elem_w(struct rte_ring *r, void *obj_table, unsigned int esize, unsigned int n, - unsigned int *available) { - return rte_ring_dequeue_bulk_elem(r, obj_table, esize, n, available); -} + unsigned int *available); int rte_ring_mc_dequeue_elem_w(struct rte_ring *r, void *obj_p, - unsigned int esize) { - return rte_ring_mc_dequeue_elem(r, obj_p, esize); -} + unsigned int esize); int rte_ring_sc_dequeue_elem_w(struct rte_ring *r, void *obj_p, - unsigned int esize) { - return rte_ring_sc_dequeue_elem(r, obj_p, esize); -} + unsigned int esize); int rte_ring_dequeue_elem_w(struct rte_ring *r, void *obj_p, - unsigned int esize) { - return rte_ring_dequeue_elem(r, obj_p, esize); -} + unsigned int esize); unsigned int rte_ring_mp_enqueue_burst_elem_w(struct rte_ring *r, const void *obj_table, unsigned int esize, unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_enqueue_burst_elem(r, obj_table, esize, n, free_space); -} + unsigned int *free_space); unsigned int rte_ring_sp_enqueue_burst_elem_w(struct rte_ring *r, const void *obj_table, unsigned int esize, unsigned int n, - unsigned int *free_space) { - return rte_ring_sp_enqueue_burst_elem(r, obj_table, esize, n, free_space); -} + unsigned int *free_space); unsigned int rte_ring_enqueue_burst_elem_w(struct rte_ring *r, const void *obj_table, unsigned int esize, unsigned int n, - unsigned int *free_space) { - return rte_ring_enqueue_burst_elem(r, obj_table, esize, n, free_space); -} + unsigned int *free_space); unsigned int rte_ring_mc_dequeue_burst_elem_w(struct rte_ring *r, void *obj_table, unsigned int esize, unsigned int n, - unsigned int *available) { - return rte_ring_mc_dequeue_burst_elem(r, obj_table, esize, n, available); -} + unsigned int *available); unsigned int rte_ring_sc_dequeue_burst_elem_w(struct rte_ring *r, void *obj_table, unsigned int esize, unsigned int n, - unsigned int *available) { - return rte_ring_sc_dequeue_burst_elem(r, obj_table, esize, n, available); -} + unsigned int *available); unsigned int rte_ring_dequeue_burst_elem_w(struct rte_ring *r, void *obj_table, unsigned int esize, unsigned int n, - unsigned int *available) { - return rte_ring_dequeue_burst_elem(r, obj_table, esize, n, available); -} + unsigned int *available); unsigned int rte_ring_enqueue_bulk_elem_start_w(struct rte_ring *r, unsigned int n, - unsigned int *free_space) { - return rte_ring_enqueue_bulk_elem_start(r, n, free_space); -} + unsigned int *free_space); unsigned int rte_ring_enqueue_bulk_start_w(struct rte_ring *r, unsigned int n, - unsigned int *free_space) { - return rte_ring_enqueue_bulk_start(r, n, free_space); -} + unsigned int *free_space); unsigned int rte_ring_enqueue_burst_elem_start_w(struct rte_ring *r, unsigned int n, - unsigned int *free_space) { - return rte_ring_enqueue_burst_elem_start(r, n, free_space); -} + unsigned int *free_space); unsigned int rte_ring_enqueue_burst_start_w(struct rte_ring *r, unsigned int n, - unsigned int *free_space) { - return rte_ring_enqueue_burst_start(r, n, free_space); -} + unsigned int *free_space); void rte_ring_enqueue_elem_finish_w(struct rte_ring *r, const void *obj_table, - unsigned int esize, unsigned int n) { - rte_ring_enqueue_elem_finish(r, obj_table, esize, n); -} + unsigned int esize, unsigned int n); void rte_ring_enqueue_finish_w(struct rte_ring *r, void *const *obj_table, - unsigned int n) { - rte_ring_enqueue_finish(r, obj_table, n); -} + unsigned int n); unsigned int rte_ring_dequeue_bulk_elem_start_w(struct rte_ring *r, void *obj_table, unsigned int esize, unsigned int n, - unsigned int *available) { - return rte_ring_dequeue_bulk_elem_start(r, obj_table, esize, n, available); -} + unsigned int *available); unsigned int rte_ring_dequeue_bulk_start_w(struct rte_ring *r, void **obj_table, unsigned int n, - unsigned int *available) { - return rte_ring_dequeue_bulk_start(r, obj_table, n, available); -} + unsigned int *available); unsigned int rte_ring_dequeue_burst_elem_start_w(struct rte_ring *r, void *obj_table, unsigned int esize, unsigned int n, - unsigned int *available) { - return rte_ring_dequeue_burst_elem_start(r, obj_table, esize, n, available); -} + unsigned int *available); unsigned int rte_ring_dequeue_burst_start_w(struct rte_ring *r, void **obj_table, unsigned int n, - unsigned int *available) { - return rte_ring_dequeue_burst_start(r, obj_table, n, available); -} -void rte_ring_dequeue_elem_finish_w(struct rte_ring *r, unsigned int n) { - rte_ring_dequeue_elem_finish(r, n); -} -void rte_ring_dequeue_finish_w(struct rte_ring *r, unsigned int n) { - rte_ring_dequeue_finish(r, n); -} + unsigned int *available); +void rte_ring_dequeue_elem_finish_w(struct rte_ring *r, unsigned int n); +void rte_ring_dequeue_finish_w(struct rte_ring *r, unsigned int n); unsigned int rte_ring_enqueue_zc_bulk_elem_start_w(struct rte_ring *r, unsigned int esize, unsigned int n, struct rte_ring_zc_data *zcd, - unsigned int *free_space) { - return rte_ring_enqueue_zc_bulk_elem_start(r, esize, n, zcd, free_space); -} + unsigned int *free_space); unsigned int rte_ring_enqueue_zc_bulk_start_w(struct rte_ring *r, unsigned int n, struct rte_ring_zc_data *zcd, - unsigned int *free_space) { - return rte_ring_enqueue_zc_bulk_start(r, n, zcd, free_space); -} + unsigned int *free_space); unsigned int rte_ring_enqueue_zc_burst_elem_start_w( struct rte_ring *r, unsigned int esize, unsigned int n, - struct rte_ring_zc_data *zcd, unsigned int *free_space) { - return rte_ring_enqueue_zc_burst_elem_start(r, esize, n, zcd, free_space); -} + struct rte_ring_zc_data *zcd, unsigned int *free_space); unsigned int rte_ring_enqueue_zc_burst_start_w(struct rte_ring *r, unsigned int n, struct rte_ring_zc_data *zcd, - unsigned int *free_space) { - return rte_ring_enqueue_zc_burst_start(r, n, zcd, free_space); -} -void rte_ring_enqueue_zc_elem_finish_w(struct rte_ring *r, unsigned int n) { - rte_ring_enqueue_zc_elem_finish(r, n); -} -void rte_ring_enqueue_zc_finish_w(struct rte_ring *r, unsigned int n) { - rte_ring_enqueue_zc_finish(r, n); -} + unsigned int *free_space); +void rte_ring_enqueue_zc_elem_finish_w(struct rte_ring *r, unsigned int n); +void rte_ring_enqueue_zc_finish_w(struct rte_ring *r, unsigned int n); unsigned int rte_ring_dequeue_zc_bulk_elem_start_w(struct rte_ring *r, unsigned int esize, unsigned int n, struct rte_ring_zc_data *zcd, - unsigned int *available) { - return rte_ring_dequeue_zc_bulk_elem_start(r, esize, n, zcd, available); -} + unsigned int *available); unsigned int rte_ring_dequeue_zc_bulk_start_w(struct rte_ring *r, unsigned int n, struct rte_ring_zc_data *zcd, - unsigned int *available) { - return rte_ring_dequeue_zc_bulk_start(r, n, zcd, available); -} + unsigned int *available); unsigned int rte_ring_dequeue_zc_burst_elem_start_w( struct rte_ring *r, unsigned int esize, unsigned int n, - struct rte_ring_zc_data *zcd, unsigned int *available) { - return rte_ring_dequeue_zc_burst_elem_start(r, esize, n, zcd, available); -} + struct rte_ring_zc_data *zcd, unsigned int *available); unsigned int rte_ring_dequeue_zc_burst_start_w(struct rte_ring *r, unsigned int n, struct rte_ring_zc_data *zcd, - unsigned int *available) { - return rte_ring_dequeue_zc_burst_start(r, n, zcd, available); -} -void rte_ring_dequeue_zc_elem_finish_w(struct rte_ring *r, unsigned int n) { - rte_ring_dequeue_zc_elem_finish(r, n); -} -void rte_ring_dequeue_zc_finish_w(struct rte_ring *r, unsigned int n) { - rte_ring_dequeue_zc_finish(r, n); -} + unsigned int *available); +void rte_ring_dequeue_zc_elem_finish_w(struct rte_ring *r, unsigned int n); +void rte_ring_dequeue_zc_finish_w(struct rte_ring *r, unsigned int n); unsigned int rte_ring_mp_enqueue_bulk_w(struct rte_ring *r, void *const *obj_table, unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_enqueue_bulk(r, obj_table, n, free_space); -} + unsigned int *free_space); unsigned int rte_ring_sp_enqueue_bulk_w(struct rte_ring *r, void *const *obj_table, unsigned int n, - unsigned int *free_space) { - return rte_ring_sp_enqueue_bulk(r, obj_table, n, free_space); -} + unsigned int *free_space); unsigned int rte_ring_enqueue_bulk_w(struct rte_ring *r, void *const *obj_table, - unsigned int n, unsigned int *free_space) { - return rte_ring_enqueue_bulk(r, obj_table, n, free_space); -} -int rte_ring_mp_enqueue_w(struct rte_ring *r, void *obj) { - return rte_ring_mp_enqueue(r, obj); -} -int rte_ring_sp_enqueue_w(struct rte_ring *r, void *obj) { - return rte_ring_sp_enqueue(r, obj); -} -int rte_ring_enqueue_w(struct rte_ring *r, void *obj) { - return rte_ring_enqueue(r, obj); -} + unsigned int n, unsigned int *free_space); +int rte_ring_mp_enqueue_w(struct rte_ring *r, void *obj); +int rte_ring_sp_enqueue_w(struct rte_ring *r, void *obj); +int rte_ring_enqueue_w(struct rte_ring *r, void *obj); unsigned int rte_ring_mc_dequeue_bulk_w(struct rte_ring *r, void **obj_table, unsigned int n, - unsigned int *available) { - return rte_ring_mc_dequeue_bulk(r, obj_table, n, available); -} + unsigned int *available); unsigned int rte_ring_sc_dequeue_bulk_w(struct rte_ring *r, void **obj_table, unsigned int n, - unsigned int *available) { - return rte_ring_sc_dequeue_bulk(r, obj_table, n, available); -} + unsigned int *available); unsigned int rte_ring_dequeue_bulk_w(struct rte_ring *r, void **obj_table, - unsigned int n, unsigned int *available) { - return rte_ring_dequeue_bulk(r, obj_table, n, available); -} -int rte_ring_mc_dequeue_w(struct rte_ring *r, void **obj_p) { - return rte_ring_mc_dequeue(r, obj_p); -} -int rte_ring_sc_dequeue_w(struct rte_ring *r, void **obj_p) { - return rte_ring_sc_dequeue(r, obj_p); -} -int rte_ring_dequeue_w(struct rte_ring *r, void **obj_p) { - return rte_ring_dequeue(r, obj_p); -} -unsigned int rte_ring_count_w(const struct rte_ring *r) { - return rte_ring_count(r); -} -unsigned int rte_ring_free_count_w(const struct rte_ring *r) { - return rte_ring_free_count(r); -} -int rte_ring_full_w(const struct rte_ring *r) { return rte_ring_full(r); } -int rte_ring_empty_w(const struct rte_ring *r) { return rte_ring_empty(r); } -unsigned int rte_ring_get_size_w(const struct rte_ring *r) { - return rte_ring_get_size(r); -} -unsigned int rte_ring_get_capacity_w(const struct rte_ring *r) { - return rte_ring_get_capacity(r); -} -enum rte_ring_sync_type -rte_ring_get_prod_sync_type_w(const struct rte_ring *r) { - return rte_ring_get_prod_sync_type(r); -} -int rte_ring_is_prod_single_w(const struct rte_ring *r) { - return rte_ring_is_prod_single(r); -} -enum rte_ring_sync_type -rte_ring_get_cons_sync_type_w(const struct rte_ring *r) { - return rte_ring_get_cons_sync_type(r); -} -int rte_ring_is_cons_single_w(const struct rte_ring *r) { - return rte_ring_is_cons_single(r); -} + unsigned int n, unsigned int *available); +int rte_ring_mc_dequeue_w(struct rte_ring *r, void **obj_p); +int rte_ring_sc_dequeue_w(struct rte_ring *r, void **obj_p); +int rte_ring_dequeue_w(struct rte_ring *r, void **obj_p); +unsigned int rte_ring_count_w(const struct rte_ring *r); +unsigned int rte_ring_free_count_w(const struct rte_ring *r); +int rte_ring_full_w(const struct rte_ring *r); +int rte_ring_empty_w(const struct rte_ring *r); +unsigned int rte_ring_get_size_w(const struct rte_ring *r); +unsigned int rte_ring_get_capacity_w(const struct rte_ring *r); +enum rte_ring_sync_type rte_ring_get_prod_sync_type_w(const struct rte_ring *r); +int rte_ring_is_prod_single_w(const struct rte_ring *r); +enum rte_ring_sync_type rte_ring_get_cons_sync_type_w(const struct rte_ring *r); +int rte_ring_is_cons_single_w(const struct rte_ring *r); unsigned int rte_ring_mp_enqueue_burst_w(struct rte_ring *r, void *const *obj_table, unsigned int n, - unsigned int *free_space) { - return rte_ring_mp_enqueue_burst(r, obj_table, n, free_space); -} + unsigned int *free_space); unsigned int rte_ring_sp_enqueue_burst_w(struct rte_ring *r, void *const *obj_table, unsigned int n, - unsigned int *free_space) { - return rte_ring_sp_enqueue_burst(r, obj_table, n, free_space); -} + unsigned int *free_space); unsigned int rte_ring_enqueue_burst_w(struct rte_ring *r, void *const *obj_table, unsigned int n, - unsigned int *free_space) { - return rte_ring_enqueue_burst(r, obj_table, n, free_space); -} + unsigned int *free_space); unsigned int rte_ring_mc_dequeue_burst_w(struct rte_ring *r, void **obj_table, unsigned int n, - unsigned int *available) { - return rte_ring_mc_dequeue_burst(r, obj_table, n, available); -} + unsigned int *available); unsigned int rte_ring_sc_dequeue_burst_w(struct rte_ring *r, void **obj_table, unsigned int n, - unsigned int *available) { - return rte_ring_sc_dequeue_burst(r, obj_table, n, available); -} + unsigned int *available); unsigned int rte_ring_dequeue_burst_w(struct rte_ring *r, void **obj_table, - unsigned int n, unsigned int *available) { - return rte_ring_dequeue_burst(r, obj_table, n, available); -} -void *rte_memcpy_w(void *dst, const void *src, size_t n) { - return rte_memcpy(dst, src, n); -} -// void *rte_mov15_or_less_w(void *dst, const void *src, size_t n) { -// return rte_mov15_or_less(dst, src, n); -// } -void rte_mov16_w(uint8_t *dst, const uint8_t *src) { rte_mov16(dst, src); } -void rte_mov32_w(uint8_t *dst, const uint8_t *src) { rte_mov32(dst, src); } -void rte_mov64_w(uint8_t *dst, const uint8_t *src) { rte_mov64(dst, src); } -void rte_mov256_w(uint8_t *dst, const uint8_t *src) { rte_mov256(dst, src); } -// void *rte_memcpy_generic_w(void *dst, const void *src, size_t n) { -// return rte_memcpy_generic(dst, src, n); -// } -// void *rte_memcpy_aligned_w(void *dst, const void *src, size_t n) { -// return rte_memcpy_aligned(dst, src, n); -// } -struct rte_mempool_objhdr *rte_mempool_get_header_w(void *obj) { - return rte_mempool_get_header(obj); -} -struct rte_mempool *rte_mempool_from_obj_w(void *obj) { - return rte_mempool_from_obj(obj); -} -struct rte_mempool_objtlr *rte_mempool_get_trailer_w(void *obj) { - return rte_mempool_get_trailer(obj); -} -struct rte_mempool_ops *rte_mempool_get_ops_w(int ops_index) { - return rte_mempool_get_ops(ops_index); -} + unsigned int n, unsigned int *available); +void *rte_memcpy_w(void *dst, const void *src, size_t n); +void rte_mov16_w(uint8_t *dst, const uint8_t *src); +void rte_mov32_w(uint8_t *dst, const uint8_t *src); +void rte_mov64_w(uint8_t *dst, const uint8_t *src); +void rte_mov256_w(uint8_t *dst, const uint8_t *src); +struct rte_mempool_objhdr *rte_mempool_get_header_w(void *obj); +struct rte_mempool *rte_mempool_from_obj_w(void *obj); +struct rte_mempool_objtlr *rte_mempool_get_trailer_w(void *obj); +struct rte_mempool_ops *rte_mempool_get_ops_w(int ops_index); int rte_mempool_ops_dequeue_bulk_w(struct rte_mempool *mp, void **obj_table, - unsigned int n) { - return rte_mempool_ops_dequeue_bulk(mp, obj_table, n); -} + unsigned int n); int rte_mempool_ops_dequeue_contig_blocks_w(struct rte_mempool *mp, void **first_obj_table, - unsigned int n) { - return rte_mempool_ops_dequeue_contig_blocks(mp, first_obj_table, n); -} + unsigned int n); int rte_mempool_ops_enqueue_bulk_w(struct rte_mempool *mp, - void *const *obj_table, unsigned int n) { - return rte_mempool_ops_enqueue_bulk(mp, obj_table, n); -} + void *const *obj_table, unsigned int n); struct rte_mempool_cache *rte_mempool_default_cache_w(struct rte_mempool *mp, - unsigned int lcore_id) { - return rte_mempool_default_cache(mp, lcore_id); -} + unsigned int lcore_id); void rte_mempool_cache_flush_w(struct rte_mempool_cache *cache, - struct rte_mempool *mp) { - rte_mempool_cache_flush(cache, mp); -} + struct rte_mempool *mp); void rte_mempool_do_generic_put_w(struct rte_mempool *mp, void *const *obj_table, unsigned int n, - struct rte_mempool_cache *cache) { - rte_mempool_do_generic_put(mp, obj_table, n, cache); -} + struct rte_mempool_cache *cache); void rte_mempool_generic_put_w(struct rte_mempool *mp, void *const *obj_table, - unsigned int n, - struct rte_mempool_cache *cache) { - rte_mempool_generic_put(mp, obj_table, n, cache); -} + unsigned int n, struct rte_mempool_cache *cache); void rte_mempool_put_bulk_w(struct rte_mempool *mp, void *const *obj_table, - unsigned int n) { - rte_mempool_put_bulk(mp, obj_table, n); -} -void rte_mempool_put_w(struct rte_mempool *mp, void *obj) { - rte_mempool_put(mp, obj); -} + unsigned int n); +void rte_mempool_put_w(struct rte_mempool *mp, void *obj); int rte_mempool_do_generic_get_w(struct rte_mempool *mp, void **obj_table, unsigned int n, - struct rte_mempool_cache *cache) { - return rte_mempool_do_generic_get(mp, obj_table, n, cache); -} + struct rte_mempool_cache *cache); int rte_mempool_generic_get_w(struct rte_mempool *mp, void **obj_table, - unsigned int n, struct rte_mempool_cache *cache) { - return rte_mempool_generic_get(mp, obj_table, n, cache); -} + unsigned int n, struct rte_mempool_cache *cache); int rte_mempool_get_bulk_w(struct rte_mempool *mp, void **obj_table, - unsigned int n) { - return rte_mempool_get_bulk(mp, obj_table, n); -} -int rte_mempool_get_w(struct rte_mempool *mp, void **obj_p) { - return rte_mempool_get(mp, obj_p); -} + unsigned int n); +int rte_mempool_get_w(struct rte_mempool *mp, void **obj_p); int rte_mempool_get_contig_blocks_w(struct rte_mempool *mp, - void **first_obj_table, unsigned int n) { - return rte_mempool_get_contig_blocks(mp, first_obj_table, n); -} -int rte_mempool_full_w(const struct rte_mempool *mp) { - return rte_mempool_full(mp); -} -int rte_mempool_empty_w(const struct rte_mempool *mp) { - return rte_mempool_empty(mp); -} -rte_iova_t rte_mempool_virt2iova_w(const void *elt) { - return rte_mempool_virt2iova(elt); -} -void *rte_mempool_get_priv_w(struct rte_mempool *mp) { - return rte_mempool_get_priv(mp); -} -void rte_prefetch0_w(const void *p) { rte_prefetch0(p); } -void rte_prefetch1_w(const void *p) { rte_prefetch1(p); } -void rte_prefetch2_w(const void *p) { rte_prefetch2(p); } -void rte_prefetch_non_temporal_w(const void *p) { - rte_prefetch_non_temporal(p); -} -void rte_prefetch0_write_w(const void *p) { rte_prefetch0_write(p); } -void rte_prefetch1_write_w(const void *p) { rte_prefetch1_write(p); } -void rte_prefetch2_write_w(const void *p) { rte_prefetch2_write(p); } -void rte_cldemote_w(const void *p) { rte_cldemote(p); } -uint16_t rte_constant_bswap16_w(uint16_t x) { return rte_constant_bswap16(x); } -uint32_t rte_constant_bswap32_w(uint32_t x) { return rte_constant_bswap32(x); } -uint64_t rte_constant_bswap64_w(uint64_t x) { return rte_constant_bswap64(x); } -// uint16_t rte_arch_bswap16_w(uint16_t _x) { return rte_arch_bswap16(_x); } -// uint32_t rte_arch_bswap32_w(uint32_t _x) { return rte_arch_bswap32(_x); } -// uint64_t rte_arch_bswap64_w(uint64_t _x) { return rte_arch_bswap64(_x); } -void rte_mbuf_prefetch_part1_w(struct rte_mbuf *m) { - rte_mbuf_prefetch_part1(m); -} -void rte_mbuf_prefetch_part2_w(struct rte_mbuf *m) { - rte_mbuf_prefetch_part2(m); -} -uint16_t rte_pktmbuf_priv_size_w(struct rte_mempool *mp) { - return rte_pktmbuf_priv_size(mp); -} -rte_iova_t rte_mbuf_iova_get_w(const struct rte_mbuf *m) { - return rte_mbuf_iova_get(m); -} -void rte_mbuf_iova_set_w(struct rte_mbuf *m, rte_iova_t iova) { - rte_mbuf_iova_set(m, iova); -} -rte_iova_t rte_mbuf_data_iova_w(const struct rte_mbuf *mb) { - return rte_mbuf_data_iova(mb); -} -rte_iova_t rte_mbuf_data_iova_default_w(const struct rte_mbuf *mb) { - return rte_mbuf_data_iova_default(mb); -} -struct rte_mbuf *rte_mbuf_from_indirect_w(struct rte_mbuf *mi) { - return rte_mbuf_from_indirect(mi); -} -char *rte_mbuf_buf_addr_w(struct rte_mbuf *mb, struct rte_mempool *mp) { - return rte_mbuf_buf_addr(mb, mp); -} -char *rte_mbuf_data_addr_default_w(struct rte_mbuf *mb) { - return rte_mbuf_data_addr_default(mb); -} -char *rte_mbuf_to_baddr_w(struct rte_mbuf *md) { return rte_mbuf_to_baddr(md); } -void *rte_mbuf_to_priv_w(struct rte_mbuf *m) { return rte_mbuf_to_priv(m); } -uint32_t rte_pktmbuf_priv_flags_w(struct rte_mempool *mp) { - return rte_pktmbuf_priv_flags(mp); -} -uint16_t rte_mbuf_refcnt_read_w(const struct rte_mbuf *m) { - return rte_mbuf_refcnt_read(m); -} -void rte_mbuf_refcnt_set_w(struct rte_mbuf *m, uint16_t new_value) { - rte_mbuf_refcnt_set(m, new_value); -} -uint16_t rte_mbuf_refcnt_update_w(struct rte_mbuf *m, int16_t value) { - return rte_mbuf_refcnt_update(m, value); -} + void **first_obj_table, unsigned int n); +int rte_mempool_full_w(const struct rte_mempool *mp); +int rte_mempool_empty_w(const struct rte_mempool *mp); +rte_iova_t rte_mempool_virt2iova_w(const void *elt); +void *rte_mempool_get_priv_w(struct rte_mempool *mp); +void rte_prefetch0_w(const void *p); +void rte_prefetch1_w(const void *p); +void rte_prefetch2_w(const void *p); +void rte_prefetch_non_temporal_w(const void *p); +void rte_prefetch0_write_w(const void *p); +void rte_prefetch1_write_w(const void *p); +void rte_prefetch2_write_w(const void *p); +void rte_cldemote_w(const void *p); +uint16_t rte_constant_bswap16_w(uint16_t x); +uint32_t rte_constant_bswap32_w(uint32_t x); +uint64_t rte_constant_bswap64_w(uint64_t x); +void rte_mbuf_prefetch_part1_w(struct rte_mbuf *m); +void rte_mbuf_prefetch_part2_w(struct rte_mbuf *m); +uint16_t rte_pktmbuf_priv_size_w(struct rte_mempool *mp); +rte_iova_t rte_mbuf_iova_get_w(const struct rte_mbuf *m); +void rte_mbuf_iova_set_w(struct rte_mbuf *m, rte_iova_t iova); +rte_iova_t rte_mbuf_data_iova_w(const struct rte_mbuf *mb); +rte_iova_t rte_mbuf_data_iova_default_w(const struct rte_mbuf *mb); +struct rte_mbuf *rte_mbuf_from_indirect_w(struct rte_mbuf *mi); +char *rte_mbuf_buf_addr_w(struct rte_mbuf *mb, struct rte_mempool *mp); +char *rte_mbuf_data_addr_default_w(struct rte_mbuf *mb); +char *rte_mbuf_to_baddr_w(struct rte_mbuf *md); +void *rte_mbuf_to_priv_w(struct rte_mbuf *m); +uint32_t rte_pktmbuf_priv_flags_w(struct rte_mempool *mp); +uint16_t rte_mbuf_refcnt_read_w(const struct rte_mbuf *m); +void rte_mbuf_refcnt_set_w(struct rte_mbuf *m, uint16_t new_value); +uint16_t rte_mbuf_refcnt_update_w(struct rte_mbuf *m, int16_t value); uint16_t -rte_mbuf_ext_refcnt_read_w(const struct rte_mbuf_ext_shared_info *shinfo) { - return rte_mbuf_ext_refcnt_read(shinfo); -} +rte_mbuf_ext_refcnt_read_w(const struct rte_mbuf_ext_shared_info *shinfo); void rte_mbuf_ext_refcnt_set_w(struct rte_mbuf_ext_shared_info *shinfo, - uint16_t new_value) { - rte_mbuf_ext_refcnt_set(shinfo, new_value); -} + uint16_t new_value); uint16_t rte_mbuf_ext_refcnt_update_w(struct rte_mbuf_ext_shared_info *shinfo, - int16_t value) { - return rte_mbuf_ext_refcnt_update(shinfo, value); -} -struct rte_mbuf *rte_mbuf_raw_alloc_w(struct rte_mempool *mp) { - return rte_mbuf_raw_alloc(mp); -} -void rte_mbuf_raw_free_w(struct rte_mbuf *m) { rte_mbuf_raw_free(m); } -uint16_t rte_pktmbuf_data_room_size_w(struct rte_mempool *mp) { - return rte_pktmbuf_data_room_size(mp); -} -void rte_pktmbuf_reset_headroom_w(struct rte_mbuf *m) { - rte_pktmbuf_reset_headroom(m); -} -void rte_pktmbuf_reset_w(struct rte_mbuf *m) { rte_pktmbuf_reset(m); } -struct rte_mbuf *rte_pktmbuf_alloc_w(struct rte_mempool *mp) { - return rte_pktmbuf_alloc(mp); -} + int16_t value); +struct rte_mbuf *rte_mbuf_raw_alloc_w(struct rte_mempool *mp); +void rte_mbuf_raw_free_w(struct rte_mbuf *m); +uint16_t rte_pktmbuf_data_room_size_w(struct rte_mempool *mp); +void rte_pktmbuf_reset_headroom_w(struct rte_mbuf *m); +void rte_pktmbuf_reset_w(struct rte_mbuf *m); +struct rte_mbuf *rte_pktmbuf_alloc_w(struct rte_mempool *mp); int rte_pktmbuf_alloc_bulk_w(struct rte_mempool *pool, struct rte_mbuf **mbufs, - unsigned int count) { - return rte_pktmbuf_alloc_bulk(pool, mbufs, count); -} + unsigned int count); struct rte_mbuf_ext_shared_info * rte_pktmbuf_ext_shinfo_init_helper_w(void *buf_addr, uint16_t *buf_len, rte_mbuf_extbuf_free_callback_t free_cb, - void *fcb_opaque) { - return rte_pktmbuf_ext_shinfo_init_helper(buf_addr, buf_len, free_cb, - fcb_opaque); -} + void *fcb_opaque); void rte_pktmbuf_attach_extbuf_w(struct rte_mbuf *m, void *buf_addr, rte_iova_t buf_iova, uint16_t buf_len, - struct rte_mbuf_ext_shared_info *shinfo) { - rte_pktmbuf_attach_extbuf(m, buf_addr, buf_iova, buf_len, shinfo); -} + struct rte_mbuf_ext_shared_info *shinfo); void rte_mbuf_dynfield_copy_w(struct rte_mbuf *mdst, - const struct rte_mbuf *msrc) { - rte_mbuf_dynfield_copy(mdst, msrc); -} -void rte_pktmbuf_attach_w(struct rte_mbuf *mi, struct rte_mbuf *m) { - rte_pktmbuf_attach(mi, m); -} -void rte_pktmbuf_detach_w(struct rte_mbuf *m) { rte_pktmbuf_detach(m); } -struct rte_mbuf *rte_pktmbuf_prefree_seg_w(struct rte_mbuf *m) { - return rte_pktmbuf_prefree_seg(m); -} -void rte_pktmbuf_free_seg_w(struct rte_mbuf *m) { rte_pktmbuf_free_seg(m); } -void rte_pktmbuf_free_w(struct rte_mbuf *m) { rte_pktmbuf_free(m); } -void rte_pktmbuf_refcnt_update_w(struct rte_mbuf *m, int16_t v) { - rte_pktmbuf_refcnt_update(m, v); -} -uint16_t rte_pktmbuf_headroom_w(const struct rte_mbuf *m) { - return rte_pktmbuf_headroom(m); -} -uint16_t rte_pktmbuf_tailroom_w(const struct rte_mbuf *m) { - return rte_pktmbuf_tailroom(m); -} -struct rte_mbuf *rte_pktmbuf_lastseg_w(struct rte_mbuf *m) { - return rte_pktmbuf_lastseg(m); -} -char *rte_pktmbuf_prepend_w(struct rte_mbuf *m, uint16_t len) { - return rte_pktmbuf_prepend(m, len); -} -char *rte_pktmbuf_append_w(struct rte_mbuf *m, uint16_t len) { - return rte_pktmbuf_append(m, len); -} -char *rte_pktmbuf_adj_w(struct rte_mbuf *m, uint16_t len) { - return rte_pktmbuf_adj(m, len); -} -int rte_pktmbuf_trim_w(struct rte_mbuf *m, uint16_t len) { - return rte_pktmbuf_trim(m, len); -} -int rte_pktmbuf_is_contiguous_w(const struct rte_mbuf *m) { - return rte_pktmbuf_is_contiguous(m); -} + const struct rte_mbuf *msrc); +void rte_pktmbuf_attach_w(struct rte_mbuf *mi, struct rte_mbuf *m); +void rte_pktmbuf_detach_w(struct rte_mbuf *m); +struct rte_mbuf *rte_pktmbuf_prefree_seg_w(struct rte_mbuf *m); +void rte_pktmbuf_free_seg_w(struct rte_mbuf *m); +void rte_pktmbuf_free_w(struct rte_mbuf *m); +void rte_pktmbuf_refcnt_update_w(struct rte_mbuf *m, int16_t v); +uint16_t rte_pktmbuf_headroom_w(const struct rte_mbuf *m); +uint16_t rte_pktmbuf_tailroom_w(const struct rte_mbuf *m); +struct rte_mbuf *rte_pktmbuf_lastseg_w(struct rte_mbuf *m); +char *rte_pktmbuf_prepend_w(struct rte_mbuf *m, uint16_t len); +char *rte_pktmbuf_append_w(struct rte_mbuf *m, uint16_t len); +char *rte_pktmbuf_adj_w(struct rte_mbuf *m, uint16_t len); +int rte_pktmbuf_trim_w(struct rte_mbuf *m, uint16_t len); +int rte_pktmbuf_is_contiguous_w(const struct rte_mbuf *m); const void *rte_pktmbuf_read_w(const struct rte_mbuf *m, uint32_t off, - uint32_t len, void *buf) { - return rte_pktmbuf_read(m, off, len, buf); -} -int rte_pktmbuf_chain_w(struct rte_mbuf *head, struct rte_mbuf *tail) { - return rte_pktmbuf_chain(head, tail); -} + uint32_t len, void *buf); +int rte_pktmbuf_chain_w(struct rte_mbuf *head, struct rte_mbuf *tail); uint64_t rte_mbuf_tx_offload_w(uint64_t il2, uint64_t il3, uint64_t il4, uint64_t tso, uint64_t ol3, uint64_t ol2, - uint64_t unused) { - return rte_mbuf_tx_offload(il2, il3, il4, tso, ol3, ol2, unused); -} -int rte_validate_tx_offload_w(const struct rte_mbuf *m) { - return rte_validate_tx_offload(m); -} -int rte_pktmbuf_linearize_w(struct rte_mbuf *mbuf) { - return rte_pktmbuf_linearize(mbuf); -} -uint32_t rte_mbuf_sched_queue_get_w(const struct rte_mbuf *m) { - return rte_mbuf_sched_queue_get(m); -} -uint8_t rte_mbuf_sched_traffic_class_get_w(const struct rte_mbuf *m) { - return rte_mbuf_sched_traffic_class_get(m); -} -uint8_t rte_mbuf_sched_color_get_w(const struct rte_mbuf *m) { - return rte_mbuf_sched_color_get(m); -} + uint64_t unused); +int rte_validate_tx_offload_w(const struct rte_mbuf *m); +int rte_pktmbuf_linearize_w(struct rte_mbuf *mbuf); +uint32_t rte_mbuf_sched_queue_get_w(const struct rte_mbuf *m); +uint8_t rte_mbuf_sched_traffic_class_get_w(const struct rte_mbuf *m); +uint8_t rte_mbuf_sched_color_get_w(const struct rte_mbuf *m); void rte_mbuf_sched_get_w(const struct rte_mbuf *m, uint32_t *queue_id, - uint8_t *traffic_class, uint8_t *color) { - rte_mbuf_sched_get(m, queue_id, traffic_class, color); -} -void rte_mbuf_sched_queue_set_w(struct rte_mbuf *m, uint32_t queue_id) { - rte_mbuf_sched_queue_set(m, queue_id); -} + uint8_t *traffic_class, uint8_t *color); +void rte_mbuf_sched_queue_set_w(struct rte_mbuf *m, uint32_t queue_id); void rte_mbuf_sched_traffic_class_set_w(struct rte_mbuf *m, - uint8_t traffic_class) { - rte_mbuf_sched_traffic_class_set(m, traffic_class); -} -void rte_mbuf_sched_color_set_w(struct rte_mbuf *m, uint8_t color) { - rte_mbuf_sched_color_set(m, color); -} + uint8_t traffic_class); +void rte_mbuf_sched_color_set_w(struct rte_mbuf *m, uint8_t color); void rte_mbuf_sched_set_w(struct rte_mbuf *m, uint32_t queue_id, - uint8_t traffic_class, uint8_t color) { - rte_mbuf_sched_set(m, queue_id, traffic_class, color); -} + uint8_t traffic_class, uint8_t color); int rte_is_same_ether_addr_w(const struct rte_ether_addr *ea1, - const struct rte_ether_addr *ea2) { - return rte_is_same_ether_addr(ea1, ea2); -} -int rte_is_zero_ether_addr_w(const struct rte_ether_addr *ea) { - return rte_is_zero_ether_addr(ea); -} -int rte_is_unicast_ether_addr_w(const struct rte_ether_addr *ea) { - return rte_is_unicast_ether_addr(ea); -} -int rte_is_multicast_ether_addr_w(const struct rte_ether_addr *ea) { - return rte_is_multicast_ether_addr(ea); -} -int rte_is_broadcast_ether_addr_w(const struct rte_ether_addr *ea) { - return rte_is_broadcast_ether_addr(ea); -} -int rte_is_universal_ether_addr_w(const struct rte_ether_addr *ea) { - return rte_is_universal_ether_addr(ea); -} -int rte_is_local_admin_ether_addr_w(const struct rte_ether_addr *ea) { - return rte_is_local_admin_ether_addr(ea); -} -int rte_is_valid_assigned_ether_addr_w(const struct rte_ether_addr *ea) { - return rte_is_valid_assigned_ether_addr(ea); -} + const struct rte_ether_addr *ea2); +int rte_is_zero_ether_addr_w(const struct rte_ether_addr *ea); +int rte_is_unicast_ether_addr_w(const struct rte_ether_addr *ea); +int rte_is_multicast_ether_addr_w(const struct rte_ether_addr *ea); +int rte_is_broadcast_ether_addr_w(const struct rte_ether_addr *ea); +int rte_is_universal_ether_addr_w(const struct rte_ether_addr *ea); +int rte_is_local_admin_ether_addr_w(const struct rte_ether_addr *ea); +int rte_is_valid_assigned_ether_addr_w(const struct rte_ether_addr *ea); void rte_ether_addr_copy_w(const struct rte_ether_addr *ea_from, - struct rte_ether_addr *ea_to) { - rte_ether_addr_copy(ea_from, ea_to); -} -int rte_vlan_strip_w(struct rte_mbuf *m) { return rte_vlan_strip(m); } -int rte_vlan_insert_w(struct rte_mbuf **m) { return rte_vlan_insert(m); } -uint32_t rte_bitmap_get_memory_footprint_w(uint32_t n_bits) { - return rte_bitmap_get_memory_footprint(n_bits); -} + struct rte_ether_addr *ea_to); +int rte_vlan_strip_w(struct rte_mbuf *m); +int rte_vlan_insert_w(struct rte_mbuf **m); +uint32_t rte_bitmap_get_memory_footprint_w(uint32_t n_bits); struct rte_bitmap *rte_bitmap_init_w(uint32_t n_bits, uint8_t *mem, - uint32_t mem_size) { - return rte_bitmap_init(n_bits, mem, mem_size); -} + uint32_t mem_size); struct rte_bitmap *rte_bitmap_init_with_all_set_w(uint32_t n_bits, uint8_t *mem, - uint32_t mem_size) { - return rte_bitmap_init_with_all_set(n_bits, mem, mem_size); -} -void rte_bitmap_free_w(struct rte_bitmap *bmp) { return rte_bitmap_free(bmp); } -void rte_bitmap_reset_w(struct rte_bitmap *bmp) { rte_bitmap_reset(bmp); } -void rte_bitmap_prefetch0_w(struct rte_bitmap *bmp, uint32_t pos) { - rte_bitmap_prefetch0(bmp, pos); -} -uint64_t rte_bitmap_get_w(struct rte_bitmap *bmp, uint32_t pos) { - return rte_bitmap_get(bmp, pos); -} -void rte_bitmap_set_w(struct rte_bitmap *bmp, uint32_t pos) { - rte_bitmap_set(bmp, pos); -} -void rte_bitmap_set_slab_w(struct rte_bitmap *bmp, uint32_t pos, - uint64_t slab) { - rte_bitmap_set_slab(bmp, pos, slab); -} -void rte_bitmap_clear_w(struct rte_bitmap *bmp, uint32_t pos) { - rte_bitmap_clear(bmp, pos); -} -int rte_bitmap_scan_w(struct rte_bitmap *bmp, uint32_t *pos, uint64_t *slab) { - return rte_bitmap_scan(bmp, pos, slab); -} -uint16_t rte_raw_cksum_w(const void *buf, size_t len) { - return rte_raw_cksum(buf, len); -} + uint32_t mem_size); +void rte_bitmap_free_w(struct rte_bitmap *bmp); +void rte_bitmap_reset_w(struct rte_bitmap *bmp); +void rte_bitmap_prefetch0_w(struct rte_bitmap *bmp, uint32_t pos); +uint64_t rte_bitmap_get_w(struct rte_bitmap *bmp, uint32_t pos); +void rte_bitmap_set_w(struct rte_bitmap *bmp, uint32_t pos); +void rte_bitmap_set_slab_w(struct rte_bitmap *bmp, uint32_t pos, uint64_t slab); +void rte_bitmap_clear_w(struct rte_bitmap *bmp, uint32_t pos); +int rte_bitmap_scan_w(struct rte_bitmap *bmp, uint32_t *pos, uint64_t *slab); +uint16_t rte_raw_cksum_w(const void *buf, size_t len); int rte_raw_cksum_mbuf_w(const struct rte_mbuf *m, uint32_t off, uint32_t len, - uint16_t *cksum) { - return rte_raw_cksum_mbuf(m, off, len, cksum); -} -uint8_t rte_ipv4_hdr_len_w(const struct rte_ipv4_hdr *ipv4_hdr) { - return rte_ipv4_hdr_len(ipv4_hdr); -} -uint16_t rte_ipv4_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr) { - return rte_ipv4_cksum(ipv4_hdr); -} -uint16_t rte_ipv4_cksum_simple_w(const struct rte_ipv4_hdr *ipv4_hdr) { - return rte_ipv4_cksum_simple(ipv4_hdr); -} + uint16_t *cksum); +uint8_t rte_ipv4_hdr_len_w(const struct rte_ipv4_hdr *ipv4_hdr); +uint16_t rte_ipv4_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr); +uint16_t rte_ipv4_cksum_simple_w(const struct rte_ipv4_hdr *ipv4_hdr); uint16_t rte_ipv4_phdr_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr, - uint64_t ol_flags) { - return rte_ipv4_phdr_cksum(ipv4_hdr, ol_flags); -} + uint64_t ol_flags); uint16_t rte_ipv4_udptcp_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr, - const void *l4_hdr) { - return rte_ipv4_udptcp_cksum(ipv4_hdr, l4_hdr); -} + const void *l4_hdr); uint16_t rte_ipv4_udptcp_cksum_mbuf_w(const struct rte_mbuf *m, const struct rte_ipv4_hdr *ipv4_hdr, - uint16_t l4_off) { - return rte_ipv4_udptcp_cksum_mbuf(m, ipv4_hdr, l4_off); -} + uint16_t l4_off); int rte_ipv4_udptcp_cksum_verify_w(const struct rte_ipv4_hdr *ipv4_hdr, - const void *l4_hdr) { - return rte_ipv4_udptcp_cksum_verify(ipv4_hdr, l4_hdr); -} + const void *l4_hdr); int rte_ipv4_udptcp_cksum_mbuf_verify_w(const struct rte_mbuf *m, const struct rte_ipv4_hdr *ipv4_hdr, - uint16_t l4_off) { - return rte_ipv4_udptcp_cksum_mbuf_verify(m, ipv4_hdr, l4_off); -} + uint16_t l4_off); bool rte_ipv6_addr_eq_w(const struct rte_ipv6_addr *a, - const struct rte_ipv6_addr *b) { - return rte_ipv6_addr_eq(a, b); -} -void rte_ipv6_addr_mask_w(struct rte_ipv6_addr *ip, uint8_t depth) { - rte_ipv6_addr_mask(ip, depth); -} + const struct rte_ipv6_addr *b); +void rte_ipv6_addr_mask_w(struct rte_ipv6_addr *ip, uint8_t depth); bool rte_ipv6_addr_eq_prefix_w(const struct rte_ipv6_addr *a, - const struct rte_ipv6_addr *b, uint8_t depth) { - return rte_ipv6_addr_eq_prefix(a, b, depth); -} -uint8_t rte_ipv6_mask_depth_w(const struct rte_ipv6_addr *mask) { - return rte_ipv6_mask_depth(mask); -} -bool rte_ipv6_addr_is_unspec_w(const struct rte_ipv6_addr *ip) { - return rte_ipv6_addr_is_unspec(ip); -} -bool rte_ipv6_addr_is_loopback_w(const struct rte_ipv6_addr *ip) { - return rte_ipv6_addr_is_loopback(ip); -} -bool rte_ipv6_addr_is_linklocal_w(const struct rte_ipv6_addr *ip) { - return rte_ipv6_addr_is_linklocal(ip); -} -bool rte_ipv6_addr_is_sitelocal_w(const struct rte_ipv6_addr *ip) { - return rte_ipv6_addr_is_sitelocal(ip); -} -bool rte_ipv6_addr_is_v4compat_w(const struct rte_ipv6_addr *ip) { - return rte_ipv6_addr_is_v4compat(ip); -} -bool rte_ipv6_addr_is_v4mapped_w(const struct rte_ipv6_addr *ip) { - return rte_ipv6_addr_is_v4mapped(ip); -} -bool rte_ipv6_addr_is_mcast_w(const struct rte_ipv6_addr *ip) { - return rte_ipv6_addr_is_mcast(ip); -} -enum rte_ipv6_mc_scope rte_ipv6_mc_scope_w(const struct rte_ipv6_addr *ip) { - return rte_ipv6_mc_scope(ip); -} + const struct rte_ipv6_addr *b, uint8_t depth); +uint8_t rte_ipv6_mask_depth_w(const struct rte_ipv6_addr *mask); +bool rte_ipv6_addr_is_unspec_w(const struct rte_ipv6_addr *ip); +bool rte_ipv6_addr_is_loopback_w(const struct rte_ipv6_addr *ip); +bool rte_ipv6_addr_is_linklocal_w(const struct rte_ipv6_addr *ip); +bool rte_ipv6_addr_is_sitelocal_w(const struct rte_ipv6_addr *ip); +bool rte_ipv6_addr_is_v4compat_w(const struct rte_ipv6_addr *ip); +bool rte_ipv6_addr_is_v4mapped_w(const struct rte_ipv6_addr *ip); +bool rte_ipv6_addr_is_mcast_w(const struct rte_ipv6_addr *ip); +enum rte_ipv6_mc_scope rte_ipv6_mc_scope_w(const struct rte_ipv6_addr *ip); void rte_ipv6_llocal_from_ethernet_w(struct rte_ipv6_addr *ip, - const struct rte_ether_addr *mac) { - rte_ipv6_llocal_from_ethernet(ip, mac); -} + const struct rte_ether_addr *mac); void rte_ipv6_solnode_from_addr_w(struct rte_ipv6_addr *sol, - const struct rte_ipv6_addr *ip) { - rte_ipv6_solnode_from_addr(sol, ip); -} + const struct rte_ipv6_addr *ip); void rte_ether_mcast_from_ipv6_w(struct rte_ether_addr *mac, - const struct rte_ipv6_addr *ip) { - rte_ether_mcast_from_ipv6(mac, ip); -} -int rte_ipv6_check_version_w(const struct rte_ipv6_hdr *ip) { - return rte_ipv6_check_version(ip); -} + const struct rte_ipv6_addr *ip); +int rte_ipv6_check_version_w(const struct rte_ipv6_hdr *ip); uint16_t rte_ipv6_phdr_cksum_w(const struct rte_ipv6_hdr *ipv6_hdr, - uint64_t ol_flags) { - return rte_ipv6_phdr_cksum(ipv6_hdr, ol_flags); -} + uint64_t ol_flags); uint16_t rte_ipv6_udptcp_cksum_w(const struct rte_ipv6_hdr *ipv6_hdr, - const void *l4_hdr) { - return rte_ipv6_udptcp_cksum(ipv6_hdr, l4_hdr); -} + const void *l4_hdr); uint16_t rte_ipv6_udptcp_cksum_mbuf_w(const struct rte_mbuf *m, const struct rte_ipv6_hdr *ipv6_hdr, - uint16_t l4_off) { - return rte_ipv6_udptcp_cksum_mbuf(m, ipv6_hdr, l4_off); -} + uint16_t l4_off); int rte_ipv6_udptcp_cksum_verify_w(const struct rte_ipv6_hdr *ipv6_hdr, - const void *l4_hdr) { - return rte_ipv6_udptcp_cksum_verify(ipv6_hdr, l4_hdr); -} + const void *l4_hdr); int rte_ipv6_udptcp_cksum_mbuf_verify_w(const struct rte_mbuf *m, const struct rte_ipv6_hdr *ipv6_hdr, - uint16_t l4_off) { - return rte_ipv6_udptcp_cksum_mbuf_verify(m, ipv6_hdr, l4_off); -} -int rte_ipv6_get_next_ext_w(const uint8_t *p, int proto, size_t *ext_len) { - return rte_ipv6_get_next_ext(p, proto, ext_len); -} + uint16_t l4_off); +int rte_ipv6_get_next_ext_w(const uint8_t *p, int proto, size_t *ext_len); enum rte_color rte_meter_srtcm_color_blind_check_w(struct rte_meter_srtcm *m, struct rte_meter_srtcm_profile *p, - uint64_t time, uint32_t pkt_len) { - return rte_meter_srtcm_color_blind_check(m, p, time, pkt_len); -} + uint64_t time, uint32_t pkt_len); enum rte_color rte_meter_srtcm_color_aware_check_w( struct rte_meter_srtcm *m, struct rte_meter_srtcm_profile *p, uint64_t time, - uint32_t pkt_len, enum rte_color pkt_color) { - return rte_meter_srtcm_color_aware_check(m, p, time, pkt_len, pkt_color); -} + uint32_t pkt_len, enum rte_color pkt_color); enum rte_color rte_meter_trtcm_color_blind_check_w(struct rte_meter_trtcm *m, struct rte_meter_trtcm_profile *p, - uint64_t time, uint32_t pkt_len) { - return rte_meter_trtcm_color_blind_check(m, p, time, pkt_len); -} + uint64_t time, uint32_t pkt_len); enum rte_color rte_meter_trtcm_color_aware_check_w( struct rte_meter_trtcm *m, struct rte_meter_trtcm_profile *p, uint64_t time, - uint32_t pkt_len, enum rte_color pkt_color) { - return rte_meter_trtcm_color_aware_check(m, p, time, pkt_len, pkt_color); -} + uint32_t pkt_len, enum rte_color pkt_color); enum rte_color rte_meter_trtcm_rfc4115_color_blind_check_w( struct rte_meter_trtcm_rfc4115 *m, - struct rte_meter_trtcm_rfc4115_profile *p, uint64_t time, - uint32_t pkt_len) { - return rte_meter_trtcm_rfc4115_color_blind_check(m, p, time, pkt_len); -} + struct rte_meter_trtcm_rfc4115_profile *p, uint64_t time, uint32_t pkt_len); enum rte_color rte_meter_trtcm_rfc4115_color_aware_check_w( struct rte_meter_trtcm_rfc4115 *m, struct rte_meter_trtcm_rfc4115_profile *p, uint64_t time, uint32_t pkt_len, - enum rte_color pkt_color) { - return rte_meter_trtcm_rfc4115_color_aware_check(m, p, time, pkt_len, - pkt_color); -} -uint64_t rte_eth_rss_hf_refine_w(uint64_t rss_hf) { - return rte_eth_rss_hf_refine(rss_hf); -} - + enum rte_color pkt_color); +uint64_t rte_eth_rss_hf_refine_w(uint64_t rss_hf); uint16_t rte_eth_rx_burst_w(uint16_t port_id, uint16_t queue_id, - struct rte_mbuf **rx_pkts, const uint16_t nb_pkts) { - return rte_eth_rx_burst(port_id, queue_id, rx_pkts, nb_pkts); -} -int rte_eth_rx_queue_count_w(uint16_t port_id, uint16_t queue_id) { - return rte_eth_rx_queue_count(port_id, queue_id); -} + struct rte_mbuf **rx_pkts, const uint16_t nb_pkts); +int rte_eth_rx_queue_count_w(uint16_t port_id, uint16_t queue_id); int rte_eth_rx_descriptor_status_w(uint16_t port_id, uint16_t queue_id, - uint16_t offset) { - return rte_eth_rx_descriptor_status(port_id, queue_id, offset); -} + uint16_t offset); int rte_eth_tx_descriptor_status_w(uint16_t port_id, uint16_t queue_id, - uint16_t offset) { - return rte_eth_tx_descriptor_status(port_id, queue_id, offset); -} + uint16_t offset); uint16_t rte_eth_tx_burst_w(uint16_t port_id, uint16_t queue_id, - struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { - return rte_eth_tx_burst(port_id, queue_id, tx_pkts, nb_pkts); -} + struct rte_mbuf **tx_pkts, uint16_t nb_pkts); uint16_t rte_eth_tx_prepare_w(uint16_t port_id, uint16_t queue_id, - struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { - return rte_eth_tx_prepare(port_id, queue_id, tx_pkts, nb_pkts); -} + struct rte_mbuf **tx_pkts, uint16_t nb_pkts); uint16_t rte_eth_tx_buffer_flush_w(uint16_t port_id, uint16_t queue_id, - struct rte_eth_dev_tx_buffer *buffer) { - return rte_eth_tx_buffer_flush(port_id, queue_id, buffer); -} + struct rte_eth_dev_tx_buffer *buffer); uint16_t rte_eth_tx_buffer_w(uint16_t port_id, uint16_t queue_id, struct rte_eth_dev_tx_buffer *buffer, - struct rte_mbuf *tx_pkt) { - return rte_eth_tx_buffer(port_id, queue_id, buffer, tx_pkt); -} + struct rte_mbuf *tx_pkt); uint16_t rte_eth_recycle_mbufs_w(uint16_t rx_port_id, uint16_t rx_queue_id, uint16_t tx_port_id, uint16_t tx_queue_id, - struct rte_eth_recycle_rxq_info *recycle_rxq_info) { - return rte_eth_recycle_mbufs(rx_port_id, rx_queue_id, tx_port_id, tx_queue_id, - recycle_rxq_info); -} -int rte_eth_tx_queue_count_w(uint16_t port_id, uint16_t queue_id) { - return rte_eth_tx_queue_count(port_id, queue_id); -} -uint32_t rte_flow_dynf_metadata_get_w(struct rte_mbuf *m) { - return rte_flow_dynf_metadata_get(m); -} -void rte_flow_dynf_metadata_set_w(struct rte_mbuf *m, uint32_t v) { - rte_flow_dynf_metadata_set(m, v); -} -int rte_flow_dynf_metadata_avail_w(void) { - return rte_flow_dynf_metadata_avail(); -} -uint32_t rte_hash_crc_1byte_w(uint8_t data, uint32_t init_val) { - return rte_hash_crc_1byte(data, init_val); -} -uint32_t rte_hash_crc_2byte_w(uint16_t data, uint32_t init_val) { - return rte_hash_crc_2byte(data, init_val); -} -uint32_t rte_hash_crc_4byte_w(uint32_t data, uint32_t init_val) { - return rte_hash_crc_4byte(data, init_val); -} -uint32_t rte_hash_crc_8byte_w(uint64_t data, uint32_t init_val) { - return rte_hash_crc_8byte(data, init_val); -} -uint32_t rte_hash_crc_w(const void *data, uint32_t data_len, - uint32_t init_val) { - return rte_hash_crc(data, data_len, init_val); -} + struct rte_eth_recycle_rxq_info *recycle_rxq_info); +int rte_eth_tx_queue_count_w(uint16_t port_id, uint16_t queue_id); +uint32_t rte_flow_dynf_metadata_get_w(struct rte_mbuf *m); +void rte_flow_dynf_metadata_set_w(struct rte_mbuf *m, uint32_t v); +int rte_flow_dynf_metadata_avail_w(void); +uint32_t rte_hash_crc_1byte_w(uint8_t data, uint32_t init_val); +uint32_t rte_hash_crc_2byte_w(uint16_t data, uint32_t init_val); +uint32_t rte_hash_crc_4byte_w(uint32_t data, uint32_t init_val); +uint32_t rte_hash_crc_8byte_w(uint64_t data, uint32_t init_val); +uint32_t rte_hash_crc_w(const void *data, uint32_t data_len, uint32_t init_val); void rte_jhash_2hashes_w(const void *key, uint32_t length, uint32_t *pc, - uint32_t *pb) { - rte_jhash_2hashes(key, length, pc, pb); -} + uint32_t *pb); void rte_jhash_32b_2hashes_w(const uint32_t *k, uint32_t length, uint32_t *pc, - uint32_t *pb) { - rte_jhash_32b_2hashes(k, length, pc, pb); -} -uint32_t rte_jhash_w(const void *key, uint32_t length, uint32_t initval) { - return rte_jhash(key, length, initval); -} -uint32_t rte_jhash_32b_w(const uint32_t *k, uint32_t length, uint32_t initval) { - return rte_jhash_32b(k, length, initval); -} + uint32_t *pb); +uint32_t rte_jhash_w(const void *key, uint32_t length, uint32_t initval); +uint32_t rte_jhash_32b_w(const uint32_t *k, uint32_t length, uint32_t initval); uint32_t rte_jhash_3words_w(uint32_t a, uint32_t b, uint32_t c, - uint32_t initval) { - return rte_jhash_3words(a, b, c, initval); -} -uint32_t rte_jhash_2words_w(uint32_t a, uint32_t b, uint32_t initval) { - return rte_jhash_2words(a, b, initval); -} -uint32_t rte_jhash_1word_w(uint32_t a, uint32_t initval) { - return rte_jhash_1word(a, initval); -} + uint32_t initval); +uint32_t rte_jhash_2words_w(uint32_t a, uint32_t b, uint32_t initval); +uint32_t rte_jhash_1word_w(uint32_t a, uint32_t initval); uint32_t rte_fbk_hash_get_bucket_w(const struct rte_fbk_hash_table *ht, - uint32_t key) { - return rte_fbk_hash_get_bucket(ht, key); -} + uint32_t key); int rte_fbk_hash_add_key_with_bucket_w(struct rte_fbk_hash_table *ht, uint32_t key, uint16_t value, - uint32_t bucket) { - return rte_fbk_hash_add_key_with_bucket(ht, key, value, bucket); -} + uint32_t bucket); int rte_fbk_hash_add_key_w(struct rte_fbk_hash_table *ht, uint32_t key, - uint16_t value) { - return rte_fbk_hash_add_key(ht, key, value); -} + uint16_t value); int rte_fbk_hash_delete_key_with_bucket_w(struct rte_fbk_hash_table *ht, - uint32_t key, uint32_t bucket) { - return rte_fbk_hash_delete_key_with_bucket(ht, key, bucket); -} -int rte_fbk_hash_delete_key_w(struct rte_fbk_hash_table *ht, uint32_t key) { - return rte_fbk_hash_delete_key(ht, key); -} + uint32_t key, uint32_t bucket); +int rte_fbk_hash_delete_key_w(struct rte_fbk_hash_table *ht, uint32_t key); int rte_fbk_hash_lookup_with_bucket_w(const struct rte_fbk_hash_table *ht, - uint32_t key, uint32_t bucket) { - return rte_fbk_hash_lookup_with_bucket(ht, key, bucket); -} -int rte_fbk_hash_lookup_w(const struct rte_fbk_hash_table *ht, uint32_t key) { - return rte_fbk_hash_lookup(ht, key); -} -void rte_fbk_hash_clear_all_w(struct rte_fbk_hash_table *ht) { - rte_fbk_hash_clear_all(ht); -} -double rte_fbk_hash_get_load_factor_w(struct rte_fbk_hash_table *ht) { - return rte_fbk_hash_get_load_factor(ht); -} + uint32_t key, uint32_t bucket); +int rte_fbk_hash_lookup_w(const struct rte_fbk_hash_table *ht, uint32_t key); +void rte_fbk_hash_clear_all_w(struct rte_fbk_hash_table *ht); +double rte_fbk_hash_get_load_factor_w(struct rte_fbk_hash_table *ht); void rte_rcu_qsbr_thread_online_w(struct rte_rcu_qsbr *v, - unsigned int thread_id) { - rte_rcu_qsbr_thread_online(v, thread_id); -} + unsigned int thread_id); void rte_rcu_qsbr_thread_offline_w(struct rte_rcu_qsbr *v, - unsigned int thread_id) { - rte_rcu_qsbr_thread_offline(v, thread_id); -} -void rte_rcu_qsbr_lock_w(struct rte_rcu_qsbr *v, unsigned int thread_id) { - rte_rcu_qsbr_lock(v, thread_id); -} -void rte_rcu_qsbr_unlock_w(struct rte_rcu_qsbr *v, unsigned int thread_id) { - rte_rcu_qsbr_unlock(v, thread_id); -} -uint64_t rte_rcu_qsbr_start_w(struct rte_rcu_qsbr *v) { - return rte_rcu_qsbr_start(v); -} -void rte_rcu_qsbr_quiescent_w(struct rte_rcu_qsbr *v, unsigned int thread_id) { - rte_rcu_qsbr_quiescent(v, thread_id); -} -int rte_rcu_qsbr_check_w(struct rte_rcu_qsbr *v, uint64_t t, bool wait) { - return rte_rcu_qsbr_check(v, t, wait); -} -uint8_t rte_read8_relaxed_w(const void *addr) { - return rte_read8_relaxed(addr); -} -uint16_t rte_read16_relaxed_w(const void *addr) { - return rte_read16_relaxed(addr); -} -uint32_t rte_read32_relaxed_w(const void *addr) { - return rte_read32_relaxed(addr); -} -uint64_t rte_read64_relaxed_w(const void *addr) { - return rte_read64_relaxed(addr); -} -void rte_write8_relaxed_w(uint8_t value, void *addr) { - rte_write8_relaxed(value, addr); -} -void rte_write16_relaxed_w(uint16_t value, void *addr) { - rte_write16_relaxed(value, addr); -} -void rte_write32_relaxed_w(uint32_t value, void *addr) { - rte_write32_relaxed(value, addr); -} -void rte_write64_relaxed_w(uint64_t value, void *addr) { - rte_write64_relaxed(value, addr); -} -uint8_t rte_read8_w(const void *addr) { return rte_read8(addr); } -uint16_t rte_read16_w(const void *addr) { return rte_read16(addr); } -uint32_t rte_read32_w(const void *addr) { return rte_read32(addr); } -uint64_t rte_read64_w(const void *addr) { return rte_read64(addr); } -void rte_write8_w(uint8_t value, void *addr) { rte_write8(value, addr); } -void rte_write16_w(uint16_t value, void *addr) { rte_write16(value, addr); } -void rte_write32_w(uint32_t value, void *addr) { rte_write32(value, addr); } -void rte_write64_w(uint64_t value, void *addr) { rte_write64(value, addr); } -void rte_write32_wc_relaxed_w(uint32_t value, void *addr) { - rte_write32_wc_relaxed(value, addr); -} -void rte_write32_wc_w(uint32_t value, void *addr) { - rte_write32_wc(value, addr); -} -void rte_mcslock_lock_w(rte_mcslock_t **msl, rte_mcslock_t *me) { - rte_mcslock_lock(msl, me); -} -void rte_mcslock_unlock_w(rte_mcslock_t **msl, rte_mcslock_t *me) { - rte_mcslock_unlock(msl, me); -} -int rte_mcslock_trylock_w(rte_mcslock_t **msl, rte_mcslock_t *me) { - return rte_mcslock_trylock(msl, me); -} -int rte_mcslock_is_locked_w(rte_mcslock_t *msl) { - return rte_mcslock_is_locked(msl); -} -void rte_pflock_init_w(struct rte_pflock *pf) { rte_pflock_init(pf); } -void rte_pflock_read_lock_w(rte_pflock_t *pf) { rte_pflock_read_lock(pf); } -void rte_pflock_read_unlock_w(rte_pflock_t *pf) { rte_pflock_read_unlock(pf); } -void rte_pflock_write_lock_w(rte_pflock_t *pf) { rte_pflock_write_lock(pf); } -void rte_pflock_write_unlock_w(rte_pflock_t *pf) { - rte_pflock_write_unlock(pf); -} -uint32_t rte_reciprocal_divide_w(uint32_t a, struct rte_reciprocal R) { - return rte_reciprocal_divide(a, R); -} + unsigned int thread_id); +void rte_rcu_qsbr_lock_w(struct rte_rcu_qsbr *v, unsigned int thread_id); +void rte_rcu_qsbr_unlock_w(struct rte_rcu_qsbr *v, unsigned int thread_id); +uint64_t rte_rcu_qsbr_start_w(struct rte_rcu_qsbr *v); +void rte_rcu_qsbr_quiescent_w(struct rte_rcu_qsbr *v, unsigned int thread_id); +int rte_rcu_qsbr_check_w(struct rte_rcu_qsbr *v, uint64_t t, bool wait); +uint8_t rte_read8_relaxed_w(const void *addr); +uint16_t rte_read16_relaxed_w(const void *addr); +uint32_t rte_read32_relaxed_w(const void *addr); +uint64_t rte_read64_relaxed_w(const void *addr); +void rte_write8_relaxed_w(uint8_t value, void *addr); +void rte_write16_relaxed_w(uint16_t value, void *addr); +void rte_write32_relaxed_w(uint32_t value, void *addr); +void rte_write64_relaxed_w(uint64_t value, void *addr); +uint8_t rte_read8_w(const void *addr); +uint16_t rte_read16_w(const void *addr); +uint32_t rte_read32_w(const void *addr); +uint64_t rte_read64_w(const void *addr); +void rte_write8_w(uint8_t value, void *addr); +void rte_write16_w(uint16_t value, void *addr); +void rte_write32_w(uint32_t value, void *addr); +void rte_write64_w(uint64_t value, void *addr); +void rte_write32_wc_relaxed_w(uint32_t value, void *addr); +void rte_write32_wc_w(uint32_t value, void *addr); +void rte_mcslock_lock_w(rte_mcslock_t **msl, rte_mcslock_t *me); +void rte_mcslock_unlock_w(rte_mcslock_t **msl, rte_mcslock_t *me); +int rte_mcslock_trylock_w(rte_mcslock_t **msl, rte_mcslock_t *me); +int rte_mcslock_is_locked_w(rte_mcslock_t *msl); +void rte_pflock_init_w(struct rte_pflock *pf); +void rte_pflock_read_lock_w(rte_pflock_t *pf); +void rte_pflock_read_unlock_w(rte_pflock_t *pf); +void rte_pflock_write_lock_w(rte_pflock_t *pf); +void rte_pflock_write_unlock_w(rte_pflock_t *pf); +uint32_t rte_reciprocal_divide_w(uint32_t a, struct rte_reciprocal R); uint64_t rte_reciprocal_divide_u64_w(uint64_t a, - const struct rte_reciprocal_u64 *R) { - return rte_reciprocal_divide_u64(a, R); -} -void rte_seqcount_init_w(rte_seqcount_t *seqcount) { - rte_seqcount_init(seqcount); -} -uint32_t rte_seqcount_read_begin_w(const rte_seqcount_t *seqcount) { - return rte_seqcount_read_begin(seqcount); -} + const struct rte_reciprocal_u64 *R); +void rte_seqcount_init_w(rte_seqcount_t *seqcount); +uint32_t rte_seqcount_read_begin_w(const rte_seqcount_t *seqcount); bool rte_seqcount_read_retry_w(const rte_seqcount_t *seqcount, - uint32_t begin_sn) { - return rte_seqcount_read_retry(seqcount, begin_sn); -} -void rte_seqcount_write_begin_w(rte_seqcount_t *seqcount) { - rte_seqcount_write_begin(seqcount); -} -void rte_seqcount_write_end_w(rte_seqcount_t *seqcount) { - rte_seqcount_write_end(seqcount); -} -void rte_seqlock_init_w(rte_seqlock_t *seqlock) { rte_seqlock_init(seqlock); } -uint32_t rte_seqlock_read_begin_w(const rte_seqlock_t *seqlock) { - return rte_seqlock_read_begin(seqlock); -} -bool rte_seqlock_read_retry_w(const rte_seqlock_t *seqlock, uint32_t begin_sn) { - return rte_seqlock_read_retry(seqlock, begin_sn); -} -void rte_seqlock_write_lock_w(rte_seqlock_t *seqlock) { - rte_seqlock_write_lock(seqlock); -} -void rte_seqlock_write_unlock_w(rte_seqlock_t *seqlock) { - rte_seqlock_write_unlock(seqlock); -} + uint32_t begin_sn); +void rte_seqcount_write_begin_w(rte_seqcount_t *seqcount); +void rte_seqcount_write_end_w(rte_seqcount_t *seqcount); +void rte_seqlock_init_w(rte_seqlock_t *seqlock); +uint32_t rte_seqlock_read_begin_w(const rte_seqlock_t *seqlock); +bool rte_seqlock_read_retry_w(const rte_seqlock_t *seqlock, uint32_t begin_sn); +void rte_seqlock_write_lock_w(rte_seqlock_t *seqlock); +void rte_seqlock_write_unlock_w(rte_seqlock_t *seqlock); unsigned int rte_stack_push_w(struct rte_stack *s, void *const *obj_table, - unsigned int n) { - return rte_stack_push(s, obj_table, n); -} + unsigned int n); unsigned int rte_stack_pop_w(struct rte_stack *s, void **obj_table, - unsigned int n) { - return rte_stack_pop(s, obj_table, n); -} -unsigned int rte_stack_count_w(struct rte_stack *s) { - return rte_stack_count(s); -} -unsigned int rte_stack_free_count_w(struct rte_stack *s) { - return rte_stack_free_count(s); -} + unsigned int n); +unsigned int rte_stack_count_w(struct rte_stack *s); +unsigned int rte_stack_free_count_w(struct rte_stack *s); uint32_t rte_softrss_w(uint32_t *input_tuple, uint32_t input_len, - const uint8_t *rss_key) { - return rte_softrss(input_tuple, input_len, rss_key); -} + const uint8_t *rss_key); uint32_t rte_softrss_be_w(uint32_t *input_tuple, uint32_t input_len, - const uint8_t *rss_key) { - return rte_softrss_be(input_tuple, input_len, rss_key); -} -void rte_ticketlock_init_w(rte_ticketlock_t *tl) { rte_ticketlock_init(tl); } -void rte_ticketlock_lock_w(rte_ticketlock_t *tl) { rte_ticketlock_lock(tl); } -void rte_ticketlock_unlock_w(rte_ticketlock_t *tl) { - rte_ticketlock_unlock(tl); -} -int rte_ticketlock_trylock_w(rte_ticketlock_t *tl) { - return rte_ticketlock_trylock(tl); -} -int rte_ticketlock_is_locked_w(rte_ticketlock_t *tl) { - return rte_ticketlock_is_locked(tl); -} -void rte_ticketlock_recursive_init_w(rte_ticketlock_recursive_t *tlr) { - rte_ticketlock_recursive_init(tlr); -} -void rte_ticketlock_recursive_lock_w(rte_ticketlock_recursive_t *tlr) { - rte_ticketlock_recursive_lock(tlr); -} -void rte_ticketlock_recursive_unlock_w(rte_ticketlock_recursive_t *tlr) { - rte_ticketlock_recursive_unlock(tlr); -} -int rte_ticketlock_recursive_trylock_w(rte_ticketlock_recursive_t *tlr) { - return rte_ticketlock_recursive_trylock(tlr); -} + const uint8_t *rss_key); +void rte_ticketlock_init_w(rte_ticketlock_t *tl); +void rte_ticketlock_lock_w(rte_ticketlock_t *tl); +void rte_ticketlock_unlock_w(rte_ticketlock_t *tl); +int rte_ticketlock_trylock_w(rte_ticketlock_t *tl); +int rte_ticketlock_is_locked_w(rte_ticketlock_t *tl); +void rte_ticketlock_recursive_init_w(rte_ticketlock_recursive_t *tlr); +void rte_ticketlock_recursive_lock_w(rte_ticketlock_recursive_t *tlr); +void rte_ticketlock_recursive_unlock_w(rte_ticketlock_recursive_t *tlr); +int rte_ticketlock_recursive_trylock_w(rte_ticketlock_recursive_t *tlr); uint64_t rte_cyclecounter_cycles_to_ns_w(struct rte_timecounter *tc, - uint64_t cycles) { - return rte_cyclecounter_cycles_to_ns(tc, cycles); -} + uint64_t cycles); uint64_t rte_timecounter_update_w(struct rte_timecounter *tc, - uint64_t cycle_now) { - return rte_timecounter_update(tc, cycle_now); -} -uint64_t rte_timespec_to_ns_w(const struct timespec *ts) { - return rte_timespec_to_ns(ts); -} -struct timespec rte_ns_to_timespec_w(uint64_t nsec) { - return rte_ns_to_timespec(nsec); -} -bool rte_trace_feature_is_enabled_w(void) { - return rte_trace_feature_is_enabled(); -} + uint64_t cycle_now); +uint64_t rte_timespec_to_ns_w(const struct timespec *ts); +struct timespec rte_ns_to_timespec_w(uint64_t nsec); +bool rte_trace_feature_is_enabled_w(void); diff --git a/nix/platform.nix b/nix/platform.nix deleted file mode 100644 index 94b1122c0..000000000 --- a/nix/platform.nix +++ /dev/null @@ -1,83 +0,0 @@ -{ - lib ? (import { }).lib, -}: -rec { - x86-64-v3 = rec { - arch = "x86_64"; - march = "x86-64-v3"; - numa = { - max-nodes = 8; - }; - override = { - stdenv'.env = rec { - NIX_CFLAGS_COMPILE = [ "-march=${march}" ]; - NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; - NIX_CFLAGS_LINK = [ ]; - }; - dpdk = { - buildInputs = { - rdma-core = true; - libbsd = true; - libnl = true; - numactl = true; - }; - }; - }; - }; - x86-64-v4 = lib.recursiveUpdate x86-64-v3 rec { - march = "x86-64-v4"; - override.stdenv'.env = rec { - NIX_CFLAGS_COMPILE = [ "-march=${march}" ]; - NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; - NIX_CFLAGS_LINK = [ ]; - }; - }; - zen4 = lib.recursiveUpdate x86-64-v4 rec { - march = "zen4"; - override.stdenv'.env = rec { - NIX_CFLAGS_COMPILE = [ "-march=${march}" ]; - NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; - NIX_CFLAGS_LINK = [ ]; - }; - }; - zen5 = lib.recursiveUpdate zen4 rec { - march = "zen5"; - override.stdenv'.env = rec { - NIX_CFLAGS_COMPILE = [ "-march=${march}" ]; - NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; - NIX_CFLAGS_LINK = [ ]; - }; - }; - bluefield2 = rec { - arch = "aarch64"; - march = "armv8.2-a"; - mcpu = "cortex-a72"; - numa = { - max-nodes = 1; - }; - override = { - stdenv'.env = rec { - NIX_CFLAGS_COMPILE = [ "-mcpu=${mcpu}" ]; - NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; - NIX_CFLAGS_LINK = [ ]; - }; - dpdk = { - buildInputs = { - rdma-core = true; - libbsd = true; - libnl = true; - numactl = false; - }; - }; - }; - }; - bluefield3 = lib.recursiveUpdate bluefield2 rec { - march = "armv8.4-a"; - mcpu = "cortex-a78ae"; - override.stdenv'.env = rec { - NIX_CFLAGS_COMPILE = [ "-mcpu=${mcpu}" ]; - NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; - NIX_CFLAGS_LINK = [ ]; - }; - }; -} diff --git a/npins/sources.json b/npins/sources.json index bc55da807..75329024f 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -16,8 +16,8 @@ "nixpkgs": { "type": "Channel", "name": "nixpkgs-unstable", - "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.05pre911335.23735a82a828/nixexprs.tar.xz", - "hash": "03cv7yy3ldb3i50in6qkm98y68nlid874l52wayzgx0z7pbpq1rk" + "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.05pre913981.7d853e518814/nixexprs.tar.xz", + "hash": "1cpg513zly625rw05kbz1hvfiqcrwbd71c1bqhp61sh6ng8ifg4c" }, "rdma-core": { "type": "Git", From e4d166a0072b80b4ae7622223ff3bff8e5d2ea4e Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 21 Dec 2025 20:15:24 +0000 Subject: [PATCH 065/163] pkgsBuildHost --- nix/overlays/dataplane.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index 44aef8cfb..41e09208b 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -15,8 +15,8 @@ let with builtins; (mapAttrs (var: val: (toString (orig.${var} or "")) + " " + (toString val)) add) ); adapt = final.stdenvAdapters; - bintools = final.buildPackages.llvmPackages.bintools; - lld = final.buildPackages.llvmPackages.lld; + bintools = final.pkgsBuildHost.llvmPackages.bintools; + lld = final.pkgsBuildHost.llvmPackages.lld; added-to-env = helpers.addToEnv target.platform.override.stdenv.env profile; stdenv' = adapt.addAttrsToDerivation (orig: { doCheck = false; From 965cb3ca1e7fb8ce14463623bccb25c41c3a33c5 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 21 Dec 2025 20:15:38 +0000 Subject: [PATCH 066/163] wip --- default.nix | 96 +++++++++++++++++++++++------------------------------ 1 file changed, 42 insertions(+), 54 deletions(-) diff --git a/default.nix b/default.nix index 04d3d9edc..f6fc3835f 100644 --- a/default.nix +++ b/default.nix @@ -37,70 +37,58 @@ let overlays.${overlay} ]; }).pkgsCross.${target.info.nixarch}; - - sysroot-list = with pkgs; [ - stdenv'.cc.libc.dev - stdenv'.cc.libc.out - libmd.dev - libmd.static - libbsd.dev - libbsd.static - libnl.dev - libnl.static - numactl.dev - numactl.static - rdma-core.dev - rdma-core.static - dpdk.dev - dpdk.static - dpdk-wrapper.dev - dpdk-wrapper.out - ]; - build-tools-list = - with pkgs.buildPackages; - [ + sysroot = pkgs.symlinkJoin { + name = "sysroot"; + paths = with pkgs; [ + stdenv'.cc.libc.dev + stdenv'.cc.libc.out + libmd.dev + libmd.static + libbsd.dev + libbsd.static + libnl.dev + libnl.static + numactl.dev + numactl.static + rdma-core.dev + rdma-core.static + dpdk.dev + dpdk.static + dpdk-wrapper.dev + dpdk-wrapper.out + ]; + }; + clangd-config = pkgs.writeTextFile { + name = ".clangd"; + text = '' + CompileFlags: + Add: + - "-I${sysroot}/include" + - "-I${pkgs.dpdk.dev}/include" + - "-Wno-deprecated-declarations" + ''; + executable = false; + destination = "/.clangd"; + }; + dev-tools = pkgs.symlinkJoin { + name = "dataplane-dev-shell"; + paths = with pkgs.buildPackages; [ + clangd-config llvmPackages.bintools llvmPackages.clang llvmPackages.libclang.lib llvmPackages.lld - ] - ++ [ npins ]; + }; in -pkgs.lib.fix (final: { +{ inherit pkgs sources profile target + sysroot + dev-tools ; - sysroot = - with final.pkgs; - symlinkJoin { - name = "sysroot"; - paths = sysroot-list; - }; - clangd = pkgs.writeTextFile { - name = ".clangd"; - text = '' - CompileFlags: - Add: - - "-I${final.sysroot}/include" - - "-I${final.pkgs.dpdk.dev}/include" - - "-Wno-deprecated-declarations" - ''; - executable = false; - destination = "/.clangd"; - }; - build-tools = - with final.pkgs.buildPackages; - symlinkJoin { - name = "build-tools"; - paths = build-tools-list ++ [ final.clangd ]; - }; - dev-shell = final.pkgs.symlinkJoin { - name = "dataplane-dev-shell"; - paths = sysroot-list ++ build-tools-list; - }; -}) +} From c2d91c1fb00ee9ecd655dd37172b66bb5d6457c4 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 21 Dec 2025 20:46:48 +0000 Subject: [PATCH 067/163] pkgsBuildHost --- default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default.nix b/default.nix index f6fc3835f..f4c0a6631 100644 --- a/default.nix +++ b/default.nix @@ -72,7 +72,7 @@ let }; dev-tools = pkgs.symlinkJoin { name = "dataplane-dev-shell"; - paths = with pkgs.buildPackages; [ + paths = with pkgs.pkgsBuildHost; [ clangd-config llvmPackages.bintools llvmPackages.clang From c5264c7cdc886aeffd502b395a428e96dfd25986 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 21 Dec 2025 23:33:05 +0000 Subject: [PATCH 068/163] wip (moderate rework) --- default.nix | 14 ++--- nix/.rust-toolchain.manifest-lock.json | 10 ++++ nix/overlays/dataplane.nix | 19 +++++-- nix/overlays/default.nix | 4 +- nix/{target.nix => platforms.nix} | 73 ++++++++++++++------------ nix/rust-toolchain.manifest-lock.nix | 18 +++++++ npins/sources.json | 5 ++ rust-toolchain.toml | 27 ++++++++++ 8 files changed, 121 insertions(+), 49 deletions(-) create mode 100644 nix/.rust-toolchain.manifest-lock.json rename nix/{target.nix => platforms.nix} (70%) create mode 100644 nix/rust-toolchain.manifest-lock.nix create mode 100644 rust-toolchain.toml diff --git a/default.nix b/default.nix index f4c0a6631..e9e245bdc 100644 --- a/default.nix +++ b/default.nix @@ -16,27 +16,27 @@ let if str == "" then [ ] else builtins.filter (elm: builtins.isString elm) (builtins.split split str); sanitizers = split-str ",+" sanitize; sources = import ./npins; - target = import ./nix/target.nix { + platform' = import ./nix/platforms.nix { inherit lib platform libc; }; profile = import ./nix/profiles.nix { inherit prof sanitizers instrumentation; - arch = target.platform.arch; + arch = platform'.arch; }; overlays = import ./nix/overlays { inherit sources sanitizers - target profile ; + platform = platform'; }; pkgs = (import sources.nixpkgs { overlays = [ overlays.${overlay} ]; - }).pkgsCross.${target.info.nixarch}; + }).pkgsCross.${platform'.info.nixarch}; sysroot = pkgs.symlinkJoin { name = "sysroot"; paths = with pkgs; [ @@ -84,11 +84,11 @@ let in { inherit + dev-tools pkgs - sources profile - target + sources sysroot - dev-tools ; + platform = platform'; } diff --git a/nix/.rust-toolchain.manifest-lock.json b/nix/.rust-toolchain.manifest-lock.json new file mode 100644 index 000000000..18160d91b --- /dev/null +++ b/nix/.rust-toolchain.manifest-lock.json @@ -0,0 +1,10 @@ +{ + "channel": "1.92.0", + "hash": { + "md5": "5925de5268fdcb9c70be7fa06de5583d", + "sha1": "aace35bc46aa55685f1e19c34d644f3d49b057c6", + "sha256": "b2a49624353173ecdacf59c158c00929300606e1963f6e4609fb483a508402d0", + "sha512": "0a8fc59360a5e6f3236d9a35ce2c8e0ba184e8be9b5a918f9bc7aae3e5cc1f8133eaa01fd044fdc6ba645805a98aa645e343fbb7b15a850ea0e83ff20d42ebaa" + }, + "url": "https://static.rust-lang.org/dist/channel-rust-1.92.0.toml" +} diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index 41e09208b..b5644da3e 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -3,7 +3,7 @@ { sources, sanitizers, - target, + platform, profile, }: final: prev: @@ -17,7 +17,7 @@ let adapt = final.stdenvAdapters; bintools = final.pkgsBuildHost.llvmPackages.bintools; lld = final.pkgsBuildHost.llvmPackages.lld; - added-to-env = helpers.addToEnv target.platform.override.stdenv.env profile; + added-to-env = helpers.addToEnv platform.override.stdenv.env profile; stdenv' = adapt.addAttrsToDerivation (orig: { doCheck = false; separateDebugInfo = true; @@ -28,6 +28,11 @@ let ]; }) final.llvmPackages.stdenv; dataplane-dep = pkg: pkg.override { stdenv = stdenv'; }; + fenix = import sources.fenix { }; + rust-toolchain = fenix.fromToolchainFile { + file = ../../rust-toolchain.toml; + sha256 = (builtins.fromJSON (builtins.readFile ../.rust-toolchain.manifest-lock.json)).hash.sha256; + }; in { inherit stdenv' added-to-env; @@ -219,9 +224,7 @@ in # Also, while this library has a respectable security track record, this is also a super strong candidate for # cfi, safe-stack, and cf-protection. dpdk = dataplane-dep ( - final.callPackage ../pkgs/dpdk ( - target.platform.override.dpdk.buildInputs // { src = sources.dpdk; } - ) + final.callPackage ../pkgs/dpdk (platform.override.dpdk.buildInputs // { src = sources.dpdk; }) ); # DPDK is largely composed of static-inline functions. @@ -230,4 +233,10 @@ in # This wrapping process does not really cause any performance issue due to lto; the compiler is going to "unwrap" # these methods anyway. dpdk-wrapper = dataplane-dep (final.callPackage ../pkgs/dpdk-wrapper { }); + + # TODO: doc this + rustPlatform = final.makeRustPlatform { + cargo = rust-toolchain; + rustc = rust-toolchain; + }; } diff --git a/nix/overlays/default.nix b/nix/overlays/default.nix index ecb927248..02212edb8 100644 --- a/nix/overlays/default.nix +++ b/nix/overlays/default.nix @@ -3,7 +3,7 @@ { sources, sanitizers, - target, + platform, profile, }: { @@ -11,7 +11,7 @@ inherit sources sanitizers - target + platform profile ; }; diff --git a/nix/target.nix b/nix/platforms.nix similarity index 70% rename from nix/target.nix rename to nix/platforms.nix index 14c0f88e0..3c5b7825c 100644 --- a/nix/target.nix +++ b/nix/platforms.nix @@ -86,42 +86,45 @@ let }; }; in -lib.fix (final: { - platform = platforms.${platform}; - info = - { - x86_64 = { - linux = { - gnu = { - target = "x86_64-unknown-linux-gnu"; - machine = "x86_64"; - nixarch = "gnu64"; - libc = "gnu"; - }; - musl = { - target = "x86_64-unknown-linux-musl"; - machine = "x86_64"; - nixarch = "musl64"; - libc = "musl"; +lib.fix ( + final: + platforms.${platform} + // { + info = + { + x86_64 = { + linux = { + gnu = { + target = "x86_64-unknown-linux-gnu"; + machine = "x86_64"; + nixarch = "gnu64"; + libc = "gnu"; + }; + musl = { + target = "x86_64-unknown-linux-musl"; + machine = "x86_64"; + nixarch = "musl64"; + libc = "musl"; + }; }; }; - }; - aarch64 = { - linux = { - gnu = { - target = "aarch64-unknown-linux-gnu"; - machine = "aarch64"; - nixarch = "aarch64-multiplatform"; - libc = "gnu"; - }; - musl = { - target = "aarch64-unknown-linux-musl"; - machine = "aarch64"; - nixarch = "aarch64-multiplatform-musl"; - libc = "musl"; + aarch64 = { + linux = { + gnu = { + target = "aarch64-unknown-linux-gnu"; + machine = "aarch64"; + nixarch = "aarch64-multiplatform"; + libc = "gnu"; + }; + musl = { + target = "aarch64-unknown-linux-musl"; + machine = "aarch64"; + nixarch = "aarch64-multiplatform-musl"; + libc = "musl"; + }; }; }; - }; - } - .${final.platform.arch}.${kernel}.${libc}; -}) + } + .${final.arch}.${kernel}.${libc}; + } +) diff --git a/nix/rust-toolchain.manifest-lock.nix b/nix/rust-toolchain.manifest-lock.nix new file mode 100644 index 000000000..2c333d943 --- /dev/null +++ b/nix/rust-toolchain.manifest-lock.nix @@ -0,0 +1,18 @@ +let + rust-toolchain = (builtins.fromTOML (builtins.readFile ../rust-toolchain.toml)).toolchain; + channel = rust-toolchain.channel; + url = "https://static.rust-lang.org/dist/channel-rust-${channel}.toml"; + manifest-path = builtins.fetchurl { + inherit url; + name = "manifest.toml"; + }; + hash = { + md5 = builtins.hashFile "md5" manifest-path; + sha1 = builtins.hashFile "sha1" manifest-path; + sha256 = builtins.hashFile "sha256" manifest-path; + sha512 = builtins.hashFile "sha512" manifest-path; + }; +in +{ + inherit channel url hash; +} diff --git a/npins/sources.json b/npins/sources.json index 75329024f..2e98b0c2a 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -13,6 +13,11 @@ "url": "https://github.com/DPDK/dpdk/archive/ed957165eadbe60a47d5ec223578cdd1c13d0bd9.tar.gz", "hash": "09h7wnmq4c9xm1nsyv5mz1yf91c1l6vy9sdcamb09qjjx4wgs0q9" }, + "fenix": { + "type": "Tarball", + "url": "https://github.com/nix-community/fenix/archive/main.tar.gz", + "hash": "1gkd9ppvsxl4jjg1jyw61wm99xhy4hdqx5dxqj06gfxi2zkamvzf" + }, "nixpkgs": { "type": "Channel", "name": "nixpkgs-unstable", diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 000000000..610ccfcad --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,27 @@ +[toolchain] +# NOTE: you can and should manually update this on new rust releases + +channel = "1.92.0" +components = [ + "rustc", + "cargo", + "rust-std", + "rust-docs", + "rustfmt-preview", + "clippy-preview", + "rust-analyzer-preview", + "rust-src", + + # disabled components + # "rust-mingw", + # "llvm-tools-preview", ## we already have a full llvm in the npins + # "rust-analysis", ## obsolete + # "miri-preview", ## not yet functional for us + # "rustc-codegen-cranelift-preview" ## not relevant to us +] +targets = [ + "x86_64-unknown-linux-gnu", + "x86_64-unknown-linux-musl", + "aarch64-unknown-linux-gnu", + "aarch64-unknown-linux-musl" +] From 1378eff3892d331d5ff2dcdd4d5ac45066a1918d Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 22 Dec 2025 03:54:01 +0000 Subject: [PATCH 069/163] wip --- default.nix | 47 +++++++++++++++++-------- nix/overlays/dataplane.nix | 20 +++++++++++ nix/overlays/default.nix | 4 +++ nix/pkgs/dpdk/cross/bluefield3.gnu.ini | 18 ---------- nix/pkgs/dpdk/cross/bluefield3.musl.ini | 18 ---------- nix/pkgs/dpdk/default.nix | 2 ++ npins/sources.json | 32 +++++++++++++++++ 7 files changed, 90 insertions(+), 51 deletions(-) delete mode 100644 nix/pkgs/dpdk/cross/bluefield3.gnu.ini delete mode 100644 nix/pkgs/dpdk/cross/bluefield3.musl.ini diff --git a/default.nix b/default.nix index e9e245bdc..53c1a6b10 100644 --- a/default.nix +++ b/default.nix @@ -1,7 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright Open Network Fabric Authors { - overlay ? "dataplane", platform ? "x86-64-v3", libc ? "gnu", prof ? "debug", @@ -31,15 +30,20 @@ let ; platform = platform'; }; - pkgs = + dataplane-dev-pkgs = import sources.nixpkgs { + overlays = [ + overlays.dataplane-dev + ]; + }; + dataplane-pkgs = (import sources.nixpkgs { overlays = [ - overlays.${overlay} + overlays.dataplane ]; }).pkgsCross.${platform'.info.nixarch}; - sysroot = pkgs.symlinkJoin { + sysroot = dataplane-pkgs.symlinkJoin { name = "sysroot"; - paths = with pkgs; [ + paths = with dataplane-pkgs; [ stdenv'.cc.libc.dev stdenv'.cc.libc.out libmd.dev @@ -58,34 +62,47 @@ let dpdk-wrapper.out ]; }; - clangd-config = pkgs.writeTextFile { + clangd-config = dataplane-pkgs.writeTextFile { name = ".clangd"; text = '' CompileFlags: Add: - "-I${sysroot}/include" - - "-I${pkgs.dpdk.dev}/include" + - "-I${dataplane-pkgs.dpdk.dev}/include" - "-Wno-deprecated-declarations" ''; executable = false; destination = "/.clangd"; }; - dev-tools = pkgs.symlinkJoin { + dev-tools = dataplane-pkgs.symlinkJoin { name = "dataplane-dev-shell"; - paths = with pkgs.pkgsBuildHost; [ + paths = [ clangd-config - llvmPackages.bintools - llvmPackages.clang - llvmPackages.libclang.lib - llvmPackages.lld + ] + ++ (with dataplane-pkgs.pkgsBuildHost.llvmPackages; [ + bintools + clang + libclang.lib + lld + ]) + ++ (with dataplane-dev-pkgs; [ + bash + cargo-bolero + cargo-deny + cargo-depgraph + cargo-llvm-cov + cargo-nextest + direnv + just npins - ]; + ]); }; in { inherit + dataplane-dev-pkgs + dataplane-pkgs dev-tools - pkgs profile sources sysroot diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index b5644da3e..424f244a6 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -65,6 +65,8 @@ in udev = null; udevCheckHook = null; + llvmPackages = final.llvmPackages_21; + # libmd is used by libbsd (et al) which is an optional dependency of dpdk. # # We _might_ actually care about perf here, so we lto this package. @@ -167,6 +169,17 @@ in rdma-core = (dataplane-dep prev.rdma-core).overrideAttrs (orig: { version = sources.rdma-core.branch; src = sources.rdma-core.outPath; + + # Patching the shebang lines in the perl scripts causes nixgraph to (incorrectly) think we depend on perl at + # runtime. We absolutely do not (we don't even ship a perl interpreter), so don't patch these shebang lines. + # In fact, we don't use any of the scripts from this package. + dontPatchShebangs = true; + + # The upstream postFixup is broken by dontPatchShebangs = true + # It's whole function was to further mutate the shebang lines in perl scripts, so we don't care. + # Just null it. + postFixup = null; + outputs = (orig.outputs or [ ]) ++ [ "static" ]; @@ -179,6 +192,8 @@ in cmakeFlags = orig.cmakeFlags ++ [ + "-DRDMA_DYNAMIC_PROVIDERS=none" + "-DRDMA_STATIC_PROVIDERS=all" "-DENABLE_STATIC=1" # we don't need pyverbs, and turning it off reduces build time / complexity. "-DNO_PYVERBS=1" @@ -234,8 +249,13 @@ in # these methods anyway. dpdk-wrapper = dataplane-dep (final.callPackage ../pkgs/dpdk-wrapper { }); + pciutils = dataplane-dep (prev.pciutils.override { static = true; }); + # This isn't directly required by dataplane, + perftest = dataplane-dep (final.callPackage ../pkgs/perftest { src = sources.perftest; }); + # TODO: doc this rustPlatform = final.makeRustPlatform { + stdenv = stdenv'; cargo = rust-toolchain; rustc = rust-toolchain; }; diff --git a/nix/overlays/default.nix b/nix/overlays/default.nix index 02212edb8..8ce3c6604 100644 --- a/nix/overlays/default.nix +++ b/nix/overlays/default.nix @@ -15,4 +15,8 @@ profile ; }; + + dataplane-dev = import ./dataplane-dev.nix { + inherit sources; + }; } diff --git a/nix/pkgs/dpdk/cross/bluefield3.gnu.ini b/nix/pkgs/dpdk/cross/bluefield3.gnu.ini deleted file mode 100644 index fec17cf95..000000000 --- a/nix/pkgs/dpdk/cross/bluefield3.gnu.ini +++ /dev/null @@ -1,18 +0,0 @@ -[binaries] -c = 'aarch64-unknown-linux-gnu-cc' -cpp = 'aarch64-unknown-linux-gnu-c++' -ar = 'aarch64-unknown-linux-gnu-ar' -strip = 'aarch64-unknown-linux-gnu-strip' -pkgconfig = 'aarch64-unknown-linux-gnu-pkg-config' -pkg-config = 'aarch64-unknown-linux-gnu-pkg-config' -pcap-config = '' - -[host_machine] -system = 'linux' -cpu_family = 'aarch64' -cpu = 'armv8.6-a' -endian = 'little' - -[properties] -platform = 'bluefield3' -libc = 'gnu' diff --git a/nix/pkgs/dpdk/cross/bluefield3.musl.ini b/nix/pkgs/dpdk/cross/bluefield3.musl.ini deleted file mode 100644 index eb433ad26..000000000 --- a/nix/pkgs/dpdk/cross/bluefield3.musl.ini +++ /dev/null @@ -1,18 +0,0 @@ -[binaries] -c = 'aarch64-unknown-linux-musl-cc' -cpp = 'aarch64-unknown-linux-musl-c++' -ar = 'aarch64-unknown-linux-musl-ar' -strip = 'aarch64-unknown-linux-musl-strip' -pkgconfig = 'aarch64-unknown-linux-musl-pkg-config' -pkg-config = 'aarch64-unknown-linux-musl-pkg-config' -pcap-config = '' - -[host_machine] -system = 'linux' -cpu_family = 'aarch64' -cpu = 'armv8.6-a' -endian = 'little' - -[properties] -platform = 'bluefield3' -libc = 'musl' diff --git a/nix/pkgs/dpdk/default.nix b/nix/pkgs/dpdk/default.nix index ab1e0010d..b8f8d300b 100644 --- a/nix/pkgs/dpdk/default.nix +++ b/nix/pkgs/dpdk/default.nix @@ -311,6 +311,8 @@ stdenv.mkDerivation { postInstall = '' # Remove docs. We don't build these anyway rm -rf $out/share/doc + # Remove python files from bin output (we never use them and they confuse dependency reports) + rm $out/bin/*.py mkdir -p $static/lib $share; mv $out/lib/*.a $static/lib mv $out/share $share diff --git a/npins/sources.json b/npins/sources.json index 2e98b0c2a..0fa1f6258 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -18,12 +18,44 @@ "url": "https://github.com/nix-community/fenix/archive/main.tar.gz", "hash": "1gkd9ppvsxl4jjg1jyw61wm99xhy4hdqx5dxqj06gfxi2zkamvzf" }, + "kopium": { + "type": "GitRelease", + "repository": { + "type": "GitHub", + "owner": "kube-rs", + "repo": "kopium" + }, + "pre_releases": false, + "version_upper_bound": null, + "release_prefix": null, + "submodules": false, + "version": "0.22.5", + "revision": "f346e2044500c8d71523c35d474bc2f6235a0060", + "url": "https://api.github.com/repos/kube-rs/kopium/tarball/0.22.5", + "hash": "14lr2qgfh50rlpw5wgy6cw1qvkz44bwwx06srlks243hgkw9p2fd" + }, "nixpkgs": { "type": "Channel", "name": "nixpkgs-unstable", "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.05pre913981.7d853e518814/nixexprs.tar.xz", "hash": "1cpg513zly625rw05kbz1hvfiqcrwbd71c1bqhp61sh6ng8ifg4c" }, + "perftest": { + "type": "GitRelease", + "repository": { + "type": "GitHub", + "owner": "linux-rdma", + "repo": "perftest" + }, + "pre_releases": false, + "version_upper_bound": null, + "release_prefix": null, + "submodules": false, + "version": "25.10.0-0.128", + "revision": "8a1d3d7234add23fe006b2ff51d650ff022077a8", + "url": "https://api.github.com/repos/linux-rdma/perftest/tarball/25.10.0-0.128", + "hash": "192m2xlds308y0p2h6f6zciwspgq3k0q93q9lp1j4ijmwrpbcrl0" + }, "rdma-core": { "type": "Git", "repository": { From 221e6710eee8ffe4d2e910e34e7a6a01d4f9a359 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 22 Dec 2025 19:25:12 +0000 Subject: [PATCH 070/163] hack --- .cargo/config.toml | 8 +- .envrc => .envrc.old | 0 Cargo.lock | 19 +- Cargo.toml | 2 +- cli/build.rs | 4 +- dataplane/build.rs | 4 +- default.nix | 158 +++++ dpdk-sys/build.rs | 20 +- dpdk-sys/dpdk_wrapper.h | 1034 ++++++++++++++++++++++++++++++++ dpdk/build.rs | 4 +- hardware/Cargo.toml | 4 +- hardware/build.rs | 4 +- hardware/src/scan.rs | 152 ++--- init/build.rs | 4 +- nix/overlays/dataplane-dev.nix | 27 + nix/overlays/dataplane.nix | 3 + nix/pkgs/kopium/default.nix | 11 + nix/pkgs/perftest/default.nix | 19 + nix/profiles.nix | 2 +- npins/sources.json | 29 + sysfs/Cargo.toml | 2 +- sysfs/build.rs | 4 +- 22 files changed, 1397 insertions(+), 117 deletions(-) rename .envrc => .envrc.old (100%) create mode 100644 dpdk-sys/dpdk_wrapper.h create mode 100644 nix/overlays/dataplane-dev.nix create mode 100644 nix/pkgs/kopium/default.nix create mode 100644 nix/pkgs/perftest/default.nix diff --git a/.cargo/config.toml b/.cargo/config.toml index 32fb6467d..02340991f 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,12 +1,12 @@ [env] COMPILE_ENV = { value = "sysroot", relative = true, force = false } -PATH = { value = "compile-env/bin", relative = true, force = true } -LIBCLANG_PATH = { value = "compile-env/lib", relative = true, force = true } -PKG_CONFIG_PATH = { value = "compile-env/sysroot/x86_64-unknown-linux-gnu/release/lib/pkgconfig", relative = true, force = true } +#PATH = { value = "compile-env/bin", relative = true, force = true } +#LIBCLANG_PATH = { value = "compile-env/lib", relative = true, force = true } +# PKG_CONFIG_PATH = { value = "compile-env/sysroot/x86_64-unknown-linux-gnu/release/lib/pkgconfig", relative = true, force = true } [build] target = "x86_64-unknown-linux-gnu" -rustc = "compile-env/bin/rustc" +# rustc = "compile-env/bin/rustc" rustflags = ["--cfg", "tokio_unstable"] [target.x86_64-unknown-linux-gnu] diff --git a/.envrc b/.envrc.old similarity index 100% rename from .envrc rename to .envrc.old diff --git a/Cargo.lock b/Cargo.lock index 6da71ebaf..6c1a1190e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -251,9 +251,9 @@ dependencies = [ [[package]] name = "axum" -version = "0.8.7" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b098575ebe77cb6d14fc7f32749631a6e44edbef6b796f89b020e99ba20d425" +checksum = "8b52af3cb4058c895d37317bb27508dccc8e5f2d39454016b297bf4a400597b8" dependencies = [ "axum-core", "bytes", @@ -1333,9 +1333,7 @@ dependencies = [ "dataplane-id", "dataplane-sysfs", "dataplane-test-utils", - "fixin", "hwlocality", - "n-vm", "num-derive", "num-traits", "pci-ids", @@ -1657,7 +1655,6 @@ version = "0.7.0" dependencies = [ "dataplane-dpdk-sysroot-helper", "dataplane-id", - "n-vm", "nix 0.30.1", "procfs", "strum", @@ -2892,9 +2889,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.15" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +checksum = "7ee5b5339afb4c41626dde77b7a611bd4f2c202b897852b4bcf5d03eddc61010" [[package]] name = "jobserver" @@ -4326,9 +4323,9 @@ dependencies = [ [[package]] name = "rapidhash" -version = "4.1.1" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8e65c75143ce5d47c55b510297eeb1182f3c739b6043c537670e9fc18612dae" +checksum = "2988730ee014541157f48ce4dcc603940e00915edc3c7f9a8d78092256bb2493" dependencies = [ "rustversion", ] @@ -4668,9 +4665,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.20" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" +checksum = "62049b2877bf12821e8f9ad256ee38fdc31db7387ec2d3b3f403024de2034aea" [[package]] name = "safemem" diff --git a/Cargo.toml b/Cargo.toml index 5453f089f..6ebdc6ddb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -133,7 +133,7 @@ metrics-exporter-prometheus = { version = "0.18.1", default-features = false, fe miette = { version = "7.6.0", default-features = false, features = [] } mio = { version = "1.1.1", default-features = false, features = [] } multi_index_map = { version = "0.15.0", default-features = false, features = [] } -n-vm = { git = "https://github.com/githedgehog/testn.git", tag = "v0.0.9", default-features = false, features = [], package = "n-vm" } +n-vm = { git = "https://github.com/githedgehog/testn.git", tag = "v0.0.9", default-features = false, features = [] } netdev = { version = "0.39.0", default-features = false, features = [] } nix = { version = "0.30.1", default-features = false, features = [] } num-derive = { version = "0.4.2", default-features = false, features = [] } diff --git a/cli/build.rs b/cli/build.rs index 9d7c9069b..1c30f3c66 100644 --- a/cli/build.rs +++ b/cli/build.rs @@ -2,7 +2,7 @@ // Copyright Open Network Fabric Authors fn main() { - let sysroot = dpdk_sysroot_helper::get_sysroot(); - println!("cargo:rustc-link-search=all={sysroot}/lib"); + // let sysroot = dpdk_sysroot_helper::get_sysroot(); + // println!("cargo:rustc-link-search=all={sysroot}/lib"); // println!("cargo:rustc-link-arg=--sysroot={sysroot}"); } diff --git a/dataplane/build.rs b/dataplane/build.rs index 9d7c9069b..1c30f3c66 100644 --- a/dataplane/build.rs +++ b/dataplane/build.rs @@ -2,7 +2,7 @@ // Copyright Open Network Fabric Authors fn main() { - let sysroot = dpdk_sysroot_helper::get_sysroot(); - println!("cargo:rustc-link-search=all={sysroot}/lib"); + // let sysroot = dpdk_sysroot_helper::get_sysroot(); + // println!("cargo:rustc-link-search=all={sysroot}/lib"); // println!("cargo:rustc-link-arg=--sysroot={sysroot}"); } diff --git a/default.nix b/default.nix index 53c1a6b10..e4823a42a 100644 --- a/default.nix +++ b/default.nix @@ -60,6 +60,7 @@ let dpdk.static dpdk-wrapper.dev dpdk-wrapper.out + hwloc ]; }; clangd-config = dataplane-pkgs.writeTextFile { @@ -97,6 +98,150 @@ let npins ]); }; + # crane = import sources.crane { pkgs = dataplane-dev-pkgs; }; + crane = import sources.crane { }; + dataplane-src = crane.cleanCargoSource ./.; + + # Common arguments can be set here to avoid repeating them later + commonArgs = { + src = dataplane-src; + strictDeps = true; + CARGO_PROFILE = "dev"; + + nativeBuildInputs = [ + dataplane-pkgs.pkg-config + # dataplane-pkgs.libclang.lib + ]; + buildInputs = [ + dataplane-pkgs.hwloc + ]; + + # Additional environment variables can be set directly + # MY_CUSTOM_VAR = "some value"; + }; + # Build *just* the cargo dependencies (of the entire workspace), + # so we can reuse all of that work (e.g. via cachix) when running in CI + # It is *highly* recommended to use something like cargo-hakari to avoid + # cache misses when building individual top-level-crates + cargoArtifacts = crane.buildDepsOnly commonArgs; + individualCrateArgs = commonArgs // { + inherit cargoArtifacts; + inherit (crane.crateNameFromCargoToml { src = dataplane-src; }) version; + # NB: we disable tests since we'll run them all via cargo-nextest + doCheck = false; + }; + fileSetForCrate = + crate: + lib.fileset.toSource { + root = ./.; + fileset = lib.fileset.unions [ + ./. + ./Cargo.toml + ./Cargo.lock + # (crane.fileset.commonCargoSources ./crates/my-common) + # (crane.fileset.commonCargoSources ./crates/my-workspace-hack) + (crane.fileset.commonCargoSources crate) + ]; + }; + rekon = crane.buildPackage ( + individualCrateArgs + // { + pname = "dataplane-rekon"; + cargoExtraArgs = "--package dataplane-rekon"; + src = fileSetForCrate ./rekon; + } + ); + net = crane.buildPackage ( + individualCrateArgs + // { + pname = "dataplane-net"; + cargoExtraArgs = "--package dataplane-net"; + src = fileSetForCrate ./net; + } + ); + cli = crane.buildPackage ( + individualCrateArgs + // { + pname = "dataplane-cli"; + cargoExtraArgs = "--package dataplane-cli"; + src = fileSetForCrate ./cli; + } + ); + dataplane-dpdk-sysroot-helper = crane.buildPackage ( + individualCrateArgs + // { + pname = "dataplane-dpdk-sysroot-helper"; + cargoExtraArgs = "--package dataplane-dpdk-sysroot-helper"; + src = fileSetForCrate ./dpdk-sysroot-helper; + } + ); + dpdk-sys = crane.buildPackage ( + individualCrateArgs + // { + pname = "dataplane-dpdk-sys"; + cargoExtraArgs = "--package dataplane-dpdk-sys"; + src = fileSetForCrate ./dpdk-sys; + env = { + LIBCLANG_PATH = "${dataplane-pkgs.llvmPackages.libclang.lib}/lib"; + C_INCLUDE_PATH = "${dataplane-pkgs.dpdk.dev}/include:${dataplane-pkgs.libbsd.dev}/include:${dataplane-pkgs.stdenv'.cc.libc.dev}/include"; + LIBRARY_PATH = "${sysroot}/lib"; + }; + nativeBuildInputs = [ + dataplane-pkgs.pkg-config + dataplane-pkgs.llvmPackages.libclang.lib + dataplane-pkgs.llvmPackages.clang + dataplane-pkgs.llvmPackages.lld + ]; + buildInputs = [ + sysroot + ]; + } + ); + pdpdk = crane.buildPackage ( + individualCrateArgs + // { + pname = "dataplane-dpdk"; + cargoExtraArgs = "--package dataplane-dpdk"; + src = fileSetForCrate ./dpdk; + env = { + LIBCLANG_PATH = "${dataplane-pkgs.llvmPackages.libclang.lib}/lib"; + C_INCLUDE_PATH = "${dataplane-pkgs.dpdk.dev}/include:${dataplane-pkgs.libbsd.dev}/include:${dataplane-pkgs.stdenv'.cc.libc.dev}/include"; + LIBRARY_PATH = "${sysroot}/lib"; + }; + nativeBuildInputs = [ + dataplane-pkgs.pkg-config + dataplane-pkgs.llvmPackages.libclang.lib + dataplane-pkgs.llvmPackages.clang + dataplane-pkgs.llvmPackages.lld + ]; + buildInputs = [ + sysroot + ]; + } + ); + dataplane = crane.buildPackage ( + individualCrateArgs + // { + pname = "dataplane"; + cargoExtraArgs = "--package dataplane"; + src = fileSetForCrate ./dataplane; + env = { + LIBCLANG_PATH = "${dataplane-pkgs.llvmPackages.libclang.lib}/lib"; + C_INCLUDE_PATH = "${dataplane-pkgs.dpdk.dev}/include:${dataplane-pkgs.libbsd.dev}/include:${dataplane-pkgs.stdenv'.cc.libc.dev}/include"; + LIBRARY_PATH = "${sysroot}/lib"; + }; + nativeBuildInputs = [ + dataplane-pkgs.pkg-config + dataplane-pkgs.llvmPackages.libclang.lib + dataplane-pkgs.llvmPackages.clang + dataplane-pkgs.llvmPackages.lld + ]; + buildInputs = [ + sysroot + ]; + } + ); + in { inherit @@ -106,6 +251,19 @@ in profile sources sysroot + crane + commonArgs + cargoArtifacts + rekon + net + cli + dataplane-dpdk-sysroot-helper + dpdk-sys + pdpdk + dataplane ; platform = platform'; + x = builtins.attrNames crane; + # y = crane.buildPackage + } diff --git a/dpdk-sys/build.rs b/dpdk-sys/build.rs index 1eac21991..8afec9363 100644 --- a/dpdk-sys/build.rs +++ b/dpdk-sys/build.rs @@ -20,11 +20,11 @@ impl ParseCallbacks for Cb { } } -fn bind(path: &Path, sysroot: &str) { +fn bind(path: &Path) { let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); let static_fn_path = out_path.join("generated.h"); bindgen::Builder::default() - .header(format!("{sysroot}/include/dpdk_wrapper.h")) + .header(format!("./dpdk_wrapper.h")) .anon_fields_prefix("annon") .use_core() .generate_comments(true) @@ -56,7 +56,7 @@ fn bind(path: &Path, sysroot: &str) { .opaque_type("rte_arp_ipv4") .opaque_type("rte_gtp_psc_generic_hdr") .opaque_type("rte_l2tpv2_combined_msg_hdr") - .clang_arg(format!("-I{sysroot}/include")) + // .clang_arg(format!("-I{sysroot}/include")) .clang_arg("-fretain-comments-from-system-headers") .clang_arg("-fparse-all-comments") .rust_edition(bindgen::RustEdition::Edition2024) @@ -69,14 +69,13 @@ fn bind(path: &Path, sysroot: &str) { fn main() { let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); - let sysroot = dpdk_sysroot_helper::get_sysroot(); + let library_path = env::var("LIBRARY_PATH").unwrap().to_string(); + // let sysroot = dpdk_sysroot_helper::get_sysroot(); // println!("cargo:rustc-link-arg=--sysroot={sysroot}"); - println!("cargo:rustc-link-search=all={sysroot}/lib"); + // println!("cargo:rustc-link-search=all={sysroot}/lib"); + println!("cargo:rustc-link-search=all={library_path}"); - // NOTE: DPDK absolutely requires whole-archive in the linking command. - // While I find this very questionable, it is what it is. - // It is just more work for the LTO later on I suppose ¯\_(ツ)_/¯ let depends = [ "dpdk_wrapper", "rte_net_virtio", @@ -127,6 +126,9 @@ fn main() { "numa", ]; + // NOTE: DPDK absolutely requires whole-archive in the linking command. + // While I find this very questionable, it is what it is. + // It is just more work for the LTO later on I suppose ¯\_(ツ)_/¯ for dep in &depends { println!("cargo:rustc-link-lib=static:+whole-archive,+bundle={dep}"); } @@ -134,5 +136,5 @@ fn main() { for file in &rerun_if_changed { println!("cargo:rerun-if-changed={file}"); } - bind(&out_path, sysroot.as_str()); + bind(&out_path); } diff --git a/dpdk-sys/dpdk_wrapper.h b/dpdk-sys/dpdk_wrapper.h new file mode 100644 index 000000000..3ebfe21e7 --- /dev/null +++ b/dpdk-sys/dpdk_wrapper.h @@ -0,0 +1,1034 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Open Network Fabric Authors + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Things which are either duplicated, totally inapplicable or not needed +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include // this is an internal header +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include + +// #include +// #include +// #include +// #include + +/** + * Thin wrapper to expose `rte_errno`. + * + * @return + * The last rte_errno value (thread local value). + */ +int rte_errno_get(); + +/** + * TX offloads to be set in [`rte_eth_tx_mode.offloads`]. + * + * This is a bitfield. Union these to enable multiple offloads. + * + * I wrapped these because the enum must be explicitly typed as 64 bit, but + * DPDK is not yet using the C23 standard (which would allow the inheritance + * notation with `uint64_t` seen here.). + */ +enum rte_eth_tx_offload : uint64_t { + TX_OFFLOAD_VLAN_INSERT = RTE_ETH_TX_OFFLOAD_VLAN_INSERT, + TX_OFFLOAD_IPV4_CKSUM = RTE_ETH_TX_OFFLOAD_IPV4_CKSUM, + TX_OFFLOAD_UDP_CKSUM = RTE_ETH_TX_OFFLOAD_UDP_CKSUM, + TX_OFFLOAD_TCP_CKSUM = RTE_ETH_TX_OFFLOAD_TCP_CKSUM, + TX_OFFLOAD_SCTP_CKSUM = RTE_ETH_TX_OFFLOAD_SCTP_CKSUM, + TX_OFFLOAD_TCP_TSO = RTE_ETH_TX_OFFLOAD_TCP_TSO, + TX_OFFLOAD_UDP_TSO = RTE_ETH_TX_OFFLOAD_UDP_TSO, + TX_OFFLOAD_OUTER_IPV4_CKSUM = RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM, + TX_OFFLOAD_QINQ_INSERT = RTE_ETH_TX_OFFLOAD_QINQ_INSERT, + TX_OFFLOAD_VXLAN_TNL_TSO = RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO, + TX_OFFLOAD_GRE_TNL_TSO = RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO, + TX_OFFLOAD_IPIP_TNL_TSO = RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO, + TX_OFFLOAD_GENEVE_TNL_TSO = RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO, + TX_OFFLOAD_MACSEC_INSERT = RTE_ETH_TX_OFFLOAD_MACSEC_INSERT, + TX_OFFLOAD_MT_LOCKFREE = RTE_ETH_TX_OFFLOAD_MT_LOCKFREE, + TX_OFFLOAD_MULTI_SEGS = RTE_ETH_TX_OFFLOAD_MULTI_SEGS, + TX_OFFLOAD_MBUF_FAST_FREE = RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE, + TX_OFFLOAD_SECURITY = RTE_ETH_TX_OFFLOAD_SECURITY, + TX_OFFLOAD_UDP_TNL_TSO = RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO, + TX_OFFLOAD_IP_TNL_TSO = RTE_ETH_TX_OFFLOAD_IP_TNL_TSO, + TX_OFFLOAD_OUTER_UDP_CKSUM = RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM, + TX_OFFLOAD_SEND_ON_TIMESTAMP = RTE_ETH_TX_OFFLOAD_SEND_ON_TIMESTAMP +}; + +/** + * RX offloads to be set in [`rte_eth_rx_mode.offloads`]. + * + * This is a bitfield. Union these to enable multiple offloads. + * + * I wrapped these because the enum must be explicitly typed as 64 bit, but + * DPDK is not yet using the C23 standard (which would allow the inheritance + * notation with `uint64_t` seen here.). + */ +enum rte_eth_rx_offload : uint64_t { + RX_OFFLOAD_VLAN_STRIP = RTE_ETH_RX_OFFLOAD_VLAN_STRIP, + RX_OFFLOAD_IPV4_CKSUM = RTE_ETH_RX_OFFLOAD_IPV4_CKSUM, + RX_OFFLOAD_UDP_CKSUM = RTE_ETH_RX_OFFLOAD_UDP_CKSUM, + RX_OFFLOAD_TCP_CKSUM = RTE_ETH_RX_OFFLOAD_TCP_CKSUM, + RX_OFFLOAD_TCP_LRO = RTE_ETH_RX_OFFLOAD_TCP_LRO, + RX_OFFLOAD_QINQ_STRIP = RTE_ETH_RX_OFFLOAD_QINQ_STRIP, + RX_OFFLOAD_OUTER_IPV4_CKSUM = RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM, + RX_OFFLOAD_MACSEC_STRIP = RTE_ETH_RX_OFFLOAD_MACSEC_STRIP, + RX_OFFLOAD_VLAN_FILTER = RTE_ETH_RX_OFFLOAD_VLAN_FILTER, + RX_OFFLOAD_VLAN_EXTEND = RTE_ETH_RX_OFFLOAD_VLAN_EXTEND, + RX_OFFLOAD_SCATTER = RTE_ETH_RX_OFFLOAD_SCATTER, + RX_OFFLOAD_TIMESTAMP = RTE_ETH_RX_OFFLOAD_TIMESTAMP, + RX_OFFLOAD_SECURITY = RTE_ETH_RX_OFFLOAD_SECURITY, + RX_OFFLOAD_KEEP_CRC = RTE_ETH_RX_OFFLOAD_KEEP_CRC, + RX_OFFLOAD_SCTP_CKSUM = RTE_ETH_RX_OFFLOAD_SCTP_CKSUM, + RX_OFFLOAD_OUTER_UDP_CKSUM = RTE_ETH_RX_OFFLOAD_OUTER_UDP_CKSUM, + RX_OFFLOAD_RSS_HASH = RTE_ETH_RX_OFFLOAD_RSS_HASH, + RX_OFFLOAD_BUFFER_SPLIT = RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT, +}; + +int rte_errno_get(); + +// Static wrappers + +void rte_atomic_thread_fence_w(rte_memory_order memorder); +int rte_atomic16_cmpset_w(uint16_t *dst, uint16_t exp, uint16_t src); +uint16_t rte_atomic16_exchange_w(uint16_t *dst, uint16_t val); +void rte_atomic16_init_w(rte_atomic16_t *v); +int16_t rte_atomic16_read_w(const rte_atomic16_t *v); +void rte_atomic16_set_w(rte_atomic16_t *v, int16_t new_value); +void rte_atomic16_add_w(rte_atomic16_t *v, int16_t inc); +void rte_atomic16_sub_w(rte_atomic16_t *v, int16_t dec); +void rte_atomic16_inc_w(rte_atomic16_t *v); +void rte_atomic16_dec_w(rte_atomic16_t *v); +int16_t rte_atomic16_add_return_w(rte_atomic16_t *v, int16_t inc); +int16_t rte_atomic16_sub_return_w(rte_atomic16_t *v, int16_t dec); +int rte_atomic16_inc_and_test_w(rte_atomic16_t *v); +int rte_atomic16_dec_and_test_w(rte_atomic16_t *v); +int rte_atomic16_test_and_set_w(rte_atomic16_t *v); +void rte_atomic16_clear_w(rte_atomic16_t *v); +int rte_atomic32_cmpset_w(uint32_t *dst, uint32_t exp, uint32_t src); +uint32_t rte_atomic32_exchange_w(uint32_t *dst, uint32_t val); +void rte_atomic32_init_w(rte_atomic32_t *v); +int32_t rte_atomic32_read_w(const rte_atomic32_t *v); +void rte_atomic32_set_w(rte_atomic32_t *v, int32_t new_value); +void rte_atomic32_add_w(rte_atomic32_t *v, int32_t inc); +void rte_atomic32_sub_w(rte_atomic32_t *v, int32_t dec); +void rte_atomic32_inc_w(rte_atomic32_t *v); +void rte_atomic32_dec_w(rte_atomic32_t *v); +int32_t rte_atomic32_add_return_w(rte_atomic32_t *v, int32_t inc); +int32_t rte_atomic32_sub_return_w(rte_atomic32_t *v, int32_t dec); +int rte_atomic32_inc_and_test_w(rte_atomic32_t *v); +int rte_atomic32_dec_and_test_w(rte_atomic32_t *v); +int rte_atomic32_test_and_set_w(rte_atomic32_t *v); +void rte_atomic32_clear_w(rte_atomic32_t *v); +int rte_atomic64_cmpset_w(uint64_t *dst, uint64_t exp, uint64_t src); +uint64_t rte_atomic64_exchange_w(uint64_t *dst, uint64_t val); +void rte_atomic64_init_w(rte_atomic64_t *v); +int64_t rte_atomic64_read_w(rte_atomic64_t *v); +void rte_atomic64_set_w(rte_atomic64_t *v, int64_t new_value); +void rte_atomic64_add_w(rte_atomic64_t *v, int64_t inc); +void rte_atomic64_sub_w(rte_atomic64_t *v, int64_t dec); +void rte_atomic64_inc_w(rte_atomic64_t *v); +void rte_atomic64_dec_w(rte_atomic64_t *v); +int64_t rte_atomic64_add_return_w(rte_atomic64_t *v, int64_t inc); +int64_t rte_atomic64_sub_return_w(rte_atomic64_t *v, int64_t dec); +int rte_atomic64_inc_and_test_w(rte_atomic64_t *v); +int rte_atomic64_dec_and_test_w(rte_atomic64_t *v); +int rte_atomic64_test_and_set_w(rte_atomic64_t *v); +void rte_atomic64_clear_w(rte_atomic64_t *v); +void rte_smp_mb_w(void); +uint64_t rte_get_tsc_cycles_w(void); +uint64_t rte_get_timer_cycles_w(void); +uint64_t rte_get_timer_hz_w(void); +void rte_delay_ms_w(unsigned int ms); +uint64_t rte_rdtsc_w(void); +uint64_t rte_rdtsc_precise_w(void); +size_t rte_strlcpy_w(char *dst, const char *src, size_t size); +size_t rte_strlcat_w(char *dst, const char *src, size_t size); +const char *rte_str_skip_leading_spaces_w(const char *src); +void rte_uuid_copy_w(rte_uuid_t dst, const rte_uuid_t src); +int rte_gettid_w(void); +unsigned int rte_lcore_id_w(void); +void rte_pause_w(void); +void rte_wait_until_equal_16_w(uint16_t *addr, uint16_t expected, + rte_memory_order memorder); +void rte_wait_until_equal_32_w(uint32_t *addr, uint32_t expected, + rte_memory_order memorder); +void rte_wait_until_equal_64_w(uint64_t *addr, uint64_t expected, + rte_memory_order memorder); +void rte_spinlock_init_w(rte_spinlock_t *sl); +void rte_spinlock_lock_w(rte_spinlock_t *sl); +void rte_spinlock_unlock_w(rte_spinlock_t *sl); +int rte_spinlock_trylock_w(rte_spinlock_t *sl); +int rte_spinlock_is_locked_w(rte_spinlock_t *sl); +int rte_tm_supported_w(void); +void rte_spinlock_lock_tm_w(rte_spinlock_t *sl); +void rte_spinlock_unlock_tm_w(rte_spinlock_t *sl); +int rte_spinlock_trylock_tm_w(rte_spinlock_t *sl); +void rte_spinlock_recursive_init_w(rte_spinlock_recursive_t *slr); +void rte_spinlock_recursive_lock_w(rte_spinlock_recursive_t *slr); +void rte_spinlock_recursive_unlock_w(rte_spinlock_recursive_t *slr); +int rte_spinlock_recursive_trylock_w(rte_spinlock_recursive_t *slr); +void rte_spinlock_recursive_lock_tm_w(rte_spinlock_recursive_t *slr); +void rte_spinlock_recursive_unlock_tm_w(rte_spinlock_recursive_t *slr); +int rte_spinlock_recursive_trylock_tm_w(rte_spinlock_recursive_t *slr); +uint32_t rte_bit_relaxed_get32_w(unsigned int nr, uint32_t *addr); +void rte_bit_relaxed_set32_w(unsigned int nr, uint32_t *addr); +void rte_bit_relaxed_clear32_w(unsigned int nr, uint32_t *addr); +uint32_t rte_bit_relaxed_test_and_set32_w(unsigned int nr, uint32_t *addr); +uint32_t rte_bit_relaxed_test_and_clear32_w(unsigned int nr, uint32_t *addr); +uint64_t rte_bit_relaxed_get64_w(unsigned int nr, uint64_t *addr); +void rte_bit_relaxed_set64_w(unsigned int nr, uint64_t *addr); +void rte_bit_relaxed_clear64_w(unsigned int nr, uint64_t *addr); +uint64_t rte_bit_relaxed_test_and_set64_w(unsigned int nr, uint64_t *addr); +uint64_t rte_bit_relaxed_test_and_clear64_w(unsigned int nr, uint64_t *addr); +unsigned int rte_clz32_w(uint32_t v); +unsigned int rte_clz64_w(uint64_t v); +unsigned int rte_ctz32_w(uint32_t v); +unsigned int rte_ctz64_w(uint64_t v); +unsigned int rte_popcount32_w(uint32_t v); +unsigned int rte_popcount64_w(uint64_t v); +uint32_t rte_combine32ms1b_w(uint32_t x); +uint64_t rte_combine64ms1b_w(uint64_t v); +uint32_t rte_bsf32_w(uint32_t v); +int rte_bsf32_safe_w(uint32_t v, uint32_t *pos); +uint32_t rte_bsf64_w(uint64_t v); +int rte_bsf64_safe_w(uint64_t v, uint32_t *pos); +uint32_t rte_fls_u32_w(uint32_t x); +uint32_t rte_fls_u64_w(uint64_t x); +int rte_is_power_of_2_w(uint32_t n); +uint32_t rte_align32pow2_w(uint32_t x); +uint32_t rte_align32prevpow2_w(uint32_t x); +uint64_t rte_align64pow2_w(uint64_t v); +uint64_t rte_align64prevpow2_w(uint64_t v); +uint32_t rte_log2_u32_w(uint32_t v); +uint32_t rte_log2_u64_w(uint64_t v); +void rte_rwlock_init_w(rte_rwlock_t *rwl); +void rte_rwlock_read_lock_w(rte_rwlock_t *rwl); +int rte_rwlock_read_trylock_w(rte_rwlock_t *rwl); +void rte_rwlock_read_unlock_w(rte_rwlock_t *rwl); +int rte_rwlock_write_trylock_w(rte_rwlock_t *rwl); +void rte_rwlock_write_lock_w(rte_rwlock_t *rwl); +void rte_rwlock_write_unlock_w(rte_rwlock_t *rwl); +int rte_rwlock_write_is_locked_w(rte_rwlock_t *rwl); +void rte_rwlock_read_lock_tm_w(rte_rwlock_t *rwl); +void rte_rwlock_read_unlock_tm_w(rte_rwlock_t *rwl); +void rte_rwlock_write_lock_tm_w(rte_rwlock_t *rwl); +void rte_rwlock_write_unlock_tm_w(rte_rwlock_t *rwl); +unsigned int rte_ring_mp_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_sp_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mp_hts_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mc_hts_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_mp_hts_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mc_hts_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_mp_hts_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mc_hts_dequeue_bulk_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available); +unsigned int rte_ring_mp_hts_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mc_hts_dequeue_burst_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available); +unsigned int rte_ring_mp_rts_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mc_rts_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_mp_rts_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mc_rts_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_mp_rts_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mc_rts_dequeue_bulk_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available); +unsigned int rte_ring_mp_rts_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mc_rts_dequeue_burst_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available); +uint32_t rte_ring_get_prod_htd_max_w(const struct rte_ring *r); +int rte_ring_set_prod_htd_max_w(struct rte_ring *r, uint32_t v); +uint32_t rte_ring_get_cons_htd_max_w(const struct rte_ring *r); +int rte_ring_set_cons_htd_max_w(struct rte_ring *r, uint32_t v); +unsigned int rte_ring_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space); +int rte_ring_mp_enqueue_elem_w(struct rte_ring *r, void *obj, + unsigned int esize); +int rte_ring_sp_enqueue_elem_w(struct rte_ring *r, void *obj, + unsigned int esize); +int rte_ring_enqueue_elem_w(struct rte_ring *r, void *obj, unsigned int esize); +unsigned int rte_ring_mc_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available); +unsigned int rte_ring_sc_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available); +unsigned int rte_ring_dequeue_bulk_elem_w(struct rte_ring *r, void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available); +int rte_ring_mc_dequeue_elem_w(struct rte_ring *r, void *obj_p, + unsigned int esize); +int rte_ring_sc_dequeue_elem_w(struct rte_ring *r, void *obj_p, + unsigned int esize); +int rte_ring_dequeue_elem_w(struct rte_ring *r, void *obj_p, + unsigned int esize); +unsigned int rte_ring_mp_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_sp_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mc_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_sc_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_dequeue_burst_elem_w(struct rte_ring *r, void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available); +unsigned int rte_ring_enqueue_bulk_elem_start_w(struct rte_ring *r, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_enqueue_bulk_start_w(struct rte_ring *r, unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_enqueue_burst_elem_start_w(struct rte_ring *r, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_enqueue_burst_start_w(struct rte_ring *r, unsigned int n, + unsigned int *free_space); +void rte_ring_enqueue_elem_finish_w(struct rte_ring *r, const void *obj_table, + unsigned int esize, unsigned int n); +void rte_ring_enqueue_finish_w(struct rte_ring *r, void *const *obj_table, + unsigned int n); +unsigned int rte_ring_dequeue_bulk_elem_start_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_dequeue_bulk_start_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_dequeue_burst_elem_start_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_dequeue_burst_start_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available); +void rte_ring_dequeue_elem_finish_w(struct rte_ring *r, unsigned int n); +void rte_ring_dequeue_finish_w(struct rte_ring *r, unsigned int n); +unsigned int rte_ring_enqueue_zc_bulk_elem_start_w(struct rte_ring *r, + unsigned int esize, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *free_space); +unsigned int rte_ring_enqueue_zc_bulk_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *free_space); +unsigned int rte_ring_enqueue_zc_burst_elem_start_w( + struct rte_ring *r, unsigned int esize, unsigned int n, + struct rte_ring_zc_data *zcd, unsigned int *free_space); +unsigned int rte_ring_enqueue_zc_burst_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *free_space); +void rte_ring_enqueue_zc_elem_finish_w(struct rte_ring *r, unsigned int n); +void rte_ring_enqueue_zc_finish_w(struct rte_ring *r, unsigned int n); +unsigned int rte_ring_dequeue_zc_bulk_elem_start_w(struct rte_ring *r, + unsigned int esize, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *available); +unsigned int rte_ring_dequeue_zc_bulk_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *available); +unsigned int rte_ring_dequeue_zc_burst_elem_start_w( + struct rte_ring *r, unsigned int esize, unsigned int n, + struct rte_ring_zc_data *zcd, unsigned int *available); +unsigned int rte_ring_dequeue_zc_burst_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *available); +void rte_ring_dequeue_zc_elem_finish_w(struct rte_ring *r, unsigned int n); +void rte_ring_dequeue_zc_finish_w(struct rte_ring *r, unsigned int n); +unsigned int rte_ring_mp_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_sp_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_enqueue_bulk_w(struct rte_ring *r, void *const *obj_table, + unsigned int n, unsigned int *free_space); +int rte_ring_mp_enqueue_w(struct rte_ring *r, void *obj); +int rte_ring_sp_enqueue_w(struct rte_ring *r, void *obj); +int rte_ring_enqueue_w(struct rte_ring *r, void *obj); +unsigned int rte_ring_mc_dequeue_bulk_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_sc_dequeue_bulk_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_dequeue_bulk_w(struct rte_ring *r, void **obj_table, + unsigned int n, unsigned int *available); +int rte_ring_mc_dequeue_w(struct rte_ring *r, void **obj_p); +int rte_ring_sc_dequeue_w(struct rte_ring *r, void **obj_p); +int rte_ring_dequeue_w(struct rte_ring *r, void **obj_p); +unsigned int rte_ring_count_w(const struct rte_ring *r); +unsigned int rte_ring_free_count_w(const struct rte_ring *r); +int rte_ring_full_w(const struct rte_ring *r); +int rte_ring_empty_w(const struct rte_ring *r); +unsigned int rte_ring_get_size_w(const struct rte_ring *r); +unsigned int rte_ring_get_capacity_w(const struct rte_ring *r); +enum rte_ring_sync_type rte_ring_get_prod_sync_type_w(const struct rte_ring *r); +int rte_ring_is_prod_single_w(const struct rte_ring *r); +enum rte_ring_sync_type rte_ring_get_cons_sync_type_w(const struct rte_ring *r); +int rte_ring_is_cons_single_w(const struct rte_ring *r); +unsigned int rte_ring_mp_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_sp_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mc_dequeue_burst_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_sc_dequeue_burst_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_dequeue_burst_w(struct rte_ring *r, void **obj_table, + unsigned int n, unsigned int *available); +void *rte_memcpy_w(void *dst, const void *src, size_t n); +void rte_mov16_w(uint8_t *dst, const uint8_t *src); +void rte_mov32_w(uint8_t *dst, const uint8_t *src); +void rte_mov64_w(uint8_t *dst, const uint8_t *src); +void rte_mov256_w(uint8_t *dst, const uint8_t *src); +struct rte_mempool_objhdr *rte_mempool_get_header_w(void *obj); +struct rte_mempool *rte_mempool_from_obj_w(void *obj); +struct rte_mempool_objtlr *rte_mempool_get_trailer_w(void *obj); +struct rte_mempool_ops *rte_mempool_get_ops_w(int ops_index); +int rte_mempool_ops_dequeue_bulk_w(struct rte_mempool *mp, void **obj_table, + unsigned int n); +int rte_mempool_ops_dequeue_contig_blocks_w(struct rte_mempool *mp, + void **first_obj_table, + unsigned int n); +int rte_mempool_ops_enqueue_bulk_w(struct rte_mempool *mp, + void *const *obj_table, unsigned int n); +struct rte_mempool_cache *rte_mempool_default_cache_w(struct rte_mempool *mp, + unsigned int lcore_id); +void rte_mempool_cache_flush_w(struct rte_mempool_cache *cache, + struct rte_mempool *mp); +void rte_mempool_do_generic_put_w(struct rte_mempool *mp, + void *const *obj_table, unsigned int n, + struct rte_mempool_cache *cache); +void rte_mempool_generic_put_w(struct rte_mempool *mp, void *const *obj_table, + unsigned int n, struct rte_mempool_cache *cache); +void rte_mempool_put_bulk_w(struct rte_mempool *mp, void *const *obj_table, + unsigned int n); +void rte_mempool_put_w(struct rte_mempool *mp, void *obj); +int rte_mempool_do_generic_get_w(struct rte_mempool *mp, void **obj_table, + unsigned int n, + struct rte_mempool_cache *cache); +int rte_mempool_generic_get_w(struct rte_mempool *mp, void **obj_table, + unsigned int n, struct rte_mempool_cache *cache); +int rte_mempool_get_bulk_w(struct rte_mempool *mp, void **obj_table, + unsigned int n); +int rte_mempool_get_w(struct rte_mempool *mp, void **obj_p); +int rte_mempool_get_contig_blocks_w(struct rte_mempool *mp, + void **first_obj_table, unsigned int n); +int rte_mempool_full_w(const struct rte_mempool *mp); +int rte_mempool_empty_w(const struct rte_mempool *mp); +rte_iova_t rte_mempool_virt2iova_w(const void *elt); +void *rte_mempool_get_priv_w(struct rte_mempool *mp); +void rte_prefetch0_w(const void *p); +void rte_prefetch1_w(const void *p); +void rte_prefetch2_w(const void *p); +void rte_prefetch_non_temporal_w(const void *p); +void rte_prefetch0_write_w(const void *p); +void rte_prefetch1_write_w(const void *p); +void rte_prefetch2_write_w(const void *p); +void rte_cldemote_w(const void *p); +uint16_t rte_constant_bswap16_w(uint16_t x); +uint32_t rte_constant_bswap32_w(uint32_t x); +uint64_t rte_constant_bswap64_w(uint64_t x); +void rte_mbuf_prefetch_part1_w(struct rte_mbuf *m); +void rte_mbuf_prefetch_part2_w(struct rte_mbuf *m); +uint16_t rte_pktmbuf_priv_size_w(struct rte_mempool *mp); +rte_iova_t rte_mbuf_iova_get_w(const struct rte_mbuf *m); +void rte_mbuf_iova_set_w(struct rte_mbuf *m, rte_iova_t iova); +rte_iova_t rte_mbuf_data_iova_w(const struct rte_mbuf *mb); +rte_iova_t rte_mbuf_data_iova_default_w(const struct rte_mbuf *mb); +struct rte_mbuf *rte_mbuf_from_indirect_w(struct rte_mbuf *mi); +char *rte_mbuf_buf_addr_w(struct rte_mbuf *mb, struct rte_mempool *mp); +char *rte_mbuf_data_addr_default_w(struct rte_mbuf *mb); +char *rte_mbuf_to_baddr_w(struct rte_mbuf *md); +void *rte_mbuf_to_priv_w(struct rte_mbuf *m); +uint32_t rte_pktmbuf_priv_flags_w(struct rte_mempool *mp); +uint16_t rte_mbuf_refcnt_read_w(const struct rte_mbuf *m); +void rte_mbuf_refcnt_set_w(struct rte_mbuf *m, uint16_t new_value); +uint16_t rte_mbuf_refcnt_update_w(struct rte_mbuf *m, int16_t value); +uint16_t +rte_mbuf_ext_refcnt_read_w(const struct rte_mbuf_ext_shared_info *shinfo); +void rte_mbuf_ext_refcnt_set_w(struct rte_mbuf_ext_shared_info *shinfo, + uint16_t new_value); +uint16_t rte_mbuf_ext_refcnt_update_w(struct rte_mbuf_ext_shared_info *shinfo, + int16_t value); +struct rte_mbuf *rte_mbuf_raw_alloc_w(struct rte_mempool *mp); +void rte_mbuf_raw_free_w(struct rte_mbuf *m); +uint16_t rte_pktmbuf_data_room_size_w(struct rte_mempool *mp); +void rte_pktmbuf_reset_headroom_w(struct rte_mbuf *m); +void rte_pktmbuf_reset_w(struct rte_mbuf *m); +struct rte_mbuf *rte_pktmbuf_alloc_w(struct rte_mempool *mp); +int rte_pktmbuf_alloc_bulk_w(struct rte_mempool *pool, struct rte_mbuf **mbufs, + unsigned int count); +struct rte_mbuf_ext_shared_info * +rte_pktmbuf_ext_shinfo_init_helper_w(void *buf_addr, uint16_t *buf_len, + rte_mbuf_extbuf_free_callback_t free_cb, + void *fcb_opaque); +void rte_pktmbuf_attach_extbuf_w(struct rte_mbuf *m, void *buf_addr, + rte_iova_t buf_iova, uint16_t buf_len, + struct rte_mbuf_ext_shared_info *shinfo); +void rte_mbuf_dynfield_copy_w(struct rte_mbuf *mdst, + const struct rte_mbuf *msrc); +void rte_pktmbuf_attach_w(struct rte_mbuf *mi, struct rte_mbuf *m); +void rte_pktmbuf_detach_w(struct rte_mbuf *m); +struct rte_mbuf *rte_pktmbuf_prefree_seg_w(struct rte_mbuf *m); +void rte_pktmbuf_free_seg_w(struct rte_mbuf *m); +void rte_pktmbuf_free_w(struct rte_mbuf *m); +void rte_pktmbuf_refcnt_update_w(struct rte_mbuf *m, int16_t v); +uint16_t rte_pktmbuf_headroom_w(const struct rte_mbuf *m); +uint16_t rte_pktmbuf_tailroom_w(const struct rte_mbuf *m); +struct rte_mbuf *rte_pktmbuf_lastseg_w(struct rte_mbuf *m); +char *rte_pktmbuf_prepend_w(struct rte_mbuf *m, uint16_t len); +char *rte_pktmbuf_append_w(struct rte_mbuf *m, uint16_t len); +char *rte_pktmbuf_adj_w(struct rte_mbuf *m, uint16_t len); +int rte_pktmbuf_trim_w(struct rte_mbuf *m, uint16_t len); +int rte_pktmbuf_is_contiguous_w(const struct rte_mbuf *m); +const void *rte_pktmbuf_read_w(const struct rte_mbuf *m, uint32_t off, + uint32_t len, void *buf); +int rte_pktmbuf_chain_w(struct rte_mbuf *head, struct rte_mbuf *tail); +uint64_t rte_mbuf_tx_offload_w(uint64_t il2, uint64_t il3, uint64_t il4, + uint64_t tso, uint64_t ol3, uint64_t ol2, + uint64_t unused); +int rte_validate_tx_offload_w(const struct rte_mbuf *m); +int rte_pktmbuf_linearize_w(struct rte_mbuf *mbuf); +uint32_t rte_mbuf_sched_queue_get_w(const struct rte_mbuf *m); +uint8_t rte_mbuf_sched_traffic_class_get_w(const struct rte_mbuf *m); +uint8_t rte_mbuf_sched_color_get_w(const struct rte_mbuf *m); +void rte_mbuf_sched_get_w(const struct rte_mbuf *m, uint32_t *queue_id, + uint8_t *traffic_class, uint8_t *color); +void rte_mbuf_sched_queue_set_w(struct rte_mbuf *m, uint32_t queue_id); +void rte_mbuf_sched_traffic_class_set_w(struct rte_mbuf *m, + uint8_t traffic_class); +void rte_mbuf_sched_color_set_w(struct rte_mbuf *m, uint8_t color); +void rte_mbuf_sched_set_w(struct rte_mbuf *m, uint32_t queue_id, + uint8_t traffic_class, uint8_t color); +int rte_is_same_ether_addr_w(const struct rte_ether_addr *ea1, + const struct rte_ether_addr *ea2); +int rte_is_zero_ether_addr_w(const struct rte_ether_addr *ea); +int rte_is_unicast_ether_addr_w(const struct rte_ether_addr *ea); +int rte_is_multicast_ether_addr_w(const struct rte_ether_addr *ea); +int rte_is_broadcast_ether_addr_w(const struct rte_ether_addr *ea); +int rte_is_universal_ether_addr_w(const struct rte_ether_addr *ea); +int rte_is_local_admin_ether_addr_w(const struct rte_ether_addr *ea); +int rte_is_valid_assigned_ether_addr_w(const struct rte_ether_addr *ea); +void rte_ether_addr_copy_w(const struct rte_ether_addr *ea_from, + struct rte_ether_addr *ea_to); +int rte_vlan_strip_w(struct rte_mbuf *m); +int rte_vlan_insert_w(struct rte_mbuf **m); +uint32_t rte_bitmap_get_memory_footprint_w(uint32_t n_bits); +struct rte_bitmap *rte_bitmap_init_w(uint32_t n_bits, uint8_t *mem, + uint32_t mem_size); +struct rte_bitmap *rte_bitmap_init_with_all_set_w(uint32_t n_bits, uint8_t *mem, + uint32_t mem_size); +void rte_bitmap_free_w(struct rte_bitmap *bmp); +void rte_bitmap_reset_w(struct rte_bitmap *bmp); +void rte_bitmap_prefetch0_w(struct rte_bitmap *bmp, uint32_t pos); +uint64_t rte_bitmap_get_w(struct rte_bitmap *bmp, uint32_t pos); +void rte_bitmap_set_w(struct rte_bitmap *bmp, uint32_t pos); +void rte_bitmap_set_slab_w(struct rte_bitmap *bmp, uint32_t pos, uint64_t slab); +void rte_bitmap_clear_w(struct rte_bitmap *bmp, uint32_t pos); +int rte_bitmap_scan_w(struct rte_bitmap *bmp, uint32_t *pos, uint64_t *slab); +uint16_t rte_raw_cksum_w(const void *buf, size_t len); +int rte_raw_cksum_mbuf_w(const struct rte_mbuf *m, uint32_t off, uint32_t len, + uint16_t *cksum); +uint8_t rte_ipv4_hdr_len_w(const struct rte_ipv4_hdr *ipv4_hdr); +uint16_t rte_ipv4_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr); +uint16_t rte_ipv4_cksum_simple_w(const struct rte_ipv4_hdr *ipv4_hdr); +uint16_t rte_ipv4_phdr_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr, + uint64_t ol_flags); +uint16_t rte_ipv4_udptcp_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr, + const void *l4_hdr); +uint16_t rte_ipv4_udptcp_cksum_mbuf_w(const struct rte_mbuf *m, + const struct rte_ipv4_hdr *ipv4_hdr, + uint16_t l4_off); +int rte_ipv4_udptcp_cksum_verify_w(const struct rte_ipv4_hdr *ipv4_hdr, + const void *l4_hdr); +int rte_ipv4_udptcp_cksum_mbuf_verify_w(const struct rte_mbuf *m, + const struct rte_ipv4_hdr *ipv4_hdr, + uint16_t l4_off); +bool rte_ipv6_addr_eq_w(const struct rte_ipv6_addr *a, + const struct rte_ipv6_addr *b); +void rte_ipv6_addr_mask_w(struct rte_ipv6_addr *ip, uint8_t depth); +bool rte_ipv6_addr_eq_prefix_w(const struct rte_ipv6_addr *a, + const struct rte_ipv6_addr *b, uint8_t depth); +uint8_t rte_ipv6_mask_depth_w(const struct rte_ipv6_addr *mask); +bool rte_ipv6_addr_is_unspec_w(const struct rte_ipv6_addr *ip); +bool rte_ipv6_addr_is_loopback_w(const struct rte_ipv6_addr *ip); +bool rte_ipv6_addr_is_linklocal_w(const struct rte_ipv6_addr *ip); +bool rte_ipv6_addr_is_sitelocal_w(const struct rte_ipv6_addr *ip); +bool rte_ipv6_addr_is_v4compat_w(const struct rte_ipv6_addr *ip); +bool rte_ipv6_addr_is_v4mapped_w(const struct rte_ipv6_addr *ip); +bool rte_ipv6_addr_is_mcast_w(const struct rte_ipv6_addr *ip); +enum rte_ipv6_mc_scope rte_ipv6_mc_scope_w(const struct rte_ipv6_addr *ip); +void rte_ipv6_llocal_from_ethernet_w(struct rte_ipv6_addr *ip, + const struct rte_ether_addr *mac); +void rte_ipv6_solnode_from_addr_w(struct rte_ipv6_addr *sol, + const struct rte_ipv6_addr *ip); +void rte_ether_mcast_from_ipv6_w(struct rte_ether_addr *mac, + const struct rte_ipv6_addr *ip); +int rte_ipv6_check_version_w(const struct rte_ipv6_hdr *ip); +uint16_t rte_ipv6_phdr_cksum_w(const struct rte_ipv6_hdr *ipv6_hdr, + uint64_t ol_flags); +uint16_t rte_ipv6_udptcp_cksum_w(const struct rte_ipv6_hdr *ipv6_hdr, + const void *l4_hdr); +uint16_t rte_ipv6_udptcp_cksum_mbuf_w(const struct rte_mbuf *m, + const struct rte_ipv6_hdr *ipv6_hdr, + uint16_t l4_off); +int rte_ipv6_udptcp_cksum_verify_w(const struct rte_ipv6_hdr *ipv6_hdr, + const void *l4_hdr); +int rte_ipv6_udptcp_cksum_mbuf_verify_w(const struct rte_mbuf *m, + const struct rte_ipv6_hdr *ipv6_hdr, + uint16_t l4_off); +int rte_ipv6_get_next_ext_w(const uint8_t *p, int proto, size_t *ext_len); +enum rte_color +rte_meter_srtcm_color_blind_check_w(struct rte_meter_srtcm *m, + struct rte_meter_srtcm_profile *p, + uint64_t time, uint32_t pkt_len); +enum rte_color rte_meter_srtcm_color_aware_check_w( + struct rte_meter_srtcm *m, struct rte_meter_srtcm_profile *p, uint64_t time, + uint32_t pkt_len, enum rte_color pkt_color); +enum rte_color +rte_meter_trtcm_color_blind_check_w(struct rte_meter_trtcm *m, + struct rte_meter_trtcm_profile *p, + uint64_t time, uint32_t pkt_len); +enum rte_color rte_meter_trtcm_color_aware_check_w( + struct rte_meter_trtcm *m, struct rte_meter_trtcm_profile *p, uint64_t time, + uint32_t pkt_len, enum rte_color pkt_color); +enum rte_color rte_meter_trtcm_rfc4115_color_blind_check_w( + struct rte_meter_trtcm_rfc4115 *m, + struct rte_meter_trtcm_rfc4115_profile *p, uint64_t time, uint32_t pkt_len); +enum rte_color rte_meter_trtcm_rfc4115_color_aware_check_w( + struct rte_meter_trtcm_rfc4115 *m, + struct rte_meter_trtcm_rfc4115_profile *p, uint64_t time, uint32_t pkt_len, + enum rte_color pkt_color); +uint64_t rte_eth_rss_hf_refine_w(uint64_t rss_hf); +uint16_t rte_eth_rx_burst_w(uint16_t port_id, uint16_t queue_id, + struct rte_mbuf **rx_pkts, const uint16_t nb_pkts); +int rte_eth_rx_queue_count_w(uint16_t port_id, uint16_t queue_id); +int rte_eth_rx_descriptor_status_w(uint16_t port_id, uint16_t queue_id, + uint16_t offset); +int rte_eth_tx_descriptor_status_w(uint16_t port_id, uint16_t queue_id, + uint16_t offset); +uint16_t rte_eth_tx_burst_w(uint16_t port_id, uint16_t queue_id, + struct rte_mbuf **tx_pkts, uint16_t nb_pkts); +uint16_t rte_eth_tx_prepare_w(uint16_t port_id, uint16_t queue_id, + struct rte_mbuf **tx_pkts, uint16_t nb_pkts); +uint16_t rte_eth_tx_buffer_flush_w(uint16_t port_id, uint16_t queue_id, + struct rte_eth_dev_tx_buffer *buffer); +uint16_t rte_eth_tx_buffer_w(uint16_t port_id, uint16_t queue_id, + struct rte_eth_dev_tx_buffer *buffer, + struct rte_mbuf *tx_pkt); +uint16_t +rte_eth_recycle_mbufs_w(uint16_t rx_port_id, uint16_t rx_queue_id, + uint16_t tx_port_id, uint16_t tx_queue_id, + struct rte_eth_recycle_rxq_info *recycle_rxq_info); +int rte_eth_tx_queue_count_w(uint16_t port_id, uint16_t queue_id); +uint32_t rte_flow_dynf_metadata_get_w(struct rte_mbuf *m); +void rte_flow_dynf_metadata_set_w(struct rte_mbuf *m, uint32_t v); +int rte_flow_dynf_metadata_avail_w(void); +uint32_t rte_hash_crc_1byte_w(uint8_t data, uint32_t init_val); +uint32_t rte_hash_crc_2byte_w(uint16_t data, uint32_t init_val); +uint32_t rte_hash_crc_4byte_w(uint32_t data, uint32_t init_val); +uint32_t rte_hash_crc_8byte_w(uint64_t data, uint32_t init_val); +uint32_t rte_hash_crc_w(const void *data, uint32_t data_len, uint32_t init_val); +void rte_jhash_2hashes_w(const void *key, uint32_t length, uint32_t *pc, + uint32_t *pb); +void rte_jhash_32b_2hashes_w(const uint32_t *k, uint32_t length, uint32_t *pc, + uint32_t *pb); +uint32_t rte_jhash_w(const void *key, uint32_t length, uint32_t initval); +uint32_t rte_jhash_32b_w(const uint32_t *k, uint32_t length, uint32_t initval); +uint32_t rte_jhash_3words_w(uint32_t a, uint32_t b, uint32_t c, + uint32_t initval); +uint32_t rte_jhash_2words_w(uint32_t a, uint32_t b, uint32_t initval); +uint32_t rte_jhash_1word_w(uint32_t a, uint32_t initval); +uint32_t rte_fbk_hash_get_bucket_w(const struct rte_fbk_hash_table *ht, + uint32_t key); +int rte_fbk_hash_add_key_with_bucket_w(struct rte_fbk_hash_table *ht, + uint32_t key, uint16_t value, + uint32_t bucket); +int rte_fbk_hash_add_key_w(struct rte_fbk_hash_table *ht, uint32_t key, + uint16_t value); +int rte_fbk_hash_delete_key_with_bucket_w(struct rte_fbk_hash_table *ht, + uint32_t key, uint32_t bucket); +int rte_fbk_hash_delete_key_w(struct rte_fbk_hash_table *ht, uint32_t key); +int rte_fbk_hash_lookup_with_bucket_w(const struct rte_fbk_hash_table *ht, + uint32_t key, uint32_t bucket); +int rte_fbk_hash_lookup_w(const struct rte_fbk_hash_table *ht, uint32_t key); +void rte_fbk_hash_clear_all_w(struct rte_fbk_hash_table *ht); +double rte_fbk_hash_get_load_factor_w(struct rte_fbk_hash_table *ht); +void rte_rcu_qsbr_thread_online_w(struct rte_rcu_qsbr *v, + unsigned int thread_id); +void rte_rcu_qsbr_thread_offline_w(struct rte_rcu_qsbr *v, + unsigned int thread_id); +void rte_rcu_qsbr_lock_w(struct rte_rcu_qsbr *v, unsigned int thread_id); +void rte_rcu_qsbr_unlock_w(struct rte_rcu_qsbr *v, unsigned int thread_id); +uint64_t rte_rcu_qsbr_start_w(struct rte_rcu_qsbr *v); +void rte_rcu_qsbr_quiescent_w(struct rte_rcu_qsbr *v, unsigned int thread_id); +int rte_rcu_qsbr_check_w(struct rte_rcu_qsbr *v, uint64_t t, bool wait); +uint8_t rte_read8_relaxed_w(const void *addr); +uint16_t rte_read16_relaxed_w(const void *addr); +uint32_t rte_read32_relaxed_w(const void *addr); +uint64_t rte_read64_relaxed_w(const void *addr); +void rte_write8_relaxed_w(uint8_t value, void *addr); +void rte_write16_relaxed_w(uint16_t value, void *addr); +void rte_write32_relaxed_w(uint32_t value, void *addr); +void rte_write64_relaxed_w(uint64_t value, void *addr); +uint8_t rte_read8_w(const void *addr); +uint16_t rte_read16_w(const void *addr); +uint32_t rte_read32_w(const void *addr); +uint64_t rte_read64_w(const void *addr); +void rte_write8_w(uint8_t value, void *addr); +void rte_write16_w(uint16_t value, void *addr); +void rte_write32_w(uint32_t value, void *addr); +void rte_write64_w(uint64_t value, void *addr); +void rte_write32_wc_relaxed_w(uint32_t value, void *addr); +void rte_write32_wc_w(uint32_t value, void *addr); +void rte_mcslock_lock_w(rte_mcslock_t **msl, rte_mcslock_t *me); +void rte_mcslock_unlock_w(rte_mcslock_t **msl, rte_mcslock_t *me); +int rte_mcslock_trylock_w(rte_mcslock_t **msl, rte_mcslock_t *me); +int rte_mcslock_is_locked_w(rte_mcslock_t *msl); +void rte_pflock_init_w(struct rte_pflock *pf); +void rte_pflock_read_lock_w(rte_pflock_t *pf); +void rte_pflock_read_unlock_w(rte_pflock_t *pf); +void rte_pflock_write_lock_w(rte_pflock_t *pf); +void rte_pflock_write_unlock_w(rte_pflock_t *pf); +uint32_t rte_reciprocal_divide_w(uint32_t a, struct rte_reciprocal R); +uint64_t rte_reciprocal_divide_u64_w(uint64_t a, + const struct rte_reciprocal_u64 *R); +void rte_seqcount_init_w(rte_seqcount_t *seqcount); +uint32_t rte_seqcount_read_begin_w(const rte_seqcount_t *seqcount); +bool rte_seqcount_read_retry_w(const rte_seqcount_t *seqcount, + uint32_t begin_sn); +void rte_seqcount_write_begin_w(rte_seqcount_t *seqcount); +void rte_seqcount_write_end_w(rte_seqcount_t *seqcount); +void rte_seqlock_init_w(rte_seqlock_t *seqlock); +uint32_t rte_seqlock_read_begin_w(const rte_seqlock_t *seqlock); +bool rte_seqlock_read_retry_w(const rte_seqlock_t *seqlock, uint32_t begin_sn); +void rte_seqlock_write_lock_w(rte_seqlock_t *seqlock); +void rte_seqlock_write_unlock_w(rte_seqlock_t *seqlock); +unsigned int rte_stack_push_w(struct rte_stack *s, void *const *obj_table, + unsigned int n); +unsigned int rte_stack_pop_w(struct rte_stack *s, void **obj_table, + unsigned int n); +unsigned int rte_stack_count_w(struct rte_stack *s); +unsigned int rte_stack_free_count_w(struct rte_stack *s); +uint32_t rte_softrss_w(uint32_t *input_tuple, uint32_t input_len, + const uint8_t *rss_key); +uint32_t rte_softrss_be_w(uint32_t *input_tuple, uint32_t input_len, + const uint8_t *rss_key); +void rte_ticketlock_init_w(rte_ticketlock_t *tl); +void rte_ticketlock_lock_w(rte_ticketlock_t *tl); +void rte_ticketlock_unlock_w(rte_ticketlock_t *tl); +int rte_ticketlock_trylock_w(rte_ticketlock_t *tl); +int rte_ticketlock_is_locked_w(rte_ticketlock_t *tl); +void rte_ticketlock_recursive_init_w(rte_ticketlock_recursive_t *tlr); +void rte_ticketlock_recursive_lock_w(rte_ticketlock_recursive_t *tlr); +void rte_ticketlock_recursive_unlock_w(rte_ticketlock_recursive_t *tlr); +int rte_ticketlock_recursive_trylock_w(rte_ticketlock_recursive_t *tlr); +uint64_t rte_cyclecounter_cycles_to_ns_w(struct rte_timecounter *tc, + uint64_t cycles); +uint64_t rte_timecounter_update_w(struct rte_timecounter *tc, + uint64_t cycle_now); +uint64_t rte_timespec_to_ns_w(const struct timespec *ts); +struct timespec rte_ns_to_timespec_w(uint64_t nsec); +bool rte_trace_feature_is_enabled_w(void); diff --git a/dpdk/build.rs b/dpdk/build.rs index 9d7c9069b..1c30f3c66 100644 --- a/dpdk/build.rs +++ b/dpdk/build.rs @@ -2,7 +2,7 @@ // Copyright Open Network Fabric Authors fn main() { - let sysroot = dpdk_sysroot_helper::get_sysroot(); - println!("cargo:rustc-link-search=all={sysroot}/lib"); + // let sysroot = dpdk_sysroot_helper::get_sysroot(); + // println!("cargo:rustc-link-search=all={sysroot}/lib"); // println!("cargo:rustc-link-arg=--sysroot={sysroot}"); } diff --git a/hardware/Cargo.toml b/hardware/Cargo.toml index 7d4fbf476..b4f469ce1 100644 --- a/hardware/Cargo.toml +++ b/hardware/Cargo.toml @@ -36,9 +36,9 @@ tracing = { workspace = true, features = ["std"] } [dev-dependencies] # internal -fixin = { workspace = true, features = [] } +# fixin = { workspace = true, features = [] } id = { workspace = true, features = ["serde", "rkyv"] } -n-vm = { workspace = true } +# n-vm = { workspace = true } test-utils = { workspace = true, features = [] } # external diff --git a/hardware/build.rs b/hardware/build.rs index 9d7c9069b..1c30f3c66 100644 --- a/hardware/build.rs +++ b/hardware/build.rs @@ -2,7 +2,7 @@ // Copyright Open Network Fabric Authors fn main() { - let sysroot = dpdk_sysroot_helper::get_sysroot(); - println!("cargo:rustc-link-search=all={sysroot}/lib"); + // let sysroot = dpdk_sysroot_helper::get_sysroot(); + // println!("cargo:rustc-link-search=all={sysroot}/lib"); // println!("cargo:rustc-link-arg=--sysroot={sysroot}"); } diff --git a/hardware/src/scan.rs b/hardware/src/scan.rs index ef8899164..1e20b49a9 100644 --- a/hardware/src/scan.rs +++ b/hardware/src/scan.rs @@ -225,82 +225,82 @@ mod test { support::{SupportedDevice, SupportedVendor}, }; - #[test] - #[n_vm::in_vm] - fn collect_them_all_and_bind_them() { - let system = Node::scan_all(); - let nics: Vec<_> = system - .iter() - .filter_map(|node| match node.attributes() { - Some(NodeAttributes::Pci(dev)) => { - if dev.vendor_id() == SupportedVendor::RedHat.vendor_id() - && SupportedDevice::VirtioNet - .device_ids() - .contains(&dev.device_id()) - { - let mut nic = PciNic::new(dev.address()).unwrap(); - nic.bind_to_vfio_pci().unwrap(); - Some(nic) - } else { - None - } - } - _ => None, - }) - .collect(); - assert_eq!(nics.len(), 3, "expected exactly 3 virtio network cards"); - } + // #[test] + // #[n_vm::in_vm] + // fn collect_them_all_and_bind_them() { + // let system = Node::scan_all(); + // let nics: Vec<_> = system + // .iter() + // .filter_map(|node| match node.attributes() { + // Some(NodeAttributes::Pci(dev)) => { + // if dev.vendor_id() == SupportedVendor::RedHat.vendor_id() + // && SupportedDevice::VirtioNet + // .device_ids() + // .contains(&dev.device_id()) + // { + // let mut nic = PciNic::new(dev.address()).unwrap(); + // nic.bind_to_vfio_pci().unwrap(); + // Some(nic) + // } else { + // None + // } + // } + // _ => None, + // }) + // .collect(); + // assert_eq!(nics.len(), 3, "expected exactly 3 virtio network cards"); + // } - #[test] - #[n_vm::in_vm] - fn bind_fabric_nics_and_skip_mgmt_nic() { - let system = Node::scan_all(); - let mgmt_nic_pci_address = "0000:00:02.0".try_into().unwrap(); - let nics: Vec<_> = system - .iter() - .filter_map(|node| match node.attributes() { - Some(NodeAttributes::Pci(dev)) => { - if dev.vendor_id() == SupportedVendor::RedHat.vendor_id() - && SupportedDevice::VirtioNet - .device_ids() - .contains(&dev.device_id()) - && dev.address() != mgmt_nic_pci_address - { - let mut nic = PciNic::new(dev.address()).unwrap(); - nic.bind_to_vfio_pci().unwrap(); - Some(nic) - } else { - None - } - } - _ => None, - }) - .collect(); - assert_eq!(nics.len(), 2, "expected exactly 2 virtio network cards"); - } + // #[test] + // #[n_vm::in_vm] + // fn bind_fabric_nics_and_skip_mgmt_nic() { + // let system = Node::scan_all(); + // let mgmt_nic_pci_address = "0000:00:02.0".try_into().unwrap(); + // let nics: Vec<_> = system + // .iter() + // .filter_map(|node| match node.attributes() { + // Some(NodeAttributes::Pci(dev)) => { + // if dev.vendor_id() == SupportedVendor::RedHat.vendor_id() + // && SupportedDevice::VirtioNet + // .device_ids() + // .contains(&dev.device_id()) + // && dev.address() != mgmt_nic_pci_address + // { + // let mut nic = PciNic::new(dev.address()).unwrap(); + // nic.bind_to_vfio_pci().unwrap(); + // Some(nic) + // } else { + // None + // } + // } + // _ => None, + // }) + // .collect(); + // assert_eq!(nics.len(), 2, "expected exactly 2 virtio network cards"); + // } - #[test] - #[n_vm::in_vm] - fn bind_nic_test() { - let system = Node::scan_all(); - let target_pci_address = "0001:00:02.0".try_into().unwrap(); - let Some(mut nic) = system.iter().find_map(|node| match node.attributes() { - Some(NodeAttributes::Pci(dev)) => { - if dev.address() == target_pci_address - && dev.vendor_id() == SupportedVendor::RedHat.vendor_id() - && SupportedDevice::VirtioNet - .device_ids() - .contains(&dev.device_id()) - { - Some(PciNic::new(dev.address()).unwrap()) - } else { - None - } - } - _ => None, - }) else { - panic!("target nic not found"); - }; - nic.bind_to_vfio_pci().unwrap(); - } + // #[test] + // #[n_vm::in_vm] + // fn bind_nic_test() { + // let system = Node::scan_all(); + // let target_pci_address = "0001:00:02.0".try_into().unwrap(); + // let Some(mut nic) = system.iter().find_map(|node| match node.attributes() { + // Some(NodeAttributes::Pci(dev)) => { + // if dev.address() == target_pci_address + // && dev.vendor_id() == SupportedVendor::RedHat.vendor_id() + // && SupportedDevice::VirtioNet + // .device_ids() + // .contains(&dev.device_id()) + // { + // Some(PciNic::new(dev.address()).unwrap()) + // } else { + // None + // } + // } + // _ => None, + // }) else { + // panic!("target nic not found"); + // }; + // nic.bind_to_vfio_pci().unwrap(); + // } } diff --git a/init/build.rs b/init/build.rs index 9d7c9069b..1c30f3c66 100644 --- a/init/build.rs +++ b/init/build.rs @@ -2,7 +2,7 @@ // Copyright Open Network Fabric Authors fn main() { - let sysroot = dpdk_sysroot_helper::get_sysroot(); - println!("cargo:rustc-link-search=all={sysroot}/lib"); + // let sysroot = dpdk_sysroot_helper::get_sysroot(); + // println!("cargo:rustc-link-search=all={sysroot}/lib"); // println!("cargo:rustc-link-arg=--sysroot={sysroot}"); } diff --git a/nix/overlays/dataplane-dev.nix b/nix/overlays/dataplane-dev.nix new file mode 100644 index 000000000..b2c3c3d09 --- /dev/null +++ b/nix/overlays/dataplane-dev.nix @@ -0,0 +1,27 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright Open Network Fabric Authors +{ + sources, +}: +let + fenix = import sources.fenix { }; + rust-toolchain = fenix.fromToolchainFile { + file = ../../rust-toolchain.toml; + sha256 = (builtins.fromJSON (builtins.readFile ../.rust-toolchain.manifest-lock.json)).hash.sha256; + }; +in +final: prev: { + # llvmPackages = final.llvmPackages_21; + + # # TODO: doc this + # rustPlatform = final.makeRustPlatform { + # stdenv = final.llvmPackages.stdenv; + # cargo = rust-toolchain; + # rustc = rust-toolchain; + # }; + + kopium = import ../pkgs/kopium { + src = sources.kopium; + inherit (final) rustPlatform; + }; +} diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index 424f244a6..effb3f55c 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -253,6 +253,9 @@ in # This isn't directly required by dataplane, perftest = dataplane-dep (final.callPackage ../pkgs/perftest { src = sources.perftest; }); + inherit rust-toolchain; + cargo = rust-toolchain; + rustc = rust-toolchain; # TODO: doc this rustPlatform = final.makeRustPlatform { stdenv = stdenv'; diff --git a/nix/pkgs/kopium/default.nix b/nix/pkgs/kopium/default.nix new file mode 100644 index 000000000..6b3e2bf56 --- /dev/null +++ b/nix/pkgs/kopium/default.nix @@ -0,0 +1,11 @@ +{ + src, + rustPlatform, +}: +rustPlatform.buildRustPackage (final: { + pname = "kopium"; + version = src.version; + src = src.outPath; + cargoLock.lockFile = "${final.src}/Cargo.lock"; + doCheck = false; +}) diff --git a/nix/pkgs/perftest/default.nix b/nix/pkgs/perftest/default.nix new file mode 100644 index 000000000..0bc0ee783 --- /dev/null +++ b/nix/pkgs/perftest/default.nix @@ -0,0 +1,19 @@ +{ + src, + stdenv, + rdma-core, + autoreconfHook, + pciutils, +}: +stdenv.mkDerivation (final: { + pname = "perftest"; + version = src.version; + src = src.outPath; + nativeBuildInputs = [ + autoreconfHook + ]; + buildInputs = [ + pciutils + rdma-core + ]; +}) diff --git a/nix/profiles.nix b/nix/profiles.nix index eaa14c67f..0c9d1f8a9 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -8,7 +8,7 @@ }: let common.NIX_CFLAGS_COMPILE = [ - "-glldb" + "-g3" "-gdwarf-5" # odr or strict-aliasing violations are indicative of LTO incompatibility, so check for that "-Werror=odr" diff --git a/npins/sources.json b/npins/sources.json index 0fa1f6258..ba31a0c91 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -1,5 +1,21 @@ { "pins": { + "crane": { + "type": "GitRelease", + "repository": { + "type": "GitHub", + "owner": "ipetkov", + "repo": "crane" + }, + "pre_releases": false, + "version_upper_bound": null, + "release_prefix": null, + "submodules": false, + "version": "v0.21.3", + "revision": "4a7cf504d83f7d0460f9cf28fe6cbaa5fb856034", + "url": "https://api.github.com/repos/ipetkov/crane/tarball/v0.21.3", + "hash": "1a27r58apm5arxyydn78j9yz0aa7d20v4ai688d23lbivfs0jaa5" + }, "dpdk": { "type": "Git", "repository": { @@ -34,6 +50,19 @@ "url": "https://api.github.com/repos/kube-rs/kopium/tarball/0.22.5", "hash": "14lr2qgfh50rlpw5wgy6cw1qvkz44bwwx06srlks243hgkw9p2fd" }, + "naersk": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "nix-community", + "repo": "naersk" + }, + "branch": "master", + "submodules": false, + "revision": "d4155d6ebb70fbe2314959842f744aa7cabbbf6a", + "url": "https://github.com/nix-community/naersk/archive/d4155d6ebb70fbe2314959842f744aa7cabbbf6a.tar.gz", + "hash": "1pmj1d3xp3fjz8m3msvmh8jnylwmgk76iah9qnfs8ddgwlij1v5g" + }, "nixpkgs": { "type": "Channel", "name": "nixpkgs-unstable", diff --git a/sysfs/Cargo.toml b/sysfs/Cargo.toml index 5638e18ef..ab301ec3f 100644 --- a/sysfs/Cargo.toml +++ b/sysfs/Cargo.toml @@ -20,7 +20,7 @@ tracing-subscriber = { workspace = true, features = ["fmt"] } [dev-dependencies] # internal -n-vm = { workspace = true } +# n-vm = { workspace = true } # external diff --git a/sysfs/build.rs b/sysfs/build.rs index 9d7c9069b..1c30f3c66 100644 --- a/sysfs/build.rs +++ b/sysfs/build.rs @@ -2,7 +2,7 @@ // Copyright Open Network Fabric Authors fn main() { - let sysroot = dpdk_sysroot_helper::get_sysroot(); - println!("cargo:rustc-link-search=all={sysroot}/lib"); + // let sysroot = dpdk_sysroot_helper::get_sysroot(); + // println!("cargo:rustc-link-search=all={sysroot}/lib"); // println!("cargo:rustc-link-arg=--sysroot={sysroot}"); } From 576a97ba8ffb15173269f64e50a7bec5d5d5fe56 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 22 Dec 2025 22:53:57 +0000 Subject: [PATCH 071/163] fix rust build --- default.nix | 10 ++++++++-- nix/overlays/dataplane-dev.nix | 30 +++++++++++++++++++----------- nix/overlays/dataplane.nix | 17 ++++++++++------- npins/sources.json | 4 ++-- 4 files changed, 39 insertions(+), 22 deletions(-) diff --git a/default.nix b/default.nix index e4823a42a..2c832bfd9 100644 --- a/default.nix +++ b/default.nix @@ -75,6 +75,8 @@ let executable = false; destination = "/.clangd"; }; + crane = import sources.crane { }; + craneLib = crane.craneLib.overrideToolchain dataplane-pkgs.rust-toolchain; dev-tools = dataplane-pkgs.symlinkJoin { name = "dataplane-dev-shell"; paths = [ @@ -98,8 +100,6 @@ let npins ]); }; - # crane = import sources.crane { pkgs = dataplane-dev-pkgs; }; - crane = import sources.crane { }; dataplane-src = crane.cleanCargoSource ./.; # Common arguments can be set here to avoid repeating them later @@ -264,6 +264,12 @@ in ; platform = platform'; x = builtins.attrNames crane; + y = { + lib = { + x = (builtins.attrNames crane.craneLib); + }; + }; + z = dataplane-pkgs.runCommand "ls" { } "echo potato > $out"; # y = crane.buildPackage } diff --git a/nix/overlays/dataplane-dev.nix b/nix/overlays/dataplane-dev.nix index b2c3c3d09..46ae9fbef 100644 --- a/nix/overlays/dataplane-dev.nix +++ b/nix/overlays/dataplane-dev.nix @@ -10,18 +10,26 @@ let sha256 = (builtins.fromJSON (builtins.readFile ../.rust-toolchain.manifest-lock.json)).hash.sha256; }; in -final: prev: { - # llvmPackages = final.llvmPackages_21; - - # # TODO: doc this - # rustPlatform = final.makeRustPlatform { - # stdenv = final.llvmPackages.stdenv; - # cargo = rust-toolchain; - # rustc = rust-toolchain; - # }; - +final: prev: +let + rustPlatform = final.makeRustPlatform { + stdenv = final.llvmPackages.stdenv; + cargo = rust-toolchain; + rustc = rust-toolchain; + }; +in +{ + inherit rust-toolchain rustPlatform; + llvmPackages = final.llvmPackages_21; kopium = import ../pkgs/kopium { src = sources.kopium; - inherit (final) rustPlatform; + inherit rustPlatform; }; + cargo-bolero = prev.cargo-bolero.override { inherit rustPlatform; }; + cargo-deny = prev.cargo-deny.override { inherit rustPlatform; }; + cargo-pciutils = prev.cargo-deny.override { inherit rustPlatform; }; + cargo-llvm-cov = prev.cargo-deny.override { inherit rustPlatform; }; + cargo-nextest = prev.cargo-deny.override { inherit rustPlatform; }; + just = prev.cargo-deny.override { inherit rustPlatform; }; + npins = prev.cargo-deny.override { inherit rustPlatform; }; } diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index effb3f55c..0faab2ea6 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -254,12 +254,15 @@ in perftest = dataplane-dep (final.callPackage ../pkgs/perftest { src = sources.perftest; }); inherit rust-toolchain; - cargo = rust-toolchain; - rustc = rust-toolchain; - # TODO: doc this - rustPlatform = final.makeRustPlatform { - stdenv = stdenv'; - cargo = rust-toolchain; - rustc = rust-toolchain; + + rustPlatform' = final.makeRustPlatform { + stdenv = final.llvmPackages.stdenv; + cargo = final.rust-toolchain; + rustc = final.rust-toolchain; + }; + + kopium = import ../pkgs/kopium { + src = sources.kopium; + rustPlatform = final.rustPlatform'; }; } diff --git a/npins/sources.json b/npins/sources.json index ba31a0c91..bada50e49 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -66,8 +66,8 @@ "nixpkgs": { "type": "Channel", "name": "nixpkgs-unstable", - "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.05pre913981.7d853e518814/nixexprs.tar.xz", - "hash": "1cpg513zly625rw05kbz1hvfiqcrwbd71c1bqhp61sh6ng8ifg4c" + "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.05pre914780.306ea70f9eb0/nixexprs.tar.xz", + "hash": "1xx42m8amnda6z8nbm2ksv0plpzcdqxzymb1qqnp0xnf0k2bz2d1" }, "perftest": { "type": "GitRelease", From 8d7fc0c32296ca3831870c3ddf24572eaa1a1462 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Tue, 23 Dec 2025 05:17:58 +0000 Subject: [PATCH 072/163] dataplane now builds, but need to undo lots of hacks --- .cargo/config.toml | 11 ++++-- Cargo.lock | 70 ---------------------------------- default.nix | 37 +++++++----------- k8s-intf/Cargo.toml | 4 +- k8s-intf/build.rs | 66 +++++++++++++------------------- nix/overlays/dataplane-dev.nix | 28 +++++++++----- nix/overlays/dataplane.nix | 22 +++-------- nix/overlays/default.nix | 4 ++ nix/overlays/llvm.nix | 36 +++++++++++++++++ npins/sources.json | 29 ++++++++++---- rust-toolchain.toml | 39 ++++++++++--------- 11 files changed, 154 insertions(+), 192 deletions(-) create mode 100644 nix/overlays/llvm.nix diff --git a/.cargo/config.toml b/.cargo/config.toml index 02340991f..33ead06f2 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,8 +1,11 @@ [env] -COMPILE_ENV = { value = "sysroot", relative = true, force = false } -#PATH = { value = "compile-env/bin", relative = true, force = true } -#LIBCLANG_PATH = { value = "compile-env/lib", relative = true, force = true } -# PKG_CONFIG_PATH = { value = "compile-env/sysroot/x86_64-unknown-linux-gnu/release/lib/pkgconfig", relative = true, force = true } +# COMPILE_ENV = { value = "sysroot", relative = true, force = false } +# PATH = { value = "compile-env/bin", relative = true, force = true } +LIBCLANG_PATH = { value = "compile-env/lib", relative = true, force = false } +PKG_CONFIG_PATH = { value = "compile-env/sysroot/x86_64-unknown-linux-gnu/release/lib/pkgconfig", relative = true, force = false } +LIBRARY_PATH = { value = "sysroot/lib", relative = true, force = false } +C_INCLUDE_PATH = { value = "sysroot/include", relative = true, force = false } +GW_CRD_PATH = { value = "devroot/src/gateway/config/crd/bases", relative = true, force = false } [build] target = "x86_64-unknown-linux-gnu" diff --git a/Cargo.lock b/Cargo.lock index 6c1a1190e..c08192f84 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1404,7 +1404,6 @@ dependencies = [ "dataplane-lpm", "dataplane-net", "dataplane-tracectl", - "dotenvy", "futures", "k8s-openapi", "kube", @@ -1417,7 +1416,6 @@ dependencies = [ "thiserror 2.0.17", "tokio", "tracing", - "ureq", ] [[package]] @@ -1887,12 +1885,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "dotenvy" -version = "0.15.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" - [[package]] name = "downcast-rs" version = "2.0.2" @@ -2104,16 +2096,6 @@ dependencies = [ "syn 2.0.111", ] -[[package]] -name = "flate2" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb" -dependencies = [ - "crc32fast", - "miniz_oxide", -] - [[package]] name = "fnv" version = "1.0.7" @@ -3383,7 +3365,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" dependencies = [ "adler2", - "simd-adler32", ] [[package]] @@ -4587,7 +4568,6 @@ dependencies = [ "aws-lc-rs", "log", "once_cell", - "ring", "rustls-pki-types", "rustls-webpki", "subtle", @@ -5021,12 +5001,6 @@ dependencies = [ "libc 0.2.178", ] -[[package]] -name = "simd-adler32" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2" - [[package]] name = "simdutf8" version = "0.1.5" @@ -5834,35 +5808,6 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" -[[package]] -name = "ureq" -version = "3.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d39cb1dbab692d82a977c0392ffac19e188bd9186a9f32806f0aaa859d75585a" -dependencies = [ - "base64 0.22.1", - "flate2", - "log", - "percent-encoding", - "rustls", - "rustls-pki-types", - "ureq-proto", - "utf-8", - "webpki-roots", -] - -[[package]] -name = "ureq-proto" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d81f9efa9df032be5934a46a068815a10a042b494b6a58cb0a1a97bb5467ed6f" -dependencies = [ - "base64 0.22.1", - "http 1.4.0", - "httparse", - "log", -] - [[package]] name = "url" version = "2.5.7" @@ -5875,12 +5820,6 @@ dependencies = [ "serde", ] -[[package]] -name = "utf-8" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" - [[package]] name = "utf8_iter" version = "1.0.4" @@ -6047,15 +5986,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "webpki-roots" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2878ef029c47c6e8cf779119f20fcf52bde7ad42a731b2a304bc221df17571e" -dependencies = [ - "rustls-pki-types", -] - [[package]] name = "winapi" version = "0.3.9" diff --git a/default.nix b/default.nix index 2c832bfd9..7e15c105b 100644 --- a/default.nix +++ b/default.nix @@ -32,12 +32,14 @@ let }; dataplane-dev-pkgs = import sources.nixpkgs { overlays = [ + overlays.llvm overlays.dataplane-dev ]; }; dataplane-pkgs = (import sources.nixpkgs { overlays = [ + overlays.llvm overlays.dataplane ]; }).pkgsCross.${platform'.info.nixarch}; @@ -75,8 +77,8 @@ let executable = false; destination = "/.clangd"; }; - crane = import sources.crane { }; - craneLib = crane.craneLib.overrideToolchain dataplane-pkgs.rust-toolchain; + crane-base = import sources.crane { }; + crane = crane-base.craneLib.overrideToolchain dataplane-dev-pkgs.rust-toolchain; dev-tools = dataplane-pkgs.symlinkJoin { name = "dataplane-dev-shell"; paths = [ @@ -96,6 +98,7 @@ let cargo-llvm-cov cargo-nextest direnv + gateway-crd just npins ]); @@ -116,6 +119,14 @@ let dataplane-pkgs.hwloc ]; + env = { + LIBCLANG_PATH = "${dataplane-pkgs.llvmPackages.libclang.lib}/lib"; + C_INCLUDE_PATH = "${sysroot}/include"; + LIBRARY_PATH = "${sysroot}/lib"; + PKG_CONFIG_PATH = "${sysroot}/lib/pkgconfig"; + GW_CRD_PATH = "${dataplane-dev-pkgs.gateway-crd}/src/gateway/config/crd/bases"; + }; + # Additional environment variables can be set directly # MY_CUSTOM_VAR = "some value"; }; @@ -136,11 +147,6 @@ let root = ./.; fileset = lib.fileset.unions [ ./. - ./Cargo.toml - ./Cargo.lock - # (crane.fileset.commonCargoSources ./crates/my-common) - # (crane.fileset.commonCargoSources ./crates/my-workspace-hack) - (crane.fileset.commonCargoSources crate) ]; }; rekon = crane.buildPackage ( @@ -181,11 +187,6 @@ let pname = "dataplane-dpdk-sys"; cargoExtraArgs = "--package dataplane-dpdk-sys"; src = fileSetForCrate ./dpdk-sys; - env = { - LIBCLANG_PATH = "${dataplane-pkgs.llvmPackages.libclang.lib}/lib"; - C_INCLUDE_PATH = "${dataplane-pkgs.dpdk.dev}/include:${dataplane-pkgs.libbsd.dev}/include:${dataplane-pkgs.stdenv'.cc.libc.dev}/include"; - LIBRARY_PATH = "${sysroot}/lib"; - }; nativeBuildInputs = [ dataplane-pkgs.pkg-config dataplane-pkgs.llvmPackages.libclang.lib @@ -203,11 +204,6 @@ let pname = "dataplane-dpdk"; cargoExtraArgs = "--package dataplane-dpdk"; src = fileSetForCrate ./dpdk; - env = { - LIBCLANG_PATH = "${dataplane-pkgs.llvmPackages.libclang.lib}/lib"; - C_INCLUDE_PATH = "${dataplane-pkgs.dpdk.dev}/include:${dataplane-pkgs.libbsd.dev}/include:${dataplane-pkgs.stdenv'.cc.libc.dev}/include"; - LIBRARY_PATH = "${sysroot}/lib"; - }; nativeBuildInputs = [ dataplane-pkgs.pkg-config dataplane-pkgs.llvmPackages.libclang.lib @@ -225,16 +221,12 @@ let pname = "dataplane"; cargoExtraArgs = "--package dataplane"; src = fileSetForCrate ./dataplane; - env = { - LIBCLANG_PATH = "${dataplane-pkgs.llvmPackages.libclang.lib}/lib"; - C_INCLUDE_PATH = "${dataplane-pkgs.dpdk.dev}/include:${dataplane-pkgs.libbsd.dev}/include:${dataplane-pkgs.stdenv'.cc.libc.dev}/include"; - LIBRARY_PATH = "${sysroot}/lib"; - }; nativeBuildInputs = [ dataplane-pkgs.pkg-config dataplane-pkgs.llvmPackages.libclang.lib dataplane-pkgs.llvmPackages.clang dataplane-pkgs.llvmPackages.lld + dataplane-dev-pkgs.kopium ]; buildInputs = [ sysroot @@ -269,7 +261,6 @@ in x = (builtins.attrNames crane.craneLib); }; }; - z = dataplane-pkgs.runCommand "ls" { } "echo potato > $out"; # y = crane.buildPackage } diff --git a/k8s-intf/Cargo.toml b/k8s-intf/Cargo.toml index a3efed406..73d542f03 100644 --- a/k8s-intf/Cargo.toml +++ b/k8s-intf/Cargo.toml @@ -37,5 +37,5 @@ lpm = { workspace = true, features = [] } net = { workspace = true, features = ["bolero", "test_buffer"] } [build-dependencies] -dotenvy = { workspace = true, features = [] } -ureq = { workspace = true, features = ["rustls", "gzip"] } +# dotenvy = { workspace = true, features = [] } +# ureq = { workspace = true, features = ["rustls", "gzip"] } diff --git a/k8s-intf/build.rs b/k8s-intf/build.rs index 05d58f45d..1db474cd1 100644 --- a/k8s-intf/build.rs +++ b/k8s-intf/build.rs @@ -1,47 +1,10 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright Open Network Fabric Authors -use std::env; use std::fs; +use std::io::Read; use std::path::PathBuf; -fn workspace_root() -> PathBuf { - PathBuf::from(env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set")) - .ancestors() - .nth(1) - .expect("Workspace root not found") - .to_path_buf() -} - -fn get_agent_crd_url() -> String { - let env_file_path = workspace_root().join("scripts").join("k8s-crd.env"); - println!("cargo:rerun-if-changed={}", env_file_path.display()); - - let env_file = - dotenvy::from_path_iter(env_file_path).expect("Failed to read scripts/k8s-crd.env"); - - env_file - .filter_map(Result::ok) - .find_map(|(key, value)| { - if key == "K8S_GATEWAY_AGENT_CRD_URL" { - Some(value) - } else { - None - } - }) - .expect("K8S_GATEWAY_AGENT_CRD_URL not found in scripts/k8s-crd.env") -} - -fn fetch_crd(url: &str) -> String { - println!("cargo:note=Fetching CRD from: {url}"); - ureq::get(url) - .call() - .expect("Failed to fetch agent CRD from url") - .body_mut() - .read_to_string() - .expect("Failed to read response body") -} - const LICENSE_PREAMBLE: &str = "// SPDX-License-Identifier: Apache-2.0 // Copyright Open Network Fabric Authors @@ -126,8 +89,31 @@ fn code_needs_regen(new_code: &str) -> bool { } fn main() { - let agent_crd_url = get_agent_crd_url(); - let agent_crd_contents = fetch_crd(&agent_crd_url); + let agent_crd_contents = { + let agent_crd_path = + PathBuf::from(std::env::var("GW_CRD_PATH").expect("GW_CRD_PATH var unset")) + .join("gwint.githedgehog.com_gatewayagents.yaml"); + let mut agent_crd_file = std::fs::OpenOptions::new() + .read(true) + .write(false) + .open(&agent_crd_path) + .unwrap_or_else(|e| { + panic!( + "failed to open {path}: {e}", + path = agent_crd_path.to_str().expect("non unicode crd path") + ) + }); + let mut contents = String::with_capacity( + agent_crd_file + .metadata() + .expect("unable to get crd metadata") + .len() as usize, + ); + agent_crd_file + .read_to_string(&mut contents) + .unwrap_or_else(|e| panic!("unable to read crd data into string: {e}")); + contents + }; let agent_generated_code = generate_rust_for_crd(&agent_crd_contents); if !code_needs_regen(&agent_generated_code) { diff --git a/nix/overlays/dataplane-dev.nix b/nix/overlays/dataplane-dev.nix index 46ae9fbef..9756d3c71 100644 --- a/nix/overlays/dataplane-dev.nix +++ b/nix/overlays/dataplane-dev.nix @@ -3,15 +3,13 @@ { sources, }: +final: prev: let fenix = import sources.fenix { }; rust-toolchain = fenix.fromToolchainFile { file = ../../rust-toolchain.toml; sha256 = (builtins.fromJSON (builtins.readFile ../.rust-toolchain.manifest-lock.json)).hash.sha256; }; -in -final: prev: -let rustPlatform = final.makeRustPlatform { stdenv = final.llvmPackages.stdenv; cargo = rust-toolchain; @@ -19,17 +17,27 @@ let }; in { - inherit rust-toolchain rustPlatform; - llvmPackages = final.llvmPackages_21; + inherit rust-toolchain; + rustPlatform' = rustPlatform; + kopium = import ../pkgs/kopium { src = sources.kopium; inherit rustPlatform; }; cargo-bolero = prev.cargo-bolero.override { inherit rustPlatform; }; cargo-deny = prev.cargo-deny.override { inherit rustPlatform; }; - cargo-pciutils = prev.cargo-deny.override { inherit rustPlatform; }; - cargo-llvm-cov = prev.cargo-deny.override { inherit rustPlatform; }; - cargo-nextest = prev.cargo-deny.override { inherit rustPlatform; }; - just = prev.cargo-deny.override { inherit rustPlatform; }; - npins = prev.cargo-deny.override { inherit rustPlatform; }; + cargo-llvm-cov = prev.cargo-llvm-cov.override { inherit rustPlatform; }; + cargo-nextest = prev.cargo-nextest.override { inherit rustPlatform; }; + just = prev.just.override { inherit rustPlatform; }; + npins = prev.npins.override { inherit rustPlatform; }; + gateway-crd = + let + path = "config/crd/bases/gwint.githedgehog.com_gatewayagents.yaml"; + in + final.writeTextFile { + name = "gateway-crd"; + text = builtins.readFile "${sources.gateway}/${path}"; + executable = false; + destination = "/src/gateway/${path}"; + }; } diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index 0faab2ea6..b8b85dd99 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -33,9 +33,14 @@ let file = ../../rust-toolchain.toml; sha256 = (builtins.fromJSON (builtins.readFile ../.rust-toolchain.manifest-lock.json)).hash.sha256; }; + rustPlatform' = final.makeRustPlatform { + stdenv = stdenv'; + cargo = rust-toolchain; + rustc = rust-toolchain; + }; in { - inherit stdenv' added-to-env; + inherit rust-toolchain stdenv' rustPlatform'; # Don't bother adapting ethtool or iproute2's build to our custom flags / env. Failure to null this can trigger # _massive_ builds because ethtool depends on libnl (et al), and we _do_ overlay libnl. Thus, the ethtool / iproute2 # get rebuilt and you end up rebuilding the whole world. @@ -65,8 +70,6 @@ in udev = null; udevCheckHook = null; - llvmPackages = final.llvmPackages_21; - # libmd is used by libbsd (et al) which is an optional dependency of dpdk. # # We _might_ actually care about perf here, so we lto this package. @@ -252,17 +255,4 @@ in pciutils = dataplane-dep (prev.pciutils.override { static = true; }); # This isn't directly required by dataplane, perftest = dataplane-dep (final.callPackage ../pkgs/perftest { src = sources.perftest; }); - - inherit rust-toolchain; - - rustPlatform' = final.makeRustPlatform { - stdenv = final.llvmPackages.stdenv; - cargo = final.rust-toolchain; - rustc = final.rust-toolchain; - }; - - kopium = import ../pkgs/kopium { - src = sources.kopium; - rustPlatform = final.rustPlatform'; - }; } diff --git a/nix/overlays/default.nix b/nix/overlays/default.nix index 8ce3c6604..d7bb9d7f7 100644 --- a/nix/overlays/default.nix +++ b/nix/overlays/default.nix @@ -7,6 +7,10 @@ profile, }: { + llvm = import ./llvm.nix { + inherit sources; + }; + dataplane = import ./dataplane.nix { inherit sources diff --git a/nix/overlays/llvm.nix b/nix/overlays/llvm.nix new file mode 100644 index 000000000..1fb641cfe --- /dev/null +++ b/nix/overlays/llvm.nix @@ -0,0 +1,36 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright Open Network Fabric Authors +{ + sources, +}: +let + fenix = import sources.fenix { }; + rust-toolchain = fenix.fromToolchainFile { + file = ../../rust-toolchain.toml; + sha256 = (builtins.fromJSON (builtins.readFile ../.rust-toolchain.manifest-lock.json)).hash.sha256; + }; +in +final: prev: { + # It is essential that we always use the same version of llvm that our rustc is backed by. + # To minimize maintenance burden, we explicitly compute the version of LLVM we need by asking rustc + # which version it is using. + # This is significantly less error prone than hunting around for all versions of pkgs.llvmPackages_${version} + # every time rust updates. + llvmPackages = + let + version = builtins.readFile ( + final.runCommandLocal "llvm-version-for-our-rustc" + { + RUSTC = "${rust-toolchain.out}/bin/rustc"; + GREP = "${final.gnugrep}/bin/grep"; + SED = "${final.gnused}/bin/sed"; + } + '' + $RUSTC --version --verbose | \ + $GREP '^LLVM version:' | \ + $SED -z 's|LLVM version: \([0-9]\+\)\.[0-9]\+\.[0-9]\+\n|\1|' > $out + '' + ); + in + final."llvmPackages_${version}"; +} diff --git a/npins/sources.json b/npins/sources.json index bada50e49..ee0f05b92 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -34,6 +34,22 @@ "url": "https://github.com/nix-community/fenix/archive/main.tar.gz", "hash": "1gkd9ppvsxl4jjg1jyw61wm99xhy4hdqx5dxqj06gfxi2zkamvzf" }, + "gateway": { + "type": "GitRelease", + "repository": { + "type": "GitHub", + "owner": "githedgehog", + "repo": "gateway" + }, + "pre_releases": false, + "version_upper_bound": null, + "release_prefix": null, + "submodules": false, + "version": "v0.33.0", + "revision": "18913fe34d78af396deb1e6a034d0258168122b1", + "url": "https://api.github.com/repos/githedgehog/gateway/tarball/v0.33.0", + "hash": "0sjdagppmmb8wjpf8p7gpxjsh18xyy1n6zs3hy08h15ldv0ip2sz" + }, "kopium": { "type": "GitRelease", "repository": { @@ -70,20 +86,17 @@ "hash": "1xx42m8amnda6z8nbm2ksv0plpzcdqxzymb1qqnp0xnf0k2bz2d1" }, "perftest": { - "type": "GitRelease", + "type": "Git", "repository": { "type": "GitHub", "owner": "linux-rdma", "repo": "perftest" }, - "pre_releases": false, - "version_upper_bound": null, - "release_prefix": null, + "branch": "master", "submodules": false, - "version": "25.10.0-0.128", - "revision": "8a1d3d7234add23fe006b2ff51d650ff022077a8", - "url": "https://api.github.com/repos/linux-rdma/perftest/tarball/25.10.0-0.128", - "hash": "192m2xlds308y0p2h6f6zciwspgq3k0q93q9lp1j4ijmwrpbcrl0" + "revision": "4e4f6629904ba07bf81f207b31433cb9dabbe8ab", + "url": "https://github.com/linux-rdma/perftest/archive/4e4f6629904ba07bf81f207b31433cb9dabbe8ab.tar.gz", + "hash": "0rvwmx9nbhr0m5zmrcpxcqwdjpl4bwsfwc7vmdn31n5gxn0qnn1x" }, "rdma-core": { "type": "Git", diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 610ccfcad..46e38a196 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,27 +1,28 @@ [toolchain] # NOTE: you can and should manually update this on new rust releases - channel = "1.92.0" + components = [ - "rustc", - "cargo", - "rust-std", - "rust-docs", - "rustfmt-preview", - "clippy-preview", - "rust-analyzer-preview", - "rust-src", + "rustc", + "cargo", + "rust-std", + "rust-docs", + "rustfmt-preview", + "clippy-preview", + "rust-analyzer-preview", + "rust-src", - # disabled components - # "rust-mingw", - # "llvm-tools-preview", ## we already have a full llvm in the npins - # "rust-analysis", ## obsolete - # "miri-preview", ## not yet functional for us - # "rustc-codegen-cranelift-preview" ## not relevant to us + ## other (disabled) components ## + # "rust-mingw", ## not relevant to us + # "llvm-tools-preview", ## we already have a full llvm in the npins, no need for another + # "rust-analysis", ## obsolete + # "miri-preview", ## not yet functional for us + # "rustc-codegen-cranelift-preview" ## not relevant to us ] + targets = [ - "x86_64-unknown-linux-gnu", - "x86_64-unknown-linux-musl", - "aarch64-unknown-linux-gnu", - "aarch64-unknown-linux-musl" + "x86_64-unknown-linux-gnu", + "x86_64-unknown-linux-musl", + "aarch64-unknown-linux-gnu", + "aarch64-unknown-linux-musl" ] From c852dae1b51904d34c5e4d6cc46669145ff0b838 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Tue, 23 Dec 2025 05:28:24 +0000 Subject: [PATCH 073/163] fix cross compile errooooor --- nix/overlays/llvm.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nix/overlays/llvm.nix b/nix/overlays/llvm.nix index 1fb641cfe..9e7049db3 100644 --- a/nix/overlays/llvm.nix +++ b/nix/overlays/llvm.nix @@ -22,8 +22,8 @@ final: prev: { final.runCommandLocal "llvm-version-for-our-rustc" { RUSTC = "${rust-toolchain.out}/bin/rustc"; - GREP = "${final.gnugrep}/bin/grep"; - SED = "${final.gnused}/bin/sed"; + GREP = "${final.pkgsBuildHost.gnugrep}/bin/grep"; + SED = "${final.pkgsBuildHost.gnused}/bin/sed"; } '' $RUSTC --version --verbose | \ From 1585a8b94a11c805aec8a2f570f84a461f546a76 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Tue, 23 Dec 2025 17:15:48 +0000 Subject: [PATCH 074/163] hacky cross compile working --- .cargo/config.toml | 6 ++- default.nix | 107 +++++++++++++++++++++---------------- nix/overlays/dataplane.nix | 54 +++++++++++++------ nix/platforms.nix | 5 +- nix/profiles.nix | 4 +- 5 files changed, 110 insertions(+), 66 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 33ead06f2..3831e1c0b 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -2,13 +2,15 @@ # COMPILE_ENV = { value = "sysroot", relative = true, force = false } # PATH = { value = "compile-env/bin", relative = true, force = true } LIBCLANG_PATH = { value = "compile-env/lib", relative = true, force = false } -PKG_CONFIG_PATH = { value = "compile-env/sysroot/x86_64-unknown-linux-gnu/release/lib/pkgconfig", relative = true, force = false } +# PKG_CONFIG_PATH = { value = "compile-env/sysroot/x86_64-unknown-linux-gnu/release/lib/pkgconfig", relative = true, force = false } +PKG_CONFIG_PATH = { value = "sysroot/lib/pkgconfig", relative = true, force = false } LIBRARY_PATH = { value = "sysroot/lib", relative = true, force = false } C_INCLUDE_PATH = { value = "sysroot/include", relative = true, force = false } GW_CRD_PATH = { value = "devroot/src/gateway/config/crd/bases", relative = true, force = false } [build] -target = "x86_64-unknown-linux-gnu" +# target = "x86_64-unknown-linux-gnu" +target = "aarch64-unknown-linux-gnu" # rustc = "compile-env/bin/rustc" rustflags = ["--cfg", "tokio_unstable"] diff --git a/default.nix b/default.nix index 7e15c105b..74a9b5ce1 100644 --- a/default.nix +++ b/default.nix @@ -36,32 +36,36 @@ let overlays.dataplane-dev ]; }; - dataplane-pkgs = - (import sources.nixpkgs { + dataplane-pkgs = ( + import sources.nixpkgs { + crossSystem = "aarch64-linux"; overlays = [ overlays.llvm overlays.dataplane ]; - }).pkgsCross.${platform'.info.nixarch}; - sysroot = dataplane-pkgs.symlinkJoin { + } + ); + # }).pkgsCross.${platform'.info.nixarch}; + sysroot = dataplane-pkgs.pkgsHostHost.symlinkJoin { name = "sysroot"; - paths = with dataplane-pkgs; [ - stdenv'.cc.libc.dev - stdenv'.cc.libc.out - libmd.dev - libmd.static - libbsd.dev - libbsd.static - libnl.dev - libnl.static - numactl.dev - numactl.static - rdma-core.dev - rdma-core.static + paths = with dataplane-pkgs.pkgsHostHost; [ + dataplane-pkgs.pkgsHostHost.libc.dev + dataplane-pkgs.pkgsHostHost.libc.out + fancy.libmd.dev + fancy.libmd.static + fancy.libbsd.dev + fancy.libbsd.static + fancy.libnl.dev + fancy.libnl.static + fancy.numactl.dev + fancy.numactl.static + fancy.rdma-core.dev + fancy.rdma-core.static dpdk.dev dpdk.static dpdk-wrapper.dev dpdk-wrapper.out + hwloc.dev hwloc ]; }; @@ -77,8 +81,8 @@ let executable = false; destination = "/.clangd"; }; - crane-base = import sources.crane { }; - crane = crane-base.craneLib.overrideToolchain dataplane-dev-pkgs.rust-toolchain; + crane-base = import sources.crane { pkgs = dataplane-pkgs; }; + crane = crane-base.craneLib.overrideToolchain dataplane-pkgs.rust-toolchain; dev-tools = dataplane-pkgs.symlinkJoin { name = "dataplane-dev-shell"; paths = [ @@ -112,7 +116,7 @@ let CARGO_PROFILE = "dev"; nativeBuildInputs = [ - dataplane-pkgs.pkg-config + dataplane-dev-pkgs.pkg-config # dataplane-pkgs.libclang.lib ]; buildInputs = [ @@ -120,15 +124,12 @@ let ]; env = { - LIBCLANG_PATH = "${dataplane-pkgs.llvmPackages.libclang.lib}/lib"; + LIBCLANG_PATH = "${dataplane-pkgs.pkgsBuildHost.llvmPackages.libclang.lib}/lib"; C_INCLUDE_PATH = "${sysroot}/include"; LIBRARY_PATH = "${sysroot}/lib"; PKG_CONFIG_PATH = "${sysroot}/lib/pkgconfig"; GW_CRD_PATH = "${dataplane-dev-pkgs.gateway-crd}/src/gateway/config/crd/bases"; }; - - # Additional environment variables can be set directly - # MY_CUSTOM_VAR = "some value"; }; # Build *just* the cargo dependencies (of the entire workspace), # so we can reuse all of that work (e.g. via cachix) when running in CI @@ -188,7 +189,7 @@ let cargoExtraArgs = "--package dataplane-dpdk-sys"; src = fileSetForCrate ./dpdk-sys; nativeBuildInputs = [ - dataplane-pkgs.pkg-config + dataplane-dev-pkgs.pkg-config dataplane-pkgs.llvmPackages.libclang.lib dataplane-pkgs.llvmPackages.clang dataplane-pkgs.llvmPackages.lld @@ -205,34 +206,50 @@ let cargoExtraArgs = "--package dataplane-dpdk"; src = fileSetForCrate ./dpdk; nativeBuildInputs = [ - dataplane-pkgs.pkg-config - dataplane-pkgs.llvmPackages.libclang.lib - dataplane-pkgs.llvmPackages.clang - dataplane-pkgs.llvmPackages.lld - ]; - buildInputs = [ - sysroot - ]; - } - ); - dataplane = crane.buildPackage ( - individualCrateArgs - // { - pname = "dataplane"; - cargoExtraArgs = "--package dataplane"; - src = fileSetForCrate ./dataplane; - nativeBuildInputs = [ - dataplane-pkgs.pkg-config + dataplane-dev-pkgs.pkg-config dataplane-pkgs.llvmPackages.libclang.lib dataplane-pkgs.llvmPackages.clang dataplane-pkgs.llvmPackages.lld - dataplane-dev-pkgs.kopium ]; buildInputs = [ sysroot ]; } ); + dataplane = + let + expr = + { + stdenv, + pkg-config, + kopium, + llvmPackages, + }: + crane.buildPackage ( + individualCrateArgs + // { + pname = "dataplane"; + cargoExtraArgs = "--package dataplane"; + src = fileSetForCrate ./dataplane; + # env.RUSTFLAGS = "-C linker=${llvmPackages.clang}/bin/clang -C link-arg=-fuse-ld=lld -C link-arg=--ld-path=${llvmPackages.lld}/bin/ld.lld"; + nativeBuildInputs = [ + pkg-config + kopium + llvmPackages.libclang.lib + llvmPackages.clang + llvmPackages.lld + ]; + buildInputs = [ + # sysroot + ]; + } + ); + in + dataplane-pkgs.callPackage expr { + stdenv = dataplane-pkgs.stdenv'; + # inherit (dataplane-dev-pkgs) pkg-config kopium; + # inherit (dataplane-pkgs) llvmPackages; + }; in { @@ -255,7 +272,7 @@ in dataplane ; platform = platform'; - x = builtins.attrNames crane; + # x = crane.buildPackage.__functionArgs.; y = { lib = { x = (builtins.attrNames crane.craneLib); diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index b8b85dd99..73187ae22 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -38,6 +38,7 @@ let cargo = rust-toolchain; rustc = rust-toolchain; }; + rustPlatform = rustPlatform'; in { inherit rust-toolchain stdenv' rustPlatform'; @@ -48,16 +49,16 @@ in # To be clear, we can still use ethtool / iproute2 if we want, we just don't need to optimize / lto it. # If you want to include ethtool / iproute2, I recommend just cutting another small overlay and static linking them. # Alternatively, you could skip that and just ship the default build of ethtool. - ethtool = null; - iproute2 = null; + # ethtool = null; + # iproute2 = null; # These are only used in docs and can make our build explode in size if we let any of this rebuild in this overlay. # It is much easier to just not build docs in this overlay. We don't care if the build depends on pandoc per se, but # you will regret the need to rebuild ghc :shrug: - gd = null; - graphviz = null; - mscgen = null; - pandoc = null; + # gd = null; + # graphviz = null; + # mscgen = null; + # pandoc = null; # We should avoid accepting anything in our dpdk + friends pkgs which depends on udev / systemd; our deploy simply # won't support any such mechanisms. @@ -66,16 +67,16 @@ in # problem). That said, builds which hard and fast depend on systemd or udev are very suspicious in this context, so # exceptions to this removal should be granted with care and some level of prejudice. At minimum, such exceptions # tend to make it hard to cross compile which is an important test case for our sysroot. - systemd = null; - udev = null; - udevCheckHook = null; + # systemd = null; + # udev = null; + # udevCheckHook = null; # libmd is used by libbsd (et al) which is an optional dependency of dpdk. # # We _might_ actually care about perf here, so we lto this package. # At minimum, the provided functions are generally quite small and likely to benefit from inlining, so static linking # is a solid plan. - libmd = (dataplane-dep prev.libmd).overrideAttrs (orig: { + fancy.libmd = (dataplane-dep prev.libmd).overrideAttrs (orig: { outputs = (orig.outputs or [ "out" ]) ++ [ "man" "dev" @@ -99,7 +100,7 @@ in # # This is also a reasonably important target for `-fsanitize=cfi` and or `-fsanitize=safe-stack` as libbsd provides # more secure versions of classic C string manipulation utilities, and I'm all about that defense-in-depth. - libbsd = (dataplane-dep prev.libbsd).overrideAttrs (orig: { + fancy.libbsd = ((dataplane-dep prev.libbsd).override { libmd = final.fancy.libmd; }).overrideAttrs (orig: { outputs = (orig.outputs or [ "out" ]) ++ [ "static" ]; # we need to enable shared (in addition to static) to build dpdk. # See the note on libmd for reasoning. @@ -124,7 +125,7 @@ in # More, this is a very low level library designed to send messages between a privileged process and the kernel. # The simple fact that this appears in our toolchain justifies sanitizers like safe-stack and cfi and/or flags like # -fcf-protection=full. - libnl = (dataplane-dep prev.libnl).overrideAttrs (orig: { + fancy.libnl = (dataplane-dep prev.libnl).overrideAttrs (orig: { outputs = (orig.outputs or [ "out" ]) ++ [ "static" ]; configureFlags = (orig.configureFlags or [ ]) ++ [ "--enable-static" @@ -149,7 +150,7 @@ in # # For now, we leave this on so DPDK can do some of that for us. That said, this logic is quite cold and would ideally # be size optimized and punted far from all hot paths. BOLT should be helpful here. - numactl = (dataplane-dep prev.numactl).overrideAttrs (orig: { + fancy.numactl = (dataplane-dep prev.numactl).overrideAttrs (orig: { outputs = (prev.lib.lists.remove "man" orig.outputs) ++ [ "static" ]; configureFlags = (orig.configureFlags or [ ]) ++ [ "--enable-static" @@ -169,7 +170,7 @@ in # link dynamically or statically, and we should make a strong effort to make sure that we always pick static linking # to enable inlining (wherever the compiler decides it makes sense). You very likely want to enable lto here in any # release build. - rdma-core = (dataplane-dep prev.rdma-core).overrideAttrs (orig: { + fancy.rdma-core = ((dataplane-dep prev.rdma-core).override { libnl = final.fancy.libnl; }).overrideAttrs (orig: { version = sources.rdma-core.branch; src = sources.rdma-core.outPath; @@ -241,9 +242,9 @@ in # # Also, while this library has a respectable security track record, this is also a super strong candidate for # cfi, safe-stack, and cf-protection. - dpdk = dataplane-dep ( + dpdk = (dataplane-dep ( final.callPackage ../pkgs/dpdk (platform.override.dpdk.buildInputs // { src = sources.dpdk; }) - ); + )).override { inherit (final.fancy) rdma-core libnl libbsd numactl; }; # DPDK is largely composed of static-inline functions. # We need to wrap those functions with "_w" variants so that we can actually call them from rust. @@ -255,4 +256,25 @@ in pciutils = dataplane-dep (prev.pciutils.override { static = true; }); # This isn't directly required by dataplane, perftest = dataplane-dep (final.callPackage ../pkgs/perftest { src = sources.perftest; }); + + kopium = import ../pkgs/kopium { + src = sources.kopium; + inherit rustPlatform; + }; + cargo-bolero = prev.cargo-bolero.override { inherit rustPlatform; }; + cargo-deny = prev.cargo-deny.override { inherit rustPlatform; }; + cargo-llvm-cov = prev.cargo-llvm-cov.override { inherit rustPlatform; }; + cargo-nextest = prev.cargo-nextest.override { inherit rustPlatform; }; + just = prev.just.override { inherit rustPlatform; }; + npins = prev.npins.override { inherit rustPlatform; }; + gateway-crd = + let + path = "config/crd/bases/gwint.githedgehog.com_gatewayagents.yaml"; + in + final.writeTextFile { + name = "gateway-crd"; + text = builtins.readFile "${sources.gateway}/${path}"; + executable = false; + destination = "/src/gateway/${path}"; + }; } diff --git a/nix/platforms.nix b/nix/platforms.nix index 3c5b7825c..be4e33fa3 100644 --- a/nix/platforms.nix +++ b/nix/platforms.nix @@ -79,7 +79,10 @@ let march = "armv8.4-a"; mcpu = "cortex-a78ae"; override.stdenv.env = rec { - NIX_CFLAGS_COMPILE = [ "-mcpu=${mcpu}" ]; + # NIX_CFLAGS_COMPILE = [ "-mcpu=${mcpu}" ]; + # NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; + # NIX_CFLAGS_LINK = [ ]; + NIX_CFLAGS_COMPILE = [ ]; NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; NIX_CFLAGS_LINK = [ ]; }; diff --git a/nix/profiles.nix b/nix/profiles.nix index 0c9d1f8a9..6bcf4f87b 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -25,8 +25,8 @@ let debug.NIX_CFLAGS_COMPILE = [ "-fno-inline" "-fno-omit-frame-pointer" - "-D_FORTIFY_SOURCE=0" # disable security stuff because the goal is to make the asm as easy to understand as possible - "-Wno-macro-redefined" # many apps opt in to _FORTIFY_SOURCE={1,2,3} explicitly, and -Wall errors when you redefine + # "-D_FORTIFY_SOURCE=0" # disable security stuff because the goal is to make the asm as easy to understand as possible + # "-Wno-macro-redefined" # many apps opt in to _FORTIFY_SOURCE={1,2,3} explicitly, and -Wall errors when you redefine ]; debug.NIX_CXXFLAGS_COMPILE = debug.NIX_CFLAGS_COMPILE; debug.NIX_CFLAGS_LINK = [ ]; From 6bcb1173a5009eb3f55bf955ed22fe8cfd86df43 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Tue, 23 Dec 2025 18:34:43 +0000 Subject: [PATCH 075/163] less hacky (seems to work with mcpu) --- .cargo/config.toml | 8 +------- default.nix | 4 ++-- nix/platforms.nix | 11 +++++++---- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 3831e1c0b..16f30d4e4 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,17 +1,11 @@ [env] -# COMPILE_ENV = { value = "sysroot", relative = true, force = false } -# PATH = { value = "compile-env/bin", relative = true, force = true } -LIBCLANG_PATH = { value = "compile-env/lib", relative = true, force = false } -# PKG_CONFIG_PATH = { value = "compile-env/sysroot/x86_64-unknown-linux-gnu/release/lib/pkgconfig", relative = true, force = false } +LIBCLANG_PATH = { value = "devroot/lib", relative = true, force = false } PKG_CONFIG_PATH = { value = "sysroot/lib/pkgconfig", relative = true, force = false } LIBRARY_PATH = { value = "sysroot/lib", relative = true, force = false } C_INCLUDE_PATH = { value = "sysroot/include", relative = true, force = false } GW_CRD_PATH = { value = "devroot/src/gateway/config/crd/bases", relative = true, force = false } [build] -# target = "x86_64-unknown-linux-gnu" -target = "aarch64-unknown-linux-gnu" -# rustc = "compile-env/bin/rustc" rustflags = ["--cfg", "tokio_unstable"] [target.x86_64-unknown-linux-gnu] diff --git a/default.nix b/default.nix index 74a9b5ce1..b4cc40a09 100644 --- a/default.nix +++ b/default.nix @@ -247,8 +247,8 @@ let in dataplane-pkgs.callPackage expr { stdenv = dataplane-pkgs.stdenv'; - # inherit (dataplane-dev-pkgs) pkg-config kopium; - # inherit (dataplane-pkgs) llvmPackages; + inherit (dataplane-dev-pkgs) pkg-config kopium; + inherit (dataplane-pkgs) llvmPackages; }; in diff --git a/nix/platforms.nix b/nix/platforms.nix index be4e33fa3..dde4d8a01 100644 --- a/nix/platforms.nix +++ b/nix/platforms.nix @@ -64,6 +64,9 @@ let }; override = { stdenv.env = rec { + # CFLAGS = [ "-mcpu=${mcpu}" ]; + # CXXFLAGS = CFLAGS; + # LDFLAGS = [ ]; NIX_CFLAGS_COMPILE = [ "-mcpu=${mcpu}" ]; NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; NIX_CFLAGS_LINK = [ ]; @@ -79,12 +82,12 @@ let march = "armv8.4-a"; mcpu = "cortex-a78ae"; override.stdenv.env = rec { - # NIX_CFLAGS_COMPILE = [ "-mcpu=${mcpu}" ]; - # NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; - # NIX_CFLAGS_LINK = [ ]; - NIX_CFLAGS_COMPILE = [ ]; + NIX_CFLAGS_COMPILE = [ "-mcpu=${mcpu}" ]; NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; NIX_CFLAGS_LINK = [ ]; + # NIX_CFLAGS_COMPILE = [ ]; + # NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; + # NIX_CFLAGS_LINK = [ ]; }; }; }; From 3d5390dae875f2cfe1a4965192d3f930bd39bc88 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Tue, 23 Dec 2025 19:29:22 +0000 Subject: [PATCH 076/163] less hacky still --- default.nix | 10 +++------- nix/platforms.nix | 6 ------ npins/sources.json | 18 +++++++++++++----- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/default.nix b/default.nix index b4cc40a09..1ede72ea5 100644 --- a/default.nix +++ b/default.nix @@ -36,16 +36,13 @@ let overlays.dataplane-dev ]; }; - dataplane-pkgs = ( - import sources.nixpkgs { - crossSystem = "aarch64-linux"; + dataplane-pkgs = + (import sources.nixpkgs { overlays = [ overlays.llvm overlays.dataplane ]; - } - ); - # }).pkgsCross.${platform'.info.nixarch}; + }).pkgsCross.${platform'.info.nixarch}; sysroot = dataplane-pkgs.pkgsHostHost.symlinkJoin { name = "sysroot"; paths = with dataplane-pkgs.pkgsHostHost; [ @@ -231,7 +228,6 @@ let pname = "dataplane"; cargoExtraArgs = "--package dataplane"; src = fileSetForCrate ./dataplane; - # env.RUSTFLAGS = "-C linker=${llvmPackages.clang}/bin/clang -C link-arg=-fuse-ld=lld -C link-arg=--ld-path=${llvmPackages.lld}/bin/ld.lld"; nativeBuildInputs = [ pkg-config kopium diff --git a/nix/platforms.nix b/nix/platforms.nix index dde4d8a01..3c5b7825c 100644 --- a/nix/platforms.nix +++ b/nix/platforms.nix @@ -64,9 +64,6 @@ let }; override = { stdenv.env = rec { - # CFLAGS = [ "-mcpu=${mcpu}" ]; - # CXXFLAGS = CFLAGS; - # LDFLAGS = [ ]; NIX_CFLAGS_COMPILE = [ "-mcpu=${mcpu}" ]; NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; NIX_CFLAGS_LINK = [ ]; @@ -85,9 +82,6 @@ let NIX_CFLAGS_COMPILE = [ "-mcpu=${mcpu}" ]; NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; NIX_CFLAGS_LINK = [ ]; - # NIX_CFLAGS_COMPILE = [ ]; - # NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; - # NIX_CFLAGS_LINK = [ ]; }; }; }; diff --git a/npins/sources.json b/npins/sources.json index ee0f05b92..a08958f83 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -30,9 +30,17 @@ "hash": "09h7wnmq4c9xm1nsyv5mz1yf91c1l6vy9sdcamb09qjjx4wgs0q9" }, "fenix": { - "type": "Tarball", - "url": "https://github.com/nix-community/fenix/archive/main.tar.gz", - "hash": "1gkd9ppvsxl4jjg1jyw61wm99xhy4hdqx5dxqj06gfxi2zkamvzf" + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "nix-community", + "repo": "fenix" + }, + "branch": "main", + "submodules": false, + "revision": "9591b811e48f906e0a9f7afe89676a1c333415dd", + "url": "https://github.com/nix-community/fenix/archive/9591b811e48f906e0a9f7afe89676a1c333415dd.tar.gz", + "hash": "10ywa8zl95y35jqa1yzrdsqrpqvil9ys7mdx40n4n9dsfgcb9gnw" }, "gateway": { "type": "GitRelease", @@ -82,8 +90,8 @@ "nixpkgs": { "type": "Channel", "name": "nixpkgs-unstable", - "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.05pre914780.306ea70f9eb0/nixexprs.tar.xz", - "hash": "1xx42m8amnda6z8nbm2ksv0plpzcdqxzymb1qqnp0xnf0k2bz2d1" + "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.05pre915325.3a7affa77a5a/nixexprs.tar.xz", + "hash": "19kpsffj03kxvxwns3vpcjbg6n6bipsns229xzifazxvkshnddsk" }, "perftest": { "type": "Git", From 4b68ec922f7788f281e22bc145b20b4d4b258f08 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Tue, 23 Dec 2025 20:39:29 +0000 Subject: [PATCH 077/163] mostly building again with the old method This is a hack which isn't quite effective, but it should help manage the changeset --- .cargo/config.toml | 8 ++++---- scripts/rust.env | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 16f30d4e4..c55c47c23 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,8 +1,8 @@ [env] -LIBCLANG_PATH = { value = "devroot/lib", relative = true, force = false } -PKG_CONFIG_PATH = { value = "sysroot/lib/pkgconfig", relative = true, force = false } -LIBRARY_PATH = { value = "sysroot/lib", relative = true, force = false } -C_INCLUDE_PATH = { value = "sysroot/include", relative = true, force = false } +LIBCLANG_PATH = { value = "compile-env/lib", relative = true, force = false } +PKG_CONFIG_PATH = { value = "compile-env/sysroot/x86_64-unknown-linux-gnu/debug/lib/pkgconfig", relative = true, force = false } +LIBRARY_PATH = { value = "compile-env/sysroot/x86_64-unknown-linux-gnu/debug/lib", relative = true, force = false } +C_INCLUDE_PATH = { value = "compile-env/sysroot/x86_64-unknown-linux-gnu/debug/include", relative = true, force = false } GW_CRD_PATH = { value = "devroot/src/gateway/config/crd/bases", relative = true, force = false } [build] diff --git a/scripts/rust.env b/scripts/rust.env index 823c85e94..753cda68e 100644 --- a/scripts/rust.env +++ b/scripts/rust.env @@ -1,6 +1,6 @@ RUSTC_BOOTSTRAP=1 NEXTEST_EXPERIMENTAL_LIBTEST_JSON=1 -LINKER="-C linker=./compile-env/bin/clang -C link-arg=--ld-path=./compile-env/bin/ld.lld" +LINKER="-C linker=clang -C link-arg=--ld-path=ld.lld" RELRO="-C relro-level=full" CRT_STATIC="-C target-feature=+crt-static" CRT_DYNAMIC="-C target-feature=-crt-static" From b8c1e08455a423401edfedeea0a1b3fac8c20e3f Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Wed, 24 Dec 2025 00:16:51 +0000 Subject: [PATCH 078/163] mostly workin (including musl) --- .cargo/config.toml | 14 +++++- Cargo.toml | 4 +- default.nix | 107 +++++++++++++++++++++++++++------------------ nix/profiles.nix | 6 ++- scripts/rust.env | 4 +- 5 files changed, 87 insertions(+), 48 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index c55c47c23..2d61d3bef 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -6,7 +6,19 @@ C_INCLUDE_PATH = { value = "compile-env/sysroot/x86_64-unknown-linux-gnu/debug/i GW_CRD_PATH = { value = "devroot/src/gateway/config/crd/bases", relative = true, force = false } [build] -rustflags = ["--cfg", "tokio_unstable"] +rustflags = [ + "--cfg", + "tokio_unstable", +] [target.x86_64-unknown-linux-gnu] runner = ["scripts/test-runner.sh"] +rustflags = [ + "--cfg", + "tokio_unstable", + "-Clinker-plugin-lto", + "-Copt-level=3", + "-Cembed-bitcode=yes", + "-Ccodegen-units=1", + "-Crelro-level=full", +] diff --git a/Cargo.toml b/Cargo.toml index 6ebdc6ddb..4852b6ccf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -194,8 +194,8 @@ rpath = true [profile.release] opt-level = 3 panic = "unwind" -debug = "full" -lto = "thin" +# debug = "full" +# lto = "fat" debug-assertions = false overflow-checks = false codegen-units = 1 diff --git a/default.nix b/default.nix index 1ede72ea5..9cc38adec 100644 --- a/default.nix +++ b/default.nix @@ -110,7 +110,7 @@ let commonArgs = { src = dataplane-src; strictDeps = true; - CARGO_PROFILE = "dev"; + CARGO_PROFILE = "release"; nativeBuildInputs = [ dataplane-dev-pkgs.pkg-config @@ -147,7 +147,53 @@ let ./. ]; }; - rekon = crane.buildPackage ( + package-list = builtins.fromJSON ( + builtins.readFile ( + dataplane-pkgs.runCommandLocal "package-list" + { + TOMLQ = "${dataplane-dev-pkgs.yq}/bin/tomlq"; + JQ = "${dataplane-dev-pkgs.jq}/bin/jq"; + } + '' + $TOMLQ -r '.workspace.members | sort[]' ${./.}/Cargo.toml | while read -r p; do + $TOMLQ --arg p "$p" -r '{ ($p): .package.name }' ${./.}/$p/Cargo.toml + done | $JQ --sort-keys --slurp 'add' > $out + '' + ) + ); + packages = builtins.mapAttrs ( + p: pname: + ( + let + package-expr = + { + pkg-config, + kopium, + llvmPackages, + }: + crane.buildPackage ( + individualCrateArgs + // { + inherit pname; + cargoExtraArgs = "--package ${pname}"; + src = fileSetForCrate (./. + p); + nativeBuildInputs = [ + pkg-config + kopium + llvmPackages.clang + llvmPackages.lld + ]; + } + ); + in + dataplane-pkgs.callPackage package-expr { + inherit (dataplane-dev-pkgs) pkg-config kopium; + inherit (dataplane-dev-pkgs) llvmPackages; + } + ) + ) package-list; + + package.rekon = crane.buildPackage ( individualCrateArgs // { pname = "dataplane-rekon"; @@ -155,7 +201,7 @@ let src = fileSetForCrate ./rekon; } ); - net = crane.buildPackage ( + package.net = crane.buildPackage ( individualCrateArgs // { pname = "dataplane-net"; @@ -163,7 +209,7 @@ let src = fileSetForCrate ./net; } ); - cli = crane.buildPackage ( + package.cli = crane.buildPackage ( individualCrateArgs // { pname = "dataplane-cli"; @@ -171,7 +217,7 @@ let src = fileSetForCrate ./cli; } ); - dataplane-dpdk-sysroot-helper = crane.buildPackage ( + package.dpdk-sysroot-helper = crane.buildPackage ( individualCrateArgs // { pname = "dataplane-dpdk-sysroot-helper"; @@ -179,45 +225,26 @@ let src = fileSetForCrate ./dpdk-sysroot-helper; } ); - dpdk-sys = crane.buildPackage ( + package.dpdk-sys = crane.buildPackage ( individualCrateArgs // { pname = "dataplane-dpdk-sys"; cargoExtraArgs = "--package dataplane-dpdk-sys"; src = fileSetForCrate ./dpdk-sys; - nativeBuildInputs = [ - dataplane-dev-pkgs.pkg-config - dataplane-pkgs.llvmPackages.libclang.lib - dataplane-pkgs.llvmPackages.clang - dataplane-pkgs.llvmPackages.lld - ]; - buildInputs = [ - sysroot - ]; } ); - pdpdk = crane.buildPackage ( + package.pdpdk = crane.buildPackage ( individualCrateArgs // { pname = "dataplane-dpdk"; cargoExtraArgs = "--package dataplane-dpdk"; src = fileSetForCrate ./dpdk; - nativeBuildInputs = [ - dataplane-dev-pkgs.pkg-config - dataplane-pkgs.llvmPackages.libclang.lib - dataplane-pkgs.llvmPackages.clang - dataplane-pkgs.llvmPackages.lld - ]; - buildInputs = [ - sysroot - ]; } ); - dataplane = + package.dataplane = let expr = { - stdenv, pkg-config, kopium, llvmPackages, @@ -231,18 +258,16 @@ let nativeBuildInputs = [ pkg-config kopium - llvmPackages.libclang.lib - llvmPackages.clang - llvmPackages.lld - ]; - buildInputs = [ - # sysroot + # llvmPackages.libclang.lib + # llvmPackages.clang + # llvmPackages.lld ]; + buildInputs = [ ]; } ); in dataplane-pkgs.callPackage expr { - stdenv = dataplane-pkgs.stdenv'; + # stdenv = dataplane-pkgs.stdenv'; inherit (dataplane-dev-pkgs) pkg-config kopium; inherit (dataplane-pkgs) llvmPackages; }; @@ -259,6 +284,12 @@ in crane commonArgs cargoArtifacts + package + packages + package-list + ; + + inherit (package) rekon net cli @@ -268,12 +299,4 @@ in dataplane ; platform = platform'; - # x = crane.buildPackage.__functionArgs.; - y = { - lib = { - x = (builtins.attrNames crane.craneLib); - }; - }; - # y = crane.buildPackage - } diff --git a/nix/profiles.nix b/nix/profiles.nix index 6bcf4f87b..f6e9d69a1 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -22,6 +22,10 @@ let # we always want pic/pie and GOT offsets should be computed at compile time whenever possible "-Wl,-z,relro,-z,now" ]; + common.RUSTFLAGS = [ + "-Cdebug-info=full" + "-Cdwarf-version=5" + ]; debug.NIX_CFLAGS_COMPILE = [ "-fno-inline" "-fno-omit-frame-pointer" @@ -32,7 +36,7 @@ let debug.NIX_CFLAGS_LINK = [ ]; optimize.NIX_CFLAGS_COMPILE = [ "-O3" - "-flto=full" + "-flto=thin" "-fsplit-lto-unit" # important for compatibility with rust's LTO ]; optimize.NIX_CXXFLAGS_COMPILE = optimize.NIX_CFLAGS_COMPILE ++ [ diff --git a/scripts/rust.env b/scripts/rust.env index 753cda68e..e91209242 100644 --- a/scripts/rust.env +++ b/scripts/rust.env @@ -1,10 +1,10 @@ RUSTC_BOOTSTRAP=1 NEXTEST_EXPERIMENTAL_LIBTEST_JSON=1 -LINKER="-C linker=clang -C link-arg=--ld-path=ld.lld" +LINKER="-C linker=clang -C link-arg=--ld-path=ld.lld -C link-arg=-Wl,--gc-sections,--as-needed -C link-arg=-flto=full" RELRO="-C relro-level=full" CRT_STATIC="-C target-feature=+crt-static" CRT_DYNAMIC="-C target-feature=-crt-static" -DEBUG="-C debuginfo=full -C split-debuginfo=off -C dwarf-version=5 -Z embed-source" +DEBUG="-C debuginfo=full -C split-debuginfo=off -C dwarf-version=5" DEBUG_ASSERTIONS_ON="-C debug-assertions=on" DEBUG_ASSERTIONS_OFF="-C debug-assertions=off" OVERFLOW_CHECK_ON="-C overflow-checks=on" From b18a68321ff284afc527aec52bd21b8af8c1ad57 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Wed, 24 Dec 2025 00:47:34 +0000 Subject: [PATCH 079/163] de-src dpdk --- nix/pkgs/dpdk/default.nix | 3 +- nix/pkgs/dpdk/src | 1 - npins/default.nix | 151 ++++++++++++++++++++++++++++++++------ npins/sources.json | 30 ++++---- 4 files changed, 143 insertions(+), 42 deletions(-) delete mode 160000 nix/pkgs/dpdk/src diff --git a/nix/pkgs/dpdk/default.nix b/nix/pkgs/dpdk/default.nix index b8f8d300b..d583133a7 100644 --- a/nix/pkgs/dpdk/default.nix +++ b/nix/pkgs/dpdk/default.nix @@ -23,8 +23,7 @@ stdenv.mkDerivation { pname = "dpdk"; version = src.branch; - # src = src.outPath; - src = ./src; + src = src.outPath; nativeBuildInputs = [ meson ninja diff --git a/nix/pkgs/dpdk/src b/nix/pkgs/dpdk/src deleted file mode 160000 index cd60dcd50..000000000 --- a/nix/pkgs/dpdk/src +++ /dev/null @@ -1 +0,0 @@ -Subproject commit cd60dcd503b91956f966a1f6d595b35d256ac00f diff --git a/npins/default.nix b/npins/default.nix index 659247626..884fc8cc5 100644 --- a/npins/default.nix +++ b/npins/default.nix @@ -9,8 +9,15 @@ */ # Generated by npins. Do not modify; will be overwritten regularly let - data = builtins.fromJSON (builtins.readFile ./sources.json); - version = data.version; + # Backwards-compatibly make something that previously didn't take any arguments take some + # The function must return an attrset, and will unfortunately be eagerly evaluated + # Same thing, but it catches eval errors on the default argument so that one may still call it with other arguments + mkFunctor = + fn: + let + e = builtins.tryEval (fn { }); + in + (if e.success then e.value else { error = fn { }; }) // { __functor = _self: fn; }; # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295 range = @@ -21,7 +28,6 @@ let # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269 stringAsChars = f: s: concatStrings (map f (stringToCharacters s)); - concatMapStrings = f: list: concatStrings (map f list); concatStrings = builtins.concatStringsSep ""; # If the environment variable NPINS_OVERRIDE_${name} is set, then use @@ -48,41 +54,87 @@ let mkSource = name: spec: + { + pkgs ? null, + }: assert spec ? type; let + # Unify across builtin and pkgs fetchers. + # `fetchGit` requires a wrapper because of slight API differences. + fetchers = + if pkgs == null then + { + inherit (builtins) fetchTarball fetchurl; + # For some fucking reason, fetchGit has a different signature than the other builtin fetchers … + fetchGit = args: (builtins.fetchGit args).outPath; + } + else + { + fetchTarball = + { + url, + sha256, + }: + pkgs.fetchzip { + inherit url sha256; + extension = "tar"; + }; + inherit (pkgs) fetchurl; + fetchGit = + { + url, + submodules, + rev, + name, + narHash, + }: + pkgs.fetchgit { + inherit url rev name; + fetchSubmodules = submodules; + hash = narHash; + }; + }; + + # Dispatch to the correct code path based on the type path = if spec.type == "Git" then - mkGitSource spec + mkGitSource fetchers spec else if spec.type == "GitRelease" then - mkGitSource spec + mkGitSource fetchers spec else if spec.type == "PyPi" then - mkPyPiSource spec + mkPyPiSource fetchers spec else if spec.type == "Channel" then - mkChannelSource spec + mkChannelSource fetchers spec else if spec.type == "Tarball" then - mkTarballSource spec + mkTarballSource fetchers spec + else if spec.type == "Container" then + mkContainerSource pkgs spec else builtins.throw "Unknown source type ${spec.type}"; in spec // { outPath = mayOverride name path; }; mkGitSource = + { + fetchTarball, + fetchGit, + ... + }: { repository, revision, url ? null, submodules, hash, - branch ? null, ... }: assert repository ? type; # At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository # In the latter case, there we will always be an url to the tarball if url != null && !submodules then - builtins.fetchTarball { + fetchTarball { inherit url; - sha256 = hash; # FIXME: check nix version & use SRI hashes + sha256 = hash; } else let @@ -93,6 +145,8 @@ let "https://github.com/${repository.owner}/${repository.repo}.git" else if repository.type == "GitLab" then "${repository.server}/${repository.repo_path}.git" + else if repository.type == "Forgejo" then + "${repository.server}/${repository.owner}/${repository.repo}.git" else throw "Unrecognized repository type ${repository.type}"; urlToName = @@ -107,40 +161,89 @@ let "${if matched == null then "source" else builtins.head matched}${appendShort}"; name = urlToName url revision; in - builtins.fetchGit { + fetchGit { rev = revision; - inherit name; - # hash = hash; - inherit url submodules; + narHash = hash; + + inherit name submodules url; }; mkPyPiSource = - { url, hash, ... }: - builtins.fetchurl { + { fetchurl, ... }: + { + url, + hash, + ... + }: + fetchurl { inherit url; sha256 = hash; }; mkChannelSource = - { url, hash, ... }: - builtins.fetchTarball { + { fetchTarball, ... }: + { + url, + hash, + ... + }: + fetchTarball { inherit url; sha256 = hash; }; mkTarballSource = + { fetchTarball, ... }: { url, locked_url ? url, hash, ... }: - builtins.fetchTarball { + fetchTarball { url = locked_url; sha256 = hash; }; + + mkContainerSource = + pkgs: + { + image_name, + image_tag, + image_digest, + ... + }: + if pkgs == null then + builtins.throw "container sources require passing in a Nixpkgs value: https://github.com/andir/npins/blob/master/README.md#using-the-nixpkgs-fetchers" + else + pkgs.dockerTools.pullImage { + imageName = image_name; + imageDigest = image_digest; + finalImageTag = image_tag; + }; in -if version == 5 then - builtins.mapAttrs mkSource data.pins -else - throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`" +mkFunctor ( + { + input ? ./sources.json, + }: + let + data = + if builtins.isPath input then + # while `readFile` will throw an error anyways if the path doesn't exist, + # we still need to check beforehand because *our* error can be caught but not the one from the builtin + # *piegames sighs* + if builtins.pathExists input then + builtins.fromJSON (builtins.readFile input) + else + throw "Input path ${toString input} does not exist" + else if builtins.isAttrs input then + input + else + throw "Unsupported input type ${builtins.typeOf input}, must be a path or an attrset"; + version = data.version; + in + if version == 7 then + builtins.mapAttrs (name: spec: mkFunctor (mkSource name spec)) data.pins + else + throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`" +) diff --git a/npins/sources.json b/npins/sources.json index a08958f83..810313b1f 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -14,20 +14,20 @@ "version": "v0.21.3", "revision": "4a7cf504d83f7d0460f9cf28fe6cbaa5fb856034", "url": "https://api.github.com/repos/ipetkov/crane/tarball/v0.21.3", - "hash": "1a27r58apm5arxyydn78j9yz0aa7d20v4ai688d23lbivfs0jaa5" + "hash": "sha256-RSkJtNtx0SEaQiYqsoFoRynwfZLo2OZ9z6rUq1DJR6g=" }, "dpdk": { "type": "Git", "repository": { "type": "GitHub", - "owner": "DPDK", + "owner": "githedgehog", "repo": "dpdk" }, - "branch": "25.11", + "branch": "pr/daniel-noland/cross-compile-fix", "submodules": false, - "revision": "ed957165eadbe60a47d5ec223578cdd1c13d0bd9", - "url": "https://github.com/DPDK/dpdk/archive/ed957165eadbe60a47d5ec223578cdd1c13d0bd9.tar.gz", - "hash": "09h7wnmq4c9xm1nsyv5mz1yf91c1l6vy9sdcamb09qjjx4wgs0q9" + "revision": "6736a6e32f5b3a8d16b2bd0e84b73af32540de77", + "url": "https://github.com/githedgehog/dpdk/archive/6736a6e32f5b3a8d16b2bd0e84b73af32540de77.tar.gz", + "hash": "sha256-aVtrmUtFkkC2SsnfWJmRN/Klwfb/EGLG+YYtSLm5tBY=" }, "fenix": { "type": "Git", @@ -40,7 +40,7 @@ "submodules": false, "revision": "9591b811e48f906e0a9f7afe89676a1c333415dd", "url": "https://github.com/nix-community/fenix/archive/9591b811e48f906e0a9f7afe89676a1c333415dd.tar.gz", - "hash": "10ywa8zl95y35jqa1yzrdsqrpqvil9ys7mdx40n4n9dsfgcb9gnw" + "hash": "sha256-3L602HO6JUssIL3Vo32iceObsW75+6CwLMOXRD9S3IM=" }, "gateway": { "type": "GitRelease", @@ -56,7 +56,7 @@ "version": "v0.33.0", "revision": "18913fe34d78af396deb1e6a034d0258168122b1", "url": "https://api.github.com/repos/githedgehog/gateway/tarball/v0.33.0", - "hash": "0sjdagppmmb8wjpf8p7gpxjsh18xyy1n6zs3hy08h15ldv0ip2sz" + "hash": "sha256-X4sbwW60BIiAh0N/Y4P3HQWoZb/vXOSu5GjVeu9TTWo=" }, "kopium": { "type": "GitRelease", @@ -72,7 +72,7 @@ "version": "0.22.5", "revision": "f346e2044500c8d71523c35d474bc2f6235a0060", "url": "https://api.github.com/repos/kube-rs/kopium/tarball/0.22.5", - "hash": "14lr2qgfh50rlpw5wgy6cw1qvkz44bwwx06srlks243hgkw9p2fd" + "hash": "sha256-zYmb+HxwEKEnzdqAzvki5M+NA2fGP174pRkU6B4WmZI=" }, "naersk": { "type": "Git", @@ -85,13 +85,13 @@ "submodules": false, "revision": "d4155d6ebb70fbe2314959842f744aa7cabbbf6a", "url": "https://github.com/nix-community/naersk/archive/d4155d6ebb70fbe2314959842f744aa7cabbbf6a.tar.gz", - "hash": "1pmj1d3xp3fjz8m3msvmh8jnylwmgk76iah9qnfs8ddgwlij1v5g" + "hash": "sha256-r+wgI+WvNaSdxQmqaM58lVNvJYJ16zoq+tKN20cLst4=" }, "nixpkgs": { "type": "Channel", "name": "nixpkgs-unstable", - "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.05pre915325.3a7affa77a5a/nixexprs.tar.xz", - "hash": "19kpsffj03kxvxwns3vpcjbg6n6bipsns229xzifazxvkshnddsk" + "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.05pre915678.cfc52a405c6e/nixexprs.tar.xz", + "hash": "sha256-7mq+kpw4eDnEzeg2WoxCXaLvcnG8oNs0e/+KoDZX+P4=" }, "perftest": { "type": "Git", @@ -104,7 +104,7 @@ "submodules": false, "revision": "4e4f6629904ba07bf81f207b31433cb9dabbe8ab", "url": "https://github.com/linux-rdma/perftest/archive/4e4f6629904ba07bf81f207b31433cb9dabbe8ab.tar.gz", - "hash": "0rvwmx9nbhr0m5zmrcpxcqwdjpl4bwsfwc7vmdn31n5gxn0qnn1x" + "hash": "sha256-PViLge2v2DBsq/sw7jRfhF7ZOGb9slx/qSDDZVOvfGc=" }, "rdma-core": { "type": "Git", @@ -117,8 +117,8 @@ "submodules": false, "revision": "9ae1b26593e2cb53239e1124f88ce1698d53857e", "url": "https://github.com/githedgehog/rdma-core/archive/9ae1b26593e2cb53239e1124f88ce1698d53857e.tar.gz", - "hash": "1djdsfga9if02pl8ynnyyf640xdd37fha6zp3xlylciy8apzn1r4" + "hash": "sha256-JAf7r0I+MuppH/cbBd0ZrXVAjPPeWo/oFcDFpJ7TTbY=" } }, - "version": 5 + "version": 7 } From 1d8bf261f4482999f36440dd8cd925e07d3b950c Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 8 Dec 2025 19:16:48 +0000 Subject: [PATCH 080/163] build: re-introduce default-members into workspace This is necessary in order to make the sysroot optional. Some packages simply can't be enabled by default while preserving any useful ergonomics. Signed-off-by: Daniel Noland --- Cargo.toml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 4852b6ccf..b73d10199 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,37 @@ [workspace] +default-members = [ + "args", + "cli", + "concurrency", + "concurrency-macros", + "config", + "dataplane", + "dpdk", + "dpdk-sys", + "dpdk-sysroot-helper", + "errno", + "flow-info", + "hardware", + "id", + "init", + "interface-manager", + "k8s-intf", + "left-right-tlcache", + "mgmt", + "nat", + "net", + "pipeline", + "pkt-meta", + "rekon", + "routing", + "stats", + "sysfs", + "test-utils", + "tracectl", + "vpcmap", +] + members = [ "args", "cli", From da61c9672f32ef735c36e7ef5577ebffdb9c6847 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 8 Dec 2025 18:47:07 +0000 Subject: [PATCH 081/163] build(hardware): remove unused dependency on sysroot Removing this build.rs file facilitates removing dpdk as a strict requirement for the build. The build.rs file for the hardware package is not strictly needed. Strictly speaking, the only packages which actually need this type of build.rs logic are those which produce an actual linked artifact (.so or elf exe or some such). Signed-off-by: Daniel Noland --- Cargo.lock | 1 - hardware/Cargo.toml | 3 --- 2 files changed, 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c08192f84..d08c67f96 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1329,7 +1329,6 @@ dependencies = [ "bolero", "bytecheck", "capctl", - "dataplane-dpdk-sysroot-helper", "dataplane-id", "dataplane-sysfs", "dataplane-test-utils", diff --git a/hardware/Cargo.toml b/hardware/Cargo.toml index b4f469ce1..f2ba9813e 100644 --- a/hardware/Cargo.toml +++ b/hardware/Cargo.toml @@ -49,6 +49,3 @@ serde = { workspace = true, features = ["std"] } serde_yaml_ng = { workspace = true, features = [] } tokio = { workspace = true } tracing-subscriber = { workspace = true } - -[build-dependencies] -dpdk-sysroot-helper = { workspace = true } From b1e2b301765425032bb4107cb89ae566e7eb3a13 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 8 Dec 2025 19:00:04 +0000 Subject: [PATCH 082/163] build(sysfs): remove unused dependency on sysroot The sysfs package does not actually require any linkage against the sysroot, so this can be safely removed. Signed-off-by: Daniel Noland --- Cargo.lock | 1 - sysfs/Cargo.toml | 1 - 2 files changed, 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d08c67f96..755bf575a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1650,7 +1650,6 @@ dependencies = [ name = "dataplane-sysfs" version = "0.7.0" dependencies = [ - "dataplane-dpdk-sysroot-helper", "dataplane-id", "nix 0.30.1", "procfs", diff --git a/sysfs/Cargo.toml b/sysfs/Cargo.toml index ab301ec3f..998e4987a 100644 --- a/sysfs/Cargo.toml +++ b/sysfs/Cargo.toml @@ -26,6 +26,5 @@ tracing-subscriber = { workspace = true, features = ["fmt"] } [build-dependencies] # internal -dpdk-sysroot-helper = { workspace = true } # external From 12031a3393de4cc959f9232ea7057f759b31ab20 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 8 Dec 2025 18:53:32 +0000 Subject: [PATCH 083/163] refactor(dpdk-sysroot-helper): drop unused get_project_root function This function is unused and has been for some time. Signed-off-by: Daniel Noland --- dpdk-sysroot-helper/src/lib.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dpdk-sysroot-helper/src/lib.rs b/dpdk-sysroot-helper/src/lib.rs index 8c5b81f37..3439f8ef0 100644 --- a/dpdk-sysroot-helper/src/lib.rs +++ b/dpdk-sysroot-helper/src/lib.rs @@ -29,10 +29,6 @@ pub fn get_target_name() -> String { .to_string() } -#[must_use] -pub fn get_project_root() -> String { - env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set") -} #[must_use] pub fn get_compile_env() -> String { From de050eee6498b1e9a71022c6e4dd0c20fb38f66f Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 8 Dec 2025 18:54:11 +0000 Subject: [PATCH 084/163] refactor(dpdk-sysroot-helper): drop unused get_compile_env functon This function is unused and has been for some time. Signed-off-by: Daniel Noland --- dpdk-sysroot-helper/src/lib.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/dpdk-sysroot-helper/src/lib.rs b/dpdk-sysroot-helper/src/lib.rs index 3439f8ef0..71456bdc4 100644 --- a/dpdk-sysroot-helper/src/lib.rs +++ b/dpdk-sysroot-helper/src/lib.rs @@ -29,12 +29,6 @@ pub fn get_target_name() -> String { .to_string() } - -#[must_use] -pub fn get_compile_env() -> String { - env::var("COMPILE_ENV").expect("COMPILE_ENV not set") -} - #[must_use] pub fn get_sysroot() -> String { let compile_env = env::var("COMPILE_ENV").expect("COMPILE_ENV not set"); From c9c9d1217be21a82055ee00fc01b9af84cc31e75 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 8 Dec 2025 18:55:04 +0000 Subject: [PATCH 085/163] feat(dpdk-sysroot-helper): intro use_sysroot function This is intended to combat build.rs code duplication across the project. Signed-off-by: Daniel Noland --- dpdk-sysroot-helper/src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dpdk-sysroot-helper/src/lib.rs b/dpdk-sysroot-helper/src/lib.rs index 71456bdc4..54ae40ee2 100644 --- a/dpdk-sysroot-helper/src/lib.rs +++ b/dpdk-sysroot-helper/src/lib.rs @@ -43,3 +43,9 @@ pub fn get_sysroot() -> String { panic!("sysroot not found at {expected_sysroot}") } } + +pub fn use_sysroot() { + let sysroot = get_sysroot(); + println!("cargo:rustc-link-search=all={sysroot}/lib"); + println!("cargo:rustc-link-arg=--sysroot={sysroot}"); +} From 9821a3066444e6a03291d67a0f50e3de0918902e Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 8 Dec 2025 18:57:32 +0000 Subject: [PATCH 086/163] refactor(cli): invoke use_sysroot to de-duplicate code Signed-off-by: Daniel Noland --- cli/build.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cli/build.rs b/cli/build.rs index 1c30f3c66..236576084 100644 --- a/cli/build.rs +++ b/cli/build.rs @@ -2,7 +2,5 @@ // Copyright Open Network Fabric Authors fn main() { - // let sysroot = dpdk_sysroot_helper::get_sysroot(); - // println!("cargo:rustc-link-search=all={sysroot}/lib"); - // println!("cargo:rustc-link-arg=--sysroot={sysroot}"); + dpdk_sysroot_helper::use_sysroot(); } From 5097977924aabff8d24f1373de4126340502e615 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 8 Dec 2025 18:58:33 +0000 Subject: [PATCH 087/163] refactor(init): invoke use_sysroot to de-duplicate code Signed-off-by: Daniel Noland --- init/build.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/init/build.rs b/init/build.rs index 1c30f3c66..236576084 100644 --- a/init/build.rs +++ b/init/build.rs @@ -2,7 +2,5 @@ // Copyright Open Network Fabric Authors fn main() { - // let sysroot = dpdk_sysroot_helper::get_sysroot(); - // println!("cargo:rustc-link-search=all={sysroot}/lib"); - // println!("cargo:rustc-link-arg=--sysroot={sysroot}"); + dpdk_sysroot_helper::use_sysroot(); } From b5e58353e9afcd744bb496e595e2bba5522e7cf9 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 8 Dec 2025 19:10:31 +0000 Subject: [PATCH 088/163] refactor(dpdk): invoke use_sysroot to de-duplicate code Signed-off-by: Daniel Noland --- dpdk/build.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dpdk/build.rs b/dpdk/build.rs index 1c30f3c66..236576084 100644 --- a/dpdk/build.rs +++ b/dpdk/build.rs @@ -2,7 +2,5 @@ // Copyright Open Network Fabric Authors fn main() { - // let sysroot = dpdk_sysroot_helper::get_sysroot(); - // println!("cargo:rustc-link-search=all={sysroot}/lib"); - // println!("cargo:rustc-link-arg=--sysroot={sysroot}"); + dpdk_sysroot_helper::use_sysroot(); } From 053341d556358245bb5ea52113867e4f38aa0700 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 8 Dec 2025 18:55:47 +0000 Subject: [PATCH 089/163] refactor(dataplane): invoke use_sysroot to de-duplicate code Signed-off-by: Daniel Noland --- dataplane/build.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dataplane/build.rs b/dataplane/build.rs index 1c30f3c66..236576084 100644 --- a/dataplane/build.rs +++ b/dataplane/build.rs @@ -2,7 +2,5 @@ // Copyright Open Network Fabric Authors fn main() { - // let sysroot = dpdk_sysroot_helper::get_sysroot(); - // println!("cargo:rustc-link-search=all={sysroot}/lib"); - // println!("cargo:rustc-link-arg=--sysroot={sysroot}"); + dpdk_sysroot_helper::use_sysroot(); } From 4b79b49bbc79925870a86eeda585f108d45e39b9 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 8 Dec 2025 19:07:37 +0000 Subject: [PATCH 090/163] build(cli): make sysroot optional The sysroot was only ever needed here to enforce consistency on the version of libc we link against. Given that the sysroot is now optional, this requirement is now also optional. Signed-off-by: Daniel Noland --- cli/Cargo.toml | 6 +++++- cli/build.rs | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 533308327..19b69bb88 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -10,6 +10,10 @@ autobins = false name = "cli" path = "bin/main.rs" +[features] +default = [] +sysroot = ["dep:dpdk-sysroot-helper"] + [dependencies] bincode2 = { workspace = true, features = [] } clap = { workspace = true, features = ["derive", "std", "usage"] } @@ -22,6 +26,6 @@ thiserror = { workspace = true } [build-dependencies] # internal -dpdk-sysroot-helper = { workspace = true } +dpdk-sysroot-helper = { workspace = true, optional = true } # external diff --git a/cli/build.rs b/cli/build.rs index 236576084..1fc109eb8 100644 --- a/cli/build.rs +++ b/cli/build.rs @@ -2,5 +2,6 @@ // Copyright Open Network Fabric Authors fn main() { + #[cfg(feature = "sysroot")] dpdk_sysroot_helper::use_sysroot(); } From e7f16a68fe98a07b8fd2afe755b16ac21cb33824 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 8 Dec 2025 19:09:30 +0000 Subject: [PATCH 091/163] build(init): make sysroot optional The sysroot is likely functionally necessary for most developers to build the init package (due to the dependency on the hardware crate), it is still possible that the developer will have their own version of the required libraries available. Such builds are entirely unsanitary and can never be used in production, but my be helpful during development. Signed-off-by: Daniel Noland --- init/Cargo.toml | 6 +++++- init/build.rs | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/init/Cargo.toml b/init/Cargo.toml index 0b8f2a8ac..e28ff9696 100644 --- a/init/Cargo.toml +++ b/init/Cargo.toml @@ -5,6 +5,10 @@ license.workspace = true publish.workspace = true version.workspace = true +[features] +default = [] +sysroot = ["dep:dpdk-sysroot-helper"] + [dependencies] # internal hardware = { workspace = true, features = ["serde", "scan"] } @@ -27,6 +31,6 @@ tracing-subscriber = { workspace = true, features = ["fmt"] } [build-dependencies] # internal -dpdk-sysroot-helper = { workspace = true } +dpdk-sysroot-helper = { workspace = true, optional = true } # external diff --git a/init/build.rs b/init/build.rs index 236576084..1fc109eb8 100644 --- a/init/build.rs +++ b/init/build.rs @@ -2,5 +2,6 @@ // Copyright Open Network Fabric Authors fn main() { + #[cfg(feature = "sysroot")] dpdk_sysroot_helper::use_sysroot(); } From 1d9a18326599eb97827a336bcc707391dfa94d3b Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 8 Dec 2025 19:19:06 +0000 Subject: [PATCH 092/163] build: remove init from default-members list Signed-off-by: Daniel Noland --- Cargo.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index b73d10199..304593b3e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,6 @@ default-members = [ "flow-info", "hardware", "id", - "init", "interface-manager", "k8s-intf", "left-right-tlcache", From 8700e2a564c39e419315e6409c1bf90dbe7acb03 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 8 Dec 2025 19:17:41 +0000 Subject: [PATCH 093/163] build: remove dpdk and friends from default-members list Signed-off-by: Daniel Noland --- Cargo.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 304593b3e..5e73d1c64 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,9 +7,6 @@ default-members = [ "concurrency-macros", "config", "dataplane", - "dpdk", - "dpdk-sys", - "dpdk-sysroot-helper", "errno", "flow-info", "hardware", From 1c276f2a81e3809beca2d0730db7efd227041936 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 8 Dec 2025 19:18:57 +0000 Subject: [PATCH 094/163] build: remove hardware from default-members list Signed-off-by: Daniel Noland --- Cargo.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 5e73d1c64..b6666cb4b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,6 @@ default-members = [ "dataplane", "errno", "flow-info", - "hardware", "id", "interface-manager", "k8s-intf", From 47087addd19a3acbb44746286b724495db84f965 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 8 Dec 2025 19:15:30 +0000 Subject: [PATCH 095/163] build(dataplane): make sysroot and dpdk optional for dataplane Now that the sysroot is optional for the dpdk package's dependencies, we can make the sysroot (and dpdk) optional for the whole dataplane. Signed-off-by: Daniel Noland --- dataplane/Cargo.toml | 9 +++++++-- dataplane/build.rs | 1 + dataplane/src/drivers/dpdk.rs | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dataplane/Cargo.toml b/dataplane/Cargo.toml index fe8d430f2..00f7845a3 100644 --- a/dataplane/Cargo.toml +++ b/dataplane/Cargo.toml @@ -5,6 +5,11 @@ license.workspace = true publish.workspace = true version.workspace = true +[features] +default = [] +sysroot = ["dep:dpdk-sysroot-helper"] +dpdk = ["sysroot", "dep:dpdk"] + [dependencies] afpacket = { workspace = true, features = ["async-tokio"] } args = { workspace = true } @@ -13,7 +18,7 @@ axum = { workspace = true, features = ["http1", "tokio"] } axum-server = { workspace = true } concurrency = { workspace = true } ctrlc = { workspace = true, features = ["termination"] } -dpdk = { workspace = true } +dpdk = { workspace = true, optional = true } dyn-iter = { workspace = true } futures = { workspace = true } gwname = { workspace = true } @@ -60,6 +65,6 @@ tracing-subscriber = { workspace = true } [build-dependencies] # internal -dpdk-sysroot-helper = { workspace = true } +dpdk-sysroot-helper = { workspace = true, optional = true } # external diff --git a/dataplane/build.rs b/dataplane/build.rs index 236576084..1fc109eb8 100644 --- a/dataplane/build.rs +++ b/dataplane/build.rs @@ -2,5 +2,6 @@ // Copyright Open Network Fabric Authors fn main() { + #[cfg(feature = "sysroot")] dpdk_sysroot_helper::use_sysroot(); } diff --git a/dataplane/src/drivers/dpdk.rs b/dataplane/src/drivers/dpdk.rs index f5f9b2a57..0f1903220 100644 --- a/dataplane/src/drivers/dpdk.rs +++ b/dataplane/src/drivers/dpdk.rs @@ -3,6 +3,7 @@ //! DPDK dataplane driver +#![cfg(feature = "dpdk")] #![allow(unused)] use dpdk::dev::{Dev, TxOffloadConfig}; From 1cffe66c749689377304e9fb4d8139c92eb24397 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 8 Dec 2025 19:37:08 +0000 Subject: [PATCH 096/163] build: drop most of config.toml This change is temporary and actually reflects substantial attrition in our build process. Specifically, this change exposes us to various forms of sterility violations for local development builds. That said, CI should still be sterile since the versions of rustc, clant, and all sysroot libs shipped in the sterile env are also the one and only valid choice to compile with / link against in those contexts. This step is also an essential proof of concept validation for the removal of the sysroot as a hard dependency. In the very near future we should restructure this project to use nix flakes to avoid the potential for the ever popular "works on my machine." We haven't had a lot of "works on my machine" in the project to date, and I would very much like to keep it that way. Signed-off-by: Daniel Noland --- .cargo/config.toml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 2d61d3bef..a512a26f7 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,9 +1,10 @@ [env] -LIBCLANG_PATH = { value = "compile-env/lib", relative = true, force = false } -PKG_CONFIG_PATH = { value = "compile-env/sysroot/x86_64-unknown-linux-gnu/debug/lib/pkgconfig", relative = true, force = false } -LIBRARY_PATH = { value = "compile-env/sysroot/x86_64-unknown-linux-gnu/debug/lib", relative = true, force = false } +COMPILE_ENV = { value = "compile-env", relative = true, force = false } C_INCLUDE_PATH = { value = "compile-env/sysroot/x86_64-unknown-linux-gnu/debug/include", relative = true, force = false } GW_CRD_PATH = { value = "devroot/src/gateway/config/crd/bases", relative = true, force = false } +LIBCLANG_PATH = { value = "compile-env/lib", relative = true, force = true } +LIBRARY_PATH = { value = "compile-env/sysroot/x86_64-unknown-linux-gnu/debug/lib", relative = true, force = false } +PKG_CONFIG_PATH = { value = "compile-env/sysroot/x86_64-unknown-linux-gnu/debug/lib/pkgconfig", relative = true, force = false } [build] rustflags = [ From 73c3cb971466521746a96405560c4820714486e8 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Thu, 11 Dec 2025 01:28:48 +0000 Subject: [PATCH 097/163] doc(net): remove pointless cfg(doc) trick --- net/src/buffer/test_buffer.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/net/src/buffer/test_buffer.rs b/net/src/buffer/test_buffer.rs index 1b6829a06..f50ba01b6 100644 --- a/net/src/buffer/test_buffer.rs +++ b/net/src/buffer/test_buffer.rs @@ -14,16 +14,14 @@ use crate::buffer::{ }; use tracing::trace; -// only included for doc ref -#[cfg(doc)] -use crate::buffer::PacketBuffer; - // Caution: do not implement Clone for `TestBuffer`. // Clone would significantly deviate from the actual mechanics of a DPDK mbuf. /// Toy data structure which implements [`PacketBuffer`] /// /// The core function of this structure is to facilitate testing by "faking" many useful properties /// of a real DPDK mbuf (without the need to spin up a full EAL). +/// +/// [`PacketBuffer`]: crate::buffer::PacketBuffer #[derive(Debug, Clone)] pub struct TestBuffer { buffer: Vec, From 875f0194d672470186195bedcaa8470dc0c9b63b Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Thu, 11 Dec 2025 01:39:28 +0000 Subject: [PATCH 098/163] build: make nix/socket dependency explicit --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index b6666cb4b..e3d77f733 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -162,7 +162,7 @@ mio = { version = "1.1.1", default-features = false, features = [] } multi_index_map = { version = "0.15.0", default-features = false, features = [] } n-vm = { git = "https://github.com/githedgehog/testn.git", tag = "v0.0.9", default-features = false, features = [] } netdev = { version = "0.39.0", default-features = false, features = [] } -nix = { version = "0.30.1", default-features = false, features = [] } +nix = { version = "0.30.1", default-features = false, features = ["socket"] } num-derive = { version = "0.4.2", default-features = false, features = [] } num-traits = { version = "0.2.19", default-features = false, features = [] } once_cell = { version = "1.21.3", default-features = false, features = [] } From 5fcdca922756422d7c1dc13f232896929d2823a0 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Wed, 10 Dec 2025 20:27:26 +0000 Subject: [PATCH 099/163] great build build refactor --- .cargo/config.toml | 51 ++++++++++++++++++++++++++++++++++++++++++---- .envrc.old | 36 +------------------------------- Cargo.toml | 2 ++ justfile | 11 +++++----- scripts/rust.env | 25 +++-------------------- 5 files changed, 59 insertions(+), 66 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index a512a26f7..b690eeaad 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -6,6 +6,17 @@ LIBCLANG_PATH = { value = "compile-env/lib", relative = true, force = true } LIBRARY_PATH = { value = "compile-env/sysroot/x86_64-unknown-linux-gnu/debug/lib", relative = true, force = false } PKG_CONFIG_PATH = { value = "compile-env/sysroot/x86_64-unknown-linux-gnu/debug/lib/pkgconfig", relative = true, force = false } +[unstable] +build-std = [ + "compiler_builtins", + "core", + "alloc", + "std", + "panic_unwind", + "proc_macro" +] +build-std-features = ["backtrace", "panic-unwind", "mem"] + [build] rustflags = [ "--cfg", @@ -15,11 +26,43 @@ rustflags = [ [target.x86_64-unknown-linux-gnu] runner = ["scripts/test-runner.sh"] rustflags = [ - "--cfg", - "tokio_unstable", + "--cfg=tokio_unstable", + "-Cdebuginfo=full", + "-Cdwarf-version=5", + "-Clink-arg=--ld-path=./compile-env/bin/ld.lld", + "-Clinker=./compile-env/bin/clang", +] + +[profile.dev] +incremental = true +rustflags = [ + "-Ccodegen-units=64", + "-Cdebug-assertions=on", + "-Copt-level=0", + "-Coverflow-checks=on", + "-Ctarget-cpu=generic", +] + +[profile.dev.build-override] +rustflags = [] + +[profile.release] +incremental = false +rustflags = [ + "-Ccodegen-units=1", + "-Cdebug-assertions=off", + "-Cembed-bitcode=yes", + "-Clink-arg=-Wl,-O3,--lto-O3,-z,relro,-z,now,--lto-whole-program-visibility,--as-needed,--gc-sections", + "-Clink-arg=-flto=full", + "-Clto=fat", "-Clinker-plugin-lto", "-Copt-level=3", - "-Cembed-bitcode=yes", - "-Ccodegen-units=1", + "-Coverflow-checks=off", "-Crelro-level=full", + "-Ctarget-cpu=znver4", + "-Ztune-cpu=znver5", + "-Zsplit-lto-unit", ] + +[profile.release.build-override] +rustflags = [] diff --git a/.envrc.old b/.envrc.old index 41bfc8c5d..319e53249 100644 --- a/.envrc.old +++ b/.envrc.old @@ -1,7 +1,6 @@ export PROJECT_DIR="$(pwd)" if [ -h "${PROJECT_DIR}/compile-env" ] || [ -d "${PROJECT_DIR}/compile-env" ]; then - export PATH="${PROJECT_DIR}/compile-env/bin:$PATH" export LIBCLANG_PATH="${PROJECT_DIR}/compile-env/bin" export COMPILE_ENV="${PROJECT_DIR}/compile-env" else @@ -10,37 +9,4 @@ else fi export NEXTEST_EXPERIMENTAL_LIBTEST_JSON=1 - -CRT="-C target-feature=-crt-static" -DEBUG="-C debuginfo=full -C split-debuginfo=off -C dwarf-version=5" -LINKER="-C linker=${COMPILE_ENV}/bin/clang -C link-arg=--ld-path=${COMPILE_ENV}/bin/ld.lld" -RELRO="-C relro-level=full" -TARGET_CPU="-C target-cpu=x86-64-v3" - -RUSTFLAGS="${CRT} ${DEBUG} ${LINKER} ${RELRO} ${TARGET_CPU}" - -OPTIMIZE="-C opt-level=3 -C linker-plugin-lto -C lto=thin -C embed-bitcode=yes -C codegen-units=1" - -case ${PROFILE:-DEBUG} in - fuzz|FUZZ) - COVERAGE="-C instrument-coverage" - DEBUG_ASSERTIONS="-C debug-assertions=on" - OVERFLOW_CHECK="-C overflow-checks=on" - RUSTFLAGS="${RUSTFLAGS} ${COVERAGE} ${DEBUG_ASSERTIONS} ${OVERFLOW_CHECK}" - ;; - release|RELEASE) - RUSTFLAGS="${RUSTFLAGS} ${OPTIMIZE}" - ;; - debug|DEBUG) - DEBUG_ASSERTIONS="-C debug-assertions=on" - OPTIMIZE="-C opt-level=0" - OVERFLOW_CHECK="-C overflow-checks=on" - RUSTFLAGS="${RUSTFLAGS} ${OPTIMIZE} ${DEBUG_ASSERTIONS} ${OVERFLOW_CHECK}" - ;; - *) - >&2 echo "unknown profile" - exit 1 - ;; -esac - -export RUSTFLAGS +unset RUSTFLAGS diff --git a/Cargo.toml b/Cargo.toml index e3d77f733..fcfcb8521 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,5 @@ +cargo-features = ["profile-rustflags"] + [workspace] default-members = [ diff --git a/justfile b/justfile index 10d23f344..0b6d5edb4 100644 --- a/justfile +++ b/justfile @@ -158,15 +158,15 @@ cargo *args: for arg in "${args[@]}"; do case "$arg" in --debug|--profile=debug|--cargo-profile=debug) - declare -rx RUSTFLAGS="${RUSTFLAGS_DEBUG}" + declare -x RUSTFLAGS="${RUSTFLAGS_DEBUG}" declare -rx LIBC_ENV_PROFILE="debug" ;; --release|--profile=release|--cargo-profile=release) - declare -rx RUSTFLAGS="${RUSTFLAGS_RELEASE}" + declare -x RUSTFLAGS="${RUSTFLAGS_RELEASE}" extra_args+=("$arg") ;; --profile=fuzz|--cargo-profile=fuzz) - declare -rx RUSTFLAGS="${RUSTFLAGS_FUZZ}" + declare -x RUSTFLAGS="${RUSTFLAGS_FUZZ}" export RUSTC_BOOTSTRAP=1 extra_args+=("$arg") ;; @@ -176,10 +176,11 @@ cargo *args: esac done if [ -z "${RUSTFLAGS:-}" ]; then - declare -rx RUSTFLAGS="${RUSTFLAGS_DEBUG}" + #declare -x RUSTFLAGS="${RUSTFLAGS_DEBUG}" + unset RUSTFLAGS fi - export RUSTDOCFLAGS="${RUSTDOCFLAGS:-} ${RUSTFLAGS} --html-in-header $(pwd)/scripts/doc/custom-header.html" + #export RUSTDOCFLAGS="${RUSTDOCFLAGS:-} ${RUSTFLAGS} --html-in-header $(pwd)/scripts/doc/custom-header.html" ./compile-env/bin/cargo "${extra_args[@]}" # Run the (very minimal) compile environment diff --git a/scripts/rust.env b/scripts/rust.env index e91209242..9e9644e4e 100644 --- a/scripts/rust.env +++ b/scripts/rust.env @@ -1,24 +1,5 @@ RUSTC_BOOTSTRAP=1 -NEXTEST_EXPERIMENTAL_LIBTEST_JSON=1 -LINKER="-C linker=clang -C link-arg=--ld-path=ld.lld -C link-arg=-Wl,--gc-sections,--as-needed -C link-arg=-flto=full" -RELRO="-C relro-level=full" -CRT_STATIC="-C target-feature=+crt-static" -CRT_DYNAMIC="-C target-feature=-crt-static" -DEBUG="-C debuginfo=full -C split-debuginfo=off -C dwarf-version=5" -DEBUG_ASSERTIONS_ON="-C debug-assertions=on" -DEBUG_ASSERTIONS_OFF="-C debug-assertions=off" -OVERFLOW_CHECK_ON="-C overflow-checks=on" -OVERFLOW_CHECK_OFF="-C overflow-checks=off" -LTO="-C linker-plugin-lto -C lto=thin -C embed-bitcode=yes -C codegen-units=1" -COVERAGE="-C instrument-coverage" -OPTIMIZE_OFF="${DEBUG_ASSERTIONS_ON} ${OVERFLOW_CHECK_ON}" -OPTIMIZE_ON="-C opt-level=3 ${LTO} ${DEBUG_ASSERTIONS_OFF} ${OVERFLOW_CHECK_OFF}" -OPTIMIZE_FUZZ="-C opt-level=3 ${LTO} ${DEBUG_ASSERTIONS_ON} ${OVERFLOW_CHECK_ON}" -TARGET_CPU_DEBUG="-C target-cpu=generic" -TARGET_CPU_RELEASE="-C target-cpu=x86-64-v3" -TOKIO_UNSTABLE="--cfg tokio_unstable" -COMMON="${LINKER} ${RELRO} ${DEBUG}" -RUSTFLAGS_DEBUG="${COMMON} ${OPTIMIZE_OFF} ${TARGET_CPU_DEBUG} ${CRT_DYNAMIC} ${TOKIO_UNSTABLE}" -RUSTFLAGS_RELEASE="${COMMON} ${OPTIMIZE_ON} ${TARGET_CPU_RELEASE} ${CRT_DYNAMIC} ${TOKIO_UNSTABLE}" -RUSTFLAGS_FUZZ="${COMMON} ${OPTIMIZE_FUZZ} ${TARGET_CPU_RELEASE} ${CRT_DYNAMIC} ${TOKIO_UNSTABLE}" +RUSTFLAGS_DEBUG="" +RUSTFLAGS_RELEASE="" +RUSTFLAGS_FUZZ="" From 6bd3f51ae83e1fd5840036808fa7bf10245e2c6a Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Thu, 11 Dec 2025 01:52:01 +0000 Subject: [PATCH 100/163] wip --- .cargo/config.toml | 39 +++++++++++++++++++-------------------- default.nix | 18 ++++++++++-------- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index b690eeaad..5866d41d1 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,10 +1,10 @@ [env] -COMPILE_ENV = { value = "compile-env", relative = true, force = false } -C_INCLUDE_PATH = { value = "compile-env/sysroot/x86_64-unknown-linux-gnu/debug/include", relative = true, force = false } +PATH = { value = "devroot/bin", relative = true, force = true } +C_INCLUDE_PATH = { value = "sysroot/include", relative = true, force = false } GW_CRD_PATH = { value = "devroot/src/gateway/config/crd/bases", relative = true, force = false } -LIBCLANG_PATH = { value = "compile-env/lib", relative = true, force = true } -LIBRARY_PATH = { value = "compile-env/sysroot/x86_64-unknown-linux-gnu/debug/lib", relative = true, force = false } -PKG_CONFIG_PATH = { value = "compile-env/sysroot/x86_64-unknown-linux-gnu/debug/lib/pkgconfig", relative = true, force = false } +LIBCLANG_PATH = { value = "devroot/lib", relative = true, force = true } +LIBRARY_PATH = { value = "sysroot/lib", relative = true, force = false } +PKG_CONFIG_PATH = { value = "sysroot/lib/pkgconfig", relative = true, force = true } [unstable] build-std = [ @@ -19,25 +19,23 @@ build-std-features = ["backtrace", "panic-unwind", "mem"] [build] rustflags = [ - "--cfg", - "tokio_unstable", + "--cfg=tokio_unstable", + "-Clink-arg=-fuse-ld=lld", + "-Clinker=clang", ] [target.x86_64-unknown-linux-gnu] runner = ["scripts/test-runner.sh"] -rustflags = [ - "--cfg=tokio_unstable", - "-Cdebuginfo=full", - "-Cdwarf-version=5", - "-Clink-arg=--ld-path=./compile-env/bin/ld.lld", - "-Clinker=./compile-env/bin/clang", -] [profile.dev] -incremental = true rustflags = [ + "--cfg=tokio_unstable", "-Ccodegen-units=64", "-Cdebug-assertions=on", + "-Cdebuginfo=full", + "-Cdwarf-version=5", + "-Clink-arg=-fuse-ld=lld", + "-Clinker=clang", "-Copt-level=0", "-Coverflow-checks=on", "-Ctarget-cpu=generic", @@ -47,20 +45,21 @@ rustflags = [ rustflags = [] [profile.release] -incremental = false rustflags = [ + "--cfg=tokio_unstable", "-Ccodegen-units=1", "-Cdebug-assertions=off", + "-Cdebuginfo=full", + "-Cdwarf-version=5", "-Cembed-bitcode=yes", - "-Clink-arg=-Wl,-O3,--lto-O3,-z,relro,-z,now,--lto-whole-program-visibility,--as-needed,--gc-sections", + "-Clink-arg=-Wl,-z,relro,-z,now,--lto-whole-program-visibility,--as-needed,--gc-sections", "-Clink-arg=-flto=full", - "-Clto=fat", + "-Clink-arg=-fuse-ld=lld", "-Clinker-plugin-lto", + "-Clinker=clang", "-Copt-level=3", "-Coverflow-checks=off", "-Crelro-level=full", - "-Ctarget-cpu=znver4", - "-Ztune-cpu=znver5", "-Zsplit-lto-unit", ] diff --git a/default.nix b/default.nix index 9cc38adec..24174c90a 100644 --- a/default.nix +++ b/default.nix @@ -80,7 +80,7 @@ let }; crane-base = import sources.crane { pkgs = dataplane-pkgs; }; crane = crane-base.craneLib.overrideToolchain dataplane-pkgs.rust-toolchain; - dev-tools = dataplane-pkgs.symlinkJoin { + devroot = dataplane-pkgs.symlinkJoin { name = "dataplane-dev-shell"; paths = [ clangd-config @@ -101,7 +101,9 @@ let direnv gateway-crd just + kopium npins + rust-toolchain ]); }; dataplane-src = crane.cleanCargoSource ./.; @@ -275,18 +277,18 @@ let in { inherit + cargoArtifacts + commonArgs + crane dataplane-dev-pkgs dataplane-pkgs - dev-tools + devroot + package + package-list + packages profile sources sysroot - crane - commonArgs - cargoArtifacts - package - packages - package-list ; inherit (package) From d25186c6688d7a2e2f56f1ed5e4db5a57f792cb8 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Thu, 25 Dec 2025 21:39:02 +0000 Subject: [PATCH 101/163] christmas time --- .cargo/config.toml | 36 ---------------- Cargo.lock | 45 ++++++++++++-------- default.nix | 104 +++++---------------------------------------- 3 files changed, 38 insertions(+), 147 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 5866d41d1..8b317d955 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,5 +1,4 @@ [env] -PATH = { value = "devroot/bin", relative = true, force = true } C_INCLUDE_PATH = { value = "sysroot/include", relative = true, force = false } GW_CRD_PATH = { value = "devroot/src/gateway/config/crd/bases", relative = true, force = false } LIBCLANG_PATH = { value = "devroot/lib", relative = true, force = true } @@ -18,16 +17,6 @@ build-std = [ build-std-features = ["backtrace", "panic-unwind", "mem"] [build] -rustflags = [ - "--cfg=tokio_unstable", - "-Clink-arg=-fuse-ld=lld", - "-Clinker=clang", -] - -[target.x86_64-unknown-linux-gnu] -runner = ["scripts/test-runner.sh"] - -[profile.dev] rustflags = [ "--cfg=tokio_unstable", "-Ccodegen-units=64", @@ -40,28 +29,3 @@ rustflags = [ "-Coverflow-checks=on", "-Ctarget-cpu=generic", ] - -[profile.dev.build-override] -rustflags = [] - -[profile.release] -rustflags = [ - "--cfg=tokio_unstable", - "-Ccodegen-units=1", - "-Cdebug-assertions=off", - "-Cdebuginfo=full", - "-Cdwarf-version=5", - "-Cembed-bitcode=yes", - "-Clink-arg=-Wl,-z,relro,-z,now,--lto-whole-program-visibility,--as-needed,--gc-sections", - "-Clink-arg=-flto=full", - "-Clink-arg=-fuse-ld=lld", - "-Clinker-plugin-lto", - "-Clinker=clang", - "-Copt-level=3", - "-Coverflow-checks=off", - "-Crelro-level=full", - "-Zsplit-lto-unit", -] - -[profile.release.build-override] -rustflags = [] diff --git a/Cargo.lock b/Cargo.lock index 755bf575a..0ebe64b3e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -145,9 +145,12 @@ checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1" [[package]] name = "arc-swap" -version = "1.7.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" +checksum = "51d03449bb8ca2cc2ef70869af31463d1ae5ccc8fa3e334b307203fbf815207e" +dependencies = [ + "rustversion", +] [[package]] name = "arrayvec" @@ -1534,7 +1537,7 @@ dependencies = [ "derive_builder 0.20.2", "etherparse", "linkme", - "linux-raw-sys 0.12.0", + "linux-raw-sys 0.12.1", "multi_index_map", "ordermap", "rapidhash", @@ -1791,18 +1794,18 @@ dependencies = [ [[package]] name = "derive_more" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10b768e943bed7bf2cab53df09f4bc34bfd217cdb57d971e769874c9a6710618" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" dependencies = [ "derive_more-impl", ] [[package]] name = "derive_more-impl" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d286bfdaf75e988b4a78e013ecd79c581e06399ab53fbacd2d916c2f904f30b" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" dependencies = [ "convert_case 0.10.0", "proc-macro2", @@ -3156,9 +3159,9 @@ checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" [[package]] name = "linux-raw-sys" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b83b49c75b50cb715b09d337b045481493a8ada2bb3e872f2bae71db45b27696" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" [[package]] name = "litemap" @@ -4418,9 +4421,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.26" +version = "0.12.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b4c14b2d9afca6a60277086b0cc6a6ae0b568f6f7916c943a8cdc79f8be240f" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" dependencies = [ "base64 0.22.1", "bytes", @@ -4546,9 +4549,9 @@ dependencies = [ [[package]] name = "rustix" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" +checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" dependencies = [ "bitflags 2.10.0", "errno", @@ -4828,15 +4831,15 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.145" +version = "1.0.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" +checksum = "6af14725505314343e673e9ecb7cd7e8a36aa9791eb936235a3567cc31447ae4" dependencies = [ "itoa", "memchr", - "ryu", "serde", "serde_core", + "zmij", ] [[package]] @@ -5242,9 +5245,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.23.0" +version = "3.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" +checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c" dependencies = [ "fastrand 2.3.0", "getrandom 0.3.4", @@ -6449,3 +6452,9 @@ dependencies = [ "quote", "syn 2.0.111", ] + +[[package]] +name = "zmij" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e404bcd8afdaf006e529269d3e85a743f9480c3cef60034d77860d02964f3ba" diff --git a/default.nix b/default.nix index 24174c90a..77d4f54a4 100644 --- a/default.nix +++ b/default.nix @@ -112,7 +112,7 @@ let commonArgs = { src = dataplane-src; strictDeps = true; - CARGO_PROFILE = "release"; + CARGO_PROFILE = "dev"; nativeBuildInputs = [ dataplane-dev-pkgs.pkg-config @@ -123,11 +123,15 @@ let ]; env = { + PATH = "${devroot}/bin"; LIBCLANG_PATH = "${dataplane-pkgs.pkgsBuildHost.llvmPackages.libclang.lib}/lib"; C_INCLUDE_PATH = "${sysroot}/include"; LIBRARY_PATH = "${sysroot}/lib"; PKG_CONFIG_PATH = "${sysroot}/lib/pkgconfig"; GW_CRD_PATH = "${dataplane-dev-pkgs.gateway-crd}/src/gateway/config/crd/bases"; + RUSTC_BOOTSTRAP = "1"; + # RUSTFLAGS = "potato"; + RUSTFLAGS = "--cfg=tokio_unstable -Ccodegen-units=64 -Cdebug-assertions=on -Cdebuginfo=full -Cdwarf-version=5 -Clink-arg=-fuse-ld=lld -Clink-arg=--ld-path=${devroot}/bin/ld.lld -Clinker=${devroot}/bin/clang -Copt-level=0 -Coverflow-checks=on -Ctarget-cpu=generic"; }; }; # Build *just* the cargo dependencies (of the entire workspace), @@ -141,6 +145,7 @@ let # NB: we disable tests since we'll run them all via cargo-nextest doCheck = false; }; + # TODO: this is hacky nonsense, clean up the fileset call fileSetForCrate = crate: lib.fileset.toSource { @@ -177,8 +182,12 @@ let individualCrateArgs // { inherit pname; - cargoExtraArgs = "--package ${pname}"; + cargoExtraArgs = "-Z unstable-options --package ${pname}"; src = fileSetForCrate (./. + p); + # RUSTC_BOOTSTRAP = "1"; + # env = { + # RUSTC_BOOTSTRAP = "1"; + # }; nativeBuildInputs = [ pkg-config kopium @@ -194,86 +203,6 @@ let } ) ) package-list; - - package.rekon = crane.buildPackage ( - individualCrateArgs - // { - pname = "dataplane-rekon"; - cargoExtraArgs = "--package dataplane-rekon"; - src = fileSetForCrate ./rekon; - } - ); - package.net = crane.buildPackage ( - individualCrateArgs - // { - pname = "dataplane-net"; - cargoExtraArgs = "--package dataplane-net"; - src = fileSetForCrate ./net; - } - ); - package.cli = crane.buildPackage ( - individualCrateArgs - // { - pname = "dataplane-cli"; - cargoExtraArgs = "--package dataplane-cli"; - src = fileSetForCrate ./cli; - } - ); - package.dpdk-sysroot-helper = crane.buildPackage ( - individualCrateArgs - // { - pname = "dataplane-dpdk-sysroot-helper"; - cargoExtraArgs = "--package dataplane-dpdk-sysroot-helper"; - src = fileSetForCrate ./dpdk-sysroot-helper; - } - ); - package.dpdk-sys = crane.buildPackage ( - individualCrateArgs - // { - pname = "dataplane-dpdk-sys"; - cargoExtraArgs = "--package dataplane-dpdk-sys"; - src = fileSetForCrate ./dpdk-sys; - } - ); - package.pdpdk = crane.buildPackage ( - individualCrateArgs - // { - pname = "dataplane-dpdk"; - cargoExtraArgs = "--package dataplane-dpdk"; - src = fileSetForCrate ./dpdk; - } - ); - package.dataplane = - let - expr = - { - pkg-config, - kopium, - llvmPackages, - }: - crane.buildPackage ( - individualCrateArgs - // { - pname = "dataplane"; - cargoExtraArgs = "--package dataplane"; - src = fileSetForCrate ./dataplane; - nativeBuildInputs = [ - pkg-config - kopium - # llvmPackages.libclang.lib - # llvmPackages.clang - # llvmPackages.lld - ]; - buildInputs = [ ]; - } - ); - in - dataplane-pkgs.callPackage expr { - # stdenv = dataplane-pkgs.stdenv'; - inherit (dataplane-dev-pkgs) pkg-config kopium; - inherit (dataplane-pkgs) llvmPackages; - }; - in { inherit @@ -283,22 +212,11 @@ in dataplane-dev-pkgs dataplane-pkgs devroot - package package-list packages profile sources sysroot ; - - inherit (package) - rekon - net - cli - dataplane-dpdk-sysroot-helper - dpdk-sys - pdpdk - dataplane - ; platform = platform'; } From f1f0b5c7575a4e86e7385b944fabf555be1e1157 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Thu, 25 Dec 2025 22:39:34 +0000 Subject: [PATCH 102/163] going to try oxa's overlay --- .cargo/config.toml | 20 ++++++++++---------- Cargo.lock | 29 +++++++++++++++-------------- Cargo.toml | 1 + default.nix | 42 ++++++++++++++++++++++++++++++------------ nix/profiles.nix | 6 +++--- npins/sources.json | 10 +++++----- 6 files changed, 64 insertions(+), 44 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 8b317d955..2b4a872ac 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -5,16 +5,16 @@ LIBCLANG_PATH = { value = "devroot/lib", relative = true, force = true } LIBRARY_PATH = { value = "sysroot/lib", relative = true, force = false } PKG_CONFIG_PATH = { value = "sysroot/lib/pkgconfig", relative = true, force = true } -[unstable] -build-std = [ - "compiler_builtins", - "core", - "alloc", - "std", - "panic_unwind", - "proc_macro" -] -build-std-features = ["backtrace", "panic-unwind", "mem"] +# [unstable] +# build-std = [ +# "compiler_builtins", +# "core", +# "alloc", +# "std", +# "panic_unwind", +# "proc_macro" +# ] +# build-std-features = ["backtrace", "panic-unwind", "mem"] [build] rustflags = [ diff --git a/Cargo.lock b/Cargo.lock index 0ebe64b3e..c9d498268 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1411,7 +1411,7 @@ dependencies = [ "kube", "linkme", "rustls", - "schemars 1.1.0", + "schemars 1.2.0", "serde", "serde-duration-ext", "serde_json", @@ -2126,9 +2126,9 @@ dependencies = [ [[package]] name = "fs-err" -version = "3.2.1" +version = "3.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824f08d01d0f496b3eca4f001a13cf17690a6ee930043d20817f547455fd98f8" +checksum = "baf68cef89750956493a66a10f512b9e58d9db21f2a573c079c0bdf1207a54a7" dependencies = [ "autocfg", "tokio", @@ -2939,7 +2939,7 @@ checksum = "06d9e5e61dd037cdc51da0d7e2b2be10f497478ea7e120d85dad632adb99882b" dependencies = [ "base64 0.22.1", "chrono", - "schemars 1.1.0", + "schemars 1.2.0", "serde", "serde_json", ] @@ -3015,7 +3015,7 @@ dependencies = [ "http 1.4.0", "json-patch", "k8s-openapi", - "schemars 1.1.0", + "schemars 1.2.0", "serde", "serde-value", "serde_json", @@ -4688,9 +4688,9 @@ dependencies = [ [[package]] name = "schemars" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9558e172d4e8533736ba97870c4b2cd63f84b382a3d6eb063da41b91cce17289" +checksum = "54e910108742c57a770f492731f99be216a52fadd361b06c8fb59d74ccc267d2" dependencies = [ "dyn-clone", "ref-cast", @@ -4701,9 +4701,9 @@ dependencies = [ [[package]] name = "schemars_derive" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301858a4023d78debd2353c7426dc486001bddc91ae31a76fb1f55132f7e2633" +checksum = "4908ad288c5035a8eb12cfdf0d49270def0a268ee162b75eeee0f85d155a7c45" dependencies = [ "proc-macro2", "quote", @@ -4886,7 +4886,7 @@ dependencies = [ "indexmap 1.9.3", "indexmap 2.12.1", "schemars 0.9.0", - "schemars 1.1.0", + "schemars 1.2.0", "serde_core", "serde_json", "time", @@ -4995,10 +4995,11 @@ dependencies = [ [[package]] name = "signal-hook-registry" -version = "1.4.7" +version = "1.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7664a098b8e616bdfcc2dc0e9ac44eb231eedf41db4e9fe95d8d32ec728dedad" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" dependencies = [ + "errno", "libc 0.2.178", ] @@ -6455,6 +6456,6 @@ dependencies = [ [[package]] name = "zmij" -version = "0.1.7" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e404bcd8afdaf006e529269d3e85a743f9480c3cef60034d77860d02964f3ba" +checksum = "d0095ecd462946aa3927d9297b63ef82fb9a5316d7a37d134eeb36e58228615a" diff --git a/Cargo.toml b/Cargo.toml index fcfcb8521..94b52f8ef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -212,6 +212,7 @@ tracing-test = { version = "0.2.5", default-features = false, features = [] } ureq = { version = "3.1.4", default-features = false, features = [] } url = { version = "2.5.7", default-features = false, features = [] } uuid = { version = "1.19.0", default-features = false, features = [] } +cfg-if = { version = "=1.0.1", default-features = true, features = [] } [profile.dev] panic = "unwind" diff --git a/default.nix b/default.nix index 77d4f54a4..be4745e4f 100644 --- a/default.nix +++ b/default.nix @@ -3,7 +3,7 @@ { platform ? "x86-64-v3", libc ? "gnu", - prof ? "debug", + profile ? "debug", instrumentation ? "none", sanitize ? "", }: @@ -11,23 +11,26 @@ let lib = (import sources.nixpkgs { }).lib; # helper method to work around nix's contrived builtin string split function. split-str = - split: str: - if str == "" then [ ] else builtins.filter (elm: builtins.isString elm) (builtins.split split str); + split-on: string: + if string == "" then + [ ] + else + builtins.filter (elm: builtins.isString elm) (builtins.split split-on string); sanitizers = split-str ",+" sanitize; sources = import ./npins; platform' = import ./nix/platforms.nix { inherit lib platform libc; }; - profile = import ./nix/profiles.nix { - inherit prof sanitizers instrumentation; + profile' = import ./nix/profiles.nix { + inherit sanitizers instrumentation profile; arch = platform'.arch; }; overlays = import ./nix/overlays { inherit sources sanitizers - profile ; + profile = profile'; platform = platform'; }; dataplane-dev-pkgs = import sources.nixpkgs { @@ -172,6 +175,7 @@ let p: pname: ( let + src = fileSetForCrate (./. + p); package-expr = { pkg-config, @@ -181,9 +185,24 @@ let crane.buildPackage ( individualCrateArgs // { - inherit pname; - cargoExtraArgs = "-Z unstable-options --package ${pname}"; - src = fileSetForCrate (./. + p); + inherit pname src; + cargoExtraArgs = "-Z unstable-options -Z build-std --package ${pname}"; + cargoVendorDir = crane.vendorMultipleCargoDeps { + inherit (crane.findCargoFiles src) cargoConfigs; + cargoLockList = [ + ./Cargo.lock + + # Unfortunately this approach requires IFD (import-from-derivation) + # otherwise Nix will refuse to read the Cargo.lock from our toolchain + # (unless we build with `--impure`). + # + # Another way around this is to manually copy the rustlib `Cargo.lock` + # to the repo and import it with `./path/to/rustlib/Cargo.lock` which + # will avoid IFD entirely but will require manually keeping the file + # up to date! + "${dataplane-dev-pkgs.rust-bin.passthru.availableComponents.rust-src}/lib/rustlib/src/rust/library/Cargo.lock" + ]; + }; # RUSTC_BOOTSTRAP = "1"; # env = { # RUSTC_BOOTSTRAP = "1"; @@ -198,8 +217,7 @@ let ); in dataplane-pkgs.callPackage package-expr { - inherit (dataplane-dev-pkgs) pkg-config kopium; - inherit (dataplane-dev-pkgs) llvmPackages; + inherit (dataplane-dev-pkgs) pkg-config kopium llvmPackages; } ) ) package-list; @@ -214,9 +232,9 @@ in devroot package-list packages - profile sources sysroot ; + profile = profile'; platform = platform'; } diff --git a/nix/profiles.nix b/nix/profiles.nix index f6e9d69a1..f009e8c6f 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -2,7 +2,7 @@ # Copyright Open Network Fabric Authors { arch, - prof, + profile, sanitizers, instrumentation, }: @@ -129,7 +129,7 @@ let builtins.foldl' ( acc: elem: acc // (builtins.mapAttrs (var: val: (acc.${var} or [ ]) ++ val) elem) ) { } features; - profile = { + profile-map = { debug = combine-profiles [ common debug @@ -143,7 +143,7 @@ let in combine-profiles ( [ - profile."${prof}" + profile-map."${profile}" march."${arch}" instrument."${instrumentation}" ] diff --git a/npins/sources.json b/npins/sources.json index 810313b1f..93502f9c2 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -38,9 +38,9 @@ }, "branch": "main", "submodules": false, - "revision": "9591b811e48f906e0a9f7afe89676a1c333415dd", - "url": "https://github.com/nix-community/fenix/archive/9591b811e48f906e0a9f7afe89676a1c333415dd.tar.gz", - "hash": "sha256-3L602HO6JUssIL3Vo32iceObsW75+6CwLMOXRD9S3IM=" + "revision": "8bfb0290049432d3785d4b29950ae37ff20a89cb", + "url": "https://github.com/nix-community/fenix/archive/8bfb0290049432d3785d4b29950ae37ff20a89cb.tar.gz", + "hash": "sha256-UzzTtDkdc4s9qJY/QU52Ovuq2zWom0cLInCwaXLZlfo=" }, "gateway": { "type": "GitRelease", @@ -90,8 +90,8 @@ "nixpkgs": { "type": "Channel", "name": "nixpkgs-unstable", - "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.05pre915678.cfc52a405c6e/nixexprs.tar.xz", - "hash": "sha256-7mq+kpw4eDnEzeg2WoxCXaLvcnG8oNs0e/+KoDZX+P4=" + "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.05pre916402.3c1016e6acd1/nixexprs.tar.xz", + "hash": "sha256-+nB3AQBn/uci4InrgicaaQhqxExFl4xHr2wyjem0TD8=" }, "perftest": { "type": "Git", From dd72889307dd31b098f2663eab7c87fba039dcad Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Thu, 25 Dec 2025 23:45:17 +0000 Subject: [PATCH 103/163] clang linker issue for cross compile --- .cargo/config.toml | 2 +- Cargo.toml | 3 --- default.nix | 11 +++++++---- nix/overlays/dataplane-dev.nix | 6 +----- nix/overlays/dataplane.nix | 11 ++++++----- nix/profiles.nix | 2 +- npins/sources.json | 13 +++++++++++++ 7 files changed, 29 insertions(+), 19 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 2b4a872ac..78401ce46 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -5,7 +5,7 @@ LIBCLANG_PATH = { value = "devroot/lib", relative = true, force = true } LIBRARY_PATH = { value = "sysroot/lib", relative = true, force = false } PKG_CONFIG_PATH = { value = "sysroot/lib/pkgconfig", relative = true, force = true } -# [unstable] +[unstable] # build-std = [ # "compiler_builtins", # "core", diff --git a/Cargo.toml b/Cargo.toml index 94b52f8ef..e3d77f733 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,3 @@ -cargo-features = ["profile-rustflags"] - [workspace] default-members = [ @@ -212,7 +210,6 @@ tracing-test = { version = "0.2.5", default-features = false, features = [] } ureq = { version = "3.1.4", default-features = false, features = [] } url = { version = "2.5.7", default-features = false, features = [] } uuid = { version = "1.19.0", default-features = false, features = [] } -cfg-if = { version = "=1.0.1", default-features = true, features = [] } [profile.dev] panic = "unwind" diff --git a/default.nix b/default.nix index be4745e4f..61c5ec188 100644 --- a/default.nix +++ b/default.nix @@ -33,8 +33,10 @@ let profile = profile'; platform = platform'; }; + rust-overlay = import sources.rust-overlay; dataplane-dev-pkgs = import sources.nixpkgs { overlays = [ + rust-overlay overlays.llvm overlays.dataplane-dev ]; @@ -42,6 +44,7 @@ let dataplane-pkgs = (import sources.nixpkgs { overlays = [ + rust-overlay overlays.llvm overlays.dataplane ]; @@ -186,7 +189,7 @@ let individualCrateArgs // { inherit pname src; - cargoExtraArgs = "-Z unstable-options -Z build-std --package ${pname}"; + cargoExtraArgs = "-Z unstable-options -Z build-std=compiler_builtins,core,alloc,std,panic_unwind,proc_macro --package ${pname}"; cargoVendorDir = crane.vendorMultipleCargoDeps { inherit (crane.findCargoFiles src) cargoConfigs; cargoLockList = [ @@ -200,7 +203,7 @@ let # to the repo and import it with `./path/to/rustlib/Cargo.lock` which # will avoid IFD entirely but will require manually keeping the file # up to date! - "${dataplane-dev-pkgs.rust-bin.passthru.availableComponents.rust-src}/lib/rustlib/src/rust/library/Cargo.lock" + "${dataplane-pkgs.rust-toolchain.passthru.availableComponents.rust-src}/lib/rustlib/src/rust/library/Cargo.lock" ]; }; # RUSTC_BOOTSTRAP = "1"; @@ -217,7 +220,7 @@ let ); in dataplane-pkgs.callPackage package-expr { - inherit (dataplane-dev-pkgs) pkg-config kopium llvmPackages; + inherit (dataplane-dev-pkgs) pkg-config llvmPackages kopium; } ) ) package-list; @@ -227,7 +230,7 @@ in cargoArtifacts commonArgs crane - dataplane-dev-pkgs + # dataplane-dev-pkgs dataplane-pkgs devroot package-list diff --git a/nix/overlays/dataplane-dev.nix b/nix/overlays/dataplane-dev.nix index 9756d3c71..c5a5d29f9 100644 --- a/nix/overlays/dataplane-dev.nix +++ b/nix/overlays/dataplane-dev.nix @@ -5,11 +5,7 @@ }: final: prev: let - fenix = import sources.fenix { }; - rust-toolchain = fenix.fromToolchainFile { - file = ../../rust-toolchain.toml; - sha256 = (builtins.fromJSON (builtins.readFile ../.rust-toolchain.manifest-lock.json)).hash.sha256; - }; + rust-toolchain = final.rust-bin.fromRustupToolchainFile ../../rust-toolchain.toml; rustPlatform = final.makeRustPlatform { stdenv = final.llvmPackages.stdenv; cargo = rust-toolchain; diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index 73187ae22..244e448d2 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -28,11 +28,12 @@ let ]; }) final.llvmPackages.stdenv; dataplane-dep = pkg: pkg.override { stdenv = stdenv'; }; - fenix = import sources.fenix { }; - rust-toolchain = fenix.fromToolchainFile { - file = ../../rust-toolchain.toml; - sha256 = (builtins.fromJSON (builtins.readFile ../.rust-toolchain.manifest-lock.json)).hash.sha256; - }; + # fenix = import sources.fenix { }; + rust-toolchain = final.rust-bin.fromRustupToolchainFile ../../rust-toolchain.toml; + # rust-toolchain = fenix.fromToolchainFile { + # file = ../../rust-toolchain.toml; + # sha256 = (builtins.fromJSON (builtins.readFile ../.rust-toolchain.manifest-lock.json)).hash.sha256; + # }; rustPlatform' = final.makeRustPlatform { stdenv = stdenv'; cargo = rust-toolchain; diff --git a/nix/profiles.nix b/nix/profiles.nix index f009e8c6f..0030075d1 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -23,7 +23,7 @@ let "-Wl,-z,relro,-z,now" ]; common.RUSTFLAGS = [ - "-Cdebug-info=full" + "-Cdebuginfo=full" "-Cdwarf-version=5" ]; debug.NIX_CFLAGS_COMPILE = [ diff --git a/npins/sources.json b/npins/sources.json index 93502f9c2..a2fca888e 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -118,6 +118,19 @@ "revision": "9ae1b26593e2cb53239e1124f88ce1698d53857e", "url": "https://github.com/githedgehog/rdma-core/archive/9ae1b26593e2cb53239e1124f88ce1698d53857e.tar.gz", "hash": "sha256-JAf7r0I+MuppH/cbBd0ZrXVAjPPeWo/oFcDFpJ7TTbY=" + }, + "rust-overlay": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "oxalica", + "repo": "rust-overlay" + }, + "branch": "master", + "submodules": false, + "revision": "3bf67c5e473f29ca79ff15904f3072d87cf6d087", + "url": "https://github.com/oxalica/rust-overlay/archive/3bf67c5e473f29ca79ff15904f3072d87cf6d087.tar.gz", + "hash": "sha256-wW15buPGU29v0XuAmDkc30+d5j4Tmg/V8AkpHH+hDWY=" } }, "version": 7 From bd912878b0337149d804c88e42ea81cac00ebc5d Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sat, 27 Dec 2025 00:00:41 +0000 Subject: [PATCH 104/163] working cross again --- dataplane/Cargo.toml | 4 +- dataplane/build.rs | 2 +- default.nix | 98 +++++++++++++++++++--------------- dpdk-sys/build.rs | 5 +- dpdk-sysroot-helper/src/lib.rs | 14 ++--- hardware/src/group/README.md | 12 ----- hardware/src/group/mod.rs | 21 ++++++-- hardware/src/lib.rs | 44 ++++++++++++++- hardware/src/mem/README.md | 25 --------- hardware/src/mem/mod.rs | 26 ++++++++- hardware/src/os/README.md | 17 ------ hardware/src/os/mod.rs | 18 ++++++- hardware/src/pci/README.md | 26 --------- hardware/src/pci/mod.rs | 27 +++++++++- init/src/main.rs | 51 +++++++++++++++++- nix/profiles.nix | 61 ++++++++++++++++----- 16 files changed, 291 insertions(+), 160 deletions(-) delete mode 100644 hardware/src/group/README.md delete mode 100644 hardware/src/mem/README.md delete mode 100644 hardware/src/os/README.md delete mode 100644 hardware/src/pci/README.md diff --git a/dataplane/Cargo.toml b/dataplane/Cargo.toml index 00f7845a3..c70bad32f 100644 --- a/dataplane/Cargo.toml +++ b/dataplane/Cargo.toml @@ -7,8 +7,8 @@ version.workspace = true [features] default = [] -sysroot = ["dep:dpdk-sysroot-helper"] -dpdk = ["sysroot", "dep:dpdk"] +dpdk = ["dep:dpdk", "_sysroot"] +_sysroot = ["dep:dpdk-sysroot-helper"] [dependencies] afpacket = { workspace = true, features = ["async-tokio"] } diff --git a/dataplane/build.rs b/dataplane/build.rs index 1fc109eb8..1b2a9e546 100644 --- a/dataplane/build.rs +++ b/dataplane/build.rs @@ -2,6 +2,6 @@ // Copyright Open Network Fabric Authors fn main() { - #[cfg(feature = "sysroot")] + #[cfg(feature = "_sysroot")] dpdk_sysroot_helper::use_sysroot(); } diff --git a/default.nix b/default.nix index 61c5ec188..0bb4b3c17 100644 --- a/default.nix +++ b/default.nix @@ -84,8 +84,8 @@ let executable = false; destination = "/.clangd"; }; - crane-base = import sources.crane { pkgs = dataplane-pkgs; }; - crane = crane-base.craneLib.overrideToolchain dataplane-pkgs.rust-toolchain; + crane = import sources.crane { pkgs = dataplane-pkgs; }; + craneLib = crane.craneLib.overrideToolchain dataplane-pkgs.rust-toolchain; devroot = dataplane-pkgs.symlinkJoin { name = "dataplane-dev-shell"; paths = [ @@ -112,7 +112,15 @@ let rust-toolchain ]); }; - dataplane-src = crane.cleanCargoSource ./.; + markdownFilter = path: _type: builtins.match ".*md$" path != null; + cHeaderFilter = path: _type: builtins.match ".*h$" path != null; + dataplane-src = dataplane-pkgs.lib.cleanSourceWith { + name = "dataplane-source"; + src = ./.; + filter = + path: type: + (craneLib.filterCargoSources path type) || (markdownFilter path type) || (cHeaderFilter path type); + }; # Common arguments can be set here to avoid repeating them later commonArgs = { @@ -122,44 +130,51 @@ let nativeBuildInputs = [ dataplane-dev-pkgs.pkg-config + devroot # dataplane-pkgs.libclang.lib ]; buildInputs = [ dataplane-pkgs.hwloc + # sysroot ]; - env = { - PATH = "${devroot}/bin"; - LIBCLANG_PATH = "${dataplane-pkgs.pkgsBuildHost.llvmPackages.libclang.lib}/lib"; - C_INCLUDE_PATH = "${sysroot}/include"; - LIBRARY_PATH = "${sysroot}/lib"; - PKG_CONFIG_PATH = "${sysroot}/lib/pkgconfig"; - GW_CRD_PATH = "${dataplane-dev-pkgs.gateway-crd}/src/gateway/config/crd/bases"; - RUSTC_BOOTSTRAP = "1"; - # RUSTFLAGS = "potato"; - RUSTFLAGS = "--cfg=tokio_unstable -Ccodegen-units=64 -Cdebug-assertions=on -Cdebuginfo=full -Cdwarf-version=5 -Clink-arg=-fuse-ld=lld -Clink-arg=--ld-path=${devroot}/bin/ld.lld -Clinker=${devroot}/bin/clang -Copt-level=0 -Coverflow-checks=on -Ctarget-cpu=generic"; - }; - }; - # Build *just* the cargo dependencies (of the entire workspace), - # so we can reuse all of that work (e.g. via cachix) when running in CI - # It is *highly* recommended to use something like cargo-hakari to avoid - # cache misses when building individual top-level-crates - cargoArtifacts = crane.buildDepsOnly commonArgs; - individualCrateArgs = commonArgs // { - inherit cargoArtifacts; - inherit (crane.crateNameFromCargoToml { src = dataplane-src; }) version; + # inherit cargoArtifacts; + inherit (craneLib.crateNameFromCargoToml { src = dataplane-src; }) version; # NB: we disable tests since we'll run them all via cargo-nextest doCheck = false; + + env = + let + target = dataplane-pkgs.stdenv'.targetPlatform.rust.rustcTarget; + isCross = dataplane-dev-pkgs.stdenv.hostPlatform.rust.rustcTarget != target; + linker = if isCross then "${target}-clang" else "clang"; + in + { + SYSROOT = "${sysroot}"; + # PATH = "${devroot}/bin"; + # CC = "${devroot}/bin/${linker}"; + LIBCLANG_PATH = "${dataplane-pkgs.pkgsBuildHost.llvmPackages.libclang.lib}/lib"; + C_INCLUDE_PATH = "${sysroot}/include"; + LIBRARY_PATH = "${sysroot}/lib"; + PKG_CONFIG_PATH = "${sysroot}/lib/pkgconfig"; + GW_CRD_PATH = "${dataplane-dev-pkgs.gateway-crd}/src/gateway/config/crd/bases"; + RUSTC_BOOTSTRAP = "1"; + RUSTFLAGS = builtins.concatStringsSep " " ( + profile'.RUSTFLAGS + ++ [ + "--cfg=tokio_unstable" + "-Clink-arg=-fuse-ld=lld" + "-Clink-arg=--ld-path=${devroot}/bin/ld.lld" + "-Clinker=${devroot}/bin/${linker}" + ] + ); + }; }; - # TODO: this is hacky nonsense, clean up the fileset call - fileSetForCrate = - crate: - lib.fileset.toSource { - root = ./.; - fileset = lib.fileset.unions [ - ./. - ]; - }; + # # Build *just* the cargo dependencies (of the entire workspace), + # # so we can reuse all of that work (e.g. via cachix) when running in CI + # # It is *highly* recommended to use something like cargo-hakari to avoid + # # cache misses when building individual top-level-crates + # cargoArtifacts = craneLib.buildDepsOnly commonArgs; package-list = builtins.fromJSON ( builtins.readFile ( dataplane-pkgs.runCommandLocal "package-list" @@ -169,7 +184,7 @@ let } '' $TOMLQ -r '.workspace.members | sort[]' ${./.}/Cargo.toml | while read -r p; do - $TOMLQ --arg p "$p" -r '{ ($p): .package.name }' ${./.}/$p/Cargo.toml + $TOMLQ --arg p "$p" -r '{ ($p): .package.name }' ${./.}/$p/Cargo.toml done | $JQ --sort-keys --slurp 'add' > $out '' ) @@ -178,15 +193,15 @@ let p: pname: ( let - src = fileSetForCrate (./. + p); + src = dataplane-src; package-expr = { pkg-config, kopium, llvmPackages, }: - crane.buildPackage ( - individualCrateArgs + craneLib.buildPackage ( + commonArgs // { inherit pname src; cargoExtraArgs = "-Z unstable-options -Z build-std=compiler_builtins,core,alloc,std,panic_unwind,proc_macro --package ${pname}"; @@ -206,10 +221,6 @@ let "${dataplane-pkgs.rust-toolchain.passthru.availableComponents.rust-src}/lib/rustlib/src/rust/library/Cargo.lock" ]; }; - # RUSTC_BOOTSTRAP = "1"; - # env = { - # RUSTC_BOOTSTRAP = "1"; - # }; nativeBuildInputs = [ pkg-config kopium @@ -227,10 +238,10 @@ let in { inherit - cargoArtifacts + # cargoArtifacts commonArgs - crane - # dataplane-dev-pkgs + + dataplane-dev-pkgs dataplane-pkgs devroot package-list @@ -238,6 +249,7 @@ in sources sysroot ; + crane = craneLib; profile = profile'; platform = platform'; } diff --git a/dpdk-sys/build.rs b/dpdk-sys/build.rs index 8afec9363..d678e6ba3 100644 --- a/dpdk-sys/build.rs +++ b/dpdk-sys/build.rs @@ -24,7 +24,7 @@ fn bind(path: &Path) { let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); let static_fn_path = out_path.join("generated.h"); bindgen::Builder::default() - .header(format!("./dpdk_wrapper.h")) + .header("./dpdk_wrapper.h") .anon_fields_prefix("annon") .use_core() .generate_comments(true) @@ -47,7 +47,6 @@ fn bind(path: &Path) { .default_enum_style(bindgen::EnumVariation::ModuleConsts) .blocklist_item("rte_atomic.*") .allowlist_item("rte.*") - .allowlist_item("wrte_.*") .allowlist_item("RTE.*") .blocklist_item("__*") .clang_macro_fallback() @@ -69,7 +68,7 @@ fn bind(path: &Path) { fn main() { let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); - let library_path = env::var("LIBRARY_PATH").unwrap().to_string(); + let library_path = env::var("LIBRARY_PATH").unwrap().to_string(); // let sysroot = dpdk_sysroot_helper::get_sysroot(); // println!("cargo:rustc-link-arg=--sysroot={sysroot}"); diff --git a/dpdk-sysroot-helper/src/lib.rs b/dpdk-sysroot-helper/src/lib.rs index 54ae40ee2..b50bb57c9 100644 --- a/dpdk-sysroot-helper/src/lib.rs +++ b/dpdk-sysroot-helper/src/lib.rs @@ -31,16 +31,12 @@ pub fn get_target_name() -> String { #[must_use] pub fn get_sysroot() -> String { - let compile_env = env::var("COMPILE_ENV").expect("COMPILE_ENV not set"); - let sysroot_env = format!("{compile_env}/sysroot"); - let target = get_target_name(); - let profile = get_profile_name(); - let expected_sysroot = format!("{sysroot_env}/{target}/{profile}"); - let expected_sysroot_path = Path::new(&expected_sysroot); - if expected_sysroot_path.exists() { - expected_sysroot + let sysroot_env = env::var("SYSROOT").expect("SYSROOT not set"); + let sysroot_path = Path::new(&sysroot_env); + if sysroot_path.exists() { + sysroot_env } else { - panic!("sysroot not found at {expected_sysroot}") + panic!("sysroot not found at {sysroot_env}") } } diff --git a/hardware/src/group/README.md b/hardware/src/group/README.md deleted file mode 100644 index 04d15393b..000000000 --- a/hardware/src/group/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# Logical hardware groupings - -This module provides types for representing logical groups of hardware -components. Groups are used in hardware topology to represent collections -of related components that don't fit into other specific categories. - -Groups can represent: - -- NUMA distances -- I/O groups -- Logical partitions -- Custom hardware groupings defined by the system diff --git a/hardware/src/group/mod.rs b/hardware/src/group/mod.rs index ac63ce03e..0dafa0e98 100644 --- a/hardware/src/group/mod.rs +++ b/hardware/src/group/mod.rs @@ -1,11 +1,22 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright Open Network Fabric Authors -#![doc = include_str!("README.md")] - -#[cfg(any(test, feature = "scan"))] -#[allow(unused_imports)] // re-export -pub use self::scan::*; +//! # Logical hardware groupings +//! +//! This module provides types for representing logical groups of hardware +//! components. Groups are used in hardware topology to represent collections +//! of related components that don't fit into other specific categories. +//! +//! Groups can represent: +//! +//! - NUMA distances +//! - I/O groups +//! - Logical partitions +//! - Custom hardware groupings defined by the system +//! +//! #[cfg(any(test, feature = "scan"))] +//! #[allow(unused_imports)] // re-export +//! pub use self::scan::*; /// Attributes for a logical hardware group. /// diff --git a/hardware/src/lib.rs b/hardware/src/lib.rs index 70ed25389..ed1765846 100644 --- a/hardware/src/lib.rs +++ b/hardware/src/lib.rs @@ -1,7 +1,49 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright Open Network Fabric Authors +// +// # Hardware topology discovery and representation + +//! The `hardware` crate provides a unified interface for discovering and representing +//! system hardware topology, including CPU architecture, memory hierarchy, PCI devices, +//! and operating system devices. It builds a hierarchical tree structure representing +//! the relationships between different hardware components. +//! +//! ## Overview +//! +//! This crate is designed to provide detailed information about system hardware topology +//! that is useful for: +//! +//! - **Performance optimization**: Understanding cache hierarchy and NUMA topology +//! - **Device management**: Enumerating and identifying PCI devices and OS devices +//! - **Resource allocation**: Making informed decisions about CPU affinity and memory +//! allocation +//! - **System monitoring**: Gathering hardware configuration information +//! +//! ## Architecture +//! +//! The crate represents hardware topology as a tree of `Node`s, where each node has: +//! +//! - A unique identifier +//! - A type and optional subtype +//! - Optional attributes specific to the hardware component +//! - Zero or more child nodes +//! +//! Node types include: +//! +//! - **NUMA nodes**: Non-Uniform Memory Access regions +//! - **Caches**: L1, L2, L3 cache levels +//! - **PCI devices**: Graphics cards, network adapters, etc. +//! - **Bridges**: PCI bridges connecting different buses +//! - **Groups**: Logical groupings of hardware components +//! - **OS devices**: Block devices, network interfaces, etc. +//! +//! ## Features +//! +//! - `scan`: Enables hardware topology scanning using the `hwlocality` crate. +//! This allows runtime discovery of the system's hardware configuration. +//! - `serde`: Adds serialization support for all types using serde. +//! - `bolero`: Enables fuzzing support for testing. -#![doc = include_str!("../README.md")] #![deny(clippy::pedantic, clippy::unwrap_used)] use id::Id; diff --git a/hardware/src/mem/README.md b/hardware/src/mem/README.md deleted file mode 100644 index 53d309611..000000000 --- a/hardware/src/mem/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# Memory Subsystem - -Models hardware memory topology for performance-critical packet processing. - -## Components - -### NUMA - -Represents Non-Uniform Memory Access nodes where memory access time depends on -processor location. - -### Cache Attributes - -Models CPU cache hierarchy (L1/L2/L3). - -- **Types**: Unified, Data, and Instruction caches -- **Properties**: Size and line size -- Helps avoid false sharing and optimize data layouts - -### Page Types - -Represents memory page sizes (e.g., 4KB, 2MB, 1GB). - -- Enables huge page utilization -- Reduces TLB pressure for large memory pools diff --git a/hardware/src/mem/mod.rs b/hardware/src/mem/mod.rs index 0d0769b4b..542c370d1 100644 --- a/hardware/src/mem/mod.rs +++ b/hardware/src/mem/mod.rs @@ -1,7 +1,31 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright Open Network Fabric Authors -#![doc = include_str!("README.md")] +//! # Memory Subsystem +//! +//! Models hardware memory topology for performance-critical packet processing. +//! +//! ## Components +//! +//! ### NUMA +//! +//! Represents Non-Uniform Memory Access nodes where memory access time depends on +//! processor location. +//! +//! ### Cache Attributes +//! +//! Models CPU cache hierarchy (L1/L2/L3). +//! +//! - **Types**: Unified, Data, and Instruction caches +//! - **Properties**: Size and line size +//! - Helps avoid false sharing and optimize data layouts +//! +//! ### Page Types +//! +//! Represents memory page sizes (e.g., 4KB, 2MB, 1GB). +//! +//! - Enables huge page utilization +//! - Reduces TLB pressure for large memory pools pub mod cache; pub mod numa; diff --git a/hardware/src/os/README.md b/hardware/src/os/README.md deleted file mode 100644 index a227cdc50..000000000 --- a/hardware/src/os/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# Operating system device representation - -This module provides types for representing devices as seen by the operating -system, including storage devices, network interfaces, GPUs, and other -hardware exposed through the OS. - -## Device Types - -The module supports various OS device types: - -- **Storage**: Block devices, disks, SSDs -- **GPU**: Graphics processing units -- **Network**: Network interfaces -- **OpenFabrics**: High-performance fabric devices (InfiniBand, etc.) -- **DMA**: Direct Memory Access engines -- **CoProcessor**: Specialized compute accelerators -- **Memory**: Memory-like devices (e.g., persistent memory) diff --git a/hardware/src/os/mod.rs b/hardware/src/os/mod.rs index b9b13fe8d..b549ed88d 100644 --- a/hardware/src/os/mod.rs +++ b/hardware/src/os/mod.rs @@ -1,7 +1,23 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright Open Network Fabric Authors -#![doc = include_str!("README.md")] +//! # Operating system device representation +//! +//! This module provides types for representing devices as seen by the operating +//! system, including storage devices, network interfaces, GPUs, and other +//! hardware exposed through the OS. +//! +//! ## Device Types +//! +//! The module supports various OS device types: +//! +//! - **Storage**: Block devices, disks, SSDs +//! - **GPU**: Graphics processing units +//! - **Network**: Network interfaces +//! - **OpenFabrics**: High-performance fabric devices (InfiniBand, etc.) +//! - **DMA**: Direct Memory Access engines +//! - **CoProcessor**: Specialized compute accelerators +//! - **Memory**: Memory-like devices (e.g., persistent memory) #![allow(clippy::doc_markdown)] // abbreviations were trigging spurious backtick lints /// Type of operating system device. diff --git a/hardware/src/pci/README.md b/hardware/src/pci/README.md deleted file mode 100644 index 020760640..000000000 --- a/hardware/src/pci/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# PCI device enumeration and attributes - -This module provides comprehensive support for PCI (Peripheral Component Interconnect) -device representation, including device addressing, attributes, and topology. - -## Overview - -PCI devices are identified by a hierarchical addressing scheme: - -- **Domain**: The PCI domain (segment) number -- **Bus**: The bus number within the domain -- **Device**: The device number on the bus -- **Function**: The function number within the device - -Together these form a PCI address like `0000:03:00.0` - -```mermaid ---- -title: PCI address format ---- -packet -+16: "domain" -+8: "bus" -+5: "device" -+3: "function" -``` diff --git a/hardware/src/pci/mod.rs b/hardware/src/pci/mod.rs index 38b2963a2..2db3640ec 100644 --- a/hardware/src/pci/mod.rs +++ b/hardware/src/pci/mod.rs @@ -1,7 +1,32 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright Open Network Fabric Authors -#![doc = include_str!("README.md")] +//! # PCI device enumeration and attributes +//! +//! This module provides comprehensive support for PCI (Peripheral Component Interconnect) +//! device representation, including device addressing, attributes, and topology. +//! +//! ## Overview +//! +//! PCI devices are identified by a hierarchical addressing scheme: +//! +//! - **Domain**: The PCI domain (segment) number +//! - **Bus**: The bus number within the domain +//! - **Device**: The device number on the bus +//! - **Function**: The function number within the device +//! +//! Together these form a PCI address like `0000:03:00.0` +//! +//! ```mermaid +//! --- +//! title: PCI address format +//! --- +//! packet +//! +16: "domain" +//! +8: "bus" +//! +5: "device" +//! +3: "function" +//! ``` use crate::pci::{address::PciAddress, device::DeviceId, vendor::VendorId}; diff --git a/init/src/main.rs b/init/src/main.rs index e32833636..8a0b6c688 100644 --- a/init/src/main.rs +++ b/init/src/main.rs @@ -1,7 +1,56 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright Open Network Fabric Authors -#![doc = include_str!("../README.md")] +//! # dataplane-init +//! +//! This program is responsible for initializing the dataplane. +//! +//! The primary steps of this program are to: +//! +//! 1. Drive the NIC into the configuration needed by DPDK to use the NIC +//! 2. (TODO) Drop some hazardous privileges (especially [`CAP_SYS_ADMIN`]) +//! 3. (TODO) `exec` the dataplane process on success +//! +//! For most network cards, this configuration step involves unbinding the NIC from the kernel driver and re-binding it to +//! the [vfio-pci] driver. +//! +//! **Note**: Not all NICs should be bound to [vfio-pci]. +//! Some network cards use the so-called bifurcated driver and must remain bound to the kernel driver. +//! In particular, all network cards which use the mlx5 driver must remain bound to the [mlx5] kernel driver. +//! +//! **Warning**: This program is _not_ responsible for full life cycle management of the NIC. +//! In particular, it makes no attempt to rebind the NIC back to the kernel driver. +//! Thus, expect this program to make network cards disappear from the perspective of tooling like [iproute2] and [ethtool]. +//! +//! Only a very limited set of network cards are currently supported, although this set can easily be expanded over time. +//! +//! ## Error Handling Strategy +//! +//! As a short-lived program which is only run once per gateway initialization, this program has significantly different +//! error handling requirements from the other software in this workspace. +//! +//! Essentially, it will either succeed or fail, and if it fails it will likely require outside intervention to recover. +//! There is little we can or should attempt to do in terms of sophisticated error handling beyond logging clear error +//! messages. +//! +//! ## Privileges +//! +//! This program is, by necessity, run with elevated privileges. +//! As such, we need to take special caution when writing to files. +//! +//! Because [sysfs] is basically a maze of symlinks, it is important to be careful when manipulating paths under [sysfs]. +//! Mistakes can lead you to write data in highly unexpected places, with totally unknown consequences. +//! Some care has been taken in the design of the types used here to discourage programmer errors which might lead to +//! unintended writes by a privileged process. +//! +//! +//! [iproute2]: https://www.kernel.org/pub/linux/utils/net/iproute2/ +//! [ethtool]: https://www.kernel.org/pub/linux/utils/net/ethtool/ +//! [sysfs]: https://www.kernel.org/doc/Documentation/filesystems/sysfs.txt +//! [vfio-pci]: https://docs.kernel.org/driver-api/vfio.html +//! [mlx5]: https://docs.kernel.org/networking/device_drivers/ethernet/mellanox/mlx5/index.html +//! [`CAP_SYS_ADMIN`]: + #![deny(clippy::pedantic, missing_docs)] use hardware::nic::{BindToVfioPci, PciNic}; diff --git a/nix/profiles.nix b/nix/profiles.nix index 0030075d1..60ea82ebd 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -13,61 +13,83 @@ let # odr or strict-aliasing violations are indicative of LTO incompatibility, so check for that "-Werror=odr" "-Werror=strict-aliasing" + "-Wno-error=unused-command-line-argument" ]; common.NIX_CXXFLAGS_COMPILE = common.NIX_CFLAGS_COMPILE; common.NIX_CFLAGS_LINK = [ # getting proper LTO from LLVM compiled objects is best done with lld rather than ld, mold, or wild (at least at the # time of writing) "-fuse-ld=lld" - # we always want pic/pie and GOT offsets should be computed at compile time whenever possible - "-Wl,-z,relro,-z,now" ]; common.RUSTFLAGS = [ "-Cdebuginfo=full" "-Cdwarf-version=5" ]; - debug.NIX_CFLAGS_COMPILE = [ + optimize-for.debug.NIX_CFLAGS_COMPILE = [ "-fno-inline" "-fno-omit-frame-pointer" - # "-D_FORTIFY_SOURCE=0" # disable security stuff because the goal is to make the asm as easy to understand as possible - # "-Wno-macro-redefined" # many apps opt in to _FORTIFY_SOURCE={1,2,3} explicitly, and -Wall errors when you redefine ]; - debug.NIX_CXXFLAGS_COMPILE = debug.NIX_CFLAGS_COMPILE; - debug.NIX_CFLAGS_LINK = [ ]; - optimize.NIX_CFLAGS_COMPILE = [ + optimize-for.debug.NIX_CXXFLAGS_COMPILE = optimize-for.debug.NIX_CFLAGS_COMPILE; + optimize-for.debug.NIX_CFLAGS_LINK = [ ]; + optimize-for.debug.RUSTFLAGS = [ + "-Copt-level=0" + "-Cdebug-assertions=on" + "-Coverflow-checks=on" + ]; + optimize-for.performance.NIX_CFLAGS_COMPILE = [ "-O3" "-flto=thin" "-fsplit-lto-unit" # important for compatibility with rust's LTO ]; - optimize.NIX_CXXFLAGS_COMPILE = optimize.NIX_CFLAGS_COMPILE ++ [ + optimize-for.performance.NIX_CXXFLAGS_COMPILE = optimize-for.performance.NIX_CFLAGS_COMPILE ++ [ "-fwhole-program-vtables" ]; - optimize.NIX_CFLAGS_LINK = optimize.NIX_CXXFLAGS_COMPILE ++ [ + optimize-for.performance.NIX_CFLAGS_LINK = optimize-for.performance.NIX_CXXFLAGS_COMPILE ++ [ "-Wl,--lto-whole-program-visibility" # just to keep the artifacts small, we don't currently use any linked artifact anyway "-Wl,--gc-sections" "-Wl,--as-needed" ]; + optimize-for.performance.RUSTFLAGS = [ + "-Copt-level=3" + "-Cdebug-assertions=off" + "-Coverflow-checks=off" + "-Clinker-plugin-lto" + "-Cembed-bitcode=yes" + "-Ccodegen-units=1" + "-Clink-arg=-flto=full" + ]; secure.NIX_CFLAGS_COMPILE = [ "-fstack-protector-strong" "-fstack-clash-protection" + # we always want pic/pie and GOT offsets should be computed at compile time whenever possible + "-Wl,-z,relro,-z,now" # "-fcf-protection=full" # requires extra testing before we enable ]; secure.NIX_CXXFLAGS_COMPILE = secure.NIX_CFLAGS_COMPILE; # handing the CFLAGS back to clang/lld is basically required for -fsanitize secure.NIX_CFLAGS_LINK = secure.NIX_CFLAGS_COMPILE; + secure.RUSTFLAGS = [ + "-Crelro-level=full" + ]; march.x86_64.NIX_CFLAGS_COMPILE = [ # DPDK functionally requires some -m flags on x86_64. # These features have been available for a long time and can be found on any reasonably recent machine, so just # enable them here for all x86_64 builds. + # In the (very) unlikely event that you need to edit these flags, also edit the associated RUSTFLAGS to match. "-mrtm" "-mcrc32" "-mssse3" ]; march.x86_64.NIX_CXXFLAGS_COMPILE = march.x86_64.NIX_CFLAGS_COMPILE; + march.x86_64.RUSTFLAGS = [ + # these should be kept in 1:1 alignment with the x86_64 NIX_CFLAGS_COMPILE settings + "-Ctarget-feature=+rtm,+crc32,+ssse3" + ]; march.aarch64.NIX_CFLAGS_COMPILE = [ ]; march.aarch64.NIX_CXXFLAGS_COMPILE = march.aarch64.NIX_CFLAGS_COMPILE; march.aarch64.NIX_CFLAGS_LINK = [ ]; + march.aarch64.RUSTFLAGS = [ ]; sanitize.address.NIX_CFLAGS_COMPILE = [ "-fsanitize=address,local-bounds" ]; @@ -87,6 +109,9 @@ let sanitize.thread.NIX_CFLAGS_LINK = sanitize.thread.NIX_CFLAGS_COMPILE ++ [ "-Wl,--allow-shlib-undefined" ]; + sanitize.thread.RUSTFLAGS = [ + "-Zsanitizer=thread" + ]; # note: cfi _requires_ LTO and is fundamentally ill suited to debug builds sanitize.cfi.NIX_CFLAGS_COMPILE = [ "-fsanitize=cfi" @@ -107,6 +132,11 @@ let ]; sanitize.cfi.NIX_CXXFLAGS_COMPILE = sanitize.cfi.NIX_CFLAGS_COMPILE; sanitize.cfi.NIX_CFLAGS_LINK = sanitize.cfi.NIX_CFLAGS_COMPILE; + sanitize.cfi.RUSTFLAGS = [ + "-Zsanitizer=cfi" + "-Zsanitizer-cfi-normalize-integers" + "-Zsanitizer-cfi-generalize-pointers" + ]; sanitize.safe-stack.NIX_CFLAGS_COMPILE = [ "-fsanitize=safe-stack" ]; @@ -114,9 +144,13 @@ let sanitize.safe-stack.NIX_CFLAGS_LINK = sanitize.safe-stack.NIX_CFLAGS_COMPILE ++ [ "-Wl,--allow-shlib-undefined" ]; + sanitize.safe-stack.RUSTFLAGS = [ + "-Zsanitizer=safestack" + ]; instrument.none.NIX_CFLAGS_COMPILE = [ ]; instrument.none.NIX_CXXFLAGS_COMPILE = instrument.none.NIX_CFLAGS_COMPILE; instrument.none.NIX_CFLAGS_LINK = instrument.none.NIX_CFLAGS_COMPILE; + instrument.none.RUSTFLAGS = [ ]; instrument.produce.NIX_CFLAGS_COMPILE = [ "-fprofile-instr-generate" "-fcoverage-mapping" @@ -124,6 +158,9 @@ let ]; instrument.produce.NIX_CXXFLAGS_COMPILE = instrument.produce.NIX_CFLAGS_COMPILE; instrument.produce.NIX_CFLAGS_LINK = instrument.produce.NIX_CFLAGS_COMPILE; + instrument.produce.RUSTFLAGS = [ + "-Cinstrument-coverage" + ]; combine-profiles = features: builtins.foldl' ( @@ -132,11 +169,11 @@ let profile-map = { debug = combine-profiles [ common - debug + optimize-for.debug ]; release = combine-profiles [ common - optimize + optimize-for.performance secure ]; }; From 1f0077388760a0ae0cde428ca074d24aedbf6115 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sat, 27 Dec 2025 00:28:48 +0000 Subject: [PATCH 105/163] fixup result exclude --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 341e2cb36..a0b329d08 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ **.profraw **/__fuzz__/** -**/result*/** +result +result*/** **/target/** /.bin/** /.vscode/** From 352e09651dfe1996b3307872f495006c397cdcad Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sat, 27 Dec 2025 05:04:03 +0000 Subject: [PATCH 106/163] many things mostly working --- .cargo/config.toml | 35 ++++---- .gitignore | 2 +- Cargo.lock | 12 +-- Cargo.toml | 1 + default.nix | 116 ++++++++++++------------ nix/overlays/dataplane.nix | 176 +++++++++++++++++++++---------------- nix/profiles.nix | 6 ++ rust-toolchain.toml | 5 +- 8 files changed, 192 insertions(+), 161 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 78401ce46..58c71c89f 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,11 +1,11 @@ [env] C_INCLUDE_PATH = { value = "sysroot/include", relative = true, force = false } GW_CRD_PATH = { value = "devroot/src/gateway/config/crd/bases", relative = true, force = false } -LIBCLANG_PATH = { value = "devroot/lib", relative = true, force = true } +LIBCLANG_PATH = { value = "devroot/lib", relative = true, force = false } LIBRARY_PATH = { value = "sysroot/lib", relative = true, force = false } -PKG_CONFIG_PATH = { value = "sysroot/lib/pkgconfig", relative = true, force = true } +PKG_CONFIG_PATH = { value = "sysroot/lib/pkgconfig", relative = true, force = false } -[unstable] +# [unstable] # build-std = [ # "compiler_builtins", # "core", @@ -14,18 +14,19 @@ PKG_CONFIG_PATH = { value = "sysroot/lib/pkgconfig", relative = true, force = tr # "panic_unwind", # "proc_macro" # ] -# build-std-features = ["backtrace", "panic-unwind", "mem"] +# # build-std-features = ["backtrace", "panic-unwind", "mem", "llvm-libunwind"] +# build-std-features = ["backtrace", "panic-unwind", "mem", "compiler-builtins-mem"] -[build] -rustflags = [ - "--cfg=tokio_unstable", - "-Ccodegen-units=64", - "-Cdebug-assertions=on", - "-Cdebuginfo=full", - "-Cdwarf-version=5", - "-Clink-arg=-fuse-ld=lld", - "-Clinker=clang", - "-Copt-level=0", - "-Coverflow-checks=on", - "-Ctarget-cpu=generic", -] +# [build] +# rustflags = [ +# "--cfg=tokio_unstable", +# "-Ccodegen-units=64", +# "-Cdebug-assertions=on", +# "-Cdebuginfo=full", +# "-Cdwarf-version=5", +# "-Clink-arg=-fuse-ld=lld", +# "-Clinker=clang", +# "-Copt-level=0", +# "-Coverflow-checks=on", +# "-Ctarget-cpu=generic", +# ] diff --git a/.gitignore b/.gitignore index a0b329d08..236f3f5a9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ **.profraw **/__fuzz__/** -result +result* result*/** **/target/** /.bin/** diff --git a/Cargo.lock b/Cargo.lock index c9d498268..45cecb8c9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -680,9 +680,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.50" +version = "1.2.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f50d563227a1c37cc0a263f64eca3334388c01c5e4c4861a9def205c614383c" +checksum = "7a0aeaff4ff1a90589618835a598e545176939b97874f7abc7851caa0618f203" dependencies = [ "find-msvc-tools", "jobserver", @@ -2071,9 +2071,9 @@ checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "find-msvc-tools" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" +checksum = "645cbb3a84e60b7531617d5ae4e57f7e27308f6445f5abf653209ea76dec8dff" [[package]] name = "findshlibs" @@ -6456,6 +6456,6 @@ dependencies = [ [[package]] name = "zmij" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0095ecd462946aa3927d9297b63ef82fb9a5316d7a37d134eeb36e58228615a" +checksum = "4af59da1029247450b54ba43e0b62c8e376582464bbe5504dd525fe521e7e8fd" diff --git a/Cargo.toml b/Cargo.toml index e3d77f733..c86b909c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -210,6 +210,7 @@ tracing-test = { version = "0.2.5", default-features = false, features = [] } ureq = { version = "3.1.4", default-features = false, features = [] } url = { version = "2.5.7", default-features = false, features = [] } uuid = { version = "1.19.0", default-features = false, features = [] } +proc-macro-error2 = { version = "2.0.1", default-features = true } [profile.dev] panic = "unwind" diff --git a/default.nix b/default.nix index 0bb4b3c17..b3b18079e 100644 --- a/default.nix +++ b/default.nix @@ -25,6 +25,10 @@ let inherit sanitizers instrumentation profile; arch = platform'.arch; }; + profile'' = { + "debug" = "dev"; + "release" = "release"; + }.${profile}; overlays = import ./nix/overlays { inherit sources @@ -69,7 +73,7 @@ let dpdk-wrapper.dev dpdk-wrapper.out hwloc.dev - hwloc + hwloc.static ]; }; clangd-config = dataplane-pkgs.writeTextFile { @@ -112,8 +116,8 @@ let rust-toolchain ]); }; - markdownFilter = path: _type: builtins.match ".*md$" path != null; - cHeaderFilter = path: _type: builtins.match ".*h$" path != null; + markdownFilter = path: _type: builtins.match ".*\.md$" path != null; + cHeaderFilter = path: _type: builtins.match ".*\.h$" path != null; dataplane-src = dataplane-pkgs.lib.cleanSourceWith { name = "dataplane-source"; src = ./.; @@ -123,21 +127,27 @@ let }; # Common arguments can be set here to avoid repeating them later + vendored = crane.vendorMultipleCargoDeps { + inherit (crane.findCargoFiles dataplane-src) cargoConfigs; + cargoLockList = [ + ./Cargo.lock + "${dataplane-pkgs.rust-toolchain.passthru.availableComponents.rust-src}/lib/rustlib/src/rust/library/Cargo.lock" + ]; + }; commonArgs = { src = dataplane-src; strictDeps = true; CARGO_PROFILE = "dev"; - nativeBuildInputs = [ - dataplane-dev-pkgs.pkg-config - devroot - # dataplane-pkgs.libclang.lib - ]; - buildInputs = [ - dataplane-pkgs.hwloc - # sysroot + cargoBuildCommand = builtins.concatStringsSep " " [ + "cargo" + "build" + "--profile=${profile''}" + "-Zunstable-options" + "-Zbuild-std=compiler_builtins,core,alloc,std,panic_unwind,proc_macro" + "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem" ]; - + cargoVendorDir = vendored; # inherit cargoArtifacts; inherit (craneLib.crateNameFromCargoToml { src = dataplane-src; }) version; # NB: we disable tests since we'll run them all via cargo-nextest @@ -174,7 +184,7 @@ let # # so we can reuse all of that work (e.g. via cachix) when running in CI # # It is *highly* recommended to use something like cargo-hakari to avoid # # cache misses when building individual top-level-crates - # cargoArtifacts = craneLib.buildDepsOnly commonArgs; + cargoArtifacts = craneLib.buildDepsOnly commonArgs; package-list = builtins.fromJSON ( builtins.readFile ( dataplane-pkgs.runCommandLocal "package-list" @@ -189,52 +199,40 @@ let '' ) ); - packages = builtins.mapAttrs ( - p: pname: - ( - let - src = dataplane-src; - package-expr = - { - pkg-config, - kopium, - llvmPackages, - }: - craneLib.buildPackage ( - commonArgs - // { - inherit pname src; - cargoExtraArgs = "-Z unstable-options -Z build-std=compiler_builtins,core,alloc,std,panic_unwind,proc_macro --package ${pname}"; - cargoVendorDir = crane.vendorMultipleCargoDeps { - inherit (crane.findCargoFiles src) cargoConfigs; - cargoLockList = [ - ./Cargo.lock - - # Unfortunately this approach requires IFD (import-from-derivation) - # otherwise Nix will refuse to read the Cargo.lock from our toolchain - # (unless we build with `--impure`). - # - # Another way around this is to manually copy the rustlib `Cargo.lock` - # to the repo and import it with `./path/to/rustlib/Cargo.lock` which - # will avoid IFD entirely but will require manually keeping the file - # up to date! - "${dataplane-pkgs.rust-toolchain.passthru.availableComponents.rust-src}/lib/rustlib/src/rust/library/Cargo.lock" - ]; - }; - nativeBuildInputs = [ - pkg-config - kopium - llvmPackages.clang - llvmPackages.lld - ]; - } - ); - in - dataplane-pkgs.callPackage package-expr { - inherit (dataplane-dev-pkgs) pkg-config llvmPackages kopium; - } - ) - ) package-list; + packages = + let + package-expr = + { + pkg-config, + kopium, + llvmPackages, + hwloc, + pname, + }: + craneLib.buildPackage ( + commonArgs + // { + inherit pname cargoArtifacts; + cargoExtraArgs = "--package=${pname}"; + nativeBuildInputs = [ + pkg-config + kopium + llvmPackages.clang + llvmPackages.lld + ]; + buildInputs = [ + hwloc.static + ]; + } + ); + in + builtins.mapAttrs ( + _: pname: + (dataplane-pkgs.callPackage package-expr { + inherit (dataplane-dev-pkgs) kopium; + inherit pname; + }) + ) package-list; in { inherit diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index 244e448d2..89a3345d8 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -29,7 +29,7 @@ let }) final.llvmPackages.stdenv; dataplane-dep = pkg: pkg.override { stdenv = stdenv'; }; # fenix = import sources.fenix { }; - rust-toolchain = final.rust-bin.fromRustupToolchainFile ../../rust-toolchain.toml; + rust-toolchain = final.rust-bin.fromRustupToolchainFile ../../rust-toolchain.toml; # rust-toolchain = fenix.fromToolchainFile { # file = ../../rust-toolchain.toml; # sha256 = (builtins.fromJSON (builtins.readFile ../.rust-toolchain.manifest-lock.json)).hash.sha256; @@ -101,18 +101,20 @@ in # # This is also a reasonably important target for `-fsanitize=cfi` and or `-fsanitize=safe-stack` as libbsd provides # more secure versions of classic C string manipulation utilities, and I'm all about that defense-in-depth. - fancy.libbsd = ((dataplane-dep prev.libbsd).override { libmd = final.fancy.libmd; }).overrideAttrs (orig: { - outputs = (orig.outputs or [ "out" ]) ++ [ "static" ]; - # we need to enable shared (in addition to static) to build dpdk. - # See the note on libmd for reasoning. - configureFlags = orig.configureFlags ++ [ - "--enable-static" - ]; - postInstall = (orig.postInstall or "") + '' - mkdir -p "$static/lib"; - mv $out/lib/*.a $static/lib; - ''; - }); + fancy.libbsd = + ((dataplane-dep prev.libbsd).override { libmd = final.fancy.libmd; }).overrideAttrs + (orig: { + outputs = (orig.outputs or [ "out" ]) ++ [ "static" ]; + # we need to enable shared (in addition to static) to build dpdk. + # See the note on libmd for reasoning. + configureFlags = orig.configureFlags ++ [ + "--enable-static" + ]; + postInstall = (orig.postInstall or "") + '' + mkdir -p "$static/lib"; + mv $out/lib/*.a $static/lib; + ''; + }); # This is (for better or worse) used by dpdk to parse / manipulate netlink messages. # @@ -171,69 +173,71 @@ in # link dynamically or statically, and we should make a strong effort to make sure that we always pick static linking # to enable inlining (wherever the compiler decides it makes sense). You very likely want to enable lto here in any # release build. - fancy.rdma-core = ((dataplane-dep prev.rdma-core).override { libnl = final.fancy.libnl; }).overrideAttrs (orig: { - version = sources.rdma-core.branch; - src = sources.rdma-core.outPath; + fancy.rdma-core = + ((dataplane-dep prev.rdma-core).override { libnl = final.fancy.libnl; }).overrideAttrs + (orig: { + version = sources.rdma-core.branch; + src = sources.rdma-core.outPath; - # Patching the shebang lines in the perl scripts causes nixgraph to (incorrectly) think we depend on perl at - # runtime. We absolutely do not (we don't even ship a perl interpreter), so don't patch these shebang lines. - # In fact, we don't use any of the scripts from this package. - dontPatchShebangs = true; + # Patching the shebang lines in the perl scripts causes nixgraph to (incorrectly) think we depend on perl at + # runtime. We absolutely do not (we don't even ship a perl interpreter), so don't patch these shebang lines. + # In fact, we don't use any of the scripts from this package. + dontPatchShebangs = true; - # The upstream postFixup is broken by dontPatchShebangs = true - # It's whole function was to further mutate the shebang lines in perl scripts, so we don't care. - # Just null it. - postFixup = null; + # The upstream postFixup is broken by dontPatchShebangs = true + # It's whole function was to further mutate the shebang lines in perl scripts, so we don't care. + # Just null it. + postFixup = null; - outputs = (orig.outputs or [ ]) ++ [ - "static" - ]; - # CMake depends on -Werror to function, but the test program it uses to confirm that -Werror works "always produces - # warnings." The reason for this is that we have injected our own CFLAGS and they have nothing to do with the - # trivial program. This causes the unused-command-line-argument warning to trigger. - # We disable that warning here to make sure rdma-core can build (more specifically, to make sure that it can build - # with debug symbols). - CFLAGS = "-Wno-unused-command-line-argument"; - cmakeFlags = - orig.cmakeFlags - ++ [ - "-DRDMA_DYNAMIC_PROVIDERS=none" - "-DRDMA_STATIC_PROVIDERS=all" - "-DENABLE_STATIC=1" - # we don't need pyverbs, and turning it off reduces build time / complexity. - "-DNO_PYVERBS=1" - # no need for docs in container images. - "-DNO_MAN_PAGES=1" - # we don't care about this lib's exported symbols / compat situation _at all_ because we static link (which - # doesn't even have symbol versioning / compatibility in the first place). Turning this off just reduces the - # build's internal complexity and makes lto easier. - "-DNO_COMPAT_SYMS=1" - # Very old versions of rdma-core used what they call the "legacy write path" to support rdma-operations. - # These have (long) since been superseded by the ioctl mode, but the library generates both code paths by - # default due to rdma-core's fairly aggressive backwards compatibility stance. - # We have absolutely no need or desire to support the legacy mode, and we can potentially save ourselves some - # instruction cache pressure by disabling that old code at compile time. - "-DIOCTL_MODE=ioctl" - ] - ++ - final.lib.optionals - ( - (builtins.elem "thread" sanitizers) - || (builtins.elem "address" sanitizers) - || (builtins.elem "safe-stack" sanitizers) - ) - [ - # This allows address / thread sanitizer to build (thread/ub sanitizers do not like -Wl,-z,defs or - # -Wl,--no-undefined). - # This isn't a hack: undefined symbols from sanitizers is a known issue and is not unique to us. - "-DSUPPORTS_NO_UNDEFINED=0" - ]; - postInstall = (orig.postInstall or "") + '' - mkdir -p $static/lib $man; - mv $out/lib/*.a $static/lib/ - mv $out/share $man/ - ''; - }); + outputs = (orig.outputs or [ ]) ++ [ + "static" + ]; + # CMake depends on -Werror to function, but the test program it uses to confirm that -Werror works "always produces + # warnings." The reason for this is that we have injected our own CFLAGS and they have nothing to do with the + # trivial program. This causes the unused-command-line-argument warning to trigger. + # We disable that warning here to make sure rdma-core can build (more specifically, to make sure that it can build + # with debug symbols). + CFLAGS = "-Wno-unused-command-line-argument"; + cmakeFlags = + orig.cmakeFlags + ++ [ + "-DRDMA_DYNAMIC_PROVIDERS=none" + "-DRDMA_STATIC_PROVIDERS=all" + "-DENABLE_STATIC=1" + # we don't need pyverbs, and turning it off reduces build time / complexity. + "-DNO_PYVERBS=1" + # no need for docs in container images. + "-DNO_MAN_PAGES=1" + # we don't care about this lib's exported symbols / compat situation _at all_ because we static link (which + # doesn't even have symbol versioning / compatibility in the first place). Turning this off just reduces the + # build's internal complexity and makes lto easier. + "-DNO_COMPAT_SYMS=1" + # Very old versions of rdma-core used what they call the "legacy write path" to support rdma-operations. + # These have (long) since been superseded by the ioctl mode, but the library generates both code paths by + # default due to rdma-core's fairly aggressive backwards compatibility stance. + # We have absolutely no need or desire to support the legacy mode, and we can potentially save ourselves some + # instruction cache pressure by disabling that old code at compile time. + "-DIOCTL_MODE=ioctl" + ] + ++ + final.lib.optionals + ( + (builtins.elem "thread" sanitizers) + || (builtins.elem "address" sanitizers) + || (builtins.elem "safe-stack" sanitizers) + ) + [ + # This allows address / thread sanitizer to build (thread/ub sanitizers do not like -Wl,-z,defs or + # -Wl,--no-undefined). + # This isn't a hack: undefined symbols from sanitizers is a known issue and is not unique to us. + "-DSUPPORTS_NO_UNDEFINED=0" + ]; + postInstall = (orig.postInstall or "") + '' + mkdir -p $static/lib $man; + mv $out/lib/*.a $static/lib/ + mv $out/share $man/ + ''; + }); # Compiling DPDK is the primary objective of this overlay. # @@ -243,9 +247,18 @@ in # # Also, while this library has a respectable security track record, this is also a super strong candidate for # cfi, safe-stack, and cf-protection. - dpdk = (dataplane-dep ( - final.callPackage ../pkgs/dpdk (platform.override.dpdk.buildInputs // { src = sources.dpdk; }) - )).override { inherit (final.fancy) rdma-core libnl libbsd numactl; }; + dpdk = + (dataplane-dep ( + final.callPackage ../pkgs/dpdk (platform.override.dpdk.buildInputs // { src = sources.dpdk; }) + )).override + { + inherit (final.fancy) + rdma-core + libnl + libbsd + numactl + ; + }; # DPDK is largely composed of static-inline functions. # We need to wrap those functions with "_w" variants so that we can actually call them from rust. @@ -258,6 +271,17 @@ in # This isn't directly required by dataplane, perftest = dataplane-dep (final.callPackage ../pkgs/perftest { src = sources.perftest; }); + hwloc = (dataplane-dep (prev.hwloc)).overrideAttrs (orig: { + outputs = (orig.outputs or [ ]) ++ [ "static" ]; + configureFlags = (orig.configureFlags or [ ]) ++ [ + "--enable-static" + ]; + postInstall = (orig.postInstall or "") + '' + mkdir -p $static/lib + mv $lib/lib/*.a $static/lib/ + ''; + }); + kopium = import ../pkgs/kopium { src = sources.kopium; inherit rustPlatform; diff --git a/nix/profiles.nix b/nix/profiles.nix index 60ea82ebd..45d14418e 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -97,11 +97,17 @@ let sanitize.address.NIX_CFLAGS_LINK = sanitize.address.NIX_CFLAGS_COMPILE ++ [ "-static-libasan" ]; + sanitize.address.RUSTFLAGS = [ + "-Zsanitizer=address" + ]; sanitize.leak.NIX_CFLAGS_COMPILE = [ "-fsanitize=leak" ]; sanitize.leak.NIX_CXXFLAGS_COMPILE = sanitize.leak.NIX_CFLAGS_COMPILE; sanitize.leak.NIX_CFLAGS_LINK = sanitize.leak.NIX_CFLAGS_COMPILE; + sanitize.leak.RUSTFLAGS = [ + "-Zsanitizer=leak" + ]; sanitize.thread.NIX_CFLAGS_COMPILE = [ "-fsanitize=thread" ]; diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 46e38a196..02edb055a 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -8,9 +8,10 @@ components = [ "rust-std", "rust-docs", "rustfmt-preview", - "clippy-preview", - "rust-analyzer-preview", + "clippy", + "rust-analyzer", "rust-src", + # "llvm-tools" ## other (disabled) components ## # "rust-mingw", ## not relevant to us From 4df9264e5b5de75a1cbd38ee540ebf0c41923326 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sat, 27 Dec 2025 16:27:55 +0000 Subject: [PATCH 107/163] more stuff working --- .cargo/aarch64.gnu.toml | 2 ++ .cargo/aarch64.musl.toml | 8 ++++++ .cargo/config.toml | 48 ++++++++++++++++------------------ .cargo/x86_64.gnu.toml | 5 ++++ .cargo/x86_64.musl.toml | 2 ++ Cargo.toml | 2 ++ default.nix | 9 ++++--- dpdk-sysroot-helper/src/lib.rs | 1 - nix/profiles.nix | 41 +++++++++++++++++++---------- 9 files changed, 74 insertions(+), 44 deletions(-) create mode 100644 .cargo/aarch64.gnu.toml create mode 100644 .cargo/aarch64.musl.toml create mode 100644 .cargo/x86_64.gnu.toml create mode 100644 .cargo/x86_64.musl.toml diff --git a/.cargo/aarch64.gnu.toml b/.cargo/aarch64.gnu.toml new file mode 100644 index 000000000..66dc89dd7 --- /dev/null +++ b/.cargo/aarch64.gnu.toml @@ -0,0 +1,2 @@ +[env] +CC = { value = "devroot/bin/aarch64-unknown-linux-gnu-clang", relative = true, force = false } diff --git a/.cargo/aarch64.musl.toml b/.cargo/aarch64.musl.toml new file mode 100644 index 000000000..1740b1f31 --- /dev/null +++ b/.cargo/aarch64.musl.toml @@ -0,0 +1,8 @@ +[env] +CC = { value = "devroot/bin/aarch64-unknown-linux-musl-clang", relative = true, force = false } + +[target.aarch64-unknown-linux-musl] +rustflags = [ + "-Copt-level=3", +] + diff --git a/.cargo/config.toml b/.cargo/config.toml index 58c71c89f..2af8f3d04 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,32 +1,28 @@ [env] +SYSROOT = { value = "sysroot", relative = true, force = false } C_INCLUDE_PATH = { value = "sysroot/include", relative = true, force = false } -GW_CRD_PATH = { value = "devroot/src/gateway/config/crd/bases", relative = true, force = false } -LIBCLANG_PATH = { value = "devroot/lib", relative = true, force = false } LIBRARY_PATH = { value = "sysroot/lib", relative = true, force = false } PKG_CONFIG_PATH = { value = "sysroot/lib/pkgconfig", relative = true, force = false } +GW_CRD_PATH = { value = "devroot/src/gateway/config/crd/bases", relative = true, force = false } +LIBCLANG_PATH = { value = "devroot/lib", relative = true, force = false } + +[build] +rustflags = ["--cfg=tokio_unstable"] + +[target.x86_64-unknown-linux-gnu] +rustflags = ["--cfg=tokio_unstable", "-Clinker=clang", "-Clink-arg=-fuse-ld=lld"] + +[target.x86_64-unknown-linux-musl] +rustflags = ["--cfg=tokio_unstable", "-Clinker=x86_64-unknown-linux-musl-clang", "-Clink-arg=-fuse-ld=lld"] + +[target.aarch64-unknown-linux-gnu] +rustflags = ["--cfg=tokio_unstable", "-Clinker=aarch64-unknown-linux-gnu-clang", "-Clink-arg=-fuse-ld=lld"] + +[target.aarch64-unknown-linux-musl] +rustflags = ["--cfg=tokio_unstable", "-Clinker=aarch64-unknown-linux-musl-clang", "-Clink-arg=-fuse-ld=lld"] -# [unstable] -# build-std = [ -# "compiler_builtins", -# "core", -# "alloc", -# "std", -# "panic_unwind", -# "proc_macro" -# ] -# # build-std-features = ["backtrace", "panic-unwind", "mem", "llvm-libunwind"] -# build-std-features = ["backtrace", "panic-unwind", "mem", "compiler-builtins-mem"] +[profile.debug] +lto = "fat" -# [build] -# rustflags = [ -# "--cfg=tokio_unstable", -# "-Ccodegen-units=64", -# "-Cdebug-assertions=on", -# "-Cdebuginfo=full", -# "-Cdwarf-version=5", -# "-Clink-arg=-fuse-ld=lld", -# "-Clinker=clang", -# "-Copt-level=0", -# "-Coverflow-checks=on", -# "-Ctarget-cpu=generic", -# ] +[profile.release] +rustflags = ["-Clinker-plugin-lto", "-Cembed-bitcode=yes", "-Clink-arg=-Wl,--as-needed,--gc-sections"] diff --git a/.cargo/x86_64.gnu.toml b/.cargo/x86_64.gnu.toml new file mode 100644 index 000000000..8a7c82b48 --- /dev/null +++ b/.cargo/x86_64.gnu.toml @@ -0,0 +1,5 @@ +[env] +CC = { value = "devroot/bin/x86_64-unknown-linux-gnu-clang", relative = true, force = false } + +[target.x86_64-unknown-linux-gnu] +rustflags = ["--cfg=tokio_unstable", "-Clinker=x86_64-unknown-linux-gnu-clang", "-Clink-arg=-fuse-ld=lld"] diff --git a/.cargo/x86_64.musl.toml b/.cargo/x86_64.musl.toml new file mode 100644 index 000000000..e2e0687f0 --- /dev/null +++ b/.cargo/x86_64.musl.toml @@ -0,0 +1,2 @@ +[env] +CC = { value = "devroot/bin/x86_64-unknown-linux-musl-clang", relative = true, force = false } diff --git a/Cargo.toml b/Cargo.toml index c86b909c8..8e679dd80 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,5 @@ +cargo-features = ["profile-rustflags"] + [workspace] default-members = [ diff --git a/default.nix b/default.nix index b3b18079e..91293b12e 100644 --- a/default.nix +++ b/default.nix @@ -25,10 +25,12 @@ let inherit sanitizers instrumentation profile; arch = platform'.arch; }; - profile'' = { + rust-profile = + { "debug" = "dev"; "release" = "release"; - }.${profile}; + } + .${profile}; overlays = import ./nix/overlays { inherit sources @@ -112,6 +114,7 @@ let gateway-crd just kopium + llvmPackages.clang npins rust-toolchain ]); @@ -142,7 +145,7 @@ let cargoBuildCommand = builtins.concatStringsSep " " [ "cargo" "build" - "--profile=${profile''}" + "--profile=${rust-profile}" "-Zunstable-options" "-Zbuild-std=compiler_builtins,core,alloc,std,panic_unwind,proc_macro" "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem" diff --git a/dpdk-sysroot-helper/src/lib.rs b/dpdk-sysroot-helper/src/lib.rs index b50bb57c9..30e036b16 100644 --- a/dpdk-sysroot-helper/src/lib.rs +++ b/dpdk-sysroot-helper/src/lib.rs @@ -43,5 +43,4 @@ pub fn get_sysroot() -> String { pub fn use_sysroot() { let sysroot = get_sysroot(); println!("cargo:rustc-link-search=all={sysroot}/lib"); - println!("cargo:rustc-link-arg=--sysroot={sysroot}"); } diff --git a/nix/profiles.nix b/nix/profiles.nix index 45d14418e..90dd9c3c5 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -24,7 +24,8 @@ let common.RUSTFLAGS = [ "-Cdebuginfo=full" "-Cdwarf-version=5" - ]; + ] + ++ (builtins.map (flag: "-Clink-arg=${flag}") common.NIX_CFLAGS_LINK); optimize-for.debug.NIX_CFLAGS_COMPILE = [ "-fno-inline" "-fno-omit-frame-pointer" @@ -35,7 +36,8 @@ let "-Copt-level=0" "-Cdebug-assertions=on" "-Coverflow-checks=on" - ]; + ] + ++ (builtins.map (flag: "-Clink-arg=${flag}") optimize-for.debug.NIX_CFLAGS_LINK); optimize-for.performance.NIX_CFLAGS_COMPILE = [ "-O3" "-flto=thin" @@ -57,8 +59,8 @@ let "-Clinker-plugin-lto" "-Cembed-bitcode=yes" "-Ccodegen-units=1" - "-Clink-arg=-flto=full" - ]; + ] + ++ (builtins.map (flag: "-Clink-arg=${flag}") optimize-for.performance.NIX_CFLAGS_LINK); secure.NIX_CFLAGS_COMPILE = [ "-fstack-protector-strong" "-fstack-clash-protection" @@ -71,7 +73,8 @@ let secure.NIX_CFLAGS_LINK = secure.NIX_CFLAGS_COMPILE; secure.RUSTFLAGS = [ "-Crelro-level=full" - ]; + ] + ++ (builtins.map (flag: "-Clink-arg=${flag}") secure.NIX_CFLAGS_LINK); march.x86_64.NIX_CFLAGS_COMPILE = [ # DPDK functionally requires some -m flags on x86_64. # These features have been available for a long time and can be found on any reasonably recent machine, so just @@ -82,14 +85,17 @@ let "-mssse3" ]; march.x86_64.NIX_CXXFLAGS_COMPILE = march.x86_64.NIX_CFLAGS_COMPILE; + march.x86_64.NIX_CFLAGS_LINK = march.x86_64.NIX_CXXFLAGS_COMPILE; march.x86_64.RUSTFLAGS = [ # these should be kept in 1:1 alignment with the x86_64 NIX_CFLAGS_COMPILE settings "-Ctarget-feature=+rtm,+crc32,+ssse3" - ]; + ] + ++ (builtins.map (flag: "-Clink-arg=${flag}") march.x86_64.NIX_CFLAGS_LINK); march.aarch64.NIX_CFLAGS_COMPILE = [ ]; march.aarch64.NIX_CXXFLAGS_COMPILE = march.aarch64.NIX_CFLAGS_COMPILE; march.aarch64.NIX_CFLAGS_LINK = [ ]; - march.aarch64.RUSTFLAGS = [ ]; + march.aarch64.RUSTFLAGS = + [ ] ++ (builtins.map (flag: "-Clink-arg=${flag}") march.aarch64.NIX_CFLAGS_LINK); sanitize.address.NIX_CFLAGS_COMPILE = [ "-fsanitize=address,local-bounds" ]; @@ -99,7 +105,8 @@ let ]; sanitize.address.RUSTFLAGS = [ "-Zsanitizer=address" - ]; + ] + ++ (builtins.map (flag: "-Clink-arg=${flag}") sanitize.address.NIX_CFLAGS_LINK); sanitize.leak.NIX_CFLAGS_COMPILE = [ "-fsanitize=leak" ]; @@ -107,7 +114,8 @@ let sanitize.leak.NIX_CFLAGS_LINK = sanitize.leak.NIX_CFLAGS_COMPILE; sanitize.leak.RUSTFLAGS = [ "-Zsanitizer=leak" - ]; + ] + ++ (builtins.map (flag: "-Clink-arg=${flag}") sanitize.leak.NIX_CFLAGS_LINK); sanitize.thread.NIX_CFLAGS_COMPILE = [ "-fsanitize=thread" ]; @@ -117,7 +125,8 @@ let ]; sanitize.thread.RUSTFLAGS = [ "-Zsanitizer=thread" - ]; + ] + ++ (builtins.map (flag: "-Clink-arg=${flag}") sanitize.thread.NIX_CFLAGS_LINK); # note: cfi _requires_ LTO and is fundamentally ill suited to debug builds sanitize.cfi.NIX_CFLAGS_COMPILE = [ "-fsanitize=cfi" @@ -142,7 +151,8 @@ let "-Zsanitizer=cfi" "-Zsanitizer-cfi-normalize-integers" "-Zsanitizer-cfi-generalize-pointers" - ]; + ] + ++ (builtins.map (flag: "-Clink-arg=${flag}") sanitize.cfi.NIX_CFLAGS_LINK); sanitize.safe-stack.NIX_CFLAGS_COMPILE = [ "-fsanitize=safe-stack" ]; @@ -152,11 +162,13 @@ let ]; sanitize.safe-stack.RUSTFLAGS = [ "-Zsanitizer=safestack" - ]; + ] + ++ (builtins.map (flag: "-Clink-arg=${flag}") sanitize.safe-stack.NIX_CFLAGS_LINK); instrument.none.NIX_CFLAGS_COMPILE = [ ]; instrument.none.NIX_CXXFLAGS_COMPILE = instrument.none.NIX_CFLAGS_COMPILE; instrument.none.NIX_CFLAGS_LINK = instrument.none.NIX_CFLAGS_COMPILE; - instrument.none.RUSTFLAGS = [ ]; + instrument.none.RUSTFLAGS = + [ ] ++ (builtins.map (flag: "-Clink-arg=${flag}") instrument.none.NIX_CFLAGS_LINK); instrument.produce.NIX_CFLAGS_COMPILE = [ "-fprofile-instr-generate" "-fcoverage-mapping" @@ -166,7 +178,8 @@ let instrument.produce.NIX_CFLAGS_LINK = instrument.produce.NIX_CFLAGS_COMPILE; instrument.produce.RUSTFLAGS = [ "-Cinstrument-coverage" - ]; + ] + ++ (builtins.map (flag: "-Clink-arg=${flag}") instrument.produce.NIX_CFLAGS_LINK); combine-profiles = features: builtins.foldl' ( From b630fab04f4272e6e339a0dc581c609f9e18eea0 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sat, 27 Dec 2025 17:28:37 +0000 Subject: [PATCH 108/163] wip --- .cargo/config.toml | 6 ------ .clangd | 2 +- Cargo.toml | 2 -- default.nix | 2 +- 4 files changed, 2 insertions(+), 10 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 2af8f3d04..3612cdc02 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -20,9 +20,3 @@ rustflags = ["--cfg=tokio_unstable", "-Clinker=aarch64-unknown-linux-gnu-clang", [target.aarch64-unknown-linux-musl] rustflags = ["--cfg=tokio_unstable", "-Clinker=aarch64-unknown-linux-musl-clang", "-Clink-arg=-fuse-ld=lld"] - -[profile.debug] -lto = "fat" - -[profile.release] -rustflags = ["-Clinker-plugin-lto", "-Cembed-bitcode=yes", "-Clink-arg=-Wl,--as-needed,--gc-sections"] diff --git a/.clangd b/.clangd index 841886296..748224bb4 120000 --- a/.clangd +++ b/.clangd @@ -1 +1 @@ -./build-tools/.clangd \ No newline at end of file +devroot/.clangd \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 8e679dd80..c86b909c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,3 @@ -cargo-features = ["profile-rustflags"] - [workspace] default-members = [ diff --git a/default.nix b/default.nix index 91293b12e..4beb1b865 100644 --- a/default.nix +++ b/default.nix @@ -84,8 +84,8 @@ let CompileFlags: Add: - "-I${sysroot}/include" - - "-I${dataplane-pkgs.dpdk.dev}/include" - "-Wno-deprecated-declarations" + - "-Wno-quoted-include-in-framework-header" ''; executable = false; destination = "/.clangd"; From ec068d679d006a1fc3b6e5727bf13cfb38739100 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sat, 27 Dec 2025 18:42:11 +0000 Subject: [PATCH 109/163] wip --- .cargo/config.toml | 2 +- .github/workflows/dev-nix.yml | 142 ++++++++++++++++++++++++++++++++++ .github/workflows/dev.yml | 9 --- default.nix | 53 +++++++------ 4 files changed, 172 insertions(+), 34 deletions(-) create mode 100644 .github/workflows/dev-nix.yml diff --git a/.cargo/config.toml b/.cargo/config.toml index 3612cdc02..9f250064e 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -10,7 +10,7 @@ LIBCLANG_PATH = { value = "devroot/lib", relative = true, force = false } rustflags = ["--cfg=tokio_unstable"] [target.x86_64-unknown-linux-gnu] -rustflags = ["--cfg=tokio_unstable", "-Clinker=clang", "-Clink-arg=-fuse-ld=lld"] +rustflags = ["--cfg=tokio_unstable"] [target.x86_64-unknown-linux-musl] rustflags = ["--cfg=tokio_unstable", "-Clinker=x86_64-unknown-linux-musl-clang", "-Clink-arg=-fuse-ld=lld"] diff --git a/.github/workflows/dev-nix.yml b/.github/workflows/dev-nix.yml new file mode 100644 index 000000000..48fc0bbd0 --- /dev/null +++ b/.github/workflows/dev-nix.yml @@ -0,0 +1,142 @@ +name: "dev-nix.yml" + +on: + pull_request: {} + push: + branches: + - "main" + tags: + - "v*" + merge_group: + types: ["checks_requested"] + workflow_dispatch: + inputs: + debug_enabled: + type: "boolean" + description: "Run with tmate enabled" + required: false + default: false + debug_justfile: + type: "boolean" + description: "enable to see debug statements from just recipes" + required: false + default: false + skip_vlab_tests: + type: "boolean" + description: "Skip VLAB tests (they run by default)" + required: false + default: false + run_hlab_tests: + type: "boolean" + description: "Run hybrid HLAB tests" + required: false + default: false + enable_release_tests: + type: "boolean" + description: "Enable release tests for VLAB/HLAB tests" + required: false + default: false + +concurrency: + group: "${{ github.workflow }}:${{ github.event.pull_request.number || github.event.after || github.event.merge_group && github.run_id }}" + cancel-in-progress: true + +permissions: + contents: "read" + packages: "write" + id-token: "write" + +jobs: + check: + env: + CACHE_REGISTRY: "run.h.hhdev.io:30000" + UPSTREAM_REGISTRY: "ghcr.io" + needs: + - check_changes + - version + if: "${{ needs.check_changes.outputs.devfiles == 'true' || startsWith(github.event.ref, 'refs/tags/v') && github.event_name == 'push' }}" + permissions: + checks: "write" + pull-requests: "write" + contents: "read" + packages: "write" + id-token: "write" + strategy: + fail-fast: false + matrix: + profile: + - name: "debug" + sterile: "" + - name: "debug" + sterile: "sterile" + - name: "release" + sterile: "sterile" + - name: "fuzz" + sterile: "sterile" + #- name: "release" + # sterile: "" + #- name: "fuzz" + # sterile: "" + debug_justfile: + - "${{ inputs.debug_justfile || false }}" + name: "${{matrix.profile.name}} ${{matrix.profile.sterile}}" + runs-on: "lab" + timeout-minutes: 120 + steps: + - name: "install nix" + uses: "cachix/install-nix-action@v31" + with: + nix_path: nixpkgs=channel:nixpkgs-unstable + + - name: "login to ghcr.io" + uses: "docker/login-action@v3" + with: + registry: "${{ env.UPSTREAM_REGISTRY }}" + username: "${{ github.actor }}" + password: "${{ secrets.GITHUB_TOKEN }}" + + - name: "login to image cache" + uses: "docker/login-action@v3" + with: + registry: "${{ env.CACHE_REGISTRY }}" + username: "${{ secrets.LAB_REGISTRY_USERNAME }}" + password: "${{ secrets.LAB_REGISTRY_TOKEN }}" + + - name: "Checkout" + uses: "actions/checkout@v6" + with: + persist-credentials: "false" + fetch-depth: "0" + + - name: "build sysroot/devroot" + run: | + nix build -f default.nix sysroot --show-trace --max-jobs 8 --out-link sysroot + nix build -f default.nix devroot --show-trace --max-jobs 8 --out-link devroot + + - name: "cargo build / nextest" + run: | + export PATH="$(pwd)/devroot/bin:$PATH" + cargo build + cargo nextest run + + - id: "clippy" + name: "run clippy" + run: | + cargo clippy --all-targets --all-features -- -D warnings + + - id: "docs" + name: "run rustdoc" + run: | + RUSTDOCFLAGS="-D warnings" cargo doc --no-deps + + - name: "run doctests" + run: | + cargo test --doc + + - name: "Setup tmate session for debug" + # if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} + if: always + uses: "mxschmitt/action-tmate@v3" + timeout-minutes: 120 + with: + limit-access-to-actor: true diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index f6704646b..bfee38917 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -1,12 +1,3 @@ -# The primary point of this workflow is to ensure that the developer experience is good. -# We take a very vanilla ubuntu image, install all necessary dependencies via "normal" means, -# and then run the build and test steps as described in the README.md file. - -# The artifacts produced by these builds are not intended to be used for anything other than -# ensuring that the developer experience is good. - -# Production artifacts are produced in a sterile environment (in another CI workflow). - name: "dev.yml" on: diff --git a/default.nix b/default.nix index 4beb1b865..16896fc5e 100644 --- a/default.nix +++ b/default.nix @@ -92,32 +92,36 @@ let }; crane = import sources.crane { pkgs = dataplane-pkgs; }; craneLib = crane.craneLib.overrideToolchain dataplane-pkgs.rust-toolchain; + _devpkgs = [ + clangd-config + ] + ++ (with dataplane-pkgs.pkgsBuildHost.llvmPackages; [ + bintools + clang + libclang.lib + lld + ]) + ++ (with dataplane-dev-pkgs; [ + bash + cargo-bolero + cargo-deny + cargo-depgraph + cargo-llvm-cov + cargo-nextest + direnv + gateway-crd + just + kopium + # llvmPackages.clang ## TODO: determine if we actually need this. It is quite heavy and may be confusing + npins + rust-toolchain + ]); devroot = dataplane-pkgs.symlinkJoin { name = "dataplane-dev-shell"; - paths = [ - clangd-config - ] - ++ (with dataplane-pkgs.pkgsBuildHost.llvmPackages; [ - bintools - clang - libclang.lib - lld - ]) - ++ (with dataplane-dev-pkgs; [ - bash - cargo-bolero - cargo-deny - cargo-depgraph - cargo-llvm-cov - cargo-nextest - direnv - gateway-crd - just - kopium - llvmPackages.clang - npins - rust-toolchain - ]); + paths = _devpkgs; + }; + shell = dataplane-pkgs.mkShell { + packages = _devpkgs; }; markdownFilter = path: _type: builtins.match ".*\.md$" path != null; cHeaderFilter = path: _type: builtins.match ".*\.h$" path != null; @@ -249,6 +253,7 @@ in packages sources sysroot + shell ; crane = craneLib; profile = profile'; From 343dc6438cfa1669a651b133539dca70711e09eb Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sat, 27 Dec 2025 18:46:17 +0000 Subject: [PATCH 110/163] hack --- .github/workflows/dev-nix.yml | 142 ------- .github/workflows/dev.back.yml | 609 +++++++++++++++++++++++++++ .github/workflows/dev.yml | 731 ++++++--------------------------- 3 files changed, 741 insertions(+), 741 deletions(-) delete mode 100644 .github/workflows/dev-nix.yml create mode 100644 .github/workflows/dev.back.yml diff --git a/.github/workflows/dev-nix.yml b/.github/workflows/dev-nix.yml deleted file mode 100644 index 48fc0bbd0..000000000 --- a/.github/workflows/dev-nix.yml +++ /dev/null @@ -1,142 +0,0 @@ -name: "dev-nix.yml" - -on: - pull_request: {} - push: - branches: - - "main" - tags: - - "v*" - merge_group: - types: ["checks_requested"] - workflow_dispatch: - inputs: - debug_enabled: - type: "boolean" - description: "Run with tmate enabled" - required: false - default: false - debug_justfile: - type: "boolean" - description: "enable to see debug statements from just recipes" - required: false - default: false - skip_vlab_tests: - type: "boolean" - description: "Skip VLAB tests (they run by default)" - required: false - default: false - run_hlab_tests: - type: "boolean" - description: "Run hybrid HLAB tests" - required: false - default: false - enable_release_tests: - type: "boolean" - description: "Enable release tests for VLAB/HLAB tests" - required: false - default: false - -concurrency: - group: "${{ github.workflow }}:${{ github.event.pull_request.number || github.event.after || github.event.merge_group && github.run_id }}" - cancel-in-progress: true - -permissions: - contents: "read" - packages: "write" - id-token: "write" - -jobs: - check: - env: - CACHE_REGISTRY: "run.h.hhdev.io:30000" - UPSTREAM_REGISTRY: "ghcr.io" - needs: - - check_changes - - version - if: "${{ needs.check_changes.outputs.devfiles == 'true' || startsWith(github.event.ref, 'refs/tags/v') && github.event_name == 'push' }}" - permissions: - checks: "write" - pull-requests: "write" - contents: "read" - packages: "write" - id-token: "write" - strategy: - fail-fast: false - matrix: - profile: - - name: "debug" - sterile: "" - - name: "debug" - sterile: "sterile" - - name: "release" - sterile: "sterile" - - name: "fuzz" - sterile: "sterile" - #- name: "release" - # sterile: "" - #- name: "fuzz" - # sterile: "" - debug_justfile: - - "${{ inputs.debug_justfile || false }}" - name: "${{matrix.profile.name}} ${{matrix.profile.sterile}}" - runs-on: "lab" - timeout-minutes: 120 - steps: - - name: "install nix" - uses: "cachix/install-nix-action@v31" - with: - nix_path: nixpkgs=channel:nixpkgs-unstable - - - name: "login to ghcr.io" - uses: "docker/login-action@v3" - with: - registry: "${{ env.UPSTREAM_REGISTRY }}" - username: "${{ github.actor }}" - password: "${{ secrets.GITHUB_TOKEN }}" - - - name: "login to image cache" - uses: "docker/login-action@v3" - with: - registry: "${{ env.CACHE_REGISTRY }}" - username: "${{ secrets.LAB_REGISTRY_USERNAME }}" - password: "${{ secrets.LAB_REGISTRY_TOKEN }}" - - - name: "Checkout" - uses: "actions/checkout@v6" - with: - persist-credentials: "false" - fetch-depth: "0" - - - name: "build sysroot/devroot" - run: | - nix build -f default.nix sysroot --show-trace --max-jobs 8 --out-link sysroot - nix build -f default.nix devroot --show-trace --max-jobs 8 --out-link devroot - - - name: "cargo build / nextest" - run: | - export PATH="$(pwd)/devroot/bin:$PATH" - cargo build - cargo nextest run - - - id: "clippy" - name: "run clippy" - run: | - cargo clippy --all-targets --all-features -- -D warnings - - - id: "docs" - name: "run rustdoc" - run: | - RUSTDOCFLAGS="-D warnings" cargo doc --no-deps - - - name: "run doctests" - run: | - cargo test --doc - - - name: "Setup tmate session for debug" - # if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} - if: always - uses: "mxschmitt/action-tmate@v3" - timeout-minutes: 120 - with: - limit-access-to-actor: true diff --git a/.github/workflows/dev.back.yml b/.github/workflows/dev.back.yml new file mode 100644 index 000000000..bfee38917 --- /dev/null +++ b/.github/workflows/dev.back.yml @@ -0,0 +1,609 @@ +name: "dev.yml" + +on: + pull_request: {} + push: + branches: + - "main" + tags: + - "v*" + merge_group: + types: ["checks_requested"] + workflow_dispatch: + inputs: + debug_enabled: + type: "boolean" + description: "Run with tmate enabled" + required: false + default: false + debug_justfile: + type: "boolean" + description: "enable to see debug statements from just recipes" + required: false + default: false + skip_vlab_tests: + type: "boolean" + description: "Skip VLAB tests (they run by default)" + required: false + default: false + run_hlab_tests: + type: "boolean" + description: "Run hybrid HLAB tests" + required: false + default: false + enable_release_tests: + type: "boolean" + description: "Enable release tests for VLAB/HLAB tests" + required: false + default: false + +concurrency: + group: "${{ github.workflow }}:${{ github.event.pull_request.number || github.event.after || github.event.merge_group && github.run_id }}" + cancel-in-progress: true + +permissions: + contents: "read" + packages: "write" + id-token: "write" + +jobs: + check_changes: + name: "Deduce required tests from code changes" + permissions: + contents: "read" + pull-requests: "read" + runs-on: "ubuntu-latest" + outputs: + devfiles: "${{ steps.changes.outputs.devfiles }}" + steps: + - name: "Checkout" + if: "${{ !github.event.pull_request }}" + uses: "actions/checkout@v6" + with: + persist-credentials: "false" + fetch-depth: "0" + - name: "Check code changes" + uses: "dorny/paths-filter@v3" + id: "changes" + with: + filters: | + devfiles: + - '!(README.md|LICENSE|.gitattributes|.gitignore|.github/**)' + - '.github/workflows/dev.yml' + + version: + runs-on: lab + + permissions: + contents: read + + outputs: + version: "${{ steps.version-gen.outputs.version }}" + ref: "${{ steps.version-gen.outputs.ref }}" + + steps: + - name: Checkout repository + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Generate temp artifacts version + id: version-gen + env: + commit_sha: ${{ github.event.pull_request.head.sha || github.sha }} + run: | + echo "version=v0-${commit_sha::9}" >> "$GITHUB_OUTPUT" + echo "ref=${commit_sha}" >> "$GITHUB_OUTPUT" + + check: + env: + CACHE_REGISTRY: "run.h.hhdev.io:30000" + UPSTREAM_REGISTRY: "ghcr.io" + needs: + - check_changes + - version + if: "${{ needs.check_changes.outputs.devfiles == 'true' || startsWith(github.event.ref, 'refs/tags/v') && github.event_name == 'push' }}" + permissions: + checks: "write" + pull-requests: "write" + contents: "read" + packages: "write" + id-token: "write" + strategy: + fail-fast: false + matrix: + profile: + - name: "debug" + sterile: "" + - name: "debug" + sterile: "sterile" + - name: "release" + sterile: "sterile" + - name: "fuzz" + sterile: "sterile" + #- name: "release" + # sterile: "" + #- name: "fuzz" + # sterile: "" + debug_justfile: + - "${{ inputs.debug_justfile || false }}" + name: "${{matrix.profile.name}} ${{matrix.profile.sterile}}" + runs-on: "lab" + timeout-minutes: 45 + steps: + - name: "login to ghcr.io" + uses: "docker/login-action@v3" + with: + registry: "${{ env.UPSTREAM_REGISTRY }}" + username: "${{ github.actor }}" + password: "${{ secrets.GITHUB_TOKEN }}" + + - name: "login to image cache" + uses: "docker/login-action@v3" + with: + registry: "${{ env.CACHE_REGISTRY }}" + username: "${{ secrets.LAB_REGISTRY_USERNAME }}" + password: "${{ secrets.LAB_REGISTRY_TOKEN }}" + + # it's temporarily needed to install skopeo + - name: Setup Go + uses: actions/setup-go@v6 + with: + go-version: stable + cache: true + + - name: "Checkout" + uses: "actions/checkout@v6" + with: + persist-credentials: "false" + fetch-depth: "0" + + - name: "install just" + run: | + # this keeps our GH actions logs from getting messed up with color codes + echo 'deb [trusted=yes] https://apt.gabe565.com /' | sudo tee /etc/apt/sources.list.d/gabe565.list + sudo apt-get update + sudo apt-get install --yes --no-install-recommends just + + - name: "set up build environment" + run: | + REQUIRED_HUGEPAGES=512 + HUGEPAGES_PATH=/sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages + OVERCOMMIT_HUGEPAGES_PATH=/sys/kernel/mm/hugepages/hugepages-2048kB/nr_overcommit_hugepages + docker run --privileged --rm busybox:latest sh -c "echo $((6 * REQUIRED_HUGEPAGES)) > $OVERCOMMIT_HUGEPAGES_PATH" + docker run --privileged --rm busybox:latest sh -c "echo $((2 * REQUIRED_HUGEPAGES)) > $HUGEPAGES_PATH" + docker pull "${{env.UPSTREAM_REGISTRY}}/githedgehog/testn/n-vm:v0.0.9" + just --yes \ + debug_justfile="${{matrix.debug_justfile}}" \ + profile=${{matrix.profile.name}} \ + dpdp_sys_registry="${{env.CACHE_REGISTRY}}" \ + refresh-compile-env + just --yes debug_justfile="${{matrix.debug_justfile}}" fake-nix + + - name: "cargo deny check" + run: | + just \ + debug_justfile="${{matrix.debug_justfile}}" \ + profile=${{matrix.profile.name}} \ + dpdp_sys_registry="${{env.CACHE_REGISTRY}}" \ + ${{matrix.profile.sterile}} cargo deny check + + - name: "push container" + if: ${{ matrix.profile.sterile == 'sterile' && (matrix.profile.name == 'release' || matrix.profile.name == 'debug') }} + run: | + just \ + debug_justfile="${{matrix.debug_justfile}}" \ + profile=${{matrix.profile.name}} \ + dpdp_sys_registry="${{env.UPSTREAM_REGISTRY}}" \ + target=x86_64-unknown-linux-gnu \ + version=${{ needs.version.outputs.version }}-${{ matrix.profile.name }} \ + oci_repo="ghcr.io" \ + push + + - name: "print container image name" + if: ${{ matrix.profile.sterile == 'sterile' && (matrix.profile.name == 'release' || matrix.profile.name == 'debug') }} + run: | + just \ + debug_justfile="${{matrix.debug_justfile}}" \ + profile=${{matrix.profile.name}} \ + target=x86_64-unknown-linux-gnu \ + version=${{ needs.version.outputs.version }}-${{ matrix.profile.name }} \ + oci_repo="ghcr.io" \ + print-container-tags + + - name: "Check for uncommitted changes" + run: | + git diff --exit-code + if [ $? -ne 0 ]; then + echo "::error::Uncommitted changes detected:" + git diff + exit 1 + fi + echo "No uncommitted changes found" + + - name: "Check for untracked files" + run: | + if [ -n "$(git ls-files --others --exclude-standard)" ]; then + echo "::error::Untracked files detected:" + git ls-files --others --exclude-standard + exit 1 + fi + echo "No untracked files found" + + - id: "test" + name: "test" + run: | + set -euo pipefail + mkdir --parent ./target/nextest + # Run tests. The resulting results.json is not a full JSON object but + # a list of JSON objects, one per line. + if [ ${{ matrix.profile.name }} = "fuzz" ]; then + echo "::notice::Running fuzz tests" + just \ + debug_justfile="${{matrix.debug_justfile}}" \ + profile=${{matrix.profile.name}} \ + target=x86_64-unknown-linux-gnu \ + dpdp_sys_registry="${{env.CACHE_REGISTRY}}" \ + ${{matrix.profile.sterile}} coverage \ + --status-level=none \ + --final-status-level=skip \ + --message-format=libtest-json-plus > ./results.json + else + echo "::notice::Running regular tests" + just \ + debug_justfile="${{matrix.debug_justfile}}" \ + profile=${{matrix.profile.name}} \ + target=x86_64-unknown-linux-gnu \ + dpdp_sys_registry="${{env.CACHE_REGISTRY}}" \ + ${{matrix.profile.sterile}} cargo nextest run \ + --cargo-profile=${{matrix.profile.name}} \ + --status-level=none \ + --final-status-level=skip \ + --message-format=libtest-json-plus \ + > ./results.json + echo "::notice::Running Shuttle tests" + # We need to rebuild using the shuttle feature. To avoid running + # all tests a second time, we filter to run only tests with pattern + # "shuttle" in their name (test function name, file name, or module + # name). + # + # IF YOUR SHUTTLE TESTS DO NOT HAVE "shuttle" IN THEIR NAME, THEY + # WILL NOT RUN. + just \ + debug_justfile="${{matrix.debug_justfile}}" \ + profile=${{matrix.profile.name}} \ + target=x86_64-unknown-linux-gnu \ + dpdp_sys_registry="${{env.CACHE_REGISTRY}}" \ + ${{matrix.profile.sterile}} cargo nextest run \ + --cargo-profile=${{matrix.profile.name}} \ + --status-level=none \ + --final-status-level=none \ + --message-format=libtest-json-plus \ + --features shuttle \ + shuttle \ + >> ./results.json + fi + # look for any flakes (flakes have a #\\d+ match in their name field) + jq \ + --raw-output \ + --slurp '.[] | select(.type == "test" and (.name | test(".*#\\d+"))) | ( .name | split("#") ) | + [.[0], (.[1] | tonumber)] | @csv + ' ./results.json > ./target/nextest/flakes.csv + if [ -s ./target/nextest/flakes.csv ]; then + { + echo "FLAKY_TESTS<> "${GITHUB_ENV}" + fi + rm results.json + + - name: "upload test results to codecov" + if: ${{ always() }} + uses: "codecov/codecov-action@v5" + with: + fail_ci_if_error: true + files: ./target/nextest/default/junit.xml + report_type: "test_results" + disable_search: "true" + use_oidc: "true" + verbose: true + flags: "${{matrix.profile.name}}-${{ matrix.profile.sterile || 'developer' }}" + + - name: "upload codecov analysis" + if: ${{ matrix.profile.name == 'fuzz' }} + uses: "codecov/codecov-action@v5" + with: + fail_ci_if_error: true + files: ./target/nextest/coverage/codecov.json + report_type: "coverage" + disable_search: "true" + use_oidc: "true" + verbose: true + flags: "${{matrix.profile.name}}-${{ matrix.profile.sterile || 'developer' }}" + + - name: "clean up coverage data" + run: | + rm -f codecov codecov.SHA256SUM codecov.SHA256SUM.sig + + - uses: "marocchino/sticky-pull-request-comment@v2" + if: ${{ always() }} + with: + header: "flakes_${{matrix.profile.name}}_${{matrix.profile.sterile}}" + ignore_empty: "true" + message: | + ${{ env.FLAKY_TESTS }} + + - name: "publish test report" + uses: "mikepenz/action-junit-report@v6" + if: "${{ always() }}" + with: + annotate_notice: "false" + annotate_only: "false" + check_annotations: "true" + check_retries: "false" + comment: "false" + detailed_summary: "true" + fail_on_failure: "false" + fail_on_parse_error: "true" + flaky_summary: "true" + include_empty_in_summary: "true" + include_passed: "true" + include_time_in_summary: "true" + report_paths: "target/nextest/default/*junit.xml" + require_passed_tests: "true" + require_tests: "true" + simplified_summary: "true" + truncate_stack_traces: "false" + group_reports: "true" + check_name: "test-report-${{matrix.profile.name}}-sterile:${{matrix.profile.sterile == 'sterile'}}" + skip_success_summary: "false" + job_summary: "true" + verbose_summary: "false" + + - id: "clippy" + name: "run clippy" + run: | + just debug_justfile="${{matrix.debug_justfile}}" profile=${{matrix.profile.name}} \ + ${{matrix.profile.sterile}} cargo clippy --all-targets --all-features -- -D warnings + + - id: "docs" + name: "run rustdoc" + run: | + RUSTDOCFLAGS="-D warnings" just \ + debug_justfile="${{matrix.debug_justfile}}" \ + profile=${{matrix.profile.name}} \ + target=x86_64-unknown-linux-gnu \ + ${{matrix.profile.sterile}} cargo doc --no-deps + + - name: "run doctests" + run: | + just \ + debug_justfile="${{matrix.debug_justfile}}" \ + profile=${{matrix.profile.name}} \ + target=x86_64-unknown-linux-gnu \ + ${{matrix.profile.sterile}} cargo test --doc + + - name: "Setup tmate session for debug" + if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} + uses: "mxschmitt/action-tmate@v3" + timeout-minutes: 60 + with: + limit-access-to-actor: true + + vlab: + if: "${{ needs.check_changes.outputs.devfiles == 'true' || startsWith(github.event.ref, 'refs/tags/v') && github.event_name == 'push' }}" + needs: + - check + - version + + name: "${{ matrix.hybrid && 'h' || 'v' }}-${{ matrix.upgradefrom && 'up' || '' }}${{ matrix.upgradefrom }}${{ matrix.upgradefrom && '-' || '' }}${{ matrix.mesh && 'mesh-' || '' }}${{ matrix.gateway && 'gw-' || '' }}${{ matrix.includeonie && 'onie-' || '' }}${{ matrix.buildmode }}-${{ matrix.vpcmode }}" + + uses: githedgehog/fabricator/.github/workflows/run-vlab.yaml@master + with: + # ci:+hlab is required to enable hybrid lab tests on PR + # ci:-vlab disables virtual lab tests on PR + # ci:-upgrade disables upgrade tests on PR + # hlab is disabled for main and merge_queue till we have gateway tests for it + # upgrade jobs are temporarily skipped in merge_queue until we fix the issue with 25.05 + skip: >- + ${{ + github.event_name == 'pull_request' + && ( + matrix.hybrid && !contains(github.event.pull_request.labels.*.name, 'ci:+hlab') + || !matrix.hybrid && contains(github.event.pull_request.labels.*.name, 'ci:-vlab') + || matrix.upgradefrom != '' && contains(github.event.pull_request.labels.*.name, 'ci:-upgrade') + ) + + || github.event_name == 'workflow_dispatch' + && ( + matrix.hybrid && inputs.run_hlab_tests != true + || !matrix.hybrid && inputs.skip_vlab_tests == true + ) + + || (github.event_name == 'push' || github.event_name == 'merge_group') + && (matrix.hybrid || matrix.upgradefrom != '') + }} + fabricatorref: master + prebuild: "just bump dataplane ${{ needs.version.outputs.version }}-release" + fabricmode: ${{ matrix.fabricmode }} + gateway: ${{ matrix.gateway }} + gateway_agentless: true + includeonie: ${{ matrix.includeonie }} + buildmode: ${{ matrix.buildmode }} + vpcmode: ${{ matrix.vpcmode }} + releasetest: ${{ contains(github.event.pull_request.labels.*.name, 'ci:+release') || inputs.enable_release_tests == true }} + hybrid: ${{ matrix.hybrid }} + upgradefrom: ${{ matrix.upgradefrom }} + + strategy: + fail-fast: false + matrix: + fabricmode: + - spine-leaf + gateway: + - true + includeonie: + - false + buildmode: + - iso + vpcmode: + - l2vni + hybrid: + - false + upgradefrom: + - "" + - "25.05" + include: + # gateway l3vni + - fabricmode: spine-leaf + gateway: true + includeonie: false + buildmode: iso + vpcmode: l3vni + hybrid: false + upgradefrom: "" + + # hlab gateway l2vni + - fabricmode: spine-leaf + gateway: true + includeonie: false + buildmode: iso + vpcmode: l2vni + hybrid: true + upgradefrom: "" + + summary: + name: "Summary" + runs-on: "ubuntu-latest" + needs: + - check + - vlab + # Run always, except when the "check" job was skipped. + # + # When the check job is skipped, summary will be marked as skipped, and + # it's OK for CI (it's not a failure). + # Why don't we do the same for check jobs? Because their names depend on + # matrix values, and if we skip them the names won't be generated and + # GitHub won't be able to find skipped jobs for required status checks. + if: ${{ always() }} + steps: + - name: "Flag any check matrix failures" + if: ${{ needs.check.result != 'success' && needs.check.result != 'skipped' }} + run: | + echo '::error:: Some check job(s) failed' + exit 1 + - name: "Flag any vlab matrix failures" + if: ${{ needs.vlab.result != 'success' && needs.vlab.result != 'skipped' }} + run: | + echo '::error:: Some vlab job(s) failed' + exit 1 + + publish: + env: + CACHE_REGISTRY: "run.h.hhdev.io:30000" + UPSTREAM_REGISTRY: "ghcr.io" + runs-on: lab + if: startsWith(github.event.ref, 'refs/tags/v') && github.event_name == 'push' + needs: + - check + - vlab + + permissions: + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Setup Go + uses: actions/setup-go@v6 + with: + go-version: stable + cache: true + + - name: Login to ghcr.io + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: "login to image cache" + uses: "docker/login-action@v3" + with: + registry: "${{ env.CACHE_REGISTRY }}" + username: "${{ secrets.LAB_REGISTRY_USERNAME }}" + password: "${{ secrets.LAB_REGISTRY_TOKEN }}" + + - name: "set up build environment" + run: | + REQUIRED_HUGEPAGES=512 + HUGEPAGES_PATH=/sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages + OVERCOMMIT_HUGEPAGES_PATH=/sys/kernel/mm/hugepages/hugepages-2048kB/nr_overcommit_hugepages + docker run --privileged --rm busybox:latest sh -c "echo $((6 * REQUIRED_HUGEPAGES)) > $OVERCOMMIT_HUGEPAGES_PATH" + docker run --privileged --rm busybox:latest sh -c "echo $((2 * REQUIRED_HUGEPAGES)) > $HUGEPAGES_PATH" + docker pull "${{env.UPSTREAM_REGISTRY}}/githedgehog/testn/n-vm:v0.0.9" + just --yes \ + debug_justfile="${{matrix.debug_justfile}}" \ + profile=${{matrix.profile.name}} \ + dpdp_sys_registry="${{env.CACHE_REGISTRY}}" \ + refresh-compile-env + just --yes debug_justfile="${{matrix.debug_justfile}}" fake-nix + + - name: "push container" + run: | + just \ + debug_justfile="${{matrix.debug_justfile}}" \ + profile=release \ + dpdp_sys_registry="${{env.UPSTREAM_REGISTRY}}" \ + target=x86_64-unknown-linux-gnu \ + oci_repo="ghcr.io" \ + push + + # Bump dataplane in the fabricator repository + + - name: Checkout fabricator repository + uses: actions/checkout@v6 + with: + repository: githedgehog/fabricator + path: fab-repo + persist-credentials: false + + - name: Bump dataplane in fabricator + working-directory: fab-repo + run: | + sed -i "s/^\tDataplaneVersion.*/\tDataplaneVersion=meta.Version(\"${{ github.ref_name }}\")/" pkg/fab/versions.go + go fmt pkg/fab/versions.go + + - name: Generate token for the fabricator repository + uses: actions/create-github-app-token@v2 + id: fab-app-token + with: + app-id: ${{ secrets.FAB_APP_ID }} + private-key: ${{ secrets.FAB_PRIVATE_KEY }} + repositories: | + fabricator + + - name: Create Pull Request for fabricator + uses: peter-evans/create-pull-request@v8 + id: fab-pr + with: + token: ${{ steps.fab-app-token.outputs.token }} + path: fab-repo + branch: pr/auto/dataplane-bump + commit-message: | + bump: dataplane to ${{ github.ref_name }} + + This is an automated commit created by GitHub Actions workflow, + in the dataplane repository. + signoff: true + title: "bump: dataplane to ${{ github.ref_name }}" + body: | + This is an automated Pull Request created by GitHub Actions workflow, + in the dataplane repository. diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index bfee38917..299799991 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -1,609 +1,142 @@ name: "dev.yml" on: - pull_request: {} - push: - branches: - - "main" - tags: - - "v*" - merge_group: - types: ["checks_requested"] - workflow_dispatch: - inputs: - debug_enabled: - type: "boolean" - description: "Run with tmate enabled" - required: false - default: false - debug_justfile: - type: "boolean" - description: "enable to see debug statements from just recipes" - required: false - default: false - skip_vlab_tests: - type: "boolean" - description: "Skip VLAB tests (they run by default)" - required: false - default: false - run_hlab_tests: - type: "boolean" - description: "Run hybrid HLAB tests" - required: false - default: false - enable_release_tests: - type: "boolean" - description: "Enable release tests for VLAB/HLAB tests" - required: false - default: false + pull_request: {} + push: + branches: + - "main" + tags: + - "v*" + merge_group: + types: ["checks_requested"] + workflow_dispatch: + inputs: + debug_enabled: + type: "boolean" + description: "Run with tmate enabled" + required: false + default: false + debug_justfile: + type: "boolean" + description: "enable to see debug statements from just recipes" + required: false + default: false + skip_vlab_tests: + type: "boolean" + description: "Skip VLAB tests (they run by default)" + required: false + default: false + run_hlab_tests: + type: "boolean" + description: "Run hybrid HLAB tests" + required: false + default: false + enable_release_tests: + type: "boolean" + description: "Enable release tests for VLAB/HLAB tests" + required: false + default: false concurrency: - group: "${{ github.workflow }}:${{ github.event.pull_request.number || github.event.after || github.event.merge_group && github.run_id }}" - cancel-in-progress: true + group: "${{ github.workflow }}:${{ github.event.pull_request.number || github.event.after || github.event.merge_group && github.run_id }}" + cancel-in-progress: true permissions: - contents: "read" - packages: "write" - id-token: "write" + contents: "read" + packages: "write" + id-token: "write" jobs: - check_changes: - name: "Deduce required tests from code changes" - permissions: - contents: "read" - pull-requests: "read" - runs-on: "ubuntu-latest" - outputs: - devfiles: "${{ steps.changes.outputs.devfiles }}" - steps: - - name: "Checkout" - if: "${{ !github.event.pull_request }}" - uses: "actions/checkout@v6" - with: - persist-credentials: "false" - fetch-depth: "0" - - name: "Check code changes" - uses: "dorny/paths-filter@v3" - id: "changes" - with: - filters: | - devfiles: - - '!(README.md|LICENSE|.gitattributes|.gitignore|.github/**)' - - '.github/workflows/dev.yml' - - version: - runs-on: lab - - permissions: - contents: read - - outputs: - version: "${{ steps.version-gen.outputs.version }}" - ref: "${{ steps.version-gen.outputs.ref }}" - - steps: - - name: Checkout repository - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Generate temp artifacts version - id: version-gen + check: env: - commit_sha: ${{ github.event.pull_request.head.sha || github.sha }} - run: | - echo "version=v0-${commit_sha::9}" >> "$GITHUB_OUTPUT" - echo "ref=${commit_sha}" >> "$GITHUB_OUTPUT" - - check: - env: - CACHE_REGISTRY: "run.h.hhdev.io:30000" - UPSTREAM_REGISTRY: "ghcr.io" - needs: - - check_changes - - version - if: "${{ needs.check_changes.outputs.devfiles == 'true' || startsWith(github.event.ref, 'refs/tags/v') && github.event_name == 'push' }}" - permissions: - checks: "write" - pull-requests: "write" - contents: "read" - packages: "write" - id-token: "write" - strategy: - fail-fast: false - matrix: - profile: - - name: "debug" - sterile: "" - - name: "debug" - sterile: "sterile" - - name: "release" - sterile: "sterile" - - name: "fuzz" - sterile: "sterile" - #- name: "release" - # sterile: "" - #- name: "fuzz" - # sterile: "" - debug_justfile: - - "${{ inputs.debug_justfile || false }}" - name: "${{matrix.profile.name}} ${{matrix.profile.sterile}}" - runs-on: "lab" - timeout-minutes: 45 - steps: - - name: "login to ghcr.io" - uses: "docker/login-action@v3" - with: - registry: "${{ env.UPSTREAM_REGISTRY }}" - username: "${{ github.actor }}" - password: "${{ secrets.GITHUB_TOKEN }}" - - - name: "login to image cache" - uses: "docker/login-action@v3" - with: - registry: "${{ env.CACHE_REGISTRY }}" - username: "${{ secrets.LAB_REGISTRY_USERNAME }}" - password: "${{ secrets.LAB_REGISTRY_TOKEN }}" - - # it's temporarily needed to install skopeo - - name: Setup Go - uses: actions/setup-go@v6 - with: - go-version: stable - cache: true - - - name: "Checkout" - uses: "actions/checkout@v6" - with: - persist-credentials: "false" - fetch-depth: "0" - - - name: "install just" - run: | - # this keeps our GH actions logs from getting messed up with color codes - echo 'deb [trusted=yes] https://apt.gabe565.com /' | sudo tee /etc/apt/sources.list.d/gabe565.list - sudo apt-get update - sudo apt-get install --yes --no-install-recommends just - - - name: "set up build environment" - run: | - REQUIRED_HUGEPAGES=512 - HUGEPAGES_PATH=/sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages - OVERCOMMIT_HUGEPAGES_PATH=/sys/kernel/mm/hugepages/hugepages-2048kB/nr_overcommit_hugepages - docker run --privileged --rm busybox:latest sh -c "echo $((6 * REQUIRED_HUGEPAGES)) > $OVERCOMMIT_HUGEPAGES_PATH" - docker run --privileged --rm busybox:latest sh -c "echo $((2 * REQUIRED_HUGEPAGES)) > $HUGEPAGES_PATH" - docker pull "${{env.UPSTREAM_REGISTRY}}/githedgehog/testn/n-vm:v0.0.9" - just --yes \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=${{matrix.profile.name}} \ - dpdp_sys_registry="${{env.CACHE_REGISTRY}}" \ - refresh-compile-env - just --yes debug_justfile="${{matrix.debug_justfile}}" fake-nix - - - name: "cargo deny check" - run: | - just \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=${{matrix.profile.name}} \ - dpdp_sys_registry="${{env.CACHE_REGISTRY}}" \ - ${{matrix.profile.sterile}} cargo deny check - - - name: "push container" - if: ${{ matrix.profile.sterile == 'sterile' && (matrix.profile.name == 'release' || matrix.profile.name == 'debug') }} - run: | - just \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=${{matrix.profile.name}} \ - dpdp_sys_registry="${{env.UPSTREAM_REGISTRY}}" \ - target=x86_64-unknown-linux-gnu \ - version=${{ needs.version.outputs.version }}-${{ matrix.profile.name }} \ - oci_repo="ghcr.io" \ - push - - - name: "print container image name" - if: ${{ matrix.profile.sterile == 'sterile' && (matrix.profile.name == 'release' || matrix.profile.name == 'debug') }} - run: | - just \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=${{matrix.profile.name}} \ - target=x86_64-unknown-linux-gnu \ - version=${{ needs.version.outputs.version }}-${{ matrix.profile.name }} \ - oci_repo="ghcr.io" \ - print-container-tags - - - name: "Check for uncommitted changes" - run: | - git diff --exit-code - if [ $? -ne 0 ]; then - echo "::error::Uncommitted changes detected:" - git diff - exit 1 - fi - echo "No uncommitted changes found" - - - name: "Check for untracked files" - run: | - if [ -n "$(git ls-files --others --exclude-standard)" ]; then - echo "::error::Untracked files detected:" - git ls-files --others --exclude-standard - exit 1 - fi - echo "No untracked files found" - - - id: "test" - name: "test" - run: | - set -euo pipefail - mkdir --parent ./target/nextest - # Run tests. The resulting results.json is not a full JSON object but - # a list of JSON objects, one per line. - if [ ${{ matrix.profile.name }} = "fuzz" ]; then - echo "::notice::Running fuzz tests" - just \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=${{matrix.profile.name}} \ - target=x86_64-unknown-linux-gnu \ - dpdp_sys_registry="${{env.CACHE_REGISTRY}}" \ - ${{matrix.profile.sterile}} coverage \ - --status-level=none \ - --final-status-level=skip \ - --message-format=libtest-json-plus > ./results.json - else - echo "::notice::Running regular tests" - just \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=${{matrix.profile.name}} \ - target=x86_64-unknown-linux-gnu \ - dpdp_sys_registry="${{env.CACHE_REGISTRY}}" \ - ${{matrix.profile.sterile}} cargo nextest run \ - --cargo-profile=${{matrix.profile.name}} \ - --status-level=none \ - --final-status-level=skip \ - --message-format=libtest-json-plus \ - > ./results.json - echo "::notice::Running Shuttle tests" - # We need to rebuild using the shuttle feature. To avoid running - # all tests a second time, we filter to run only tests with pattern - # "shuttle" in their name (test function name, file name, or module - # name). - # - # IF YOUR SHUTTLE TESTS DO NOT HAVE "shuttle" IN THEIR NAME, THEY - # WILL NOT RUN. - just \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=${{matrix.profile.name}} \ - target=x86_64-unknown-linux-gnu \ - dpdp_sys_registry="${{env.CACHE_REGISTRY}}" \ - ${{matrix.profile.sterile}} cargo nextest run \ - --cargo-profile=${{matrix.profile.name}} \ - --status-level=none \ - --final-status-level=none \ - --message-format=libtest-json-plus \ - --features shuttle \ - shuttle \ - >> ./results.json - fi - # look for any flakes (flakes have a #\\d+ match in their name field) - jq \ - --raw-output \ - --slurp '.[] | select(.type == "test" and (.name | test(".*#\\d+"))) | ( .name | split("#") ) | - [.[0], (.[1] | tonumber)] | @csv - ' ./results.json > ./target/nextest/flakes.csv - if [ -s ./target/nextest/flakes.csv ]; then - { - echo "FLAKY_TESTS<> "${GITHUB_ENV}" - fi - rm results.json - - - name: "upload test results to codecov" - if: ${{ always() }} - uses: "codecov/codecov-action@v5" - with: - fail_ci_if_error: true - files: ./target/nextest/default/junit.xml - report_type: "test_results" - disable_search: "true" - use_oidc: "true" - verbose: true - flags: "${{matrix.profile.name}}-${{ matrix.profile.sterile || 'developer' }}" - - - name: "upload codecov analysis" - if: ${{ matrix.profile.name == 'fuzz' }} - uses: "codecov/codecov-action@v5" - with: - fail_ci_if_error: true - files: ./target/nextest/coverage/codecov.json - report_type: "coverage" - disable_search: "true" - use_oidc: "true" - verbose: true - flags: "${{matrix.profile.name}}-${{ matrix.profile.sterile || 'developer' }}" - - - name: "clean up coverage data" - run: | - rm -f codecov codecov.SHA256SUM codecov.SHA256SUM.sig - - - uses: "marocchino/sticky-pull-request-comment@v2" - if: ${{ always() }} - with: - header: "flakes_${{matrix.profile.name}}_${{matrix.profile.sterile}}" - ignore_empty: "true" - message: | - ${{ env.FLAKY_TESTS }} - - - name: "publish test report" - uses: "mikepenz/action-junit-report@v6" - if: "${{ always() }}" - with: - annotate_notice: "false" - annotate_only: "false" - check_annotations: "true" - check_retries: "false" - comment: "false" - detailed_summary: "true" - fail_on_failure: "false" - fail_on_parse_error: "true" - flaky_summary: "true" - include_empty_in_summary: "true" - include_passed: "true" - include_time_in_summary: "true" - report_paths: "target/nextest/default/*junit.xml" - require_passed_tests: "true" - require_tests: "true" - simplified_summary: "true" - truncate_stack_traces: "false" - group_reports: "true" - check_name: "test-report-${{matrix.profile.name}}-sterile:${{matrix.profile.sterile == 'sterile'}}" - skip_success_summary: "false" - job_summary: "true" - verbose_summary: "false" - - - id: "clippy" - name: "run clippy" - run: | - just debug_justfile="${{matrix.debug_justfile}}" profile=${{matrix.profile.name}} \ - ${{matrix.profile.sterile}} cargo clippy --all-targets --all-features -- -D warnings - - - id: "docs" - name: "run rustdoc" - run: | - RUSTDOCFLAGS="-D warnings" just \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=${{matrix.profile.name}} \ - target=x86_64-unknown-linux-gnu \ - ${{matrix.profile.sterile}} cargo doc --no-deps - - - name: "run doctests" - run: | - just \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=${{matrix.profile.name}} \ - target=x86_64-unknown-linux-gnu \ - ${{matrix.profile.sterile}} cargo test --doc - - - name: "Setup tmate session for debug" - if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} - uses: "mxschmitt/action-tmate@v3" - timeout-minutes: 60 - with: - limit-access-to-actor: true - - vlab: - if: "${{ needs.check_changes.outputs.devfiles == 'true' || startsWith(github.event.ref, 'refs/tags/v') && github.event_name == 'push' }}" - needs: - - check - - version - - name: "${{ matrix.hybrid && 'h' || 'v' }}-${{ matrix.upgradefrom && 'up' || '' }}${{ matrix.upgradefrom }}${{ matrix.upgradefrom && '-' || '' }}${{ matrix.mesh && 'mesh-' || '' }}${{ matrix.gateway && 'gw-' || '' }}${{ matrix.includeonie && 'onie-' || '' }}${{ matrix.buildmode }}-${{ matrix.vpcmode }}" - - uses: githedgehog/fabricator/.github/workflows/run-vlab.yaml@master - with: - # ci:+hlab is required to enable hybrid lab tests on PR - # ci:-vlab disables virtual lab tests on PR - # ci:-upgrade disables upgrade tests on PR - # hlab is disabled for main and merge_queue till we have gateway tests for it - # upgrade jobs are temporarily skipped in merge_queue until we fix the issue with 25.05 - skip: >- - ${{ - github.event_name == 'pull_request' - && ( - matrix.hybrid && !contains(github.event.pull_request.labels.*.name, 'ci:+hlab') - || !matrix.hybrid && contains(github.event.pull_request.labels.*.name, 'ci:-vlab') - || matrix.upgradefrom != '' && contains(github.event.pull_request.labels.*.name, 'ci:-upgrade') - ) - - || github.event_name == 'workflow_dispatch' - && ( - matrix.hybrid && inputs.run_hlab_tests != true - || !matrix.hybrid && inputs.skip_vlab_tests == true - ) - - || (github.event_name == 'push' || github.event_name == 'merge_group') - && (matrix.hybrid || matrix.upgradefrom != '') - }} - fabricatorref: master - prebuild: "just bump dataplane ${{ needs.version.outputs.version }}-release" - fabricmode: ${{ matrix.fabricmode }} - gateway: ${{ matrix.gateway }} - gateway_agentless: true - includeonie: ${{ matrix.includeonie }} - buildmode: ${{ matrix.buildmode }} - vpcmode: ${{ matrix.vpcmode }} - releasetest: ${{ contains(github.event.pull_request.labels.*.name, 'ci:+release') || inputs.enable_release_tests == true }} - hybrid: ${{ matrix.hybrid }} - upgradefrom: ${{ matrix.upgradefrom }} - - strategy: - fail-fast: false - matrix: - fabricmode: - - spine-leaf - gateway: - - true - includeonie: - - false - buildmode: - - iso - vpcmode: - - l2vni - hybrid: - - false - upgradefrom: - - "" - - "25.05" - include: - # gateway l3vni - - fabricmode: spine-leaf - gateway: true - includeonie: false - buildmode: iso - vpcmode: l3vni - hybrid: false - upgradefrom: "" - - # hlab gateway l2vni - - fabricmode: spine-leaf - gateway: true - includeonie: false - buildmode: iso - vpcmode: l2vni - hybrid: true - upgradefrom: "" - - summary: - name: "Summary" - runs-on: "ubuntu-latest" - needs: - - check - - vlab - # Run always, except when the "check" job was skipped. - # - # When the check job is skipped, summary will be marked as skipped, and - # it's OK for CI (it's not a failure). - # Why don't we do the same for check jobs? Because their names depend on - # matrix values, and if we skip them the names won't be generated and - # GitHub won't be able to find skipped jobs for required status checks. - if: ${{ always() }} - steps: - - name: "Flag any check matrix failures" - if: ${{ needs.check.result != 'success' && needs.check.result != 'skipped' }} - run: | - echo '::error:: Some check job(s) failed' - exit 1 - - name: "Flag any vlab matrix failures" - if: ${{ needs.vlab.result != 'success' && needs.vlab.result != 'skipped' }} - run: | - echo '::error:: Some vlab job(s) failed' - exit 1 - - publish: - env: - CACHE_REGISTRY: "run.h.hhdev.io:30000" - UPSTREAM_REGISTRY: "ghcr.io" - runs-on: lab - if: startsWith(github.event.ref, 'refs/tags/v') && github.event_name == 'push' - needs: - - check - - vlab - - permissions: - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Setup Go - uses: actions/setup-go@v6 - with: - go-version: stable - cache: true - - - name: Login to ghcr.io - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: "login to image cache" - uses: "docker/login-action@v3" - with: - registry: "${{ env.CACHE_REGISTRY }}" - username: "${{ secrets.LAB_REGISTRY_USERNAME }}" - password: "${{ secrets.LAB_REGISTRY_TOKEN }}" - - - name: "set up build environment" - run: | - REQUIRED_HUGEPAGES=512 - HUGEPAGES_PATH=/sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages - OVERCOMMIT_HUGEPAGES_PATH=/sys/kernel/mm/hugepages/hugepages-2048kB/nr_overcommit_hugepages - docker run --privileged --rm busybox:latest sh -c "echo $((6 * REQUIRED_HUGEPAGES)) > $OVERCOMMIT_HUGEPAGES_PATH" - docker run --privileged --rm busybox:latest sh -c "echo $((2 * REQUIRED_HUGEPAGES)) > $HUGEPAGES_PATH" - docker pull "${{env.UPSTREAM_REGISTRY}}/githedgehog/testn/n-vm:v0.0.9" - just --yes \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=${{matrix.profile.name}} \ - dpdp_sys_registry="${{env.CACHE_REGISTRY}}" \ - refresh-compile-env - just --yes debug_justfile="${{matrix.debug_justfile}}" fake-nix - - - name: "push container" - run: | - just \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=release \ - dpdp_sys_registry="${{env.UPSTREAM_REGISTRY}}" \ - target=x86_64-unknown-linux-gnu \ - oci_repo="ghcr.io" \ - push - - # Bump dataplane in the fabricator repository - - - name: Checkout fabricator repository - uses: actions/checkout@v6 - with: - repository: githedgehog/fabricator - path: fab-repo - persist-credentials: false - - - name: Bump dataplane in fabricator - working-directory: fab-repo - run: | - sed -i "s/^\tDataplaneVersion.*/\tDataplaneVersion=meta.Version(\"${{ github.ref_name }}\")/" pkg/fab/versions.go - go fmt pkg/fab/versions.go - - - name: Generate token for the fabricator repository - uses: actions/create-github-app-token@v2 - id: fab-app-token - with: - app-id: ${{ secrets.FAB_APP_ID }} - private-key: ${{ secrets.FAB_PRIVATE_KEY }} - repositories: | - fabricator - - - name: Create Pull Request for fabricator - uses: peter-evans/create-pull-request@v8 - id: fab-pr - with: - token: ${{ steps.fab-app-token.outputs.token }} - path: fab-repo - branch: pr/auto/dataplane-bump - commit-message: | - bump: dataplane to ${{ github.ref_name }} - - This is an automated commit created by GitHub Actions workflow, - in the dataplane repository. - signoff: true - title: "bump: dataplane to ${{ github.ref_name }}" - body: | - This is an automated Pull Request created by GitHub Actions workflow, - in the dataplane repository. + CACHE_REGISTRY: "run.h.hhdev.io:30000" + UPSTREAM_REGISTRY: "ghcr.io" + needs: + - check_changes + - version + if: "${{ needs.check_changes.outputs.devfiles == 'true' || startsWith(github.event.ref, 'refs/tags/v') && github.event_name == 'push' }}" + permissions: + checks: "write" + pull-requests: "write" + contents: "read" + packages: "write" + id-token: "write" + strategy: + fail-fast: false + matrix: + profile: + - name: "debug" + sterile: "" + - name: "debug" + sterile: "sterile" + - name: "release" + sterile: "sterile" + - name: "fuzz" + sterile: "sterile" + #- name: "release" + # sterile: "" + #- name: "fuzz" + # sterile: "" + debug_justfile: + - "${{ inputs.debug_justfile || false }}" + name: "${{matrix.profile.name}} ${{matrix.profile.sterile}}" + runs-on: "lab" + timeout-minutes: 120 + steps: + - name: "install nix" + uses: "cachix/install-nix-action@v31" + with: + nix_path: nixpkgs=channel:nixpkgs-unstable + + - name: "login to ghcr.io" + uses: "docker/login-action@v3" + with: + registry: "${{ env.UPSTREAM_REGISTRY }}" + username: "${{ github.actor }}" + password: "${{ secrets.GITHUB_TOKEN }}" + + - name: "login to image cache" + uses: "docker/login-action@v3" + with: + registry: "${{ env.CACHE_REGISTRY }}" + username: "${{ secrets.LAB_REGISTRY_USERNAME }}" + password: "${{ secrets.LAB_REGISTRY_TOKEN }}" + + - name: "Checkout" + uses: "actions/checkout@v6" + with: + persist-credentials: "false" + fetch-depth: "0" + + - name: "build sysroot/devroot" + run: | + nix build -f default.nix sysroot --show-trace --max-jobs 8 --out-link sysroot + nix build -f default.nix devroot --show-trace --max-jobs 8 --out-link devroot + + - name: "cargo build / nextest" + run: | + export PATH="$(pwd)/devroot/bin:$PATH" + cargo build + cargo nextest run + + - id: "clippy" + name: "run clippy" + run: | + cargo clippy --all-targets --all-features -- -D warnings + + - id: "docs" + name: "run rustdoc" + run: | + RUSTDOCFLAGS="-D warnings" cargo doc --no-deps + + - name: "run doctests" + run: | + cargo test --doc + + - name: "Setup tmate session for debug" + # if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} + if: always + uses: "mxschmitt/action-tmate@v3" + timeout-minutes: 120 + with: + limit-access-to-actor: true From 35aa8091ce7da639bcbb26f9a35a88cd9a08b5df Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sat, 27 Dec 2025 18:49:22 +0000 Subject: [PATCH 111/163] hack2 --- .github/workflows/dev.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 299799991..20f8ac82d 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -3,6 +3,7 @@ name: "dev.yml" on: pull_request: {} push: + branches: - "main" tags: From 7183e6835940cb94373995d3e7b2ddf3b9aad07e Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sat, 27 Dec 2025 18:50:47 +0000 Subject: [PATCH 112/163] big hack --- .github/workflows/dev.back.yml | 609 --------------------------------- 1 file changed, 609 deletions(-) delete mode 100644 .github/workflows/dev.back.yml diff --git a/.github/workflows/dev.back.yml b/.github/workflows/dev.back.yml deleted file mode 100644 index bfee38917..000000000 --- a/.github/workflows/dev.back.yml +++ /dev/null @@ -1,609 +0,0 @@ -name: "dev.yml" - -on: - pull_request: {} - push: - branches: - - "main" - tags: - - "v*" - merge_group: - types: ["checks_requested"] - workflow_dispatch: - inputs: - debug_enabled: - type: "boolean" - description: "Run with tmate enabled" - required: false - default: false - debug_justfile: - type: "boolean" - description: "enable to see debug statements from just recipes" - required: false - default: false - skip_vlab_tests: - type: "boolean" - description: "Skip VLAB tests (they run by default)" - required: false - default: false - run_hlab_tests: - type: "boolean" - description: "Run hybrid HLAB tests" - required: false - default: false - enable_release_tests: - type: "boolean" - description: "Enable release tests for VLAB/HLAB tests" - required: false - default: false - -concurrency: - group: "${{ github.workflow }}:${{ github.event.pull_request.number || github.event.after || github.event.merge_group && github.run_id }}" - cancel-in-progress: true - -permissions: - contents: "read" - packages: "write" - id-token: "write" - -jobs: - check_changes: - name: "Deduce required tests from code changes" - permissions: - contents: "read" - pull-requests: "read" - runs-on: "ubuntu-latest" - outputs: - devfiles: "${{ steps.changes.outputs.devfiles }}" - steps: - - name: "Checkout" - if: "${{ !github.event.pull_request }}" - uses: "actions/checkout@v6" - with: - persist-credentials: "false" - fetch-depth: "0" - - name: "Check code changes" - uses: "dorny/paths-filter@v3" - id: "changes" - with: - filters: | - devfiles: - - '!(README.md|LICENSE|.gitattributes|.gitignore|.github/**)' - - '.github/workflows/dev.yml' - - version: - runs-on: lab - - permissions: - contents: read - - outputs: - version: "${{ steps.version-gen.outputs.version }}" - ref: "${{ steps.version-gen.outputs.ref }}" - - steps: - - name: Checkout repository - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Generate temp artifacts version - id: version-gen - env: - commit_sha: ${{ github.event.pull_request.head.sha || github.sha }} - run: | - echo "version=v0-${commit_sha::9}" >> "$GITHUB_OUTPUT" - echo "ref=${commit_sha}" >> "$GITHUB_OUTPUT" - - check: - env: - CACHE_REGISTRY: "run.h.hhdev.io:30000" - UPSTREAM_REGISTRY: "ghcr.io" - needs: - - check_changes - - version - if: "${{ needs.check_changes.outputs.devfiles == 'true' || startsWith(github.event.ref, 'refs/tags/v') && github.event_name == 'push' }}" - permissions: - checks: "write" - pull-requests: "write" - contents: "read" - packages: "write" - id-token: "write" - strategy: - fail-fast: false - matrix: - profile: - - name: "debug" - sterile: "" - - name: "debug" - sterile: "sterile" - - name: "release" - sterile: "sterile" - - name: "fuzz" - sterile: "sterile" - #- name: "release" - # sterile: "" - #- name: "fuzz" - # sterile: "" - debug_justfile: - - "${{ inputs.debug_justfile || false }}" - name: "${{matrix.profile.name}} ${{matrix.profile.sterile}}" - runs-on: "lab" - timeout-minutes: 45 - steps: - - name: "login to ghcr.io" - uses: "docker/login-action@v3" - with: - registry: "${{ env.UPSTREAM_REGISTRY }}" - username: "${{ github.actor }}" - password: "${{ secrets.GITHUB_TOKEN }}" - - - name: "login to image cache" - uses: "docker/login-action@v3" - with: - registry: "${{ env.CACHE_REGISTRY }}" - username: "${{ secrets.LAB_REGISTRY_USERNAME }}" - password: "${{ secrets.LAB_REGISTRY_TOKEN }}" - - # it's temporarily needed to install skopeo - - name: Setup Go - uses: actions/setup-go@v6 - with: - go-version: stable - cache: true - - - name: "Checkout" - uses: "actions/checkout@v6" - with: - persist-credentials: "false" - fetch-depth: "0" - - - name: "install just" - run: | - # this keeps our GH actions logs from getting messed up with color codes - echo 'deb [trusted=yes] https://apt.gabe565.com /' | sudo tee /etc/apt/sources.list.d/gabe565.list - sudo apt-get update - sudo apt-get install --yes --no-install-recommends just - - - name: "set up build environment" - run: | - REQUIRED_HUGEPAGES=512 - HUGEPAGES_PATH=/sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages - OVERCOMMIT_HUGEPAGES_PATH=/sys/kernel/mm/hugepages/hugepages-2048kB/nr_overcommit_hugepages - docker run --privileged --rm busybox:latest sh -c "echo $((6 * REQUIRED_HUGEPAGES)) > $OVERCOMMIT_HUGEPAGES_PATH" - docker run --privileged --rm busybox:latest sh -c "echo $((2 * REQUIRED_HUGEPAGES)) > $HUGEPAGES_PATH" - docker pull "${{env.UPSTREAM_REGISTRY}}/githedgehog/testn/n-vm:v0.0.9" - just --yes \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=${{matrix.profile.name}} \ - dpdp_sys_registry="${{env.CACHE_REGISTRY}}" \ - refresh-compile-env - just --yes debug_justfile="${{matrix.debug_justfile}}" fake-nix - - - name: "cargo deny check" - run: | - just \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=${{matrix.profile.name}} \ - dpdp_sys_registry="${{env.CACHE_REGISTRY}}" \ - ${{matrix.profile.sterile}} cargo deny check - - - name: "push container" - if: ${{ matrix.profile.sterile == 'sterile' && (matrix.profile.name == 'release' || matrix.profile.name == 'debug') }} - run: | - just \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=${{matrix.profile.name}} \ - dpdp_sys_registry="${{env.UPSTREAM_REGISTRY}}" \ - target=x86_64-unknown-linux-gnu \ - version=${{ needs.version.outputs.version }}-${{ matrix.profile.name }} \ - oci_repo="ghcr.io" \ - push - - - name: "print container image name" - if: ${{ matrix.profile.sterile == 'sterile' && (matrix.profile.name == 'release' || matrix.profile.name == 'debug') }} - run: | - just \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=${{matrix.profile.name}} \ - target=x86_64-unknown-linux-gnu \ - version=${{ needs.version.outputs.version }}-${{ matrix.profile.name }} \ - oci_repo="ghcr.io" \ - print-container-tags - - - name: "Check for uncommitted changes" - run: | - git diff --exit-code - if [ $? -ne 0 ]; then - echo "::error::Uncommitted changes detected:" - git diff - exit 1 - fi - echo "No uncommitted changes found" - - - name: "Check for untracked files" - run: | - if [ -n "$(git ls-files --others --exclude-standard)" ]; then - echo "::error::Untracked files detected:" - git ls-files --others --exclude-standard - exit 1 - fi - echo "No untracked files found" - - - id: "test" - name: "test" - run: | - set -euo pipefail - mkdir --parent ./target/nextest - # Run tests. The resulting results.json is not a full JSON object but - # a list of JSON objects, one per line. - if [ ${{ matrix.profile.name }} = "fuzz" ]; then - echo "::notice::Running fuzz tests" - just \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=${{matrix.profile.name}} \ - target=x86_64-unknown-linux-gnu \ - dpdp_sys_registry="${{env.CACHE_REGISTRY}}" \ - ${{matrix.profile.sterile}} coverage \ - --status-level=none \ - --final-status-level=skip \ - --message-format=libtest-json-plus > ./results.json - else - echo "::notice::Running regular tests" - just \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=${{matrix.profile.name}} \ - target=x86_64-unknown-linux-gnu \ - dpdp_sys_registry="${{env.CACHE_REGISTRY}}" \ - ${{matrix.profile.sterile}} cargo nextest run \ - --cargo-profile=${{matrix.profile.name}} \ - --status-level=none \ - --final-status-level=skip \ - --message-format=libtest-json-plus \ - > ./results.json - echo "::notice::Running Shuttle tests" - # We need to rebuild using the shuttle feature. To avoid running - # all tests a second time, we filter to run only tests with pattern - # "shuttle" in their name (test function name, file name, or module - # name). - # - # IF YOUR SHUTTLE TESTS DO NOT HAVE "shuttle" IN THEIR NAME, THEY - # WILL NOT RUN. - just \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=${{matrix.profile.name}} \ - target=x86_64-unknown-linux-gnu \ - dpdp_sys_registry="${{env.CACHE_REGISTRY}}" \ - ${{matrix.profile.sterile}} cargo nextest run \ - --cargo-profile=${{matrix.profile.name}} \ - --status-level=none \ - --final-status-level=none \ - --message-format=libtest-json-plus \ - --features shuttle \ - shuttle \ - >> ./results.json - fi - # look for any flakes (flakes have a #\\d+ match in their name field) - jq \ - --raw-output \ - --slurp '.[] | select(.type == "test" and (.name | test(".*#\\d+"))) | ( .name | split("#") ) | - [.[0], (.[1] | tonumber)] | @csv - ' ./results.json > ./target/nextest/flakes.csv - if [ -s ./target/nextest/flakes.csv ]; then - { - echo "FLAKY_TESTS<> "${GITHUB_ENV}" - fi - rm results.json - - - name: "upload test results to codecov" - if: ${{ always() }} - uses: "codecov/codecov-action@v5" - with: - fail_ci_if_error: true - files: ./target/nextest/default/junit.xml - report_type: "test_results" - disable_search: "true" - use_oidc: "true" - verbose: true - flags: "${{matrix.profile.name}}-${{ matrix.profile.sterile || 'developer' }}" - - - name: "upload codecov analysis" - if: ${{ matrix.profile.name == 'fuzz' }} - uses: "codecov/codecov-action@v5" - with: - fail_ci_if_error: true - files: ./target/nextest/coverage/codecov.json - report_type: "coverage" - disable_search: "true" - use_oidc: "true" - verbose: true - flags: "${{matrix.profile.name}}-${{ matrix.profile.sterile || 'developer' }}" - - - name: "clean up coverage data" - run: | - rm -f codecov codecov.SHA256SUM codecov.SHA256SUM.sig - - - uses: "marocchino/sticky-pull-request-comment@v2" - if: ${{ always() }} - with: - header: "flakes_${{matrix.profile.name}}_${{matrix.profile.sterile}}" - ignore_empty: "true" - message: | - ${{ env.FLAKY_TESTS }} - - - name: "publish test report" - uses: "mikepenz/action-junit-report@v6" - if: "${{ always() }}" - with: - annotate_notice: "false" - annotate_only: "false" - check_annotations: "true" - check_retries: "false" - comment: "false" - detailed_summary: "true" - fail_on_failure: "false" - fail_on_parse_error: "true" - flaky_summary: "true" - include_empty_in_summary: "true" - include_passed: "true" - include_time_in_summary: "true" - report_paths: "target/nextest/default/*junit.xml" - require_passed_tests: "true" - require_tests: "true" - simplified_summary: "true" - truncate_stack_traces: "false" - group_reports: "true" - check_name: "test-report-${{matrix.profile.name}}-sterile:${{matrix.profile.sterile == 'sterile'}}" - skip_success_summary: "false" - job_summary: "true" - verbose_summary: "false" - - - id: "clippy" - name: "run clippy" - run: | - just debug_justfile="${{matrix.debug_justfile}}" profile=${{matrix.profile.name}} \ - ${{matrix.profile.sterile}} cargo clippy --all-targets --all-features -- -D warnings - - - id: "docs" - name: "run rustdoc" - run: | - RUSTDOCFLAGS="-D warnings" just \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=${{matrix.profile.name}} \ - target=x86_64-unknown-linux-gnu \ - ${{matrix.profile.sterile}} cargo doc --no-deps - - - name: "run doctests" - run: | - just \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=${{matrix.profile.name}} \ - target=x86_64-unknown-linux-gnu \ - ${{matrix.profile.sterile}} cargo test --doc - - - name: "Setup tmate session for debug" - if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} - uses: "mxschmitt/action-tmate@v3" - timeout-minutes: 60 - with: - limit-access-to-actor: true - - vlab: - if: "${{ needs.check_changes.outputs.devfiles == 'true' || startsWith(github.event.ref, 'refs/tags/v') && github.event_name == 'push' }}" - needs: - - check - - version - - name: "${{ matrix.hybrid && 'h' || 'v' }}-${{ matrix.upgradefrom && 'up' || '' }}${{ matrix.upgradefrom }}${{ matrix.upgradefrom && '-' || '' }}${{ matrix.mesh && 'mesh-' || '' }}${{ matrix.gateway && 'gw-' || '' }}${{ matrix.includeonie && 'onie-' || '' }}${{ matrix.buildmode }}-${{ matrix.vpcmode }}" - - uses: githedgehog/fabricator/.github/workflows/run-vlab.yaml@master - with: - # ci:+hlab is required to enable hybrid lab tests on PR - # ci:-vlab disables virtual lab tests on PR - # ci:-upgrade disables upgrade tests on PR - # hlab is disabled for main and merge_queue till we have gateway tests for it - # upgrade jobs are temporarily skipped in merge_queue until we fix the issue with 25.05 - skip: >- - ${{ - github.event_name == 'pull_request' - && ( - matrix.hybrid && !contains(github.event.pull_request.labels.*.name, 'ci:+hlab') - || !matrix.hybrid && contains(github.event.pull_request.labels.*.name, 'ci:-vlab') - || matrix.upgradefrom != '' && contains(github.event.pull_request.labels.*.name, 'ci:-upgrade') - ) - - || github.event_name == 'workflow_dispatch' - && ( - matrix.hybrid && inputs.run_hlab_tests != true - || !matrix.hybrid && inputs.skip_vlab_tests == true - ) - - || (github.event_name == 'push' || github.event_name == 'merge_group') - && (matrix.hybrid || matrix.upgradefrom != '') - }} - fabricatorref: master - prebuild: "just bump dataplane ${{ needs.version.outputs.version }}-release" - fabricmode: ${{ matrix.fabricmode }} - gateway: ${{ matrix.gateway }} - gateway_agentless: true - includeonie: ${{ matrix.includeonie }} - buildmode: ${{ matrix.buildmode }} - vpcmode: ${{ matrix.vpcmode }} - releasetest: ${{ contains(github.event.pull_request.labels.*.name, 'ci:+release') || inputs.enable_release_tests == true }} - hybrid: ${{ matrix.hybrid }} - upgradefrom: ${{ matrix.upgradefrom }} - - strategy: - fail-fast: false - matrix: - fabricmode: - - spine-leaf - gateway: - - true - includeonie: - - false - buildmode: - - iso - vpcmode: - - l2vni - hybrid: - - false - upgradefrom: - - "" - - "25.05" - include: - # gateway l3vni - - fabricmode: spine-leaf - gateway: true - includeonie: false - buildmode: iso - vpcmode: l3vni - hybrid: false - upgradefrom: "" - - # hlab gateway l2vni - - fabricmode: spine-leaf - gateway: true - includeonie: false - buildmode: iso - vpcmode: l2vni - hybrid: true - upgradefrom: "" - - summary: - name: "Summary" - runs-on: "ubuntu-latest" - needs: - - check - - vlab - # Run always, except when the "check" job was skipped. - # - # When the check job is skipped, summary will be marked as skipped, and - # it's OK for CI (it's not a failure). - # Why don't we do the same for check jobs? Because their names depend on - # matrix values, and if we skip them the names won't be generated and - # GitHub won't be able to find skipped jobs for required status checks. - if: ${{ always() }} - steps: - - name: "Flag any check matrix failures" - if: ${{ needs.check.result != 'success' && needs.check.result != 'skipped' }} - run: | - echo '::error:: Some check job(s) failed' - exit 1 - - name: "Flag any vlab matrix failures" - if: ${{ needs.vlab.result != 'success' && needs.vlab.result != 'skipped' }} - run: | - echo '::error:: Some vlab job(s) failed' - exit 1 - - publish: - env: - CACHE_REGISTRY: "run.h.hhdev.io:30000" - UPSTREAM_REGISTRY: "ghcr.io" - runs-on: lab - if: startsWith(github.event.ref, 'refs/tags/v') && github.event_name == 'push' - needs: - - check - - vlab - - permissions: - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Setup Go - uses: actions/setup-go@v6 - with: - go-version: stable - cache: true - - - name: Login to ghcr.io - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: "login to image cache" - uses: "docker/login-action@v3" - with: - registry: "${{ env.CACHE_REGISTRY }}" - username: "${{ secrets.LAB_REGISTRY_USERNAME }}" - password: "${{ secrets.LAB_REGISTRY_TOKEN }}" - - - name: "set up build environment" - run: | - REQUIRED_HUGEPAGES=512 - HUGEPAGES_PATH=/sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages - OVERCOMMIT_HUGEPAGES_PATH=/sys/kernel/mm/hugepages/hugepages-2048kB/nr_overcommit_hugepages - docker run --privileged --rm busybox:latest sh -c "echo $((6 * REQUIRED_HUGEPAGES)) > $OVERCOMMIT_HUGEPAGES_PATH" - docker run --privileged --rm busybox:latest sh -c "echo $((2 * REQUIRED_HUGEPAGES)) > $HUGEPAGES_PATH" - docker pull "${{env.UPSTREAM_REGISTRY}}/githedgehog/testn/n-vm:v0.0.9" - just --yes \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=${{matrix.profile.name}} \ - dpdp_sys_registry="${{env.CACHE_REGISTRY}}" \ - refresh-compile-env - just --yes debug_justfile="${{matrix.debug_justfile}}" fake-nix - - - name: "push container" - run: | - just \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=release \ - dpdp_sys_registry="${{env.UPSTREAM_REGISTRY}}" \ - target=x86_64-unknown-linux-gnu \ - oci_repo="ghcr.io" \ - push - - # Bump dataplane in the fabricator repository - - - name: Checkout fabricator repository - uses: actions/checkout@v6 - with: - repository: githedgehog/fabricator - path: fab-repo - persist-credentials: false - - - name: Bump dataplane in fabricator - working-directory: fab-repo - run: | - sed -i "s/^\tDataplaneVersion.*/\tDataplaneVersion=meta.Version(\"${{ github.ref_name }}\")/" pkg/fab/versions.go - go fmt pkg/fab/versions.go - - - name: Generate token for the fabricator repository - uses: actions/create-github-app-token@v2 - id: fab-app-token - with: - app-id: ${{ secrets.FAB_APP_ID }} - private-key: ${{ secrets.FAB_PRIVATE_KEY }} - repositories: | - fabricator - - - name: Create Pull Request for fabricator - uses: peter-evans/create-pull-request@v8 - id: fab-pr - with: - token: ${{ steps.fab-app-token.outputs.token }} - path: fab-repo - branch: pr/auto/dataplane-bump - commit-message: | - bump: dataplane to ${{ github.ref_name }} - - This is an automated commit created by GitHub Actions workflow, - in the dataplane repository. - signoff: true - title: "bump: dataplane to ${{ github.ref_name }}" - body: | - This is an automated Pull Request created by GitHub Actions workflow, - in the dataplane repository. From c7a5ff663703f898da55b305f5b8b0ea86842dd4 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sat, 27 Dec 2025 18:54:51 +0000 Subject: [PATCH 113/163] Update dev.yml --- .github/workflows/dev.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 20f8ac82d..d3e3874a0 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -3,7 +3,6 @@ name: "dev.yml" on: pull_request: {} push: - branches: - "main" tags: @@ -55,7 +54,6 @@ jobs: needs: - check_changes - version - if: "${{ needs.check_changes.outputs.devfiles == 'true' || startsWith(github.event.ref, 'refs/tags/v') && github.event_name == 'push' }}" permissions: checks: "write" pull-requests: "write" From 7977554ab4de5c0c98e52dea9cb7658986dd5b72 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sat, 27 Dec 2025 18:56:15 +0000 Subject: [PATCH 114/163] Update dev.yml --- .github/workflows/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index d3e3874a0..d860fa839 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -1,4 +1,4 @@ -name: "dev.yml" +name: "scratch" on: pull_request: {} From d8e9d88ce60c2ef482b0e6eba41148da93f940b4 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sat, 27 Dec 2025 18:56:57 +0000 Subject: [PATCH 115/163] wip --- .github/workflows/dev.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index d860fa839..a627d8e17 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -134,7 +134,6 @@ jobs: - name: "Setup tmate session for debug" # if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} - if: always uses: "mxschmitt/action-tmate@v3" timeout-minutes: 120 with: From 344d154fd9900ad181d69b805d40f03647e9af1b Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sat, 27 Dec 2025 18:59:12 +0000 Subject: [PATCH 116/163] fix --- .github/workflows/dev.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index a627d8e17..8a30d7cbf 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -51,9 +51,6 @@ jobs: env: CACHE_REGISTRY: "run.h.hhdev.io:30000" UPSTREAM_REGISTRY: "ghcr.io" - needs: - - check_changes - - version permissions: checks: "write" pull-requests: "write" From 4c009ecb77f5974e14c68ce6b5229b8f5e6f5b5c Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sat, 27 Dec 2025 19:00:42 +0000 Subject: [PATCH 117/163] frustration --- .github/workflows/{dev.yml => scratch.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{dev.yml => scratch.yml} (99%) diff --git a/.github/workflows/dev.yml b/.github/workflows/scratch.yml similarity index 99% rename from .github/workflows/dev.yml rename to .github/workflows/scratch.yml index 8a30d7cbf..c47bce502 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/scratch.yml @@ -1,4 +1,4 @@ -name: "scratch" +name: "scratch.yml" on: pull_request: {} From e3393dd0e436c35bb82c040be980dc0daf24708c Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sat, 27 Dec 2025 19:09:59 +0000 Subject: [PATCH 118/163] better yet --- .github/workflows/scratch.yml | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/.github/workflows/scratch.yml b/.github/workflows/scratch.yml index c47bce502..7d7c30597 100644 --- a/.github/workflows/scratch.yml +++ b/.github/workflows/scratch.yml @@ -61,21 +61,11 @@ jobs: fail-fast: false matrix: profile: - - name: "debug" - sterile: "" - - name: "debug" - sterile: "sterile" - - name: "release" - sterile: "sterile" - - name: "fuzz" - sterile: "sterile" - #- name: "release" - # sterile: "" - #- name: "fuzz" - # sterile: "" + - "debug" + - "release" debug_justfile: - "${{ inputs.debug_justfile || false }}" - name: "${{matrix.profile.name}} ${{matrix.profile.sterile}}" + name: "${{matrix.profile}}" runs-on: "lab" timeout-minutes: 120 steps: @@ -104,10 +94,19 @@ jobs: persist-credentials: "false" fetch-depth: "0" - - name: "build sysroot/devroot" + - name: "devroot" run: | - nix build -f default.nix sysroot --show-trace --max-jobs 8 --out-link sysroot - nix build -f default.nix devroot --show-trace --max-jobs 8 --out-link devroot + nix build -f default.nix --argstr profile ${{matrix.profile}} devroot --show-trace --max-jobs 3 --out-link devroot + + - name: "sysroot" + run: | + nix build -f default.nix --argstr profile ${{matrix.profile}} sysroot --show-trace --max-jobs 3 --out-link sysroot + + - name: "bins" + run: | + nix build -f default.nix --argstr profile ${{matrix.profile}} --show-trace --max-jobs 3 packages.dataplane --out-link output.dataplane + nix build -f default.nix --argstr profile ${{matrix.profile}} --show-trace --max-jobs 3 packages.cli --out-link output.cli + nix build -f default.nix --argstr profile ${{matrix.profile}} --show-trace --max-jobs 3 packages.init --out-link output.init - name: "cargo build / nextest" run: | From 283924247bae988848a47380e25d95417cfb261a Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 28 Dec 2025 02:27:58 +0000 Subject: [PATCH 119/163] cachix test 0 --- .cargo/aarch64.musl.toml | 6 ------ .cargo/x86_64.gnu.toml | 2 +- .github/workflows/scratch.yml | 26 ++++++++++++++++---------- default.nix | 11 +++-------- 4 files changed, 20 insertions(+), 25 deletions(-) diff --git a/.cargo/aarch64.musl.toml b/.cargo/aarch64.musl.toml index 1740b1f31..977e8fd8e 100644 --- a/.cargo/aarch64.musl.toml +++ b/.cargo/aarch64.musl.toml @@ -1,8 +1,2 @@ [env] CC = { value = "devroot/bin/aarch64-unknown-linux-musl-clang", relative = true, force = false } - -[target.aarch64-unknown-linux-musl] -rustflags = [ - "-Copt-level=3", -] - diff --git a/.cargo/x86_64.gnu.toml b/.cargo/x86_64.gnu.toml index 8a7c82b48..753bd2de5 100644 --- a/.cargo/x86_64.gnu.toml +++ b/.cargo/x86_64.gnu.toml @@ -2,4 +2,4 @@ CC = { value = "devroot/bin/x86_64-unknown-linux-gnu-clang", relative = true, force = false } [target.x86_64-unknown-linux-gnu] -rustflags = ["--cfg=tokio_unstable", "-Clinker=x86_64-unknown-linux-gnu-clang", "-Clink-arg=-fuse-ld=lld"] +rustflags = ["--cfg=tokio_unstable", "-Clinker=x86_64-unknown-linux-gnu-clang"] diff --git a/.github/workflows/scratch.yml b/.github/workflows/scratch.yml index 7d7c30597..fa48cf927 100644 --- a/.github/workflows/scratch.yml +++ b/.github/workflows/scratch.yml @@ -94,25 +94,31 @@ jobs: persist-credentials: "false" fetch-depth: "0" + - name: "log into cachix" + uses: cachix/cachix-action@v14 + with: + name: dnoland-githedgehog-cache-2 + signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}" + - name: "devroot" run: | - nix build -f default.nix --argstr profile ${{matrix.profile}} devroot --show-trace --max-jobs 3 --out-link devroot + nix-build --argstr profile ${{matrix.profile}} --show-trace --max-jobs 3 -A devroot | cachix push -m zstd dnoland-githedgehog-cache-2 - name: "sysroot" run: | - nix build -f default.nix --argstr profile ${{matrix.profile}} sysroot --show-trace --max-jobs 3 --out-link sysroot + nix-build --argstr profile ${{matrix.profile}} --show-trace --max-jobs 3 -A sysroot | cachix push -m zstd dnoland-githedgehog-cache-2 - name: "bins" run: | - nix build -f default.nix --argstr profile ${{matrix.profile}} --show-trace --max-jobs 3 packages.dataplane --out-link output.dataplane - nix build -f default.nix --argstr profile ${{matrix.profile}} --show-trace --max-jobs 3 packages.cli --out-link output.cli - nix build -f default.nix --argstr profile ${{matrix.profile}} --show-trace --max-jobs 3 packages.init --out-link output.init + nix-build --argstr profile ${{matrix.profile}} --show-trace --max-jobs 3 -A packages.dataplane | cachix push -m zstd dnoland-githedgehog-cache-2 + nix-build --argstr profile ${{matrix.profile}} --show-trace --max-jobs 3 -A packages.cli | cachix push -m zstd dnoland-githedgehog-cache-2 + nix-build --argstr profile ${{matrix.profile}} --show-trace --max-jobs 3 -A packages.init | cachix push -m zstd dnoland-githedgehog-cache-2 - - name: "cargo build / nextest" - run: | - export PATH="$(pwd)/devroot/bin:$PATH" - cargo build - cargo nextest run + # - name: "cargo build / nextest" + # run: | + # export PATH="$(pwd)/devroot/bin:$PATH" + # cargo build + # cargo nextest run - id: "clippy" name: "run clippy" diff --git a/default.nix b/default.nix index 16896fc5e..93c69b8a2 100644 --- a/default.nix +++ b/default.nix @@ -133,7 +133,6 @@ let (craneLib.filterCargoSources path type) || (markdownFilter path type) || (cHeaderFilter path type); }; - # Common arguments can be set here to avoid repeating them later vendored = crane.vendorMultipleCargoDeps { inherit (crane.findCargoFiles dataplane-src) cargoConfigs; cargoLockList = [ @@ -155,21 +154,17 @@ let "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem" ]; cargoVendorDir = vendored; - # inherit cargoArtifacts; inherit (craneLib.crateNameFromCargoToml { src = dataplane-src; }) version; - # NB: we disable tests since we'll run them all via cargo-nextest doCheck = false; env = let target = dataplane-pkgs.stdenv'.targetPlatform.rust.rustcTarget; isCross = dataplane-dev-pkgs.stdenv.hostPlatform.rust.rustcTarget != target; - linker = if isCross then "${target}-clang" else "clang"; + clang = if isCross then "${target}-clang" else "clang"; in { SYSROOT = "${sysroot}"; - # PATH = "${devroot}/bin"; - # CC = "${devroot}/bin/${linker}"; LIBCLANG_PATH = "${dataplane-pkgs.pkgsBuildHost.llvmPackages.libclang.lib}/lib"; C_INCLUDE_PATH = "${sysroot}/include"; LIBRARY_PATH = "${sysroot}/lib"; @@ -180,9 +175,8 @@ let profile'.RUSTFLAGS ++ [ "--cfg=tokio_unstable" - "-Clink-arg=-fuse-ld=lld" "-Clink-arg=--ld-path=${devroot}/bin/ld.lld" - "-Clinker=${devroot}/bin/${linker}" + "-Clinker=${devroot}/bin/${clang}" ] ); }; @@ -253,6 +247,7 @@ in packages sources sysroot + _devpkgs shell ; crane = craneLib; From 108d99c02121318b9f081091919f156de5dcfc87 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 28 Dec 2025 02:33:55 +0000 Subject: [PATCH 120/163] wth --- .github/workflows/scratch.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/scratch.yml b/.github/workflows/scratch.yml index fa48cf927..36d4751d3 100644 --- a/.github/workflows/scratch.yml +++ b/.github/workflows/scratch.yml @@ -99,6 +99,8 @@ jobs: with: name: dnoland-githedgehog-cache-2 signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}" + # If you chose API tokens for write access OR if you have a private cache + authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" - name: "devroot" run: | From c9db541f9e67c536249e0ec75760843c66a86c4f Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 28 Dec 2025 02:39:17 +0000 Subject: [PATCH 121/163] unclear --- .github/workflows/scratch.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/scratch.yml b/.github/workflows/scratch.yml index 36d4751d3..f74526171 100644 --- a/.github/workflows/scratch.yml +++ b/.github/workflows/scratch.yml @@ -97,10 +97,9 @@ jobs: - name: "log into cachix" uses: cachix/cachix-action@v14 with: - name: dnoland-githedgehog-cache-2 - signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}" - # If you chose API tokens for write access OR if you have a private cache + name: "dnoland-githedgehog-cache-2" authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}" - name: "devroot" run: | From 862de7b4492c2d8a48e8236a7a11bc58e7aa9e68 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 28 Dec 2025 02:41:21 +0000 Subject: [PATCH 122/163] confusing --- .github/workflows/scratch.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/scratch.yml b/.github/workflows/scratch.yml index f74526171..93f9a2749 100644 --- a/.github/workflows/scratch.yml +++ b/.github/workflows/scratch.yml @@ -100,6 +100,7 @@ jobs: name: "dnoland-githedgehog-cache-2" authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}" + useDaemon: false - name: "devroot" run: | From ed177223cddd33aafaa05936c664973f77eec1b1 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 28 Dec 2025 02:41:50 +0000 Subject: [PATCH 123/163] very confusing --- .github/workflows/scratch.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/scratch.yml b/.github/workflows/scratch.yml index 93f9a2749..554b631e2 100644 --- a/.github/workflows/scratch.yml +++ b/.github/workflows/scratch.yml @@ -96,6 +96,8 @@ jobs: - name: "log into cachix" uses: cachix/cachix-action@v14 + env: + USER: "runner" with: name: "dnoland-githedgehog-cache-2" authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" From f1eabd00a6b7beb536b279530fc2a9156d250fd2 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 28 Dec 2025 02:42:54 +0000 Subject: [PATCH 124/163] extra confuse --- .github/workflows/scratch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scratch.yml b/.github/workflows/scratch.yml index 554b631e2..4c70c4493 100644 --- a/.github/workflows/scratch.yml +++ b/.github/workflows/scratch.yml @@ -102,7 +102,7 @@ jobs: name: "dnoland-githedgehog-cache-2" authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}" - useDaemon: false + useDaemon: true - name: "devroot" run: | From caf8cbf95c825a2ad8a45e49b7552f626fa0e133 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 28 Dec 2025 02:53:16 +0000 Subject: [PATCH 125/163] less confusing --- .github/workflows/scratch.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/scratch.yml b/.github/workflows/scratch.yml index 4c70c4493..80575bed1 100644 --- a/.github/workflows/scratch.yml +++ b/.github/workflows/scratch.yml @@ -74,6 +74,16 @@ jobs: with: nix_path: nixpkgs=channel:nixpkgs-unstable + - name: "log into cachix" + uses: cachix/cachix-action@v14 + env: + USER: "runner" + with: + name: "dnoland-githedgehog-cache-2" + authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}" + useDaemon: true + - name: "login to ghcr.io" uses: "docker/login-action@v3" with: @@ -94,16 +104,6 @@ jobs: persist-credentials: "false" fetch-depth: "0" - - name: "log into cachix" - uses: cachix/cachix-action@v14 - env: - USER: "runner" - with: - name: "dnoland-githedgehog-cache-2" - authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" - signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}" - useDaemon: true - - name: "devroot" run: | nix-build --argstr profile ${{matrix.profile}} --show-trace --max-jobs 3 -A devroot | cachix push -m zstd dnoland-githedgehog-cache-2 From c0292eda95847a645d8d53115a3fa6dcce0a1215 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 28 Dec 2025 02:59:30 +0000 Subject: [PATCH 126/163] substitute --- .config/nix/nix.conf | 5 +++++ .github/workflows/scratch.yml | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .config/nix/nix.conf diff --git a/.config/nix/nix.conf b/.config/nix/nix.conf new file mode 100644 index 000000000..145e6ce59 --- /dev/null +++ b/.config/nix/nix.conf @@ -0,0 +1,5 @@ +max-jobs = 4 +experimental-features = nix-command +substituters = https://dnoland-test-cache.cachix.org/ https://cache.nixos.org https://cache.nixos.org/ +trusted-public-keys = dnoland-test-cache.cachix.org-1:AsVLS3c7NGIJbUHW5xOlK69zPEzY5jNF+ax0jd1LKUA= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= +always-allow-substitutes = true diff --git a/.github/workflows/scratch.yml b/.github/workflows/scratch.yml index 80575bed1..68b1089dd 100644 --- a/.github/workflows/scratch.yml +++ b/.github/workflows/scratch.yml @@ -82,7 +82,7 @@ jobs: name: "dnoland-githedgehog-cache-2" authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}" - useDaemon: true + useDaemon: false - name: "login to ghcr.io" uses: "docker/login-action@v3" @@ -106,14 +106,17 @@ jobs: - name: "devroot" run: | + cachix use dnoland-githedgehog-cache-2 nix-build --argstr profile ${{matrix.profile}} --show-trace --max-jobs 3 -A devroot | cachix push -m zstd dnoland-githedgehog-cache-2 - name: "sysroot" run: | + cachix use dnoland-githedgehog-cache-2 nix-build --argstr profile ${{matrix.profile}} --show-trace --max-jobs 3 -A sysroot | cachix push -m zstd dnoland-githedgehog-cache-2 - name: "bins" run: | + cachix use dnoland-githedgehog-cache-2 nix-build --argstr profile ${{matrix.profile}} --show-trace --max-jobs 3 -A packages.dataplane | cachix push -m zstd dnoland-githedgehog-cache-2 nix-build --argstr profile ${{matrix.profile}} --show-trace --max-jobs 3 -A packages.cli | cachix push -m zstd dnoland-githedgehog-cache-2 nix-build --argstr profile ${{matrix.profile}} --show-trace --max-jobs 3 -A packages.init | cachix push -m zstd dnoland-githedgehog-cache-2 From 47b0cf989570eff2fb375b020f88719a4371a249 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 28 Dec 2025 03:03:47 +0000 Subject: [PATCH 127/163] wip --- .github/workflows/scratch.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/scratch.yml b/.github/workflows/scratch.yml index 68b1089dd..6aaf3c29c 100644 --- a/.github/workflows/scratch.yml +++ b/.github/workflows/scratch.yml @@ -74,16 +74,6 @@ jobs: with: nix_path: nixpkgs=channel:nixpkgs-unstable - - name: "log into cachix" - uses: cachix/cachix-action@v14 - env: - USER: "runner" - with: - name: "dnoland-githedgehog-cache-2" - authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" - signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}" - useDaemon: false - - name: "login to ghcr.io" uses: "docker/login-action@v3" with: @@ -104,6 +94,16 @@ jobs: persist-credentials: "false" fetch-depth: "0" + - name: "log into cachix" + uses: cachix/cachix-action@v14 + env: + USER: "runner" + with: + name: "dnoland-githedgehog-cache-2" + authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}" + useDaemon: true + - name: "devroot" run: | cachix use dnoland-githedgehog-cache-2 From 29afe7555677614a4815aa5b1ca27372c5daa07d Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 28 Dec 2025 03:05:51 +0000 Subject: [PATCH 128/163] wiip --- .github/workflows/scratch.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/scratch.yml b/.github/workflows/scratch.yml index 6aaf3c29c..3ba25bdaf 100644 --- a/.github/workflows/scratch.yml +++ b/.github/workflows/scratch.yml @@ -51,6 +51,7 @@ jobs: env: CACHE_REGISTRY: "run.h.hhdev.io:30000" UPSTREAM_REGISTRY: "ghcr.io" + USER: "runner" permissions: checks: "write" pull-requests: "write" @@ -96,8 +97,6 @@ jobs: - name: "log into cachix" uses: cachix/cachix-action@v14 - env: - USER: "runner" with: name: "dnoland-githedgehog-cache-2" authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" From 4ccec1b8c37553d593eac2dbc3a816bdc98cedba Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 28 Dec 2025 03:56:53 +0000 Subject: [PATCH 129/163] cleanup 0 --- .github/workflows/scratch.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/scratch.yml b/.github/workflows/scratch.yml index 3ba25bdaf..9c6f35184 100644 --- a/.github/workflows/scratch.yml +++ b/.github/workflows/scratch.yml @@ -103,19 +103,20 @@ jobs: signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}" useDaemon: true + # - name: use cachix + # run: | + # cachix use dnoland-githedgehog-cache-2 + - name: "devroot" run: | - cachix use dnoland-githedgehog-cache-2 nix-build --argstr profile ${{matrix.profile}} --show-trace --max-jobs 3 -A devroot | cachix push -m zstd dnoland-githedgehog-cache-2 - name: "sysroot" run: | - cachix use dnoland-githedgehog-cache-2 nix-build --argstr profile ${{matrix.profile}} --show-trace --max-jobs 3 -A sysroot | cachix push -m zstd dnoland-githedgehog-cache-2 - name: "bins" run: | - cachix use dnoland-githedgehog-cache-2 nix-build --argstr profile ${{matrix.profile}} --show-trace --max-jobs 3 -A packages.dataplane | cachix push -m zstd dnoland-githedgehog-cache-2 nix-build --argstr profile ${{matrix.profile}} --show-trace --max-jobs 3 -A packages.cli | cachix push -m zstd dnoland-githedgehog-cache-2 nix-build --argstr profile ${{matrix.profile}} --show-trace --max-jobs 3 -A packages.init | cachix push -m zstd dnoland-githedgehog-cache-2 From e92063850cc86b8466f6fb5af30010c80e692959 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 28 Dec 2025 04:06:30 +0000 Subject: [PATCH 130/163] more wip --- .github/workflows/scratch.yml | 64 ++++++++++++++++++++++++----------- 1 file changed, 45 insertions(+), 19 deletions(-) diff --git a/.github/workflows/scratch.yml b/.github/workflows/scratch.yml index 9c6f35184..6f8ea5436 100644 --- a/.github/workflows/scratch.yml +++ b/.github/workflows/scratch.yml @@ -98,48 +98,74 @@ jobs: - name: "log into cachix" uses: cachix/cachix-action@v14 with: - name: "dnoland-githedgehog-cache-2" + name: "${{ vars.CACHIX_CACHE_NAME }}" authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}" useDaemon: true - # - name: use cachix - # run: | - # cachix use dnoland-githedgehog-cache-2 - - name: "devroot" run: | - nix-build --argstr profile ${{matrix.profile}} --show-trace --max-jobs 3 -A devroot | cachix push -m zstd dnoland-githedgehog-cache-2 + nix build \ + --argstr profile ${{matrix.profile}} \ + --show-trace \ + --max-jobs 3 \ + --file default.nix \ + devroot \ + --out-link devroot - name: "sysroot" run: | - nix-build --argstr profile ${{matrix.profile}} --show-trace --max-jobs 3 -A sysroot | cachix push -m zstd dnoland-githedgehog-cache-2 + nix build \ + --argstr profile ${{matrix.profile}} \ + --show-trace \ + --max-jobs 3 \ + --file default.nix \ + sysroot \ + --out-link sysroot - name: "bins" run: | - nix-build --argstr profile ${{matrix.profile}} --show-trace --max-jobs 3 -A packages.dataplane | cachix push -m zstd dnoland-githedgehog-cache-2 - nix-build --argstr profile ${{matrix.profile}} --show-trace --max-jobs 3 -A packages.cli | cachix push -m zstd dnoland-githedgehog-cache-2 - nix-build --argstr profile ${{matrix.profile}} --show-trace --max-jobs 3 -A packages.init | cachix push -m zstd dnoland-githedgehog-cache-2 - - # - name: "cargo build / nextest" - # run: | - # export PATH="$(pwd)/devroot/bin:$PATH" - # cargo build - # cargo nextest run + nix build --file default.nix \ + --argstr profile ${{matrix.profile}} \ + --show-trace \ + --max-jobs 3 \ + packages.dataplane \ + --out-link packages.dataplane + nix build --file default.nix \ + --argstr profile ${{matrix.profile}} \ + --show-trace \ + --max-jobs 3 \ + packages.cli \ + --out-link packages.cli + nix build --file default.nix \ + --argstr profile ${{matrix.profile}} \ + --show-trace \ + --max-jobs 3 \ + packages.init \ + --out-link packages.init + + - name: "cargo build / nextest" + run: | + export PATH="$(pwd)/devroot/bin:$PATH" + nix env shell --file default.nix shell --command \ + 'cargo nextest --cargo-profile ${{matrix.profile}} run' - id: "clippy" name: "run clippy" run: | - cargo clippy --all-targets --all-features -- -D warnings + nix env shell --file default.nix shell --command \ + 'cargo --profile ${{matrix.profile}} clippy --all-targets --all-features -- -D warnings' - id: "docs" name: "run rustdoc" run: | - RUSTDOCFLAGS="-D warnings" cargo doc --no-deps + nix env shell --file default.nix shell --command \ + 'RUSTDOCFLAGS="-D warnings" cargo --profile=${{matrix.profile}} doc --no-deps' - name: "run doctests" run: | - cargo test --doc + nix env shell --file default.nix shell --command \ + 'RUSTDOCFLAGS="-D warnings" cargo --profile=${{matrix.profile}} test --doc' - name: "Setup tmate session for debug" # if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} From a413120226f7e3e38b919a5dc945a52bfbe3e67f Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 28 Dec 2025 04:09:01 +0000 Subject: [PATCH 131/163] scratch --- .github/workflows/scratch.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/scratch.yml b/.github/workflows/scratch.yml index 6f8ea5436..d0dc26df8 100644 --- a/.github/workflows/scratch.yml +++ b/.github/workflows/scratch.yml @@ -173,3 +173,4 @@ jobs: timeout-minutes: 120 with: limit-access-to-actor: true + From 51dcd2b9d6004ee010893ddec3ecff62db71ee18 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 28 Dec 2025 04:10:20 +0000 Subject: [PATCH 132/163] wip again --- .github/workflows/scratch.yml | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/.github/workflows/scratch.yml b/.github/workflows/scratch.yml index d0dc26df8..fca8fd405 100644 --- a/.github/workflows/scratch.yml +++ b/.github/workflows/scratch.yml @@ -125,24 +125,14 @@ jobs: - name: "bins" run: | - nix build --file default.nix \ - --argstr profile ${{matrix.profile}} \ - --show-trace \ - --max-jobs 3 \ - packages.dataplane \ - --out-link packages.dataplane - nix build --file default.nix \ - --argstr profile ${{matrix.profile}} \ - --show-trace \ - --max-jobs 3 \ - packages.cli \ - --out-link packages.cli - nix build --file default.nix \ - --argstr profile ${{matrix.profile}} \ - --show-trace \ - --max-jobs 3 \ - packages.init \ - --out-link packages.init + for pkg in dataplane cli init; do + nix build --file default.nix \ + --argstr profile ${{matrix.profile}} \ + --show-trace \ + --max-jobs 3 \ + packages.dataplane \ + --out-link "packages.${pkg}" + done - name: "cargo build / nextest" run: | @@ -173,4 +163,3 @@ jobs: timeout-minutes: 120 with: limit-access-to-actor: true - From 001e5745f7f385cdec5a95542595e14833ad98db Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 28 Dec 2025 04:39:54 +0000 Subject: [PATCH 133/163] wip --- .github/workflows/scratch.yml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/scratch.yml b/.github/workflows/scratch.yml index fca8fd405..0aee000f0 100644 --- a/.github/workflows/scratch.yml +++ b/.github/workflows/scratch.yml @@ -134,28 +134,30 @@ jobs: --out-link "packages.${pkg}" done - - name: "cargo build / nextest" + - name: "cargo nextest" run: | export PATH="$(pwd)/devroot/bin:$PATH" - nix env shell --file default.nix shell --command \ - 'cargo nextest --cargo-profile ${{matrix.profile}} run' + nix env shell --file default.nix devroot --command \ + cargo nextest --cargo-profile ${{matrix.profile}} archive --archive-file tests.tar.zst + nix env shell --file default.nix devroot --command \ + cargo nextest --cargo-profile ${{matrix.profile}} run --archive-file tests.tar.zst - id: "clippy" name: "run clippy" run: | - nix env shell --file default.nix shell --command \ - 'cargo --profile ${{matrix.profile}} clippy --all-targets --all-features -- -D warnings' + nix env shell --file default.nix devroot --command \ + cargo --profile ${{matrix.profile}} clippy --all-targets --all-features -- -D warnings - id: "docs" name: "run rustdoc" run: | - nix env shell --file default.nix shell --command \ - 'RUSTDOCFLAGS="-D warnings" cargo --profile=${{matrix.profile}} doc --no-deps' + nix env shell --file default.nix devroot --command \ + RUSTDOCFLAGS="-D warnings" cargo --profile=${{matrix.profile}} doc --no-deps - name: "run doctests" run: | - nix env shell --file default.nix shell --command \ - 'RUSTDOCFLAGS="-D warnings" cargo --profile=${{matrix.profile}} test --doc' + nix env shell --file default.nix devroot --command \ + RUSTDOCFLAGS="-D warnings" cargo --profile=${{matrix.profile}} test --doc - name: "Setup tmate session for debug" # if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} From dc0a00dd2ad69aa026fc8b50841576ec62c49ef8 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 28 Dec 2025 04:43:11 +0000 Subject: [PATCH 134/163] wip again --- .github/workflows/scratch.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/scratch.yml b/.github/workflows/scratch.yml index 0aee000f0..b08ac0f13 100644 --- a/.github/workflows/scratch.yml +++ b/.github/workflows/scratch.yml @@ -106,6 +106,7 @@ jobs: - name: "devroot" run: | nix build \ + --log-format raw \ --argstr profile ${{matrix.profile}} \ --show-trace \ --max-jobs 3 \ @@ -116,6 +117,7 @@ jobs: - name: "sysroot" run: | nix build \ + --log-format raw \ --argstr profile ${{matrix.profile}} \ --show-trace \ --max-jobs 3 \ @@ -127,6 +129,7 @@ jobs: run: | for pkg in dataplane cli init; do nix build --file default.nix \ + --log-format raw \ --argstr profile ${{matrix.profile}} \ --show-trace \ --max-jobs 3 \ From ce2add39a501b27c8722c993ae31cad5915adbf1 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 28 Dec 2025 04:44:46 +0000 Subject: [PATCH 135/163] wip --- .github/workflows/scratch.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/scratch.yml b/.github/workflows/scratch.yml index b08ac0f13..dd0964c33 100644 --- a/.github/workflows/scratch.yml +++ b/.github/workflows/scratch.yml @@ -141,9 +141,9 @@ jobs: run: | export PATH="$(pwd)/devroot/bin:$PATH" nix env shell --file default.nix devroot --command \ - cargo nextest --cargo-profile ${{matrix.profile}} archive --archive-file tests.tar.zst + cargo nextest archive --cargo-profile ${{matrix.profile}} --archive-file tests.tar.zst nix env shell --file default.nix devroot --command \ - cargo nextest --cargo-profile ${{matrix.profile}} run --archive-file tests.tar.zst + cargo nextest run --cargo-profile ${{matrix.profile}} --archive-file tests.tar.zst - id: "clippy" name: "run clippy" From d38c72dca4ccfb16b9f488fbab2565c7f1327446 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 28 Dec 2025 04:46:09 +0000 Subject: [PATCH 136/163] wip --- .github/workflows/scratch.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/scratch.yml b/.github/workflows/scratch.yml index dd0964c33..75ae13052 100644 --- a/.github/workflows/scratch.yml +++ b/.github/workflows/scratch.yml @@ -145,22 +145,22 @@ jobs: nix env shell --file default.nix devroot --command \ cargo nextest run --cargo-profile ${{matrix.profile}} --archive-file tests.tar.zst + - name: "run doctests" + run: | + nix env shell --file default.nix devroot --command \ + cargo test --profile=${{matrix.profile}} --doc + - id: "clippy" name: "run clippy" run: | nix env shell --file default.nix devroot --command \ - cargo --profile ${{matrix.profile}} clippy --all-targets --all-features -- -D warnings + cargo clippy --profile ${{matrix.profile}} --all-targets --all-features -- -D warnings - id: "docs" name: "run rustdoc" run: | nix env shell --file default.nix devroot --command \ - RUSTDOCFLAGS="-D warnings" cargo --profile=${{matrix.profile}} doc --no-deps - - - name: "run doctests" - run: | - nix env shell --file default.nix devroot --command \ - RUSTDOCFLAGS="-D warnings" cargo --profile=${{matrix.profile}} test --doc + RUSTDOCFLAGS="-D warnings" cargo doc --profile=${{matrix.profile}} --no-deps - name: "Setup tmate session for debug" # if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} From 74a3186da9d45fb0442ce745c9bd6121738cfb55 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 28 Dec 2025 04:53:57 +0000 Subject: [PATCH 137/163] wip --- .github/workflows/scratch.yml | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/scratch.yml b/.github/workflows/scratch.yml index 75ae13052..a1917f743 100644 --- a/.github/workflows/scratch.yml +++ b/.github/workflows/scratch.yml @@ -62,11 +62,13 @@ jobs: fail-fast: false matrix: profile: - - "debug" - - "release" + - name: "debug" + cargo_name: "dev" + - name: "release" + cargo_name: "release" debug_justfile: - "${{ inputs.debug_justfile || false }}" - name: "${{matrix.profile}}" + name: "${{matrix.profile.name}}" runs-on: "lab" timeout-minutes: 120 steps: @@ -107,7 +109,7 @@ jobs: run: | nix build \ --log-format raw \ - --argstr profile ${{matrix.profile}} \ + --argstr profile ${{matrix.profile.name}} \ --show-trace \ --max-jobs 3 \ --file default.nix \ @@ -118,7 +120,7 @@ jobs: run: | nix build \ --log-format raw \ - --argstr profile ${{matrix.profile}} \ + --argstr profile ${{matrix.profile.name}} \ --show-trace \ --max-jobs 3 \ --file default.nix \ @@ -130,7 +132,7 @@ jobs: for pkg in dataplane cli init; do nix build --file default.nix \ --log-format raw \ - --argstr profile ${{matrix.profile}} \ + --argstr profile ${{matrix.profile.name}} \ --show-trace \ --max-jobs 3 \ packages.dataplane \ @@ -141,26 +143,26 @@ jobs: run: | export PATH="$(pwd)/devroot/bin:$PATH" nix env shell --file default.nix devroot --command \ - cargo nextest archive --cargo-profile ${{matrix.profile}} --archive-file tests.tar.zst + cargo nextest archive --cargo-profile ${{matrix.profile.cargo_name}} --archive-file tests.tar.zst nix env shell --file default.nix devroot --command \ - cargo nextest run --cargo-profile ${{matrix.profile}} --archive-file tests.tar.zst + cargo nextest run --archive-file tests.tar.zst - name: "run doctests" run: | nix env shell --file default.nix devroot --command \ - cargo test --profile=${{matrix.profile}} --doc + cargo test --profile=${{matrix.profile.cargo_name}} --doc - id: "clippy" name: "run clippy" run: | nix env shell --file default.nix devroot --command \ - cargo clippy --profile ${{matrix.profile}} --all-targets --all-features -- -D warnings + cargo clippy --profile ${{matrix.profile.cargo_name}} --all-targets --all-features -- -D warnings - id: "docs" name: "run rustdoc" run: | nix env shell --file default.nix devroot --command \ - RUSTDOCFLAGS="-D warnings" cargo doc --profile=${{matrix.profile}} --no-deps + RUSTDOCFLAGS="-D warnings" cargo doc --profile=${{matrix.profile_name}} --no-deps - name: "Setup tmate session for debug" # if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} From 5c9f1884c5753944c4f9b98d783a3bd824b18e9b Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 28 Dec 2025 04:56:37 +0000 Subject: [PATCH 138/163] switch sysroot and devroot --- .github/workflows/scratch.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/scratch.yml b/.github/workflows/scratch.yml index a1917f743..671376978 100644 --- a/.github/workflows/scratch.yml +++ b/.github/workflows/scratch.yml @@ -105,7 +105,7 @@ jobs: signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}" useDaemon: true - - name: "devroot" + - name: "sysroot" run: | nix build \ --log-format raw \ @@ -113,10 +113,10 @@ jobs: --show-trace \ --max-jobs 3 \ --file default.nix \ - devroot \ - --out-link devroot + sysroot \ + --out-link sysroot - - name: "sysroot" + - name: "devroot" run: | nix build \ --log-format raw \ @@ -124,8 +124,8 @@ jobs: --show-trace \ --max-jobs 3 \ --file default.nix \ - sysroot \ - --out-link sysroot + devroot \ + --out-link devroot - name: "bins" run: | From cbb92e6d4042c3082b6345eb85d7e2e3e432ac92 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 28 Dec 2025 04:59:28 +0000 Subject: [PATCH 139/163] revert --- .github/workflows/scratch.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/scratch.yml b/.github/workflows/scratch.yml index 671376978..dedc6cf3b 100644 --- a/.github/workflows/scratch.yml +++ b/.github/workflows/scratch.yml @@ -144,8 +144,8 @@ jobs: export PATH="$(pwd)/devroot/bin:$PATH" nix env shell --file default.nix devroot --command \ cargo nextest archive --cargo-profile ${{matrix.profile.cargo_name}} --archive-file tests.tar.zst - nix env shell --file default.nix devroot --command \ - cargo nextest run --archive-file tests.tar.zst + # nix env shell --file default.nix devroot --command \ + # cargo nextest run --archive-file tests.tar.zst - name: "run doctests" run: | From 85d9557aff1d0835acc10741365c71e4e0aa4c26 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 28 Dec 2025 05:05:10 +0000 Subject: [PATCH 140/163] revert me as well --- .github/workflows/scratch.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/scratch.yml b/.github/workflows/scratch.yml index dedc6cf3b..4e4b9ce8a 100644 --- a/.github/workflows/scratch.yml +++ b/.github/workflows/scratch.yml @@ -152,11 +152,11 @@ jobs: nix env shell --file default.nix devroot --command \ cargo test --profile=${{matrix.profile.cargo_name}} --doc - - id: "clippy" - name: "run clippy" - run: | - nix env shell --file default.nix devroot --command \ - cargo clippy --profile ${{matrix.profile.cargo_name}} --all-targets --all-features -- -D warnings + # - id: "clippy" + # name: "run clippy" + # run: | + # nix env shell --file default.nix devroot --command \ + # cargo clippy --profile ${{matrix.profile.cargo_name}} --all-targets --all-features -- -D warnings - id: "docs" name: "run rustdoc" From 2f39d6f416ca20d9ffb79517982cd7de71d8ba74 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 28 Dec 2025 15:28:26 +0000 Subject: [PATCH 141/163] broken again --- .github/workflows/scratch.yml | 20 ++++++++++---------- .gitignore | 22 ++++++++++++++++++++++ default.nix | 8 ++++++++ nix/overlays/dataplane.nix | 5 ----- 4 files changed, 40 insertions(+), 15 deletions(-) diff --git a/.github/workflows/scratch.yml b/.github/workflows/scratch.yml index 4e4b9ce8a..36f8ed521 100644 --- a/.github/workflows/scratch.yml +++ b/.github/workflows/scratch.yml @@ -142,27 +142,27 @@ jobs: - name: "cargo nextest" run: | export PATH="$(pwd)/devroot/bin:$PATH" - nix env shell --file default.nix devroot --command \ + nix shell --file default.nix devroot --command \ cargo nextest archive --cargo-profile ${{matrix.profile.cargo_name}} --archive-file tests.tar.zst - # nix env shell --file default.nix devroot --command \ + # nix shell --file default.nix devroot --command \ # cargo nextest run --archive-file tests.tar.zst - name: "run doctests" run: | - nix env shell --file default.nix devroot --command \ + nix shell --file default.nix devroot --command \ cargo test --profile=${{matrix.profile.cargo_name}} --doc - # - id: "clippy" - # name: "run clippy" - # run: | - # nix env shell --file default.nix devroot --command \ - # cargo clippy --profile ${{matrix.profile.cargo_name}} --all-targets --all-features -- -D warnings + - id: "clippy" + name: "run clippy" + run: | + nix shell --file default.nix shell --command \ + cargo clippy --profile ${{matrix.profile.cargo_name}} --all-targets --all-features -- -D warnings - id: "docs" name: "run rustdoc" run: | - nix env shell --file default.nix devroot --command \ - RUSTDOCFLAGS="-D warnings" cargo doc --profile=${{matrix.profile_name}} --no-deps + nix shell --file default.nix devroot --command \ + sh -c 'RUSTDOCFLAGS="-D warnings" cargo doc --profile=${{matrix.profile_name}} --no-deps' - name: "Setup tmate session for debug" # if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} diff --git a/.gitignore b/.gitignore index 236f3f5a9..11d895249 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,25 @@ result*/** /dpdk-sys/dpdk_wrapper-precompile.h* *.pch /bin + +# Devenv +.devenv* +devenv.local.nix +devenv.local.yaml + +# direnv +.direnv + +# pre-commit +.pre-commit-config.yaml + +# Devenv +.devenv* +devenv.local.nix +devenv.local.yaml + +# direnv +.direnv + +# pre-commit +.pre-commit-config.yaml diff --git a/default.nix b/default.nix index 93c69b8a2..f58789414 100644 --- a/default.nix +++ b/default.nix @@ -122,6 +122,9 @@ let }; shell = dataplane-pkgs.mkShell { packages = _devpkgs; + env = { + RUSTDOCFLAGS = "-D warnings"; + }; }; markdownFilter = path: _type: builtins.match ".*\.md$" path != null; cHeaderFilter = path: _type: builtins.match ".*\.h$" path != null; @@ -224,6 +227,11 @@ let buildInputs = [ hwloc.static ]; + lint = craneLib.cargoClippy (commonArgs // { + inherit cargoArtifacts; + # Optional: Add extra arguments for clippy (e.g., denying warnings) + cargoClippyExtraArgs = "-- --deny warnings"; + }); } ); in diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index 89a3345d8..3d6a25e86 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -28,12 +28,7 @@ let ]; }) final.llvmPackages.stdenv; dataplane-dep = pkg: pkg.override { stdenv = stdenv'; }; - # fenix = import sources.fenix { }; rust-toolchain = final.rust-bin.fromRustupToolchainFile ../../rust-toolchain.toml; - # rust-toolchain = fenix.fromToolchainFile { - # file = ../../rust-toolchain.toml; - # sha256 = (builtins.fromJSON (builtins.readFile ../.rust-toolchain.manifest-lock.json)).hash.sha256; - # }; rustPlatform' = final.makeRustPlatform { stdenv = stdenv'; cargo = rust-toolchain; From 73444c0412c08469222305b368f2044ca42a1232 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 28 Dec 2025 18:30:00 +0000 Subject: [PATCH 142/163] still not quite clippy working --- .cargo/aarch64.gnu.toml | 9 +++++- .cargo/aarch64.musl.toml | 9 +++++- .cargo/config.toml | 12 -------- .cargo/x86_64.gnu.toml | 8 +++-- .cargo/x86_64.musl.toml | 9 +++++- Cargo.lock | 32 ++++++++++---------- default.nix | 38 ++++++++++++++++-------- nix/overlays/dataplane-dev.nix | 6 ++-- nix/overlays/dataplane.nix | 54 +++++++++++++--------------------- nix/pkgs/dpdk/default.nix | 2 +- 10 files changed, 95 insertions(+), 84 deletions(-) diff --git a/.cargo/aarch64.gnu.toml b/.cargo/aarch64.gnu.toml index 66dc89dd7..76e9d145c 100644 --- a/.cargo/aarch64.gnu.toml +++ b/.cargo/aarch64.gnu.toml @@ -1,2 +1,9 @@ [env] -CC = { value = "devroot/bin/aarch64-unknown-linux-gnu-clang", relative = true, force = false } +CC = { value = "aarch64-unknown-linux-gnu-clang", relative = false, force = true } +PATH = { value = "devroot/bin", relative = true, force = true } + +[build] +target = "aarch64-unknown-linux-gnu" + +[target.aarch64-unknown-linux-gnu] +rustflags = ["--cfg=tokio_unstable", "-Clinker=aarch64-unknown-linux-gnu-clang", "-Clink-arg=-fuse-ld=lld"] diff --git a/.cargo/aarch64.musl.toml b/.cargo/aarch64.musl.toml index 977e8fd8e..fb2d9cc07 100644 --- a/.cargo/aarch64.musl.toml +++ b/.cargo/aarch64.musl.toml @@ -1,2 +1,9 @@ [env] -CC = { value = "devroot/bin/aarch64-unknown-linux-musl-clang", relative = true, force = false } +CC = { value = "aarch64-unknown-linux-musl-clang", relative = false, force = true } +PATH = { value = "devroot/bin", relative = true, force = true } + +[build] +target = "aarch64-unknown-linux-musl" + +[target.aarch64-unknown-linux-musl] +rustflags = ["--cfg=tokio_unstable", "-Clinker=aarch64-unknown-linux-musl-clang", "-Clink-arg=-fuse-ld=lld"] diff --git a/.cargo/config.toml b/.cargo/config.toml index 9f250064e..c412225d2 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -8,15 +8,3 @@ LIBCLANG_PATH = { value = "devroot/lib", relative = true, force = false } [build] rustflags = ["--cfg=tokio_unstable"] - -[target.x86_64-unknown-linux-gnu] -rustflags = ["--cfg=tokio_unstable"] - -[target.x86_64-unknown-linux-musl] -rustflags = ["--cfg=tokio_unstable", "-Clinker=x86_64-unknown-linux-musl-clang", "-Clink-arg=-fuse-ld=lld"] - -[target.aarch64-unknown-linux-gnu] -rustflags = ["--cfg=tokio_unstable", "-Clinker=aarch64-unknown-linux-gnu-clang", "-Clink-arg=-fuse-ld=lld"] - -[target.aarch64-unknown-linux-musl] -rustflags = ["--cfg=tokio_unstable", "-Clinker=aarch64-unknown-linux-musl-clang", "-Clink-arg=-fuse-ld=lld"] diff --git a/.cargo/x86_64.gnu.toml b/.cargo/x86_64.gnu.toml index 753bd2de5..cae38ad6e 100644 --- a/.cargo/x86_64.gnu.toml +++ b/.cargo/x86_64.gnu.toml @@ -1,5 +1,9 @@ [env] -CC = { value = "devroot/bin/x86_64-unknown-linux-gnu-clang", relative = true, force = false } +CC = { value = "x86_64-unknown-linux-gnu-clang", relative = false, force = true } +PATH = { value = "devroot/bin", relative = true, force = true } + +[build] +target = "x86_64-unknown-linux-gnu" [target.x86_64-unknown-linux-gnu] -rustflags = ["--cfg=tokio_unstable", "-Clinker=x86_64-unknown-linux-gnu-clang"] +rustflags = ["--cfg=tokio_unstable", "-Clinker=x86_64-unknown-linux-gnu-clang", "-Clink-arg=-fuse-ld=lld"] diff --git a/.cargo/x86_64.musl.toml b/.cargo/x86_64.musl.toml index e2e0687f0..d2496ad40 100644 --- a/.cargo/x86_64.musl.toml +++ b/.cargo/x86_64.musl.toml @@ -1,2 +1,9 @@ [env] -CC = { value = "devroot/bin/x86_64-unknown-linux-musl-clang", relative = true, force = false } +CC = { value = "x86_64-unknown-linux-musl-clang", relative = false, force = true } +PATH = { value = "devroot/bin", relative = true, force = true } + +[build] +target = "x86_64-unknown-linux-musl" + +[target.x86_64-unknown-linux-musl] +rustflags = ["--cfg=tokio_unstable", "-Clinker=x86_64-unknown-linux-musl-clang", "-Clink-arg=-fuse-ld=lld"] diff --git a/Cargo.lock b/Cargo.lock index 45cecb8c9..b18a92c09 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -282,9 +282,9 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59446ce19cd142f8833f856eb31f3eb097812d1479ab224f54d72428ca21ea22" +checksum = "08c78f31d7b1291f7ee735c1c6780ccde7785daae9a9206026862dab7d8792d1" dependencies = [ "bytes", "futures-core", @@ -2872,9 +2872,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee5b5339afb4c41626dde77b7a611bd4f2c202b897852b4bcf5d03eddc61010" +checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" [[package]] name = "jobserver" @@ -3123,9 +3123,9 @@ dependencies = [ [[package]] name = "libredox" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df15f6eac291ed1cf25865b1ee60399f57e7c227e7f51bdbd4c5270396a9ed50" +checksum = "3d0b95e02c851351f877147b7deea7b1afb1df71b63aa5f8270716e0c5720616" dependencies = [ "bitflags 2.10.0", "libc 0.2.178", @@ -3931,9 +3931,9 @@ checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "portable-atomic" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f59e70c4aef1e55797c2e8fd94a4f2a973fc972cfde0e0b05f683667b0cd39dd" +checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" [[package]] name = "potential_utf" @@ -4048,9 +4048,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.103" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" +checksum = "9695f8df41bb4f3d222c95a67532365f569318332d03d5f3f67f37b20e6ebdf0" dependencies = [ "unicode-ident", ] @@ -4646,9 +4646,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.21" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62049b2877bf12821e8f9ad256ee38fdc31db7387ec2d3b3f403024de2034aea" +checksum = "a50f4cf475b65d88e057964e0e9bb1f0aa9bbb2036dc65c64596b42932536984" [[package]] name = "safemem" @@ -4831,9 +4831,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.147" +version = "1.0.148" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6af14725505314343e673e9ecb7cd7e8a36aa9791eb936235a3567cc31447ae4" +checksum = "3084b546a1dd6289475996f182a22aba973866ea8e8b02c51d9f46b1336a22da" dependencies = [ "itoa", "memchr", @@ -6456,6 +6456,6 @@ dependencies = [ [[package]] name = "zmij" -version = "0.1.10" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4af59da1029247450b54ba43e0b62c8e376582464bbe5504dd525fe521e7e8fd" +checksum = "e6d6085d62852e35540689d1f97ad663e3971fc19cf5eceab364d62c646ea167" diff --git a/default.nix b/default.nix index f58789414..5cc1e6af8 100644 --- a/default.nix +++ b/default.nix @@ -25,7 +25,7 @@ let inherit sanitizers instrumentation profile; arch = platform'.arch; }; - rust-profile = + cargo-profile = { "debug" = "dev"; "release" = "release"; @@ -112,7 +112,7 @@ let gateway-crd just kopium - # llvmPackages.clang ## TODO: determine if we actually need this. It is quite heavy and may be confusing + llvmPackages.clang # yes, you do actually need the host compiler in order to link proc macros npins rust-toolchain ]); @@ -126,14 +126,14 @@ let RUSTDOCFLAGS = "-D warnings"; }; }; - markdownFilter = path: _type: builtins.match ".*\.md$" path != null; - cHeaderFilter = path: _type: builtins.match ".*\.h$" path != null; + markdownFilter = p: _type: builtins.match ".*\.md$" p != null; + cHeaderFilter = p: _type: builtins.match ".*\.h$" p != null; dataplane-src = dataplane-pkgs.lib.cleanSourceWith { name = "dataplane-source"; src = ./.; filter = - path: type: - (craneLib.filterCargoSources path type) || (markdownFilter path type) || (cHeaderFilter path type); + p: type: + (craneLib.filterCargoSources p type) || (markdownFilter p type) || (cHeaderFilter p type); }; vendored = crane.vendorMultipleCargoDeps { @@ -146,12 +146,12 @@ let commonArgs = { src = dataplane-src; strictDeps = true; - CARGO_PROFILE = "dev"; + CARGO_PROFILE = cargo-profile; cargoBuildCommand = builtins.concatStringsSep " " [ "cargo" "build" - "--profile=${rust-profile}" + "--profile=${cargo-profile}" "-Zunstable-options" "-Zbuild-std=compiler_builtins,core,alloc,std,panic_unwind,proc_macro" "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem" @@ -227,11 +227,6 @@ let buildInputs = [ hwloc.static ]; - lint = craneLib.cargoClippy (commonArgs // { - inherit cargoArtifacts; - # Optional: Add extra arguments for clippy (e.g., denying warnings) - cargoClippyExtraArgs = "-- --deny warnings"; - }); } ); in @@ -242,6 +237,22 @@ let inherit pname; }) ) package-list; + lints = + let + package-expr = + { + pname, + }: + craneLib.cargoClippy { + inherit pname cargoArtifacts; + inherit (commonArgs) version src env; + # cargoExtraArgs = "--package=${pname}"; + }; + in + builtins.mapAttrs ( + _: pname: + (dataplane-pkgs.callPackage package-expr { inherit pname; }) + ) package-list; in { inherit @@ -257,6 +268,7 @@ in sysroot _devpkgs shell + lints ; crane = craneLib; profile = profile'; diff --git a/nix/overlays/dataplane-dev.nix b/nix/overlays/dataplane-dev.nix index c5a5d29f9..5a122d049 100644 --- a/nix/overlays/dataplane-dev.nix +++ b/nix/overlays/dataplane-dev.nix @@ -28,12 +28,12 @@ in npins = prev.npins.override { inherit rustPlatform; }; gateway-crd = let - path = "config/crd/bases/gwint.githedgehog.com_gatewayagents.yaml"; + p = "config/crd/bases/gwint.githedgehog.com_gatewayagents.yaml"; in final.writeTextFile { name = "gateway-crd"; - text = builtins.readFile "${sources.gateway}/${path}"; + text = builtins.readFile "${sources.gateway}/${p}"; executable = false; - destination = "/src/gateway/${path}"; + destination = "/src/gateway/${p}"; }; } diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index 3d6a25e86..3f8f04745 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -9,10 +9,10 @@ final: prev: let helpers.addToEnv = - add: orig: + new: orig: orig // ( - with builtins; (mapAttrs (var: val: (toString (orig.${var} or "")) + " " + (toString val)) add) + with builtins; (mapAttrs (var: val: (toString (orig.${var} or "")) + " " + (toString val)) new) ); adapt = final.stdenvAdapters; bintools = final.pkgsBuildHost.llvmPackages.bintools; @@ -34,7 +34,6 @@ let cargo = rust-toolchain; rustc = rust-toolchain; }; - rustPlatform = rustPlatform'; in { inherit rust-toolchain stdenv' rustPlatform'; @@ -169,7 +168,15 @@ in # to enable inlining (wherever the compiler decides it makes sense). You very likely want to enable lto here in any # release build. fancy.rdma-core = - ((dataplane-dep prev.rdma-core).override { libnl = final.fancy.libnl; }).overrideAttrs + ((dataplane-dep prev.rdma-core).override { + docutils = null; + ethtool = null; + iproute2 = null; + libnl = final.fancy.libnl; + pandoc = null; + udev = null; + udevCheckHook = null; + }).overrideAttrs (orig: { version = sources.rdma-core.branch; src = sources.rdma-core.outPath; @@ -196,22 +203,21 @@ in cmakeFlags = orig.cmakeFlags ++ [ - "-DRDMA_DYNAMIC_PROVIDERS=none" - "-DRDMA_STATIC_PROVIDERS=all" "-DENABLE_STATIC=1" # we don't need pyverbs, and turning it off reduces build time / complexity. "-DNO_PYVERBS=1" # no need for docs in container images. "-DNO_MAN_PAGES=1" # we don't care about this lib's exported symbols / compat situation _at all_ because we static link (which - # doesn't even have symbol versioning / compatibility in the first place). Turning this off just reduces the - # build's internal complexity and makes lto easier. + # doesn't have symbol versioning in the first place). Turning this off just reduces the build's internal + # complexity and makes lto easier. "-DNO_COMPAT_SYMS=1" + # IOCTL_MODE can be "write" or "ioctl" or "both" (default). # Very old versions of rdma-core used what they call the "legacy write path" to support rdma-operations. - # These have (long) since been superseded by the ioctl mode, but the library generates both code paths by + # These have (long since) been superseded by the ioctl mode, but the library generates both code paths by # default due to rdma-core's fairly aggressive backwards compatibility stance. - # We have absolutely no need or desire to support the legacy mode, and we can potentially save ourselves some - # instruction cache pressure by disabling that old code at compile time. + # We have absolutely no need or desire to support the legacy mode, and we can potentially save ourselves + # some instruction cache pressure by disabling that old code at compile time. "-DIOCTL_MODE=ioctl" ] ++ @@ -240,7 +246,7 @@ in # or debugging. After all, if you aren't doing something performance critical then I don't know why you want DPDK at # all :) # - # Also, while this library has a respectable security track record, this is also a super strong candidate for + # Also, while this library has a respectable security track record, this is also a very strong candidate for # cfi, safe-stack, and cf-protection. dpdk = (dataplane-dep ( @@ -263,8 +269,6 @@ in dpdk-wrapper = dataplane-dep (final.callPackage ../pkgs/dpdk-wrapper { }); pciutils = dataplane-dep (prev.pciutils.override { static = true; }); - # This isn't directly required by dataplane, - perftest = dataplane-dep (final.callPackage ../pkgs/perftest { src = sources.perftest; }); hwloc = (dataplane-dep (prev.hwloc)).overrideAttrs (orig: { outputs = (orig.outputs or [ ]) ++ [ "static" ]; @@ -277,24 +281,6 @@ in ''; }); - kopium = import ../pkgs/kopium { - src = sources.kopium; - inherit rustPlatform; - }; - cargo-bolero = prev.cargo-bolero.override { inherit rustPlatform; }; - cargo-deny = prev.cargo-deny.override { inherit rustPlatform; }; - cargo-llvm-cov = prev.cargo-llvm-cov.override { inherit rustPlatform; }; - cargo-nextest = prev.cargo-nextest.override { inherit rustPlatform; }; - just = prev.just.override { inherit rustPlatform; }; - npins = prev.npins.override { inherit rustPlatform; }; - gateway-crd = - let - path = "config/crd/bases/gwint.githedgehog.com_gatewayagents.yaml"; - in - final.writeTextFile { - name = "gateway-crd"; - text = builtins.readFile "${sources.gateway}/${path}"; - executable = false; - destination = "/src/gateway/${path}"; - }; + # This isn't directly required by dataplane, + perftest = dataplane-dep (final.callPackage ../pkgs/perftest { src = sources.perftest; }); } diff --git a/nix/pkgs/dpdk/default.nix b/nix/pkgs/dpdk/default.nix index d583133a7..c20ff00f3 100644 --- a/nix/pkgs/dpdk/default.nix +++ b/nix/pkgs/dpdk/default.nix @@ -308,7 +308,7 @@ stdenv.mkDerivation { CFLAGS = if stdenv.targetPlatform.parsed.cpu.name == "aarch64" then "-ffat-lto-objects" else ""; postInstall = '' - # Remove docs. We don't build these anyway + # Remove docs. We don't want these anyway rm -rf $out/share/doc # Remove python files from bin output (we never use them and they confuse dependency reports) rm $out/bin/*.py From 6f8bac5fbe907ab6e9591252d298ad8a67afa14c Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 28 Dec 2025 19:29:55 +0000 Subject: [PATCH 143/163] fix nonsense --- hardware/src/group/mod.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/hardware/src/group/mod.rs b/hardware/src/group/mod.rs index 0dafa0e98..a7a67bd92 100644 --- a/hardware/src/group/mod.rs +++ b/hardware/src/group/mod.rs @@ -2,21 +2,22 @@ // Copyright Open Network Fabric Authors //! # Logical hardware groupings -//! +//! //! This module provides types for representing logical groups of hardware //! components. Groups are used in hardware topology to represent collections //! of related components that don't fit into other specific categories. -//! +//! //! Groups can represent: -//! +//! //! - NUMA distances //! - I/O groups //! - Logical partitions //! - Custom hardware groupings defined by the system -//! -//! #[cfg(any(test, feature = "scan"))] -//! #[allow(unused_imports)] // re-export -//! pub use self::scan::*; +//! + +#[cfg(any(test, feature = "scan"))] +#[allow(unused_imports)] // re-export +pub use self::scan::*; /// Attributes for a logical hardware group. /// From 755c79eda3729482f567478023c83cc70e1da947 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 28 Dec 2025 19:30:23 +0000 Subject: [PATCH 144/163] SYSROOT->DATAPLANE_SYSROOT --- .cargo/config.toml | 2 +- dpdk-sysroot-helper/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index c412225d2..99fc2352e 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,5 +1,5 @@ [env] -SYSROOT = { value = "sysroot", relative = true, force = false } +DATAPLANE_SYSROOT = { value = "sysroot", relative = true, force = false } C_INCLUDE_PATH = { value = "sysroot/include", relative = true, force = false } LIBRARY_PATH = { value = "sysroot/lib", relative = true, force = false } PKG_CONFIG_PATH = { value = "sysroot/lib/pkgconfig", relative = true, force = false } diff --git a/dpdk-sysroot-helper/src/lib.rs b/dpdk-sysroot-helper/src/lib.rs index 30e036b16..e6d2c1bcf 100644 --- a/dpdk-sysroot-helper/src/lib.rs +++ b/dpdk-sysroot-helper/src/lib.rs @@ -31,7 +31,7 @@ pub fn get_target_name() -> String { #[must_use] pub fn get_sysroot() -> String { - let sysroot_env = env::var("SYSROOT").expect("SYSROOT not set"); + let sysroot_env = env::var("DATAPLANE_SYSROOT").expect("DATAPLANE_SYSROOT not set"); let sysroot_path = Path::new(&sysroot_env); if sysroot_path.exists() { sysroot_env From 98742375bd8ad9879cf1299c46e8bf762e732cfe Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 28 Dec 2025 20:45:25 +0000 Subject: [PATCH 145/163] leak san working? --- Cargo.lock | 4 ++-- default.nix | 25 +++++++++++++++++++++---- nix/profiles.nix | 3 +++ rust-toolchain.toml | 14 ++++++-------- 4 files changed, 32 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b18a92c09..e0987b8c6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6456,6 +6456,6 @@ dependencies = [ [[package]] name = "zmij" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d6085d62852e35540689d1f97ad663e3971fc19cf5eceab364d62c646ea167" +checksum = "f5858cd3a46fff31e77adea2935e357e3a2538d870741617bfb7c943e218fee6" diff --git a/default.nix b/default.nix index 5cc1e6af8..f1623d31e 100644 --- a/default.nix +++ b/default.nix @@ -167,7 +167,7 @@ let clang = if isCross then "${target}-clang" else "clang"; in { - SYSROOT = "${sysroot}"; + DATAPLANE_SYSROOT = "${sysroot}"; LIBCLANG_PATH = "${dataplane-pkgs.pkgsBuildHost.llvmPackages.libclang.lib}/lib"; C_INCLUDE_PATH = "${sysroot}/include"; LIBRARY_PATH = "${sysroot}/lib"; @@ -216,7 +216,8 @@ let craneLib.buildPackage ( commonArgs // { - inherit pname cargoArtifacts; + # inherit pname cargoArtifacts; + inherit pname; cargoExtraArgs = "--package=${pname}"; nativeBuildInputs = [ pkg-config @@ -241,17 +242,33 @@ let let package-expr = { + pkg-config, + kopium, + llvmPackages, + hwloc, pname, }: craneLib.cargoClippy { inherit pname cargoArtifacts; inherit (commonArgs) version src env; - # cargoExtraArgs = "--package=${pname}"; + cargoExtraArgs = "--package=${pname}"; + nativeBuildInputs = [ + pkg-config + kopium + llvmPackages.clang + llvmPackages.lld + ]; + buildInputs = [ + hwloc.static + ]; }; in builtins.mapAttrs ( _: pname: - (dataplane-pkgs.callPackage package-expr { inherit pname; }) + (dataplane-pkgs.callPackage package-expr { + inherit pname; + inherit (dataplane-dev-pkgs) kopium; + }) ) package-list; in { diff --git a/nix/profiles.nix b/nix/profiles.nix index 90dd9c3c5..d028720c6 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -105,6 +105,7 @@ let ]; sanitize.address.RUSTFLAGS = [ "-Zsanitizer=address" + "-Zexternal-clangrt" ] ++ (builtins.map (flag: "-Clink-arg=${flag}") sanitize.address.NIX_CFLAGS_LINK); sanitize.leak.NIX_CFLAGS_COMPILE = [ @@ -114,6 +115,7 @@ let sanitize.leak.NIX_CFLAGS_LINK = sanitize.leak.NIX_CFLAGS_COMPILE; sanitize.leak.RUSTFLAGS = [ "-Zsanitizer=leak" + "-Zexternal-clangrt" ] ++ (builtins.map (flag: "-Clink-arg=${flag}") sanitize.leak.NIX_CFLAGS_LINK); sanitize.thread.NIX_CFLAGS_COMPILE = [ @@ -125,6 +127,7 @@ let ]; sanitize.thread.RUSTFLAGS = [ "-Zsanitizer=thread" + "-Zexternal-clangrt" ] ++ (builtins.map (flag: "-Clink-arg=${flag}") sanitize.thread.NIX_CFLAGS_LINK); # note: cfi _requires_ LTO and is fundamentally ill suited to debug builds diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 02edb055a..b3a0d7bb3 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -7,18 +7,16 @@ components = [ "cargo", "rust-std", "rust-docs", - "rustfmt-preview", + "rustfmt", "clippy", "rust-analyzer", "rust-src", - # "llvm-tools" - ## other (disabled) components ## - # "rust-mingw", ## not relevant to us - # "llvm-tools-preview", ## we already have a full llvm in the npins, no need for another - # "rust-analysis", ## obsolete - # "miri-preview", ## not yet functional for us - # "rustc-codegen-cranelift-preview" ## not relevant to us + ## other (disabled) components + # "rust-mingw", # not relevant to us + # "llvm-tools", # we already have a full llvm in the npins, no need for another + # "miri", # not yet functional for us + # "rustc-codegen-cranelift-preview" # not relevant to us ] targets = [ From 4d662480d4cb9e1a46eb5da2152604d9cc3d89e2 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Sun, 28 Dec 2025 23:52:10 +0000 Subject: [PATCH 146/163] hacky, but thread sanitizer compiles --- .cargo/config.toml | 1 + Cargo.lock | 1 + Cargo.toml | 1 + default.nix | 13 +++++++++---- nix/profiles.nix | 2 +- test-utils/Cargo.toml | 2 ++ 6 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 99fc2352e..bf56991da 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,4 +1,5 @@ [env] +# PATH = { value = "devroot/bin", relative = true, force = true } DATAPLANE_SYSROOT = { value = "sysroot", relative = true, force = false } C_INCLUDE_PATH = { value = "sysroot/include", relative = true, force = false } LIBRARY_PATH = { value = "sysroot/lib", relative = true, force = false } diff --git a/Cargo.lock b/Cargo.lock index e0987b8c6..85c2994a0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1670,6 +1670,7 @@ dependencies = [ "caps", "dataplane-gwname", "nix 0.30.1", + "proc-macro-error-attr2", "rtnetlink", "tokio", "tracing", diff --git a/Cargo.toml b/Cargo.toml index c86b909c8..9fc67850a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -218,6 +218,7 @@ debug-assertions = true overflow-checks = true debug = "full" rpath = true +incremental = false [profile.release] opt-level = 3 diff --git a/default.nix b/default.nix index f1623d31e..53b312ccf 100644 --- a/default.nix +++ b/default.nix @@ -114,6 +114,7 @@ let kopium llvmPackages.clang # yes, you do actually need the host compiler in order to link proc macros npins + pkg-config rust-toolchain ]); devroot = dataplane-pkgs.symlinkJoin { @@ -136,8 +137,7 @@ let (craneLib.filterCargoSources p type) || (markdownFilter p type) || (cHeaderFilter p type); }; - vendored = crane.vendorMultipleCargoDeps { - inherit (crane.findCargoFiles dataplane-src) cargoConfigs; + cargoVendorDir = craneLib.vendorMultipleCargoDeps { cargoLockList = [ ./Cargo.lock "${dataplane-pkgs.rust-toolchain.passthru.availableComponents.rust-src}/lib/rustlib/src/rust/library/Cargo.lock" @@ -155,8 +155,9 @@ let "-Zunstable-options" "-Zbuild-std=compiler_builtins,core,alloc,std,panic_unwind,proc_macro" "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem" + "--target=x86_64-unknown-linux-gnu" ]; - cargoVendorDir = vendored; + inherit cargoVendorDir; inherit (craneLib.crateNameFromCargoToml { src = dataplane-src; }) version; doCheck = false; @@ -174,12 +175,16 @@ let PKG_CONFIG_PATH = "${sysroot}/lib/pkgconfig"; GW_CRD_PATH = "${dataplane-dev-pkgs.gateway-crd}/src/gateway/config/crd/bases"; RUSTC_BOOTSTRAP = "1"; + CARGO_BUILD_RUSTFLAGS = ""; RUSTFLAGS = builtins.concatStringsSep " " ( profile'.RUSTFLAGS ++ [ + "-Cdebuginfo=0" + "-Ccodegen-units=1" "--cfg=tokio_unstable" "-Clink-arg=--ld-path=${devroot}/bin/ld.lld" "-Clinker=${devroot}/bin/${clang}" + "-Cunsafe-allow-abi-mismatch=sanitizer" ] ); }; @@ -218,7 +223,7 @@ let // { # inherit pname cargoArtifacts; inherit pname; - cargoExtraArgs = "--package=${pname}"; + cargoExtraArgs = "--package=${pname} --target=x86_64-unknown-linux-gnu"; nativeBuildInputs = [ pkg-config kopium diff --git a/nix/profiles.nix b/nix/profiles.nix index d028720c6..e98401259 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -41,7 +41,7 @@ let optimize-for.performance.NIX_CFLAGS_COMPILE = [ "-O3" "-flto=thin" - "-fsplit-lto-unit" # important for compatibility with rust's LTO + # "-fsplit-lto-unit" # important for compatibility with rust's LTO ]; optimize-for.performance.NIX_CXXFLAGS_COMPILE = optimize-for.performance.NIX_CFLAGS_COMPILE ++ [ "-fwhole-program-vtables" diff --git a/test-utils/Cargo.toml b/test-utils/Cargo.toml index 969760d81..6d2c9465c 100644 --- a/test-utils/Cargo.toml +++ b/test-utils/Cargo.toml @@ -12,3 +12,5 @@ nix = { workspace = true, default-features = false, features = ["sched", "fs"] } rtnetlink = { workspace = true, default-features = false, features = ["tokio_socket"] } tokio = { workspace = true, default-features = false, features = ["rt", "net", "time"] } tracing = { workspace = true, default-features = false, features = [] } + +proc-macro-error-attr2 = { version = "=2.0.0", default-features = true } From 89b8caf4b64680967de122c8a34320a1179898a4 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 29 Dec 2025 00:19:41 +0000 Subject: [PATCH 147/163] a little cleaner --- default.nix | 4 ++-- nix/profiles.nix | 34 +++++++++++++++++++--------------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/default.nix b/default.nix index 53b312ccf..a5c497c64 100644 --- a/default.nix +++ b/default.nix @@ -153,7 +153,7 @@ let "build" "--profile=${cargo-profile}" "-Zunstable-options" - "-Zbuild-std=compiler_builtins,core,alloc,std,panic_unwind,proc_macro" + "-Zbuild-std=compiler_builtins,core,alloc,std,panic_unwind,proc_macro,sysroot" "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem" "--target=x86_64-unknown-linux-gnu" ]; @@ -184,7 +184,6 @@ let "--cfg=tokio_unstable" "-Clink-arg=--ld-path=${devroot}/bin/ld.lld" "-Clinker=${devroot}/bin/${clang}" - "-Cunsafe-allow-abi-mismatch=sanitizer" ] ); }; @@ -223,6 +222,7 @@ let // { # inherit pname cargoArtifacts; inherit pname; + # TODO: remove target spec or make dynamic cargoExtraArgs = "--package=${pname} --target=x86_64-unknown-linux-gnu"; nativeBuildInputs = [ pkg-config diff --git a/nix/profiles.nix b/nix/profiles.nix index e98401259..e6a1d00f9 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -24,8 +24,9 @@ let common.RUSTFLAGS = [ "-Cdebuginfo=full" "-Cdwarf-version=5" + "-Csymbol-mangling-version=v0" ] - ++ (builtins.map (flag: "-Clink-arg=${flag}") common.NIX_CFLAGS_LINK); + ++ (map (flag: "-Clink-arg=${flag}") common.NIX_CFLAGS_LINK); optimize-for.debug.NIX_CFLAGS_COMPILE = [ "-fno-inline" "-fno-omit-frame-pointer" @@ -37,7 +38,7 @@ let "-Cdebug-assertions=on" "-Coverflow-checks=on" ] - ++ (builtins.map (flag: "-Clink-arg=${flag}") optimize-for.debug.NIX_CFLAGS_LINK); + ++ (map (flag: "-Clink-arg=${flag}") optimize-for.debug.NIX_CFLAGS_LINK); optimize-for.performance.NIX_CFLAGS_COMPILE = [ "-O3" "-flto=thin" @@ -60,7 +61,7 @@ let "-Cembed-bitcode=yes" "-Ccodegen-units=1" ] - ++ (builtins.map (flag: "-Clink-arg=${flag}") optimize-for.performance.NIX_CFLAGS_LINK); + ++ (map (flag: "-Clink-arg=${flag}") optimize-for.performance.NIX_CFLAGS_LINK); secure.NIX_CFLAGS_COMPILE = [ "-fstack-protector-strong" "-fstack-clash-protection" @@ -74,7 +75,7 @@ let secure.RUSTFLAGS = [ "-Crelro-level=full" ] - ++ (builtins.map (flag: "-Clink-arg=${flag}") secure.NIX_CFLAGS_LINK); + ++ (map (flag: "-Clink-arg=${flag}") secure.NIX_CFLAGS_LINK); march.x86_64.NIX_CFLAGS_COMPILE = [ # DPDK functionally requires some -m flags on x86_64. # These features have been available for a long time and can be found on any reasonably recent machine, so just @@ -90,12 +91,12 @@ let # these should be kept in 1:1 alignment with the x86_64 NIX_CFLAGS_COMPILE settings "-Ctarget-feature=+rtm,+crc32,+ssse3" ] - ++ (builtins.map (flag: "-Clink-arg=${flag}") march.x86_64.NIX_CFLAGS_LINK); + ++ (map (flag: "-Clink-arg=${flag}") march.x86_64.NIX_CFLAGS_LINK); march.aarch64.NIX_CFLAGS_COMPILE = [ ]; march.aarch64.NIX_CXXFLAGS_COMPILE = march.aarch64.NIX_CFLAGS_COMPILE; march.aarch64.NIX_CFLAGS_LINK = [ ]; march.aarch64.RUSTFLAGS = - [ ] ++ (builtins.map (flag: "-Clink-arg=${flag}") march.aarch64.NIX_CFLAGS_LINK); + [ ] ++ (map (flag: "-Clink-arg=${flag}") march.aarch64.NIX_CFLAGS_LINK); sanitize.address.NIX_CFLAGS_COMPILE = [ "-fsanitize=address,local-bounds" ]; @@ -107,7 +108,7 @@ let "-Zsanitizer=address" "-Zexternal-clangrt" ] - ++ (builtins.map (flag: "-Clink-arg=${flag}") sanitize.address.NIX_CFLAGS_LINK); + ++ (map (flag: "-Clink-arg=${flag}") sanitize.address.NIX_CFLAGS_LINK); sanitize.leak.NIX_CFLAGS_COMPILE = [ "-fsanitize=leak" ]; @@ -117,7 +118,7 @@ let "-Zsanitizer=leak" "-Zexternal-clangrt" ] - ++ (builtins.map (flag: "-Clink-arg=${flag}") sanitize.leak.NIX_CFLAGS_LINK); + ++ (map (flag: "-Clink-arg=${flag}") sanitize.leak.NIX_CFLAGS_LINK); sanitize.thread.NIX_CFLAGS_COMPILE = [ "-fsanitize=thread" ]; @@ -128,8 +129,10 @@ let sanitize.thread.RUSTFLAGS = [ "-Zsanitizer=thread" "-Zexternal-clangrt" + # gimli doesn't like thread sanitizer, but it shouldn't be an issue since that is all build time logic + "-Cunsafe-allow-abi-mismatch=sanitizer" ] - ++ (builtins.map (flag: "-Clink-arg=${flag}") sanitize.thread.NIX_CFLAGS_LINK); + ++ (map (flag: "-Clink-arg=${flag}") sanitize.thread.NIX_CFLAGS_LINK); # note: cfi _requires_ LTO and is fundamentally ill suited to debug builds sanitize.cfi.NIX_CFLAGS_COMPILE = [ "-fsanitize=cfi" @@ -155,7 +158,7 @@ let "-Zsanitizer-cfi-normalize-integers" "-Zsanitizer-cfi-generalize-pointers" ] - ++ (builtins.map (flag: "-Clink-arg=${flag}") sanitize.cfi.NIX_CFLAGS_LINK); + ++ (map (flag: "-Clink-arg=${flag}") sanitize.cfi.NIX_CFLAGS_LINK); sanitize.safe-stack.NIX_CFLAGS_COMPILE = [ "-fsanitize=safe-stack" ]; @@ -165,13 +168,14 @@ let ]; sanitize.safe-stack.RUSTFLAGS = [ "-Zsanitizer=safestack" + "-Zexternal-clangrt" ] - ++ (builtins.map (flag: "-Clink-arg=${flag}") sanitize.safe-stack.NIX_CFLAGS_LINK); + ++ (map (flag: "-Clink-arg=${flag}") sanitize.safe-stack.NIX_CFLAGS_LINK); instrument.none.NIX_CFLAGS_COMPILE = [ ]; instrument.none.NIX_CXXFLAGS_COMPILE = instrument.none.NIX_CFLAGS_COMPILE; instrument.none.NIX_CFLAGS_LINK = instrument.none.NIX_CFLAGS_COMPILE; instrument.none.RUSTFLAGS = - [ ] ++ (builtins.map (flag: "-Clink-arg=${flag}") instrument.none.NIX_CFLAGS_LINK); + [ ] ++ (map (flag: "-Clink-arg=${flag}") instrument.none.NIX_CFLAGS_LINK); instrument.produce.NIX_CFLAGS_COMPILE = [ "-fprofile-instr-generate" "-fcoverage-mapping" @@ -182,11 +186,11 @@ let instrument.produce.RUSTFLAGS = [ "-Cinstrument-coverage" ] - ++ (builtins.map (flag: "-Clink-arg=${flag}") instrument.produce.NIX_CFLAGS_LINK); + ++ (map (flag: "-Clink-arg=${flag}") instrument.produce.NIX_CFLAGS_LINK); combine-profiles = features: builtins.foldl' ( - acc: elem: acc // (builtins.mapAttrs (var: val: (acc.${var} or [ ]) ++ val) elem) + acc: element: acc // (builtins.mapAttrs (var: val: (acc.${var} or [ ]) ++ val) element) ) { } features; profile-map = { debug = combine-profiles [ @@ -206,5 +210,5 @@ combine-profiles ( march."${arch}" instrument."${instrumentation}" ] - ++ (builtins.map (s: sanitize.${s}) sanitizers) + ++ (map (s: sanitize.${s}) sanitizers) ) From e697f90c2b2c27f02e74ffbb858e602b7fccdbea Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 29 Dec 2025 17:47:04 +0000 Subject: [PATCH 148/163] wip --- .cargo/config.toml | 2 +- Cargo.toml | 4 +- dataplane/src/main.rs | 12 ++-- default.nix | 138 +++++++++++++++++++------------------ nix/overlays/dataplane.nix | 12 ++-- nix/profiles.nix | 38 +++++++--- 6 files changed, 118 insertions(+), 88 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index bf56991da..7aa8b4f79 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,5 +1,5 @@ [env] -# PATH = { value = "devroot/bin", relative = true, force = true } +PATH = { value = "devroot/bin", relative = true, force = true } DATAPLANE_SYSROOT = { value = "sysroot", relative = true, force = false } C_INCLUDE_PATH = { value = "sysroot/include", relative = true, force = false } LIBRARY_PATH = { value = "sysroot/lib", relative = true, force = false } diff --git a/Cargo.toml b/Cargo.toml index 9fc67850a..39e159b03 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -223,8 +223,8 @@ incremental = false [profile.release] opt-level = 3 panic = "unwind" -# debug = "full" -# lto = "fat" +debug = "full" +lto = true debug-assertions = false overflow-checks = false codegen-units = 1 diff --git a/dataplane/src/main.rs b/dataplane/src/main.rs index bc95d53a2..646f6951d 100644 --- a/dataplane/src/main.rs +++ b/dataplane/src/main.rs @@ -121,12 +121,12 @@ fn main() { let (stop_tx, stop_rx) = std::sync::mpsc::channel(); let ctrlc_stop_tx = stop_tx.clone(); - ctrlc::set_handler(move || { - ctrlc_stop_tx - .send(0) - .expect("Error sending shutdown signal"); - }) - .expect("failed to set SIGINT handler"); + // ctrlc::set_handler(move || { + // ctrlc_stop_tx + // .send(0) + // .expect("Error sending shutdown signal"); + // }) + // .expect("failed to set SIGINT handler"); let grpc_addr = match args.grpc_address() { Ok(addr) => addr, diff --git a/default.nix b/default.nix index a5c497c64..ba4fe2347 100644 --- a/default.nix +++ b/default.nix @@ -92,6 +92,7 @@ let }; crane = import sources.crane { pkgs = dataplane-pkgs; }; craneLib = crane.craneLib.overrideToolchain dataplane-pkgs.rust-toolchain; + craneLibCrossEnv = crane.craneLib.mkCrossToolchainEnv (p: p.stdenv'); _devpkgs = [ clangd-config ] @@ -133,8 +134,7 @@ let name = "dataplane-source"; src = ./.; filter = - p: type: - (craneLib.filterCargoSources p type) || (markdownFilter p type) || (cHeaderFilter p type); + p: type: (craneLib.filterCargoSources p type) || (markdownFilter p type) || (cHeaderFilter p type); }; cargoVendorDir = craneLib.vendorMultipleCargoDeps { @@ -143,31 +143,31 @@ let "${dataplane-pkgs.rust-toolchain.passthru.availableComponents.rust-src}/lib/rustlib/src/rust/library/Cargo.lock" ]; }; - commonArgs = { - src = dataplane-src; - strictDeps = true; - CARGO_PROFILE = cargo-profile; + commonArgs = + let + target = dataplane-pkgs.stdenv'.targetPlatform.rust.rustcTarget; + isCross = dataplane-dev-pkgs.stdenv.hostPlatform.rust.rustcTarget != target; + clang = if isCross then "${target}-clang" else "clang"; + in + { + src = dataplane-src; + strictDeps = true; + CARGO_PROFILE = cargo-profile; - cargoBuildCommand = builtins.concatStringsSep " " [ - "cargo" - "build" - "--profile=${cargo-profile}" - "-Zunstable-options" - "-Zbuild-std=compiler_builtins,core,alloc,std,panic_unwind,proc_macro,sysroot" - "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem" - "--target=x86_64-unknown-linux-gnu" - ]; - inherit cargoVendorDir; - inherit (craneLib.crateNameFromCargoToml { src = dataplane-src; }) version; - doCheck = false; + cargoBuildCommand = builtins.concatStringsSep " " [ + "cargo" + "build" + "--profile=${cargo-profile}" + "-Zunstable-options" + "-Zbuild-std=compiler_builtins,std,panic_unwind,sysroot" + "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem" + "--target=${target}" + ]; + inherit cargoVendorDir; + inherit (craneLib.crateNameFromCargoToml { src = dataplane-src; }) version; + doCheck = false; - env = - let - target = dataplane-pkgs.stdenv'.targetPlatform.rust.rustcTarget; - isCross = dataplane-dev-pkgs.stdenv.hostPlatform.rust.rustcTarget != target; - clang = if isCross then "${target}-clang" else "clang"; - in - { + env = { DATAPLANE_SYSROOT = "${sysroot}"; LIBCLANG_PATH = "${dataplane-pkgs.pkgsBuildHost.llvmPackages.libclang.lib}/lib"; C_INCLUDE_PATH = "${sysroot}/include"; @@ -187,12 +187,7 @@ let ] ); }; - }; - # # Build *just* the cargo dependencies (of the entire workspace), - # # so we can reuse all of that work (e.g. via cachix) when running in CI - # # It is *highly* recommended to use something like cargo-hakari to avoid - # # cache misses when building individual top-level-crates - cargoArtifacts = craneLib.buildDepsOnly commonArgs; + }; package-list = builtins.fromJSON ( builtins.readFile ( dataplane-pkgs.runCommandLocal "package-list" @@ -209,6 +204,7 @@ let ); packages = let + target = dataplane-pkgs.stdenv'.targetPlatform.rust.rustcTarget; package-expr = { pkg-config, @@ -220,10 +216,8 @@ let craneLib.buildPackage ( commonArgs // { - # inherit pname cargoArtifacts; inherit pname; - # TODO: remove target spec or make dynamic - cargoExtraArgs = "--package=${pname} --target=x86_64-unknown-linux-gnu"; + cargoExtraArgs = "--package=${pname} --target=${target}"; nativeBuildInputs = [ pkg-config kopium @@ -241,40 +235,51 @@ let (dataplane-pkgs.callPackage package-expr { inherit (dataplane-dev-pkgs) kopium; inherit pname; + }).overrideAttrs + (orig: { + # I'm not 100% sure if I would call it a bug in crane or a bug in cargo, but there is no easy way to distinguish + # RUSTFLAGS intended for the build-time dependencies from the RUSTFLAGS intended for the runtime dependencies. + # One unfortunate conseqnence of this is that is you set platform specific RUSTFLAGS then the postBuild hook + # malfunctions in the cross compile. Fortunately, the "fix" is easy: just unset RUSTFLAGS before the postBuild + # hook actually runs. + postBuild = '' + unset RUSTFLAGS; + '' + + (orig.postBuild or ""); + }) + ) package-list; + lints = + let + package-expr = + { + pkg-config, + kopium, + llvmPackages, + hwloc, + pname, + }: + craneLib.cargoClippy { + inherit pname; + inherit (commonArgs) version src env; + cargoExtraArgs = "--package=${pname}"; + nativeBuildInputs = [ + pkg-config + kopium + llvmPackages.clang + llvmPackages.lld + ]; + buildInputs = [ + hwloc.static + ]; + }; + in + builtins.mapAttrs ( + _: pname: + (dataplane-pkgs.callPackage package-expr { + inherit pname; + inherit (dataplane-dev-pkgs) kopium; }) ) package-list; - lints = - let - package-expr = - { - pkg-config, - kopium, - llvmPackages, - hwloc, - pname, - }: - craneLib.cargoClippy { - inherit pname cargoArtifacts; - inherit (commonArgs) version src env; - cargoExtraArgs = "--package=${pname}"; - nativeBuildInputs = [ - pkg-config - kopium - llvmPackages.clang - llvmPackages.lld - ]; - buildInputs = [ - hwloc.static - ]; - }; - in - builtins.mapAttrs ( - _: pname: - (dataplane-pkgs.callPackage package-expr { - inherit pname; - inherit (dataplane-dev-pkgs) kopium; - }) - ) package-list; in { inherit @@ -291,6 +296,7 @@ in _devpkgs shell lints + craneLibCrossEnv ; crane = craneLib; profile = profile'; diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index 3f8f04745..c43b278cf 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -270,14 +270,18 @@ in pciutils = dataplane-dep (prev.pciutils.override { static = true; }); - hwloc = (dataplane-dep (prev.hwloc)).overrideAttrs (orig: { + hwloc = ((dataplane-dep prev.hwloc).override { + inherit (final.fancy) numactl; + cairo = null; + libX11 = null; + }).overrideAttrs (orig: { outputs = (orig.outputs or [ ]) ++ [ "static" ]; configureFlags = (orig.configureFlags or [ ]) ++ [ - "--enable-static" + "--enable-static" ]; postInstall = (orig.postInstall or "") + '' - mkdir -p $static/lib - mv $lib/lib/*.a $static/lib/ + mkdir -p $static/lib + mv $lib/lib/*.a $static/lib/ ''; }); diff --git a/nix/profiles.nix b/nix/profiles.nix index e6a1d00f9..583632d5a 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -41,15 +41,14 @@ let ++ (map (flag: "-Clink-arg=${flag}") optimize-for.debug.NIX_CFLAGS_LINK); optimize-for.performance.NIX_CFLAGS_COMPILE = [ "-O3" - "-flto=thin" - # "-fsplit-lto-unit" # important for compatibility with rust's LTO + "-flto=full" + "-fsplit-lto-unit" # important for compatibility with rust's LTO ]; optimize-for.performance.NIX_CXXFLAGS_COMPILE = optimize-for.performance.NIX_CFLAGS_COMPILE ++ [ "-fwhole-program-vtables" ]; optimize-for.performance.NIX_CFLAGS_LINK = optimize-for.performance.NIX_CXXFLAGS_COMPILE ++ [ "-Wl,--lto-whole-program-visibility" - # just to keep the artifacts small, we don't currently use any linked artifact anyway "-Wl,--gc-sections" "-Wl,--as-needed" ]; @@ -59,7 +58,9 @@ let "-Coverflow-checks=off" "-Clinker-plugin-lto" "-Cembed-bitcode=yes" + "-Clto=true" "-Ccodegen-units=1" + "-Zsplit-lto-unit" ] ++ (map (flag: "-Clink-arg=${flag}") optimize-for.performance.NIX_CFLAGS_LINK); secure.NIX_CFLAGS_COMPILE = [ @@ -169,24 +170,43 @@ let sanitize.safe-stack.RUSTFLAGS = [ "-Zsanitizer=safestack" "-Zexternal-clangrt" + # gimli doesn't like thread sanitizer, but it shouldn't be an issue since that is all build time logic + "-Cunsafe-allow-abi-mismatch=sanitizer" + "-Ctarget-feature=-crt-static" # safe-stack doesn't work with any static libc of any kind ] ++ (map (flag: "-Clink-arg=${flag}") sanitize.safe-stack.NIX_CFLAGS_LINK); + sanitize.shadow-stack.NIX_CFLAGS_COMPILE = [ + "-ffixed-x18" + "-fsanitize=shadow-call-stack" + ]; + sanitize.shadow-stack.NIX_CXXFLAGS_COMPILE = sanitize.shadow-stack.NIX_CFLAGS_COMPILE; + sanitize.shadow-stack.NIX_CFLAGS_LINK = sanitize.shadow-stack.NIX_CFLAGS_COMPILE ++ [ + # "-Wl,--allow-shlib-undefined" + ]; + sanitize.shadow-stack.RUSTFLAGS = [ + "-Zfixed-x18" + "-Zsanitizer=shadow-call-stack" + "-Zexternal-clangrt" + # gimli doesn't like shadow-stack sanitizer, but it shouldn't be an issue since that is all build time logic + "-Cunsafe-allow-abi-mismatch=sanitizer,fixed-x18" + "-Ctarget-feature=-crt-static" # shadow-stack doesn't work with static libc + ] + ++ (map (flag: "-Clink-arg=${flag}") sanitize.shadow-stack.NIX_CFLAGS_LINK); instrument.none.NIX_CFLAGS_COMPILE = [ ]; instrument.none.NIX_CXXFLAGS_COMPILE = instrument.none.NIX_CFLAGS_COMPILE; instrument.none.NIX_CFLAGS_LINK = instrument.none.NIX_CFLAGS_COMPILE; instrument.none.RUSTFLAGS = [ ] ++ (map (flag: "-Clink-arg=${flag}") instrument.none.NIX_CFLAGS_LINK); - instrument.produce.NIX_CFLAGS_COMPILE = [ + instrument.coverage.NIX_CFLAGS_COMPILE = [ "-fprofile-instr-generate" "-fcoverage-mapping" - "-fno-omit-frame-pointer" ]; - instrument.produce.NIX_CXXFLAGS_COMPILE = instrument.produce.NIX_CFLAGS_COMPILE; - instrument.produce.NIX_CFLAGS_LINK = instrument.produce.NIX_CFLAGS_COMPILE; - instrument.produce.RUSTFLAGS = [ + instrument.coverage.NIX_CXXFLAGS_COMPILE = instrument.coverage.NIX_CFLAGS_COMPILE; + instrument.coverage.NIX_CFLAGS_LINK = instrument.coverage.NIX_CFLAGS_COMPILE; + instrument.coverage.RUSTFLAGS = [ "-Cinstrument-coverage" ] - ++ (map (flag: "-Clink-arg=${flag}") instrument.produce.NIX_CFLAGS_LINK); + ++ (map (flag: "-Clink-arg=${flag}") instrument.coverage.NIX_CFLAGS_LINK); combine-profiles = features: builtins.foldl' ( From 68b0602516cc42e1e2008af359b699c074c0aade Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 29 Dec 2025 18:05:31 +0000 Subject: [PATCH 149/163] wip --- dataplane/src/main.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dataplane/src/main.rs b/dataplane/src/main.rs index 646f6951d..bc95d53a2 100644 --- a/dataplane/src/main.rs +++ b/dataplane/src/main.rs @@ -121,12 +121,12 @@ fn main() { let (stop_tx, stop_rx) = std::sync::mpsc::channel(); let ctrlc_stop_tx = stop_tx.clone(); - // ctrlc::set_handler(move || { - // ctrlc_stop_tx - // .send(0) - // .expect("Error sending shutdown signal"); - // }) - // .expect("failed to set SIGINT handler"); + ctrlc::set_handler(move || { + ctrlc_stop_tx + .send(0) + .expect("Error sending shutdown signal"); + }) + .expect("failed to set SIGINT handler"); let grpc_addr = match args.grpc_address() { Ok(addr) => addr, From d4b44e91d3a8f82dad7f375c514c5508ff558e35 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Mon, 29 Dec 2025 23:18:13 +0000 Subject: [PATCH 150/163] some cleanup but way too much jank --- .cargo/config.toml | 1 - .../aarch64/gnu.toml} | 1 - .../aarch64/musl.toml} | 1 - .../x86_64/gnu.toml} | 1 - .../x86_64/musl.toml} | 1 - default.nix | 327 ++++++++++++------ nix/profiles.nix | 3 +- 7 files changed, 216 insertions(+), 119 deletions(-) rename .cargo/{aarch64.gnu.toml => cross/aarch64/gnu.toml} (81%) rename .cargo/{aarch64.musl.toml => cross/aarch64/musl.toml} (81%) rename .cargo/{x86_64.gnu.toml => cross/x86_64/gnu.toml} (81%) rename .cargo/{x86_64.musl.toml => cross/x86_64/musl.toml} (81%) diff --git a/.cargo/config.toml b/.cargo/config.toml index 7aa8b4f79..99fc2352e 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,5 +1,4 @@ [env] -PATH = { value = "devroot/bin", relative = true, force = true } DATAPLANE_SYSROOT = { value = "sysroot", relative = true, force = false } C_INCLUDE_PATH = { value = "sysroot/include", relative = true, force = false } LIBRARY_PATH = { value = "sysroot/lib", relative = true, force = false } diff --git a/.cargo/aarch64.gnu.toml b/.cargo/cross/aarch64/gnu.toml similarity index 81% rename from .cargo/aarch64.gnu.toml rename to .cargo/cross/aarch64/gnu.toml index 76e9d145c..fce26c56a 100644 --- a/.cargo/aarch64.gnu.toml +++ b/.cargo/cross/aarch64/gnu.toml @@ -1,6 +1,5 @@ [env] CC = { value = "aarch64-unknown-linux-gnu-clang", relative = false, force = true } -PATH = { value = "devroot/bin", relative = true, force = true } [build] target = "aarch64-unknown-linux-gnu" diff --git a/.cargo/aarch64.musl.toml b/.cargo/cross/aarch64/musl.toml similarity index 81% rename from .cargo/aarch64.musl.toml rename to .cargo/cross/aarch64/musl.toml index fb2d9cc07..173243792 100644 --- a/.cargo/aarch64.musl.toml +++ b/.cargo/cross/aarch64/musl.toml @@ -1,6 +1,5 @@ [env] CC = { value = "aarch64-unknown-linux-musl-clang", relative = false, force = true } -PATH = { value = "devroot/bin", relative = true, force = true } [build] target = "aarch64-unknown-linux-musl" diff --git a/.cargo/x86_64.gnu.toml b/.cargo/cross/x86_64/gnu.toml similarity index 81% rename from .cargo/x86_64.gnu.toml rename to .cargo/cross/x86_64/gnu.toml index cae38ad6e..ce5b95740 100644 --- a/.cargo/x86_64.gnu.toml +++ b/.cargo/cross/x86_64/gnu.toml @@ -1,6 +1,5 @@ [env] CC = { value = "x86_64-unknown-linux-gnu-clang", relative = false, force = true } -PATH = { value = "devroot/bin", relative = true, force = true } [build] target = "x86_64-unknown-linux-gnu" diff --git a/.cargo/x86_64.musl.toml b/.cargo/cross/x86_64/musl.toml similarity index 81% rename from .cargo/x86_64.musl.toml rename to .cargo/cross/x86_64/musl.toml index d2496ad40..17985dc60 100644 --- a/.cargo/x86_64.musl.toml +++ b/.cargo/cross/x86_64/musl.toml @@ -1,6 +1,5 @@ [env] CC = { value = "x86_64-unknown-linux-musl-clang", relative = false, force = true } -PATH = { value = "devroot/bin", relative = true, force = true } [build] target = "x86_64-unknown-linux-musl" diff --git a/default.nix b/default.nix index ba4fe2347..9508b87ae 100644 --- a/default.nix +++ b/default.nix @@ -143,51 +143,87 @@ let "${dataplane-pkgs.rust-toolchain.passthru.availableComponents.rust-src}/lib/rustlib/src/rust/library/Cargo.lock" ]; }; - commonArgs = - let - target = dataplane-pkgs.stdenv'.targetPlatform.rust.rustcTarget; - isCross = dataplane-dev-pkgs.stdenv.hostPlatform.rust.rustcTarget != target; - clang = if isCross then "${target}-clang" else "clang"; - in - { - src = dataplane-src; - strictDeps = true; - CARGO_PROFILE = cargo-profile; + target = dataplane-pkgs.stdenv'.targetPlatform.rust.rustcTarget; + isCross = dataplane-dev-pkgs.stdenv.hostPlatform.rust.rustcTarget != target; + cc = if isCross then "${target}-clang" else "clang"; + commonArgs = { + src = dataplane-src; + strictDeps = true; + CARGO_PROFILE = cargo-profile; - cargoBuildCommand = builtins.concatStringsSep " " [ - "cargo" - "build" - "--profile=${cargo-profile}" - "-Zunstable-options" - "-Zbuild-std=compiler_builtins,std,panic_unwind,sysroot" - "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem" - "--target=${target}" - ]; - inherit cargoVendorDir; - inherit (craneLib.crateNameFromCargoToml { src = dataplane-src; }) version; - doCheck = false; + cargoBuildCommand = builtins.concatStringsSep " " [ + "cargo" + "build" + "--profile=${cargo-profile}" + "-Zunstable-options" + "-Zbuild-std=compiler_builtins,std,panic_unwind,sysroot" + "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem" + "--target=${target}" + ]; + inherit cargoVendorDir; + inherit (craneLib.crateNameFromCargoToml { src = dataplane-src; }) version; + doCheck = false; + dontStrip = true; - env = { - DATAPLANE_SYSROOT = "${sysroot}"; - LIBCLANG_PATH = "${dataplane-pkgs.pkgsBuildHost.llvmPackages.libclang.lib}/lib"; - C_INCLUDE_PATH = "${sysroot}/include"; - LIBRARY_PATH = "${sysroot}/lib"; - PKG_CONFIG_PATH = "${sysroot}/lib/pkgconfig"; - GW_CRD_PATH = "${dataplane-dev-pkgs.gateway-crd}/src/gateway/config/crd/bases"; - RUSTC_BOOTSTRAP = "1"; - CARGO_BUILD_RUSTFLAGS = ""; - RUSTFLAGS = builtins.concatStringsSep " " ( - profile'.RUSTFLAGS - ++ [ - "-Cdebuginfo=0" - "-Ccodegen-units=1" - "--cfg=tokio_unstable" - "-Clink-arg=--ld-path=${devroot}/bin/ld.lld" - "-Clinker=${devroot}/bin/${clang}" - ] - ); - }; + env = { + DATAPLANE_SYSROOT = "${sysroot}"; + LIBCLANG_PATH = "${dataplane-pkgs.pkgsBuildHost.llvmPackages.libclang.lib}/lib"; + C_INCLUDE_PATH = "${sysroot}/include"; + LIBRARY_PATH = "${sysroot}/lib"; + PKG_CONFIG_PATH = "${sysroot}/lib/pkgconfig"; + GW_CRD_PATH = "${dataplane-dev-pkgs.gateway-crd}/src/gateway/config/crd/bases"; + RUSTC_BOOTSTRAP = "1"; + CARGO_BUILD_RUSTFLAGS = ""; + RUSTFLAGS = builtins.concatStringsSep " " ( + profile'.RUSTFLAGS + ++ [ + "--cfg=tokio_unstable" + "-Clink-arg=--ld-path=${devroot}/bin/ld.lld" + "-Clinker=${devroot}/bin/${cc}" + ] + ); }; + }; + + commonArgs-nextest = { + src = dataplane-src; + strictDeps = true; + CARGO_PROFILE = cargo-profile; + + cargoBuildCommand = builtins.concatStringsSep " " [ + "cargo" + "nextest" + "archive" + "--profile=${cargo-profile}" + "-Zunstable-options" + "-Zbuild-std=compiler_builtins,std,panic_unwind,sysroot" + "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem" + "--target=${target}" + ]; + inherit cargoVendorDir; + inherit (craneLib.crateNameFromCargoToml { src = dataplane-src; }) version; + doCheck = false; + dontStrip = true; + + env = { + DATAPLANE_SYSROOT = "${sysroot}"; + LIBCLANG_PATH = "${dataplane-pkgs.pkgsBuildHost.llvmPackages.libclang.lib}/lib"; + C_INCLUDE_PATH = "${sysroot}/include"; + LIBRARY_PATH = "${sysroot}/lib"; + PKG_CONFIG_PATH = "${sysroot}/lib/pkgconfig"; + GW_CRD_PATH = "${dataplane-dev-pkgs.gateway-crd}/src/gateway/config/crd/bases"; + RUSTC_BOOTSTRAP = "1"; + CARGO_BUILD_RUSTFLAGS = ""; + RUSTFLAGS = builtins.concatStringsSep " " ( + profile'.RUSTFLAGS + ++ [ + "--cfg=tokio_unstable" + "-Clink-arg=--ld-path=${devroot}/bin/ld.lld" + "-Clinker=${devroot}/bin/${cc}" + ] + ); + }; + }; package-list = builtins.fromJSON ( builtins.readFile ( dataplane-pkgs.runCommandLocal "package-list" @@ -202,84 +238,152 @@ let '' ) ); - packages = - let - target = dataplane-pkgs.stdenv'.targetPlatform.rust.rustcTarget; - package-expr = - { - pkg-config, - kopium, - llvmPackages, - hwloc, - pname, - }: - craneLib.buildPackage ( - commonArgs - // { - inherit pname; - cargoExtraArgs = "--package=${pname} --target=${target}"; - nativeBuildInputs = [ - pkg-config - kopium - llvmPackages.clang - llvmPackages.lld - ]; - buildInputs = [ - hwloc.static - ]; - } - ); - in - builtins.mapAttrs ( - _: pname: - (dataplane-pkgs.callPackage package-expr { - inherit (dataplane-dev-pkgs) kopium; - inherit pname; - }).overrideAttrs - (orig: { - # I'm not 100% sure if I would call it a bug in crane or a bug in cargo, but there is no easy way to distinguish - # RUSTFLAGS intended for the build-time dependencies from the RUSTFLAGS intended for the runtime dependencies. - # One unfortunate conseqnence of this is that is you set platform specific RUSTFLAGS then the postBuild hook - # malfunctions in the cross compile. Fortunately, the "fix" is easy: just unset RUSTFLAGS before the postBuild - # hook actually runs. - postBuild = '' - unset RUSTFLAGS; - '' - + (orig.postBuild or ""); - }) - ) package-list; - lints = - let - package-expr = - { - pkg-config, - kopium, - llvmPackages, - hwloc, - pname, - }: - craneLib.cargoClippy { - inherit pname; - inherit (commonArgs) version src env; - cargoExtraArgs = "--package=${pname}"; + package-expr = + { + operation, + cargoArtifacts ? null, + pname ? null, + }: + { + pkg-config, + kopium, + llvmPackages, + hwloc, + }: + craneLib.${operation} ( + commonArgs + // { + inherit pname cargoArtifacts; + cargoExtraArgs = (if pname != null then "--package=${pname} " else "") + "--target=${target}"; + nativeBuildInputs = [ + pkg-config + kopium + llvmPackages.clang + llvmPackages.lld + ]; + buildInputs = [ + hwloc.static + ]; + } + ); + nextest-expr = + { + cargoArtifacts ? null, + pname ? null, + }: + dataplane-pkgs.callPackage ( + { + stdenv', + pkg-config, + kopium, + cargo-nextest, + llvmPackages, + hwloc, + rust-toolchain, + }: + stdenv'.mkDerivation ( + commonArgs-nextest + // { + inherit pname cargoArtifacts; + buildCommand = builtins.concatStringsSep " " [ + "cd $src;" + "cargo" + "nextest" + "archive" + "--profile=${cargo-profile}" + "-Zunstable-options" + "-Zbuild-std=compiler_builtins,std,panic_unwind,sysroot" + "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem" + ( + "--target=${target} " + + ( + if pname != null then + "--package=${pname} --archive-file $out/${pname}.tar.zst " + else + "--archive-file $out/nextest.tar.zst " + ) + ) + ]; nativeBuildInputs = [ pkg-config kopium llvmPackages.clang llvmPackages.lld + rust-toolchain + cargo-nextest ]; buildInputs = [ hwloc.static ]; - }; - in - builtins.mapAttrs ( - _: pname: - (dataplane-pkgs.callPackage package-expr { - inherit pname; - inherit (dataplane-dev-pkgs) kopium; + } + ) + ); + craneOp = + { + operation ? "buildPackage", + cargoArtifacts ? null, + pname ? null, + }@inputs: + (dataplane-pkgs.callPackage (package-expr (inputs // { inherit pname; })) { + inherit (dataplane-dev-pkgs) kopium; + }).overrideAttrs + (orig: { + # I'm not 100% sure if I would call it a bug in crane or a bug in cargo, but there is no easy way to distinguish + # RUSTFLAGS intended for the build-time dependencies from the RUSTFLAGS intended for the runtime dependencies. + # One unfortunate conseqnence of this is that is you set platform specific RUSTFLAGS then the postBuild hook + # malfunctions in the cross compile. Fortunately, the "fix" is easy: just unset RUSTFLAGS before the postBuild + # hook actually runs. + postBuild = '' + unset RUSTFLAGS; + '' + + (orig.postBuild or ""); + }); + nextestOp = + { + cargoArtifacts ? null, + pname ? null, + }@inputs: + ( + ((nextest-expr (inputs // { inherit pname; })) { + inherit (dataplane-dev-pkgs) kopium cargo-nextest; }) - ) package-list; + ).overrideAttrs + (orig: { + # I'm not 100% sure if I would call it a bug in crane or a bug in cargo, but there is no easy way to distinguish + # RUSTFLAGS intended for the build-time dependencies from the RUSTFLAGS intended for the runtime dependencies. + # One unfortunate conseqnence of this is that is you set platform specific RUSTFLAGS then the postBuild hook + # malfunctions in the cross compile. Fortunately, the "fix" is easy: just unset RUSTFLAGS before the postBuild + # hook actually runs. + postBuild = '' + unset RUSTFLAGS; + '' + + (orig.postBuild or ""); + }); + cargo.build = builtins.mapAttrs ( + _: pname: + craneOp { + operation = "buildPackage"; + inherit pname; + } + ) package-list; + cargo.clippy = craneOp { + operation = "cargoClippy"; + cargoArtifacts = cargo.build.dataplane; + }; + cargo.nextest = builtins.mapAttrs ( + package: pname: + (nextest-expr { + cargoArtifacts = cargo.build.${package}; + inherit pname; + }) + { + inherit (dataplane-dev-pkgs) kopium cargo-nextest; + } + ) package-list; + cargo.doctest = craneOp { + operation = "cargoDocTest"; + cargoArtifacts = cargo.build.dataplane; + }; in { inherit @@ -290,13 +394,12 @@ in dataplane-pkgs devroot package-list - packages sources sysroot _devpkgs shell - lints craneLibCrossEnv + cargo ; crane = craneLib; profile = profile'; diff --git a/nix/profiles.nix b/nix/profiles.nix index 583632d5a..f13c701fe 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -96,8 +96,7 @@ let march.aarch64.NIX_CFLAGS_COMPILE = [ ]; march.aarch64.NIX_CXXFLAGS_COMPILE = march.aarch64.NIX_CFLAGS_COMPILE; march.aarch64.NIX_CFLAGS_LINK = [ ]; - march.aarch64.RUSTFLAGS = - [ ] ++ (map (flag: "-Clink-arg=${flag}") march.aarch64.NIX_CFLAGS_LINK); + march.aarch64.RUSTFLAGS = [ ] ++ (map (flag: "-Clink-arg=${flag}") march.aarch64.NIX_CFLAGS_LINK); sanitize.address.NIX_CFLAGS_COMPILE = [ "-fsanitize=address,local-bounds" ]; From 6901439fa7ba332e180d45480d540b1cd42cfa83 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Tue, 30 Dec 2025 02:12:00 +0000 Subject: [PATCH 151/163] less messy but some attrition --- default.nix | 387 ++++++++++++++------------------------------- npins/sources.json | 30 ++-- 2 files changed, 133 insertions(+), 284 deletions(-) diff --git a/default.nix b/default.nix index 9508b87ae..63ea41f55 100644 --- a/default.nix +++ b/default.nix @@ -40,14 +40,14 @@ let platform = platform'; }; rust-overlay = import sources.rust-overlay; - dataplane-dev-pkgs = import sources.nixpkgs { + dev-pkgs = import sources.nixpkgs { overlays = [ rust-overlay overlays.llvm overlays.dataplane-dev ]; }; - dataplane-pkgs = + pkgs = (import sources.nixpkgs { overlays = [ rust-overlay @@ -55,11 +55,11 @@ let overlays.dataplane ]; }).pkgsCross.${platform'.info.nixarch}; - sysroot = dataplane-pkgs.pkgsHostHost.symlinkJoin { + sysroot = pkgs.pkgsHostHost.symlinkJoin { name = "sysroot"; - paths = with dataplane-pkgs.pkgsHostHost; [ - dataplane-pkgs.pkgsHostHost.libc.dev - dataplane-pkgs.pkgsHostHost.libc.out + paths = with pkgs.pkgsHostHost; [ + pkgs.pkgsHostHost.libc.dev + pkgs.pkgsHostHost.libc.out fancy.libmd.dev fancy.libmd.static fancy.libbsd.dev @@ -78,7 +78,7 @@ let hwloc.static ]; }; - clangd-config = dataplane-pkgs.writeTextFile { + clangd-config = pkgs.writeTextFile { name = ".clangd"; text = '' CompileFlags: @@ -90,157 +90,70 @@ let executable = false; destination = "/.clangd"; }; - crane = import sources.crane { pkgs = dataplane-pkgs; }; - craneLib = crane.craneLib.overrideToolchain dataplane-pkgs.rust-toolchain; - craneLibCrossEnv = crane.craneLib.mkCrossToolchainEnv (p: p.stdenv'); - _devpkgs = [ - clangd-config - ] - ++ (with dataplane-pkgs.pkgsBuildHost.llvmPackages; [ - bintools - clang - libclang.lib - lld - ]) - ++ (with dataplane-dev-pkgs; [ - bash - cargo-bolero - cargo-deny - cargo-depgraph - cargo-llvm-cov - cargo-nextest - direnv - gateway-crd - just - kopium - llvmPackages.clang # yes, you do actually need the host compiler in order to link proc macros - npins - pkg-config - rust-toolchain - ]); - devroot = dataplane-pkgs.symlinkJoin { + crane = import sources.crane { pkgs = pkgs; }; + craneLib = crane.craneLib.overrideToolchain pkgs.rust-toolchain; + devroot = pkgs.symlinkJoin { name = "dataplane-dev-shell"; - paths = _devpkgs; - }; - shell = dataplane-pkgs.mkShell { - packages = _devpkgs; - env = { - RUSTDOCFLAGS = "-D warnings"; - }; + paths = [ + clangd-config + ] + ++ (with pkgs.pkgsBuildHost.llvmPackages; [ + bintools + clang + libclang.lib + lld + ]) + ++ (with dev-pkgs; [ + bash + cargo-bolero + cargo-deny + cargo-depgraph + cargo-llvm-cov + cargo-nextest + direnv + gateway-crd + just + kopium + llvmPackages.clang # yes, you do actually need the host compiler in order to link proc macros + npins + pkg-config + rust-toolchain + ]); }; markdownFilter = p: _type: builtins.match ".*\.md$" p != null; cHeaderFilter = p: _type: builtins.match ".*\.h$" p != null; - dataplane-src = dataplane-pkgs.lib.cleanSourceWith { - name = "dataplane-source"; - src = ./.; - filter = - p: type: (craneLib.filterCargoSources p type) || (markdownFilter p type) || (cHeaderFilter p type); - }; - + bigFilter = p: _type: (p != "target") && (p != "sysroot") && (p != "devroot") && (p != ".git"); + sourceFilter = pkgs.lib.cleanSourceWith ( + p: t: + (bigFilter p t) && (markdownFilter p t) && (cHeaderFilter p t) && (craneLib.filterCargoSources p t) + ); + src = pkgs.lib.cleanSource ./.; cargoVendorDir = craneLib.vendorMultipleCargoDeps { cargoLockList = [ ./Cargo.lock - "${dataplane-pkgs.rust-toolchain.passthru.availableComponents.rust-src}/lib/rustlib/src/rust/library/Cargo.lock" - ]; - }; - target = dataplane-pkgs.stdenv'.targetPlatform.rust.rustcTarget; - isCross = dataplane-dev-pkgs.stdenv.hostPlatform.rust.rustcTarget != target; - cc = if isCross then "${target}-clang" else "clang"; - commonArgs = { - src = dataplane-src; - strictDeps = true; - CARGO_PROFILE = cargo-profile; - - cargoBuildCommand = builtins.concatStringsSep " " [ - "cargo" - "build" - "--profile=${cargo-profile}" - "-Zunstable-options" - "-Zbuild-std=compiler_builtins,std,panic_unwind,sysroot" - "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem" - "--target=${target}" - ]; - inherit cargoVendorDir; - inherit (craneLib.crateNameFromCargoToml { src = dataplane-src; }) version; - doCheck = false; - dontStrip = true; - - env = { - DATAPLANE_SYSROOT = "${sysroot}"; - LIBCLANG_PATH = "${dataplane-pkgs.pkgsBuildHost.llvmPackages.libclang.lib}/lib"; - C_INCLUDE_PATH = "${sysroot}/include"; - LIBRARY_PATH = "${sysroot}/lib"; - PKG_CONFIG_PATH = "${sysroot}/lib/pkgconfig"; - GW_CRD_PATH = "${dataplane-dev-pkgs.gateway-crd}/src/gateway/config/crd/bases"; - RUSTC_BOOTSTRAP = "1"; - CARGO_BUILD_RUSTFLAGS = ""; - RUSTFLAGS = builtins.concatStringsSep " " ( - profile'.RUSTFLAGS - ++ [ - "--cfg=tokio_unstable" - "-Clink-arg=--ld-path=${devroot}/bin/ld.lld" - "-Clinker=${devroot}/bin/${cc}" - ] - ); - }; - }; - - commonArgs-nextest = { - src = dataplane-src; - strictDeps = true; - CARGO_PROFILE = cargo-profile; - - cargoBuildCommand = builtins.concatStringsSep " " [ - "cargo" - "nextest" - "archive" - "--profile=${cargo-profile}" - "-Zunstable-options" - "-Zbuild-std=compiler_builtins,std,panic_unwind,sysroot" - "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem" - "--target=${target}" + "${pkgs.rust-toolchain.passthru.availableComponents.rust-src}/lib/rustlib/src/rust/library/Cargo.lock" ]; - inherit cargoVendorDir; - inherit (craneLib.crateNameFromCargoToml { src = dataplane-src; }) version; - doCheck = false; - dontStrip = true; - - env = { - DATAPLANE_SYSROOT = "${sysroot}"; - LIBCLANG_PATH = "${dataplane-pkgs.pkgsBuildHost.llvmPackages.libclang.lib}/lib"; - C_INCLUDE_PATH = "${sysroot}/include"; - LIBRARY_PATH = "${sysroot}/lib"; - PKG_CONFIG_PATH = "${sysroot}/lib/pkgconfig"; - GW_CRD_PATH = "${dataplane-dev-pkgs.gateway-crd}/src/gateway/config/crd/bases"; - RUSTC_BOOTSTRAP = "1"; - CARGO_BUILD_RUSTFLAGS = ""; - RUSTFLAGS = builtins.concatStringsSep " " ( - profile'.RUSTFLAGS - ++ [ - "--cfg=tokio_unstable" - "-Clink-arg=--ld-path=${devroot}/bin/ld.lld" - "-Clinker=${devroot}/bin/${cc}" - ] - ); - }; }; + target = pkgs.stdenv'.targetPlatform.rust.rustcTarget; + is-cross-compile = dev-pkgs.stdenv.hostPlatform.rust.rustcTarget != target; + cc = if is-cross-compile then "${target}-clang" else "clang"; package-list = builtins.fromJSON ( builtins.readFile ( - dataplane-pkgs.runCommandLocal "package-list" + pkgs.runCommandLocal "package-list" { - TOMLQ = "${dataplane-dev-pkgs.yq}/bin/tomlq"; - JQ = "${dataplane-dev-pkgs.jq}/bin/jq"; + TOMLQ = "${dev-pkgs.yq}/bin/tomlq"; + JQ = "${dev-pkgs.jq}/bin/jq"; } '' - $TOMLQ -r '.workspace.members | sort[]' ${./.}/Cargo.toml | while read -r p; do - $TOMLQ --arg p "$p" -r '{ ($p): .package.name }' ${./.}/$p/Cargo.toml + $TOMLQ -r '.workspace.members | sort[]' ${src}/Cargo.toml | while read -r p; do + $TOMLQ --arg p "$p" -r '{ ($p): .package.name }' ${src}/$p/Cargo.toml done | $JQ --sort-keys --slurp 'add' > $out '' ) ); - package-expr = + version = (craneLib.crateNameFromCargoToml { inherit src; }).version; + package-expr-builder = { - operation, cargoArtifacts ? null, pname ? null, }: @@ -250,82 +163,69 @@ let llvmPackages, hwloc, }: - craneLib.${operation} ( - commonArgs - // { - inherit pname cargoArtifacts; - cargoExtraArgs = (if pname != null then "--package=${pname} " else "") + "--target=${target}"; - nativeBuildInputs = [ - pkg-config - kopium - llvmPackages.clang - llvmPackages.lld - ]; - buildInputs = [ - hwloc.static - ]; - } - ); - nextest-expr = - { - cargoArtifacts ? null, - pname ? null, - }: - dataplane-pkgs.callPackage ( - { - stdenv', - pkg-config, - kopium, - cargo-nextest, - llvmPackages, - hwloc, - rust-toolchain, - }: - stdenv'.mkDerivation ( - commonArgs-nextest - // { - inherit pname cargoArtifacts; - buildCommand = builtins.concatStringsSep " " [ - "cd $src;" - "cargo" - "nextest" - "archive" - "--profile=${cargo-profile}" - "-Zunstable-options" - "-Zbuild-std=compiler_builtins,std,panic_unwind,sysroot" - "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem" - ( - "--target=${target} " - + ( - if pname != null then - "--package=${pname} --archive-file $out/${pname}.tar.zst " - else - "--archive-file $out/nextest.tar.zst " - ) - ) - ]; - nativeBuildInputs = [ - pkg-config - kopium - llvmPackages.clang - llvmPackages.lld - rust-toolchain - cargo-nextest - ]; - buildInputs = [ - hwloc.static - ]; - } - ) - ); - craneOp = - { - operation ? "buildPackage", - cargoArtifacts ? null, - pname ? null, - }@inputs: - (dataplane-pkgs.callPackage (package-expr (inputs // { inherit pname; })) { - inherit (dataplane-dev-pkgs) kopium; + craneLib.buildPackage { + inherit + src + version + pname + cargoArtifacts + cargoVendorDir + ; + + doCheck = false; + strictDeps = true; + dontStrip = true; + + nativeBuildInputs = [ + pkg-config + kopium + llvmPackages.clang + llvmPackages.lld + ]; + + buildInputs = [ + hwloc.static + ]; + + env = { + CARGO_PROFILE = cargo-profile; + DATAPLANE_SYSROOT = "${sysroot}"; + LIBCLANG_PATH = "${pkgs.pkgsBuildHost.llvmPackages.libclang.lib}/lib"; + C_INCLUDE_PATH = "${sysroot}/include"; + LIBRARY_PATH = "${sysroot}/lib"; + PKG_CONFIG_PATH = "${sysroot}/lib/pkgconfig"; + GW_CRD_PATH = "${dev-pkgs.gateway-crd}/src/gateway/config/crd/bases"; + RUSTC_BOOTSTRAP = "1"; + CARGO_BUILD_RUSTFLAGS = ""; + RUSTFLAGS = builtins.concatStringsSep " " ( + profile'.RUSTFLAGS + ++ [ + "--cfg=tokio_unstable" + "-Clink-arg=--ld-path=${devroot}/bin/ld.lld" + "-Clinker=${devroot}/bin/${cc}" + ] + ); + }; + + cargoBuildCommand = builtins.concatStringsSep " " [ + "cargo" + "build" + "--profile=${cargo-profile}" + "-Zunstable-options" + "-Zbuild-std=compiler_builtins,std,panic_unwind,sysroot" + "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem" + "--target=${target}" + ]; + cargoExtraArgs = (if pname != null then "--package=${pname} " else "") + "--target=${target}"; + }; + cli = + let + pkgs-expr = package-expr-builder { + pname = "dataplane-cli"; + }; + in + (pkgs.callPackage pkgs-expr { + inherit (dev-pkgs) kopium; }).overrideAttrs (orig: { # I'm not 100% sure if I would call it a bug in crane or a bug in cargo, but there is no easy way to distinguish @@ -338,68 +238,17 @@ let '' + (orig.postBuild or ""); }); - nextestOp = - { - cargoArtifacts ? null, - pname ? null, - }@inputs: - ( - ((nextest-expr (inputs // { inherit pname; })) { - inherit (dataplane-dev-pkgs) kopium cargo-nextest; - }) - ).overrideAttrs - (orig: { - # I'm not 100% sure if I would call it a bug in crane or a bug in cargo, but there is no easy way to distinguish - # RUSTFLAGS intended for the build-time dependencies from the RUSTFLAGS intended for the runtime dependencies. - # One unfortunate conseqnence of this is that is you set platform specific RUSTFLAGS then the postBuild hook - # malfunctions in the cross compile. Fortunately, the "fix" is easy: just unset RUSTFLAGS before the postBuild - # hook actually runs. - postBuild = '' - unset RUSTFLAGS; - '' - + (orig.postBuild or ""); - }); - cargo.build = builtins.mapAttrs ( - _: pname: - craneOp { - operation = "buildPackage"; - inherit pname; - } - ) package-list; - cargo.clippy = craneOp { - operation = "cargoClippy"; - cargoArtifacts = cargo.build.dataplane; - }; - cargo.nextest = builtins.mapAttrs ( - package: pname: - (nextest-expr { - cargoArtifacts = cargo.build.${package}; - inherit pname; - }) - { - inherit (dataplane-dev-pkgs) kopium cargo-nextest; - } - ) package-list; - cargo.doctest = craneOp { - operation = "cargoDocTest"; - cargoArtifacts = cargo.build.dataplane; - }; in { inherit # cargoArtifacts - commonArgs - - dataplane-dev-pkgs - dataplane-pkgs + pkgs + dev-pkgs devroot package-list sources sysroot - _devpkgs - shell - craneLibCrossEnv - cargo + cli ; crane = craneLib; profile = profile'; diff --git a/npins/sources.json b/npins/sources.json index a2fca888e..5336f3ffe 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -11,10 +11,10 @@ "version_upper_bound": null, "release_prefix": null, "submodules": false, - "version": "v0.21.3", - "revision": "4a7cf504d83f7d0460f9cf28fe6cbaa5fb856034", - "url": "https://api.github.com/repos/ipetkov/crane/tarball/v0.21.3", - "hash": "sha256-RSkJtNtx0SEaQiYqsoFoRynwfZLo2OZ9z6rUq1DJR6g=" + "version": "v0.22.0", + "revision": "40203daff663c9e0b70d052aae12819dea8e6798", + "url": "https://api.github.com/repos/ipetkov/crane/tarball/refs/tags/v0.22.0", + "hash": "sha256-8qxEFpj4dVmIuPn9j9z6NTbU+hrcGjBOvaxTzre5HmM=" }, "dpdk": { "type": "Git", @@ -38,9 +38,9 @@ }, "branch": "main", "submodules": false, - "revision": "8bfb0290049432d3785d4b29950ae37ff20a89cb", - "url": "https://github.com/nix-community/fenix/archive/8bfb0290049432d3785d4b29950ae37ff20a89cb.tar.gz", - "hash": "sha256-UzzTtDkdc4s9qJY/QU52Ovuq2zWom0cLInCwaXLZlfo=" + "revision": "dfa623c0a6682e6bd4269cc6192f965beb69aa03", + "url": "https://github.com/nix-community/fenix/archive/dfa623c0a6682e6bd4269cc6192f965beb69aa03.tar.gz", + "hash": "sha256-6RfhhB6fzxY0p6eE6UhBXoWSaEAcjCgDG9UaQ6ge1tQ=" }, "gateway": { "type": "GitRelease", @@ -90,8 +90,8 @@ "nixpkgs": { "type": "Channel", "name": "nixpkgs-unstable", - "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.05pre916402.3c1016e6acd1/nixexprs.tar.xz", - "hash": "sha256-+nB3AQBn/uci4InrgicaaQhqxExFl4xHr2wyjem0TD8=" + "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.05pre918100.0744ef1b047f/nixexprs.tar.xz", + "hash": "sha256-Ot0xSLsfRXy6IlMvnc8hSLHKNn/7R8yFDc7uI5Cjpr4=" }, "perftest": { "type": "Git", @@ -102,9 +102,9 @@ }, "branch": "master", "submodules": false, - "revision": "4e4f6629904ba07bf81f207b31433cb9dabbe8ab", - "url": "https://github.com/linux-rdma/perftest/archive/4e4f6629904ba07bf81f207b31433cb9dabbe8ab.tar.gz", - "hash": "sha256-PViLge2v2DBsq/sw7jRfhF7ZOGb9slx/qSDDZVOvfGc=" + "revision": "1c4dc79b81060f0707830c54bf5dae7102fdbbfa", + "url": "https://github.com/linux-rdma/perftest/archive/1c4dc79b81060f0707830c54bf5dae7102fdbbfa.tar.gz", + "hash": "sha256-XHWZGB5qo9FdJ1yVEiwaSMmRmT34V6hngAlZ1ptYkiw=" }, "rdma-core": { "type": "Git", @@ -128,9 +128,9 @@ }, "branch": "master", "submodules": false, - "revision": "3bf67c5e473f29ca79ff15904f3072d87cf6d087", - "url": "https://github.com/oxalica/rust-overlay/archive/3bf67c5e473f29ca79ff15904f3072d87cf6d087.tar.gz", - "hash": "sha256-wW15buPGU29v0XuAmDkc30+d5j4Tmg/V8AkpHH+hDWY=" + "revision": "9fe44e7f05b734a64a01f92fc51ad064fb0a884f", + "url": "https://github.com/oxalica/rust-overlay/archive/9fe44e7f05b734a64a01f92fc51ad064fb0a884f.tar.gz", + "hash": "sha256-w+o3AIBI56tzfMJRqRXg9tSXnpQRN5hAT15o2t9rxYw=" } }, "version": 7 From c21898d1d7d316522a7a92e7bf63927482fc0d97 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Tue, 30 Dec 2025 03:53:09 +0000 Subject: [PATCH 152/163] fenix cleanup --- default.nix | 45 ++++++----- nix/.rust-toolchain.manifest-lock.json | 10 --- nix/overlays/dataplane-dev.nix | 34 ++++---- nix/overlays/dataplane.nix | 103 ++++++------------------- nix/overlays/default.nix | 26 ++----- nix/overlays/llvm.nix | 71 +++++++++++------ nix/rust-toolchain.manifest-lock.nix | 18 ----- npins/sources.json | 19 +---- 8 files changed, 123 insertions(+), 203 deletions(-) delete mode 100644 nix/.rust-toolchain.manifest-lock.json delete mode 100644 nix/rust-toolchain.manifest-lock.nix diff --git a/default.nix b/default.nix index 63ea41f55..48f3edf13 100644 --- a/default.nix +++ b/default.nix @@ -39,18 +39,17 @@ let profile = profile'; platform = platform'; }; - rust-overlay = import sources.rust-overlay; dev-pkgs = import sources.nixpkgs { overlays = [ - rust-overlay + overlays.rust overlays.llvm - overlays.dataplane-dev + # overlays.dataplane-dev ]; }; pkgs = (import sources.nixpkgs { overlays = [ - rust-overlay + overlays.rust overlays.llvm overlays.dataplane ]; @@ -122,12 +121,15 @@ let }; markdownFilter = p: _type: builtins.match ".*\.md$" p != null; cHeaderFilter = p: _type: builtins.match ".*\.h$" p != null; - bigFilter = p: _type: (p != "target") && (p != "sysroot") && (p != "devroot") && (p != ".git"); - sourceFilter = pkgs.lib.cleanSourceWith ( - p: t: - (bigFilter p t) && (markdownFilter p t) && (cHeaderFilter p t) && (craneLib.filterCargoSources p t) - ); - src = pkgs.lib.cleanSource ./.; + outputsFilter = p: _type: (p != "target") && (p != "sysroot") && (p != "devroot") && (p != ".git"); + src = pkgs.lib.cleanSourceWith { + filter = + p: t: + (markdownFilter p t) + || (cHeaderFilter p t) + || ((outputsFilter p t) && (craneLib.filterCargoSources p t)); + src = ./.; + }; cargoVendorDir = craneLib.vendorMultipleCargoDeps { cargoLockList = [ ./Cargo.lock @@ -152,6 +154,13 @@ let ) ); version = (craneLib.crateNameFromCargoToml { inherit src; }).version; + cargo-cmd-prefix = builtins.concatStringsSep " " [ + "--profile=${cargo-profile}" + "-Zunstable-options" + "-Zbuild-std=compiler_builtins,std,panic_unwind,sysroot" + "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem" + "--target=${target}" + ]; package-expr-builder = { cargoArtifacts ? null, @@ -207,15 +216,13 @@ let ); }; - cargoBuildCommand = builtins.concatStringsSep " " [ - "cargo" - "build" - "--profile=${cargo-profile}" - "-Zunstable-options" - "-Zbuild-std=compiler_builtins,std,panic_unwind,sysroot" - "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem" - "--target=${target}" - ]; + cargoBuildCommand = builtins.concatStringsSep " " ( + [ + "cargo" + "build" + ] + ++ cargo-cmd-prefix + ); cargoExtraArgs = (if pname != null then "--package=${pname} " else "") + "--target=${target}"; }; cli = diff --git a/nix/.rust-toolchain.manifest-lock.json b/nix/.rust-toolchain.manifest-lock.json deleted file mode 100644 index 18160d91b..000000000 --- a/nix/.rust-toolchain.manifest-lock.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "channel": "1.92.0", - "hash": { - "md5": "5925de5268fdcb9c70be7fa06de5583d", - "sha1": "aace35bc46aa55685f1e19c34d644f3d49b057c6", - "sha256": "b2a49624353173ecdacf59c158c00929300606e1963f6e4609fb483a508402d0", - "sha512": "0a8fc59360a5e6f3236d9a35ce2c8e0ba184e8be9b5a918f9bc7aae3e5cc1f8133eaa01fd044fdc6ba645805a98aa645e343fbb7b15a850ea0e83ff20d42ebaa" - }, - "url": "https://static.rust-lang.org/dist/channel-rust-1.92.0.toml" -} diff --git a/nix/overlays/dataplane-dev.nix b/nix/overlays/dataplane-dev.nix index 5a122d049..f71e5f4eb 100644 --- a/nix/overlays/dataplane-dev.nix +++ b/nix/overlays/dataplane-dev.nix @@ -2,30 +2,28 @@ # Copyright Open Network Fabric Authors { sources, + ... }: final: prev: let - rust-toolchain = final.rust-bin.fromRustupToolchainFile ../../rust-toolchain.toml; - rustPlatform = final.makeRustPlatform { - stdenv = final.llvmPackages.stdenv; - cargo = rust-toolchain; - rustc = rust-toolchain; + override-packages = { + stdenv = final.llvmPackages'.stdenv; + rustPlatform = final.rustPlatform'; }; in { - inherit rust-toolchain; - rustPlatform' = rustPlatform; - - kopium = import ../pkgs/kopium { - src = sources.kopium; - inherit rustPlatform; - }; - cargo-bolero = prev.cargo-bolero.override { inherit rustPlatform; }; - cargo-deny = prev.cargo-deny.override { inherit rustPlatform; }; - cargo-llvm-cov = prev.cargo-llvm-cov.override { inherit rustPlatform; }; - cargo-nextest = prev.cargo-nextest.override { inherit rustPlatform; }; - just = prev.just.override { inherit rustPlatform; }; - npins = prev.npins.override { inherit rustPlatform; }; + kopium = import ../pkgs/kopium ( + { + src = sources.kopium; + } + // override-packages + ); + cargo-bolero = prev.cargo-bolero.override override-packages; + cargo-deny = prev.cargo-deny.override override-packages; + cargo-llvm-cov = prev.cargo-llvm-cov.override override-packages; + cargo-nextest = prev.cargo-nextest.override override-packages; + just = prev.just.override override-packages; + npins = prev.npins.override override-packages; gateway-crd = let p = "config/crd/bases/gwint.githedgehog.com_gatewayagents.yaml"; diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index c43b278cf..bd68736b1 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -4,68 +4,13 @@ sources, sanitizers, platform, - profile, + ... }: final: prev: let - helpers.addToEnv = - new: orig: - orig - // ( - with builtins; (mapAttrs (var: val: (toString (orig.${var} or "")) + " " + (toString val)) new) - ); - adapt = final.stdenvAdapters; - bintools = final.pkgsBuildHost.llvmPackages.bintools; - lld = final.pkgsBuildHost.llvmPackages.lld; - added-to-env = helpers.addToEnv platform.override.stdenv.env profile; - stdenv' = adapt.addAttrsToDerivation (orig: { - doCheck = false; - separateDebugInfo = true; - env = helpers.addToEnv added-to-env (orig.env or { }); - nativeBuildInputs = (orig.nativeBuildInputs or [ ]) ++ [ - bintools - lld - ]; - }) final.llvmPackages.stdenv; - dataplane-dep = pkg: pkg.override { stdenv = stdenv'; }; - rust-toolchain = final.rust-bin.fromRustupToolchainFile ../../rust-toolchain.toml; - rustPlatform' = final.makeRustPlatform { - stdenv = stdenv'; - cargo = rust-toolchain; - rustc = rust-toolchain; - }; + dataplane-dep = pkg: pkg.override { stdenv = final.stdenv'; }; in { - inherit rust-toolchain stdenv' rustPlatform'; - # Don't bother adapting ethtool or iproute2's build to our custom flags / env. Failure to null this can trigger - # _massive_ builds because ethtool depends on libnl (et al), and we _do_ overlay libnl. Thus, the ethtool / iproute2 - # get rebuilt and you end up rebuilding the whole world. - # - # To be clear, we can still use ethtool / iproute2 if we want, we just don't need to optimize / lto it. - # If you want to include ethtool / iproute2, I recommend just cutting another small overlay and static linking them. - # Alternatively, you could skip that and just ship the default build of ethtool. - # ethtool = null; - # iproute2 = null; - - # These are only used in docs and can make our build explode in size if we let any of this rebuild in this overlay. - # It is much easier to just not build docs in this overlay. We don't care if the build depends on pandoc per se, but - # you will regret the need to rebuild ghc :shrug: - # gd = null; - # graphviz = null; - # mscgen = null; - # pandoc = null; - - # We should avoid accepting anything in our dpdk + friends pkgs which depends on udev / systemd; our deploy simply - # won't support any such mechanisms. - # - # Usually this type of dependency takes the form of udev rules / systemd service files being generated (which is no - # problem). That said, builds which hard and fast depend on systemd or udev are very suspicious in this context, so - # exceptions to this removal should be granted with care and some level of prejudice. At minimum, such exceptions - # tend to make it hard to cross compile which is an important test case for our sysroot. - # systemd = null; - # udev = null; - # udevCheckHook = null; - # libmd is used by libbsd (et al) which is an optional dependency of dpdk. # # We _might_ actually care about perf here, so we lto this package. @@ -169,13 +114,13 @@ in # release build. fancy.rdma-core = ((dataplane-dep prev.rdma-core).override { - docutils = null; - ethtool = null; - iproute2 = null; - libnl = final.fancy.libnl; - pandoc = null; - udev = null; - udevCheckHook = null; + docutils = null; + ethtool = null; + iproute2 = null; + libnl = final.fancy.libnl; + pandoc = null; + udev = null; + udevCheckHook = null; }).overrideAttrs (orig: { version = sources.rdma-core.branch; @@ -270,20 +215,22 @@ in pciutils = dataplane-dep (prev.pciutils.override { static = true; }); - hwloc = ((dataplane-dep prev.hwloc).override { - inherit (final.fancy) numactl; - cairo = null; - libX11 = null; - }).overrideAttrs (orig: { - outputs = (orig.outputs or [ ]) ++ [ "static" ]; - configureFlags = (orig.configureFlags or [ ]) ++ [ - "--enable-static" - ]; - postInstall = (orig.postInstall or "") + '' - mkdir -p $static/lib - mv $lib/lib/*.a $static/lib/ - ''; - }); + hwloc = + ((dataplane-dep prev.hwloc).override { + inherit (final.fancy) numactl; + cairo = null; + libX11 = null; + }).overrideAttrs + (orig: { + outputs = (orig.outputs or [ ]) ++ [ "static" ]; + configureFlags = (orig.configureFlags or [ ]) ++ [ + "--enable-static" + ]; + postInstall = (orig.postInstall or "") + '' + mkdir -p $static/lib + mv $lib/lib/*.a $static/lib/ + ''; + }); # This isn't directly required by dataplane, perftest = dataplane-dep (final.callPackage ../pkgs/perftest { src = sources.perftest; }); diff --git a/nix/overlays/default.nix b/nix/overlays/default.nix index d7bb9d7f7..b54445b75 100644 --- a/nix/overlays/default.nix +++ b/nix/overlays/default.nix @@ -1,26 +1,12 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright Open Network Fabric Authors -{ +inputs@{ sources, - sanitizers, - platform, - profile, + ... }: { - llvm = import ./llvm.nix { - inherit sources; - }; - - dataplane = import ./dataplane.nix { - inherit - sources - sanitizers - platform - profile - ; - }; - - dataplane-dev = import ./dataplane-dev.nix { - inherit sources; - }; + rust = import sources.rust-overlay; + llvm = import ./llvm.nix inputs; # requires rust + dataplane = import ./dataplane.nix inputs; # requires llvm + dataplane-dev = import ./dataplane-dev.nix inputs; # requires llvm } diff --git a/nix/overlays/llvm.nix b/nix/overlays/llvm.nix index 9e7049db3..5e0f00ef5 100644 --- a/nix/overlays/llvm.nix +++ b/nix/overlays/llvm.nix @@ -1,36 +1,59 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright Open Network Fabric Authors { - sources, + platform, + profile, + ... }: +final: prev: let - fenix = import sources.fenix { }; - rust-toolchain = fenix.fromToolchainFile { - file = ../../rust-toolchain.toml; - sha256 = (builtins.fromJSON (builtins.readFile ../.rust-toolchain.manifest-lock.json)).hash.sha256; + helpers.addToEnv = + new: orig: + orig + // ( + with builtins; (mapAttrs (var: val: (toString (orig.${var} or "")) + " " + (toString val)) new) + ); + adapt = final.stdenvAdapters; + bintools = final.pkgsBuildHost.llvmPackages.bintools; + lld = final.pkgsBuildHost.llvmPackages.lld; + added-to-env = helpers.addToEnv platform.override.stdenv.env profile; + stdenv' = adapt.addAttrsToDerivation (orig: { + doCheck = false; + separateDebugInfo = true; + env = helpers.addToEnv added-to-env (orig.env or { }); + nativeBuildInputs = (orig.nativeBuildInputs or [ ]) ++ [ + bintools + lld + ]; + }) final.llvmPackages.stdenv; + # note: rust-bin comes from oxa's overlay, not nixpkgs + rust-toolchain = prev.rust-bin.fromRustupToolchainFile ../../rust-toolchain.toml; + rustPlatform' = prev.makeRustPlatform { + stdenv = stdenv'; + cargo = rust-toolchain; + rustc = rust-toolchain; }; -in -final: prev: { # It is essential that we always use the same version of llvm that our rustc is backed by. # To minimize maintenance burden, we explicitly compute the version of LLVM we need by asking rustc # which version it is using. # This is significantly less error prone than hunting around for all versions of pkgs.llvmPackages_${version} # every time rust updates. - llvmPackages = - let - version = builtins.readFile ( - final.runCommandLocal "llvm-version-for-our-rustc" - { - RUSTC = "${rust-toolchain.out}/bin/rustc"; - GREP = "${final.pkgsBuildHost.gnugrep}/bin/grep"; - SED = "${final.pkgsBuildHost.gnused}/bin/sed"; - } - '' - $RUSTC --version --verbose | \ - $GREP '^LLVM version:' | \ - $SED -z 's|LLVM version: \([0-9]\+\)\.[0-9]\+\.[0-9]\+\n|\1|' > $out - '' - ); - in - final."llvmPackages_${version}"; + # Unfortunately, this is also IFD, so it slows down the nix build a bit :shrug: + llvm-version = builtins.readFile ( + prev.runCommand "llvm-version-for-our-rustc" + { + RUSTC = "${rust-toolchain.out}/bin/rustc"; + GREP = "${prev.pkgsBuildHost.gnugrep}/bin/grep"; + SED = "${prev.pkgsBuildHost.gnused}/bin/sed"; + } + '' + $RUSTC --version --verbose | \ + $GREP '^LLVM version:' | \ + $SED -z 's|LLVM version: \([0-9]\+\)\.[0-9]\+\.[0-9]\+\n|\1|' > $out + '' + ); +in +{ + inherit rust-toolchain rustPlatform'; + llvmPackages' = prev."llvmPackages_${llvm-version}"; } diff --git a/nix/rust-toolchain.manifest-lock.nix b/nix/rust-toolchain.manifest-lock.nix deleted file mode 100644 index 2c333d943..000000000 --- a/nix/rust-toolchain.manifest-lock.nix +++ /dev/null @@ -1,18 +0,0 @@ -let - rust-toolchain = (builtins.fromTOML (builtins.readFile ../rust-toolchain.toml)).toolchain; - channel = rust-toolchain.channel; - url = "https://static.rust-lang.org/dist/channel-rust-${channel}.toml"; - manifest-path = builtins.fetchurl { - inherit url; - name = "manifest.toml"; - }; - hash = { - md5 = builtins.hashFile "md5" manifest-path; - sha1 = builtins.hashFile "sha1" manifest-path; - sha256 = builtins.hashFile "sha256" manifest-path; - sha512 = builtins.hashFile "sha512" manifest-path; - }; -in -{ - inherit channel url hash; -} diff --git a/npins/sources.json b/npins/sources.json index 5336f3ffe..f3ef1c158 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -29,19 +29,6 @@ "url": "https://github.com/githedgehog/dpdk/archive/6736a6e32f5b3a8d16b2bd0e84b73af32540de77.tar.gz", "hash": "sha256-aVtrmUtFkkC2SsnfWJmRN/Klwfb/EGLG+YYtSLm5tBY=" }, - "fenix": { - "type": "Git", - "repository": { - "type": "GitHub", - "owner": "nix-community", - "repo": "fenix" - }, - "branch": "main", - "submodules": false, - "revision": "dfa623c0a6682e6bd4269cc6192f965beb69aa03", - "url": "https://github.com/nix-community/fenix/archive/dfa623c0a6682e6bd4269cc6192f965beb69aa03.tar.gz", - "hash": "sha256-6RfhhB6fzxY0p6eE6UhBXoWSaEAcjCgDG9UaQ6ge1tQ=" - }, "gateway": { "type": "GitRelease", "repository": { @@ -128,9 +115,9 @@ }, "branch": "master", "submodules": false, - "revision": "9fe44e7f05b734a64a01f92fc51ad064fb0a884f", - "url": "https://github.com/oxalica/rust-overlay/archive/9fe44e7f05b734a64a01f92fc51ad064fb0a884f.tar.gz", - "hash": "sha256-w+o3AIBI56tzfMJRqRXg9tSXnpQRN5hAT15o2t9rxYw=" + "revision": "943d2d0bf1b86267287aff826ebd1138d83113b7", + "url": "https://github.com/oxalica/rust-overlay/archive/943d2d0bf1b86267287aff826ebd1138d83113b7.tar.gz", + "hash": "sha256-hfKAOJQYbR0mlwabV56tOlEMUgESRroHqlDpX0hwOpU=" } }, "version": 7 From 4682469fb02e294d89364ba72d05fefbb9a11538 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Tue, 30 Dec 2025 21:28:38 +0000 Subject: [PATCH 153/163] more cleanup --- Cargo.lock | 112 ++++++++++++++---------------- Cargo.toml | 15 ++-- default.nix | 48 +++++++++++-- nix/overlays/dataplane-dev.nix | 14 ++-- nix/overlays/dataplane.nix | 22 ++---- nix/overlays/llvm.nix | 9 ++- nix/pkgs/dpdk-wrapper/default.nix | 1 + nix/pkgs/dpdk/default.nix | 7 +- nix/pkgs/kopium/default.nix | 1 + nix/pkgs/perftest/default.nix | 1 + nix/platforms.nix | 8 --- nix/profiles.nix | 19 +++-- shell.nix | 57 --------------- 13 files changed, 139 insertions(+), 175 deletions(-) delete mode 100644 shell.nix diff --git a/Cargo.lock b/Cargo.lock index 85c2994a0..3eb8e6d4c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -30,7 +30,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa514b7c2d4cb8ac9d54925c91900d21fdda508877694661858744211c11c69c" dependencies = [ "futures-lite", - "libc 0.2.178", + "libc", "tokio", ] @@ -68,7 +68,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" dependencies = [ - "libc 0.2.178", + "libc", ] [[package]] @@ -334,7 +334,7 @@ checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" dependencies = [ "addr2line", "cfg-if", - "libc 0.2.178", + "libc", "miniz_oxide", "object", "rustc-demangle", @@ -647,7 +647,7 @@ checksum = "4a6e71767585f51c2a33fed6d67147ec0343725fc3c03bf4b89fe67fede56aa5" dependencies = [ "bitflags 1.3.2", "cfg-if", - "libc 0.2.178", + "libc", ] [[package]] @@ -656,7 +656,7 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd1ddba47aba30b6a889298ad0109c3b8dcb0e8fc993b459daa7067d46f865e0" dependencies = [ - "libc 0.2.178", + "libc", ] [[package]] @@ -686,7 +686,7 @@ checksum = "7a0aeaff4ff1a90589618835a598e545176939b97874f7abc7851caa0618f203" dependencies = [ "find-msvc-tools", "jobserver", - "libc 0.2.178", + "libc", "shlex", ] @@ -732,7 +732,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" dependencies = [ "glob", - "libc 0.2.178", + "libc", "libloading", ] @@ -902,7 +902,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", - "libc 0.2.178", + "libc", ] [[package]] @@ -912,7 +912,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" dependencies = [ "core-foundation-sys", - "libc 0.2.178", + "libc", ] [[package]] @@ -936,7 +936,7 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" dependencies = [ - "libc 0.2.178", + "libc", ] [[package]] @@ -1386,7 +1386,7 @@ dependencies = [ "dataplane-tracectl", "derive_builder 0.20.2", "futures", - "libc 1.0.0-alpha.1", + "libc", "multi_index_map", "nix 0.30.1", "rtnetlink", @@ -1848,7 +1848,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" dependencies = [ - "libc 0.2.178", + "libc", "redox_users", "winapi", ] @@ -1861,7 +1861,7 @@ checksum = "89a09f22a6c6069a18470eb92d2298acf25463f14256d24778e1230d789a2aec" dependencies = [ "bitflags 2.10.0", "block2", - "libc 0.2.178", + "libc", "objc2", ] @@ -1882,7 +1882,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09b4f5f101177ff01b8ec4ecc81eead416a8aa42819a2869311b3420fa114ffa" dependencies = [ - "libc 0.2.178", + "libc", "once_cell", "winapi", ] @@ -2005,7 +2005,7 @@ version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ - "libc 0.2.178", + "libc", "windows-sys 0.61.2", ] @@ -2084,7 +2084,7 @@ checksum = "40b9e59cd0f7e0806cca4be089683ecb6434e602038df21fe6bf6711b2f07f64" dependencies = [ "cc", "lazy_static", - "libc 0.2.178", + "libc", "winapi", ] @@ -2284,7 +2284,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5cc16584ff22b460a382b7feec54b23d2908d858152e5739a120b949293bd74e" dependencies = [ "cc", - "libc 0.2.178", + "libc", "log", "rustversion", "windows", @@ -2298,7 +2298,7 @@ checksum = "52f04ae4152da20c76fe800fa48659201d5cf627c5149ca0b707b69d7eef6cf9" dependencies = [ "cc", "cfg-if", - "libc 0.2.178", + "libc", "log", "rustversion", "windows-link", @@ -2322,7 +2322,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" dependencies = [ "cfg-if", - "libc 0.2.178", + "libc", "wasi", ] @@ -2333,7 +2333,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ "cfg-if", - "libc 0.2.178", + "libc", "r-efi", "wasip2", ] @@ -2447,7 +2447,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "617aaa3557aef3810a6369d0a99fac8a080891b68bd9f9812a1eeda0c0730cbd" dependencies = [ "cfg-if", - "libc 0.2.178", + "libc", "windows-link", ] @@ -2518,7 +2518,7 @@ dependencies = [ "derive_more", "errno", "hwlocality-sys", - "libc 0.2.178", + "libc", "strum", "thiserror 2.0.17", "windows-sys 0.61.2", @@ -2530,7 +2530,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d55ff554bde432473a6d17dc219a2d7fedc1be12d1e150418526f666dc9d096" dependencies = [ - "libc 0.2.178", + "libc", "pkg-config", "windows-sys 0.61.2", ] @@ -2619,7 +2619,7 @@ dependencies = [ "http-body", "hyper", "ipnet", - "libc 0.2.178", + "libc", "percent-encoding", "pin-project-lite", "socket2", @@ -2884,7 +2884,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" dependencies = [ "getrandom 0.3.4", - "libc 0.2.178", + "libc", ] [[package]] @@ -3086,12 +3086,6 @@ version = "0.2.178" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" -[[package]] -name = "libc" -version = "1.0.0-alpha.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7222002e5385b4d9327755661e3847c970e8fbf9dea6da8c57f16e8cfbff53a8" - [[package]] name = "libflate" version = "1.4.0" @@ -3129,7 +3123,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d0b95e02c851351f877147b7deea7b1afb1df71b63aa5f8270716e0c5720616" dependencies = [ "bitflags 2.10.0", - "libc 0.2.178", + "libc", ] [[package]] @@ -3257,7 +3251,7 @@ version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "744133e4a0e0a658e1374cf3bf8e415c4052a15a111acd372764c55b4177d490" dependencies = [ - "libc 0.2.178", + "libc", ] [[package]] @@ -3375,7 +3369,7 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" dependencies = [ - "libc 0.2.178", + "libc", "log", "wasi", "windows-sys 0.61.2", @@ -3473,7 +3467,7 @@ checksum = "35a703aa1a87cd885b9f674922445a42dbb0c0f4f1b28fef21b227ae32375d21" dependencies = [ "dlopen2", "ipnet", - "libc 0.2.178", + "libc", "mac-addr", "netlink-packet-core", "netlink-packet-route 0.25.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3499,7 +3493,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ec2f5b6839be2a19d7fa5aab5bc444380f6311c2b693551cb80f45caaa7b5ef" dependencies = [ "bitflags 2.10.0", - "libc 0.2.178", + "libc", "log", "netlink-packet-core", ] @@ -3510,7 +3504,7 @@ version = "0.25.1" source = "git+https://github.com/githedgehog/netlink-packet-route.git?branch=pr%2Fdaniel-noland%2Fswing4#09b8ffdf9b4e9bbc8780a3efb4ec3494ee7ee3fd" dependencies = [ "bitflags 2.10.0", - "libc 0.2.178", + "libc", "log", "netlink-packet-core", ] @@ -3548,7 +3542,7 @@ checksum = "16c903aa70590cb93691bf97a767c8d1d6122d2cc9070433deb3bbf36ce8bd23" dependencies = [ "bytes", "futures", - "libc 0.2.178", + "libc", "log", "tokio", ] @@ -3570,7 +3564,7 @@ checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" dependencies = [ "bitflags 1.3.2", "cfg-if", - "libc 0.2.178", + "libc", ] [[package]] @@ -3582,7 +3576,7 @@ dependencies = [ "autocfg", "bitflags 1.3.2", "cfg-if", - "libc 0.2.178", + "libc", "memoffset 0.6.5", "pin-utils", ] @@ -3595,7 +3589,7 @@ checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" dependencies = [ "bitflags 2.10.0", "cfg-if", - "libc 0.2.178", + "libc", ] [[package]] @@ -3607,7 +3601,7 @@ dependencies = [ "bitflags 2.10.0", "cfg-if", "cfg_aliases", - "libc 0.2.178", + "libc", "memoffset 0.9.1", ] @@ -3620,7 +3614,7 @@ dependencies = [ "bitflags 2.10.0", "cfg-if", "cfg_aliases", - "libc 0.2.178", + "libc", "memoffset 0.9.1", ] @@ -3764,7 +3758,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" dependencies = [ "cfg-if", - "libc 0.2.178", + "libc", "redox_syscall", "smallvec", "windows-link", @@ -3960,7 +3954,7 @@ dependencies = [ "backtrace", "cfg-if", "findshlibs", - "libc 0.2.178", + "libc", "log", "nix 0.27.1", "once_cell", @@ -4149,7 +4143,7 @@ version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3a5f63b0d2727095db59045e6a0ef3259b28b90d481ae88f0e3d866d0234ce8" dependencies = [ - "libc 0.2.178", + "libc", "libflate", "log", "names", @@ -4179,7 +4173,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3ab5a9d756f0d97bdc89019bd2e4ea098cf9cde50ee7564dde6b81ccc8f06c7" dependencies = [ "crossbeam-utils", - "libc 0.2.178", + "libc", "once_cell", "raw-cpuid", "wasi", @@ -4233,7 +4227,7 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ - "libc 0.2.178", + "libc", "rand_chacha 0.3.1", "rand_core 0.6.4", ] @@ -4463,7 +4457,7 @@ dependencies = [ "cc", "cfg-if", "getrandom 0.2.16", - "libc 0.2.178", + "libc", "untrusted", "windows-sys 0.52.0", ] @@ -4556,7 +4550,7 @@ checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" dependencies = [ "bitflags 2.10.0", "errno", - "libc 0.2.178", + "libc", "linux-raw-sys 0.11.0", "windows-sys 0.61.2", ] @@ -4633,7 +4627,7 @@ dependencies = [ "bitflags 2.10.0", "cfg-if", "clipboard-win", - "libc 0.2.178", + "libc", "log", "memchr", "nix 0.30.1", @@ -4748,7 +4742,7 @@ dependencies = [ "bitflags 2.10.0", "core-foundation 0.10.1", "core-foundation-sys", - "libc 0.2.178", + "libc", "security-framework-sys", ] @@ -4759,7 +4753,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc1f0cbffaac4852523ce30d8bd3c5cdc873501d96ff467ca09b6767bb8cd5c0" dependencies = [ "core-foundation-sys", - "libc 0.2.178", + "libc", ] [[package]] @@ -5001,7 +4995,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" dependencies = [ "errno", - "libc 0.2.178", + "libc", ] [[package]] @@ -5077,7 +5071,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881" dependencies = [ - "libc 0.2.178", + "libc", "windows-sys 0.60.2", ] @@ -5236,7 +5230,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" dependencies = [ "core-foundation-sys", - "libc 0.2.178", + "libc", ] [[package]] @@ -5410,7 +5404,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" dependencies = [ "bytes", - "libc 0.2.178", + "libc", "mio", "parking_lot", "pin-project-lite", @@ -5489,7 +5483,7 @@ checksum = "8b319ef9394889dab2e1b4f0085b45ba11d0c79dc9d1a9d1afc057d009d0f1c7" dependencies = [ "bytes", "futures", - "libc 0.2.178", + "libc", "tokio", "vsock", ] @@ -5866,7 +5860,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2da6e4ac76cd19635dce0f98985378bb62f8044ee2ff80abd2a7334b920ed63" dependencies = [ - "libc 0.2.178", + "libc", "nix 0.30.1", ] diff --git a/Cargo.toml b/Cargo.toml index 39e159b03..3fb4a4852 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -129,7 +129,7 @@ color-eyre = { version = "0.6.5", default-features = false, features = [] } colored = { version = "3.0.0", default-features = false, features = [] } command-fds = { version = "0.3.2", default-features = false, features = [] } crossbeam-channel = { version = "0.5.15", default-features = false, features = [] } -ctrlc = { version = "3.5.1", default-features = false, features = [] } +ctrlc = { version = "3.5.1", default-features = false, features = [] } # TODO: remove this in favor of tokio signal handling dashmap = { version = "6.1.0", default-features = false, features = [] } derive_builder = { version = "0.20.2", default-features = false, features = [] } dotenvy = { version = "0.15.7", default-features = false, features = [] } @@ -148,7 +148,7 @@ k8s-openapi = { version = "0.26.0", default-features = false, features = [] } kanal = { version = "0.1.1", default-features = false, features = [] } kube = { version = "2.0.1", default-features = false, features = [] } left-right = { version = "0.11.6", default-features = false, features = [] } -libc = { version = "1.0.0-alpha.1", default-features = false, features = [] } +libc = { version = "0.2.178", default-features = false, features = [] } linkme = { version = "0.3.35", default-features = false, features = [] } linux-raw-sys = { version = "0.12.0", default-features = false, features = [] } log = { version = "0.4.29", default-features = false, features = [] } # TODO: try to remove this @@ -160,7 +160,7 @@ metrics-exporter-prometheus = { version = "0.18.1", default-features = false, fe miette = { version = "7.6.0", default-features = false, features = [] } mio = { version = "1.1.1", default-features = false, features = [] } multi_index_map = { version = "0.15.0", default-features = false, features = [] } -n-vm = { git = "https://github.com/githedgehog/testn.git", tag = "v0.0.9", default-features = false, features = [] } +n-vm = { git = "https://github.com/githedgehog/testn.git", tag = "v0.0.9", default-features = false, features = [] } # TODO: merge this in to the main repo netdev = { version = "0.39.0", default-features = false, features = [] } nix = { version = "0.30.1", default-features = false, features = ["socket"] } num-derive = { version = "0.4.2", default-features = false, features = [] } @@ -182,7 +182,7 @@ rand = { version = "0.9.2", default-features = false, features = [] } rapidhash = { version = "4.1.1", default-features = false, features = [] } rkyv = { version = "0.8.12", default-features = false, features = [] } roaring = { version = "0.11.2", default-features = false, features = [] } -rtnetlink = { git = "https://github.com/githedgehog/rtnetlink.git", branch = "hh/tc-actions3", default-features = false, features = [] } +rtnetlink = { git = "https://github.com/githedgehog/rtnetlink.git", branch = "hh/tc-actions3", default-features = false, features = [] } # TODO: update this rustls = { version = "0.23.35", default-features = false, features = [] } rustyline = { version = "17.0.2", default-features = false, features = [] } schemars = { version = "1", default-features = false, features = [] } @@ -213,22 +213,21 @@ uuid = { version = "1.19.0", default-features = false, features = [] } proc-macro-error2 = { version = "2.0.1", default-features = true } [profile.dev] +opt-level = 0 panic = "unwind" +debug = "full" debug-assertions = true overflow-checks = true -debug = "full" -rpath = true incremental = false [profile.release] opt-level = 3 panic = "unwind" debug = "full" -lto = true debug-assertions = false overflow-checks = false +lto = "thin" codegen-units = 1 -rpath = true [profile.fuzz] inherits = "release" diff --git a/default.nix b/default.nix index 48f3edf13..c0c3272e8 100644 --- a/default.nix +++ b/default.nix @@ -43,7 +43,7 @@ let overlays = [ overlays.rust overlays.llvm - # overlays.dataplane-dev + overlays.dataplane-dev ]; }; pkgs = @@ -154,10 +154,10 @@ let ) ); version = (craneLib.crateNameFromCargoToml { inherit src; }).version; - cargo-cmd-prefix = builtins.concatStringsSep " " [ + cargo-cmd-prefix = [ "--profile=${cargo-profile}" "-Zunstable-options" - "-Zbuild-std=compiler_builtins,std,panic_unwind,sysroot" + "-Zbuild-std=compiler_builtins,core,alloc,std,panic_unwind,sysroot" "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem" "--target=${target}" ]; @@ -184,6 +184,10 @@ let doCheck = false; strictDeps = true; dontStrip = true; + # dontFixup = true; + doRemapPathPrefix = true; + doNotRemoveReferencesToRustToolchain = true; + doNotRemoveReferencesToVendorDir = true; nativeBuildInputs = [ pkg-config @@ -209,9 +213,20 @@ let RUSTFLAGS = builtins.concatStringsSep " " ( profile'.RUSTFLAGS ++ [ - "--cfg=tokio_unstable" - "-Clink-arg=--ld-path=${devroot}/bin/ld.lld" - "-Clinker=${devroot}/bin/${cc}" + "-Clink-arg=--ld-path=${pkgs.pkgsBuildHost.llvmPackages.lld}/bin/ld.lld" + "-Clinker=${pkgs.pkgsBuildHost.llvmPackages.clang}/bin/${cc}" + # NOTE: this is basically a trick to get our source code to be available to debuggers + # Normally remap-path-prefix takes the form --remap-path-prefix=FROM=TO where FROM and TO are directories. + # This is intended to map source code paths to generic, relative, or redacted paths. + # We are sorta using that mechanism in reverse here in that the empth FROM in the next expression maps our + # source code in the debug info from the current working directory to ${src} (the nix store path we where + # we have copied our source code). + # + # This is nice in that it should allow us to include ${src} in a container with gdb / lldb + the .dwo files + # we strip out of the final binaries we cook. Then we can include gdb/lldbserver binaries in + # some debug/release-with-debug-tools containers. Then, connecting from the gdb/lldb container to the + # gdb/lldbserver container should allow us to actually debug binaries deployed to test machines. + "--remap-path-prefix==${src}" ] ); }; @@ -245,6 +260,26 @@ let '' + (orig.postBuild or ""); }); + dataplane = + let + pkgs-expr = package-expr-builder { + pname = "dataplane"; + }; + in + (pkgs.callPackage pkgs-expr { + inherit (dev-pkgs) kopium; + }).overrideAttrs + (orig: { + # I'm not 100% sure if I would call it a bug in crane or a bug in cargo, but there is no easy way to distinguish + # RUSTFLAGS intended for the build-time dependencies from the RUSTFLAGS intended for the runtime dependencies. + # One unfortunate conseqnence of this is that is you set platform specific RUSTFLAGS then the postBuild hook + # malfunctions in the cross compile. Fortunately, the "fix" is easy: just unset RUSTFLAGS before the postBuild + # hook actually runs. + postBuild = '' + unset RUSTFLAGS; + '' + + (orig.postBuild or ""); + }); in { inherit @@ -256,6 +291,7 @@ in sources sysroot cli + dataplane ; crane = craneLib; profile = profile'; diff --git a/nix/overlays/dataplane-dev.nix b/nix/overlays/dataplane-dev.nix index f71e5f4eb..e548ef9e8 100644 --- a/nix/overlays/dataplane-dev.nix +++ b/nix/overlays/dataplane-dev.nix @@ -7,23 +7,23 @@ final: prev: let override-packages = { - stdenv = final.llvmPackages'.stdenv; - rustPlatform = final.rustPlatform'; + stdenv = final.llvmPackages.stdenv; + rustPlatform = final.rustPlatform'-dev; }; in { kopium = import ../pkgs/kopium ( - { + override-packages + // { src = sources.kopium; } - // override-packages ); - cargo-bolero = prev.cargo-bolero.override override-packages; - cargo-deny = prev.cargo-deny.override override-packages; + cargo-bolero = prev.cargo-bolero.override { inherit (override-packages) rustPlatform; }; + cargo-deny = prev.cargo-deny.override { inherit (override-packages) rustPlatform; }; cargo-llvm-cov = prev.cargo-llvm-cov.override override-packages; cargo-nextest = prev.cargo-nextest.override override-packages; just = prev.just.override override-packages; - npins = prev.npins.override override-packages; + npins = prev.npins.override { inherit (override-packages) rustPlatform; }; gateway-crd = let p = "config/crd/bases/gwint.githedgehog.com_gatewayagents.yaml"; diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index bd68736b1..1b4cc6603 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -3,7 +3,6 @@ { sources, sanitizers, - platform, ... }: final: prev: @@ -193,28 +192,19 @@ in # # Also, while this library has a respectable security track record, this is also a very strong candidate for # cfi, safe-stack, and cf-protection. - dpdk = - (dataplane-dep ( - final.callPackage ../pkgs/dpdk (platform.override.dpdk.buildInputs // { src = sources.dpdk; }) - )).override - { - inherit (final.fancy) - rdma-core - libnl - libbsd - numactl - ; - }; + dpdk = dataplane-dep (final.callPackage ../pkgs/dpdk (final.fancy // { src = sources.dpdk; })); # DPDK is largely composed of static-inline functions. # We need to wrap those functions with "_w" variants so that we can actually call them from rust. # # This wrapping process does not really cause any performance issue due to lto; the compiler is going to "unwrap" # these methods anyway. - dpdk-wrapper = dataplane-dep (final.callPackage ../pkgs/dpdk-wrapper { }); + dpdk-wrapper = dataplane-dep (final.callPackage ../pkgs/dpdk-wrapper final.fancy); + # TODO: consistent packages pciutils = dataplane-dep (prev.pciutils.override { static = true; }); + # TODO: consistent packages, min deps hwloc = ((dataplane-dep prev.hwloc).override { inherit (final.fancy) numactl; @@ -233,5 +223,7 @@ in }); # This isn't directly required by dataplane, - perftest = dataplane-dep (final.callPackage ../pkgs/perftest { src = sources.perftest; }); + perftest = dataplane-dep ( + final.callPackage ../pkgs/perftest final.fancy // { src = sources.perftest; } + ); } diff --git a/nix/overlays/llvm.nix b/nix/overlays/llvm.nix index 5e0f00ef5..4e7f4f977 100644 --- a/nix/overlays/llvm.nix +++ b/nix/overlays/llvm.nix @@ -26,13 +26,18 @@ let lld ]; }) final.llvmPackages.stdenv; - # note: rust-bin comes from oxa's overlay, not nixpkgs + # note: rust-bin comes from oxa's overlay, not nixpkgs. This overlay only works if you have a rust overlay as well. rust-toolchain = prev.rust-bin.fromRustupToolchainFile ../../rust-toolchain.toml; rustPlatform' = prev.makeRustPlatform { stdenv = stdenv'; cargo = rust-toolchain; rustc = rust-toolchain; }; + rustPlatform'-dev = prev.makeRustPlatform { + stdenv = final.llvmPackages.stdenv; + cargo = rust-toolchain; + rustc = rust-toolchain; + }; # It is essential that we always use the same version of llvm that our rustc is backed by. # To minimize maintenance burden, we explicitly compute the version of LLVM we need by asking rustc # which version it is using. @@ -54,6 +59,6 @@ let ); in { - inherit rust-toolchain rustPlatform'; + inherit rust-toolchain rustPlatform' rustPlatform'-dev stdenv'; llvmPackages' = prev."llvmPackages_${llvm-version}"; } diff --git a/nix/pkgs/dpdk-wrapper/default.nix b/nix/pkgs/dpdk-wrapper/default.nix index 60ffe4623..4ea99b383 100644 --- a/nix/pkgs/dpdk-wrapper/default.nix +++ b/nix/pkgs/dpdk-wrapper/default.nix @@ -4,6 +4,7 @@ stdenv, dpdk, libbsd, + ... }: stdenv.mkDerivation { pname = "dpdk-wrapper"; diff --git a/nix/pkgs/dpdk/default.nix b/nix/pkgs/dpdk/default.nix index c20ff00f3..abfcc8644 100644 --- a/nix/pkgs/dpdk/default.nix +++ b/nix/pkgs/dpdk/default.nix @@ -8,7 +8,7 @@ meson, ninja, libbsd, - numactl, + # numactl, rdma-core, libnl, python3, @@ -18,6 +18,7 @@ platform = "bluefield3"; }, writeText, + ... }: stdenv.mkDerivation { @@ -35,7 +36,7 @@ stdenv.mkDerivation { buildInputs = [ libbsd libnl - numactl + # numactl rdma-core ]; @@ -286,7 +287,7 @@ stdenv.mkDerivation { "-Ddefault_library=static" "-Denable_docs=false" "-Denable_driver_sdk=false" - "-Dmax_numa_nodes=8" + "-Dmax_numa_nodes=1" "-Dtests=false" # Running DPDK tests in CI is usually silly "-Duse_hpet=false" "-Ddebug=false" diff --git a/nix/pkgs/kopium/default.nix b/nix/pkgs/kopium/default.nix index 6b3e2bf56..d5d9b4dd7 100644 --- a/nix/pkgs/kopium/default.nix +++ b/nix/pkgs/kopium/default.nix @@ -1,6 +1,7 @@ { src, rustPlatform, + ... }: rustPlatform.buildRustPackage (final: { pname = "kopium"; diff --git a/nix/pkgs/perftest/default.nix b/nix/pkgs/perftest/default.nix index 0bc0ee783..8b1bc9b3e 100644 --- a/nix/pkgs/perftest/default.nix +++ b/nix/pkgs/perftest/default.nix @@ -4,6 +4,7 @@ rdma-core, autoreconfHook, pciutils, + ... }: stdenv.mkDerivation (final: { pname = "perftest"; diff --git a/nix/platforms.nix b/nix/platforms.nix index 3c5b7825c..50ee66e34 100644 --- a/nix/platforms.nix +++ b/nix/platforms.nix @@ -18,9 +18,6 @@ let NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; NIX_CFLAGS_LINK = [ ]; }; - dpdk = { - buildInputs = { }; - }; }; }; x86-64-v4 = lib.recursiveUpdate x86-64-v3 rec { @@ -68,11 +65,6 @@ let NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; NIX_CFLAGS_LINK = [ ]; }; - dpdk = { - buildInputs = { - numactl = null; - }; - }; }; }; bluefield3 = lib.recursiveUpdate bluefield2 rec { diff --git a/nix/profiles.nix b/nix/profiles.nix index f13c701fe..ba618ac97 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -22,6 +22,7 @@ let "-fuse-ld=lld" ]; common.RUSTFLAGS = [ + "--cfg=tokio_unstable" "-Cdebuginfo=full" "-Cdwarf-version=5" "-Csymbol-mangling-version=v0" @@ -41,8 +42,7 @@ let ++ (map (flag: "-Clink-arg=${flag}") optimize-for.debug.NIX_CFLAGS_LINK); optimize-for.performance.NIX_CFLAGS_COMPILE = [ "-O3" - "-flto=full" - "-fsplit-lto-unit" # important for compatibility with rust's LTO + "-flto=thin" ]; optimize-for.performance.NIX_CXXFLAGS_COMPILE = optimize-for.performance.NIX_CFLAGS_COMPILE ++ [ "-fwhole-program-vtables" @@ -53,14 +53,8 @@ let "-Wl,--as-needed" ]; optimize-for.performance.RUSTFLAGS = [ - "-Copt-level=3" - "-Cdebug-assertions=off" - "-Coverflow-checks=off" "-Clinker-plugin-lto" "-Cembed-bitcode=yes" - "-Clto=true" - "-Ccodegen-units=1" - "-Zsplit-lto-unit" ] ++ (map (flag: "-Clink-arg=${flag}") optimize-for.performance.NIX_CFLAGS_LINK); secure.NIX_CFLAGS_COMPILE = [ @@ -68,13 +62,14 @@ let "-fstack-clash-protection" # we always want pic/pie and GOT offsets should be computed at compile time whenever possible "-Wl,-z,relro,-z,now" - # "-fcf-protection=full" # requires extra testing before we enable + "-fcf-protection=full" # requires extra testing before we enable ]; secure.NIX_CXXFLAGS_COMPILE = secure.NIX_CFLAGS_COMPILE; # handing the CFLAGS back to clang/lld is basically required for -fsanitize secure.NIX_CFLAGS_LINK = secure.NIX_CFLAGS_COMPILE; secure.RUSTFLAGS = [ "-Crelro-level=full" + "-Zcf-protection=full" ] ++ (map (flag: "-Clink-arg=${flag}") secure.NIX_CFLAGS_LINK); march.x86_64.NIX_CFLAGS_COMPILE = [ @@ -142,7 +137,7 @@ let # NOTE: you also want to enable -Wl,--lto-whole-program-visibility in the linker flags if visibility=default so that # symbols can be refined to hidden visibility at link time. # This "whole-program-visibility" flag is already enabled by the optimize profile, and - # given that the optimize profile is required for cfi to even bild, we don't explicitly enable it again here. + # given that the optimize profile is required for cfi to even build, we don't explicitly enable it again here. "-fvisibility=default" # required to properly link with rust "-fsanitize-cfi-icall-experimental-normalize-integers" @@ -150,6 +145,8 @@ let # Type fudging is common in C code, especially in cases where function pointers are used with lax const correctness. # Ideally we wouldn't enable this, but we can't really re-write all of the C code in the world. "-fsanitize-cfi-icall-generalize-pointers" + # "-fsanitize-cfi-cross-dso" + "-fsplit-lto-unit" # important for compatibility with rust's LTO ]; sanitize.cfi.NIX_CXXFLAGS_COMPILE = sanitize.cfi.NIX_CFLAGS_COMPILE; sanitize.cfi.NIX_CFLAGS_LINK = sanitize.cfi.NIX_CFLAGS_COMPILE; @@ -157,6 +154,8 @@ let "-Zsanitizer=cfi" "-Zsanitizer-cfi-normalize-integers" "-Zsanitizer-cfi-generalize-pointers" + # "-Zsanitizer-cfi-cross-dso" + "-Zsplit-lto-unit" ] ++ (map (flag: "-Clink-arg=${flag}") sanitize.cfi.NIX_CFLAGS_LINK); sanitize.safe-stack.NIX_CFLAGS_COMPILE = [ diff --git a/shell.nix b/shell.nix deleted file mode 100644 index ef124bdb4..000000000 --- a/shell.nix +++ /dev/null @@ -1,57 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 -# Copyright Open Network Fabric Authors -{ - overlay ? "dataplane", - platform ? "x86-64-v3", - libc ? "gnu", - prof ? "debug", - instrumentation ? "none", - sanitize ? "address", -}: -let - d = import ./default.nix { - inherit - overlay - platform - libc - prof - instrumentation - sanitize - ; - }; - pkgs = import {}; -in -(d.pkgs-super.buildPackages.buildFHSEnv { - name = "dataplane-dev"; - targetPkgs = - pkgs: with pkgs; [ - stdenv.cc.libc.dev - stdenv.cc.libc.out - # libmd.dev - # libmd.static - libbsd.dev - # libbsd.static - numactl.dev - # numactl.static - rdma-core.dev - # rdma-core.static - # dpdk.dev - # dpdk.static - # dpdk-wrapper.dev - # dpdk-wrapper.out - ]; - # (with pkgs.buildPackages; [ - # # dev tools - # bash - # direnv - # just - # nil - # nixd - # npins - # wget - # llvmPackages.bintools - # llvmPackages.clang - # llvmPackages.libclang.lib - # llvmPackages.lld - # ]); -}).env From 3af2498a393135997b1a000183166e35913f73dd Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Wed, 31 Dec 2025 00:04:42 +0000 Subject: [PATCH 154/163] wip --- default.nix | 29 +++++++++++++++++++++++++++-- ld.script | 35 +++++++++++++++++++++++++++++++++++ nix/profiles.nix | 11 ++++++++--- 3 files changed, 70 insertions(+), 5 deletions(-) create mode 100644 ld.script diff --git a/default.nix b/default.nix index c0c3272e8..b082d74d3 100644 --- a/default.nix +++ b/default.nix @@ -58,6 +58,7 @@ let name = "sysroot"; paths = with pkgs.pkgsHostHost; [ pkgs.pkgsHostHost.libc.dev + pkgs.pkgsHostHost.libc.static pkgs.pkgsHostHost.libc.out fancy.libmd.dev fancy.libmd.static @@ -209,12 +210,12 @@ let PKG_CONFIG_PATH = "${sysroot}/lib/pkgconfig"; GW_CRD_PATH = "${dev-pkgs.gateway-crd}/src/gateway/config/crd/bases"; RUSTC_BOOTSTRAP = "1"; - CARGO_BUILD_RUSTFLAGS = ""; RUSTFLAGS = builtins.concatStringsSep " " ( profile'.RUSTFLAGS ++ [ - "-Clink-arg=--ld-path=${pkgs.pkgsBuildHost.llvmPackages.lld}/bin/ld.lld" "-Clinker=${pkgs.pkgsBuildHost.llvmPackages.clang}/bin/${cc}" + "-Clink-arg=--ld-path=${pkgs.pkgsBuildHost.llvmPackages.lld}/bin/ld.lld" + "-Clink-arg=-Wl,T${src}/ld.script" # NOTE: this is basically a trick to get our source code to be available to debuggers # Normally remap-path-prefix takes the form --remap-path-prefix=FROM=TO where FROM and TO are directories. # This is intended to map source code paths to generic, relative, or redacted paths. @@ -260,6 +261,29 @@ let '' + (orig.postBuild or ""); }); + + packages = builtins.mapAttrs ( + dir: pname: + let + pkgs-expr = package-expr-builder { + inherit pname; + }; + in + (pkgs.callPackage pkgs-expr { + inherit (dev-pkgs) kopium; + }).overrideAttrs + (orig: { + # # I'm not 100% sure if I would call it a bug in crane or a bug in cargo, but there is no easy way to distinguish + # # RUSTFLAGS intended for the build-time dependencies from the RUSTFLAGS intended for the runtime dependencies. + # # One unfortunate conseqnence of this is that is you set platform specific RUSTFLAGS then the postBuild hook + # # malfunctions in the cross compile. Fortunately, the "fix" is easy: just unset RUSTFLAGS before the postBuild + # # hook actually runs. + # postBuild = '' + # unset RUSTFLAGS; + # '' + # + (orig.postBuild or ""); + }) + ) package-list; dataplane = let pkgs-expr = package-expr-builder { @@ -292,6 +316,7 @@ in sysroot cli dataplane + packages ; crane = craneLib; profile = profile'; diff --git a/ld.script b/ld.script new file mode 100644 index 000000000..f333a25ca --- /dev/null +++ b/ld.script @@ -0,0 +1,35 @@ +/* ------------------------------------------------------------- + * linker.ld – forces the .text segment onto a 2‑MiB hugepage. + * ------------------------------------------------------------- + */ +SECTIONS +{ + /* Place the code at the very beginning of the file image */ + . = 0x400000; /* typical default load address */ + .text : { + *(.text*) /* all .text sections from objects */ + } > flash /* “flash” is just a name; not a real region */ + + .rodata : { + *(.rodata*) + } + + .data : { + *(.data*) + } + + .bss : { + *(.bss*) + } +} + +/* ----------------------------------------------------------------- + * Force the first PT_LOAD (the code segment) to have a 2‑MiB alignment. + * ----------------------------------------------------------------- + */ +PHDRS +{ + text PT_LOAD FLAGS(5) /* PF_R | PF_X */ ALIGN(0x200000); + rodata PT_LOAD FLAGS(4) /* PF_R */ ALIGN(0x200000); + data PT_LOAD FLAGS(6) /* PF_R | PF_W */ ALIGN(0x200000); +} diff --git a/nix/profiles.nix b/nix/profiles.nix index ba618ac97..e93e4843d 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -48,13 +48,18 @@ let "-fwhole-program-vtables" ]; optimize-for.performance.NIX_CFLAGS_LINK = optimize-for.performance.NIX_CXXFLAGS_COMPILE ++ [ - "-Wl,--lto-whole-program-visibility" - "-Wl,--gc-sections" - "-Wl,--as-needed" + # "-Wl,--lto-whole-program-visibility" + # "-Wl,--gc-sections" + # "-Wl,--as-needed" + "-Wl,-z,common-page-size=0x200000" + "-Wl,-z,max-page-size=0x200000" ]; optimize-for.performance.RUSTFLAGS = [ "-Clinker-plugin-lto" "-Cembed-bitcode=yes" + "-Clink-arg=-Wl,-z,common-page-size=0x200000" + "-Clink-arg=-Wl,-z,max-page-size=0x200000" + "-Ctarget-feature=+crt-static" ] ++ (map (flag: "-Clink-arg=${flag}") optimize-for.performance.NIX_CFLAGS_LINK); secure.NIX_CFLAGS_COMPILE = [ From 8447f5ae769d797fc47b271994f3d2c3e7bf4fa9 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Wed, 31 Dec 2025 01:49:09 +0000 Subject: [PATCH 155/163] wip --- default.nix | 3 ++- ld.script | 35 ----------------------------------- nix/profiles.nix | 11 +++-------- 3 files changed, 5 insertions(+), 44 deletions(-) delete mode 100644 ld.script diff --git a/default.nix b/default.nix index b082d74d3..97e45e03c 100644 --- a/default.nix +++ b/default.nix @@ -215,7 +215,8 @@ let ++ [ "-Clinker=${pkgs.pkgsBuildHost.llvmPackages.clang}/bin/${cc}" "-Clink-arg=--ld-path=${pkgs.pkgsBuildHost.llvmPackages.lld}/bin/ld.lld" - "-Clink-arg=-Wl,T${src}/ld.script" + # "-Clink-arg=-T" + # "-Clink-arg=${./ld.script}" # NOTE: this is basically a trick to get our source code to be available to debuggers # Normally remap-path-prefix takes the form --remap-path-prefix=FROM=TO where FROM and TO are directories. # This is intended to map source code paths to generic, relative, or redacted paths. diff --git a/ld.script b/ld.script deleted file mode 100644 index f333a25ca..000000000 --- a/ld.script +++ /dev/null @@ -1,35 +0,0 @@ -/* ------------------------------------------------------------- - * linker.ld – forces the .text segment onto a 2‑MiB hugepage. - * ------------------------------------------------------------- - */ -SECTIONS -{ - /* Place the code at the very beginning of the file image */ - . = 0x400000; /* typical default load address */ - .text : { - *(.text*) /* all .text sections from objects */ - } > flash /* “flash” is just a name; not a real region */ - - .rodata : { - *(.rodata*) - } - - .data : { - *(.data*) - } - - .bss : { - *(.bss*) - } -} - -/* ----------------------------------------------------------------- - * Force the first PT_LOAD (the code segment) to have a 2‑MiB alignment. - * ----------------------------------------------------------------- - */ -PHDRS -{ - text PT_LOAD FLAGS(5) /* PF_R | PF_X */ ALIGN(0x200000); - rodata PT_LOAD FLAGS(4) /* PF_R */ ALIGN(0x200000); - data PT_LOAD FLAGS(6) /* PF_R | PF_W */ ALIGN(0x200000); -} diff --git a/nix/profiles.nix b/nix/profiles.nix index e93e4843d..ba618ac97 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -48,18 +48,13 @@ let "-fwhole-program-vtables" ]; optimize-for.performance.NIX_CFLAGS_LINK = optimize-for.performance.NIX_CXXFLAGS_COMPILE ++ [ - # "-Wl,--lto-whole-program-visibility" - # "-Wl,--gc-sections" - # "-Wl,--as-needed" - "-Wl,-z,common-page-size=0x200000" - "-Wl,-z,max-page-size=0x200000" + "-Wl,--lto-whole-program-visibility" + "-Wl,--gc-sections" + "-Wl,--as-needed" ]; optimize-for.performance.RUSTFLAGS = [ "-Clinker-plugin-lto" "-Cembed-bitcode=yes" - "-Clink-arg=-Wl,-z,common-page-size=0x200000" - "-Clink-arg=-Wl,-z,max-page-size=0x200000" - "-Ctarget-feature=+crt-static" ] ++ (map (flag: "-Clink-arg=${flag}") optimize-for.performance.NIX_CFLAGS_LINK); secure.NIX_CFLAGS_COMPILE = [ From 38ab338cca8ef34fd2def326ee3a81ff10b4838a Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Thu, 1 Jan 2026 21:40:29 +0000 Subject: [PATCH 156/163] more fancy --- default.nix | 104 ++++++++++++------------------------- nix/overlays/dataplane.nix | 25 +++++++-- nix/profiles.nix | 1 + npins/sources.json | 14 ++--- 4 files changed, 61 insertions(+), 83 deletions(-) diff --git a/default.nix b/default.nix index 97e45e03c..255544b2e 100644 --- a/default.nix +++ b/default.nix @@ -58,24 +58,24 @@ let name = "sysroot"; paths = with pkgs.pkgsHostHost; [ pkgs.pkgsHostHost.libc.dev - pkgs.pkgsHostHost.libc.static pkgs.pkgsHostHost.libc.out - fancy.libmd.dev - fancy.libmd.static + fancy.dpdk-wrapper.dev + fancy.dpdk-wrapper.out + fancy.dpdk.dev + fancy.dpdk.static + fancy.hwloc.dev + fancy.hwloc.static fancy.libbsd.dev fancy.libbsd.static + fancy.libmd.dev + fancy.libmd.static fancy.libnl.dev fancy.libnl.static + fancy.libunwind.out fancy.numactl.dev fancy.numactl.static fancy.rdma-core.dev fancy.rdma-core.static - dpdk.dev - dpdk.static - dpdk-wrapper.dev - dpdk-wrapper.out - hwloc.dev - hwloc.static ]; }; clangd-config = pkgs.writeTextFile { @@ -159,7 +159,7 @@ let "--profile=${cargo-profile}" "-Zunstable-options" "-Zbuild-std=compiler_builtins,core,alloc,std,panic_unwind,sysroot" - "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem" + "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem,llvm-libunwind" "--target=${target}" ]; package-expr-builder = @@ -189,6 +189,7 @@ let doRemapPathPrefix = true; doNotRemoveReferencesToRustToolchain = true; doNotRemoveReferencesToVendorDir = true; + separateDebugInfo = true; nativeBuildInputs = [ pkg-config @@ -198,7 +199,7 @@ let ]; buildInputs = [ - hwloc.static + hwloc ]; env = { @@ -215,18 +216,17 @@ let ++ [ "-Clinker=${pkgs.pkgsBuildHost.llvmPackages.clang}/bin/${cc}" "-Clink-arg=--ld-path=${pkgs.pkgsBuildHost.llvmPackages.lld}/bin/ld.lld" - # "-Clink-arg=-T" - # "-Clink-arg=${./ld.script}" - # NOTE: this is basically a trick to get our source code to be available to debuggers - # Normally remap-path-prefix takes the form --remap-path-prefix=FROM=TO where FROM and TO are directories. + "-Clink-arg=-L${sysroot}/lib" + # NOTE: this is basically a trick to make our source code available to debuggers. + # Normally remap-path-prefix takes the form --remap-path-prefix=FROM=TO where FROM and TO are directories. # This is intended to map source code paths to generic, relative, or redacted paths. - # We are sorta using that mechanism in reverse here in that the empth FROM in the next expression maps our - # source code in the debug info from the current working directory to ${src} (the nix store path we where - # we have copied our source code). + # We are sorta using that mechanism in reverse here in that the empty FROM in the next expression maps our + # source code in the debug info from the current working directory to ${src} (the nix store path where we + # have copied our source code). # - # This is nice in that it should allow us to include ${src} in a container with gdb / lldb + the .dwo files - # we strip out of the final binaries we cook. Then we can include gdb/lldbserver binaries in - # some debug/release-with-debug-tools containers. Then, connecting from the gdb/lldb container to the + # This is nice in that it should allow us to include ${src} in a container with gdb / lldb + the debug files + # we strip out of the final binaries we cook and include a gdbserver binary in some + # debug/release-with-debug-tools containers. Then, connecting from the gdb/lldb container to the # gdb/lldbserver container should allow us to actually debug binaries deployed to test machines. "--remap-path-prefix==${src}" ] @@ -242,27 +242,6 @@ let ); cargoExtraArgs = (if pname != null then "--package=${pname} " else "") + "--target=${target}"; }; - cli = - let - pkgs-expr = package-expr-builder { - pname = "dataplane-cli"; - }; - in - (pkgs.callPackage pkgs-expr { - inherit (dev-pkgs) kopium; - }).overrideAttrs - (orig: { - # I'm not 100% sure if I would call it a bug in crane or a bug in cargo, but there is no easy way to distinguish - # RUSTFLAGS intended for the build-time dependencies from the RUSTFLAGS intended for the runtime dependencies. - # One unfortunate conseqnence of this is that is you set platform specific RUSTFLAGS then the postBuild hook - # malfunctions in the cross compile. Fortunately, the "fix" is easy: just unset RUSTFLAGS before the postBuild - # hook actually runs. - postBuild = '' - unset RUSTFLAGS; - '' - + (orig.postBuild or ""); - }); - packages = builtins.mapAttrs ( dir: pname: let @@ -272,39 +251,24 @@ let in (pkgs.callPackage pkgs-expr { inherit (dev-pkgs) kopium; + # inherit (pkgs.fancy) hwloc; }).overrideAttrs (orig: { - # # I'm not 100% sure if I would call it a bug in crane or a bug in cargo, but there is no easy way to distinguish - # # RUSTFLAGS intended for the build-time dependencies from the RUSTFLAGS intended for the runtime dependencies. - # # One unfortunate conseqnence of this is that is you set platform specific RUSTFLAGS then the postBuild hook - # # malfunctions in the cross compile. Fortunately, the "fix" is easy: just unset RUSTFLAGS before the postBuild - # # hook actually runs. - # postBuild = '' - # unset RUSTFLAGS; - # '' - # + (orig.postBuild or ""); - }) - ) package-list; - dataplane = - let - pkgs-expr = package-expr-builder { - pname = "dataplane"; - }; - in - (pkgs.callPackage pkgs-expr { - inherit (dev-pkgs) kopium; - }).overrideAttrs - (orig: { - # I'm not 100% sure if I would call it a bug in crane or a bug in cargo, but there is no easy way to distinguish - # RUSTFLAGS intended for the build-time dependencies from the RUSTFLAGS intended for the runtime dependencies. - # One unfortunate conseqnence of this is that is you set platform specific RUSTFLAGS then the postBuild hook - # malfunctions in the cross compile. Fortunately, the "fix" is easy: just unset RUSTFLAGS before the postBuild - # hook actually runs. + separateDebugInfo = true; + + # I'm not 100% sure if I would call it a bug in crane or a bug in cargo, but cross compile is tricky here. + # There is no easy way to distinguish RUSTFLAGS intended for the build-time dependencies from the RUSTFLAGS + # intended for the runtime dependencies. + # One unfortunate consequence of this is that if you set platform specific RUSTFLAGS then the postBuild hook + # malfunctions. Fortunately, the "fix" is easy: just unset RUSTFLAGS before the postBuild hook actually runs. + # We don't need to set any optimization flags for postBuild tooling anyway. postBuild = '' unset RUSTFLAGS; '' + (orig.postBuild or ""); - }); + + }) + ) package-list; in { inherit @@ -315,8 +279,6 @@ in package-list sources sysroot - cli - dataplane packages ; crane = craneLib; diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix index 1b4cc6603..f61090748 100644 --- a/nix/overlays/dataplane.nix +++ b/nix/overlays/dataplane.nix @@ -192,24 +192,39 @@ in # # Also, while this library has a respectable security track record, this is also a very strong candidate for # cfi, safe-stack, and cf-protection. - dpdk = dataplane-dep (final.callPackage ../pkgs/dpdk (final.fancy // { src = sources.dpdk; })); + fancy.dpdk = dataplane-dep ( + final.callPackage ../pkgs/dpdk (final.fancy // { src = sources.dpdk; }) + ); # DPDK is largely composed of static-inline functions. # We need to wrap those functions with "_w" variants so that we can actually call them from rust. # # This wrapping process does not really cause any performance issue due to lto; the compiler is going to "unwrap" # these methods anyway. - dpdk-wrapper = dataplane-dep (final.callPackage ../pkgs/dpdk-wrapper final.fancy); + fancy.dpdk-wrapper = dataplane-dep (final.callPackage ../pkgs/dpdk-wrapper final.fancy); # TODO: consistent packages - pciutils = dataplane-dep (prev.pciutils.override { static = true; }); + fancy.pciutils = dataplane-dep ( + final.pciutils.override { + static = true; + kmod = null; + zlib = null; + } + ); + + fancy.libunwind = (dataplane-dep final.llvmPackages.libunwind).override { enableShared = false; }; # TODO: consistent packages, min deps - hwloc = + fancy.hwloc = ((dataplane-dep prev.hwloc).override { inherit (final.fancy) numactl; cairo = null; + cudaPackages = null; + enableCuda = false; + expat = null; libX11 = null; + ncurses = null; + x11Support = false; }).overrideAttrs (orig: { outputs = (orig.outputs or [ ]) ++ [ "static" ]; @@ -223,7 +238,7 @@ in }); # This isn't directly required by dataplane, - perftest = dataplane-dep ( + fancy.perftest = dataplane-dep ( final.callPackage ../pkgs/perftest final.fancy // { src = sources.perftest; } ); } diff --git a/nix/profiles.nix b/nix/profiles.nix index ba618ac97..6ea45d7a1 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -20,6 +20,7 @@ let # getting proper LTO from LLVM compiled objects is best done with lld rather than ld, mold, or wild (at least at the # time of writing) "-fuse-ld=lld" + "-Wl,--build-id" ]; common.RUSTFLAGS = [ "--cfg=tokio_unstable" diff --git a/npins/sources.json b/npins/sources.json index f3ef1c158..c7ccc9635 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -100,11 +100,11 @@ "owner": "githedgehog", "repo": "rdma-core" }, - "branch": "fix-lto-60.0", + "branch": "fix-lto-61.0", "submodules": false, - "revision": "9ae1b26593e2cb53239e1124f88ce1698d53857e", - "url": "https://github.com/githedgehog/rdma-core/archive/9ae1b26593e2cb53239e1124f88ce1698d53857e.tar.gz", - "hash": "sha256-JAf7r0I+MuppH/cbBd0ZrXVAjPPeWo/oFcDFpJ7TTbY=" + "revision": "998375a38e27e66bc74ed7419a0b93d0066e8194", + "url": "https://github.com/githedgehog/rdma-core/archive/998375a38e27e66bc74ed7419a0b93d0066e8194.tar.gz", + "hash": "sha256-Qm5IhgRI5k+sDdBzyTIILg60jlmYroGWYyERSHKfuV4=" }, "rust-overlay": { "type": "Git", @@ -115,9 +115,9 @@ }, "branch": "master", "submodules": false, - "revision": "943d2d0bf1b86267287aff826ebd1138d83113b7", - "url": "https://github.com/oxalica/rust-overlay/archive/943d2d0bf1b86267287aff826ebd1138d83113b7.tar.gz", - "hash": "sha256-hfKAOJQYbR0mlwabV56tOlEMUgESRroHqlDpX0hwOpU=" + "revision": "2be15c4abeba7ade2cf9bc4c17ab310441e533b9", + "url": "https://github.com/oxalica/rust-overlay/archive/2be15c4abeba7ade2cf9bc4c17ab310441e533b9.tar.gz", + "hash": "sha256-l4ftzyoD7XX0biEoTEwhOkFhvHhmggkVQyl2jEES0so=" } }, "version": 7 From 414671e40c8d206fe2a30988501029adc16166ce Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Thu, 1 Jan 2026 23:21:34 +0000 Subject: [PATCH 157/163] tests sorta workin --- default.nix | 121 ++++++++++++++++++++++++++++++++++++++++++++ rust-toolchain.toml | 2 +- 2 files changed, 122 insertions(+), 1 deletion(-) diff --git a/default.nix b/default.nix index 255544b2e..6bc1e2fb6 100644 --- a/default.nix +++ b/default.nix @@ -269,6 +269,126 @@ let }) ) package-list; + package-test-builder = + { + cargoArtifacts ? null, + pname ? null, + }: + { + pkg-config, + kopium, + llvmPackages, + hwloc, + cargo-nextest, + }: + craneLib.mkCargoDerivation { + inherit + src + version + pname + cargoArtifacts + cargoVendorDir + ; + + doCheck = false; + strictDeps = true; + dontStrip = true; + doRemapPathPrefix = true; + doNotRemoveReferencesToRustToolchain = true; + doNotRemoveReferencesToVendorDir = true; + separateDebugInfo = true; + + nativeBuildInputs = [ + pkg-config + kopium + llvmPackages.clang + llvmPackages.lld + cargo-nextest + ]; + + buildInputs = [ + hwloc + ]; + + env = { + CARGO_PROFILE = cargo-profile; + DATAPLANE_SYSROOT = "${sysroot}"; + LIBCLANG_PATH = "${pkgs.pkgsBuildHost.llvmPackages.libclang.lib}/lib"; + C_INCLUDE_PATH = "${sysroot}/include"; + LIBRARY_PATH = "${sysroot}/lib"; + PKG_CONFIG_PATH = "${sysroot}/lib/pkgconfig"; + GW_CRD_PATH = "${dev-pkgs.gateway-crd}/src/gateway/config/crd/bases"; + RUSTC_BOOTSTRAP = "1"; + RUSTFLAGS = builtins.concatStringsSep " " ( + profile'.RUSTFLAGS + ++ [ + "-Clinker=${pkgs.pkgsBuildHost.llvmPackages.clang}/bin/${cc}" + "-Clink-arg=--ld-path=${pkgs.pkgsBuildHost.llvmPackages.lld}/bin/ld.lld" + "-Clink-arg=-L${sysroot}/lib" + # NOTE: this is basically a trick to make our source code available to debuggers. + # Normally remap-path-prefix takes the form --remap-path-prefix=FROM=TO where FROM and TO are directories. + # This is intended to map source code paths to generic, relative, or redacted paths. + # We are sorta using that mechanism in reverse here in that the empty FROM in the next expression maps our + # source code in the debug info from the current working directory to ${src} (the nix store path where we + # have copied our source code). + # + # This is nice in that it should allow us to include ${src} in a container with gdb / lldb + the debug files + # we strip out of the final binaries we cook and include a gdbserver binary in some + # debug/release-with-debug-tools containers. Then, connecting from the gdb/lldb container to the + # gdb/lldbserver container should allow us to actually debug binaries deployed to test machines. + "--remap-path-prefix==${src}" + ] + ); + }; + + buildPhaseCargoCommand = builtins.concatStringsSep " " ([ + "cargo" + "nextest" + "archive" + "--archive-file" + "$out/${pname}.tar.zst" + "--cargo-profile=${cargo-profile}" + "-Zunstable-options" + "-Zbuild-std=compiler_builtins,core,alloc,std,panic_unwind,sysroot" + "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem,llvm-libunwind" + "--target=${target}" + "--package=${pname}" + ]); + }; + tests = builtins.mapAttrs ( + dir: pname: + let + pkgs-expr = package-test-builder { + inherit pname; + }; + in + (pkgs.callPackage pkgs-expr { + inherit (dev-pkgs) kopium; + # inherit (pkgs.fancy) hwloc; + }).overrideAttrs + (orig: { + separateDebugInfo = true; + # cargoArtifacts = packages.${dir}; + + preBuild = '' + mkdir $out + ''; + # I'm not 100% sure if I would call it a bug in crane or a bug in cargo, but cross compile is tricky here. + # There is no easy way to distinguish RUSTFLAGS intended for the build-time dependencies from the RUSTFLAGS + # intended for the runtime dependencies. + # One unfortunate consequence of this is that if you set platform specific RUSTFLAGS then the postBuild hook + # malfunctions. Fortunately, the "fix" is easy: just unset RUSTFLAGS before the postBuild hook actually runs. + # We don't need to set any optimization flags for postBuild tooling anyway. + postBuild = '' + unset RUSTFLAGS; + '' + + (orig.postBuild or ""); + + postFixup = '' + rm -f $out/target.tar.zst + ''; + }) + ) package-list; in { inherit @@ -280,6 +400,7 @@ in sources sysroot packages + tests ; crane = craneLib; profile = profile'; diff --git a/rust-toolchain.toml b/rust-toolchain.toml index b3a0d7bb3..6c3cbe31a 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -12,7 +12,7 @@ components = [ "rust-analyzer", "rust-src", - ## other (disabled) components + ## disabled components ## # "rust-mingw", # not relevant to us # "llvm-tools", # we already have a full llvm in the npins, no need for another # "miri", # not yet functional for us From 44dc024af4effae0d5aeb4ca86d143d0484352dc Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Thu, 1 Jan 2026 23:59:12 +0000 Subject: [PATCH 158/163] clippy? --- default.nix | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) diff --git a/default.nix b/default.nix index 6bc1e2fb6..acef38ae0 100644 --- a/default.nix +++ b/default.nix @@ -384,6 +384,119 @@ let '' + (orig.postBuild or ""); + postFixup = '' + rm -f $out/target.tar.zst + ''; + }) + ) package-list; + package-clippy-builder = + { + cargoArtifacts ? null, + pname ? null, + }: + { + pkg-config, + kopium, + llvmPackages, + hwloc, + cargo-nextest, + }: + craneLib.mkCargoDerivation { + inherit + src + version + pname + cargoArtifacts + cargoVendorDir + ; + + doCheck = false; + strictDeps = true; + dontStrip = true; + doRemapPathPrefix = true; + doNotRemoveReferencesToRustToolchain = true; + doNotRemoveReferencesToVendorDir = true; + separateDebugInfo = true; + + nativeBuildInputs = [ + pkg-config + kopium + llvmPackages.clang + llvmPackages.lld + cargo-nextest + ]; + + buildInputs = [ + hwloc + ]; + + env = { + CARGO_PROFILE = cargo-profile; + DATAPLANE_SYSROOT = "${sysroot}"; + LIBCLANG_PATH = "${pkgs.pkgsBuildHost.llvmPackages.libclang.lib}/lib"; + C_INCLUDE_PATH = "${sysroot}/include"; + LIBRARY_PATH = "${sysroot}/lib"; + PKG_CONFIG_PATH = "${sysroot}/lib/pkgconfig"; + GW_CRD_PATH = "${dev-pkgs.gateway-crd}/src/gateway/config/crd/bases"; + RUSTC_BOOTSTRAP = "1"; + RUSTFLAGS = builtins.concatStringsSep " " ( + profile'.RUSTFLAGS + ++ [ + "-Clinker=${pkgs.pkgsBuildHost.llvmPackages.clang}/bin/${cc}" + "-Clink-arg=--ld-path=${pkgs.pkgsBuildHost.llvmPackages.lld}/bin/ld.lld" + "-Clink-arg=-L${sysroot}/lib" + # NOTE: this is basically a trick to make our source code available to debuggers. + # Normally remap-path-prefix takes the form --remap-path-prefix=FROM=TO where FROM and TO are directories. + # This is intended to map source code paths to generic, relative, or redacted paths. + # We are sorta using that mechanism in reverse here in that the empty FROM in the next expression maps our + # source code in the debug info from the current working directory to ${src} (the nix store path where we + # have copied our source code). + # + # This is nice in that it should allow us to include ${src} in a container with gdb / lldb + the debug files + # we strip out of the final binaries we cook and include a gdbserver binary in some + # debug/release-with-debug-tools containers. Then, connecting from the gdb/lldb container to the + # gdb/lldbserver container should allow us to actually debug binaries deployed to test machines. + "--remap-path-prefix==${src}" + ] + ); + }; + + buildPhaseCargoCommand = builtins.concatStringsSep " " ([ + "cargo" + "clippy" + "--target=${target}" + "--package=${pname}" + ]); + }; + clippy = builtins.mapAttrs ( + dir: pname: + let + pkgs-expr = package-clippy-builder { + inherit pname; + }; + in + (pkgs.callPackage pkgs-expr { + inherit (dev-pkgs) kopium; + # inherit (pkgs.fancy) hwloc; + }).overrideAttrs + (orig: { + separateDebugInfo = true; + # cargoArtifacts = packages.${dir}; + + preBuild = '' + mkdir $out + ''; + # I'm not 100% sure if I would call it a bug in crane or a bug in cargo, but cross compile is tricky here. + # There is no easy way to distinguish RUSTFLAGS intended for the build-time dependencies from the RUSTFLAGS + # intended for the runtime dependencies. + # One unfortunate consequence of this is that if you set platform specific RUSTFLAGS then the postBuild hook + # malfunctions. Fortunately, the "fix" is easy: just unset RUSTFLAGS before the postBuild hook actually runs. + # We don't need to set any optimization flags for postBuild tooling anyway. + postBuild = '' + unset RUSTFLAGS; + '' + + (orig.postBuild or ""); + postFixup = '' rm -f $out/target.tar.zst ''; @@ -401,6 +514,7 @@ in sysroot packages tests + clippy ; crane = craneLib; profile = profile'; From 238eae91d1bb6c94de31f350acdea24b8e538756 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Fri, 2 Jan 2026 02:05:12 +0000 Subject: [PATCH 159/163] separate build deps mostly working --- default.nix | 157 ++++++++++++++++++++++++++++++++++++++++++----- nix/profiles.nix | 4 +- 2 files changed, 143 insertions(+), 18 deletions(-) diff --git a/default.nix b/default.nix index acef38ae0..ad93b5533 100644 --- a/default.nix +++ b/default.nix @@ -157,12 +157,12 @@ let version = (craneLib.crateNameFromCargoToml { inherit src; }).version; cargo-cmd-prefix = [ "--profile=${cargo-profile}" - "-Zunstable-options" - "-Zbuild-std=compiler_builtins,core,alloc,std,panic_unwind,sysroot" - "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem,llvm-libunwind" + # "-Zunstable-options" + # "-Zbuild-std=compiler_builtins,core,alloc,std,panic_unwind,sysroot" + # "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem,llvm-libunwind" "--target=${target}" ]; - package-expr-builder = + builder-expr = { cargoArtifacts ? null, pname ? null, @@ -173,7 +173,7 @@ let llvmPackages, hwloc, }: - craneLib.buildPackage { + craneLib.buildDepsOnly { inherit src version @@ -182,6 +182,7 @@ let cargoVendorDir ; + # # noCompressDebugSectionsSet = true; doCheck = false; strictDeps = true; dontStrip = true; @@ -233,20 +234,139 @@ let ); }; - cargoBuildCommand = builtins.concatStringsSep " " ( + buildPhaseCargoCommand = builtins.concatStringsSep " " ( [ "cargo" "build" ] ++ cargo-cmd-prefix ); - cargoExtraArgs = (if pname != null then "--package=${pname} " else "") + "--target=${target}"; + }; + deps = builtins.mapAttrs ( + dir: pname: + let + pkgs-expr = builder-expr { + inherit pname; + }; + in + (pkgs.callPackage pkgs-expr { + inherit (dev-pkgs) kopium; + }).overrideAttrs + (orig: { + # separateDebugInfo = true; + + # I'm not 100% sure if I would call it a bug in crane or a bug in cargo, but cross compile is tricky here. + # There is no easy way to distinguish RUSTFLAGS intended for the build-time dependencies from the RUSTFLAGS + # intended for the runtime dependencies. + # One unfortunate consequence of this is that if you set platform specific RUSTFLAGS then the postBuild hook + # malfunctions. Fortunately, the "fix" is easy: just unset RUSTFLAGS before the postBuild hook actually runs. + # We don't need to set any optimization flags for postBuild tooling anyway. + # postBuild = '' + # unset RUSTFLAGS; + # '' + # + (orig.postBuild or ""); + + }) + ) package-list; + package-expr-builder = + { + cargoArtifacts ? null, + pname ? null, + }: + { + pkg-config, + kopium, + llvmPackages, + hwloc, + }: + craneLib.buildPackage { + inherit + src + version + pname + cargoArtifacts + cargoVendorDir + ; + + doCheck = false; + strictDeps = true; + dontStrip = true; + dontFixup = true; + doRemapPathPrefix = true; + doNotRemoveReferencesToRustToolchain = true; + doNotRemoveReferencesToVendorDir = true; + # separateDebugInfo = true; + + nativeBuildInputs = [ + pkg-config + kopium + llvmPackages.clang + llvmPackages.lld + ]; + + buildInputs = [ + hwloc + ]; + + env = { + CARGO_PROFILE = cargo-profile; + DATAPLANE_SYSROOT = "${sysroot}"; + LIBCLANG_PATH = "${pkgs.pkgsBuildHost.llvmPackages.libclang.lib}/lib"; + C_INCLUDE_PATH = "${sysroot}/include"; + LIBRARY_PATH = "${sysroot}/lib"; + PKG_CONFIG_PATH = "${sysroot}/lib/pkgconfig"; + GW_CRD_PATH = "${dev-pkgs.gateway-crd}/src/gateway/config/crd/bases"; + RUSTC_BOOTSTRAP = "1"; + RUSTFLAGS = builtins.concatStringsSep " " ( + profile'.RUSTFLAGS + ++ [ + "-Clinker=${pkgs.pkgsBuildHost.llvmPackages.clang}/bin/${cc}" + "-Clink-arg=--ld-path=${pkgs.pkgsBuildHost.llvmPackages.lld}/bin/ld.lld" + "-Clink-arg=-L${sysroot}/lib" + # NOTE: this is basically a trick to make our source code available to debuggers. + # Normally remap-path-prefix takes the form --remap-path-prefix=FROM=TO where FROM and TO are directories. + # This is intended to map source code paths to generic, relative, or redacted paths. + # We are sorta using that mechanism in reverse here in that the empty FROM in the next expression maps our + # source code in the debug info from the current working directory to ${src} (the nix store path where we + # have copied our source code). + # + # This is nice in that it should allow us to include ${src} in a container with gdb / lldb + the debug files + # we strip out of the final binaries we cook and include a gdbserver binary in some + # debug/release-with-debug-tools containers. Then, connecting from the gdb/lldb container to the + # gdb/lldbserver container should allow us to actually debug binaries deployed to test machines. + "--remap-path-prefix==${src}" + ] + ); + }; + + buildPhaseCargoCommand = '' + cargoBuildLog=$(mktemp cargoBuildLogXXXX.json) + '' + + (builtins.concatStringsSep " " ( + [ + "cargo" + "build" + ] + ++ cargo-cmd-prefix + ++ [ + "--message-format json-render-diagnostics >$cargoBuildLog" + ] + )); + # cargoBuildCommand = builtins.concatStringsSep " " ( + # [ + # "cargo" + # "build" + # ] + # ++ cargo-cmd-prefix + # ); + # cargoExtraArgs = (if pname != null then "--package=${pname} " else "") + "--target=${target}"; }; packages = builtins.mapAttrs ( dir: pname: let pkgs-expr = package-expr-builder { inherit pname; + cargoArtifacts = deps.${dir}; }; in (pkgs.callPackage pkgs-expr { @@ -254,7 +374,7 @@ let # inherit (pkgs.fancy) hwloc; }).overrideAttrs (orig: { - separateDebugInfo = true; + # separateDebugInfo = true; # I'm not 100% sure if I would call it a bug in crane or a bug in cargo, but cross compile is tricky here. # There is no easy way to distinguish RUSTFLAGS intended for the build-time dependencies from the RUSTFLAGS @@ -262,10 +382,10 @@ let # One unfortunate consequence of this is that if you set platform specific RUSTFLAGS then the postBuild hook # malfunctions. Fortunately, the "fix" is easy: just unset RUSTFLAGS before the postBuild hook actually runs. # We don't need to set any optimization flags for postBuild tooling anyway. - postBuild = '' - unset RUSTFLAGS; - '' - + (orig.postBuild or ""); + # postBuild = '' + # unset RUSTFLAGS; + # '' + # + (orig.postBuild or ""); }) ) package-list; @@ -296,7 +416,7 @@ let doRemapPathPrefix = true; doNotRemoveReferencesToRustToolchain = true; doNotRemoveReferencesToVendorDir = true; - separateDebugInfo = true; + # separateDebugInfo = true; nativeBuildInputs = [ pkg-config @@ -461,18 +581,23 @@ let ); }; - buildPhaseCargoCommand = builtins.concatStringsSep " " ([ + buildPhaseCargoCommand = builtins.concatStringsSep " " [ "cargo" "clippy" + "--profile=${cargo-profile}" + "-Zunstable-options" + "-Zbuild-std=compiler_builtins,core,alloc,std,panic_unwind,sysroot" + "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem,llvm-libunwind" "--target=${target}" "--package=${pname}" - ]); + ]; }; clippy = builtins.mapAttrs ( dir: pname: let pkgs-expr = package-clippy-builder { inherit pname; + cargoArtifacts = packages.${dir}; }; in (pkgs.callPackage pkgs-expr { @@ -481,7 +606,6 @@ let }).overrideAttrs (orig: { separateDebugInfo = true; - # cargoArtifacts = packages.${dir}; preBuild = '' mkdir $out @@ -515,6 +639,7 @@ in packages tests clippy + deps ; crane = craneLib; profile = profile'; diff --git a/nix/profiles.nix b/nix/profiles.nix index 6ea45d7a1..a5067531a 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -63,14 +63,14 @@ let "-fstack-clash-protection" # we always want pic/pie and GOT offsets should be computed at compile time whenever possible "-Wl,-z,relro,-z,now" - "-fcf-protection=full" # requires extra testing before we enable + # "-fcf-protection=full" # requires extra testing before we enable ]; secure.NIX_CXXFLAGS_COMPILE = secure.NIX_CFLAGS_COMPILE; # handing the CFLAGS back to clang/lld is basically required for -fsanitize secure.NIX_CFLAGS_LINK = secure.NIX_CFLAGS_COMPILE; secure.RUSTFLAGS = [ "-Crelro-level=full" - "-Zcf-protection=full" + # "-Zcf-protection=full" ] ++ (map (flag: "-Clink-arg=${flag}") secure.NIX_CFLAGS_LINK); march.x86_64.NIX_CFLAGS_COMPILE = [ From 0feb81d75c496acba3c99d853a9ae3f7970e71e1 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Fri, 2 Jan 2026 05:52:13 +0000 Subject: [PATCH 160/163] container time --- Dockerfile | 24 +++++++++++++------- default.nix | 63 +++++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 70 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6a1cd5433..02db27c1a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,16 @@ -ARG BASE -FROM $BASE AS dataplane -ARG ARTIFACT -ARG ARTIFACT_CLI -COPY --link --chown=0:0 "${ARTIFACT}" /dataplane -COPY --link --chown=0:0 "${ARTIFACT_CLI}" /dataplane-cli -WORKDIR / -ENTRYPOINT ["/dataplane"] +# ARG BASE +# FROM $BASE AS dataplane +# ARG ARTIFACT +# ARG ARTIFACT_CLI +# COPY --link --chown=0:0 "${ARTIFACT}" /dataplane +# COPY --link --chown=0:0 "${ARTIFACT_CLI}" /dataplane-cli +# WORKDIR / +# ENTRYPOINT ["/dataplane"] + +FROM containers-base:v0.0.0 as base-image +ADD \ + --unpack=true \ + --chown=root:root \ + --chmod=500 \ + ./dataplane.tar / +ENTRYPOINT [ "/bin/dataplane" ] diff --git a/default.nix b/default.nix index ad93b5533..5567e47c4 100644 --- a/default.nix +++ b/default.nix @@ -157,9 +157,9 @@ let version = (craneLib.crateNameFromCargoToml { inherit src; }).version; cargo-cmd-prefix = [ "--profile=${cargo-profile}" - # "-Zunstable-options" - # "-Zbuild-std=compiler_builtins,core,alloc,std,panic_unwind,sysroot" - # "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem,llvm-libunwind" + "-Zunstable-options" + "-Zbuild-std=compiler_builtins,core,alloc,std,panic_unwind,sysroot" + "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem,llvm-libunwind" "--target=${target}" ]; builder-expr = @@ -374,7 +374,7 @@ let # inherit (pkgs.fancy) hwloc; }).overrideAttrs (orig: { - # separateDebugInfo = true; + separateDebugInfo = true; # I'm not 100% sure if I would call it a bug in crane or a bug in cargo, but cross compile is tricky here. # There is no easy way to distinguish RUSTFLAGS intended for the build-time dependencies from the RUSTFLAGS @@ -382,11 +382,19 @@ let # One unfortunate consequence of this is that if you set platform specific RUSTFLAGS then the postBuild hook # malfunctions. Fortunately, the "fix" is easy: just unset RUSTFLAGS before the postBuild hook actually runs. # We don't need to set any optimization flags for postBuild tooling anyway. - # postBuild = '' - # unset RUSTFLAGS; - # '' - # + (orig.postBuild or ""); - + postBuild = (orig.postBuild or "") + '' + unset RUSTFLAGS; + ''; + postInstall = (orig.postInstall or "") + '' + mkdir -p $debug/bin + for f in $out/bin/*; do + strip --only-keep-debug "$f" -o "$out/bin/$(basename "$f").dbg" + strip --strip-debug "$f" + cd $out/bin + objcopy --add-gnu-debuglink="$(basename "$f").dbg" "$(basename "$f")" + mv "$(basename "$f")".dbg "$debug/bin/" + done + ''; }) ) package-list; package-test-builder = @@ -626,6 +634,40 @@ let ''; }) ) package-list; + env.base = pkgs.buildEnv { + name = "base-env"; + pathsToLink = [ + "/etc" + "/var" + ]; + paths = [ + pkgs.pkgsHostHost.libc.out + pkgs.pkgsHostHost.libgcc.libgcc + pkgs.pkgsHostHost.dockerTools.fakeNss + ]; + }; + containers.base = pkgs.dockerTools.buildImage { + name = "containers-base"; + tag = "v0.0.0"; + copyToRoot = env.base; + }; + dataplane-tar = pkgs.stdenv'.mkDerivation { + pname = "dataplane-tar"; + version = "0.0.0"; + dontUnpack = true; + src = null; + buildPhase = '' + tmp="$(mktemp -d)" + mkdir -p "$tmp/"{bin,var,run} + mkdir -p "$tmp/run/dataplane" "$tmp/run/frr/hh" "$tmp/run/dataplane" + ln -s /run "$tmp/var/run" + cp "${packages.dataplane}/bin/dataplane" "$tmp/bin/" + cp "${packages.cli}/bin/cli" "$tmp/bin/cli" + ln -s cli "$tmp/bin/sh" + cd "$tmp" + tar -czvf "$out" . + ''; + }; in { inherit @@ -640,6 +682,9 @@ in tests clippy deps + containers + env + dataplane-tar ; crane = craneLib; profile = profile'; From f0d1456104ae452d9d2cf50159bcf9874c3d0069 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Fri, 2 Jan 2026 18:08:52 +0000 Subject: [PATCH 161/163] cleanup happening --- default.nix | 186 +++++++++++++++++++++++++++------------------------- 1 file changed, 96 insertions(+), 90 deletions(-) diff --git a/default.nix b/default.nix index 5567e47c4..b0c0ba016 100644 --- a/default.nix +++ b/default.nix @@ -162,98 +162,79 @@ let "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem,llvm-libunwind" "--target=${target}" ]; - builder-expr = + invoke = { - cargoArtifacts ? null, - pname ? null, - }: - { - pkg-config, - kopium, - llvmPackages, + builder, + args ? { + pname = null; + cargoArtifacts = null; + }, hwloc, + llvmPackages, + pkg-config, }: - craneLib.buildDepsOnly { - inherit - src - version - pname - cargoArtifacts - cargoVendorDir - ; + (builder ( + { + inherit + src + version + cargoVendorDir + ; - # # noCompressDebugSectionsSet = true; - doCheck = false; - strictDeps = true; - dontStrip = true; - # dontFixup = true; - doRemapPathPrefix = true; - doNotRemoveReferencesToRustToolchain = true; - doNotRemoveReferencesToVendorDir = true; - separateDebugInfo = true; + doCheck = false; + strictDeps = true; + dontStrip = true; + doRemapPathPrefix = true; + doNotRemoveReferencesToRustToolchain = true; + doNotRemoveReferencesToVendorDir = true; + separateDebugInfo = true; - nativeBuildInputs = [ - pkg-config - kopium - llvmPackages.clang - llvmPackages.lld - ]; + nativeBuildInputs = [ + pkg-config + (dev-pkgs.kopium) + llvmPackages.clang + llvmPackages.lld + ]; - buildInputs = [ - hwloc - ]; + buildInputs = [ + hwloc + ]; - env = { - CARGO_PROFILE = cargo-profile; - DATAPLANE_SYSROOT = "${sysroot}"; - LIBCLANG_PATH = "${pkgs.pkgsBuildHost.llvmPackages.libclang.lib}/lib"; - C_INCLUDE_PATH = "${sysroot}/include"; - LIBRARY_PATH = "${sysroot}/lib"; - PKG_CONFIG_PATH = "${sysroot}/lib/pkgconfig"; - GW_CRD_PATH = "${dev-pkgs.gateway-crd}/src/gateway/config/crd/bases"; - RUSTC_BOOTSTRAP = "1"; - RUSTFLAGS = builtins.concatStringsSep " " ( - profile'.RUSTFLAGS - ++ [ - "-Clinker=${pkgs.pkgsBuildHost.llvmPackages.clang}/bin/${cc}" - "-Clink-arg=--ld-path=${pkgs.pkgsBuildHost.llvmPackages.lld}/bin/ld.lld" - "-Clink-arg=-L${sysroot}/lib" - # NOTE: this is basically a trick to make our source code available to debuggers. - # Normally remap-path-prefix takes the form --remap-path-prefix=FROM=TO where FROM and TO are directories. - # This is intended to map source code paths to generic, relative, or redacted paths. - # We are sorta using that mechanism in reverse here in that the empty FROM in the next expression maps our - # source code in the debug info from the current working directory to ${src} (the nix store path where we - # have copied our source code). - # - # This is nice in that it should allow us to include ${src} in a container with gdb / lldb + the debug files - # we strip out of the final binaries we cook and include a gdbserver binary in some - # debug/release-with-debug-tools containers. Then, connecting from the gdb/lldb container to the - # gdb/lldbserver container should allow us to actually debug binaries deployed to test machines. - "--remap-path-prefix==${src}" - ] - ); - }; - - buildPhaseCargoCommand = builtins.concatStringsSep " " ( - [ - "cargo" - "build" - ] - ++ cargo-cmd-prefix - ); - }; - deps = builtins.mapAttrs ( - dir: pname: - let - pkgs-expr = builder-expr { - inherit pname; - }; - in - (pkgs.callPackage pkgs-expr { - inherit (dev-pkgs) kopium; - }).overrideAttrs + env = { + CARGO_PROFILE = cargo-profile; + DATAPLANE_SYSROOT = "${sysroot}"; + LIBCLANG_PATH = "${pkgs.pkgsBuildHost.llvmPackages.libclang.lib}/lib"; + C_INCLUDE_PATH = "${sysroot}/include"; + LIBRARY_PATH = "${sysroot}/lib"; + PKG_CONFIG_PATH = "${sysroot}/lib/pkgconfig"; + GW_CRD_PATH = "${dev-pkgs.gateway-crd}/src/gateway/config/crd/bases"; + RUSTC_BOOTSTRAP = "1"; + RUSTFLAGS = builtins.concatStringsSep " " ( + profile'.RUSTFLAGS + ++ [ + "-Clinker=${pkgs.pkgsBuildHost.llvmPackages.clang}/bin/${cc}" + "-Clink-arg=--ld-path=${pkgs.pkgsBuildHost.llvmPackages.lld}/bin/ld.lld" + "-Clink-arg=-L${sysroot}/lib" + # NOTE: this is basically a trick to make our source code available to debuggers. + # Normally remap-path-prefix takes the form --remap-path-prefix=FROM=TO where FROM and TO are directories. + # This is intended to map source code paths to generic, relative, or redacted paths. + # We are sorta using that mechanism in reverse here in that the empty FROM in the next expression maps our + # source code in the debug info from the current working directory to ${src} (the nix store path where we + # have copied our source code). + # + # This is nice in that it should allow us to include ${src} in a container with gdb / lldb + the debug files + # we strip out of the final binaries we cook and include a gdbserver binary in some + # debug/release-with-debug-tools containers. Then, connecting from the gdb/lldb container to the + # gdb/lldbserver container should allow us to actually debug binaries deployed to test machines. + "--remap-path-prefix==${src}" + ] + ); + }; + } + // args + )).overrideAttrs (orig: { - # separateDebugInfo = true; + separateDebugInfo = true; # I'm not 100% sure if I would call it a bug in crane or a bug in cargo, but cross compile is tricky here. # There is no easy way to distinguish RUSTFLAGS intended for the build-time dependencies from the RUSTFLAGS @@ -261,11 +242,36 @@ let # One unfortunate consequence of this is that if you set platform specific RUSTFLAGS then the postBuild hook # malfunctions. Fortunately, the "fix" is easy: just unset RUSTFLAGS before the postBuild hook actually runs. # We don't need to set any optimization flags for postBuild tooling anyway. - # postBuild = '' - # unset RUSTFLAGS; - # '' - # + (orig.postBuild or ""); + postBuild = '' + unset RUSTFLAGS; + '' + + (orig.postBuild or ""); + }); + builder-expr = + { + pname ? null, + cargoArtifacts ? null, + }: + (pkgs.callPackage invoke { + builder = craneLib.buildDepsOnly; + args = { + inherit pname cargoArtifacts; + buildPhaseCargoCommand = builtins.concatStringsSep " " ( + [ + "cargo" + "build" + ] + ++ cargo-cmd-prefix + ); + }; + }); + deps = builtins.mapAttrs ( + dir: pname: + (pkgs.callPackage builder-expr { + inherit pname; + }).overrideAttrs + (orig: { }) ) package-list; package-expr-builder = @@ -631,7 +637,8 @@ let postFixup = '' rm -f $out/target.tar.zst - ''; + '' + + (orig.postFixup or ""); }) ) package-list; env.base = pkgs.buildEnv { @@ -686,7 +693,6 @@ in env dataplane-tar ; - crane = craneLib; profile = profile'; platform = platform'; } From d32dbc9f0d57c7f37ed069537e5b44c9f0e81e15 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Fri, 2 Jan 2026 20:59:17 +0000 Subject: [PATCH 162/163] more cleanup --- default.nix | 439 +++++++++++----------------------------------------- 1 file changed, 88 insertions(+), 351 deletions(-) diff --git a/default.nix b/default.nix index b0c0ba016..12543af42 100644 --- a/default.nix +++ b/default.nix @@ -169,6 +169,7 @@ let pname = null; cargoArtifacts = null; }, + cargo-nextest, hwloc, llvmPackages, pkg-config, @@ -190,10 +191,11 @@ let separateDebugInfo = true; nativeBuildInputs = [ - pkg-config (dev-pkgs.kopium) + cargo-nextest llvmPackages.clang llvmPackages.lld + pkg-config ]; buildInputs = [ @@ -242,13 +244,24 @@ let # One unfortunate consequence of this is that if you set platform specific RUSTFLAGS then the postBuild hook # malfunctions. Fortunately, the "fix" is easy: just unset RUSTFLAGS before the postBuild hook actually runs. # We don't need to set any optimization flags for postBuild tooling anyway. - postBuild = '' + postBuild = (orig.postBuild or "") + '' unset RUSTFLAGS; - '' - + (orig.postBuild or ""); - + ''; + postInstall = (orig.postInstall or "") + '' + mkdir -p $debug/bin + for f in $out/bin/*; do + strip --only-keep-debug "$f" -o "$out/bin/$(basename "$f").dbg" + strip --strip-debug "$f" + cd $out/bin + objcopy --add-gnu-debuglink="$(basename "$f").dbg" "$(basename "$f")" + mv "$(basename "$f")".dbg "$debug/bin/" + done + ''; + postFixup = (orig.postFixup or "") + '' + rm -f $out/target.tar.zst + ''; }); - builder-expr = + dep-builder = { pname ? null, cargoArtifacts ? null, @@ -268,378 +281,102 @@ let }); deps = builtins.mapAttrs ( dir: pname: - (pkgs.callPackage builder-expr { + dep-builder { inherit pname; - }).overrideAttrs - (orig: { - }) + } ) package-list; - package-expr-builder = + package-builder = { - cargoArtifacts ? null, pname ? null, + cargoArtifacts ? null, }: - { - pkg-config, - kopium, - llvmPackages, - hwloc, - }: - craneLib.buildPackage { - inherit - src - version - pname - cargoArtifacts - cargoVendorDir - ; - - doCheck = false; - strictDeps = true; - dontStrip = true; - dontFixup = true; - doRemapPathPrefix = true; - doNotRemoveReferencesToRustToolchain = true; - doNotRemoveReferencesToVendorDir = true; - # separateDebugInfo = true; - - nativeBuildInputs = [ - pkg-config - kopium - llvmPackages.clang - llvmPackages.lld - ]; - - buildInputs = [ - hwloc - ]; - - env = { - CARGO_PROFILE = cargo-profile; - DATAPLANE_SYSROOT = "${sysroot}"; - LIBCLANG_PATH = "${pkgs.pkgsBuildHost.llvmPackages.libclang.lib}/lib"; - C_INCLUDE_PATH = "${sysroot}/include"; - LIBRARY_PATH = "${sysroot}/lib"; - PKG_CONFIG_PATH = "${sysroot}/lib/pkgconfig"; - GW_CRD_PATH = "${dev-pkgs.gateway-crd}/src/gateway/config/crd/bases"; - RUSTC_BOOTSTRAP = "1"; - RUSTFLAGS = builtins.concatStringsSep " " ( - profile'.RUSTFLAGS + pkgs.callPackage invoke { + builder = craneLib.buildPackage; + args = { + inherit pname cargoArtifacts; + buildPhaseCargoCommand = '' + cargoBuildLog=$(mktemp cargoBuildLogXXXX.json) + '' + + (builtins.concatStringsSep " " ( + [ + "cargo" + "build" + ] + ++ cargo-cmd-prefix ++ [ - "-Clinker=${pkgs.pkgsBuildHost.llvmPackages.clang}/bin/${cc}" - "-Clink-arg=--ld-path=${pkgs.pkgsBuildHost.llvmPackages.lld}/bin/ld.lld" - "-Clink-arg=-L${sysroot}/lib" - # NOTE: this is basically a trick to make our source code available to debuggers. - # Normally remap-path-prefix takes the form --remap-path-prefix=FROM=TO where FROM and TO are directories. - # This is intended to map source code paths to generic, relative, or redacted paths. - # We are sorta using that mechanism in reverse here in that the empty FROM in the next expression maps our - # source code in the debug info from the current working directory to ${src} (the nix store path where we - # have copied our source code). - # - # This is nice in that it should allow us to include ${src} in a container with gdb / lldb + the debug files - # we strip out of the final binaries we cook and include a gdbserver binary in some - # debug/release-with-debug-tools containers. Then, connecting from the gdb/lldb container to the - # gdb/lldbserver container should allow us to actually debug binaries deployed to test machines. - "--remap-path-prefix==${src}" + "--message-format json-render-diagnostics >$cargoBuildLog" ] - ); + )); }; - - buildPhaseCargoCommand = '' - cargoBuildLog=$(mktemp cargoBuildLogXXXX.json) - '' - + (builtins.concatStringsSep " " ( - [ - "cargo" - "build" - ] - ++ cargo-cmd-prefix - ++ [ - "--message-format json-render-diagnostics >$cargoBuildLog" - ] - )); - # cargoBuildCommand = builtins.concatStringsSep " " ( - # [ - # "cargo" - # "build" - # ] - # ++ cargo-cmd-prefix - # ); - # cargoExtraArgs = (if pname != null then "--package=${pname} " else "") + "--target=${target}"; }; packages = builtins.mapAttrs ( dir: pname: - let - pkgs-expr = package-expr-builder { - inherit pname; - cargoArtifacts = deps.${dir}; - }; - in - (pkgs.callPackage pkgs-expr { - inherit (dev-pkgs) kopium; - # inherit (pkgs.fancy) hwloc; - }).overrideAttrs - (orig: { - separateDebugInfo = true; - - # I'm not 100% sure if I would call it a bug in crane or a bug in cargo, but cross compile is tricky here. - # There is no easy way to distinguish RUSTFLAGS intended for the build-time dependencies from the RUSTFLAGS - # intended for the runtime dependencies. - # One unfortunate consequence of this is that if you set platform specific RUSTFLAGS then the postBuild hook - # malfunctions. Fortunately, the "fix" is easy: just unset RUSTFLAGS before the postBuild hook actually runs. - # We don't need to set any optimization flags for postBuild tooling anyway. - postBuild = (orig.postBuild or "") + '' - unset RUSTFLAGS; - ''; - postInstall = (orig.postInstall or "") + '' - mkdir -p $debug/bin - for f in $out/bin/*; do - strip --only-keep-debug "$f" -o "$out/bin/$(basename "$f").dbg" - strip --strip-debug "$f" - cd $out/bin - objcopy --add-gnu-debuglink="$(basename "$f").dbg" "$(basename "$f")" - mv "$(basename "$f")".dbg "$debug/bin/" - done - ''; - }) + package-builder { + inherit pname; + cargoArtifacts = deps.${dir}; + } ) package-list; - package-test-builder = + test-builder = { - cargoArtifacts ? null, pname ? null, + cargoArtifacts ? null, }: - { - pkg-config, - kopium, - llvmPackages, - hwloc, - cargo-nextest, - }: - craneLib.mkCargoDerivation { - inherit - src - version - pname - cargoArtifacts - cargoVendorDir - ; - - doCheck = false; - strictDeps = true; - dontStrip = true; - doRemapPathPrefix = true; - doNotRemoveReferencesToRustToolchain = true; - doNotRemoveReferencesToVendorDir = true; - # separateDebugInfo = true; - - nativeBuildInputs = [ - pkg-config - kopium - llvmPackages.clang - llvmPackages.lld - cargo-nextest - ]; - - buildInputs = [ - hwloc - ]; - - env = { - CARGO_PROFILE = cargo-profile; - DATAPLANE_SYSROOT = "${sysroot}"; - LIBCLANG_PATH = "${pkgs.pkgsBuildHost.llvmPackages.libclang.lib}/lib"; - C_INCLUDE_PATH = "${sysroot}/include"; - LIBRARY_PATH = "${sysroot}/lib"; - PKG_CONFIG_PATH = "${sysroot}/lib/pkgconfig"; - GW_CRD_PATH = "${dev-pkgs.gateway-crd}/src/gateway/config/crd/bases"; - RUSTC_BOOTSTRAP = "1"; - RUSTFLAGS = builtins.concatStringsSep " " ( - profile'.RUSTFLAGS - ++ [ - "-Clinker=${pkgs.pkgsBuildHost.llvmPackages.clang}/bin/${cc}" - "-Clink-arg=--ld-path=${pkgs.pkgsBuildHost.llvmPackages.lld}/bin/ld.lld" - "-Clink-arg=-L${sysroot}/lib" - # NOTE: this is basically a trick to make our source code available to debuggers. - # Normally remap-path-prefix takes the form --remap-path-prefix=FROM=TO where FROM and TO are directories. - # This is intended to map source code paths to generic, relative, or redacted paths. - # We are sorta using that mechanism in reverse here in that the empty FROM in the next expression maps our - # source code in the debug info from the current working directory to ${src} (the nix store path where we - # have copied our source code). - # - # This is nice in that it should allow us to include ${src} in a container with gdb / lldb + the debug files - # we strip out of the final binaries we cook and include a gdbserver binary in some - # debug/release-with-debug-tools containers. Then, connecting from the gdb/lldb container to the - # gdb/lldbserver container should allow us to actually debug binaries deployed to test machines. - "--remap-path-prefix==${src}" - ] - ); + pkgs.callPackage invoke { + builder = craneLib.mkCargoDerivation; + args = { + inherit pname cargoArtifacts; + buildPhaseCargoCommand = builtins.concatStringsSep " " [ + "mkdir -p $out;" + "cargo" + "nextest" + "archive" + "--archive-file" + "$out/${pname}.tar.zst" + "--cargo-profile=${cargo-profile}" + "-Zunstable-options" + "-Zbuild-std=compiler_builtins,core,alloc,std,panic_unwind,sysroot" + "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem,llvm-libunwind" + "--target=${target}" + "--package=${pname}" + ]; }; - - buildPhaseCargoCommand = builtins.concatStringsSep " " ([ - "cargo" - "nextest" - "archive" - "--archive-file" - "$out/${pname}.tar.zst" - "--cargo-profile=${cargo-profile}" - "-Zunstable-options" - "-Zbuild-std=compiler_builtins,core,alloc,std,panic_unwind,sysroot" - "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem,llvm-libunwind" - "--target=${target}" - "--package=${pname}" - ]); }; tests = builtins.mapAttrs ( dir: pname: - let - pkgs-expr = package-test-builder { - inherit pname; - }; - in - (pkgs.callPackage pkgs-expr { - inherit (dev-pkgs) kopium; - # inherit (pkgs.fancy) hwloc; - }).overrideAttrs - (orig: { - separateDebugInfo = true; - # cargoArtifacts = packages.${dir}; - - preBuild = '' - mkdir $out - ''; - # I'm not 100% sure if I would call it a bug in crane or a bug in cargo, but cross compile is tricky here. - # There is no easy way to distinguish RUSTFLAGS intended for the build-time dependencies from the RUSTFLAGS - # intended for the runtime dependencies. - # One unfortunate consequence of this is that if you set platform specific RUSTFLAGS then the postBuild hook - # malfunctions. Fortunately, the "fix" is easy: just unset RUSTFLAGS before the postBuild hook actually runs. - # We don't need to set any optimization flags for postBuild tooling anyway. - postBuild = '' - unset RUSTFLAGS; - '' - + (orig.postBuild or ""); - - postFixup = '' - rm -f $out/target.tar.zst - ''; - }) + test-builder { + inherit pname; + # cargoArtifacts = deps.${dir}; + } ) package-list; - package-clippy-builder = + clippy-builder = { - cargoArtifacts ? null, pname ? null, }: - { - pkg-config, - kopium, - llvmPackages, - hwloc, - cargo-nextest, - }: - craneLib.mkCargoDerivation { - inherit - src - version - pname - cargoArtifacts - cargoVendorDir - ; - - doCheck = false; - strictDeps = true; - dontStrip = true; - doRemapPathPrefix = true; - doNotRemoveReferencesToRustToolchain = true; - doNotRemoveReferencesToVendorDir = true; - separateDebugInfo = true; - - nativeBuildInputs = [ - pkg-config - kopium - llvmPackages.clang - llvmPackages.lld - cargo-nextest - ]; - - buildInputs = [ - hwloc - ]; - - env = { - CARGO_PROFILE = cargo-profile; - DATAPLANE_SYSROOT = "${sysroot}"; - LIBCLANG_PATH = "${pkgs.pkgsBuildHost.llvmPackages.libclang.lib}/lib"; - C_INCLUDE_PATH = "${sysroot}/include"; - LIBRARY_PATH = "${sysroot}/lib"; - PKG_CONFIG_PATH = "${sysroot}/lib/pkgconfig"; - GW_CRD_PATH = "${dev-pkgs.gateway-crd}/src/gateway/config/crd/bases"; - RUSTC_BOOTSTRAP = "1"; - RUSTFLAGS = builtins.concatStringsSep " " ( - profile'.RUSTFLAGS - ++ [ - "-Clinker=${pkgs.pkgsBuildHost.llvmPackages.clang}/bin/${cc}" - "-Clink-arg=--ld-path=${pkgs.pkgsBuildHost.llvmPackages.lld}/bin/ld.lld" - "-Clink-arg=-L${sysroot}/lib" - # NOTE: this is basically a trick to make our source code available to debuggers. - # Normally remap-path-prefix takes the form --remap-path-prefix=FROM=TO where FROM and TO are directories. - # This is intended to map source code paths to generic, relative, or redacted paths. - # We are sorta using that mechanism in reverse here in that the empty FROM in the next expression maps our - # source code in the debug info from the current working directory to ${src} (the nix store path where we - # have copied our source code). - # - # This is nice in that it should allow us to include ${src} in a container with gdb / lldb + the debug files - # we strip out of the final binaries we cook and include a gdbserver binary in some - # debug/release-with-debug-tools containers. Then, connecting from the gdb/lldb container to the - # gdb/lldbserver container should allow us to actually debug binaries deployed to test machines. - "--remap-path-prefix==${src}" - ] - ); + pkgs.callPackage invoke { + builder = craneLib.mkCargoDerivation; + args = { + inherit pname; + cargoArtifacts = null; + buildPhaseCargoCommand = builtins.concatStringsSep " " [ + "set -e;" + "cargo" + "clippy" + "--profile=${cargo-profile}" + "-Zunstable-options" + "-Zbuild-std=compiler_builtins,core,alloc,std,panic_unwind,sysroot" + "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem,llvm-libunwind" + "--target=${target}" + "--package=${pname}" + "--" + "-D warnings" + ]; }; - - buildPhaseCargoCommand = builtins.concatStringsSep " " [ - "cargo" - "clippy" - "--profile=${cargo-profile}" - "-Zunstable-options" - "-Zbuild-std=compiler_builtins,core,alloc,std,panic_unwind,sysroot" - "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem,llvm-libunwind" - "--target=${target}" - "--package=${pname}" - ]; }; clippy = builtins.mapAttrs ( dir: pname: - let - pkgs-expr = package-clippy-builder { - inherit pname; - cargoArtifacts = packages.${dir}; - }; - in - (pkgs.callPackage pkgs-expr { - inherit (dev-pkgs) kopium; - # inherit (pkgs.fancy) hwloc; - }).overrideAttrs - (orig: { - separateDebugInfo = true; - - preBuild = '' - mkdir $out - ''; - # I'm not 100% sure if I would call it a bug in crane or a bug in cargo, but cross compile is tricky here. - # There is no easy way to distinguish RUSTFLAGS intended for the build-time dependencies from the RUSTFLAGS - # intended for the runtime dependencies. - # One unfortunate consequence of this is that if you set platform specific RUSTFLAGS then the postBuild hook - # malfunctions. Fortunately, the "fix" is easy: just unset RUSTFLAGS before the postBuild hook actually runs. - # We don't need to set any optimization flags for postBuild tooling anyway. - postBuild = '' - unset RUSTFLAGS; - '' - + (orig.postBuild or ""); - - postFixup = '' - rm -f $out/target.tar.zst - '' - + (orig.postFixup or ""); - }) + clippy-builder { + inherit pname; + } ) package-list; env.base = pkgs.buildEnv { name = "base-env"; From 35de66ca1123d52379fd3d28447c87dee09ef966 Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Fri, 2 Jan 2026 22:38:04 +0000 Subject: [PATCH 163/163] much cleaner --- default.nix | 95 ++++++++++++++++------------------------------ nix/profiles.nix | 10 +++-- npins/sources.json | 6 +-- 3 files changed, 43 insertions(+), 68 deletions(-) diff --git a/default.nix b/default.nix index 12543af42..001a89f39 100644 --- a/default.nix +++ b/default.nix @@ -156,7 +156,6 @@ let ); version = (craneLib.crateNameFromCargoToml { inherit src; }).version; cargo-cmd-prefix = [ - "--profile=${cargo-profile}" "-Zunstable-options" "-Zbuild-std=compiler_builtins,core,alloc,std,panic_unwind,sysroot" "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem,llvm-libunwind" @@ -185,7 +184,7 @@ let doCheck = false; strictDeps = true; dontStrip = true; - doRemapPathPrefix = true; + doRemapPathPrefix = false; # TODO: this setting may be wrong, test with debugger doNotRemoveReferencesToRustToolchain = true; doNotRemoveReferencesToVendorDir = true; separateDebugInfo = true; @@ -261,30 +260,6 @@ let rm -f $out/target.tar.zst ''; }); - dep-builder = - { - pname ? null, - cargoArtifacts ? null, - }: - (pkgs.callPackage invoke { - builder = craneLib.buildDepsOnly; - args = { - inherit pname cargoArtifacts; - buildPhaseCargoCommand = builtins.concatStringsSep " " ( - [ - "cargo" - "build" - ] - ++ cargo-cmd-prefix - ); - }; - }); - deps = builtins.mapAttrs ( - dir: pname: - dep-builder { - inherit pname; - } - ) package-list; package-builder = { pname ? null, @@ -294,26 +269,25 @@ let builder = craneLib.buildPackage; args = { inherit pname cargoArtifacts; - buildPhaseCargoCommand = '' - cargoBuildLog=$(mktemp cargoBuildLogXXXX.json) - '' - + (builtins.concatStringsSep " " ( + buildPhaseCargoCommand = builtins.concatStringsSep " " ( [ + "cargoBuildLog=$(mktemp cargoBuildLogXXXX.json);" "cargo" "build" + "--package=${pname}" + "--profile=${cargo-profile}" ] ++ cargo-cmd-prefix ++ [ - "--message-format json-render-diagnostics >$cargoBuildLog" + "--message-format json-render-diagnostics > $cargoBuildLog" ] - )); + ); }; }; packages = builtins.mapAttrs ( dir: pname: package-builder { inherit pname; - cargoArtifacts = deps.${dir}; } ) package-list; test-builder = @@ -325,27 +299,25 @@ let builder = craneLib.mkCargoDerivation; args = { inherit pname cargoArtifacts; - buildPhaseCargoCommand = builtins.concatStringsSep " " [ - "mkdir -p $out;" - "cargo" - "nextest" - "archive" - "--archive-file" - "$out/${pname}.tar.zst" - "--cargo-profile=${cargo-profile}" - "-Zunstable-options" - "-Zbuild-std=compiler_builtins,core,alloc,std,panic_unwind,sysroot" - "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem,llvm-libunwind" - "--target=${target}" - "--package=${pname}" - ]; + buildPhaseCargoCommand = builtins.concatStringsSep " " ( + [ + "mkdir -p $out;" + "cargo" + "nextest" + "archive" + "--archive-file" + "$out/${pname}.tar.zst" + "--cargo-profile=${cargo-profile}" + "--package=${pname}" + ] + ++ cargo-cmd-prefix + ); }; }; tests = builtins.mapAttrs ( dir: pname: test-builder { inherit pname; - # cargoArtifacts = deps.${dir}; } ) package-list; clippy-builder = @@ -357,19 +329,19 @@ let args = { inherit pname; cargoArtifacts = null; - buildPhaseCargoCommand = builtins.concatStringsSep " " [ - "set -e;" - "cargo" - "clippy" - "--profile=${cargo-profile}" - "-Zunstable-options" - "-Zbuild-std=compiler_builtins,core,alloc,std,panic_unwind,sysroot" - "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem,llvm-libunwind" - "--target=${target}" - "--package=${pname}" - "--" - "-D warnings" - ]; + buildPhaseCargoCommand = builtins.concatStringsSep " " ( + [ + "cargo" + "clippy" + "--profile=${cargo-profile}" + "--package=${pname}" + ] + ++ cargo-cmd-prefix + ++ [ + "--" + "-D warnings" + ] + ); }; }; clippy = builtins.mapAttrs ( @@ -425,7 +397,6 @@ in packages tests clippy - deps containers env dataplane-tar diff --git a/nix/profiles.nix b/nix/profiles.nix index a5067531a..98af3083c 100644 --- a/nix/profiles.nix +++ b/nix/profiles.nix @@ -78,15 +78,19 @@ let # These features have been available for a long time and can be found on any reasonably recent machine, so just # enable them here for all x86_64 builds. # In the (very) unlikely event that you need to edit these flags, also edit the associated RUSTFLAGS to match. - "-mrtm" + "-mrtm" # TODO: try to convince DPDK not to rely on rtm "-mcrc32" "-mssse3" ]; march.x86_64.NIX_CXXFLAGS_COMPILE = march.x86_64.NIX_CFLAGS_COMPILE; march.x86_64.NIX_CFLAGS_LINK = march.x86_64.NIX_CXXFLAGS_COMPILE; march.x86_64.RUSTFLAGS = [ - # these should be kept in 1:1 alignment with the x86_64 NIX_CFLAGS_COMPILE settings - "-Ctarget-feature=+rtm,+crc32,+ssse3" + # Ideally these should be kept in 1:1 alignment with the x86_64 NIX_CFLAGS_COMPILE settings. + # That said, rtm and crc32 are only kinda supported by rust, and rtm is functionally deprecated anyway, so we should + # try to remove DPDK's insistence on it. We are absolutely not using hardware memory transactions anyway; they + # proved to be broken in Intel's implementation, and AMD never built them in the first place. + # "-Ctarget-feature=+rtm,+crc32,+ssse3" + "-Ctarget-feature=+ssse3" ] ++ (map (flag: "-Clink-arg=${flag}") march.x86_64.NIX_CFLAGS_LINK); march.aarch64.NIX_CFLAGS_COMPILE = [ ]; diff --git a/npins/sources.json b/npins/sources.json index c7ccc9635..b7b792557 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -115,9 +115,9 @@ }, "branch": "master", "submodules": false, - "revision": "2be15c4abeba7ade2cf9bc4c17ab310441e533b9", - "url": "https://github.com/oxalica/rust-overlay/archive/2be15c4abeba7ade2cf9bc4c17ab310441e533b9.tar.gz", - "hash": "sha256-l4ftzyoD7XX0biEoTEwhOkFhvHhmggkVQyl2jEES0so=" + "revision": "03c6e38661c02a27ca006a284813afdc461e9f7e", + "url": "https://github.com/oxalica/rust-overlay/archive/03c6e38661c02a27ca006a284813afdc461e9f7e.tar.gz", + "hash": "sha256-yHKXXw2OWfIFsyTjduB4EyFwR0SYYF0hK8xI9z4NIn0=" } }, "version": 7