[PATCH v3 04/15] scsi: replace blk_mq_pci_map_queues with blk_mq_dev_map_queues
John Garry
john.g.garry at oracle.com
Mon Aug 12 08:31:32 PDT 2024
On 06/08/2024 13:06, Daniel Wagner wrote:
> Replace all users of blk_mq_pci_map_queues with the more generic
> blk_mq_dev_map_queues. This in preparation to retire
> blk_mq_pci_map_queues.
nit: About blk_mq_dev_map_queues(), from the name it gives the
impression that we deal in struct device, which is not the case.
>
> Signed-off-by: Daniel Wagner <dwagner at suse.de>
> ---
> drivers/scsi/fnic/fnic_main.c | 3 ++-
> drivers/scsi/hisi_sas/hisi_sas.h | 1 -
> drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 20 ++++++++++----------
> drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 5 +++--
> drivers/scsi/megaraid/megaraid_sas_base.c | 3 ++-
> drivers/scsi/mpi3mr/mpi3mr_os.c | 3 ++-
> drivers/scsi/mpt3sas/mpt3sas_scsih.c | 3 ++-
> drivers/scsi/pm8001/pm8001_init.c | 3 ++-
> drivers/scsi/qla2xxx/qla_nvme.c | 3 ++-
> drivers/scsi/qla2xxx/qla_os.c | 3 ++-
> drivers/scsi/smartpqi/smartpqi_init.c | 7 ++++---
> 11 files changed, 31 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
> index 29eead383eb9..dee7f241c38a 100644
> --- a/drivers/scsi/fnic/fnic_main.c
> +++ b/drivers/scsi/fnic/fnic_main.c
> @@ -601,7 +601,8 @@ void fnic_mq_map_queues_cpus(struct Scsi_Host *host)
> return;
> }
>
> - blk_mq_pci_map_queues(qmap, l_pdev, FNIC_PCI_OFFSET);
> + blk_mq_dev_map_queues(qmap, l_pdev, FNIC_PCI_OFFSET,
> + blk_mq_pci_get_queue_affinity);
> }
>
> static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h
> index d223f482488f..010479a354ee 100644
> --- a/drivers/scsi/hisi_sas/hisi_sas.h
> +++ b/drivers/scsi/hisi_sas/hisi_sas.h
> @@ -9,7 +9,6 @@
>
> #include <linux/acpi.h>
> #include <linux/blk-mq.h>
> -#include <linux/blk-mq-pci.h>
> #include <linux/clk.h>
> #include <linux/debugfs.h>
> #include <linux/dmapool.h>
> diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
> index 342d75f12051..91daf57f328c 100644
> --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
> +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
> @@ -3549,21 +3549,21 @@ static const struct attribute_group *sdev_groups_v2_hw[] = {
> NULL
> };
>
> +static const struct cpumask *hisi_hba_get_queue_affinity(void *dev_data,
> + int offset, int idx)
personally I think that name "queue" would be better than "idx"
> +{
> + struct hisi_hba *hba = dev_data;
> +
> + return irq_get_affinity_mask(hba->irq_map[offset + idx]);
> +}
> +
> static void map_queues_v2_hw(struct Scsi_Host *shost)
> {
> struct hisi_hba *hisi_hba = shost_priv(shost);
> struct blk_mq_queue_map *qmap = &shost->tag_set.map[HCTX_TYPE_DEFAULT];
> - const struct cpumask *mask;
> - unsigned int queue, cpu;
>
> - for (queue = 0; queue < qmap->nr_queues; queue++) {
> - mask = irq_get_affinity_mask(hisi_hba->irq_map[96 + queue]);
> - if (!mask)
> - continue;
> -
> - for_each_cpu(cpu, mask)
> - qmap->mq_map[cpu] = qmap->queue_offset + queue;
> - }
> + return blk_mq_dev_map_queues(qmap, hisi_hba, 96,
blk_mq_dev_map_queues() returns void, and so we should not return the
value (which is void).
And I know that the current code is like this, but using CQ0_IRQ_INDEX
instead of 96 would be nicer.
> + hisi_hba_get_queue_affinity);
> }
>
> static const struct scsi_host_template sht_v2_hw = {
> diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
> index feda9b54b443..0b3c7b49813a 100644
> --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
> +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
> @@ -3322,8 +3322,9 @@ static void hisi_sas_map_queues(struct Scsi_Host *shost)
> if (i == HCTX_TYPE_POLL)
More information about the Linux-nvme
mailing list