From: Bjorn Helgaas <helgaas@kernel.org>
To: Lukasz Laguna <lukasz.laguna@intel.com>
Cc: linux-pci@vger.kernel.org, bhelgaas@google.com,
michal.winiarski@intel.com, djbw@kernel.org,
brett.creeley@amd.com, anthony.l.nguyen@intel.com,
przemyslaw.kitszel@intel.com, pabeni@redhat.com,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org
Subject: Re: [PATCH v2 09/13] PCI/TSM: Use generic VF iterators
Date: Tue, 27 Oct 2026 15:08:18 -0500 [thread overview]
Message-ID: <20261027200818.GA482873@bhelgaas> (raw)
In-Reply-To: <20261027160446.858300-10-lukasz.laguna@intel.com>
On Tue, Oct 27, 2026 at 05:04:42PM +0100, Lukasz Laguna wrote:
> pci_tsm_walk_fns() and pci_tsm_walk_fns_reverse() implement their own VF
> iteration logic. Replace it with for_each_pci_vf() and
> for_each_pci_vf_reverse().
This and the rest of the series seems like nice, relatively simple
cleanup that could be done earlier, e.g., after [02/13] "PCI/IOV:
Introduce VF iterators". Those look fairly straightforward and maybe
could be merged earlier to get them out of the way.
> Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
> ---
> drivers/pci/tsm.c | 25 ++++---------------------
> 1 file changed, 4 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/pci/tsm.c b/drivers/pci/tsm.c
> index 5fdcd7f2e820..01fa6149e481 100644
> --- a/drivers/pci/tsm.c
> +++ b/drivers/pci/tsm.c
> @@ -84,6 +84,7 @@ static void pci_tsm_walk_fns(struct pci_dev *pdev,
> for (int i = 0; i < 8; i++) {
> struct pci_dev *pf __free(pci_dev_put) = pci_get_slot(
> pdev->bus, PCI_DEVFN(PCI_SLOT(pdev->devfn), i));
> + struct pci_dev *vf;
>
> if (!pf)
> continue;
> @@ -93,18 +94,8 @@ static void pci_tsm_walk_fns(struct pci_dev *pdev,
> cb(pf, data);
>
> /* walk virtual functions of each pf */
> - for (int j = 0; j < pci_num_vf(pf); j++) {
> - struct pci_dev *vf __free(pci_dev_put) =
> - pci_get_domain_bus_and_slot(
> - pci_domain_nr(pf->bus),
> - pci_iov_virtfn_bus(pf, j),
> - pci_iov_virtfn_devfn(pf, j));
> -
> - if (!vf)
> - continue;
> -
> + for_each_pci_vf(pf, vf)
> cb(vf, data);
> - }
> }
>
> /*
> @@ -128,22 +119,14 @@ static void pci_tsm_walk_fns_reverse(struct pci_dev *pdev,
> for (int i = 7; i >= 0; i--) {
> struct pci_dev *pf __free(pci_dev_put) = pci_get_slot(
> pdev->bus, PCI_DEVFN(PCI_SLOT(pdev->devfn), i));
> + struct pci_dev *vf;
>
> if (!pf)
> continue;
>
> /* reverse walk virtual functions */
> - for (int j = pci_num_vf(pf) - 1; j >= 0; j--) {
> - struct pci_dev *vf __free(pci_dev_put) =
> - pci_get_domain_bus_and_slot(
> - pci_domain_nr(pf->bus),
> - pci_iov_virtfn_bus(pf, j),
> - pci_iov_virtfn_devfn(pf, j));
> -
> - if (!vf)
> - continue;
> + for_each_pci_vf_reverse(pf, vf)
> cb(vf, data);
> - }
>
> /* on exit, caller will run @cb on function 0 */
> if (i > 0)
> --
> 2.43.0
>
next prev parent reply other threads:[~2026-10-27 20:08 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-27 16:04 [PATCH v2 00/13] PCI/IOV: Improve reset handling with VFs enabled Lukasz Laguna
2026-10-27 16:04 ` [PATCH v2 01/13] PCI/IOV: Introduce pci_iov_get_virtfn() Lukasz Laguna
2026-10-27 16:20 ` sashiko-bot
2026-10-27 16:04 ` [PATCH v2 02/13] PCI/IOV: Introduce VF iterators Lukasz Laguna
2026-10-27 16:21 ` sashiko-bot
2026-10-27 21:35 ` Bjorn Helgaas
2026-10-28 7:29 ` Laguna, Lukasz
2026-10-27 16:04 ` [PATCH v2 03/13] PCI/IOV: Introduce VF locking helpers Lukasz Laguna
2026-10-27 16:26 ` sashiko-bot
2026-10-27 16:04 ` [PATCH v2 04/13] PCI/IOV: Allow VF drivers to handle resets Lukasz Laguna
2026-10-27 16:34 ` sashiko-bot
2026-10-27 16:51 ` Laguna, Lukasz
2026-10-28 8:52 ` Weili Qian
2026-10-28 14:05 ` Laguna, Lukasz
2026-10-27 20:00 ` Bjorn Helgaas
2026-10-28 6:39 ` Laguna, Lukasz
2026-10-27 16:04 ` [PATCH v2 05/13] ionic: Lock VFs around pci_reset_function_locked() Lukasz Laguna
2026-10-27 16:14 ` sashiko-bot
2026-10-27 16:04 ` [PATCH v2 06/13] pds_core: " Lukasz Laguna
2026-10-27 16:12 ` sashiko-bot
2026-10-27 16:04 ` [PATCH v2 07/13] i40e: Drop VF MSI state restore from PF reset_done Lukasz Laguna
2026-10-27 16:13 ` sashiko-bot
2026-10-27 16:04 ` [PATCH v2 08/13] PCI/IOV: Allow bus reset_method for PF with VFs enabled Lukasz Laguna
2026-10-27 16:20 ` sashiko-bot
2026-10-27 16:04 ` [PATCH v2 09/13] PCI/TSM: Use generic VF iterators Lukasz Laguna
2026-10-27 16:15 ` sashiko-bot
2026-10-27 20:08 ` Bjorn Helgaas [this message]
2026-10-28 7:25 ` Laguna, Lukasz
2026-10-27 16:04 ` [PATCH v2 10/13] ixgbe: Use generic VF iterator Lukasz Laguna
2026-10-27 16:17 ` sashiko-bot
2026-10-27 16:04 ` [PATCH v2 11/13] ice: Use pci_iov_get_virtfn() Lukasz Laguna
2026-10-27 16:20 ` sashiko-bot
2026-10-27 16:04 ` [PATCH v2 12/13] liquidio: " Lukasz Laguna
2026-10-27 16:19 ` sashiko-bot
2026-10-27 16:04 ` [PATCH v2 13/13] drm/xe/pf: " Lukasz Laguna
2026-10-27 16:21 ` sashiko-bot
2026-10-27 19:49 ` [PATCH v2 00/13] PCI/IOV: Improve reset handling with VFs enabled Bjorn Helgaas
2026-10-28 7:03 ` Laguna, Lukasz
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=20261027200818.GA482873@bhelgaas \
--to=helgaas@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=bhelgaas@google.com \
--cc=brett.creeley@amd.com \
--cc=davem@davemloft.net \
--cc=djbw@kernel.org \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lukasz.laguna@intel.com \
--cc=michal.winiarski@intel.com \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@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