aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/target/target_core_spc.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c
index 3bebc71ea033..d4c6a318d4c2 100644
--- a/drivers/target/target_core_spc.c
+++ b/drivers/target/target_core_spc.c
@@ -71,6 +71,7 @@ spc_emulate_inquiry_std(struct se_cmd *cmd, unsigned char *buf)
71{ 71{
72 struct se_lun *lun = cmd->se_lun; 72 struct se_lun *lun = cmd->se_lun;
73 struct se_device *dev = cmd->se_dev; 73 struct se_device *dev = cmd->se_dev;
74 struct se_session *sess = cmd->se_sess;
74 75
75 /* Set RMB (removable media) for tape devices */ 76 /* Set RMB (removable media) for tape devices */
76 if (dev->transport->get_device_type(dev) == TYPE_TAPE) 77 if (dev->transport->get_device_type(dev) == TYPE_TAPE)
@@ -101,10 +102,13 @@ spc_emulate_inquiry_std(struct se_cmd *cmd, unsigned char *buf)
101 if (dev->dev_attrib.emulate_3pc) 102 if (dev->dev_attrib.emulate_3pc)
102 buf[5] |= 0x8; 103 buf[5] |= 0x8;
103 /* 104 /*
104 * Set Protection (PROTECT) bit when DIF has been enabled. 105 * Set Protection (PROTECT) bit when DIF has been enabled on the
106 * device, and the transport supports VERIFY + PASS.
105 */ 107 */
106 if (dev->dev_attrib.pi_prot_type) 108 if (sess->sup_prot_ops & (TARGET_PROT_DIN_PASS | TARGET_PROT_DOUT_PASS)) {
107 buf[5] |= 0x1; 109 if (dev->dev_attrib.pi_prot_type)
110 buf[5] |= 0x1;
111 }
108 112
109 buf[7] = 0x2; /* CmdQue=1 */ 113 buf[7] = 0x2; /* CmdQue=1 */
110 114
@@ -473,16 +477,19 @@ static sense_reason_t
473spc_emulate_evpd_86(struct se_cmd *cmd, unsigned char *buf) 477spc_emulate_evpd_86(struct se_cmd *cmd, unsigned char *buf)
474{ 478{
475 struct se_device *dev = cmd->se_dev; 479 struct se_device *dev = cmd->se_dev;
480 struct se_session *sess = cmd->se_sess;
476 481
477 buf[3] = 0x3c; 482 buf[3] = 0x3c;
478 /* 483 /*
479 * Set GRD_CHK + REF_CHK for TYPE1 protection, or GRD_CHK 484 * Set GRD_CHK + REF_CHK for TYPE1 protection, or GRD_CHK
480 * only for TYPE3 protection. 485 * only for TYPE3 protection.
481 */ 486 */
482 if (dev->dev_attrib.pi_prot_type == TARGET_DIF_TYPE1_PROT) 487 if (sess->sup_prot_ops & (TARGET_PROT_DIN_PASS | TARGET_PROT_DOUT_PASS)) {
483 buf[4] = 0x5; 488 if (dev->dev_attrib.pi_prot_type == TARGET_DIF_TYPE1_PROT)
484 else if (dev->dev_attrib.pi_prot_type == TARGET_DIF_TYPE3_PROT) 489 buf[4] = 0x5;
485 buf[4] = 0x4; 490 else if (dev->dev_attrib.pi_prot_type == TARGET_DIF_TYPE3_PROT)
491 buf[4] = 0x4;
492 }
486 493
487 /* Set HEADSUP, ORDSUP, SIMPSUP */ 494 /* Set HEADSUP, ORDSUP, SIMPSUP */
488 buf[5] = 0x07; 495 buf[5] = 0x07;