From: "Bernatowicz, Marcin" <marcin.bernatowicz@linux.intel.com>
To: Lukasz Laguna <lukasz.laguna@intel.com>, igt-dev@lists.freedesktop.org
Cc: satyanarayana.k.v.p@intel.com, michal.wajdeczko@intel.com,
adam.miszczak@linux.intel.com, jakub1.kolakowski@intel.com
Subject: Re: [PATCH i-g-t v2 3/4] lib/igt_sriov_device: Add helper to iterate over VFs in specified range
Date: Tue, 11 Feb 2025 12:23:04 +0100 [thread overview]
Message-ID: <2ca94e20-a777-414e-bb62-b511588ad7af@linux.intel.com> (raw)
In-Reply-To: <20250207094031.15942-4-lukasz.laguna@intel.com>
On 2/7/2025 10:40 AM, Lukasz Laguna wrote:
> Helper allows to iterate over VFs within the specified range.
>
> Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
> ---
> lib/igt_sriov_device.h | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/lib/igt_sriov_device.h b/lib/igt_sriov_device.h
> index de25a7d98..c12a8cf6c 100644
> --- a/lib/igt_sriov_device.h
> +++ b/lib/igt_sriov_device.h
> @@ -86,6 +86,24 @@ igt_sriov_random_vf_in_range(int pf_fd, unsigned int start, unsigned int end)
> ++__vf_num)
> #define for_each_sriov_num_vfs for_each_sriov_vf
>
> +/**
> + * for_each_sriov_vf_in_range - Iterate over VFs in a specified range
> + * @__pf_fd: PF device file descriptor
> + * @__start: Starting VF number in the range
> + * @__end: Ending VF number in the range
> + * @__vf_num: Variable to store the random VF number
> + *
> + * For loop that iterates over VFs associated with given PF @__pf_fd,
> + * within the specified range [__start, __end]. The loop runs only if
> + * the range is valid.
> + */
> +#define for_each_sriov_vf_in_range(__pf_fd, __start, __end, __vf_num) \
> + for (unsigned int __vf_num = __start & \
> + __is_valid_range(__start, __end, igt_sriov_get_total_vfs(__pf_fd)); \
> + __vf_num && __vf_num <= __end; \
> + ++__vf_num)
> +#define for_each_sriov_num_vfs_in_range for_each_sriov_vf_in_range
> +
Something is wrong, is the bitwise operator expected ?
Is this going to work:
for_each_sriov_vf_in_range(pf_fd, 2, 7, vf) ?
Maybe
#define for_each_sriov_vf_in_range(__pf_fd, __start, __end, __vf_num) \
for (unsigned int __vf_num = ((__is_valid_range((__start), (__end),
igt_sriov_get_total_vfs(__pf_fd))) ?
(__start) : 0); \
__vf_num && __vf_num <= (__end); ++__vf_num)
--
marcin
> /**
> * for_random_sriov_vf_in_range - Iterate over a random VF in a specified range
> * @__pf_fd: PF device file descriptor
next prev parent reply other threads:[~2025-02-11 11:23 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-07 9:40 [PATCH i-g-t v2 0/4] Verify VF configuration data against provisioned values Lukasz Laguna
2025-02-07 9:40 ` [PATCH i-g-t v2 1/4] lib/xe/xe_sriov_debugfs: Add helper to read VF's configuration data Lukasz Laguna
2025-02-10 10:43 ` Bernatowicz, Marcin
2025-02-10 10:57 ` Bernatowicz, Marcin
2025-02-07 9:40 ` [PATCH i-g-t v2 2/4] lib/xe/xe_sriov_provisioning: Add helper to get VF's provisioned quota Lukasz Laguna
2025-02-07 9:40 ` [PATCH i-g-t v2 3/4] lib/igt_sriov_device: Add helper to iterate over VFs in specified range Lukasz Laguna
2025-02-11 11:23 ` Bernatowicz, Marcin [this message]
2025-02-07 9:40 ` [PATCH i-g-t v2 4/4] tests/xe_sriov_auto_provisioning: Add subtest to verify VF's configuration Lukasz Laguna
2025-02-10 10:52 ` Bernatowicz, Marcin
2025-02-08 0:26 ` ✓ i915.CI.BAT: success for Verify VF configuration data against provisioned values (rev2) Patchwork
2025-02-08 1:22 ` ✗ Xe.CI.BAT: failure " Patchwork
2025-02-08 16:45 ` ✗ i915.CI.Full: " Patchwork
2025-02-08 19:19 ` ✗ Xe.CI.Full: " Patchwork
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=2ca94e20-a777-414e-bb62-b511588ad7af@linux.intel.com \
--to=marcin.bernatowicz@linux.intel.com \
--cc=adam.miszczak@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jakub1.kolakowski@intel.com \
--cc=lukasz.laguna@intel.com \
--cc=michal.wajdeczko@intel.com \
--cc=satyanarayana.k.v.p@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