From nobody Tue Feb 10 00:58:31 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C744233372D for ; Thu, 5 Feb 2026 21:00:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770325242; cv=none; b=j7MCy0CBJObF5H5/qUiqxAbYB+eIveLU80KHyqz/TS86lcSdoiYEtyBbUG4ldw8jqRC5wZ29S4/NeZgVW/tsh5MDY1ylXk7C6KXxg1cg4gcQtV2s27GZX4xnL15ZF4J/7NW9bWyzWbI+LPyFaSQYYYeiqIshcY5x0xK2vFY20ts= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770325242; c=relaxed/simple; bh=zYEg72eTegIm4aBsUkMl8q2KG4rMnFZIPR9seQA5Ej8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dOUAuR+jgXWnairPljeF74eeG/C3zplwKMHRUTdyXOwwnOLv0LEC1qmxV8vh2W0lVl5hPZEFYw7zhNNSLvSsXFeCGyztcPj+kIPH3KTpngCPBM5xiyDdttwyV5ahXcFucphs4l4E0rmE5yBZ5fruSHQhdpH60+yLbAs26A7eDmQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=FYvZLoxV; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=Gs5Y8Fe2; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="FYvZLoxV"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="Gs5Y8Fe2" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770325241; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iChE2sHYyL+SE0NwtrGJ4SsAVC7actOKSXH6xK1kyOw=; b=FYvZLoxVgoqVzvuA7Uq6AUpuCQ6ebSCCJWihz1p4UAp35QsBg1qSayR+zrjIaJsQSW/Gtw +v5B9kmQ72f0wjN5tQ4EVre7EWyET8QADstc7vRKbWejIkGsYl4mq13G8bIY4uaeRF4dEy Cjy0uoo6lgQt1v714kugcNUiM2SRuTk= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-633-rU0eKXX7MrmUfW9xYZfopw-1; Thu, 05 Feb 2026 16:00:38 -0500 X-MC-Unique: rU0eKXX7MrmUfW9xYZfopw-1 X-Mimecast-MFC-AGG-ID: rU0eKXX7MrmUfW9xYZfopw_1770325237 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8c52c921886so168322585a.2 for ; Thu, 05 Feb 2026 13:00:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1770325237; x=1770930037; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=iChE2sHYyL+SE0NwtrGJ4SsAVC7actOKSXH6xK1kyOw=; b=Gs5Y8Fe2u1BVoCIIfWVuAew+NDxTEBwKtArLqZiGDPZRBy1dLP5zzIZkpljltmJLqb DWtXoxV7aWQquJVxNxIyqTOtnFxWhCWOdqzrmVVRsWV7zRtEffiutjAUTinG2YJ2hF1c aAYuC38vKOzLkb6Mskb5QZfPwURt76blJKMctWKkjof7EkQeOu/6ScyVfK8kzonahC/B ewbYpxD9JnLYuYA7HbZA0IoRoS0w77nlC2ACRzjeKdEAx2ckDqVLg1ITuDS5F0Yf+7h0 ox+Eg+RQ+QiJEEUBt8YekPRmNT4L/oi9zVLmflGCBEoXdgybS0bY+X09kEIpF8ZttdgI 3kkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770325237; x=1770930037; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=iChE2sHYyL+SE0NwtrGJ4SsAVC7actOKSXH6xK1kyOw=; b=D8wJSsytP828dY9sZ+b5IvCXtlX71H67yIJIpbZwQh2aQ55Nq7IWB0vBeIgGUvaxGG sY6Awi85nTRdsKXm5ADeJ+J0fmiHVL6aHYLgbxUe7iLqAsX0T/6L6HZYQMeR/HziGY7p szQ6wT6mM8DBNAvQKKxUMeDmKCjyamHkWLVbhQFqJbCF2HRWELxsjyfvyJfIn2M9OlrJ LmwYxfi1J6lqrL1ECJY6spPh2FQ09gRNX7S4LhX5tapJ45vn2SNeIeiUm/KuZGRWRxUk 8CSRKKBffd5uK0upZTUcT4k27sRg6ilfiag6qx9MYhx21ZaiI+AKPP7q3FgbsH4+6lZU GaEA== X-Forwarded-Encrypted: i=1; AJvYcCXVUi/vAkm1T0roYS0wVzDrSsAyoK6uWM9qqtbjP+trbA8ERMSSE6UisMC03awePJEGgm5yeDZZ5KtpBpA=@vger.kernel.org X-Gm-Message-State: AOJu0YwyeRVUJcRMru5TC2WUddYQlXBHhhfOAJbhzJxS/gfolpZ5kkEw jtwiS7vx5w3h6qQpuWsA7VNT04sbfGgZ2zlE76c+7qmayspzkiNe8FOLmijTu9P2r4KKVyXJlcM KsE5mondUIJdeM/ucDPx1UTB6yPt3zrsOJve0v0If8Kv0e4z7y39Uj/St7kdOwlTZCw== X-Gm-Gg: AZuq6aLRhJvtkzKS0cNrIerXe9V3EjxWg1bLKHujbTRiZ6BkDkHPLsLhACjN1ZB9Y7r zNxJW3zlJbRn4PQMZoqhisa9m1Z+gIEouPmfygRNGJDzlpXNxLYZnD8ncjgiq++rlVQ6BbfOE4b 8T6UiwQwlK7V1L2j4b7INRL2mbM6tnmksHTktk7puXg6t7FglP5tS5V40BR9hjinJGrgH7hEATU LTj8uG04mJRhdvc8EHQB6UsfVQ5HJxudreHpPMZRIgd7Ga8Q9vHeJQYIIAwXimtUFHTX++f6Ir9 IioNNgkG8lzD7xkWH9DXOz8Yv1sm1yhas4ewG3CA3lno6WzxBwKsnQbrD+KhAdy7ND1m3QdYeIu 5+F0yRvnAyk/MXos= X-Received: by 2002:a05:620a:44cf:b0:8c5:3067:903c with SMTP id af79cd13be357-8caeeb50f3emr72337785a.11.1770325237554; Thu, 05 Feb 2026 13:00:37 -0800 (PST) X-Received: by 2002:a05:620a:44cf:b0:8c5:3067:903c with SMTP id af79cd13be357-8caeeb50f3emr72328985a.11.1770325236916; Thu, 05 Feb 2026 13:00:36 -0800 (PST) Received: from [172.16.1.8] ([2607:f2c0:b010:9000:4c85:f148:4c91:943a]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8caf9fdf692sm17571285a.44.2026.02.05.13.00.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Feb 2026 13:00:36 -0800 (PST) From: Peter Colberg Date: Thu, 05 Feb 2026 15:59:55 -0500 Subject: [PATCH v2 08/10] rust: pci: add num_vf(), to return number of VFs Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260205-rust-pci-sriov-v2-8-ef9400c7767b@redhat.com> References: <20260205-rust-pci-sriov-v2-0-ef9400c7767b@redhat.com> In-Reply-To: <20260205-rust-pci-sriov-v2-0-ef9400c7767b@redhat.com> To: Danilo Krummrich , Bjorn Helgaas , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Abdiel Janulgue , Daniel Almeida , Robin Murphy , Greg Kroah-Hartman , Dave Ertman , Ira Weiny , Leon Romanovsky , David Airlie , Simona Vetter , Jonathan Corbet , Xu Yilun , Tom Rix , Moritz Fischer , "Rafael J. Wysocki" Cc: linux-pci@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Alexandre Courbot , Alistair Popple , Joel Fernandes , John Hubbard , Zhi Wang , nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-doc@vger.kernel.org, linux-fpga@vger.kernel.org, driver-core@lists.linux.dev, Peter Colberg , Jason Gunthorpe X-Mailer: b4 0.14.2 Add a method to return the number of Virtual Functions (VF) enabled for a Physical Function (PF). Signed-off-by: Peter Colberg --- rust/kernel/pci.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rust/kernel/pci.rs b/rust/kernel/pci.rs index df39ad3f0d5fd898b034609efb03368f83c2a2e9..581930d0afe98ccc29d729e4d9a= ab75b4144e46c 100644 --- a/rust/kernel/pci.rs +++ b/rust/kernel/pci.rs @@ -498,6 +498,13 @@ pub fn is_virtfn(&self) -> bool { unsafe { (*self.as_raw()).is_virtfn() !=3D 0 } } =20 + /// Returns the number of Virtual Functions (VF) enabled for a Physica= l Function (PF). + #[cfg(CONFIG_PCI_IOV)] + pub fn num_vf(&self) -> i32 { + // SAFETY: `self.as_raw` is a valid pointer to a `struct pci_dev`. + unsafe { bindings::pci_num_vf(self.as_raw()) } + } + /// Returns the size of the given PCI BAR resource. pub fn resource_len(&self, bar: u32) -> Result { if !Bar::index_is_valid(bar) { --=20 2.52.0