diff options
-rw-r--r-- | drivers/scsi/qla2xxx/qla_os.c | 47 |
1 files changed, 42 insertions, 5 deletions
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 6ef32c932826..d10a8763caaf 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/mutex.h> | 13 | #include <linux/mutex.h> |
14 | #include <linux/kobject.h> | 14 | #include <linux/kobject.h> |
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <linux/blk-mq-pci.h> | ||
16 | #include <scsi/scsi_tcq.h> | 17 | #include <scsi/scsi_tcq.h> |
17 | #include <scsi/scsicam.h> | 18 | #include <scsi/scsicam.h> |
18 | #include <scsi/scsi_transport.h> | 19 | #include <scsi/scsi_transport.h> |
@@ -254,6 +255,7 @@ static int qla2xxx_eh_host_reset(struct scsi_cmnd *); | |||
254 | static void qla2x00_clear_drv_active(struct qla_hw_data *); | 255 | static void qla2x00_clear_drv_active(struct qla_hw_data *); |
255 | static void qla2x00_free_device(scsi_qla_host_t *); | 256 | static void qla2x00_free_device(scsi_qla_host_t *); |
256 | static void qla83xx_disable_laser(scsi_qla_host_t *vha); | 257 | static void qla83xx_disable_laser(scsi_qla_host_t *vha); |
258 | static int qla2xxx_map_queues(struct Scsi_Host *shost); | ||
257 | 259 | ||
258 | struct scsi_host_template qla2xxx_driver_template = { | 260 | struct scsi_host_template qla2xxx_driver_template = { |
259 | .module = THIS_MODULE, | 261 | .module = THIS_MODULE, |
@@ -273,6 +275,7 @@ struct scsi_host_template qla2xxx_driver_template = { | |||
273 | .scan_finished = qla2xxx_scan_finished, | 275 | .scan_finished = qla2xxx_scan_finished, |
274 | .scan_start = qla2xxx_scan_start, | 276 | .scan_start = qla2xxx_scan_start, |
275 | .change_queue_depth = scsi_change_queue_depth, | 277 | .change_queue_depth = scsi_change_queue_depth, |
278 | .map_queues = qla2xxx_map_queues, | ||
276 | .this_id = -1, | 279 | .this_id = -1, |
277 | .cmd_per_lun = 3, | 280 | .cmd_per_lun = 3, |
278 | .use_clustering = ENABLE_CLUSTERING, | 281 | .use_clustering = ENABLE_CLUSTERING, |
@@ -738,16 +741,26 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) | |||
738 | struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); | 741 | struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); |
739 | srb_t *sp; | 742 | srb_t *sp; |
740 | int rval; | 743 | int rval; |
741 | struct qla_qpair *qpair; | 744 | struct qla_qpair *qpair = NULL; |
745 | uint32_t tag; | ||
746 | uint16_t hwq; | ||
742 | 747 | ||
743 | if (unlikely(test_bit(UNLOADING, &base_vha->dpc_flags))) { | 748 | if (unlikely(test_bit(UNLOADING, &base_vha->dpc_flags))) { |
744 | cmd->result = DID_NO_CONNECT << 16; | 749 | cmd->result = DID_NO_CONNECT << 16; |
745 | goto qc24_fail_command; | 750 | goto qc24_fail_command; |
746 | } | 751 | } |
747 | 752 | ||
748 | if (vha->vp_idx && vha->qpair) { | 753 | if (ha->mqenable) { |
749 | qpair = vha->qpair; | 754 | if (shost_use_blk_mq(vha->host)) { |
750 | return qla2xxx_mqueuecommand(host, cmd, qpair); | 755 | tag = blk_mq_unique_tag(cmd->request); |
756 | hwq = blk_mq_unique_tag_to_hwq(tag); | ||
757 | qpair = ha->queue_pair_map[hwq]; | ||
758 | } else if (vha->vp_idx && vha->qpair) { | ||
759 | qpair = vha->qpair; | ||
760 | } | ||
761 | |||
762 | if (qpair) | ||
763 | return qla2xxx_mqueuecommand(host, cmd, qpair); | ||
751 | } | 764 | } |
752 | 765 | ||
753 | if (ha->flags.eeh_busy) { | 766 | if (ha->flags.eeh_busy) { |
@@ -2509,6 +2522,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
2509 | uint16_t req_length = 0, rsp_length = 0; | 2522 | uint16_t req_length = 0, rsp_length = 0; |
2510 | struct req_que *req = NULL; | 2523 | struct req_que *req = NULL; |
2511 | struct rsp_que *rsp = NULL; | 2524 | struct rsp_que *rsp = NULL; |
2525 | int i; | ||
2512 | 2526 | ||
2513 | bars = pci_select_bars(pdev, IORESOURCE_MEM | IORESOURCE_IO); | 2527 | bars = pci_select_bars(pdev, IORESOURCE_MEM | IORESOURCE_IO); |
2514 | sht = &qla2xxx_driver_template; | 2528 | sht = &qla2xxx_driver_template; |
@@ -2874,6 +2888,16 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
2874 | goto probe_init_failed; | 2888 | goto probe_init_failed; |
2875 | } | 2889 | } |
2876 | 2890 | ||
2891 | if (ha->mqenable && shost_use_blk_mq(host)) { | ||
2892 | /* number of hardware queues supported by blk/scsi-mq*/ | ||
2893 | host->nr_hw_queues = ha->max_qpairs; | ||
2894 | |||
2895 | ql_dbg(ql_dbg_init, base_vha, 0x0192, | ||
2896 | "blk/scsi-mq enabled, HW queues = %d.\n", host->nr_hw_queues); | ||
2897 | } else | ||
2898 | ql_dbg(ql_dbg_init, base_vha, 0x0193, | ||
2899 | "blk/scsi-mq disabled.\n"); | ||
2900 | |||
2877 | qlt_probe_one_stage1(base_vha, ha); | 2901 | qlt_probe_one_stage1(base_vha, ha); |
2878 | 2902 | ||
2879 | pci_save_state(pdev); | 2903 | pci_save_state(pdev); |
@@ -2965,8 +2989,14 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
2965 | host->can_queue, base_vha->req, | 2989 | host->can_queue, base_vha->req, |
2966 | base_vha->mgmt_svr_loop_id, host->sg_tablesize); | 2990 | base_vha->mgmt_svr_loop_id, host->sg_tablesize); |
2967 | 2991 | ||
2968 | if (ha->mqenable) | 2992 | if (ha->mqenable) { |
2969 | ha->wq = alloc_workqueue("qla2xxx_wq", WQ_MEM_RECLAIM, 1); | 2993 | ha->wq = alloc_workqueue("qla2xxx_wq", WQ_MEM_RECLAIM, 1); |
2994 | /* Create start of day qpairs for Block MQ */ | ||
2995 | if (shost_use_blk_mq(host)) { | ||
2996 | for (i = 0; i < ha->max_qpairs; i++) | ||
2997 | qla2xxx_create_qpair(base_vha, 5, 0); | ||
2998 | } | ||
2999 | } | ||
2970 | 3000 | ||
2971 | if (ha->flags.running_gold_fw) | 3001 | if (ha->flags.running_gold_fw) |
2972 | goto skip_dpc; | 3002 | goto skip_dpc; |
@@ -6109,6 +6139,13 @@ qla83xx_disable_laser(scsi_qla_host_t *vha) | |||
6109 | qla83xx_wr_reg(vha, reg, data); | 6139 | qla83xx_wr_reg(vha, reg, data); |
6110 | } | 6140 | } |
6111 | 6141 | ||
6142 | static int qla2xxx_map_queues(struct Scsi_Host *shost) | ||
6143 | { | ||
6144 | scsi_qla_host_t *vha = (scsi_qla_host_t *)shost->hostdata; | ||
6145 | |||
6146 | return blk_mq_pci_map_queues(&shost->tag_set, vha->hw->pdev); | ||
6147 | } | ||
6148 | |||
6112 | static const struct pci_error_handlers qla2xxx_err_handler = { | 6149 | static const struct pci_error_handlers qla2xxx_err_handler = { |
6113 | .error_detected = qla2xxx_pci_error_detected, | 6150 | .error_detected = qla2xxx_pci_error_detected, |
6114 | .mmio_enabled = qla2xxx_pci_mmio_enabled, | 6151 | .mmio_enabled = qla2xxx_pci_mmio_enabled, |