At the SCSI transport level, there is no distinction between user data and protection information. Thus, iscsi header field "expected data transfer length" should include protection information. Patch #1 introduces scsi helper scsi_transfer_length which computes wire transfer byte count. Patch #2 modifies iscsi initiator to set correct wire transfer length in iscsi header data_length field (and modifies iser accordingly). Patch #3 modifies target core to re-calculate the pure data length in case of PI presence over the wire (and modifies loopback transport to align with other transports). Changes from v1: - scsi_cmnd: Rewrite scsi_transfer_length as MKP suggested - Target/sbc: re-calculate the data_length in case PI exists on the wire (instead od deacrease data -= prot) Changes from v0: - Introduce scsi helpers to compute correct transfer length in the presence of protection information. - Modify iscsi to set correct transfer length using scsi helpers - Modify loopback transport to set correct transfer length using scsi helpers Sagi Grimberg (3): scsi_cmnd: Introduce scsi_transfer_length helper libiscsi, iser: Adjust data_length to include protection information TARGET/sbc,loopback: Adjust command data length in case pi exists on the wire drivers/infiniband/ulp/iser/iser_initiator.c | 34 +++++++------------------ drivers/scsi/libiscsi.c | 18 +++++++------- drivers/target/loopback/tcm_loop.c | 15 +++++++++-- drivers/target/target_core_sbc.c | 15 ++++++++++- include/scsi/scsi_cmnd.h | 17 +++++++++++++ 5 files changed, 61 insertions(+), 38 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html