aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c1
-rw-r--r--drivers/infiniband/ulp/srpt/ib_srpt.c10
-rw-r--r--drivers/scsi/53c700.c41
-rw-r--r--drivers/scsi/Kconfig17
-rw-r--r--drivers/scsi/advansys.c8
-rw-r--r--drivers/scsi/aic94xx/aic94xx_init.c1
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc_fcoe.c1
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc_io.c6
-rw-r--r--drivers/scsi/csiostor/csio_scsi.c5
-rw-r--r--drivers/scsi/esas2r/esas2r_flash.c4
-rw-r--r--drivers/scsi/esas2r/esas2r_main.c1
-rw-r--r--drivers/scsi/fcoe/fcoe.c1
-rw-r--r--drivers/scsi/fnic/fnic_main.c1
-rw-r--r--drivers/scsi/ibmvscsi/ibmvfc.c2
-rw-r--r--drivers/scsi/ipr.c116
-rw-r--r--drivers/scsi/ipr.h4
-rw-r--r--drivers/scsi/isci/init.c1
-rw-r--r--drivers/scsi/libsas/sas_scsi_host.c8
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c2
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_scsih.c1
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_transport.c5
-rw-r--r--drivers/scsi/mpt3sas/mpt3sas_scsih.c1
-rw-r--r--drivers/scsi/mpt3sas/mpt3sas_transport.c5
-rw-r--r--drivers/scsi/mvsas/mv_init.c1
-rw-r--r--drivers/scsi/pm8001/pm8001_init.c1
-rw-r--r--drivers/scsi/pmcraid.c1
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c1
-rw-r--r--drivers/scsi/qla2xxx/qla_target.c12
-rw-r--r--drivers/scsi/scsi.c22
-rw-r--r--drivers/scsi/scsi_debug.c62
-rw-r--r--drivers/scsi/scsi_sysfs.c30
-rw-r--r--drivers/scsi/scsi_transport_spi.c2
-rw-r--r--drivers/scsi/storvsc_drv.c7
-rw-r--r--drivers/target/iscsi/iscsi_target.c14
-rw-r--r--drivers/target/loopback/tcm_loop.c5
-rw-r--r--drivers/target/sbp/sbp_target.c2
-rw-r--r--drivers/target/target_core_pscsi.c2
-rw-r--r--drivers/target/target_core_sbc.c2
-rw-r--r--drivers/target/target_core_spc.c4
-rw-r--r--drivers/target/target_core_transport.c16
-rw-r--r--drivers/target/tcm_fc/tfc_cmd.c8
-rw-r--r--drivers/usb/gadget/legacy/tcm_usb_gadget.c10
-rw-r--r--drivers/xen/xen-scsiback.c2
-rw-r--r--include/scsi/libsas.h1
-rw-r--r--include/scsi/scsi_host.h13
-rw-r--r--include/scsi/scsi_tcq.h36
-rw-r--r--include/target/target_core_base.h6
-rw-r--r--include/trace/events/target.h8
49 files changed, 147 insertions, 365 deletions
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 5461924c9f10..a1640364144b 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -2740,7 +2740,6 @@ static struct scsi_host_template srp_template = {
2740 .info = srp_target_info, 2740 .info = srp_target_info,
2741 .queuecommand = srp_queuecommand, 2741 .queuecommand = srp_queuecommand,
2742 .change_queue_depth = srp_change_queue_depth, 2742 .change_queue_depth = srp_change_queue_depth,
2743 .change_queue_type = scsi_change_queue_type,
2744 .eh_abort_handler = srp_abort, 2743 .eh_abort_handler = srp_abort,
2745 .eh_device_reset_handler = srp_reset_device, 2744 .eh_device_reset_handler = srp_reset_device,
2746 .eh_host_reset_handler = srp_reset_host, 2745 .eh_host_reset_handler = srp_reset_host,
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index dc829682701a..eb694ddad79f 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -1708,17 +1708,17 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
1708 1708
1709 switch (srp_cmd->task_attr) { 1709 switch (srp_cmd->task_attr) {
1710 case SRP_CMD_SIMPLE_Q: 1710 case SRP_CMD_SIMPLE_Q:
1711 cmd->sam_task_attr = MSG_SIMPLE_TAG; 1711 cmd->sam_task_attr = TCM_SIMPLE_TAG;
1712 break; 1712 break;
1713 case SRP_CMD_ORDERED_Q: 1713 case SRP_CMD_ORDERED_Q:
1714 default: 1714 default:
1715 cmd->sam_task_attr = MSG_ORDERED_TAG; 1715 cmd->sam_task_attr = TCM_ORDERED_TAG;
1716 break; 1716 break;
1717 case SRP_CMD_HEAD_OF_Q: 1717 case SRP_CMD_HEAD_OF_Q:
1718 cmd->sam_task_attr = MSG_HEAD_TAG; 1718 cmd->sam_task_attr = TCM_HEAD_TAG;
1719 break; 1719 break;
1720 case SRP_CMD_ACA: 1720 case SRP_CMD_ACA:
1721 cmd->sam_task_attr = MSG_ACA_TAG; 1721 cmd->sam_task_attr = TCM_ACA_TAG;
1722 break; 1722 break;
1723 } 1723 }
1724 1724
@@ -1733,7 +1733,7 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
1733 sizeof(srp_cmd->lun)); 1733 sizeof(srp_cmd->lun));
1734 rc = target_submit_cmd(cmd, ch->sess, srp_cmd->cdb, 1734 rc = target_submit_cmd(cmd, ch->sess, srp_cmd->cdb,
1735 &send_ioctx->sense_data[0], unpacked_lun, data_len, 1735 &send_ioctx->sense_data[0], unpacked_lun, data_len,
1736 MSG_SIMPLE_TAG, dir, TARGET_SCF_ACK_KREF); 1736 TCM_SIMPLE_TAG, dir, TARGET_SCF_ACK_KREF);
1737 if (rc != 0) { 1737 if (rc != 0) {
1738 ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; 1738 ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
1739 goto send_sense; 1739 goto send_sense;
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index aa915da2a5e5..82abfce1cb42 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -176,7 +176,6 @@ STATIC int NCR_700_slave_alloc(struct scsi_device *SDpnt);
176STATIC int NCR_700_slave_configure(struct scsi_device *SDpnt); 176STATIC int NCR_700_slave_configure(struct scsi_device *SDpnt);
177STATIC void NCR_700_slave_destroy(struct scsi_device *SDpnt); 177STATIC void NCR_700_slave_destroy(struct scsi_device *SDpnt);
178static int NCR_700_change_queue_depth(struct scsi_device *SDpnt, int depth); 178static int NCR_700_change_queue_depth(struct scsi_device *SDpnt, int depth);
179static int NCR_700_change_queue_type(struct scsi_device *SDpnt, int depth);
180 179
181STATIC struct device_attribute *NCR_700_dev_attrs[]; 180STATIC struct device_attribute *NCR_700_dev_attrs[];
182 181
@@ -326,7 +325,6 @@ NCR_700_detect(struct scsi_host_template *tpnt,
326 tpnt->slave_destroy = NCR_700_slave_destroy; 325 tpnt->slave_destroy = NCR_700_slave_destroy;
327 tpnt->slave_alloc = NCR_700_slave_alloc; 326 tpnt->slave_alloc = NCR_700_slave_alloc;
328 tpnt->change_queue_depth = NCR_700_change_queue_depth; 327 tpnt->change_queue_depth = NCR_700_change_queue_depth;
329 tpnt->change_queue_type = NCR_700_change_queue_type;
330 tpnt->use_blk_tags = 1; 328 tpnt->use_blk_tags = 1;
331 329
332 if(tpnt->name == NULL) 330 if(tpnt->name == NULL)
@@ -904,8 +902,8 @@ process_message(struct Scsi_Host *host, struct NCR_700_Host_Parameters *hostdata
904 hostdata->tag_negotiated &= ~(1<<scmd_id(SCp)); 902 hostdata->tag_negotiated &= ~(1<<scmd_id(SCp));
905 903
906 SCp->device->tagged_supported = 0; 904 SCp->device->tagged_supported = 0;
905 SCp->device->simple_tags = 0;
907 scsi_change_queue_depth(SCp->device, host->cmd_per_lun); 906 scsi_change_queue_depth(SCp->device, host->cmd_per_lun);
908 scsi_set_tag_type(SCp->device, 0);
909 } else { 907 } else {
910 shost_printk(KERN_WARNING, host, 908 shost_printk(KERN_WARNING, host,
911 "(%d:%d) Unexpected REJECT Message %s\n", 909 "(%d:%d) Unexpected REJECT Message %s\n",
@@ -1818,8 +1816,8 @@ NCR_700_queuecommand_lck(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)
1818 hostdata->tag_negotiated &= ~(1<<scmd_id(SCp)); 1816 hostdata->tag_negotiated &= ~(1<<scmd_id(SCp));
1819 } 1817 }
1820 1818
1821 if((hostdata->tag_negotiated &(1<<scmd_id(SCp))) 1819 if ((hostdata->tag_negotiated & (1<<scmd_id(SCp))) &&
1822 && scsi_get_tag_type(SCp->device)) { 1820 SCp->device->simple_tags) {
1823 slot->tag = SCp->request->tag; 1821 slot->tag = SCp->request->tag;
1824 CDEBUG(KERN_DEBUG, SCp, "sending out tag %d, slot %p\n", 1822 CDEBUG(KERN_DEBUG, SCp, "sending out tag %d, slot %p\n",
1825 slot->tag, slot); 1823 slot->tag, slot);
@@ -2082,39 +2080,6 @@ NCR_700_change_queue_depth(struct scsi_device *SDp, int depth)
2082 return scsi_change_queue_depth(SDp, depth); 2080 return scsi_change_queue_depth(SDp, depth);
2083} 2081}
2084 2082
2085static int NCR_700_change_queue_type(struct scsi_device *SDp, int tag_type)
2086{
2087 int change_tag = ((tag_type ==0 && scsi_get_tag_type(SDp) != 0)
2088 || (tag_type != 0 && scsi_get_tag_type(SDp) == 0));
2089 struct NCR_700_Host_Parameters *hostdata =
2090 (struct NCR_700_Host_Parameters *)SDp->host->hostdata[0];
2091
2092 /* We have a global (per target) flag to track whether TCQ is
2093 * enabled, so we'll be turning it off for the entire target here.
2094 * our tag algorithm will fail if we mix tagged and untagged commands,
2095 * so quiesce the device before doing this */
2096 if (change_tag)
2097 scsi_target_quiesce(SDp->sdev_target);
2098
2099 scsi_set_tag_type(SDp, tag_type);
2100 if (!tag_type) {
2101 /* shift back to the default unqueued number of commands
2102 * (the user can still raise this) */
2103 scsi_change_queue_depth(SDp, SDp->host->cmd_per_lun);
2104 hostdata->tag_negotiated &= ~(1 << sdev_id(SDp));
2105 } else {
2106 /* Here, we cleared the negotiation flag above, so this
2107 * will force the driver to renegotiate */
2108 scsi_change_queue_depth(SDp, SDp->queue_depth);
2109 if (change_tag)
2110 NCR_700_set_tag_neg_state(SDp, NCR_700_START_TAG_NEGOTIATION);
2111 }
2112 if (change_tag)
2113 scsi_target_resume(SDp->sdev_target);
2114
2115 return tag_type;
2116}
2117
2118static ssize_t 2083static ssize_t
2119NCR_700_show_active_tags(struct device *dev, struct device_attribute *attr, char *buf) 2084NCR_700_show_active_tags(struct device *dev, struct device_attribute *attr, char *buf)
2120{ 2085{
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 86cf3d671eb9..9c92f415229f 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -1462,18 +1462,17 @@ config SCSI_WD719X
1462 SCSI controllers (based on WD33C296A chip). 1462 SCSI controllers (based on WD33C296A chip).
1463 1463
1464config SCSI_DEBUG 1464config SCSI_DEBUG
1465 tristate "SCSI debugging host simulator" 1465 tristate "SCSI debugging host and device simulator"
1466 depends on SCSI 1466 depends on SCSI
1467 select CRC_T10DIF 1467 select CRC_T10DIF
1468 help 1468 help
1469 This is a host adapter simulator that can simulate multiple hosts 1469 This pseudo driver simulates one or more hosts (SCSI initiators),
1470 each with multiple dummy SCSI devices (disks). It defaults to one 1470 each with one or more targets, each with one or more logical units.
1471 host adapter with one dummy SCSI disk. Each dummy disk uses kernel 1471 Defaults to one of each, creating a small RAM disk device. Many
1472 RAM as storage (i.e. it is a ramdisk). To save space when multiple 1472 parameters found in the /sys/bus/pseudo/drivers/scsi_debug
1473 dummy disks are simulated, they share the same kernel RAM for 1473 directory can be tweaked at run time.
1474 their storage. See <http://sg.danny.cz/sg/sdebug26.html> for more 1474 See <http://sg.danny.cz/sg/sdebug26.html> for more information.
1475 information. This driver is primarily of use to those testing the 1475 Mainly used for testing and best as a module. If unsure, say N.
1476 SCSI and block subsystems. If unsure, say N.
1477 1476
1478config SCSI_MESH 1477config SCSI_MESH
1479 tristate "MESH (Power Mac internal SCSI) support" 1478 tristate "MESH (Power Mac internal SCSI) support"
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 6719a3390ebd..2c5ce48c8f95 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -7921,9 +7921,9 @@ static int asc_build_req(struct asc_board *boardp, struct scsi_cmnd *scp,
7921 */ 7921 */
7922 if ((asc_dvc->cur_dvc_qng[scp->device->id] > 0) && 7922 if ((asc_dvc->cur_dvc_qng[scp->device->id] > 0) &&
7923 (boardp->reqcnt[scp->device->id] % 255) == 0) { 7923 (boardp->reqcnt[scp->device->id] % 255) == 0) {
7924 asc_scsi_q->q2.tag_code = MSG_ORDERED_TAG; 7924 asc_scsi_q->q2.tag_code = ORDERED_QUEUE_TAG;
7925 } else { 7925 } else {
7926 asc_scsi_q->q2.tag_code = MSG_SIMPLE_TAG; 7926 asc_scsi_q->q2.tag_code = SIMPLE_QUEUE_TAG;
7927 } 7927 }
7928 7928
7929 /* Build ASC_SCSI_Q */ 7929 /* Build ASC_SCSI_Q */
@@ -8351,7 +8351,7 @@ static int AscPutReadyQueue(ASC_DVC_VAR *asc_dvc, ASC_SCSI_Q *scsiq, uchar q_no)
8351 } 8351 }
8352 q_addr = ASC_QNO_TO_QADDR(q_no); 8352 q_addr = ASC_QNO_TO_QADDR(q_no);
8353 if ((scsiq->q1.target_id & asc_dvc->use_tagged_qng) == 0) { 8353 if ((scsiq->q1.target_id & asc_dvc->use_tagged_qng) == 0) {
8354 scsiq->q2.tag_code &= ~MSG_SIMPLE_TAG; 8354 scsiq->q2.tag_code &= ~SIMPLE_QUEUE_TAG;
8355 } 8355 }
8356 scsiq->q1.status = QS_FREE; 8356 scsiq->q1.status = QS_FREE;
8357 AscMemWordCopyPtrToLram(iop_base, 8357 AscMemWordCopyPtrToLram(iop_base,
@@ -8669,7 +8669,7 @@ static int AscExeScsiQueue(ASC_DVC_VAR *asc_dvc, ASC_SCSI_Q *scsiq)
8669 } 8669 }
8670 } 8670 }
8671 if (disable_syn_offset_one_fix) { 8671 if (disable_syn_offset_one_fix) {
8672 scsiq->q2.tag_code &= ~MSG_SIMPLE_TAG; 8672 scsiq->q2.tag_code &= ~SIMPLE_QUEUE_TAG;
8673 scsiq->q2.tag_code |= (ASC_TAG_FLAG_DISABLE_ASYN_USE_SYN_FIX | 8673 scsiq->q2.tag_code |= (ASC_TAG_FLAG_DISABLE_ASYN_USE_SYN_FIX |
8674 ASC_TAG_FLAG_DISABLE_DISCONNECT); 8674 ASC_TAG_FLAG_DISABLE_DISCONNECT);
8675 } else { 8675 } else {
diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c
index 14fc018436c2..02a2512b76a8 100644
--- a/drivers/scsi/aic94xx/aic94xx_init.c
+++ b/drivers/scsi/aic94xx/aic94xx_init.c
@@ -63,7 +63,6 @@ static struct scsi_host_template aic94xx_sht = {
63 .scan_finished = asd_scan_finished, 63 .scan_finished = asd_scan_finished,
64 .scan_start = asd_scan_start, 64 .scan_start = asd_scan_start,
65 .change_queue_depth = sas_change_queue_depth, 65 .change_queue_depth = sas_change_queue_depth,
66 .change_queue_type = sas_change_queue_type,
67 .bios_param = sas_bios_param, 66 .bios_param = sas_bios_param,
68 .can_queue = 1, 67 .can_queue = 1,
69 .cmd_per_lun = 1, 68 .cmd_per_lun = 1,
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index e861f286b42e..98d06d151958 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -2792,7 +2792,6 @@ static struct scsi_host_template bnx2fc_shost_template = {
2792 .eh_host_reset_handler = fc_eh_host_reset, 2792 .eh_host_reset_handler = fc_eh_host_reset,
2793 .slave_alloc = fc_slave_alloc, 2793 .slave_alloc = fc_slave_alloc,
2794 .change_queue_depth = scsi_change_queue_depth, 2794 .change_queue_depth = scsi_change_queue_depth,
2795 .change_queue_type = scsi_change_queue_type,
2796 .this_id = -1, 2795 .this_id = -1,
2797 .cmd_per_lun = 3, 2796 .cmd_per_lun = 3,
2798 .use_clustering = ENABLE_CLUSTERING, 2797 .use_clustering = ENABLE_CLUSTERING,
diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c
index 4b56858c1df2..9ecca8504f60 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_io.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
@@ -1737,11 +1737,7 @@ void bnx2fc_build_fcp_cmnd(struct bnx2fc_cmd *io_req,
1737 fcp_cmnd->fc_pri_ta = 0; 1737 fcp_cmnd->fc_pri_ta = 0;
1738 fcp_cmnd->fc_tm_flags = io_req->mp_req.tm_flags; 1738 fcp_cmnd->fc_tm_flags = io_req->mp_req.tm_flags;
1739 fcp_cmnd->fc_flags = io_req->io_req_flags; 1739 fcp_cmnd->fc_flags = io_req->io_req_flags;
1740 1740 fcp_cmnd->fc_pri_ta = FCP_PTA_SIMPLE;
1741 if (sc_cmd->flags & SCMD_TAGGED)
1742 fcp_cmnd->fc_pri_ta = FCP_PTA_SIMPLE;
1743 else
1744 fcp_cmnd->fc_pri_ta = 0;
1745} 1741}
1746 1742
1747static void bnx2fc_parse_fcp_rsp(struct bnx2fc_cmd *io_req, 1743static void bnx2fc_parse_fcp_rsp(struct bnx2fc_cmd *io_req,
diff --git a/drivers/scsi/csiostor/csio_scsi.c b/drivers/scsi/csiostor/csio_scsi.c
index 51ea5dc5f084..3987284e0d2a 100644
--- a/drivers/scsi/csiostor/csio_scsi.c
+++ b/drivers/scsi/csiostor/csio_scsi.c
@@ -172,10 +172,7 @@ csio_scsi_fcp_cmnd(struct csio_ioreq *req, void *addr)
172 fcp_cmnd->fc_cmdref = 0; 172 fcp_cmnd->fc_cmdref = 0;
173 173
174 memcpy(fcp_cmnd->fc_cdb, scmnd->cmnd, 16); 174 memcpy(fcp_cmnd->fc_cdb, scmnd->cmnd, 16);
175 if (scmnd->flags & SCMD_TAGGED) 175 fcp_cmnd->fc_pri_ta = FCP_PTA_SIMPLE;
176 fcp_cmnd->fc_pri_ta = FCP_PTA_SIMPLE;
177 else
178 fcp_cmnd->fc_pri_ta = 0;
179 fcp_cmnd->fc_dl = cpu_to_be32(scsi_bufflen(scmnd)); 176 fcp_cmnd->fc_dl = cpu_to_be32(scsi_bufflen(scmnd));
180 177
181 if (req->nsge) 178 if (req->nsge)
diff --git a/drivers/scsi/esas2r/esas2r_flash.c b/drivers/scsi/esas2r/esas2r_flash.c
index b7dc59fca7a6..7bd376d95ed5 100644
--- a/drivers/scsi/esas2r/esas2r_flash.c
+++ b/drivers/scsi/esas2r/esas2r_flash.c
@@ -684,9 +684,9 @@ static u16 calc_fi_checksum(struct esas2r_flash_context *fc)
684 * 1) verify the fi_version is correct 684 * 1) verify the fi_version is correct
685 * 2) verify the checksum of the entire image. 685 * 2) verify the checksum of the entire image.
686 * 3) validate the adap_typ, action and length fields. 686 * 3) validate the adap_typ, action and length fields.
687 * 4) valdiate each component header. check the img_type and 687 * 4) validate each component header. check the img_type and
688 * length fields 688 * length fields
689 * 5) valdiate each component image. validate signatures and 689 * 5) validate each component image. validate signatures and
690 * local checksums 690 * local checksums
691 */ 691 */
692static bool verify_fi(struct esas2r_adapter *a, 692static bool verify_fi(struct esas2r_adapter *a,
diff --git a/drivers/scsi/esas2r/esas2r_main.c b/drivers/scsi/esas2r/esas2r_main.c
index 593ff8a63c70..7e1c21e6736b 100644
--- a/drivers/scsi/esas2r/esas2r_main.c
+++ b/drivers/scsi/esas2r/esas2r_main.c
@@ -255,7 +255,6 @@ static struct scsi_host_template driver_template = {
255 .emulated = 0, 255 .emulated = 0,
256 .proc_name = ESAS2R_DRVR_NAME, 256 .proc_name = ESAS2R_DRVR_NAME,
257 .change_queue_depth = scsi_change_queue_depth, 257 .change_queue_depth = scsi_change_queue_depth,
258 .change_queue_type = scsi_change_queue_type,
259 .max_sectors = 0xFFFF, 258 .max_sectors = 0xFFFF,
260 .use_blk_tags = 1, 259 .use_blk_tags = 1,
261}; 260};
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index cd00a6cdf55b..ec193a8357d7 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -281,7 +281,6 @@ static struct scsi_host_template fcoe_shost_template = {
281 .eh_host_reset_handler = fc_eh_host_reset, 281 .eh_host_reset_handler = fc_eh_host_reset,
282 .slave_alloc = fc_slave_alloc, 282 .slave_alloc = fc_slave_alloc,
283 .change_queue_depth = scsi_change_queue_depth, 283 .change_queue_depth = scsi_change_queue_depth,
284 .change_queue_type = scsi_change_queue_type,
285 .this_id = -1, 284 .this_id = -1,
286 .cmd_per_lun = 3, 285 .cmd_per_lun = 3,
287 .can_queue = FCOE_MAX_OUTSTANDING_COMMANDS, 286 .can_queue = FCOE_MAX_OUTSTANDING_COMMANDS,
diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
index 0c1f8177b5b7..8a0d4d7b3254 100644
--- a/drivers/scsi/fnic/fnic_main.c
+++ b/drivers/scsi/fnic/fnic_main.c
@@ -111,7 +111,6 @@ static struct scsi_host_template fnic_host_template = {
111 .eh_host_reset_handler = fnic_host_reset, 111 .eh_host_reset_handler = fnic_host_reset,
112 .slave_alloc = fnic_slave_alloc, 112 .slave_alloc = fnic_slave_alloc,
113 .change_queue_depth = scsi_change_queue_depth, 113 .change_queue_depth = scsi_change_queue_depth,
114 .change_queue_type = scsi_change_queue_type,
115 .this_id = -1, 114 .this_id = -1,
116 .cmd_per_lun = 3, 115 .cmd_per_lun = 3,
117 .can_queue = FNIC_DFLT_IO_REQ, 116 .can_queue = FNIC_DFLT_IO_REQ,
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index f58c6d8e0264..057d27721d5b 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -1615,7 +1615,6 @@ static int ibmvfc_queuecommand_lck(struct scsi_cmnd *cmnd,
1615 struct fc_rport *rport = starget_to_rport(scsi_target(cmnd->device)); 1615 struct fc_rport *rport = starget_to_rport(scsi_target(cmnd->device));
1616 struct ibmvfc_cmd *vfc_cmd; 1616 struct ibmvfc_cmd *vfc_cmd;
1617 struct ibmvfc_event *evt; 1617 struct ibmvfc_event *evt;
1618 u8 tag[2];
1619 int rc; 1618 int rc;
1620 1619
1621 if (unlikely((rc = fc_remote_port_chkready(rport))) || 1620 if (unlikely((rc = fc_remote_port_chkready(rport))) ||
@@ -3089,7 +3088,6 @@ static struct scsi_host_template driver_template = {
3089 .target_alloc = ibmvfc_target_alloc, 3088 .target_alloc = ibmvfc_target_alloc,
3090 .scan_finished = ibmvfc_scan_finished, 3089 .scan_finished = ibmvfc_scan_finished,
3091 .change_queue_depth = ibmvfc_change_queue_depth, 3090 .change_queue_depth = ibmvfc_change_queue_depth,
3092 .change_queue_type = scsi_change_queue_type,
3093 .cmd_per_lun = 16, 3091 .cmd_per_lun = 16,
3094 .can_queue = IBMVFC_MAX_REQUESTS_DEFAULT, 3092 .can_queue = IBMVFC_MAX_REQUESTS_DEFAULT,
3095 .this_id = -1, 3093 .this_id = -1,
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 540294389355..df4e27cd996a 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -1426,16 +1426,14 @@ static void ipr_handle_config_change(struct ipr_ioa_cfg *ioa_cfg,
1426 if (res->sdev) { 1426 if (res->sdev) {
1427 res->del_from_ml = 1; 1427 res->del_from_ml = 1;
1428 res->res_handle = IPR_INVALID_RES_HANDLE; 1428 res->res_handle = IPR_INVALID_RES_HANDLE;
1429 if (ioa_cfg->allow_ml_add_del) 1429 schedule_work(&ioa_cfg->work_q);
1430 schedule_work(&ioa_cfg->work_q);
1431 } else { 1430 } else {
1432 ipr_clear_res_target(res); 1431 ipr_clear_res_target(res);
1433 list_move_tail(&res->queue, &ioa_cfg->free_res_q); 1432 list_move_tail(&res->queue, &ioa_cfg->free_res_q);
1434 } 1433 }
1435 } else if (!res->sdev || res->del_from_ml) { 1434 } else if (!res->sdev || res->del_from_ml) {
1436 res->add_to_ml = 1; 1435 res->add_to_ml = 1;
1437 if (ioa_cfg->allow_ml_add_del) 1436 schedule_work(&ioa_cfg->work_q);
1438 schedule_work(&ioa_cfg->work_q);
1439 } 1437 }
1440 1438
1441 ipr_send_hcam(ioa_cfg, IPR_HCAM_CDB_OP_CODE_CONFIG_CHANGE, hostrcb); 1439 ipr_send_hcam(ioa_cfg, IPR_HCAM_CDB_OP_CODE_CONFIG_CHANGE, hostrcb);
@@ -3273,8 +3271,7 @@ static void ipr_worker_thread(struct work_struct *work)
3273restart: 3271restart:
3274 do { 3272 do {
3275 did_work = 0; 3273 did_work = 0;
3276 if (!ioa_cfg->hrrq[IPR_INIT_HRRQ].allow_cmds || 3274 if (!ioa_cfg->hrrq[IPR_INIT_HRRQ].allow_cmds) {
3277 !ioa_cfg->allow_ml_add_del) {
3278 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); 3275 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
3279 return; 3276 return;
3280 } 3277 }
@@ -3311,6 +3308,7 @@ restart:
3311 } 3308 }
3312 } 3309 }
3313 3310
3311 ioa_cfg->scan_done = 1;
3314 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); 3312 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
3315 kobject_uevent(&ioa_cfg->host->shost_dev.kobj, KOBJ_CHANGE); 3313 kobject_uevent(&ioa_cfg->host->shost_dev.kobj, KOBJ_CHANGE);
3316 LEAVE; 3314 LEAVE;
@@ -4346,30 +4344,6 @@ static int ipr_change_queue_depth(struct scsi_device *sdev, int qdepth)
4346} 4344}
4347 4345
4348/** 4346/**
4349 * ipr_change_queue_type - Change the device's queue type
4350 * @dsev: scsi device struct
4351 * @tag_type: type of tags to use
4352 *
4353 * Return value:
4354 * actual queue type set
4355 **/
4356static int ipr_change_queue_type(struct scsi_device *sdev, int tag_type)
4357{
4358 struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)sdev->host->hostdata;
4359 struct ipr_resource_entry *res;
4360 unsigned long lock_flags = 0;
4361
4362 spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
4363 res = (struct ipr_resource_entry *)sdev->hostdata;
4364 if (res && ipr_is_gscsi(res))
4365 tag_type = scsi_change_queue_type(sdev, tag_type);
4366 else
4367 tag_type = 0;
4368 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
4369 return tag_type;
4370}
4371
4372/**
4373 * ipr_show_adapter_handle - Show the adapter's resource handle for this device 4347 * ipr_show_adapter_handle - Show the adapter's resource handle for this device
4374 * @dev: device struct 4348 * @dev: device struct
4375 * @attr: device attribute structure 4349 * @attr: device attribute structure
@@ -4739,6 +4713,7 @@ static int ipr_slave_configure(struct scsi_device *sdev)
4739 sdev->no_uld_attach = 1; 4713 sdev->no_uld_attach = 1;
4740 } 4714 }
4741 if (ipr_is_vset_device(res)) { 4715 if (ipr_is_vset_device(res)) {
4716 sdev->scsi_level = SCSI_SPC_3;
4742 blk_queue_rq_timeout(sdev->request_queue, 4717 blk_queue_rq_timeout(sdev->request_queue,
4743 IPR_VSET_RW_TIMEOUT); 4718 IPR_VSET_RW_TIMEOUT);
4744 blk_queue_max_hw_sectors(sdev->request_queue, IPR_VSET_MAX_SECTORS); 4719 blk_queue_max_hw_sectors(sdev->request_queue, IPR_VSET_MAX_SECTORS);
@@ -5231,6 +5206,28 @@ static int ipr_cancel_op(struct scsi_cmnd *scsi_cmd)
5231 * @scsi_cmd: scsi command struct 5206 * @scsi_cmd: scsi command struct
5232 * 5207 *
5233 * Return value: 5208 * Return value:
5209 * 0 if scan in progress / 1 if scan is complete
5210 **/
5211static int ipr_scan_finished(struct Scsi_Host *shost, unsigned long elapsed_time)
5212{
5213 unsigned long lock_flags;
5214 struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *) shost->hostdata;
5215 int rc = 0;
5216
5217 spin_lock_irqsave(shost->host_lock, lock_flags);
5218 if (ioa_cfg->hrrq[IPR_INIT_HRRQ].ioa_is_dead || ioa_cfg->scan_done)
5219 rc = 1;
5220 if ((elapsed_time/HZ) > (ioa_cfg->transop_timeout * 2))
5221 rc = 1;
5222 spin_unlock_irqrestore(shost->host_lock, lock_flags);
5223 return rc;
5224}
5225
5226/**
5227 * ipr_eh_host_reset - Reset the host adapter
5228 * @scsi_cmd: scsi command struct
5229 *
5230 * Return value:
5234 * SUCCESS / FAILED 5231 * SUCCESS / FAILED
5235 **/ 5232 **/
5236static int ipr_eh_abort(struct scsi_cmnd *scsi_cmd) 5233static int ipr_eh_abort(struct scsi_cmnd *scsi_cmd)
@@ -5779,7 +5776,7 @@ static void ipr_erp_cancel_all(struct ipr_cmnd *ipr_cmd)
5779 5776
5780 ipr_reinit_ipr_cmnd_for_erp(ipr_cmd); 5777 ipr_reinit_ipr_cmnd_for_erp(ipr_cmd);
5781 5778
5782 if (!scsi_get_tag_type(scsi_cmd->device)) { 5779 if (!scsi_cmd->device->simple_tags) {
5783 ipr_erp_request_sense(ipr_cmd); 5780 ipr_erp_request_sense(ipr_cmd);
5784 return; 5781 return;
5785 } 5782 }
@@ -6299,10 +6296,10 @@ static struct scsi_host_template driver_template = {
6299 .slave_alloc = ipr_slave_alloc, 6296 .slave_alloc = ipr_slave_alloc,
6300 .slave_configure = ipr_slave_configure, 6297 .slave_configure = ipr_slave_configure,
6301 .slave_destroy = ipr_slave_destroy, 6298 .slave_destroy = ipr_slave_destroy,
6299 .scan_finished = ipr_scan_finished,
6302 .target_alloc = ipr_target_alloc, 6300 .target_alloc = ipr_target_alloc,
6303 .target_destroy = ipr_target_destroy, 6301 .target_destroy = ipr_target_destroy,
6304 .change_queue_depth = ipr_change_queue_depth, 6302 .change_queue_depth = ipr_change_queue_depth,
6305 .change_queue_type = ipr_change_queue_type,
6306 .bios_param = ipr_biosparam, 6303 .bios_param = ipr_biosparam,
6307 .can_queue = IPR_MAX_COMMANDS, 6304 .can_queue = IPR_MAX_COMMANDS,
6308 .this_id = -1, 6305 .this_id = -1,
@@ -6841,7 +6838,7 @@ static int ipr_ioa_reset_done(struct ipr_cmnd *ipr_cmd)
6841 ioa_cfg->doorbell |= IPR_RUNTIME_RESET; 6838 ioa_cfg->doorbell |= IPR_RUNTIME_RESET;
6842 6839
6843 list_for_each_entry(res, &ioa_cfg->used_res_q, queue) { 6840 list_for_each_entry(res, &ioa_cfg->used_res_q, queue) {
6844 if (ioa_cfg->allow_ml_add_del && (res->add_to_ml || res->del_from_ml)) { 6841 if (res->add_to_ml || res->del_from_ml) {
6845 ipr_trace; 6842 ipr_trace;
6846 break; 6843 break;
6847 } 6844 }
@@ -6870,6 +6867,7 @@ static int ipr_ioa_reset_done(struct ipr_cmnd *ipr_cmd)
6870 if (!ioa_cfg->hrrq[IPR_INIT_HRRQ].allow_cmds) 6867 if (!ioa_cfg->hrrq[IPR_INIT_HRRQ].allow_cmds)
6871 scsi_block_requests(ioa_cfg->host); 6868 scsi_block_requests(ioa_cfg->host);
6872 6869
6870 schedule_work(&ioa_cfg->work_q);
6873 LEAVE; 6871 LEAVE;
6874 return IPR_RC_JOB_RETURN; 6872 return IPR_RC_JOB_RETURN;
6875} 6873}
@@ -7610,6 +7608,19 @@ static int ipr_ioafp_page0_inquiry(struct ipr_cmnd *ipr_cmd)
7610 type[4] = '\0'; 7608 type[4] = '\0';
7611 ioa_cfg->type = simple_strtoul((char *)type, NULL, 16); 7609 ioa_cfg->type = simple_strtoul((char *)type, NULL, 16);
7612 7610
7611 if (ipr_invalid_adapter(ioa_cfg)) {
7612 dev_err(&ioa_cfg->pdev->dev,
7613 "Adapter not supported in this hardware configuration.\n");
7614
7615 if (!ipr_testmode) {
7616 ioa_cfg->reset_retries += IPR_NUM_RESET_RELOAD_RETRIES;
7617 ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_NONE);
7618 list_add_tail(&ipr_cmd->queue,
7619 &ioa_cfg->hrrq->hrrq_free_q);
7620 return IPR_RC_JOB_RETURN;
7621 }
7622 }
7623
7613 ipr_cmd->job_step = ipr_ioafp_page3_inquiry; 7624 ipr_cmd->job_step = ipr_ioafp_page3_inquiry;
7614 7625
7615 ipr_ioafp_inquiry(ipr_cmd, 1, 0, 7626 ipr_ioafp_inquiry(ipr_cmd, 1, 0,
@@ -8797,20 +8808,6 @@ static int ipr_probe_ioa_part2(struct ipr_ioa_cfg *ioa_cfg)
8797 _ipr_initiate_ioa_reset(ioa_cfg, ipr_reset_enable_ioa, 8808 _ipr_initiate_ioa_reset(ioa_cfg, ipr_reset_enable_ioa,
8798 IPR_SHUTDOWN_NONE); 8809 IPR_SHUTDOWN_NONE);
8799 spin_unlock_irqrestore(ioa_cfg->host->host_lock, host_lock_flags); 8810 spin_unlock_irqrestore(ioa_cfg->host->host_lock, host_lock_flags);
8800 wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload);
8801 spin_lock_irqsave(ioa_cfg->host->host_lock, host_lock_flags);
8802
8803 if (ioa_cfg->hrrq[IPR_INIT_HRRQ].ioa_is_dead) {
8804 rc = -EIO;
8805 } else if (ipr_invalid_adapter(ioa_cfg)) {
8806 if (!ipr_testmode)
8807 rc = -EIO;
8808
8809 dev_err(&ioa_cfg->pdev->dev,
8810 "Adapter not supported in this hardware configuration.\n");
8811 }
8812
8813 spin_unlock_irqrestore(ioa_cfg->host->host_lock, host_lock_flags);
8814 8811
8815 LEAVE; 8812 LEAVE;
8816 return rc; 8813 return rc;
@@ -9264,7 +9261,7 @@ static void ipr_init_ioa_cfg(struct ipr_ioa_cfg *ioa_cfg,
9264 * ioa_cfg->max_devs_supported))); 9261 * ioa_cfg->max_devs_supported)));
9265 } 9262 }
9266 9263
9267 host->max_channel = IPR_MAX_BUS_TO_SCAN; 9264 host->max_channel = IPR_VSET_BUS;
9268 host->unique_id = host->host_no; 9265 host->unique_id = host->host_no;
9269 host->max_cmd_len = IPR_MAX_CDB_LEN; 9266 host->max_cmd_len = IPR_MAX_CDB_LEN;
9270 host->can_queue = ioa_cfg->max_cmds; 9267 host->can_queue = ioa_cfg->max_cmds;
@@ -9764,25 +9761,6 @@ out_scsi_host_put:
9764} 9761}
9765 9762
9766/** 9763/**
9767 * ipr_scan_vsets - Scans for VSET devices
9768 * @ioa_cfg: ioa config struct
9769 *
9770 * Description: Since the VSET resources do not follow SAM in that we can have
9771 * sparse LUNs with no LUN 0, we have to scan for these ourselves.
9772 *
9773 * Return value:
9774 * none
9775 **/
9776static void ipr_scan_vsets(struct ipr_ioa_cfg *ioa_cfg)
9777{
9778 int target, lun;
9779
9780 for (target = 0; target < IPR_MAX_NUM_TARGETS_PER_BUS; target++)
9781 for (lun = 0; lun < IPR_MAX_NUM_VSET_LUNS_PER_TARGET; lun++)
9782 scsi_add_device(ioa_cfg->host, IPR_VSET_BUS, target, lun);
9783}
9784
9785/**
9786 * ipr_initiate_ioa_bringdown - Bring down an adapter 9764 * ipr_initiate_ioa_bringdown - Bring down an adapter
9787 * @ioa_cfg: ioa config struct 9765 * @ioa_cfg: ioa config struct
9788 * @shutdown_type: shutdown type 9766 * @shutdown_type: shutdown type
@@ -9937,10 +9915,6 @@ static int ipr_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
9937 } 9915 }
9938 9916
9939 scsi_scan_host(ioa_cfg->host); 9917 scsi_scan_host(ioa_cfg->host);
9940 ipr_scan_vsets(ioa_cfg);
9941 scsi_add_device(ioa_cfg->host, IPR_IOA_BUS, IPR_IOA_TARGET, IPR_IOA_LUN);
9942 ioa_cfg->allow_ml_add_del = 1;
9943 ioa_cfg->host->max_channel = IPR_VSET_BUS;
9944 ioa_cfg->iopoll_weight = ioa_cfg->chip_cfg->iopoll_weight; 9918 ioa_cfg->iopoll_weight = ioa_cfg->chip_cfg->iopoll_weight;
9945 9919
9946 if (ioa_cfg->iopoll_weight && ioa_cfg->sis64 && ioa_cfg->nvectors > 1) { 9920 if (ioa_cfg->iopoll_weight && ioa_cfg->sis64 && ioa_cfg->nvectors > 1) {
diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h
index 9ebdebd944e7..b4f3eec51bc9 100644
--- a/drivers/scsi/ipr.h
+++ b/drivers/scsi/ipr.h
@@ -157,13 +157,11 @@
157 157
158#define IPR_MAX_NUM_TARGETS_PER_BUS 256 158#define IPR_MAX_NUM_TARGETS_PER_BUS 256
159#define IPR_MAX_NUM_LUNS_PER_TARGET 256 159#define IPR_MAX_NUM_LUNS_PER_TARGET 256
160#define IPR_MAX_NUM_VSET_LUNS_PER_TARGET 8
161#define IPR_VSET_BUS 0xff 160#define IPR_VSET_BUS 0xff
162#define IPR_IOA_BUS 0xff 161#define IPR_IOA_BUS 0xff
163#define IPR_IOA_TARGET 0xff 162#define IPR_IOA_TARGET 0xff
164#define IPR_IOA_LUN 0xff 163#define IPR_IOA_LUN 0xff
165#define IPR_MAX_NUM_BUSES 16 164#define IPR_MAX_NUM_BUSES 16
166#define IPR_MAX_BUS_TO_SCAN IPR_MAX_NUM_BUSES
167 165
168#define IPR_NUM_RESET_RELOAD_RETRIES 3 166#define IPR_NUM_RESET_RELOAD_RETRIES 3
169 167
@@ -1453,7 +1451,7 @@ struct ipr_ioa_cfg {
1453 u8 in_ioa_bringdown:1; 1451 u8 in_ioa_bringdown:1;
1454 u8 ioa_unit_checked:1; 1452 u8 ioa_unit_checked:1;
1455 u8 dump_taken:1; 1453 u8 dump_taken:1;
1456 u8 allow_ml_add_del:1; 1454 u8 scan_done:1;
1457 u8 needs_hard_reset:1; 1455 u8 needs_hard_reset:1;
1458 u8 dual_raid:1; 1456 u8 dual_raid:1;
1459 u8 needs_warm_reset:1; 1457 u8 needs_warm_reset:1;
diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c
index 724c6265b667..cd41b63a2f10 100644
--- a/drivers/scsi/isci/init.c
+++ b/drivers/scsi/isci/init.c
@@ -158,7 +158,6 @@ static struct scsi_host_template isci_sht = {
158 .scan_finished = isci_host_scan_finished, 158 .scan_finished = isci_host_scan_finished,
159 .scan_start = isci_host_start, 159 .scan_start = isci_host_start,
160 .change_queue_depth = sas_change_queue_depth, 160 .change_queue_depth = sas_change_queue_depth,
161 .change_queue_type = sas_change_queue_type,
162 .bios_param = sas_bios_param, 161 .bios_param = sas_bios_param,
163 .can_queue = ISCI_CAN_QUEUE_VAL, 162 .can_queue = ISCI_CAN_QUEUE_VAL,
164 .cmd_per_lun = 1, 163 .cmd_per_lun = 1,
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 72918d227ead..519dac4e341e 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -906,13 +906,6 @@ int sas_change_queue_depth(struct scsi_device *sdev, int depth)
906 return scsi_change_queue_depth(sdev, depth); 906 return scsi_change_queue_depth(sdev, depth);
907} 907}
908 908
909int sas_change_queue_type(struct scsi_device *scsi_dev, int type)
910{
911 if (dev_is_sata(sdev_to_domain_dev(scsi_dev)))
912 return -EINVAL;
913 return scsi_change_queue_type(scsi_dev, type);
914}
915
916int sas_bios_param(struct scsi_device *scsi_dev, 909int sas_bios_param(struct scsi_device *scsi_dev,
917 struct block_device *bdev, 910 struct block_device *bdev,
918 sector_t capacity, int *hsc) 911 sector_t capacity, int *hsc)
@@ -1011,7 +1004,6 @@ EXPORT_SYMBOL_GPL(sas_queuecommand);
1011EXPORT_SYMBOL_GPL(sas_target_alloc); 1004EXPORT_SYMBOL_GPL(sas_target_alloc);
1012EXPORT_SYMBOL_GPL(sas_slave_configure); 1005EXPORT_SYMBOL_GPL(sas_slave_configure);
1013EXPORT_SYMBOL_GPL(sas_change_queue_depth); 1006EXPORT_SYMBOL_GPL(sas_change_queue_depth);
1014EXPORT_SYMBOL_GPL(sas_change_queue_type);
1015EXPORT_SYMBOL_GPL(sas_bios_param); 1007EXPORT_SYMBOL_GPL(sas_bios_param);
1016EXPORT_SYMBOL_GPL(sas_task_abort); 1008EXPORT_SYMBOL_GPL(sas_task_abort);
1017EXPORT_SYMBOL_GPL(sas_phy_reset); 1009EXPORT_SYMBOL_GPL(sas_phy_reset);
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index fd85952b621d..4f9222eb2266 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -5879,7 +5879,6 @@ struct scsi_host_template lpfc_template = {
5879 .max_sectors = 0xFFFF, 5879 .max_sectors = 0xFFFF,
5880 .vendor_id = LPFC_NL_VENDOR_ID, 5880 .vendor_id = LPFC_NL_VENDOR_ID,
5881 .change_queue_depth = scsi_change_queue_depth, 5881 .change_queue_depth = scsi_change_queue_depth,
5882 .change_queue_type = scsi_change_queue_type,
5883 .use_blk_tags = 1, 5882 .use_blk_tags = 1,
5884 .track_queue_depth = 1, 5883 .track_queue_depth = 1,
5885}; 5884};
@@ -5904,7 +5903,6 @@ struct scsi_host_template lpfc_vport_template = {
5904 .shost_attrs = lpfc_vport_attrs, 5903 .shost_attrs = lpfc_vport_attrs,
5905 .max_sectors = 0xFFFF, 5904 .max_sectors = 0xFFFF,
5906 .change_queue_depth = scsi_change_queue_depth, 5905 .change_queue_depth = scsi_change_queue_depth,
5907 .change_queue_type = scsi_change_queue_type,
5908 .use_blk_tags = 1, 5906 .use_blk_tags = 1,
5909 .track_queue_depth = 1, 5907 .track_queue_depth = 1,
5910}; 5908};
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index 8431eb10bbb1..6a1c036a6f3f 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -7592,7 +7592,6 @@ static struct scsi_host_template scsih_driver_template = {
7592 .scan_finished = _scsih_scan_finished, 7592 .scan_finished = _scsih_scan_finished,
7593 .scan_start = _scsih_scan_start, 7593 .scan_start = _scsih_scan_start,
7594 .change_queue_depth = _scsih_change_queue_depth, 7594 .change_queue_depth = _scsih_change_queue_depth,
7595 .change_queue_type = scsi_change_queue_type,
7596 .eh_abort_handler = _scsih_abort, 7595 .eh_abort_handler = _scsih_abort,
7597 .eh_device_reset_handler = _scsih_dev_reset, 7596 .eh_device_reset_handler = _scsih_dev_reset,
7598 .eh_target_reset_handler = _scsih_target_reset, 7597 .eh_target_reset_handler = _scsih_target_reset,
diff --git a/drivers/scsi/mpt2sas/mpt2sas_transport.c b/drivers/scsi/mpt2sas/mpt2sas_transport.c
index 0d1d06488a28..e689bf20a3ea 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_transport.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_transport.c
@@ -1006,12 +1006,9 @@ mpt2sas_transport_update_links(struct MPT2SAS_ADAPTER *ioc,
1006 &mpt2sas_phy->remote_identify); 1006 &mpt2sas_phy->remote_identify);
1007 _transport_add_phy_to_an_existing_port(ioc, sas_node, 1007 _transport_add_phy_to_an_existing_port(ioc, sas_node,
1008 mpt2sas_phy, mpt2sas_phy->remote_identify.sas_address); 1008 mpt2sas_phy, mpt2sas_phy->remote_identify.sas_address);
1009 } else { 1009 } else
1010 memset(&mpt2sas_phy->remote_identify, 0 , sizeof(struct 1010 memset(&mpt2sas_phy->remote_identify, 0 , sizeof(struct
1011 sas_identify)); 1011 sas_identify));
1012 _transport_del_phy_from_an_existing_port(ioc, sas_node,
1013 mpt2sas_phy);
1014 }
1015 1012
1016 if (mpt2sas_phy->phy) 1013 if (mpt2sas_phy->phy)
1017 mpt2sas_phy->phy->negotiated_linkrate = 1014 mpt2sas_phy->phy->negotiated_linkrate =
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index a2b60991efd4..94261ee9e72d 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -7229,7 +7229,6 @@ static struct scsi_host_template scsih_driver_template = {
7229 .scan_finished = _scsih_scan_finished, 7229 .scan_finished = _scsih_scan_finished,
7230 .scan_start = _scsih_scan_start, 7230 .scan_start = _scsih_scan_start,
7231 .change_queue_depth = _scsih_change_queue_depth, 7231 .change_queue_depth = _scsih_change_queue_depth,
7232 .change_queue_type = scsi_change_queue_type,
7233 .eh_abort_handler = _scsih_abort, 7232 .eh_abort_handler = _scsih_abort,
7234 .eh_device_reset_handler = _scsih_dev_reset, 7233 .eh_device_reset_handler = _scsih_dev_reset,
7235 .eh_target_reset_handler = _scsih_target_reset, 7234 .eh_target_reset_handler = _scsih_target_reset,
diff --git a/drivers/scsi/mpt3sas/mpt3sas_transport.c b/drivers/scsi/mpt3sas/mpt3sas_transport.c
index d4bafaaebea9..3637ae6c0171 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_transport.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_transport.c
@@ -1003,12 +1003,9 @@ mpt3sas_transport_update_links(struct MPT3SAS_ADAPTER *ioc,
1003 &mpt3sas_phy->remote_identify); 1003 &mpt3sas_phy->remote_identify);
1004 _transport_add_phy_to_an_existing_port(ioc, sas_node, 1004 _transport_add_phy_to_an_existing_port(ioc, sas_node,
1005 mpt3sas_phy, mpt3sas_phy->remote_identify.sas_address); 1005 mpt3sas_phy, mpt3sas_phy->remote_identify.sas_address);
1006 } else { 1006 } else
1007 memset(&mpt3sas_phy->remote_identify, 0 , sizeof(struct 1007 memset(&mpt3sas_phy->remote_identify, 0 , sizeof(struct
1008 sas_identify)); 1008 sas_identify));
1009 _transport_del_phy_from_an_existing_port(ioc, sas_node,
1010 mpt3sas_phy);
1011 }
1012 1009
1013 if (mpt3sas_phy->phy) 1010 if (mpt3sas_phy->phy)
1014 mpt3sas_phy->phy->negotiated_linkrate = 1011 mpt3sas_phy->phy->negotiated_linkrate =
diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c
index f15df3de6790..53030b0e8015 100644
--- a/drivers/scsi/mvsas/mv_init.c
+++ b/drivers/scsi/mvsas/mv_init.c
@@ -54,7 +54,6 @@ static struct scsi_host_template mvs_sht = {
54 .scan_finished = mvs_scan_finished, 54 .scan_finished = mvs_scan_finished,
55 .scan_start = mvs_scan_start, 55 .scan_start = mvs_scan_start,
56 .change_queue_depth = sas_change_queue_depth, 56 .change_queue_depth = sas_change_queue_depth,
57 .change_queue_type = sas_change_queue_type,
58 .bios_param = sas_bios_param, 57 .bios_param = sas_bios_param,
59 .can_queue = 1, 58 .can_queue = 1,
60 .cmd_per_lun = 1, 59 .cmd_per_lun = 1,
diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c
index 329aba0083ab..65555916d3b8 100644
--- a/drivers/scsi/pm8001/pm8001_init.c
+++ b/drivers/scsi/pm8001/pm8001_init.c
@@ -76,7 +76,6 @@ static struct scsi_host_template pm8001_sht = {
76 .scan_finished = pm8001_scan_finished, 76 .scan_finished = pm8001_scan_finished,
77 .scan_start = pm8001_scan_start, 77 .scan_start = pm8001_scan_start,
78 .change_queue_depth = sas_change_queue_depth, 78 .change_queue_depth = sas_change_queue_depth,
79 .change_queue_type = sas_change_queue_type,
80 .bios_param = sas_bios_param, 79 .bios_param = sas_bios_param,
81 .can_queue = 1, 80 .can_queue = 1,
82 .cmd_per_lun = 1, 81 .cmd_per_lun = 1,
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index b1b1f66b1ab7..8c27b6a77ec4 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -4251,7 +4251,6 @@ static struct scsi_host_template pmcraid_host_template = {
4251 .slave_configure = pmcraid_slave_configure, 4251 .slave_configure = pmcraid_slave_configure,
4252 .slave_destroy = pmcraid_slave_destroy, 4252 .slave_destroy = pmcraid_slave_destroy,
4253 .change_queue_depth = pmcraid_change_queue_depth, 4253 .change_queue_depth = pmcraid_change_queue_depth,
4254 .change_queue_type = scsi_change_queue_type,
4255 .can_queue = PMCRAID_MAX_IO_CMD, 4254 .can_queue = PMCRAID_MAX_IO_CMD,
4256 .this_id = -1, 4255 .this_id = -1,
4257 .sg_tablesize = PMCRAID_MAX_IOADLS, 4256 .sg_tablesize = PMCRAID_MAX_IOADLS,
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index a4dde7e80dbd..e59f25bff7ab 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -3237,8 +3237,6 @@ qla2x00_reg_remote_port(scsi_qla_host_t *vha, fc_port_t *fcport)
3237 struct fc_rport *rport; 3237 struct fc_rport *rport;
3238 unsigned long flags; 3238 unsigned long flags;
3239 3239
3240 qla2x00_rport_del(fcport);
3241
3242 rport_ids.node_name = wwn_to_u64(fcport->node_name); 3240 rport_ids.node_name = wwn_to_u64(fcport->node_name);
3243 rport_ids.port_name = wwn_to_u64(fcport->port_name); 3241 rport_ids.port_name = wwn_to_u64(fcport->port_name);
3244 rport_ids.port_id = fcport->d_id.b.domain << 16 | 3242 rport_ids.port_id = fcport->d_id.b.domain << 16 |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 6b4d9235368a..12ca291c1380 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -258,7 +258,6 @@ struct scsi_host_template qla2xxx_driver_template = {
258 .scan_finished = qla2xxx_scan_finished, 258 .scan_finished = qla2xxx_scan_finished,
259 .scan_start = qla2xxx_scan_start, 259 .scan_start = qla2xxx_scan_start,
260 .change_queue_depth = scsi_change_queue_depth, 260 .change_queue_depth = scsi_change_queue_depth,
261 .change_queue_type = scsi_change_queue_type,
262 .this_id = -1, 261 .this_id = -1,
263 .cmd_per_lun = 3, 262 .cmd_per_lun = 3,
264 .use_clustering = ENABLE_CLUSTERING, 263 .use_clustering = ENABLE_CLUSTERING,
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index a902fa1db7af..57418258c101 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -3218,25 +3218,25 @@ static inline int qlt_get_fcp_task_attr(struct scsi_qla_host *vha,
3218 3218
3219 switch (task_codes) { 3219 switch (task_codes) {
3220 case ATIO_SIMPLE_QUEUE: 3220 case ATIO_SIMPLE_QUEUE:
3221 fcp_task_attr = MSG_SIMPLE_TAG; 3221 fcp_task_attr = TCM_SIMPLE_TAG;
3222 break; 3222 break;
3223 case ATIO_HEAD_OF_QUEUE: 3223 case ATIO_HEAD_OF_QUEUE:
3224 fcp_task_attr = MSG_HEAD_TAG; 3224 fcp_task_attr = TCM_HEAD_TAG;
3225 break; 3225 break;
3226 case ATIO_ORDERED_QUEUE: 3226 case ATIO_ORDERED_QUEUE:
3227 fcp_task_attr = MSG_ORDERED_TAG; 3227 fcp_task_attr = TCM_ORDERED_TAG;
3228 break; 3228 break;
3229 case ATIO_ACA_QUEUE: 3229 case ATIO_ACA_QUEUE:
3230 fcp_task_attr = MSG_ACA_TAG; 3230 fcp_task_attr = TCM_ACA_TAG;
3231 break; 3231 break;
3232 case ATIO_UNTAGGED: 3232 case ATIO_UNTAGGED:
3233 fcp_task_attr = MSG_SIMPLE_TAG; 3233 fcp_task_attr = TCM_SIMPLE_TAG;
3234 break; 3234 break;
3235 default: 3235 default:
3236 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf05d, 3236 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf05d,
3237 "qla_target: unknown task code %x, use ORDERED instead\n", 3237 "qla_target: unknown task code %x, use ORDERED instead\n",
3238 task_codes); 3238 task_codes);
3239 fcp_task_attr = MSG_ORDERED_TAG; 3239 fcp_task_attr = TCM_ORDERED_TAG;
3240 break; 3240 break;
3241 } 3241 }
3242 3242
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 1ad0c36375b8..e02885451425 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -739,34 +739,12 @@ int scsi_track_queue_full(struct scsi_device *sdev, int depth)
739 739
740 if (sdev->last_queue_full_count <= 10) 740 if (sdev->last_queue_full_count <= 10)
741 return 0; 741 return 0;
742 if (sdev->last_queue_full_depth < 8) {
743 /* Drop back to untagged */
744 scsi_set_tag_type(sdev, 0);
745 scsi_change_queue_depth(sdev, sdev->host->cmd_per_lun);
746 return -1;
747 }
748 742
749 return scsi_change_queue_depth(sdev, depth); 743 return scsi_change_queue_depth(sdev, depth);
750} 744}
751EXPORT_SYMBOL(scsi_track_queue_full); 745EXPORT_SYMBOL(scsi_track_queue_full);
752 746
753/** 747/**
754 * scsi_change_queue_type() - Change a device's queue type
755 * @sdev: The SCSI device whose queue depth is to change
756 * @tag_type: Identifier for queue type
757 */
758int scsi_change_queue_type(struct scsi_device *sdev, int tag_type)
759{
760 if (!sdev->tagged_supported)
761 return 0;
762
763 scsi_set_tag_type(sdev, tag_type);
764 return tag_type;
765
766}
767EXPORT_SYMBOL(scsi_change_queue_type);
768
769/**
770 * scsi_vpd_inquiry - Request a device provide us with a VPD page 748 * scsi_vpd_inquiry - Request a device provide us with a VPD page
771 * @sdev: The device to ask 749 * @sdev: The device to ask
772 * @buffer: Where to put the result 750 * @buffer: Where to put the result
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index aa4b6b80aade..7b8b51bc29b4 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -128,7 +128,6 @@ static const char *scsi_debug_version_date = "20141022";
128#define DEF_REMOVABLE false 128#define DEF_REMOVABLE false
129#define DEF_SCSI_LEVEL 6 /* INQUIRY, byte2 [6->SPC-4] */ 129#define DEF_SCSI_LEVEL 6 /* INQUIRY, byte2 [6->SPC-4] */
130#define DEF_SECTOR_SIZE 512 130#define DEF_SECTOR_SIZE 512
131#define DEF_TAGGED_QUEUING 0 /* 0 | MSG_SIMPLE_TAG | MSG_ORDERED_TAG */
132#define DEF_UNMAP_ALIGNMENT 0 131#define DEF_UNMAP_ALIGNMENT 0
133#define DEF_UNMAP_GRANULARITY 1 132#define DEF_UNMAP_GRANULARITY 1
134#define DEF_UNMAP_MAX_BLOCKS 0xFFFFFFFF 133#define DEF_UNMAP_MAX_BLOCKS 0xFFFFFFFF
@@ -817,6 +816,7 @@ static int check_readiness(struct scsi_cmnd *SCpnt, int uas_only,
817 UA_CHANGED_ASC, CAPACITY_CHANGED_ASCQ); 816 UA_CHANGED_ASC, CAPACITY_CHANGED_ASCQ);
818 if (debug) 817 if (debug)
819 cp = "capacity data changed"; 818 cp = "capacity data changed";
819 break;
820 default: 820 default:
821 pr_warn("%s: unexpected unit attention code=%d\n", 821 pr_warn("%s: unexpected unit attention code=%d\n",
822 __func__, k); 822 __func__, k);
@@ -3045,18 +3045,12 @@ resp_comp_write(struct scsi_cmnd *scp, struct sdebug_dev_info *devip)
3045 u8 num; 3045 u8 num;
3046 unsigned long iflags; 3046 unsigned long iflags;
3047 int ret; 3047 int ret;
3048 int retval = 0;
3048 3049
3049 lba = get_unaligned_be32(cmd + 2); 3050 lba = get_unaligned_be64(cmd + 2);
3050 num = cmd[13]; /* 1 to a maximum of 255 logical blocks */ 3051 num = cmd[13]; /* 1 to a maximum of 255 logical blocks */
3051 if (0 == num) 3052 if (0 == num)
3052 return 0; /* degenerate case, not an error */ 3053 return 0; /* degenerate case, not an error */
3053 dnum = 2 * num;
3054 arr = kzalloc(dnum * lb_size, GFP_ATOMIC);
3055 if (NULL == arr) {
3056 mk_sense_buffer(scp, ILLEGAL_REQUEST, INSUFF_RES_ASC,
3057 INSUFF_RES_ASCQ);
3058 return check_condition_result;
3059 }
3060 if (scsi_debug_dif == SD_DIF_TYPE2_PROTECTION && 3054 if (scsi_debug_dif == SD_DIF_TYPE2_PROTECTION &&
3061 (cmd[1] & 0xe0)) { 3055 (cmd[1] & 0xe0)) {
3062 mk_sense_invalid_opcode(scp); 3056 mk_sense_invalid_opcode(scp);
@@ -3079,6 +3073,13 @@ resp_comp_write(struct scsi_cmnd *scp, struct sdebug_dev_info *devip)
3079 mk_sense_buffer(scp, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, 0); 3073 mk_sense_buffer(scp, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, 0);
3080 return check_condition_result; 3074 return check_condition_result;
3081 } 3075 }
3076 dnum = 2 * num;
3077 arr = kzalloc(dnum * lb_size, GFP_ATOMIC);
3078 if (NULL == arr) {
3079 mk_sense_buffer(scp, ILLEGAL_REQUEST, INSUFF_RES_ASC,
3080 INSUFF_RES_ASCQ);
3081 return check_condition_result;
3082 }
3082 3083
3083 write_lock_irqsave(&atomic_rw, iflags); 3084 write_lock_irqsave(&atomic_rw, iflags);
3084 3085
@@ -3089,24 +3090,24 @@ resp_comp_write(struct scsi_cmnd *scp, struct sdebug_dev_info *devip)
3089 ret = do_device_access(scp, 0, dnum, true); 3090 ret = do_device_access(scp, 0, dnum, true);
3090 fake_storep = fake_storep_hold; 3091 fake_storep = fake_storep_hold;
3091 if (ret == -1) { 3092 if (ret == -1) {
3092 write_unlock_irqrestore(&atomic_rw, iflags); 3093 retval = DID_ERROR << 16;
3093 kfree(arr); 3094 goto cleanup;
3094 return DID_ERROR << 16;
3095 } else if ((ret < (dnum * lb_size)) && 3095 } else if ((ret < (dnum * lb_size)) &&
3096 (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)) 3096 (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts))
3097 sdev_printk(KERN_INFO, scp->device, "%s: compare_write: cdb " 3097 sdev_printk(KERN_INFO, scp->device, "%s: compare_write: cdb "
3098 "indicated=%u, IO sent=%d bytes\n", my_name, 3098 "indicated=%u, IO sent=%d bytes\n", my_name,
3099 dnum * lb_size, ret); 3099 dnum * lb_size, ret);
3100 if (!comp_write_worker(lba, num, arr)) { 3100 if (!comp_write_worker(lba, num, arr)) {
3101 write_unlock_irqrestore(&atomic_rw, iflags);
3102 kfree(arr);
3103 mk_sense_buffer(scp, MISCOMPARE, MISCOMPARE_VERIFY_ASC, 0); 3101 mk_sense_buffer(scp, MISCOMPARE, MISCOMPARE_VERIFY_ASC, 0);
3104 return check_condition_result; 3102 retval = check_condition_result;
3103 goto cleanup;
3105 } 3104 }
3106 if (scsi_debug_lbp()) 3105 if (scsi_debug_lbp())
3107 map_region(lba, num); 3106 map_region(lba, num);
3107cleanup:
3108 write_unlock_irqrestore(&atomic_rw, iflags); 3108 write_unlock_irqrestore(&atomic_rw, iflags);
3109 return 0; 3109 kfree(arr);
3110 return retval;
3110} 3111}
3111 3112
3112struct unmap_block_desc { 3113struct unmap_block_desc {
@@ -4438,6 +4439,7 @@ static ssize_t virtual_gb_store(struct device_driver *ddp, const char *buf,
4438 struct sdebug_host_info *sdhp; 4439 struct sdebug_host_info *sdhp;
4439 struct sdebug_dev_info *dp; 4440 struct sdebug_dev_info *dp;
4440 4441
4442 spin_lock(&sdebug_host_list_lock);
4441 list_for_each_entry(sdhp, &sdebug_host_list, 4443 list_for_each_entry(sdhp, &sdebug_host_list,
4442 host_list) { 4444 host_list) {
4443 list_for_each_entry(dp, &sdhp->dev_info_list, 4445 list_for_each_entry(dp, &sdhp->dev_info_list,
@@ -4446,6 +4448,7 @@ static ssize_t virtual_gb_store(struct device_driver *ddp, const char *buf,
4446 dp->uas_bm); 4448 dp->uas_bm);
4447 } 4449 }
4448 } 4450 }
4451 spin_unlock(&sdebug_host_list_lock);
4449 } 4452 }
4450 return count; 4453 return count;
4451 } 4454 }
@@ -4988,32 +4991,6 @@ sdebug_change_qdepth(struct scsi_device *sdev, int qdepth)
4988} 4991}
4989 4992
4990static int 4993static int
4991sdebug_change_qtype(struct scsi_device *sdev, int qtype)
4992{
4993 qtype = scsi_change_queue_type(sdev, qtype);
4994 if (SCSI_DEBUG_OPT_Q_NOISE & scsi_debug_opts) {
4995 const char *cp;
4996
4997 switch (qtype) {
4998 case 0:
4999 cp = "untagged";
5000 break;
5001 case MSG_SIMPLE_TAG:
5002 cp = "simple tags";
5003 break;
5004 case MSG_ORDERED_TAG:
5005 cp = "ordered tags";
5006 break;
5007 default:
5008 cp = "unknown";
5009 break;
5010 }
5011 sdev_printk(KERN_INFO, sdev, "%s: to %s\n", __func__, cp);
5012 }
5013 return qtype;
5014}
5015
5016static int
5017check_inject(struct scsi_cmnd *scp) 4994check_inject(struct scsi_cmnd *scp)
5018{ 4995{
5019 struct sdebug_scmd_extra_t *ep = scsi_cmd_priv(scp); 4996 struct sdebug_scmd_extra_t *ep = scsi_cmd_priv(scp);
@@ -5212,7 +5189,6 @@ static struct scsi_host_template sdebug_driver_template = {
5212 .ioctl = scsi_debug_ioctl, 5189 .ioctl = scsi_debug_ioctl,
5213 .queuecommand = sdebug_queuecommand_lock_or_not, 5190 .queuecommand = sdebug_queuecommand_lock_or_not,
5214 .change_queue_depth = sdebug_change_qdepth, 5191 .change_queue_depth = sdebug_change_qdepth,
5215 .change_queue_type = sdebug_change_qtype,
5216 .eh_abort_handler = scsi_debug_abort, 5192 .eh_abort_handler = scsi_debug_abort,
5217 .eh_device_reset_handler = scsi_debug_device_reset, 5193 .eh_device_reset_handler = scsi_debug_device_reset,
5218 .eh_target_reset_handler = scsi_debug_target_reset, 5194 .eh_target_reset_handler = scsi_debug_target_reset,
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 1cb64a8e18c9..1ac38e73df7e 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -738,30 +738,12 @@ store_queue_type_field(struct device *dev, struct device_attribute *attr,
738 const char *buf, size_t count) 738 const char *buf, size_t count)
739{ 739{
740 struct scsi_device *sdev = to_scsi_device(dev); 740 struct scsi_device *sdev = to_scsi_device(dev);
741 struct scsi_host_template *sht = sdev->host->hostt;
742 int tag_type = 0, retval;
743 int prev_tag_type = scsi_get_tag_type(sdev);
744
745 if (!sdev->tagged_supported || !sht->change_queue_type)
746 return -EINVAL;
747 741
748 /* 742 if (!sdev->tagged_supported)
749 * We're never issueing order tags these days, but allow the value
750 * for backwards compatibility.
751 */
752 if (strncmp(buf, "ordered", 7) == 0 ||
753 strncmp(buf, "simple", 6) == 0)
754 tag_type = MSG_SIMPLE_TAG;
755 else if (strncmp(buf, "none", 4) != 0)
756 return -EINVAL; 743 return -EINVAL;
757 744
758 if (tag_type == prev_tag_type) 745 sdev_printk(KERN_INFO, sdev,
759 return count; 746 "ignoring write to deprecated queue_type attribute");
760
761 retval = sht->change_queue_type(sdev, tag_type);
762 if (retval < 0)
763 return retval;
764
765 return count; 747 return count;
766} 748}
767 749
@@ -938,10 +920,6 @@ static umode_t scsi_sdev_attr_is_visible(struct kobject *kobj,
938 !sdev->host->hostt->change_queue_depth) 920 !sdev->host->hostt->change_queue_depth)
939 return 0; 921 return 0;
940 922
941 if (attr == &dev_attr_queue_type.attr &&
942 !sdev->host->hostt->change_queue_type)
943 return S_IRUGO;
944
945 return attr->mode; 923 return attr->mode;
946} 924}
947 925
diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c
index fa2aece76cc2..31bbb0da3397 100644
--- a/drivers/scsi/scsi_transport_spi.c
+++ b/drivers/scsi/scsi_transport_spi.c
@@ -1221,7 +1221,7 @@ EXPORT_SYMBOL_GPL(spi_populate_ppr_msg);
1221int spi_populate_tag_msg(unsigned char *msg, struct scsi_cmnd *cmd) 1221int spi_populate_tag_msg(unsigned char *msg, struct scsi_cmnd *cmd)
1222{ 1222{
1223 if (cmd->flags & SCMD_TAGGED) { 1223 if (cmd->flags & SCMD_TAGGED) {
1224 *msg++ = MSG_SIMPLE_TAG; 1224 *msg++ = SIMPLE_QUEUE_TAG;
1225 *msg++ = cmd->request->tag; 1225 *msg++ = cmd->request->tag;
1226 return 2; 1226 return 2;
1227 } 1227 }
diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index e3ba251fb6e7..4cff0ddc2c25 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -1688,13 +1688,12 @@ static int storvsc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scmnd)
1688 if (ret == -EAGAIN) { 1688 if (ret == -EAGAIN) {
1689 /* no more space */ 1689 /* no more space */
1690 1690
1691 if (cmd_request->bounce_sgl_count) { 1691 if (cmd_request->bounce_sgl_count)
1692 destroy_bounce_buffer(cmd_request->bounce_sgl, 1692 destroy_bounce_buffer(cmd_request->bounce_sgl,
1693 cmd_request->bounce_sgl_count); 1693 cmd_request->bounce_sgl_count);
1694 1694
1695 ret = SCSI_MLQUEUE_DEVICE_BUSY; 1695 ret = SCSI_MLQUEUE_DEVICE_BUSY;
1696 goto queue_error; 1696 goto queue_error;
1697 }
1698 } 1697 }
1699 1698
1700 return 0; 1699 return 0;
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index 73e58d22e325..811d863f4206 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -943,17 +943,17 @@ int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
943 */ 943 */
944 if ((iscsi_task_attr == ISCSI_ATTR_UNTAGGED) || 944 if ((iscsi_task_attr == ISCSI_ATTR_UNTAGGED) ||
945 (iscsi_task_attr == ISCSI_ATTR_SIMPLE)) 945 (iscsi_task_attr == ISCSI_ATTR_SIMPLE))
946 sam_task_attr = MSG_SIMPLE_TAG; 946 sam_task_attr = TCM_SIMPLE_TAG;
947 else if (iscsi_task_attr == ISCSI_ATTR_ORDERED) 947 else if (iscsi_task_attr == ISCSI_ATTR_ORDERED)
948 sam_task_attr = MSG_ORDERED_TAG; 948 sam_task_attr = TCM_ORDERED_TAG;
949 else if (iscsi_task_attr == ISCSI_ATTR_HEAD_OF_QUEUE) 949 else if (iscsi_task_attr == ISCSI_ATTR_HEAD_OF_QUEUE)
950 sam_task_attr = MSG_HEAD_TAG; 950 sam_task_attr = TCM_HEAD_TAG;
951 else if (iscsi_task_attr == ISCSI_ATTR_ACA) 951 else if (iscsi_task_attr == ISCSI_ATTR_ACA)
952 sam_task_attr = MSG_ACA_TAG; 952 sam_task_attr = TCM_ACA_TAG;
953 else { 953 else {
954 pr_debug("Unknown iSCSI Task Attribute: 0x%02x, using" 954 pr_debug("Unknown iSCSI Task Attribute: 0x%02x, using"
955 " MSG_SIMPLE_TAG\n", iscsi_task_attr); 955 " TCM_SIMPLE_TAG\n", iscsi_task_attr);
956 sam_task_attr = MSG_SIMPLE_TAG; 956 sam_task_attr = TCM_SIMPLE_TAG;
957 } 957 }
958 958
959 cmd->iscsi_opcode = ISCSI_OP_SCSI_CMD; 959 cmd->iscsi_opcode = ISCSI_OP_SCSI_CMD;
@@ -1811,7 +1811,7 @@ iscsit_handle_task_mgt_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
1811 transport_init_se_cmd(&cmd->se_cmd, 1811 transport_init_se_cmd(&cmd->se_cmd,
1812 &lio_target_fabric_configfs->tf_ops, 1812 &lio_target_fabric_configfs->tf_ops,
1813 conn->sess->se_sess, 0, DMA_NONE, 1813 conn->sess->se_sess, 0, DMA_NONE,
1814 MSG_SIMPLE_TAG, cmd->sense_buffer + 2); 1814 TCM_SIMPLE_TAG, cmd->sense_buffer + 2);
1815 1815
1816 target_get_sess_cmd(conn->sess->se_sess, &cmd->se_cmd, true); 1816 target_get_sess_cmd(conn->sess->se_sess, &cmd->se_cmd, true);
1817 sess_ref = true; 1817 sess_ref = true;
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
index 4d1b7224a7f2..dda9a08c939f 100644
--- a/drivers/target/loopback/tcm_loop.c
+++ b/drivers/target/loopback/tcm_loop.c
@@ -168,7 +168,7 @@ static void tcm_loop_submission_work(struct work_struct *work)
168 168
169 rc = target_submit_cmd_map_sgls(se_cmd, tl_nexus->se_sess, sc->cmnd, 169 rc = target_submit_cmd_map_sgls(se_cmd, tl_nexus->se_sess, sc->cmnd,
170 &tl_cmd->tl_sense_buf[0], tl_cmd->sc->device->lun, 170 &tl_cmd->tl_sense_buf[0], tl_cmd->sc->device->lun,
171 transfer_length, MSG_SIMPLE_TAG, 171 transfer_length, TCM_SIMPLE_TAG,
172 sc->sc_data_direction, 0, 172 sc->sc_data_direction, 0,
173 scsi_sglist(sc), scsi_sg_count(sc), 173 scsi_sglist(sc), scsi_sg_count(sc),
174 sgl_bidi, sgl_bidi_count, 174 sgl_bidi, sgl_bidi_count,
@@ -248,7 +248,7 @@ static int tcm_loop_issue_tmr(struct tcm_loop_tpg *tl_tpg,
248 * Initialize struct se_cmd descriptor from target_core_mod infrastructure 248 * Initialize struct se_cmd descriptor from target_core_mod infrastructure
249 */ 249 */
250 transport_init_se_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess, 0, 250 transport_init_se_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess, 0,
251 DMA_NONE, MSG_SIMPLE_TAG, 251 DMA_NONE, TCM_SIMPLE_TAG,
252 &tl_cmd->tl_sense_buf[0]); 252 &tl_cmd->tl_sense_buf[0]);
253 253
254 rc = core_tmr_alloc_req(se_cmd, tl_tmr, tmr, GFP_KERNEL); 254 rc = core_tmr_alloc_req(se_cmd, tl_tmr, tmr, GFP_KERNEL);
@@ -385,7 +385,6 @@ static struct scsi_host_template tcm_loop_driver_template = {
385 .name = "TCM_Loopback", 385 .name = "TCM_Loopback",
386 .queuecommand = tcm_loop_queuecommand, 386 .queuecommand = tcm_loop_queuecommand,
387 .change_queue_depth = scsi_change_queue_depth, 387 .change_queue_depth = scsi_change_queue_depth,
388 .change_queue_type = scsi_change_queue_type,
389 .eh_abort_handler = tcm_loop_abort_task, 388 .eh_abort_handler = tcm_loop_abort_task,
390 .eh_device_reset_handler = tcm_loop_device_reset, 389 .eh_device_reset_handler = tcm_loop_device_reset,
391 .eh_target_reset_handler = tcm_loop_target_reset, 390 .eh_target_reset_handler = tcm_loop_target_reset,
diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c
index e7e93727553c..9512af6a8114 100644
--- a/drivers/target/sbp/sbp_target.c
+++ b/drivers/target/sbp/sbp_target.c
@@ -1237,7 +1237,7 @@ static void sbp_handle_command(struct sbp_target_request *req)
1237 1237
1238 if (target_submit_cmd(&req->se_cmd, sess->se_sess, req->cmd_buf, 1238 if (target_submit_cmd(&req->se_cmd, sess->se_sess, req->cmd_buf,
1239 req->sense_buf, unpacked_lun, data_length, 1239 req->sense_buf, unpacked_lun, data_length,
1240 MSG_SIMPLE_TAG, data_dir, 0)) 1240 TCM_SIMPLE_TAG, data_dir, 0))
1241 goto err; 1241 goto err;
1242 1242
1243 return; 1243 return;
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
index 7c8291f0bbbc..caf03d5b3ca2 100644
--- a/drivers/target/target_core_pscsi.c
+++ b/drivers/target/target_core_pscsi.c
@@ -1094,7 +1094,7 @@ pscsi_execute_cmd(struct se_cmd *cmd)
1094 req->retries = PS_RETRY; 1094 req->retries = PS_RETRY;
1095 1095
1096 blk_execute_rq_nowait(pdv->pdv_sd->request_queue, NULL, req, 1096 blk_execute_rq_nowait(pdv->pdv_sd->request_queue, NULL, req,
1097 (cmd->sam_task_attr == MSG_HEAD_TAG), 1097 (cmd->sam_task_attr == TCM_HEAD_TAG),
1098 pscsi_req_done); 1098 pscsi_req_done);
1099 1099
1100 return 0; 1100 return 0;
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c
index 8d171ff77e75..11bea1952435 100644
--- a/drivers/target/target_core_sbc.c
+++ b/drivers/target/target_core_sbc.c
@@ -485,7 +485,7 @@ static sense_reason_t compare_and_write_callback(struct se_cmd *cmd)
485 cmd->t_data_nents_orig = cmd->t_data_nents; 485 cmd->t_data_nents_orig = cmd->t_data_nents;
486 cmd->t_data_nents = 1; 486 cmd->t_data_nents = 1;
487 487
488 cmd->sam_task_attr = MSG_HEAD_TAG; 488 cmd->sam_task_attr = TCM_HEAD_TAG;
489 cmd->transport_complete_callback = compare_and_write_post; 489 cmd->transport_complete_callback = compare_and_write_post;
490 /* 490 /*
491 * Now reset ->execute_cmd() to the normal sbc_execute_rw() handler 491 * Now reset ->execute_cmd() to the normal sbc_execute_rw() handler
diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c
index bc286a67af7c..1307600fe726 100644
--- a/drivers/target/target_core_spc.c
+++ b/drivers/target/target_core_spc.c
@@ -1357,7 +1357,7 @@ spc_parse_cdb(struct se_cmd *cmd, unsigned int *size)
1357 * Do implicit HEAD_OF_QUEUE processing for INQUIRY. 1357 * Do implicit HEAD_OF_QUEUE processing for INQUIRY.
1358 * See spc4r17 section 5.3 1358 * See spc4r17 section 5.3
1359 */ 1359 */
1360 cmd->sam_task_attr = MSG_HEAD_TAG; 1360 cmd->sam_task_attr = TCM_HEAD_TAG;
1361 cmd->execute_cmd = spc_emulate_inquiry; 1361 cmd->execute_cmd = spc_emulate_inquiry;
1362 break; 1362 break;
1363 case SECURITY_PROTOCOL_IN: 1363 case SECURITY_PROTOCOL_IN:
@@ -1391,7 +1391,7 @@ spc_parse_cdb(struct se_cmd *cmd, unsigned int *size)
1391 * Do implicit HEAD_OF_QUEUE processing for REPORT_LUNS 1391 * Do implicit HEAD_OF_QUEUE processing for REPORT_LUNS
1392 * See spc4r17 section 5.3 1392 * See spc4r17 section 5.3
1393 */ 1393 */
1394 cmd->sam_task_attr = MSG_HEAD_TAG; 1394 cmd->sam_task_attr = TCM_HEAD_TAG;
1395 break; 1395 break;
1396 case TEST_UNIT_READY: 1396 case TEST_UNIT_READY:
1397 cmd->execute_cmd = spc_emulate_testunitready; 1397 cmd->execute_cmd = spc_emulate_testunitready;
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index be877bf6f730..0adc0f650213 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -1159,7 +1159,7 @@ transport_check_alloc_task_attr(struct se_cmd *cmd)
1159 if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) 1159 if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV)
1160 return 0; 1160 return 0;
1161 1161
1162 if (cmd->sam_task_attr == MSG_ACA_TAG) { 1162 if (cmd->sam_task_attr == TCM_ACA_TAG) {
1163 pr_debug("SAM Task Attribute ACA" 1163 pr_debug("SAM Task Attribute ACA"
1164 " emulation is not supported\n"); 1164 " emulation is not supported\n");
1165 return TCM_INVALID_CDB_FIELD; 1165 return TCM_INVALID_CDB_FIELD;
@@ -1531,7 +1531,7 @@ int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess,
1531 BUG_ON(!se_tpg); 1531 BUG_ON(!se_tpg);
1532 1532
1533 transport_init_se_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess, 1533 transport_init_se_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess,
1534 0, DMA_NONE, MSG_SIMPLE_TAG, sense); 1534 0, DMA_NONE, TCM_SIMPLE_TAG, sense);
1535 /* 1535 /*
1536 * FIXME: Currently expect caller to handle se_cmd->se_tmr_req 1536 * FIXME: Currently expect caller to handle se_cmd->se_tmr_req
1537 * allocation failure. 1537 * allocation failure.
@@ -1718,12 +1718,12 @@ static bool target_handle_task_attr(struct se_cmd *cmd)
1718 * to allow the passed struct se_cmd list of tasks to the front of the list. 1718 * to allow the passed struct se_cmd list of tasks to the front of the list.
1719 */ 1719 */
1720 switch (cmd->sam_task_attr) { 1720 switch (cmd->sam_task_attr) {
1721 case MSG_HEAD_TAG: 1721 case TCM_HEAD_TAG:
1722 pr_debug("Added HEAD_OF_QUEUE for CDB: 0x%02x, " 1722 pr_debug("Added HEAD_OF_QUEUE for CDB: 0x%02x, "
1723 "se_ordered_id: %u\n", 1723 "se_ordered_id: %u\n",
1724 cmd->t_task_cdb[0], cmd->se_ordered_id); 1724 cmd->t_task_cdb[0], cmd->se_ordered_id);
1725 return false; 1725 return false;
1726 case MSG_ORDERED_TAG: 1726 case TCM_ORDERED_TAG:
1727 atomic_inc_mb(&dev->dev_ordered_sync); 1727 atomic_inc_mb(&dev->dev_ordered_sync);
1728 1728
1729 pr_debug("Added ORDERED for CDB: 0x%02x to ordered list, " 1729 pr_debug("Added ORDERED for CDB: 0x%02x to ordered list, "
@@ -1828,7 +1828,7 @@ static void target_restart_delayed_cmds(struct se_device *dev)
1828 1828
1829 __target_execute_cmd(cmd); 1829 __target_execute_cmd(cmd);
1830 1830
1831 if (cmd->sam_task_attr == MSG_ORDERED_TAG) 1831 if (cmd->sam_task_attr == TCM_ORDERED_TAG)
1832 break; 1832 break;
1833 } 1833 }
1834} 1834}
@@ -1844,18 +1844,18 @@ static void transport_complete_task_attr(struct se_cmd *cmd)
1844 if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) 1844 if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV)
1845 return; 1845 return;
1846 1846
1847 if (cmd->sam_task_attr == MSG_SIMPLE_TAG) { 1847 if (cmd->sam_task_attr == TCM_SIMPLE_TAG) {
1848 atomic_dec_mb(&dev->simple_cmds); 1848 atomic_dec_mb(&dev->simple_cmds);
1849 dev->dev_cur_ordered_id++; 1849 dev->dev_cur_ordered_id++;
1850 pr_debug("Incremented dev->dev_cur_ordered_id: %u for" 1850 pr_debug("Incremented dev->dev_cur_ordered_id: %u for"
1851 " SIMPLE: %u\n", dev->dev_cur_ordered_id, 1851 " SIMPLE: %u\n", dev->dev_cur_ordered_id,
1852 cmd->se_ordered_id); 1852 cmd->se_ordered_id);
1853 } else if (cmd->sam_task_attr == MSG_HEAD_TAG) { 1853 } else if (cmd->sam_task_attr == TCM_HEAD_TAG) {
1854 dev->dev_cur_ordered_id++; 1854 dev->dev_cur_ordered_id++;
1855 pr_debug("Incremented dev_cur_ordered_id: %u for" 1855 pr_debug("Incremented dev_cur_ordered_id: %u for"
1856 " HEAD_OF_QUEUE: %u\n", dev->dev_cur_ordered_id, 1856 " HEAD_OF_QUEUE: %u\n", dev->dev_cur_ordered_id,
1857 cmd->se_ordered_id); 1857 cmd->se_ordered_id);
1858 } else if (cmd->sam_task_attr == MSG_ORDERED_TAG) { 1858 } else if (cmd->sam_task_attr == TCM_ORDERED_TAG) {
1859 atomic_dec_mb(&dev->dev_ordered_sync); 1859 atomic_dec_mb(&dev->dev_ordered_sync);
1860 1860
1861 dev->dev_cur_ordered_id++; 1861 dev->dev_cur_ordered_id++;
diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c
index be0c0d08c56a..edcafa4490c0 100644
--- a/drivers/target/tcm_fc/tfc_cmd.c
+++ b/drivers/target/tcm_fc/tfc_cmd.c
@@ -554,17 +554,17 @@ static void ft_send_work(struct work_struct *work)
554 */ 554 */
555 switch (fcp->fc_pri_ta & FCP_PTA_MASK) { 555 switch (fcp->fc_pri_ta & FCP_PTA_MASK) {
556 case FCP_PTA_HEADQ: 556 case FCP_PTA_HEADQ:
557 task_attr = MSG_HEAD_TAG; 557 task_attr = TCM_HEAD_TAG;
558 break; 558 break;
559 case FCP_PTA_ORDERED: 559 case FCP_PTA_ORDERED:
560 task_attr = MSG_ORDERED_TAG; 560 task_attr = TCM_ORDERED_TAG;
561 break; 561 break;
562 case FCP_PTA_ACA: 562 case FCP_PTA_ACA:
563 task_attr = MSG_ACA_TAG; 563 task_attr = TCM_ACA_TAG;
564 break; 564 break;
565 case FCP_PTA_SIMPLE: /* Fallthrough */ 565 case FCP_PTA_SIMPLE: /* Fallthrough */
566 default: 566 default:
567 task_attr = MSG_SIMPLE_TAG; 567 task_attr = TCM_SIMPLE_TAG;
568 } 568 }
569 569
570 fc_seq_exch(cmd->seq)->lp->tt.seq_set_resp(cmd->seq, ft_recv_seq, cmd); 570 fc_seq_exch(cmd->seq)->lp->tt.seq_set_resp(cmd->seq, ft_recv_seq, cmd);
diff --git a/drivers/usb/gadget/legacy/tcm_usb_gadget.c b/drivers/usb/gadget/legacy/tcm_usb_gadget.c
index 024f58475a94..3a494168661e 100644
--- a/drivers/usb/gadget/legacy/tcm_usb_gadget.c
+++ b/drivers/usb/gadget/legacy/tcm_usb_gadget.c
@@ -1131,19 +1131,19 @@ static int usbg_submit_command(struct f_uas *fu,
1131 1131
1132 switch (cmd_iu->prio_attr & 0x7) { 1132 switch (cmd_iu->prio_attr & 0x7) {
1133 case UAS_HEAD_TAG: 1133 case UAS_HEAD_TAG:
1134 cmd->prio_attr = MSG_HEAD_TAG; 1134 cmd->prio_attr = TCM_HEAD_TAG;
1135 break; 1135 break;
1136 case UAS_ORDERED_TAG: 1136 case UAS_ORDERED_TAG:
1137 cmd->prio_attr = MSG_ORDERED_TAG; 1137 cmd->prio_attr = TCM_ORDERED_TAG;
1138 break; 1138 break;
1139 case UAS_ACA: 1139 case UAS_ACA:
1140 cmd->prio_attr = MSG_ACA_TAG; 1140 cmd->prio_attr = TCM_ACA_TAG;
1141 break; 1141 break;
1142 default: 1142 default:
1143 pr_debug_once("Unsupported prio_attr: %02x.\n", 1143 pr_debug_once("Unsupported prio_attr: %02x.\n",
1144 cmd_iu->prio_attr); 1144 cmd_iu->prio_attr);
1145 case UAS_SIMPLE_TAG: 1145 case UAS_SIMPLE_TAG:
1146 cmd->prio_attr = MSG_SIMPLE_TAG; 1146 cmd->prio_attr = TCM_SIMPLE_TAG;
1147 break; 1147 break;
1148 } 1148 }
1149 1149
@@ -1240,7 +1240,7 @@ static int bot_submit_command(struct f_uas *fu,
1240 goto err; 1240 goto err;
1241 } 1241 }
1242 1242
1243 cmd->prio_attr = MSG_SIMPLE_TAG; 1243 cmd->prio_attr = TCM_SIMPLE_TAG;
1244 se_cmd = &cmd->se_cmd; 1244 se_cmd = &cmd->se_cmd;
1245 cmd->unpacked_lun = cbw->Lun; 1245 cmd->unpacked_lun = cbw->Lun;
1246 cmd->is_read = cbw->Flags & US_BULK_FLAG_IN ? 1 : 0; 1246 cmd->is_read = cbw->Flags & US_BULK_FLAG_IN ? 1 : 0;
diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c
index 50610a6acf3d..e999496eda3e 100644
--- a/drivers/xen/xen-scsiback.c
+++ b/drivers/xen/xen-scsiback.c
@@ -606,7 +606,7 @@ static void scsiback_device_action(struct vscsibk_pend *pending_req,
606 init_waitqueue_head(&tmr->tmr_wait); 606 init_waitqueue_head(&tmr->tmr_wait);
607 607
608 transport_init_se_cmd(se_cmd, tpg->se_tpg.se_tpg_tfo, 608 transport_init_se_cmd(se_cmd, tpg->se_tpg.se_tpg_tfo,
609 tpg->tpg_nexus->tvn_se_sess, 0, DMA_NONE, MSG_SIMPLE_TAG, 609 tpg->tpg_nexus->tvn_se_sess, 0, DMA_NONE, TCM_SIMPLE_TAG,
610 &pending_req->sense_buffer[0]); 610 &pending_req->sense_buffer[0]);
611 611
612 rc = core_tmr_alloc_req(se_cmd, tmr, act, GFP_KERNEL); 612 rc = core_tmr_alloc_req(se_cmd, tmr, act, GFP_KERNEL);
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index 9d87a37aecad..dae99d7d2bc0 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -688,7 +688,6 @@ extern int sas_queuecommand(struct Scsi_Host * ,struct scsi_cmnd *);
688extern int sas_target_alloc(struct scsi_target *); 688extern int sas_target_alloc(struct scsi_target *);
689extern int sas_slave_configure(struct scsi_device *); 689extern int sas_slave_configure(struct scsi_device *);
690extern int sas_change_queue_depth(struct scsi_device *, int new_depth); 690extern int sas_change_queue_depth(struct scsi_device *, int new_depth);
691extern int sas_change_queue_type(struct scsi_device *, int qt);
692extern int sas_bios_param(struct scsi_device *, 691extern int sas_bios_param(struct scsi_device *,
693 struct block_device *, 692 struct block_device *,
694 sector_t capacity, int *hsc); 693 sector_t capacity, int *hsc);
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index e939d2b3757a..019e66858ce6 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -278,19 +278,6 @@ struct scsi_host_template {
278 int (* change_queue_depth)(struct scsi_device *, int); 278 int (* change_queue_depth)(struct scsi_device *, int);
279 279
280 /* 280 /*
281 * Fill in this function to allow the changing of tag types
282 * (this also allows the enabling/disabling of tag command
283 * queueing). An error should only be returned if something
284 * went wrong in the driver while trying to set the tag type.
285 * If the driver doesn't support the requested tag type, then
286 * it should set the closest type it does support without
287 * returning an error. Returns the actual tag type set.
288 *
289 * Status: OPTIONAL
290 */
291 int (* change_queue_type)(struct scsi_device *, int);
292
293 /*
294 * This function determines the BIOS parameters for a given 281 * This function determines the BIOS parameters for a given
295 * harddisk. These tend to be numbers that are made up by 282 * harddisk. These tend to be numbers that are made up by
296 * the host adapter. Parameters: 283 * the host adapter. Parameters:
diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h
index fe4a70299419..9708b28bd2aa 100644
--- a/include/scsi/scsi_tcq.h
+++ b/include/scsi/scsi_tcq.h
@@ -6,46 +6,10 @@
6#include <scsi/scsi_device.h> 6#include <scsi/scsi_device.h>
7#include <scsi/scsi_host.h> 7#include <scsi/scsi_host.h>
8 8
9#define MSG_SIMPLE_TAG 0x20
10#define MSG_HEAD_TAG 0x21
11#define MSG_ORDERED_TAG 0x22
12#define MSG_ACA_TAG 0x24 /* unsupported */
13
14#define SCSI_NO_TAG (-1) /* identify no tag in use */ 9#define SCSI_NO_TAG (-1) /* identify no tag in use */
15 10
16 11
17#ifdef CONFIG_BLOCK 12#ifdef CONFIG_BLOCK
18
19int scsi_change_queue_type(struct scsi_device *sdev, int tag_type);
20
21/**
22 * scsi_get_tag_type - get the type of tag the device supports
23 * @sdev: the scsi device
24 */
25static inline int scsi_get_tag_type(struct scsi_device *sdev)
26{
27 if (!sdev->tagged_supported)
28 return 0;
29 if (sdev->simple_tags)
30 return MSG_SIMPLE_TAG;
31 return 0;
32}
33
34static inline void scsi_set_tag_type(struct scsi_device *sdev, int tag)
35{
36 switch (tag) {
37 case MSG_ORDERED_TAG:
38 case MSG_SIMPLE_TAG:
39 sdev->simple_tags = 1;
40 break;
41 case 0:
42 /* fall through */
43 default:
44 sdev->simple_tags = 0;
45 break;
46 }
47}
48
49static inline struct scsi_cmnd *scsi_mq_find_tag(struct Scsi_Host *shost, 13static inline struct scsi_cmnd *scsi_mq_find_tag(struct Scsi_Host *shost,
50 int unique_tag) 14 int unique_tag)
51{ 15{
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 23c518a0340c..397fb635766a 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -476,6 +476,12 @@ struct se_dif_v1_tuple {
476 __be32 ref_tag; 476 __be32 ref_tag;
477}; 477};
478 478
479/* for sam_task_attr */
480#define TCM_SIMPLE_TAG 0x20
481#define TCM_HEAD_TAG 0x21
482#define TCM_ORDERED_TAG 0x22
483#define TCM_ACA_TAG 0x24
484
479struct se_cmd { 485struct se_cmd {
480 /* SAM response code being sent to initiator */ 486 /* SAM response code being sent to initiator */
481 u8 scsi_status; 487 u8 scsi_status;
diff --git a/include/trace/events/target.h b/include/trace/events/target.h
index 45403443dd82..04c3c6efdcc2 100644
--- a/include/trace/events/target.h
+++ b/include/trace/events/target.h
@@ -109,10 +109,10 @@
109 109
110#define show_task_attribute_name(val) \ 110#define show_task_attribute_name(val) \
111 __print_symbolic(val, \ 111 __print_symbolic(val, \
112 { MSG_SIMPLE_TAG, "SIMPLE" }, \ 112 { TCM_SIMPLE_TAG, "SIMPLE" }, \
113 { MSG_HEAD_TAG, "HEAD" }, \ 113 { TCM_HEAD_TAG, "HEAD" }, \
114 { MSG_ORDERED_TAG, "ORDERED" }, \ 114 { TCM_ORDERED_TAG, "ORDERED" }, \
115 { MSG_ACA_TAG, "ACA" } ) 115 { TCM_ACA_TAG, "ACA" } )
116 116
117#define show_scsi_status_name(val) \ 117#define show_scsi_status_name(val) \
118 __print_symbolic(val, \ 118 __print_symbolic(val, \