aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/target/target_core_sbc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c
index ec204f7ef126..f2d73dd4f9a3 100644
--- a/drivers/target/target_core_sbc.c
+++ b/drivers/target/target_core_sbc.c
@@ -89,6 +89,7 @@ static sense_reason_t
89sbc_emulate_readcapacity_16(struct se_cmd *cmd) 89sbc_emulate_readcapacity_16(struct se_cmd *cmd)
90{ 90{
91 struct se_device *dev = cmd->se_dev; 91 struct se_device *dev = cmd->se_dev;
92 struct se_session *sess = cmd->se_sess;
92 unsigned char *rbuf; 93 unsigned char *rbuf;
93 unsigned char buf[32]; 94 unsigned char buf[32];
94 unsigned long long blocks = dev->transport->get_blocks(dev); 95 unsigned long long blocks = dev->transport->get_blocks(dev);
@@ -109,8 +110,10 @@ sbc_emulate_readcapacity_16(struct se_cmd *cmd)
109 /* 110 /*
110 * Set P_TYPE and PROT_EN bits for DIF support 111 * Set P_TYPE and PROT_EN bits for DIF support
111 */ 112 */
112 if (dev->dev_attrib.pi_prot_type) 113 if (sess->sup_prot_ops & (TARGET_PROT_DIN_PASS | TARGET_PROT_DOUT_PASS)) {
113 buf[12] = (dev->dev_attrib.pi_prot_type - 1) << 1 | 0x1; 114 if (dev->dev_attrib.pi_prot_type)
115 buf[12] = (dev->dev_attrib.pi_prot_type - 1) << 1 | 0x1;
116 }
114 117
115 if (dev->transport->get_lbppbe) 118 if (dev->transport->get_lbppbe)
116 buf[13] = dev->transport->get_lbppbe(dev) & 0x0f; 119 buf[13] = dev->transport->get_lbppbe(dev) & 0x0f;