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