From: Yureka <yuka@yuka.dev>
To: Alyssa Ross <hi@alyssa.is>
Cc: devel@spectrum-os.org
Subject: Re: [DO_NOT_APPLY 1/2] integrate xdp-forwarder into net-vm
Date: Sun, 31 Aug 2025 20:06:38 +0200 [thread overview]
Message-ID: <14ab4dbe-fb4f-4e7e-95b8-ebca0bfdedad@yuka.dev> (raw)
In-Reply-To: <87h5xnxvqu.fsf@alyssa.is>
On 8/31/25 19:10, Alyssa Ross wrote:
> Alyssa Ross <hi@alyssa.is> writes:
>
>>> diff --git a/vm/sys/net/xdp-forwarder/default.nix
>>> b/vm/sys/net/xdp-forwarder/default.nix
>>> new file mode 100644
>>> index 0000000..75b1d66
>>> --- /dev/null
>>> +++ b/vm/sys/net/xdp-forwarder/default.nix
>>> @@ -0,0 +1,35 @@
>>> +# SPDX-License-Identifier: MIT
>>> +# SPDX-FileCopyrightText: 2025 Yureka Lilian <yureka@cyberchaos.dev>
>>> +
>>> +{ lib, runCommand, stdenv, llvmPackages, libbpf, linux, bpftools }:
>>> +
>>> +stdenv.mkDerivation {
>>> + pname = "xdp-forwarder";
>>> + version = "0";
>>> +
>>> + src = lib.fileset.toSource {
>>> + root = ./.;
>>> + fileset = lib.fileset.fileFilter
>>> + ({ hasExt, ... }: !(hasExt "nix") && !(hasExt "md")) ./.;
>>> + };
>>> +
>>> + buildInputs = [ libbpf ];
>>> + nativeBuildInputs = [ llvmPackages.clang-unwrapped bpftools ];
>>> +
>>> + buildPhase = ''
>>> + bpftool btf dump file ${linux.dev}/vmlinux format c >
>>> include/vmlinux.h
>> I guess we're still missing a vmlinux.h package in Nixpkgs? That would
>> be much cleaner.
> Actually, given discussion in #systemd:nixos.org yesterday, it sounds
> like best practice is to declare just the structs and struct members we
> use:
>
> https://nakryiko.com/posts/bpf-core-reference-guide/#defining-own-co-re-relocatable-type-definitions
>
> (Since on Spectrum we /can/ predict the kernel we'll be running on, it's
> not a huge deal, but I'd still like to follow the principle of having
> packages be portable.)
I don't really understand how avoiding vmlinux.h would make our programb
more portable.
At the same time, I am very reliant on bpf/bpf_helpers.h from libbpf,
and this requires a definition of __u64 and __u32, and I don't know
where I would get those from if not vmlinux.h (and defining them myself
feels wrong).
next prev parent reply other threads:[~2025-08-31 18:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-23 22:21 [DO_NOT_APPLY 0/2] xdp-forwarder Yureka Lilian
2025-08-23 22:21 ` [DO_NOT_APPLY 1/2] integrate xdp-forwarder into net-vm Yureka Lilian
2025-08-30 10:59 ` Alyssa Ross
2025-08-31 17:10 ` Alyssa Ross
2025-08-31 18:06 ` Yureka [this message]
2025-08-31 20:50 ` Yureka
2025-09-01 13:59 ` Alyssa Ross
2025-09-01 14:04 ` Yureka
2025-09-01 14:12 ` Alyssa Ross
2025-08-23 22:21 ` [DO_NOT_APPLY 2/2] temporary changes for testing Yureka Lilian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=14ab4dbe-fb4f-4e7e-95b8-ebca0bfdedad@yuka.dev \
--to=yuka@yuka.dev \
--cc=devel@spectrum-os.org \
--cc=hi@alyssa.is \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://spectrum-os.org/git/crosvm
https://spectrum-os.org/git/doc
https://spectrum-os.org/git/mktuntap
https://spectrum-os.org/git/nixpkgs
https://spectrum-os.org/git/spectrum
https://spectrum-os.org/git/ucspi-vsock
https://spectrum-os.org/git/www
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).