X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=drivers%2Ftarget%2Ftarget_core_spc.c;h=7912aa1243857a8968dcff5fa0f643b8e249dd6e;hb=296edb71dc55f1997e94767a405077b302e4da9b;hp=6c8bd6bc175ca48fb9d33063dc3f3b8185d19876;hpb=2404a70dd38806d455110c09ee49e932b2839d48;p=karo-tx-linux.git diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c index 6c8bd6bc175c..7912aa124385 100644 --- a/drivers/target/target_core_spc.c +++ b/drivers/target/target_core_spc.c @@ -103,10 +103,12 @@ spc_emulate_inquiry_std(struct se_cmd *cmd, unsigned char *buf) buf[5] |= 0x8; /* * Set Protection (PROTECT) bit when DIF has been enabled on the - * device, and the transport supports VERIFY + PASS. + * device, and the fabric supports VERIFY + PASS. Also report + * PROTECT=1 if sess_prot_type has been configured to allow T10-PI + * to unprotected devices. */ if (sess->sup_prot_ops & (TARGET_PROT_DIN_PASS | TARGET_PROT_DOUT_PASS)) { - if (dev->dev_attrib.pi_prot_type) + if (dev->dev_attrib.pi_prot_type || cmd->se_sess->sess_prot_type) buf[5] |= 0x1; } @@ -467,9 +469,11 @@ spc_emulate_evpd_86(struct se_cmd *cmd, unsigned char *buf) * only for TYPE3 protection. */ if (sess->sup_prot_ops & (TARGET_PROT_DIN_PASS | TARGET_PROT_DOUT_PASS)) { - if (dev->dev_attrib.pi_prot_type == TARGET_DIF_TYPE1_PROT) + if (dev->dev_attrib.pi_prot_type == TARGET_DIF_TYPE1_PROT || + cmd->se_sess->sess_prot_type == TARGET_DIF_TYPE1_PROT) buf[4] = 0x5; - else if (dev->dev_attrib.pi_prot_type == TARGET_DIF_TYPE3_PROT) + else if (dev->dev_attrib.pi_prot_type == TARGET_DIF_TYPE3_PROT || + cmd->se_sess->sess_prot_type == TARGET_DIF_TYPE3_PROT) buf[4] = 0x4; } @@ -861,7 +865,7 @@ static int spc_modesense_control(struct se_cmd *cmd, u8 pc, u8 *p) * TAG field. */ if (sess->sup_prot_ops & (TARGET_PROT_DIN_PASS | TARGET_PROT_DOUT_PASS)) { - if (dev->dev_attrib.pi_prot_type) + if (dev->dev_attrib.pi_prot_type || sess->sess_prot_type) p[5] |= 0x80; } @@ -1099,7 +1103,7 @@ static sense_reason_t spc_emulate_modeselect(struct se_cmd *cmd) unsigned char *buf; unsigned char tbuf[SE_MODE_PAGE_BUF]; int length; - int ret = 0; + sense_reason_t ret = 0; int i; if (!cmd->data_length) {