Skip to content

Commit b3e2c72

Browse files
scsi: mpt3sas: Use the proper SCSI midlayer interfaces for PI
Use the SCSI midlayer interfaces to query protection interval, reference tag, and per-command DIX flags. Link: https://lore.kernel.org/r/[email protected] Cc: Sreekanth Reddy <[email protected]> Cc: Kashyap Desai <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 125c12f commit b3e2c72

File tree

1 file changed

+13
-30
lines changed

1 file changed

+13
-30
lines changed

drivers/scsi/mpt3sas/mpt3sas_scsih.c

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5048,48 +5048,31 @@ _scsih_setup_eedp(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd,
50485048
Mpi25SCSIIORequest_t *mpi_request)
50495049
{
50505050
u16 eedp_flags;
5051-
unsigned char prot_op = scsi_get_prot_op(scmd);
5052-
unsigned char prot_type = scsi_get_prot_type(scmd);
50535051
Mpi25SCSIIORequest_t *mpi_request_3v =
50545052
(Mpi25SCSIIORequest_t *)mpi_request;
50555053

5056-
if (prot_type == SCSI_PROT_DIF_TYPE0 || prot_op == SCSI_PROT_NORMAL)
5057-
return;
5058-
5059-
if (prot_op == SCSI_PROT_READ_STRIP)
5054+
switch (scsi_get_prot_op(scmd)) {
5055+
case SCSI_PROT_READ_STRIP:
50605056
eedp_flags = MPI2_SCSIIO_EEDPFLAGS_CHECK_REMOVE_OP;
5061-
else if (prot_op == SCSI_PROT_WRITE_INSERT)
5057+
break;
5058+
case SCSI_PROT_WRITE_INSERT:
50625059
eedp_flags = MPI2_SCSIIO_EEDPFLAGS_INSERT_OP;
5063-
else
5060+
break;
5061+
default:
50645062
return;
5063+
}
50655064

5066-
switch (prot_type) {
5067-
case SCSI_PROT_DIF_TYPE1:
5068-
case SCSI_PROT_DIF_TYPE2:
5065+
if (scmd->prot_flags & SCSI_PROT_GUARD_CHECK)
5066+
eedp_flags |= MPI2_SCSIIO_EEDPFLAGS_CHECK_GUARD;
50695067

5070-
/*
5071-
* enable ref/guard checking
5072-
* auto increment ref tag
5073-
*/
5068+
if (scmd->prot_flags & SCSI_PROT_REF_CHECK) {
50745069
eedp_flags |= MPI2_SCSIIO_EEDPFLAGS_INC_PRI_REFTAG |
5075-
MPI2_SCSIIO_EEDPFLAGS_CHECK_REFTAG |
5076-
MPI2_SCSIIO_EEDPFLAGS_CHECK_GUARD;
5070+
MPI2_SCSIIO_EEDPFLAGS_CHECK_REFTAG;
50775071
mpi_request->CDB.EEDP32.PrimaryReferenceTag =
5078-
cpu_to_be32(t10_pi_ref_tag(scsi_cmd_to_rq(scmd)));
5079-
break;
5080-
5081-
case SCSI_PROT_DIF_TYPE3:
5082-
5083-
/*
5084-
* enable guard checking
5085-
*/
5086-
eedp_flags |= MPI2_SCSIIO_EEDPFLAGS_CHECK_GUARD;
5087-
5088-
break;
5072+
cpu_to_be32(scsi_prot_ref_tag(scmd));
50895073
}
50905074

5091-
mpi_request_3v->EEDPBlockSize =
5092-
cpu_to_le16(scmd->device->sector_size);
5075+
mpi_request_3v->EEDPBlockSize = cpu_to_le16(scsi_prot_interval(scmd));
50935076

50945077
if (ioc->is_gen35_ioc)
50955078
eedp_flags |= MPI25_SCSIIO_EEDPFLAGS_APPTAG_DISABLE_MODE;

0 commit comments

Comments
 (0)