From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f74.google.com (mail-ed1-f74.google.com [209.85.208.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA08C345CAB for ; Sat, 7 Mar 2026 21:28:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772918923; cv=none; b=oGzLP7t/5xSkgJ171eTTXkElfVXwlAB5VCV1vw9AdfM+AMNduAm+vV7icpgZR/VIneqoTKLIhZBwuzgf86K9titXeGiXtfniZ798ASecSMaCNYSQMobjJ5+pzWz3BH4WIvVzMtaejFdiuioUnPajrOBaPMvcPyY071l/I39pPsk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772918923; c=relaxed/simple; bh=1bK4p5mzYeMCWDs67MGklTJGxrWR+9TZ2JdRQtnv8Ww=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Hg7V27fruuo16wFoO3Kx2URgP8v3ed7ghjVWo2xOQXQ4PYkX+eyfah8H9pjndlTecp0XOO7qx5PZGEg8WaBChArOrf30EdPqtnBu26fE7JqMpjOhNFZ1K0EUzBsg4bV9+XTyK5aWU5jfxPTr1Vo9UFz7RbWShMXYp7DcG8Ich40= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=NU8GDp0g; arc=none smtp.client-ip=209.85.208.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="NU8GDp0g" Received: by mail-ed1-f74.google.com with SMTP id 4fb4d7f45d1cf-660af6ded1cso7055930a12.1 for ; Sat, 07 Mar 2026 13:28:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772918919; x=1773523719; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=KXZ2BtMMwe7rXhuI9FW2OS3wA90krDOiJKGgmhoSpL0=; b=NU8GDp0g20o35tVSF2xZAWpKYNqzKc0JdJ0p2GzKlRGomkAI1xh2kfVeplpTnxKD7r 978MPt33LOd/U/rygfzMtKvHQA4/GBEfK2cnuYh7nuJDOvGVX6CfsxZ5ljVFUFnXS3Is docUZYk+e434kTIFf3ZsbErf/KHulPGTKlA1v4jWdw+dOKe1oiLOYdLJXJXTlAvDrxW6 ndTtTxuhC40YE4ZHYdwm+NeROrSby7P0WDdiwu1ffMX4YfeTSbktCRQ6PKkNjn+0haIR pPfelNjMrf2IExS+27TqN6LvxeACByxJnreqKkMwh06tGqUG8drEn3WlvJo32XrfrPvc erjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772918919; x=1773523719; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KXZ2BtMMwe7rXhuI9FW2OS3wA90krDOiJKGgmhoSpL0=; b=fDguFW75x2rXvIyTxgwfpTGdy0P8Z0Sm8A46uMihmDmi7zdnZM5FE5FHzpn61+iW77 siGa8SgDc5dXqoP9gkxHXyOrtr+OjaUOfWN5Kr/2NFAYCvRUVG+/EeMba2ZxgZKxq+gJ hsQLl9Xb9MCVOJ7kl0LUbui3HkXXKoSMDSKDlqAODYnM8txoN1nSEqChBOSoNzfQ2+uC eaL7GVyrHsc84hf7q7PbAyPeppjYrm6fnZpSROaW5iEs6mLVywgMexeltcz8Cmn/A9it hKnMk5EzR31HnxX3VFmkxzIZzj43tc6tzOYVhtKRSHt11DIANhjh0B4MbYPAGgIJW+cR SVmA== X-Forwarded-Encrypted: i=1; AJvYcCVkZG2+rs3FlXjFWy1Qd7L195u2AYJXYMnVxuoM4ekvRK9ILNI/15IQZIhZGXNf1RkWSLf1A4Ut3GUQZqo=@vger.kernel.org X-Gm-Message-State: AOJu0YzU3TcheCksdepbv8ptkGTZtctWsEHrfuu9/aUeled/YiEpwBFH wxYgeJcOoWYpOGhfTTwhJqAjBu+yqs8rAvATWySx0Or/C2+XMvdnnGDT9wRFsIc6Wo4ql1/PRcc EYmZPNt8LbR7DepzdCg== X-Received: from edse9.prod.google.com ([2002:aa7:d7c9:0:b0:660:e726:1fa]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6402:42cb:b0:65f:7000:928f with SMTP id 4fb4d7f45d1cf-6619d2efe84mr3606718a12.0.1772918918922; Sat, 07 Mar 2026 13:28:38 -0800 (PST) Date: Sat, 7 Mar 2026 21:28:38 +0000 In-Reply-To: <081b1f16-5c8b-4a18-a9f1-d56e757de4c0@lunn.ch> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260306-binder-netlink-v1-0-daceb5bc83f2@google.com> <20260306-binder-netlink-v1-1-daceb5bc83f2@google.com> <081b1f16-5c8b-4a18-a9f1-d56e757de4c0@lunn.ch> Message-ID: Subject: Re: [PATCH 1/4] rust: netlink: add raw netlink abstraction From: Alice Ryhl To: Andrew Lunn Cc: Miguel Ojeda , Boqun Feng , Gary Guo , "=?utf-8?B?QmrDtnJu?= Roy Baron" , Benno Lossin , Andreas Hindborg , Trevor Gross , Danilo Krummrich , Donald Hunter , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Simon Horman , Greg Kroah-Hartman , "Arve =?utf-8?B?SGrDuG5uZXbDpWc=?=" , Todd Kjos , Christian Brauner , Carlos Llamas , linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, netdev@vger.kernel.org Content-Type: text/plain; charset="utf-8" On Sat, Mar 07, 2026 at 04:43:02PM +0100, Andrew Lunn wrote: > > diff --git a/rust/kernel/netlink.rs b/rust/kernel/netlink.rs > > ... > > > +/// The default netlink message size. > > +pub const GENLMSG_DEFAULT_SIZE: usize = bindings::GENLMSG_DEFAULT_SIZE; > > + > > +/// A wrapper around `struct sk_buff` for generic netlink messages. > > +/// > > +/// # Invariants > > +/// > > +/// The pointer has ownership over a valid `sk_buff`. > > +pub struct SkBuff { > > + skb: NonNull, > > +} > > struct sk_buff is a core data structure which appears all over the > networking stack, but also other places like crypto, scsi, tty, file > systems, etc. Since it is a top level data structure, it seems odd > Rust puts it into netlink.rs. > > How do you see the Rust SkBuff evolving to a general purpose data > structure which can be used everywhere? We can make a kernel::net module (rust/kernel/net/) and put it there instead? I guess netlink.rs can also be a submodule of that. Hmm ... but I'm currently using genlmsg_new() / nlmsg_free(), and I assume the other use-cases do not go through those methods, since they sound netlink specific. To be honest, I'm new to the kernel's networking stack, so I probably can't design Rust wrapper for sk_buff that supports all those different usecases without someone walking me through how it works. It may or may not be best to write a netlink-specific struct now and expand it later. Alice