From: sashiko-bot@kernel.org
To: "Zhi Wang" <zhiw@nvidia.com>
Cc: gary@garyguo.net, linux-pci@vger.kernel.org, ojeda@kernel.org
Subject: Re: [PATCH v2 5/8] rust: pci: add num_vf(), to return number of VFs
Date: Thu, 24 Sep 2026 19:13:43 +0000 [thread overview]
Message-ID: <20260924191343.C8E831F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260924190556.1620886-6-zhiw@nvidia.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] rust: pci: missing unconditional availability for num_vf() causing driver build failures
- [Low] rust: pci: missing #[inline] on num_vf() FFI wrapper
--
commit 887b28180af5e15626ffb6304f6b61300c0d3b74
Author: Peter Colberg <pcolberg@redhat.com>
rust: pci: add num_vf(), to return number of VFs
Add a method to return the number of Virtual Functions (VF) enabled for
a Physical Function (PF).
> diff --git a/rust/kernel/pci.rs b/rust/kernel/pci.rs
> index ca009775bd612..db0554f14afc8 100644
> --- a/rust/kernel/pci.rs
> +++ b/rust/kernel/pci.rs
> @@ -449,6 +449,14 @@ pub(crate) fn is_virtfn(&self) -> bool {
> unsafe { (*self.as_raw()).is_virtfn() != 0 }
> }
>
> + /// Returns the number of Virtual Functions (VF) enabled for a Physical Function (PF).
> + #[cfg(CONFIG_PCI_IOV)]
[Severity: Medium]
Will this cause build failures for drivers that unconditionally call
num_vf() when CONFIG_PCI_IOV is disabled?
In C, pci_num_vf() is unconditionally available as a static inline that
returns 0 when IOV is disabled, so drivers can safely call it without
checking Kconfig symbols. Adding #[cfg(CONFIG_PCI_IOV)] here hides the
method entirely in non-IOV builds, which will result in compilation errors
for downstream callers.
> + #[expect(dead_code)]
> + pub(crate) fn num_vf(&self) -> i32 {
[Severity: Low]
Should this method have the #[inline] attribute?
The rust subsystem guidelines recommend adding #[inline] to abstraction
methods that forward directly to a C binding.
> + // 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.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260924190556.1620886-1-zhiw@nvidia.com?part=5
next prev parent reply other threads:[~2026-09-24 19:13 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-24 19:05 [PATCH v2 0/8] Add Rust PCI SR-IOV support Zhi Wang
2026-09-24 19:05 ` [PATCH v2 1/8] rust: pci: add {enable,disable}_sriov(), to control SR-IOV capability Zhi Wang
2026-09-24 19:20 ` sashiko-bot
2026-09-25 20:43 ` Peter Colberg
2026-09-28 19:32 ` Zhi Wang
2026-09-27 16:37 ` Danilo Krummrich
2026-09-28 19:45 ` Zhi Wang
2026-09-24 19:05 ` [PATCH v2 2/8] rust: pci: add vtable attribute to pci::Driver trait Zhi Wang
2026-09-24 19:13 ` sashiko-bot
2026-09-24 19:05 ` [PATCH v2 3/8] rust: pci: add is_virtfn(), to check for VFs Zhi Wang
2026-09-24 19:14 ` sashiko-bot
2026-09-24 19:05 ` [PATCH v2 4/8] rust: pci: add is_physfn(), to check for PFs Zhi Wang
2026-09-24 19:12 ` sashiko-bot
2026-09-24 19:05 ` [PATCH v2 5/8] rust: pci: add num_vf(), to return number of VFs Zhi Wang
2026-09-24 19:13 ` sashiko-bot [this message]
2026-09-24 19:05 ` [PATCH v2 6/8] rust: pci: add bus callback sriov_configure(), to control SR-IOV from sysfs Zhi Wang
2026-09-24 19:19 ` sashiko-bot
2026-09-24 19:05 ` [PATCH v2 7/8] rust: pci: add typed SR-IOV PF registration data Zhi Wang
2026-09-24 19:27 ` sashiko-bot
2026-09-28 20:08 ` Danilo Krummrich
2026-09-29 7:27 ` Zhi Wang
2026-09-29 8:35 ` Danilo Krummrich
2026-09-24 19:05 ` [PATCH v2 8/8] samples: rust: add Rust SR-IOV VF driver sample Zhi Wang
2026-09-24 19:22 ` sashiko-bot
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=20260924191343.C8E831F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=gary@garyguo.net \
--cc=linux-pci@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=zhiw@nvidia.com \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox