From: Adam Miszczak <adam.miszczak@linux.intel.com>
To: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>,
igt-dev@lists.freedesktop.org
Cc: kamil.konieczny@linux.intel.com, lukasz.laguna@intel.com,
michal.wajdeczko@intel.com
Subject: Re: [PATCH i-g-t] lib/igt_sriov_device: Adjust the igt_sriov_is_pf function
Date: Wed, 4 Sep 2024 11:25:07 +0200 [thread overview]
Message-ID: <bdec6673-98f5-41d7-a776-d2046c7b2771@linux.intel.com> (raw)
In-Reply-To: <20240509141556.4128166-1-marcin.bernatowicz@linux.intel.com>
Hi Marcin,
On 09.05.2024 16:15, Marcin Bernatowicz wrote:
> A device is considered a PF if it supports the creation of one or more
> VFs. This capability is indicated by the presence of the sriov_totalvfs
> attribute in the device's sysfs entry, with a value greater than zero.
> The igt_sriov_is_pf function checks for this attribute and its value to
> confirm the device's PF status.
> This adjustment streamlines the process for tests that manipulate Virtual
> Functions (VFs) by consolidating prerequisite checks into a single
> `igt_require(igt_sriov_is_pf)`.
>
> Cc: Lukasz Laguna <lukasz.laguna@intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Signed-off-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
> ---
> lib/igt_sriov_device.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/lib/igt_sriov_device.c b/lib/igt_sriov_device.c
> index a0ef05d5c..8d59bfdca 100644
> --- a/lib/igt_sriov_device.c
> +++ b/lib/igt_sriov_device.c
> @@ -19,23 +19,25 @@
> * igt_sriov_is_pf - Check if device is PF
> * @device: device file descriptor
> *
> - * Determine if device is PF by checking existence of sriov_totalvfs file.
> + * Determines if a device is a Physical Function (PF) by verifying
> + * the presence of the sriov_totalvfs attribute and ensuring its
> + * read value is greater than zero.
> *
> * Return:
> * True if device is PF, false otherwise.
> */
> bool igt_sriov_is_pf(int device)
> {
> + uint32_t value = 0;
> int sysfs;
> - bool ret;
>
> sysfs = igt_sysfs_open(device);
> igt_assert_fd(sysfs);
>
> - ret = igt_sysfs_has_attr(sysfs, "device/sriov_totalvfs");
> + __igt_sysfs_get_u32(sysfs, "device/sriov_totalvfs", &value);
> close(sysfs);
>
> - return ret;
> + return value > 0;
LGTM,
Reviewed-by: Adam Miszczak <adam.miszczak@linux.intel.com>
> }
>
> static bool __pf_attr_get_u32(int pf, const char *attr, uint32_t *value)
prev parent reply other threads:[~2024-09-04 9:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-09 14:15 [PATCH i-g-t] lib/igt_sriov_device: Adjust the igt_sriov_is_pf function Marcin Bernatowicz
2024-05-09 14:44 ` ✓ CI.xeBAT: success for " Patchwork
2024-05-09 15:00 ` ✓ Fi.CI.BAT: " Patchwork
2024-05-09 19:37 ` ✗ CI.xeFULL: failure " Patchwork
2024-05-10 8:33 ` Bernatowicz, Marcin
2024-05-10 1:51 ` ✗ Fi.CI.IGT: " Patchwork
2024-05-10 8:35 ` Bernatowicz, Marcin
2024-09-04 9:25 ` Adam Miszczak [this message]
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=bdec6673-98f5-41d7-a776-d2046c7b2771@linux.intel.com \
--to=adam.miszczak@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kamil.konieczny@linux.intel.com \
--cc=lukasz.laguna@intel.com \
--cc=marcin.bernatowicz@linux.intel.com \
--cc=michal.wajdeczko@intel.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