patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: Alyssa Ross <hi@alyssa.is>
To: Yureka Lilian <yureka@cyberchaos.dev>
Cc: devel@spectrum-os.org
Subject: Re: [DO_NOT_APPLY 1/2] integrate xdp-forwarder into net-vm
Date: Sun, 31 Aug 2025 19:10:33 +0200	[thread overview]
Message-ID: <87h5xnxvqu.fsf@alyssa.is> (raw)
In-Reply-To: <87bjnxt6qn.fsf@alyssa.is>

[-- Attachment #1: Type: text/plain, Size: 1432 bytes --]

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.)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

  reply	other threads:[~2025-08-31 17:10 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 [this message]
2025-08-31 18:06       ` Yureka
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=87h5xnxvqu.fsf@alyssa.is \
    --to=hi@alyssa.is \
    --cc=devel@spectrum-os.org \
    --cc=yureka@cyberchaos.dev \
    /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).