summaryrefslogtreecommitdiffstats
path: root/sys/dev/mps/mps_sas.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/mps/mps_sas.c')
-rw-r--r--sys/dev/mps/mps_sas.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/sys/dev/mps/mps_sas.c b/sys/dev/mps/mps_sas.c
index 6a34c38..2f23612 100644
--- a/sys/dev/mps/mps_sas.c
+++ b/sys/dev/mps/mps_sas.c
@@ -928,6 +928,8 @@ mpssas_action(struct cam_sim *sim, union ccb *ccb)
case XPT_PATH_INQ:
{
struct ccb_pathinq *cpi = &ccb->cpi;
+ struct mps_softc *sc = sassc->sc;
+ uint8_t sges_per_frame;
cpi->version_num = 1;
cpi->hba_inquiry = PI_SDTR_ABLE|PI_TAG_ABLE|PI_WIDE_16;
@@ -951,12 +953,23 @@ mpssas_action(struct cam_sim *sim, union ccb *ccb)
cpi->transport_version = 0;
cpi->protocol = PROTO_SCSI;
cpi->protocol_version = SCSI_REV_SPC;
-#if __FreeBSD_version >= 800001
+
/*
- * XXX KDM where does this number come from?
+ * Max IO Size is Page Size * the following:
+ * ((SGEs per frame - 1 for chain element) *
+ * Max Chain Depth) + 1 for no chain needed in last frame
+ *
+ * If user suggests a Max IO size to use, use the smaller of the
+ * user's value and the calculated value as long as the user's
+ * value is larger than 0. The user's value is in pages.
*/
- cpi->maxio = 256 * 1024;
-#endif
+ sges_per_frame = ((sc->facts->IOCRequestFrameSize * 4) /
+ sizeof(MPI2_SGE_SIMPLE64)) - 1;
+ cpi->maxio = (sges_per_frame * sc->facts->MaxChainDepth) + 1;
+ cpi->maxio *= PAGE_SIZE;
+ if ((sc->max_io_pages > 0) && (sc->max_io_pages * PAGE_SIZE <
+ cpi->maxio))
+ cpi->maxio = sc->max_io_pages * PAGE_SIZE;
mpssas_set_ccbstatus(ccb, CAM_REQ_CMP);
break;
}
OpenPOWER on IntegriCloud