target: Add DIF CHECK_CONDITION ASC/ASCQ exception cases
authorNicholas Bellinger <nab@linux-iscsi.org>
Tue, 7 Jan 2014 23:39:33 +0000 (23:39 +0000)
committerNicholas Bellinger <nab@linux-iscsi.org>
Sat, 18 Jan 2014 09:53:11 +0000 (09:53 +0000)
This patch adds support for DIF related CHECK_CONDITION ASC/ASCQ
exception cases into transport_send_check_condition_and_sense().

This includes:

  LOGICAL BLOCK GUARD CHECK FAILED
  LOGICAL BLOCK APPLICATION TAG CHECK FAILED
  LOGICAL BLOCK REFERENCE TAG CHECK FAILED

that used by DIF TYPE1 and TYPE3 failure cases.

Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Sagi Grimberg <sagig@mellanox.com>
Cc: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/target_core_transport.c
include/target/target_core_base.h

index 18c828dc3b9ebd36006a0816bd851aee6385da84..fa4fc0429452fbb48a47ab3767479268e2c8377f 100644 (file)
@@ -2674,6 +2674,36 @@ transport_send_check_condition_and_sense(struct se_cmd *cmd,
                buffer[SPC_ASC_KEY_OFFSET] = 0x1d;
                buffer[SPC_ASCQ_KEY_OFFSET] = 0x00;
                break;
+       case TCM_LOGICAL_BLOCK_GUARD_CHECK_FAILED:
+               /* CURRENT ERROR */
+               buffer[0] = 0x70;
+               buffer[SPC_ADD_SENSE_LEN_OFFSET] = 10;
+               /* ILLEGAL REQUEST */
+               buffer[SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
+               /* LOGICAL BLOCK GUARD CHECK FAILED */
+               buffer[SPC_ASC_KEY_OFFSET] = 0x10;
+               buffer[SPC_ASCQ_KEY_OFFSET] = 0x01;
+               break;
+       case TCM_LOGICAL_BLOCK_APP_TAG_CHECK_FAILED:
+               /* CURRENT ERROR */
+               buffer[0] = 0x70;
+               buffer[SPC_ADD_SENSE_LEN_OFFSET] = 10;
+               /* ILLEGAL REQUEST */
+               buffer[SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
+               /* LOGICAL BLOCK APPLICATION TAG CHECK FAILED */
+               buffer[SPC_ASC_KEY_OFFSET] = 0x10;
+               buffer[SPC_ASCQ_KEY_OFFSET] = 0x02;
+               break;
+       case TCM_LOGICAL_BLOCK_REF_TAG_CHECK_FAILED:
+               /* CURRENT ERROR */
+               buffer[0] = 0x70;
+               buffer[SPC_ADD_SENSE_LEN_OFFSET] = 10;
+               /* ILLEGAL REQUEST */
+               buffer[SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
+               /* LOGICAL BLOCK REFERENCE TAG CHECK FAILED */
+               buffer[SPC_ASC_KEY_OFFSET] = 0x10;
+               buffer[SPC_ASCQ_KEY_OFFSET] = 0x03;
+               break;
        case TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE:
        default:
                /* CURRENT ERROR */
index d98048b97fe3bc2bfaa1bc5dccb155a376b88f85..0336d70d0d9fbc3bec36322ed0bcd017a2e2ef96 100644 (file)
@@ -205,6 +205,9 @@ enum tcm_sense_reason_table {
        TCM_OUT_OF_RESOURCES                    = R(0x12),
        TCM_PARAMETER_LIST_LENGTH_ERROR         = R(0x13),
        TCM_MISCOMPARE_VERIFY                   = R(0x14),
+       TCM_LOGICAL_BLOCK_GUARD_CHECK_FAILED    = R(0x15),
+       TCM_LOGICAL_BLOCK_APP_TAG_CHECK_FAILED  = R(0x16),
+       TCM_LOGICAL_BLOCK_REF_TAG_CHECK_FAILED  = R(0x17),
 #undef R
 };