b37f23
From cf10a0af2c72e9972fa436aa6c2420a00ac69e46 Mon Sep 17 00:00:00 2001
b37f23
From: Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>
b37f23
Date: Wed, 26 Oct 2016 13:34:39 +0530
b37f23
Subject: [PATCH 08/11] scsi: mpt3sas: set EEDP-escape-flags for SAS35 devices.
b37f23
b37f23
An UNMAP command on a PI formatted device will leave the Logical Block
b37f23
Application Tag and Logical Block Reference Tag as all F's (for those LBAs
b37f23
that are unmapped). To avoid IO errors if those LBAs are subsequently read
b37f23
before they are written with valid tag fields, the MPI SCSI IO requests
b37f23
need to set the EEDPFlags element EEDP Escape Mode field, Bits [7:6]
b37f23
appropriately. A value of 2 should be set to disable all PI checks if the
b37f23
Logical Block Application Tag is 0xFFFF for PI types 1 and 2.  A value
b37f23
of 3 should be set to disable all PI checks if the Logical Block
b37f23
Application Tag is 0xFFFF and the Logical Block Reference Tag is
b37f23
0xFFFFFFFF for PI type 3.
b37f23
b37f23
Signed-off-by: Chaitra P B <chaitra.basappa@broadcom.com>
b37f23
Signed-off-by: Sathya Prakash <sathya.prakash@broadcom.com>
b37f23
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
b37f23
Reviewed-by: Hannes Reinecke <hare@suse.com>
b37f23
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
b37f23
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
b37f23
---
b37f23
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 3 +++
b37f23
 1 file changed, 3 insertions(+)
b37f23
b37f23
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
b37f23
index 980c69d..0ff2ed3 100644
b37f23
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
b37f23
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
b37f23
@@ -4040,6 +4040,9 @@ _scsih_setup_eedp(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd,
b37f23
 
b37f23
 	mpi_request_3v->EEDPBlockSize =
b37f23
 	    cpu_to_le16(scmd->device->sector_size);
b37f23
+
b37f23
+	if (ioc->is_gen35_ioc)
b37f23
+		eedp_flags |= MPI25_SCSIIO_EEDPFLAGS_APPTAG_DISABLE_MODE;
b37f23
 	mpi_request->EEDPFlags = cpu_to_le16(eedp_flags);
b37f23
 }
b37f23
 
b37f23
-- 
b37f23
1.8.3.1
b37f23