Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: Lukasz Laguna <lukasz.laguna@intel.com>, igt-dev@lists.freedesktop.org
Cc: marcin.bernatowicz@linux.intel.com,
	satyanarayana.k.v.p@intel.com, adam.miszczak@linux.intel.com,
	jakub1.kolakowski@intel.com
Subject: Re: [PATCH i-g-t v1 3/4] lib/igt_sriov_device: Add helper to iterate over VFs from starting number
Date: Mon, 27 Jan 2025 10:06:45 +0100	[thread overview]
Message-ID: <aa0f8738-1db3-4880-95c7-ec4638a49a29@intel.com> (raw)
In-Reply-To: <20250124081039.31201-4-lukasz.laguna@intel.com>



On 24.01.2025 09:10, Lukasz Laguna wrote:
> Helper allows to iterate over VFs associated with given PF, starting
> from a specified VF number.
> 
> Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
> ---
>  lib/igt_sriov_device.h | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/lib/igt_sriov_device.h b/lib/igt_sriov_device.h
> index de25a7d98..741b1bcec 100644
> --- a/lib/igt_sriov_device.h
> +++ b/lib/igt_sriov_device.h
> @@ -86,6 +86,21 @@ 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_starting_from - Iterate over VFs starting from a specified VF
> + * @__pf_fd: PF device file descriptor
> + * @__start: Starting VF number
> + * @__vf_num: VFs iterator
> + *
> + * For loop that iterates over VFs associated with given PF @__pf_fd,
> + * starting from a specified VF number @__start.
> + */
> +#define for_each_sriov_vf_starting_from(__pf_fd, __start, __vf_num) \

nit: there is no need to use underscore for the macro params as all will
be expanded/replaced as-is

> +	for (unsigned int __vf_num = __start, __total_vfs = igt_sriov_get_total_vfs(__pf_fd); \

macro param "start" shall be wrapped in ( )

> +	     __vf_num <= __total_vfs; \
> +	     ++__vf_num)

macro param "vf_num" shall be wrapped in ( )

and there is a risk of param re-evaluation due to param reuse
maybe just add new local temp var for it?

> +#define for_each_sriov_num_vfs_starting_from for_each_sriov_vf_starting_from

why do we need another alias for this new macro?
if the original name is wrong then just use a better one ;)

> +
>  /**
>   * for_random_sriov_vf_in_range - Iterate over a random VF in a specified range
>   * @__pf_fd: PF device file descriptor


  parent reply	other threads:[~2025-01-27  9:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-24  8:10 [PATCH i-g-t v1 0/4] Verify VF configuration data against provisioned values Lukasz Laguna
2025-01-24  8:10 ` [PATCH i-g-t v1 1/4] lib/xe/xe_sriov_provisioning: Add helper to read VF's configuration data Lukasz Laguna
2025-01-24 10:46   ` K V P, Satyanarayana
2025-01-24  8:10 ` [PATCH i-g-t v1 2/4] lib/xe/xe_sriov_provisioning: Add helper to get VF's provisioned quota Lukasz Laguna
2025-01-27  7:46   ` K V P, Satyanarayana
2025-01-24  8:10 ` [PATCH i-g-t v1 3/4] lib/igt_sriov_device: Add helper to iterate over VFs from starting number Lukasz Laguna
2025-01-27  7:47   ` K V P, Satyanarayana
2025-01-27  9:06   ` Michal Wajdeczko [this message]
2025-01-29 10:15     ` Laguna, Lukasz
2025-01-24  8:10 ` [PATCH i-g-t v1 4/4] tests/xe_sriov_auto_provisioning: Add subtest to verify VF's configuration Lukasz Laguna
2025-01-24 18:09 ` ✓ i915.CI.BAT: success for Verify VF configuration data against provisioned values Patchwork
2025-01-24 18:35 ` ✓ Xe.CI.BAT: " Patchwork
2025-01-25  0:45 ` ✗ Xe.CI.Full: failure " Patchwork
2025-01-25  6:24 ` ✗ i915.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=aa0f8738-1db3-4880-95c7-ec4638a49a29@intel.com \
    --to=michal.wajdeczko@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=marcin.bernatowicz@linux.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