summaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2014-11-03 08:09:02 -0500
committerChristoph Hellwig <hch@lst.de>2014-11-12 05:19:43 -0500
commit2ecb204d07ac8debe3893c362415919bc78bebd6 (patch)
treeeef99b324201b21de358dffdab8bfc0453358d5f /drivers/scsi
parente2eddf4d530df745019fded0fedfb78f6d3e33ca (diff)
scsi: always assign block layer tags if enabled
Allow a driver to ask for block layer tags by setting .use_blk_tags in the host template, in which case it will always see a valid value in request->tag, similar to the behavior when using blk-mq. This means even SCSI "untagged" commands will now have a tag, which is especially useful when using a host-wide tag map. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Hannes Reinecke <hare@suse.de>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/53c700.c12
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.c11
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.c11
-rw-r--r--drivers/scsi/aic94xx/aic94xx_init.c1
-rw-r--r--drivers/scsi/bfa/bfad_im.c8
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc_fcoe.c1
-rw-r--r--drivers/scsi/csiostor/csio_scsi.c8
-rw-r--r--drivers/scsi/esas2r/esas2r_main.c12
-rw-r--r--drivers/scsi/esp_scsi.c6
-rw-r--r--drivers/scsi/fcoe/fcoe.c1
-rw-r--r--drivers/scsi/fnic/fnic_main.c3
-rw-r--r--drivers/scsi/ibmvscsi/ibmvfc.c11
-rw-r--r--drivers/scsi/ipr.c1
-rw-r--r--drivers/scsi/isci/init.c1
-rw-r--r--drivers/scsi/libfc/fc_fcp.c7
-rw-r--r--drivers/scsi/libsas/sas_scsi_host.c11
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c7
-rw-r--r--drivers/scsi/mvsas/mv_init.c1
-rw-r--r--drivers/scsi/pm8001/pm8001_init.c1
-rw-r--r--drivers/scsi/pmcraid.c4
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c6
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c10
-rw-r--r--drivers/scsi/scsi.c12
-rw-r--r--drivers/scsi/scsi_scan.c6
-rw-r--r--drivers/scsi/stex.c10
-rw-r--r--drivers/scsi/tmscsim.c3
-rw-r--r--drivers/scsi/ufs/ufshcd.c5
27 files changed, 76 insertions, 94 deletions
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index 1b36fd3a6e62..497cbb1efd4b 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -327,6 +327,7 @@ NCR_700_detect(struct scsi_host_template *tpnt,
327 tpnt->slave_alloc = NCR_700_slave_alloc; 327 tpnt->slave_alloc = NCR_700_slave_alloc;
328 tpnt->change_queue_depth = NCR_700_change_queue_depth; 328 tpnt->change_queue_depth = NCR_700_change_queue_depth;
329 tpnt->change_queue_type = NCR_700_change_queue_type; 329 tpnt->change_queue_type = NCR_700_change_queue_type;
330 tpnt->use_blk_tags = 1;
330 331
331 if(tpnt->name == NULL) 332 if(tpnt->name == NULL)
332 tpnt->name = "53c700"; 333 tpnt->name = "53c700";
@@ -902,7 +903,7 @@ process_message(struct Scsi_Host *host, struct NCR_700_Host_Parameters *hostdata
902 NCR_700_set_tag_neg_state(SCp->device, NCR_700_FINISHED_TAG_NEGOTIATION); 903 NCR_700_set_tag_neg_state(SCp->device, NCR_700_FINISHED_TAG_NEGOTIATION);
903 hostdata->tag_negotiated &= ~(1<<scmd_id(SCp)); 904 hostdata->tag_negotiated &= ~(1<<scmd_id(SCp));
904 SCp->device->tagged_supported = 0; 905 SCp->device->tagged_supported = 0;
905 scsi_deactivate_tcq(SCp->device, host->cmd_per_lun); 906 scsi_adjust_queue_depth(SCp->device, 0, host->cmd_per_lun);
906 } else { 907 } else {
907 shost_printk(KERN_WARNING, host, 908 shost_printk(KERN_WARNING, host,
908 "(%d:%d) Unexpected REJECT Message %s\n", 909 "(%d:%d) Unexpected REJECT Message %s\n",
@@ -2049,8 +2050,7 @@ NCR_700_slave_configure(struct scsi_device *SDp)
2049 2050
2050 /* to do here: allocate memory; build a queue_full list */ 2051 /* to do here: allocate memory; build a queue_full list */
2051 if(SDp->tagged_supported) { 2052 if(SDp->tagged_supported) {
2052 scsi_set_tag_type(SDp, MSG_ORDERED_TAG); 2053 scsi_adjust_queue_depth(SDp, MSG_ORDERED_TAG, NCR_700_DEFAULT_TAGS);
2053 scsi_activate_tcq(SDp, NCR_700_DEFAULT_TAGS);
2054 NCR_700_set_tag_neg_state(SDp, NCR_700_START_TAG_NEGOTIATION); 2054 NCR_700_set_tag_neg_state(SDp, NCR_700_START_TAG_NEGOTIATION);
2055 } else { 2055 } else {
2056 /* initialise to default depth */ 2056 /* initialise to default depth */
@@ -2094,8 +2094,6 @@ static int NCR_700_change_queue_type(struct scsi_device *SDp, int tag_type)
2094 struct NCR_700_Host_Parameters *hostdata = 2094 struct NCR_700_Host_Parameters *hostdata =
2095 (struct NCR_700_Host_Parameters *)SDp->host->hostdata[0]; 2095 (struct NCR_700_Host_Parameters *)SDp->host->hostdata[0];
2096 2096
2097 scsi_set_tag_type(SDp, tag_type);
2098
2099 /* We have a global (per target) flag to track whether TCQ is 2097 /* We have a global (per target) flag to track whether TCQ is
2100 * enabled, so we'll be turning it off for the entire target here. 2098 * enabled, so we'll be turning it off for the entire target here.
2101 * our tag algorithm will fail if we mix tagged and untagged commands, 2099 * our tag algorithm will fail if we mix tagged and untagged commands,
@@ -2106,12 +2104,12 @@ static int NCR_700_change_queue_type(struct scsi_device *SDp, int tag_type)
2106 if (!tag_type) { 2104 if (!tag_type) {
2107 /* shift back to the default unqueued number of commands 2105 /* shift back to the default unqueued number of commands
2108 * (the user can still raise this) */ 2106 * (the user can still raise this) */
2109 scsi_deactivate_tcq(SDp, SDp->host->cmd_per_lun); 2107 scsi_adjust_queue_depth(SDp, 0, SDp->host->cmd_per_lun);
2110 hostdata->tag_negotiated &= ~(1 << sdev_id(SDp)); 2108 hostdata->tag_negotiated &= ~(1 << sdev_id(SDp));
2111 } else { 2109 } else {
2112 /* Here, we cleared the negotiation flag above, so this 2110 /* Here, we cleared the negotiation flag above, so this
2113 * will force the driver to renegotiate */ 2111 * will force the driver to renegotiate */
2114 scsi_activate_tcq(SDp, SDp->queue_depth); 2112 scsi_adjust_queue_depth(SDp, tag_type, SDp->queue_depth);
2115 if (change_tag) 2113 if (change_tag)
2116 NCR_700_set_tag_neg_state(SDp, NCR_700_START_TAG_NEGOTIATION); 2114 NCR_700_set_tag_neg_state(SDp, NCR_700_START_TAG_NEGOTIATION);
2117 } 2115 }
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index d3b6d68107ea..9fd6b5618b25 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -925,6 +925,7 @@ struct scsi_host_template aic79xx_driver_template = {
925 .slave_configure = ahd_linux_slave_configure, 925 .slave_configure = ahd_linux_slave_configure,
926 .target_alloc = ahd_linux_target_alloc, 926 .target_alloc = ahd_linux_target_alloc,
927 .target_destroy = ahd_linux_target_destroy, 927 .target_destroy = ahd_linux_target_destroy,
928 .use_blk_tags = 1,
928}; 929};
929 930
930/******************************** Bus DMA *************************************/ 931/******************************** Bus DMA *************************************/
@@ -1468,12 +1469,12 @@ ahd_platform_set_tags(struct ahd_softc *ahd, struct scsi_device *sdev,
1468 1469
1469 switch ((dev->flags & (AHD_DEV_Q_BASIC|AHD_DEV_Q_TAGGED))) { 1470 switch ((dev->flags & (AHD_DEV_Q_BASIC|AHD_DEV_Q_TAGGED))) {
1470 case AHD_DEV_Q_BASIC: 1471 case AHD_DEV_Q_BASIC:
1471 scsi_set_tag_type(sdev, MSG_SIMPLE_TASK); 1472 scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TASK,
1472 scsi_activate_tcq(sdev, dev->openings + dev->active); 1473 dev->openings + dev->active);
1473 break; 1474 break;
1474 case AHD_DEV_Q_TAGGED: 1475 case AHD_DEV_Q_TAGGED:
1475 scsi_set_tag_type(sdev, MSG_ORDERED_TASK); 1476 scsi_adjust_queue_depth(sdev, MSG_ORDERED_TASK,
1476 scsi_activate_tcq(sdev, dev->openings + dev->active); 1477 dev->openings + dev->active);
1477 break; 1478 break;
1478 default: 1479 default:
1479 /* 1480 /*
@@ -1482,7 +1483,7 @@ ahd_platform_set_tags(struct ahd_softc *ahd, struct scsi_device *sdev,
1482 * serially on the controller/device. This should 1483 * serially on the controller/device. This should
1483 * remove some latency. 1484 * remove some latency.
1484 */ 1485 */
1485 scsi_deactivate_tcq(sdev, 1); 1486 scsi_adjust_queue_depth(sdev, 0, 1);
1486 break; 1487 break;
1487 } 1488 }
1488} 1489}
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index 33a5f959e86a..f18b6d69d3fb 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -812,6 +812,7 @@ struct scsi_host_template aic7xxx_driver_template = {
812 .slave_configure = ahc_linux_slave_configure, 812 .slave_configure = ahc_linux_slave_configure,
813 .target_alloc = ahc_linux_target_alloc, 813 .target_alloc = ahc_linux_target_alloc,
814 .target_destroy = ahc_linux_target_destroy, 814 .target_destroy = ahc_linux_target_destroy,
815 .use_blk_tags = 1,
815}; 816};
816 817
817/**************************** Tasklet Handler *********************************/ 818/**************************** Tasklet Handler *********************************/
@@ -1334,12 +1335,12 @@ ahc_platform_set_tags(struct ahc_softc *ahc, struct scsi_device *sdev,
1334 } 1335 }
1335 switch ((dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED))) { 1336 switch ((dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED))) {
1336 case AHC_DEV_Q_BASIC: 1337 case AHC_DEV_Q_BASIC:
1337 scsi_set_tag_type(sdev, MSG_SIMPLE_TAG); 1338 scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TASK,
1338 scsi_activate_tcq(sdev, dev->openings + dev->active); 1339 dev->openings + dev->active);
1339 break; 1340 break;
1340 case AHC_DEV_Q_TAGGED: 1341 case AHC_DEV_Q_TAGGED:
1341 scsi_set_tag_type(sdev, MSG_ORDERED_TAG); 1342 scsi_adjust_queue_depth(sdev, MSG_ORDERED_TASK,
1342 scsi_activate_tcq(sdev, dev->openings + dev->active); 1343 dev->openings + dev->active);
1343 break; 1344 break;
1344 default: 1345 default:
1345 /* 1346 /*
@@ -1348,7 +1349,7 @@ ahc_platform_set_tags(struct ahc_softc *ahc, struct scsi_device *sdev,
1348 * serially on the controller/device. This should 1349 * serially on the controller/device. This should
1349 * remove some latency. 1350 * remove some latency.
1350 */ 1351 */
1351 scsi_deactivate_tcq(sdev, 2); 1352 scsi_adjust_queue_depth(sdev, 0, 2);
1352 break; 1353 break;
1353 } 1354 }
1354} 1355}
diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c
index c56741fc4b99..579dc2f460c4 100644
--- a/drivers/scsi/aic94xx/aic94xx_init.c
+++ b/drivers/scsi/aic94xx/aic94xx_init.c
@@ -83,6 +83,7 @@ static struct scsi_host_template aic94xx_sht = {
83 .eh_bus_reset_handler = sas_eh_bus_reset_handler, 83 .eh_bus_reset_handler = sas_eh_bus_reset_handler,
84 .target_destroy = sas_target_destroy, 84 .target_destroy = sas_target_destroy,
85 .ioctl = sas_ioctl, 85 .ioctl = sas_ioctl,
86 .use_blk_tags = 1,
86}; 87};
87 88
88static int asd_map_memio(struct asd_ha_struct *asd_ha) 89static int asd_map_memio(struct asd_ha_struct *asd_ha)
diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c
index 99280e89c289..d8e43c81d19b 100644
--- a/drivers/scsi/bfa/bfad_im.c
+++ b/drivers/scsi/bfa/bfad_im.c
@@ -776,11 +776,7 @@ bfad_thread_workq(struct bfad_s *bfad)
776static int 776static int
777bfad_im_slave_configure(struct scsi_device *sdev) 777bfad_im_slave_configure(struct scsi_device *sdev)
778{ 778{
779 if (sdev->tagged_supported) 779 scsi_adjust_queue_depth(sdev, 0, bfa_lun_queue_depth);
780 scsi_activate_tcq(sdev, bfa_lun_queue_depth);
781 else
782 scsi_deactivate_tcq(sdev, bfa_lun_queue_depth);
783
784 return 0; 780 return 0;
785} 781}
786 782
@@ -804,6 +800,7 @@ struct scsi_host_template bfad_im_scsi_host_template = {
804 .shost_attrs = bfad_im_host_attrs, 800 .shost_attrs = bfad_im_host_attrs,
805 .max_sectors = BFAD_MAX_SECTORS, 801 .max_sectors = BFAD_MAX_SECTORS,
806 .vendor_id = BFA_PCI_VENDOR_ID_BROCADE, 802 .vendor_id = BFA_PCI_VENDOR_ID_BROCADE,
803 .use_blk_tags = 1,
807}; 804};
808 805
809struct scsi_host_template bfad_im_vport_template = { 806struct scsi_host_template bfad_im_vport_template = {
@@ -825,6 +822,7 @@ struct scsi_host_template bfad_im_vport_template = {
825 .use_clustering = ENABLE_CLUSTERING, 822 .use_clustering = ENABLE_CLUSTERING,
826 .shost_attrs = bfad_im_vport_attrs, 823 .shost_attrs = bfad_im_vport_attrs,
827 .max_sectors = BFAD_MAX_SECTORS, 824 .max_sectors = BFAD_MAX_SECTORS,
825 .use_blk_tags = 1,
828}; 826};
829 827
830bfa_status_t 828bfa_status_t
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 3c6dc8abc776..cd2e61025926 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -2790,6 +2790,7 @@ static struct scsi_host_template bnx2fc_shost_template = {
2790 .use_clustering = ENABLE_CLUSTERING, 2790 .use_clustering = ENABLE_CLUSTERING,
2791 .sg_tablesize = BNX2FC_MAX_BDS_PER_CMD, 2791 .sg_tablesize = BNX2FC_MAX_BDS_PER_CMD,
2792 .max_sectors = 1024, 2792 .max_sectors = 1024,
2793 .use_blk_tags = 1,
2793}; 2794};
2794 2795
2795static struct libfc_function_template bnx2fc_libfc_fcn_templ = { 2796static struct libfc_function_template bnx2fc_libfc_fcn_templ = {
diff --git a/drivers/scsi/csiostor/csio_scsi.c b/drivers/scsi/csiostor/csio_scsi.c
index 8231505cce0a..f73155db80a3 100644
--- a/drivers/scsi/csiostor/csio_scsi.c
+++ b/drivers/scsi/csiostor/csio_scsi.c
@@ -2241,11 +2241,7 @@ csio_slave_alloc(struct scsi_device *sdev)
2241static int 2241static int
2242csio_slave_configure(struct scsi_device *sdev) 2242csio_slave_configure(struct scsi_device *sdev)
2243{ 2243{
2244 if (sdev->tagged_supported) 2244 scsi_adjust_queue_depth(sdev, 0, csio_lun_qdepth);
2245 scsi_activate_tcq(sdev, csio_lun_qdepth);
2246 else
2247 scsi_deactivate_tcq(sdev, csio_lun_qdepth);
2248
2249 return 0; 2245 return 0;
2250} 2246}
2251 2247
@@ -2290,6 +2286,7 @@ struct scsi_host_template csio_fcoe_shost_template = {
2290 .use_clustering = ENABLE_CLUSTERING, 2286 .use_clustering = ENABLE_CLUSTERING,
2291 .shost_attrs = csio_fcoe_lport_attrs, 2287 .shost_attrs = csio_fcoe_lport_attrs,
2292 .max_sectors = CSIO_MAX_SECTOR_SIZE, 2288 .max_sectors = CSIO_MAX_SECTOR_SIZE,
2289 .use_blk_tags = 1,
2293}; 2290};
2294 2291
2295struct scsi_host_template csio_fcoe_shost_vport_template = { 2292struct scsi_host_template csio_fcoe_shost_vport_template = {
@@ -2309,6 +2306,7 @@ struct scsi_host_template csio_fcoe_shost_vport_template = {
2309 .use_clustering = ENABLE_CLUSTERING, 2306 .use_clustering = ENABLE_CLUSTERING,
2310 .shost_attrs = csio_fcoe_vport_attrs, 2307 .shost_attrs = csio_fcoe_vport_attrs,
2311 .max_sectors = CSIO_MAX_SECTOR_SIZE, 2308 .max_sectors = CSIO_MAX_SECTOR_SIZE,
2309 .use_blk_tags = 1,
2312}; 2310};
2313 2311
2314/* 2312/*
diff --git a/drivers/scsi/esas2r/esas2r_main.c b/drivers/scsi/esas2r/esas2r_main.c
index be09c628d034..a020b09ba347 100644
--- a/drivers/scsi/esas2r/esas2r_main.c
+++ b/drivers/scsi/esas2r/esas2r_main.c
@@ -260,6 +260,7 @@ static struct scsi_host_template driver_template = {
260 .change_queue_depth = esas2r_change_queue_depth, 260 .change_queue_depth = esas2r_change_queue_depth,
261 .change_queue_type = scsi_change_queue_type, 261 .change_queue_type = scsi_change_queue_type,
262 .max_sectors = 0xFFFF, 262 .max_sectors = 0xFFFF,
263 .use_blk_tags = 1,
263}; 264};
264 265
265int sgl_page_size = 512; 266int sgl_page_size = 512;
@@ -1278,13 +1279,10 @@ int esas2r_slave_configure(struct scsi_device *dev)
1278 esas2r_log_dev(ESAS2R_LOG_INFO, &(dev->sdev_gendev), 1279 esas2r_log_dev(ESAS2R_LOG_INFO, &(dev->sdev_gendev),
1279 "esas2r_slave_configure()"); 1280 "esas2r_slave_configure()");
1280 1281
1281 if (dev->tagged_supported) { 1282 if (dev->tagged_supported)
1282 scsi_set_tag_type(dev, MSG_SIMPLE_TAG); 1283 scsi_adjust_queue_depth(dev, MSG_SIMPLE_TAG, cmd_per_lun);
1283 scsi_activate_tcq(dev, cmd_per_lun); 1284 else
1284 } else { 1285 scsi_adjust_queue_depth(dev, 0, cmd_per_lun);
1285 scsi_set_tag_type(dev, 0);
1286 scsi_deactivate_tcq(dev, cmd_per_lun);
1287 }
1288 1286
1289 return 0; 1287 return 0;
1290} 1288}
diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c
index b23101b28bfa..66b6ce10b259 100644
--- a/drivers/scsi/esp_scsi.c
+++ b/drivers/scsi/esp_scsi.c
@@ -2419,10 +2419,9 @@ static int esp_slave_configure(struct scsi_device *dev)
2419 queue_depth = dev->host->cmd_per_lun; 2419 queue_depth = dev->host->cmd_per_lun;
2420 2420
2421 if (goal_tags) { 2421 if (goal_tags) {
2422 scsi_set_tag_type(dev, MSG_ORDERED_TAG); 2422 scsi_adjust_queue_depth(dev, MSG_ORDERED_TAG, queue_depth);
2423 scsi_activate_tcq(dev, queue_depth);
2424 } else { 2423 } else {
2425 scsi_deactivate_tcq(dev, queue_depth); 2424 scsi_adjust_queue_depth(dev, 0, queue_depth);
2426 } 2425 }
2427 tp->flags |= ESP_TGT_DISCONNECT; 2426 tp->flags |= ESP_TGT_DISCONNECT;
2428 2427
@@ -2631,6 +2630,7 @@ struct scsi_host_template scsi_esp_template = {
2631 .use_clustering = ENABLE_CLUSTERING, 2630 .use_clustering = ENABLE_CLUSTERING,
2632 .max_sectors = 0xffff, 2631 .max_sectors = 0xffff,
2633 .skip_settle_delay = 1, 2632 .skip_settle_delay = 1,
2633 .use_blk_tags = 1,
2634}; 2634};
2635EXPORT_SYMBOL(scsi_esp_template); 2635EXPORT_SYMBOL(scsi_esp_template);
2636 2636
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 86956cc3448e..a3eeb6842499 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -288,6 +288,7 @@ static struct scsi_host_template fcoe_shost_template = {
288 .use_clustering = ENABLE_CLUSTERING, 288 .use_clustering = ENABLE_CLUSTERING,
289 .sg_tablesize = SG_ALL, 289 .sg_tablesize = SG_ALL,
290 .max_sectors = 0xffff, 290 .max_sectors = 0xffff,
291 .use_blk_tags = 1,
291}; 292};
292 293
293/** 294/**
diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
index 8581ce662cf0..2a6c98b7d4db 100644
--- a/drivers/scsi/fnic/fnic_main.c
+++ b/drivers/scsi/fnic/fnic_main.c
@@ -100,7 +100,7 @@ static int fnic_slave_alloc(struct scsi_device *sdev)
100 if (!rport || fc_remote_port_chkready(rport)) 100 if (!rport || fc_remote_port_chkready(rport))
101 return -ENXIO; 101 return -ENXIO;
102 102
103 scsi_activate_tcq(sdev, fnic_max_qdepth); 103 scsi_adjust_queue_depth(sdev, 0, fnic_max_qdepth);
104 return 0; 104 return 0;
105} 105}
106 106
@@ -121,6 +121,7 @@ static struct scsi_host_template fnic_host_template = {
121 .sg_tablesize = FNIC_MAX_SG_DESC_CNT, 121 .sg_tablesize = FNIC_MAX_SG_DESC_CNT,
122 .max_sectors = 0xffff, 122 .max_sectors = 0xffff,
123 .shost_attrs = fnic_attrs, 123 .shost_attrs = fnic_attrs,
124 .use_blk_tags = 1,
124}; 125};
125 126
126static void 127static void
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index a964f8c85833..4723d89df5ac 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -2888,11 +2888,11 @@ static int ibmvfc_slave_configure(struct scsi_device *sdev)
2888 if (sdev->type == TYPE_DISK) 2888 if (sdev->type == TYPE_DISK)
2889 sdev->allow_restart = 1; 2889 sdev->allow_restart = 1;
2890 2890
2891 if (sdev->tagged_supported) { 2891 if (sdev->tagged_supported)
2892 scsi_set_tag_type(sdev, MSG_SIMPLE_TAG); 2892 scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG,
2893 scsi_activate_tcq(sdev, sdev->queue_depth); 2893 sdev->queue_depth);
2894 } else 2894 else
2895 scsi_deactivate_tcq(sdev, sdev->queue_depth); 2895 scsi_adjust_queue_depth(sdev, 0, sdev->queue_depth);
2896 spin_unlock_irqrestore(shost->host_lock, flags); 2896 spin_unlock_irqrestore(shost->host_lock, flags);
2897 return 0; 2897 return 0;
2898} 2898}
@@ -3108,6 +3108,7 @@ static struct scsi_host_template driver_template = {
3108 .max_sectors = IBMVFC_MAX_SECTORS, 3108 .max_sectors = IBMVFC_MAX_SECTORS,
3109 .use_clustering = ENABLE_CLUSTERING, 3109 .use_clustering = ENABLE_CLUSTERING,
3110 .shost_attrs = ibmvfc_attrs, 3110 .shost_attrs = ibmvfc_attrs,
3111 .use_blk_tags = 1,
3111}; 3112};
3112 3113
3113/** 3114/**
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 6b52feafa929..f84fcb9a6ed7 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -6317,6 +6317,7 @@ static struct scsi_host_template driver_template = {
6317 .sdev_attrs = ipr_dev_attrs, 6317 .sdev_attrs = ipr_dev_attrs,
6318 .proc_name = IPR_NAME, 6318 .proc_name = IPR_NAME,
6319 .no_write_same = 1, 6319 .no_write_same = 1,
6320 .use_blk_tags = 1,
6320}; 6321};
6321 6322
6322/** 6323/**
diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c
index 2e890b1e2526..897562056018 100644
--- a/drivers/scsi/isci/init.c
+++ b/drivers/scsi/isci/init.c
@@ -172,6 +172,7 @@ static struct scsi_host_template isci_sht = {
172 .target_destroy = sas_target_destroy, 172 .target_destroy = sas_target_destroy,
173 .ioctl = sas_ioctl, 173 .ioctl = sas_ioctl,
174 .shost_attrs = isci_host_attrs, 174 .shost_attrs = isci_host_attrs,
175 .use_blk_tags = 1,
175}; 176};
176 177
177static struct sas_domain_function_template isci_transport_ops = { 178static struct sas_domain_function_template isci_transport_ops = {
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index f3043ad1f35d..d4bb642f2681 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -2160,12 +2160,7 @@ int fc_slave_alloc(struct scsi_device *sdev)
2160 if (!rport || fc_remote_port_chkready(rport)) 2160 if (!rport || fc_remote_port_chkready(rport))
2161 return -ENXIO; 2161 return -ENXIO;
2162 2162
2163 if (sdev->tagged_supported) 2163 scsi_adjust_queue_depth(sdev, 0, FC_FCP_DFLT_QUEUE_DEPTH);
2164 scsi_activate_tcq(sdev, FC_FCP_DFLT_QUEUE_DEPTH);
2165 else
2166 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev),
2167 FC_FCP_DFLT_QUEUE_DEPTH);
2168
2169 return 0; 2164 return 0;
2170} 2165}
2171EXPORT_SYMBOL(fc_slave_alloc); 2166EXPORT_SYMBOL(fc_slave_alloc);
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 24e477d2ea70..eee21a060d93 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -940,15 +940,13 @@ int sas_slave_configure(struct scsi_device *scsi_dev)
940 sas_read_port_mode_page(scsi_dev); 940 sas_read_port_mode_page(scsi_dev);
941 941
942 if (scsi_dev->tagged_supported) { 942 if (scsi_dev->tagged_supported) {
943 scsi_set_tag_type(scsi_dev, MSG_SIMPLE_TAG); 943 scsi_adjust_queue_depth(scsi_dev, MSG_SIMPLE_TAG, SAS_DEF_QD);
944 scsi_activate_tcq(scsi_dev, SAS_DEF_QD);
945 } else { 944 } else {
946 SAS_DPRINTK("device %llx, LUN %llx doesn't support " 945 SAS_DPRINTK("device %llx, LUN %llx doesn't support "
947 "TCQ\n", SAS_ADDR(dev->sas_addr), 946 "TCQ\n", SAS_ADDR(dev->sas_addr),
948 scsi_dev->lun); 947 scsi_dev->lun);
949 scsi_dev->tagged_supported = 0; 948 scsi_dev->tagged_supported = 0;
950 scsi_set_tag_type(scsi_dev, 0); 949 scsi_adjust_queue_depth(scsi_dev, 0, 1);
951 scsi_deactivate_tcq(scsi_dev, 1);
952 } 950 }
953 951
954 scsi_dev->allow_restart = 1; 952 scsi_dev->allow_restart = 1;
@@ -991,10 +989,7 @@ int sas_change_queue_type(struct scsi_device *scsi_dev, int qt)
991 if (!scsi_dev->tagged_supported) 989 if (!scsi_dev->tagged_supported)
992 return 0; 990 return 0;
993 991
994 scsi_deactivate_tcq(scsi_dev, 1); 992 scsi_adjust_queue_depth(scsi_dev, qt, scsi_dev->queue_depth);
995
996 scsi_set_tag_type(scsi_dev, qt);
997 scsi_activate_tcq(scsi_dev, scsi_dev->queue_depth);
998 993
999 return qt; 994 return qt;
1000} 995}
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 4a150063fb4d..a24106a70968 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -5598,10 +5598,7 @@ lpfc_slave_configure(struct scsi_device *sdev)
5598 struct lpfc_vport *vport = (struct lpfc_vport *) sdev->host->hostdata; 5598 struct lpfc_vport *vport = (struct lpfc_vport *) sdev->host->hostdata;
5599 struct lpfc_hba *phba = vport->phba; 5599 struct lpfc_hba *phba = vport->phba;
5600 5600
5601 if (sdev->tagged_supported) 5601 scsi_adjust_queue_depth(sdev, 0, vport->cfg_lun_queue_depth);
5602 scsi_activate_tcq(sdev, vport->cfg_lun_queue_depth);
5603 else
5604 scsi_deactivate_tcq(sdev, vport->cfg_lun_queue_depth);
5605 5602
5606 if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { 5603 if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) {
5607 lpfc_sli_handle_fast_ring_event(phba, 5604 lpfc_sli_handle_fast_ring_event(phba,
@@ -5986,6 +5983,7 @@ struct scsi_host_template lpfc_template = {
5986 .vendor_id = LPFC_NL_VENDOR_ID, 5983 .vendor_id = LPFC_NL_VENDOR_ID,
5987 .change_queue_depth = lpfc_change_queue_depth, 5984 .change_queue_depth = lpfc_change_queue_depth,
5988 .change_queue_type = scsi_change_queue_type, 5985 .change_queue_type = scsi_change_queue_type,
5986 .use_blk_tags = 1,
5989}; 5987};
5990 5988
5991struct scsi_host_template lpfc_vport_template = { 5989struct scsi_host_template lpfc_vport_template = {
@@ -6009,4 +6007,5 @@ struct scsi_host_template lpfc_vport_template = {
6009 .max_sectors = 0xFFFF, 6007 .max_sectors = 0xFFFF,
6010 .change_queue_depth = lpfc_change_queue_depth, 6008 .change_queue_depth = lpfc_change_queue_depth,
6011 .change_queue_type = scsi_change_queue_type, 6009 .change_queue_type = scsi_change_queue_type,
6010 .use_blk_tags = 1,
6012}; 6011};
diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c
index eacee48a955c..d3c1fa5e76fb 100644
--- a/drivers/scsi/mvsas/mv_init.c
+++ b/drivers/scsi/mvsas/mv_init.c
@@ -76,6 +76,7 @@ static struct scsi_host_template mvs_sht = {
76 .target_destroy = sas_target_destroy, 76 .target_destroy = sas_target_destroy,
77 .ioctl = sas_ioctl, 77 .ioctl = sas_ioctl,
78 .shost_attrs = mvst_host_attrs, 78 .shost_attrs = mvst_host_attrs,
79 .use_blk_tags = 1,
79}; 80};
80 81
81static struct sas_domain_function_template mvs_transport_ops = { 82static struct sas_domain_function_template mvs_transport_ops = {
diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c
index 666bf5af06e2..3ff759a3b74d 100644
--- a/drivers/scsi/pm8001/pm8001_init.c
+++ b/drivers/scsi/pm8001/pm8001_init.c
@@ -89,6 +89,7 @@ static struct scsi_host_template pm8001_sht = {
89 .target_destroy = sas_target_destroy, 89 .target_destroy = sas_target_destroy,
90 .ioctl = sas_ioctl, 90 .ioctl = sas_ioctl,
91 .shost_attrs = pm8001_host_attrs, 91 .shost_attrs = pm8001_host_attrs,
92 .use_blk_tags = 1,
92}; 93};
93 94
94/** 95/**
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index d5fb31fa388b..71f9f59b13c6 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -251,7 +251,6 @@ static int pmcraid_slave_configure(struct scsi_device *scsi_dev)
251 251
252 if (scsi_dev->tagged_supported && 252 if (scsi_dev->tagged_supported &&
253 (RES_IS_GSCSI(res->cfg_entry) || RES_IS_VSET(res->cfg_entry))) { 253 (RES_IS_GSCSI(res->cfg_entry) || RES_IS_VSET(res->cfg_entry))) {
254 scsi_activate_tcq(scsi_dev, scsi_dev->queue_depth);
255 scsi_adjust_queue_depth(scsi_dev, MSG_SIMPLE_TAG, 254 scsi_adjust_queue_depth(scsi_dev, MSG_SIMPLE_TAG,
256 scsi_dev->host->cmd_per_lun); 255 scsi_dev->host->cmd_per_lun);
257 } else { 256 } else {
@@ -4295,7 +4294,8 @@ static struct scsi_host_template pmcraid_host_template = {
4295 .cmd_per_lun = PMCRAID_MAX_CMD_PER_LUN, 4294 .cmd_per_lun = PMCRAID_MAX_CMD_PER_LUN,
4296 .use_clustering = ENABLE_CLUSTERING, 4295 .use_clustering = ENABLE_CLUSTERING,
4297 .shost_attrs = pmcraid_host_attrs, 4296 .shost_attrs = pmcraid_host_attrs,
4298 .proc_name = PMCRAID_DRIVER_NAME 4297 .proc_name = PMCRAID_DRIVER_NAME,
4298 .use_blk_tags = 1,
4299}; 4299};
4300 4300
4301/* 4301/*
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 1e34fcf68e77..eb0465305f8d 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -269,6 +269,7 @@ struct scsi_host_template qla2xxx_driver_template = {
269 .shost_attrs = qla2x00_host_attrs, 269 .shost_attrs = qla2x00_host_attrs,
270 270
271 .supported_mode = MODE_INITIATOR, 271 .supported_mode = MODE_INITIATOR,
272 .use_blk_tags = 1,
272}; 273};
273 274
274static struct scsi_transport_template *qla2xxx_transport_template = NULL; 275static struct scsi_transport_template *qla2xxx_transport_template = NULL;
@@ -1404,10 +1405,7 @@ qla2xxx_slave_configure(struct scsi_device *sdev)
1404 if (IS_T10_PI_CAPABLE(vha->hw)) 1405 if (IS_T10_PI_CAPABLE(vha->hw))
1405 blk_queue_update_dma_alignment(sdev->request_queue, 0x7); 1406 blk_queue_update_dma_alignment(sdev->request_queue, 0x7);
1406 1407
1407 if (sdev->tagged_supported) 1408 scsi_adjust_queue_depth(sdev, 0, req->max_q_depth);
1408 scsi_activate_tcq(sdev, req->max_q_depth);
1409 else
1410 scsi_deactivate_tcq(sdev, req->max_q_depth);
1411 return 0; 1409 return 0;
1412} 1410}
1413 1411
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 199fcf79a051..f3119c144e29 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -163,7 +163,6 @@ static int qla4xxx_eh_target_reset(struct scsi_cmnd *cmd);
163static int qla4xxx_eh_host_reset(struct scsi_cmnd *cmd); 163static int qla4xxx_eh_host_reset(struct scsi_cmnd *cmd);
164static int qla4xxx_slave_alloc(struct scsi_device *device); 164static int qla4xxx_slave_alloc(struct scsi_device *device);
165static int qla4xxx_slave_configure(struct scsi_device *device); 165static int qla4xxx_slave_configure(struct scsi_device *device);
166static void qla4xxx_slave_destroy(struct scsi_device *sdev);
167static umode_t qla4_attr_is_visible(int param_type, int param); 166static umode_t qla4_attr_is_visible(int param_type, int param);
168static int qla4xxx_host_reset(struct Scsi_Host *shost, int reset_type); 167static int qla4xxx_host_reset(struct Scsi_Host *shost, int reset_type);
169static int qla4xxx_change_queue_depth(struct scsi_device *sdev, int qdepth, 168static int qla4xxx_change_queue_depth(struct scsi_device *sdev, int qdepth,
@@ -206,7 +205,6 @@ static struct scsi_host_template qla4xxx_driver_template = {
206 205
207 .slave_configure = qla4xxx_slave_configure, 206 .slave_configure = qla4xxx_slave_configure,
208 .slave_alloc = qla4xxx_slave_alloc, 207 .slave_alloc = qla4xxx_slave_alloc,
209 .slave_destroy = qla4xxx_slave_destroy,
210 .change_queue_depth = qla4xxx_change_queue_depth, 208 .change_queue_depth = qla4xxx_change_queue_depth,
211 209
212 .this_id = -1, 210 .this_id = -1,
@@ -218,6 +216,7 @@ static struct scsi_host_template qla4xxx_driver_template = {
218 .shost_attrs = qla4xxx_host_attrs, 216 .shost_attrs = qla4xxx_host_attrs,
219 .host_reset = qla4xxx_host_reset, 217 .host_reset = qla4xxx_host_reset,
220 .vendor_id = SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_QLOGIC, 218 .vendor_id = SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_QLOGIC,
219 .use_blk_tags = 1,
221}; 220};
222 221
223static struct iscsi_transport qla4xxx_iscsi_transport = { 222static struct iscsi_transport qla4xxx_iscsi_transport = {
@@ -9065,7 +9064,7 @@ static int qla4xxx_slave_alloc(struct scsi_device *sdev)
9065 if (ql4xmaxqdepth != 0 && ql4xmaxqdepth <= 0xffffU) 9064 if (ql4xmaxqdepth != 0 && ql4xmaxqdepth <= 0xffffU)
9066 queue_depth = ql4xmaxqdepth; 9065 queue_depth = ql4xmaxqdepth;
9067 9066
9068 scsi_activate_tcq(sdev, queue_depth); 9067 scsi_adjust_queue_depth(sdev, 0, queue_depth);
9069 return 0; 9068 return 0;
9070} 9069}
9071 9070
@@ -9075,11 +9074,6 @@ static int qla4xxx_slave_configure(struct scsi_device *sdev)
9075 return 0; 9074 return 0;
9076} 9075}
9077 9076
9078static void qla4xxx_slave_destroy(struct scsi_device *sdev)
9079{
9080 scsi_deactivate_tcq(sdev, 1);
9081}
9082
9083static int qla4xxx_change_queue_depth(struct scsi_device *sdev, int qdepth, 9077static int qla4xxx_change_queue_depth(struct scsi_device *sdev, int qdepth,
9084 int reason) 9078 int reason)
9085{ 9079{
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 22c449e926fa..a3426f1bf0dd 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -864,16 +864,12 @@ EXPORT_SYMBOL(scsi_track_queue_full);
864 */ 864 */
865int scsi_change_queue_type(struct scsi_device *sdev, int tag_type) 865int scsi_change_queue_type(struct scsi_device *sdev, int tag_type)
866{ 866{
867 if (sdev->tagged_supported) { 867 if (!sdev->tagged_supported)
868 scsi_set_tag_type(sdev, tag_type); 868 return 0;
869 if (tag_type)
870 scsi_activate_tcq(sdev, sdev->queue_depth);
871 else
872 scsi_deactivate_tcq(sdev, sdev->queue_depth);
873 } else
874 tag_type = 0;
875 869
870 scsi_adjust_queue_depth(sdev, tag_type, sdev->queue_depth);
876 return tag_type; 871 return tag_type;
872
877} 873}
878EXPORT_SYMBOL(scsi_change_queue_type); 874EXPORT_SYMBOL(scsi_change_queue_type);
879 875
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index b1aa1646012a..408891cb14ff 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -286,6 +286,12 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
286 } 286 }
287 WARN_ON_ONCE(!blk_get_queue(sdev->request_queue)); 287 WARN_ON_ONCE(!blk_get_queue(sdev->request_queue));
288 sdev->request_queue->queuedata = sdev; 288 sdev->request_queue->queuedata = sdev;
289
290 if (!shost_use_blk_mq(sdev->host) &&
291 (shost->bqt || shost->hostt->use_blk_tags)) {
292 blk_queue_init_tags(sdev->request_queue,
293 sdev->host->cmd_per_lun, shost->bqt);
294 }
289 scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun); 295 scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
290 296
291 scsi_sysfs_device_initialize(sdev); 297 scsi_sysfs_device_initialize(sdev);
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index 713af13b858e..b5eae4f6ba46 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -549,7 +549,7 @@ stex_slave_alloc(struct scsi_device *sdev)
549 /* Cheat: usually extracted from Inquiry data */ 549 /* Cheat: usually extracted from Inquiry data */
550 sdev->tagged_supported = 1; 550 sdev->tagged_supported = 1;
551 551
552 scsi_activate_tcq(sdev, sdev->host->can_queue); 552 scsi_adjust_queue_depth(sdev, 0, sdev->host->can_queue);
553 553
554 return 0; 554 return 0;
555} 555}
@@ -565,12 +565,6 @@ stex_slave_config(struct scsi_device *sdev)
565 return 0; 565 return 0;
566} 566}
567 567
568static void
569stex_slave_destroy(struct scsi_device *sdev)
570{
571 scsi_deactivate_tcq(sdev, 1);
572}
573
574static int 568static int
575stex_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) 569stex_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
576{ 570{
@@ -1390,10 +1384,10 @@ static struct scsi_host_template driver_template = {
1390 .queuecommand = stex_queuecommand, 1384 .queuecommand = stex_queuecommand,
1391 .slave_alloc = stex_slave_alloc, 1385 .slave_alloc = stex_slave_alloc,
1392 .slave_configure = stex_slave_config, 1386 .slave_configure = stex_slave_config,
1393 .slave_destroy = stex_slave_destroy,
1394 .eh_abort_handler = stex_abort, 1387 .eh_abort_handler = stex_abort,
1395 .eh_host_reset_handler = stex_reset, 1388 .eh_host_reset_handler = stex_reset,
1396 .this_id = -1, 1389 .this_id = -1,
1390 .use_blk_tags = 1,
1397}; 1391};
1398 1392
1399static struct pci_device_id stex_pci_tbl[] = { 1393static struct pci_device_id stex_pci_tbl[] = {
diff --git a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c
index 547812437a7c..6369f9a282f1 100644
--- a/drivers/scsi/tmscsim.c
+++ b/drivers/scsi/tmscsim.c
@@ -2187,7 +2187,7 @@ static int dc390_slave_configure(struct scsi_device *sdev)
2187 acb->scan_devices = 0; 2187 acb->scan_devices = 0;
2188 if (sdev->tagged_supported && (dcb->DevMode & TAG_QUEUEING_)) { 2188 if (sdev->tagged_supported && (dcb->DevMode & TAG_QUEUEING_)) {
2189 dcb->SyncMode |= EN_TAG_QUEUEING; 2189 dcb->SyncMode |= EN_TAG_QUEUEING;
2190 scsi_activate_tcq(sdev, acb->TagMaxNum); 2190 scsi_adjust_queue_depth(sdev, 0, acb->TagMaxNum);
2191 } 2191 }
2192 2192
2193 return 0; 2193 return 0;
@@ -2209,6 +2209,7 @@ static struct scsi_host_template driver_template = {
2209 .cmd_per_lun = 1, 2209 .cmd_per_lun = 1,
2210 .use_clustering = ENABLE_CLUSTERING, 2210 .use_clustering = ENABLE_CLUSTERING,
2211 .max_sectors = 0x4000, /* 8MiB = 16 * 1024 * 512 */ 2211 .max_sectors = 0x4000, /* 8MiB = 16 * 1024 * 512 */
2212 .use_blk_tags = 1,
2212}; 2213};
2213 2214
2214/*********************************************************************** 2215/***********************************************************************
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 9da319130da5..48c7f9e8f256 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -2695,7 +2695,8 @@ static void ufshcd_set_queue_depth(struct scsi_device *sdev)
2695 2695
2696 dev_dbg(hba->dev, "%s: activate tcq with queue depth %d\n", 2696 dev_dbg(hba->dev, "%s: activate tcq with queue depth %d\n",
2697 __func__, lun_qdepth); 2697 __func__, lun_qdepth);
2698 scsi_activate_tcq(sdev, lun_qdepth); 2698 if (sdev->tagged_supported)
2699 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), lun_qdepth);
2699} 2700}
2700 2701
2701/* 2702/*
@@ -2842,7 +2843,6 @@ static void ufshcd_slave_destroy(struct scsi_device *sdev)
2842 struct ufs_hba *hba; 2843 struct ufs_hba *hba;
2843 2844
2844 hba = shost_priv(sdev->host); 2845 hba = shost_priv(sdev->host);
2845 scsi_deactivate_tcq(sdev, hba->nutrs);
2846 /* Drop the reference as it won't be needed anymore */ 2846 /* Drop the reference as it won't be needed anymore */
2847 if (ufshcd_scsi_to_upiu_lun(sdev->lun) == UFS_UPIU_UFS_DEVICE_WLUN) 2847 if (ufshcd_scsi_to_upiu_lun(sdev->lun) == UFS_UPIU_UFS_DEVICE_WLUN)
2848 hba->sdev_ufs_device = NULL; 2848 hba->sdev_ufs_device = NULL;
@@ -4235,6 +4235,7 @@ static struct scsi_host_template ufshcd_driver_template = {
4235 .cmd_per_lun = UFSHCD_CMD_PER_LUN, 4235 .cmd_per_lun = UFSHCD_CMD_PER_LUN,
4236 .can_queue = UFSHCD_CAN_QUEUE, 4236 .can_queue = UFSHCD_CAN_QUEUE,
4237 .max_host_blocked = 1, 4237 .max_host_blocked = 1,
4238 .use_blk_tags = 1,
4238}; 4239};
4239 4240
4240static int ufshcd_config_vreg_load(struct device *dev, struct ufs_vreg *vreg, 4241static int ufshcd_config_vreg_load(struct device *dev, struct ufs_vreg *vreg,