All of lore.kernel.org
 help / color / mirror / Atom feed
From: Himanshu Madhani <himanshu.madhani@cavium.com>
To: martin.petersen@oracle.com
Cc: linux-scsi@vger.kernel.org, himanshu.madhani@cavium.com
Subject: [PATCH v3 5/6] qla2xxx: Add Block Multi Queue functionality.
Date: Fri, 2 Dec 2016 13:44:56 -0800	[thread overview]
Message-ID: <1480715097-13611-6-git-send-email-himanshu.madhani@cavium.com> (raw)
In-Reply-To: <1480715097-13611-1-git-send-email-himanshu.madhani@cavium.com>

From: Michael Hernandez <michael.hernandez@cavium.com>

Tell the SCSI layer how many hardware queues we have based on the number
of max queue pairs created. The number of max queue pairs created will
depend on number of MSI-X vector count.

This feature can be turned on via CONFIG_SCSI_MQ_DEFAULT or passing
scsi_mod.use_blk_mq=Y as a parameter to the kernel

Queue pair creation depend on module parameter "ql2xmqsupport", which
need to be enabled to create queue pair.

Signed-off-by: Sawan Chandak <sawan.chandak@cavium.com>
Signed-off-by: Michael Hernandez <michael.hernandez@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
---
 drivers/scsi/qla2xxx/qla_os.c | 37 ++++++++++++++++++++++++++++++++-----
 1 file changed, 32 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index b06722a..3371b3f 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -667,16 +667,26 @@ static void qla2x00_free_queues(struct qla_hw_data *ha)
 	struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
 	srb_t *sp;
 	int rval;
-	struct qla_qpair *qpair;
+	struct qla_qpair *qpair = NULL;
+	uint32_t tag;
+	uint16_t hwq;
 
 	if (unlikely(test_bit(UNLOADING, &base_vha->dpc_flags))) {
 		cmd->result = DID_NO_CONNECT << 16;
 		goto qc24_fail_command;
 	}
 
-	if (vha->vp_idx && vha->qpair) {
-		qpair = vha->qpair;
-		return qla2xxx_mqueuecommand(host, cmd, qpair);
+	if (ha->mqenable) {
+		if (shost_use_blk_mq(vha->host)) {
+			tag = blk_mq_unique_tag(cmd->request);
+			hwq = blk_mq_unique_tag_to_hwq(tag);
+			qpair = ha->queue_pair_map[hwq];
+		} else if (vha->vp_idx && vha->qpair) {
+			qpair = vha->qpair;
+		}
+
+		if (qpair)
+			return qla2xxx_mqueuecommand(host, cmd, qpair);
 	}
 
 	if (ha->flags.eeh_busy) {
@@ -2362,6 +2372,7 @@ static void qla2x00_destroy_mbx_wq(struct qla_hw_data *ha)
 	uint16_t req_length = 0, rsp_length = 0;
 	struct req_que *req = NULL;
 	struct rsp_que *rsp = NULL;
+	int i;
 
 	bars = pci_select_bars(pdev, IORESOURCE_MEM | IORESOURCE_IO);
 	sht = &qla2xxx_driver_template;
@@ -2727,6 +2738,16 @@ static void qla2x00_destroy_mbx_wq(struct qla_hw_data *ha)
 		goto probe_init_failed;
 	}
 
+	if (ha->mqenable && shost_use_blk_mq(host)) {
+		/* number of hardware queues supported by blk/scsi-mq*/
+		host->nr_hw_queues = ha->max_qpairs;
+
+		ql_dbg(ql_dbg_init, base_vha, 0x0192,
+			"blk/scsi-mq enabled, HW queues = %d.\n", host->nr_hw_queues);
+	} else
+		ql_dbg(ql_dbg_init, base_vha, 0x0193,
+			"blk/scsi-mq disabled.\n");
+
 	qlt_probe_one_stage1(base_vha, ha);
 
 	pci_save_state(pdev);
@@ -2827,8 +2848,14 @@ static void qla2x00_destroy_mbx_wq(struct qla_hw_data *ha)
 	    host->can_queue, base_vha->req,
 	    base_vha->mgmt_svr_loop_id, host->sg_tablesize);
 
-	if (ha->mqenable)
+	if (ha->mqenable) {
 		ha->wq = alloc_workqueue("qla2xxx_wq", WQ_MEM_RECLAIM, 1);
+		/* Create start of day qpairs for Block MQ */
+		if (shost_use_blk_mq(host)) {
+			for (i = 0; i < ha->max_qpairs; i++)
+				qla2xxx_create_qpair(base_vha, 5, 0);
+		}
+	}
 
 	if (ha->flags.running_gold_fw)
 		goto skip_dpc;
-- 
1.8.3.1


  parent reply	other threads:[~2016-12-02 22:00 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-02 21:44 [PATCH v3 0/6] qla2xxx: Feture updates for driver Himanshu Madhani
2016-12-02 21:44 ` [PATCH v3 1/6] qla2xxx: Only allow operational MBX to proceed during RESET Himanshu Madhani
2016-12-05 16:01   ` Christoph Hellwig
2016-12-05 18:36     ` Madhani, Himanshu
2016-12-06 13:57       ` Christoph Hellwig
2016-12-02 21:44 ` [PATCH v3 2/6] qla2xxx: Fix mailbox command timeout due to starvation Himanshu Madhani
2016-12-05 16:03   ` Christoph Hellwig
2016-12-05 18:37     ` Madhani, Himanshu
2016-12-07 18:49       ` Christoph Hellwig
2016-12-02 21:44 ` [PATCH v3 3/6] qla2xxx: Utilize pci_alloc_irq_vectors/pci_free_irq_vectors calls Himanshu Madhani
2016-12-05  7:19   ` Hannes Reinecke
2016-12-05 12:54     ` Christoph Hellwig
2016-12-05 16:09       ` Christoph Hellwig
2016-12-05 12:55   ` Christoph Hellwig
2016-12-05 21:20     ` Madhani, Himanshu
2016-12-02 21:44 ` [PATCH v3 4/6] qla2xxx: Add multiple queue pair functionality Himanshu Madhani
2016-12-05  7:38   ` Hannes Reinecke
2016-12-05 12:59     ` Christoph Hellwig
2016-12-05 20:43     ` Madhani, Himanshu
2016-12-05 22:08       ` Madhani, Himanshu
2016-12-05 16:20   ` Christoph Hellwig
2016-12-05 22:41     ` Madhani, Himanshu
2016-12-02 21:44 ` Himanshu Madhani [this message]
2016-12-05  7:39   ` [PATCH v3 5/6] qla2xxx: Add Block Multi Queue functionality Hannes Reinecke
2016-12-02 21:44 ` [PATCH v3 6/6] qla2xxx: Fix Target mode handling with Multiqueue changes Himanshu Madhani
2016-12-05  7:42   ` Hannes Reinecke
2016-12-05 21:06     ` Madhani, Himanshu

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=1480715097-13611-6-git-send-email-himanshu.madhani@cavium.com \
    --to=himanshu.madhani@cavium.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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.