Skip to content

Commit 61a9f25

Browse files
scsi: mpt3sas: Fix reference tag handling for WRITE_INSERT
Testing revealed a problem with how the reference tag was handled for a WRITE_INSERT operation. The SCSI_PROT_REF_CHECK flag is not set when the controller is asked to generate the protection information (i.e. not DIX). And as a result the initial reference tag would not be set in the WRITE_INSERT case. Separate handling of the REF_CHECK and REF_INCREMENT flags to align with both the DIX spec and the MPI implementation. Link: https://lore.kernel.org/r/[email protected] Fixes: b3e2c72 ("scsi: mpt3sas: Use the proper SCSI midlayer interfaces for PI") Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 282da7c commit 61a9f25

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

drivers/scsi/mpt3sas/mpt3sas_scsih.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5065,9 +5065,12 @@ _scsih_setup_eedp(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd,
50655065
if (scmd->prot_flags & SCSI_PROT_GUARD_CHECK)
50665066
eedp_flags |= MPI2_SCSIIO_EEDPFLAGS_CHECK_GUARD;
50675067

5068-
if (scmd->prot_flags & SCSI_PROT_REF_CHECK) {
5069-
eedp_flags |= MPI2_SCSIIO_EEDPFLAGS_INC_PRI_REFTAG |
5070-
MPI2_SCSIIO_EEDPFLAGS_CHECK_REFTAG;
5068+
if (scmd->prot_flags & SCSI_PROT_REF_CHECK)
5069+
eedp_flags |= MPI2_SCSIIO_EEDPFLAGS_CHECK_REFTAG;
5070+
5071+
if (scmd->prot_flags & SCSI_PROT_REF_INCREMENT) {
5072+
eedp_flags |= MPI2_SCSIIO_EEDPFLAGS_INC_PRI_REFTAG;
5073+
50715074
mpi_request->CDB.EEDP32.PrimaryReferenceTag =
50725075
cpu_to_be32(scsi_prot_ref_tag(scmd));
50735076
}

0 commit comments

Comments
 (0)