scsi: add support for multiple hardware queues
authorBart Van Assche <bvanassche@acm.org>
Thu, 30 Oct 2014 13:45:36 +0000 (14:45 +0100)
committerChristoph Hellwig <hch@lst.de>
Wed, 12 Nov 2014 10:16:09 +0000 (11:16 +0100)
Allow a SCSI LLD to declare how many hardware queues it supports
by setting Scsi_Host.nr_hw_queues before calling scsi_add_host().

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/scsi/scsi_lib.c
include/scsi/scsi_host.h

index fc0a8a0c0a34cd584d72996196d618ceceed34cd..38f8c85957b6a7e3278fef7f6d51f0813f3be1c7 100644 (file)
@@ -2106,7 +2106,7 @@ int scsi_mq_setup_tags(struct Scsi_Host *shost)
 
        memset(&shost->tag_set, 0, sizeof(shost->tag_set));
        shost->tag_set.ops = &scsi_mq_ops;
-       shost->tag_set.nr_hw_queues = 1;
+       shost->tag_set.nr_hw_queues = shost->nr_hw_queues ? : 1;
        shost->tag_set.queue_depth = shost->can_queue;
        shost->tag_set.cmd_size = cmd_size;
        shost->tag_set.numa_node = NUMA_NO_NODE;
index 5e362489ee88a024d8216c1740fa0b424e723bb2..bb9e27815be5d7dba5888e5a4f7fb7b7abc17512 100644 (file)
@@ -638,6 +638,14 @@ struct Scsi_Host {
        short unsigned int sg_prot_tablesize;
        unsigned int max_sectors;
        unsigned long dma_boundary;
+       /*
+        * In scsi-mq mode, the number of hardware queues supported by the LLD.
+        *
+        * Note: it is assumed that each hardware queue has a queue depth of
+        * can_queue. In other words, the total queue depth per host
+        * is nr_hw_queues * can_queue.
+        */
+       unsigned nr_hw_queues;
        /* 
         * Used to assign serial numbers to the cmds.
         * Protected by the host lock.