All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: James Bottomley <james.bottomley@hansenpartnership.com>,
	Christoph Hellwig <hch@lst.de>,
	linux-scsi@vger.kernel.org,
	Sathya Prakash <sathya.prakash@broadcom.com>,
	Kashyap Desai <kashyap.desai@broadcom.com>,
	mpt-fusionlinux.pdl@broadcom.com, Hannes Reinecke <hare@suse.de>,
	Hannes Reinecke <hare@suse.com>
Subject: [PATCH 10/10] mpt3sas: scsi-mq interrupt steering
Date: Tue, 31 Jan 2017 10:26:00 +0100	[thread overview]
Message-ID: <1485854760-122683-11-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1485854760-122683-1-git-send-email-hare@suse.de>

Enable all queues and implement correct I/O steering for scsi-mq.

Signed-off-by: Hannes Reinecke <hare@suse.com>
---
 drivers/scsi/mpt3sas/mpt3sas_base.c  |  8 ++++++--
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 19 +++++++++++++++++++
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index f6564a3..84f808d 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -3560,9 +3560,13 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
 	 * with some internal commands that could be outstanding
 	 */
 	ioc->shost->can_queue = ioc->scsiio_depth - INTERNAL_SCSIIO_CMDS_COUNT;
+	if (ioc->shost->nr_hw_queues > 1) {
+		ioc->shost->nr_hw_queues = ioc->msix_vector_count;
+		ioc->shost->can_queue /= ioc->msix_vector_count;
+	}
 	dinitprintk(ioc, pr_info(MPT3SAS_FMT
-		"scsi host: can_queue depth (%d)\n",
-		ioc->name, ioc->shost->can_queue));
+		"scsi host: can_queue depth (%d), nr_hw_queues (%d)\n",
+		ioc->name, ioc->shost->can_queue, ioc->shost->nr_hw_queues));
 
 
 	/* contiguous pool for request and chains, 16 byte align, one extra "
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 8c451aa..e43f928 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -54,6 +54,7 @@
 #include <linux/interrupt.h>
 #include <linux/aer.h>
 #include <linux/raid_class.h>
+#include <linux/blk-mq-pci.h>
 #include <asm/unaligned.h>
 
 #include "mpt3sas_base.h"
@@ -4255,6 +4256,11 @@ void _flush_running(struct request *req, void *data, bool reserved)
 		mpt3sas_setup_direct_io(ioc, scmd, raid_device, mpi_request,
 		    smid);
 
+	if (shost_use_blk_mq(ioc->shost) && (ioc->shost->nr_hw_queues > 1)) {
+		u32 unique_tag = blk_mq_unique_tag(scmd->request);
+
+		msix_task = blk_mq_unique_tag_to_hwq(unique_tag);
+	}
 	if (likely(mpi_request->Function == MPI2_FUNCTION_SCSI_IO_REQUEST)) {
 		if (sas_target_priv_data->flags & MPT_TARGET_FASTPATH_IO) {
 			mpi_request->IoFlags = cpu_to_le16(scmd->cmd_len |
@@ -8775,6 +8781,16 @@ static void sas_device_make_active(struct MPT3SAS_ADAPTER *ioc,
 	return 1;
 }
 
+static int scsih_map_queues(struct Scsi_Host *shost)
+{
+	struct MPT3SAS_ADAPTER *ioc = shost_priv(shost);
+
+	if (shost->nr_hw_queues > 1)
+		return blk_mq_pci_map_queues(&shost->tag_set, ioc->pdev);
+
+	return -EINVAL;
+}
+
 /* shost template for SAS 2.0 HBA devices */
 static struct scsi_host_template mpt2sas_driver_template = {
 	.module				= THIS_MODULE,
@@ -8788,6 +8804,7 @@ static void sas_device_make_active(struct MPT3SAS_ADAPTER *ioc,
 	.slave_destroy			= scsih_slave_destroy,
 	.scan_finished			= scsih_scan_finished,
 	.scan_start			= scsih_scan_start,
+	.map_queues			= scsih_map_queues,
 	.change_queue_depth		= scsih_change_queue_depth,
 	.eh_abort_handler		= scsih_abort,
 	.eh_device_reset_handler	= scsih_dev_reset,
@@ -9054,6 +9071,8 @@ static void sas_device_make_active(struct MPT3SAS_ADAPTER *ioc,
 	shost->max_lun = max_lun;
 	shost->transportt = mpt3sas_transport_template;
 	shost->unique_id = ioc->id;
+	if (shost->use_blk_mq)
+		shost->nr_hw_queues = num_online_cpus();
 
 	if (max_sectors != 0xFFFF) {
 		if (max_sectors < 64) {
-- 
1.8.5.6


  parent reply	other threads:[~2017-01-31  9:26 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-31  9:25 [PATCH 00/10] mpt3sas: full mq support Hannes Reinecke
2017-01-31  9:25 ` [PATCH 01/10] mpt3sas: switch to pci_alloc_irq_vectors Hannes Reinecke
2017-02-07 13:15   ` Christoph Hellwig
2017-02-16  9:32   ` Sreekanth Reddy
2017-02-16 10:01     ` Hannes Reinecke
2017-01-31  9:25 ` [PATCH 02/10] mpt3sas: set default value for cb_idx Hannes Reinecke
2017-02-07 13:15   ` Christoph Hellwig
2017-01-31  9:25 ` [PATCH 03/10] mpt3sas: implement _dechain_st() Hannes Reinecke
2017-02-07 13:15   ` Christoph Hellwig
2017-02-07 13:18     ` Hannes Reinecke
2017-01-31  9:25 ` [PATCH 04/10] mpt3sas: separate out _base_recovery_check() Hannes Reinecke
2017-02-07 13:16   ` Christoph Hellwig
2017-02-16  9:53   ` Sreekanth Reddy
2017-02-16 10:03     ` Hannes Reinecke
2017-01-31  9:25 ` [PATCH 05/10] mpt3sas: open-code _scsih_scsi_lookup_get() Hannes Reinecke
2017-02-07 13:16   ` Christoph Hellwig
2017-02-16  9:59   ` Sreekanth Reddy
2017-02-16 10:04     ` Hannes Reinecke
2017-01-31  9:25 ` [PATCH 06/10] mpt3sas: Introduce mpt3sas_get_st_from_smid() Hannes Reinecke
2017-02-07 13:17   ` Christoph Hellwig
2017-01-31  9:25 ` [PATCH 07/10] mpt3sas: use hi-priority queue for TMFs Hannes Reinecke
2017-02-07 13:19   ` Christoph Hellwig
2017-02-16 10:09   ` Sreekanth Reddy
2017-02-16 10:14     ` Hannes Reinecke
2017-02-16 10:23       ` Sreekanth Reddy
2017-02-16 10:26         ` Hannes Reinecke
2017-01-31  9:25 ` [PATCH 08/10] mpt3sas: lockless command submission for scsi-mq Hannes Reinecke
2017-01-31 13:22   ` Christoph Hellwig
2017-01-31 13:46     ` Hannes Reinecke
2017-01-31 14:24       ` Christoph Hellwig
2017-01-31  9:25 ` [PATCH 09/10] mpt3sas: Use 'msix_index' as argument for put_smid functions Hannes Reinecke
2017-01-31  9:26 ` Hannes Reinecke [this message]
2017-01-31 10:05   ` [PATCH 10/10] mpt3sas: scsi-mq interrupt steering Christoph Hellwig
2017-01-31 10:02 ` [PATCH 00/10] mpt3sas: full mq support Christoph Hellwig
2017-01-31 11:16   ` Hannes Reinecke
2017-01-31 17:54     ` Kashyap Desai
2017-02-01  6:51       ` Hannes Reinecke
2017-02-01  7:07         ` Kashyap Desai
2017-02-01  7:43           ` Hannes Reinecke
2017-02-09 13:03             ` Sreekanth Reddy
2017-02-09 13:12               ` Hannes Reinecke
2017-02-10  4:43                 ` Sreekanth Reddy
2017-02-10  6:59                   ` Hannes Reinecke
2017-02-13  6:15                     ` Sreekanth Reddy
2017-02-13 13:11                       ` Hannes Reinecke
2017-02-15  8:27                         ` Sreekanth Reddy
2017-02-15  9:18                           ` Kashyap Desai
2017-02-15 10:05                             ` Hannes Reinecke
2017-02-16  9:48                               ` Kashyap Desai
2017-02-16 10:18                                 ` Hannes Reinecke
2017-02-16 10:45                                   ` Kashyap Desai
2017-02-07 13:19 ` Christoph Hellwig
2017-02-07 14:38   ` Hannes Reinecke
2017-02-07 15:34     ` Christoph Hellwig
2017-02-07 15:39       ` Hannes Reinecke
2017-02-07 15:40         ` Christoph Hellwig
2017-02-07 15:49           ` Hannes Reinecke
2017-02-15  8:15   ` Christoph Hellwig
2017-02-15  8:19     ` Hannes Reinecke

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=1485854760-122683-11-git-send-email-hare@suse.de \
    --to=hare@suse.de \
    --cc=hare@suse.com \
    --cc=hch@lst.de \
    --cc=james.bottomley@hansenpartnership.com \
    --cc=kashyap.desai@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mpt-fusionlinux.pdl@broadcom.com \
    --cc=sathya.prakash@broadcom.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.