Fix TLR (Transport Layer Retry) support in the mps(4) and mpr(4) drivers.

TLR is necessary for reliable communication with SAS tape drives.

This was broken by change 246713 in the mps(4) driver.  It changed the
cm_data field for SCSI I/O requests to point to the CCB instead of the data
buffer.  So, instead, look at the CCB's data pointer to determine whether
or not we're talking to a tape drive.

Also, take the residual into account to make sure that we don't go off the
end of the request.

MFC after:	3 days
Sponsored by:	Spectra Logic Corporation
This commit is contained in:
ken 2014-05-08 20:28:22 +00:00
parent cf9c121b0f
commit c75ba560d7
2 changed files with 8 additions and 4 deletions

View File

@ -2355,8 +2355,9 @@ mprsas_scsiio_complete(struct mpr_softc *sc, struct mpr_command *cm)
(csio->cdb_io.cdb_bytes[1] & SI_EVPD) &&
(csio->cdb_io.cdb_bytes[2] == SVPD_SUPPORTED_PAGE_LIST) &&
((csio->ccb_h.flags & CAM_DATA_MASK) == CAM_DATA_VADDR) &&
(csio->data_ptr != NULL) && (((uint8_t *)cm->cm_data)[0] ==
T_SEQUENTIAL) && (sc->control_TLR) &&
(csio->data_ptr != NULL) &&
((csio->data_ptr[0] & 0x1f) == T_SEQUENTIAL) &&
(sc->control_TLR) &&
(sc->mapping_table[csio->ccb_h.target_id].device_info &
MPI2_SAS_DEVICE_INFO_SSP_TARGET)) {
vpd_list = (struct scsi_vpd_supported_page_list *)
@ -2367,6 +2368,7 @@ mprsas_scsiio_complete(struct mpr_softc *sc, struct mpr_command *cm)
TLR_on = (u8)MPI2_SCSIIO_CONTROL_TLR_ON;
alloc_len = ((u16)csio->cdb_io.cdb_bytes[3] << 8) +
csio->cdb_io.cdb_bytes[4];
alloc_len -= csio->resid;
for (i = 0; i < MIN(vpd_list->length, alloc_len); i++) {
if (vpd_list->list[i] == 0x90) {
*TLR_bits = TLR_on;

View File

@ -2316,8 +2316,9 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm)
(csio->cdb_io.cdb_bytes[1] & SI_EVPD) &&
(csio->cdb_io.cdb_bytes[2] == SVPD_SUPPORTED_PAGE_LIST) &&
((csio->ccb_h.flags & CAM_DATA_MASK) == CAM_DATA_VADDR) &&
(csio->data_ptr != NULL) && (((uint8_t *)cm->cm_data)[0] ==
T_SEQUENTIAL) && (sc->control_TLR) &&
(csio->data_ptr != NULL) &&
((csio->data_ptr[0] & 0x1f) == T_SEQUENTIAL) &&
(sc->control_TLR) &&
(sc->mapping_table[csio->ccb_h.target_id].device_info &
MPI2_SAS_DEVICE_INFO_SSP_TARGET)) {
vpd_list = (struct scsi_vpd_supported_page_list *)
@ -2328,6 +2329,7 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm)
TLR_on = (u8)MPI2_SCSIIO_CONTROL_TLR_ON;
alloc_len = ((u16)csio->cdb_io.cdb_bytes[3] << 8) +
csio->cdb_io.cdb_bytes[4];
alloc_len -= csio->resid;
for (i = 0; i < MIN(vpd_list->length, alloc_len); i++) {
if (vpd_list->list[i] == 0x90) {
*TLR_bits = TLR_on;