[PATCH i-g-t v1 3/4] lib/igt_sriov_device: Add helper to iterate over VFs from starting number
K V P, Satyanarayana
satyanarayana.k.v.p at intel.com
Mon Jan 27 07:47:23 UTC 2025
> From: Laguna, Lukasz <lukasz.laguna at intel.com>
> Sent: Friday, January 24, 2025 1:41 PM
> To: igt-dev at lists.freedesktop.org
> Cc: marcin.bernatowicz at linux.intel.com; Laguna, Lukasz
> <lukasz.laguna at intel.com>; K V P, Satyanarayana
> <satyanarayana.k.v.p at intel.com>; Wajdeczko, Michal
> <Michal.Wajdeczko at intel.com>; adam.miszczak at linux.intel.com; Kolakowski,
> Jakub1 <jakub1.kolakowski at intel.com>
> Subject: [PATCH i-g-t v1 3/4] lib/igt_sriov_device: Add helper to iterate over
> VFs from starting number
>
> Helper allows to iterate over VFs associated with given PF, starting
> from a specified VF number.
>
> Signed-off-by: Lukasz Laguna <lukasz.laguna at intel.com>
Reviewed-by: Satyanarayana K V P <satyanarayana.k.v.p at 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) \
> + for (unsigned int __vf_num = __start, __total_vfs =
> igt_sriov_get_total_vfs(__pf_fd); \
> + __vf_num <= __total_vfs; \
> + ++__vf_num)
> +#define for_each_sriov_num_vfs_starting_from
> for_each_sriov_vf_starting_from
> +
> /**
> * for_random_sriov_vf_in_range - Iterate over a random VF in a specified
> range
> * @__pf_fd: PF device file descriptor
> --
> 2.40.0
More information about the igt-dev
mailing list