mpt(4): Remove incorrect S/G segments limits.

First, two of those four checks are unreachable.
Second, I don't believe there should be ">=" instead of ">".
Third, bus_dma(9) already returns the same EFBIG if ">".

This fixes false I/O errors in worst S/G cases with maxphys >= 2MB.

MFC after:	1 week
This commit is contained in:
Alexander Motin 2021-04-17 10:41:35 -04:00
parent b51f459a20
commit 0f29396e49

View File

@ -1292,10 +1292,6 @@ mpt_execute_req_a64(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error)
hdrp = req->req_vbuf;
mpt_off = req->req_vbuf;
if (error == 0 && ((uint32_t)nseg) >= mpt->max_seg_cnt) {
error = EFBIG;
}
if (error == 0) {
switch (hdrp->Function) {
case MPI_FUNCTION_SCSI_IO_REQUEST:
@ -1315,12 +1311,6 @@ mpt_execute_req_a64(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error)
}
}
if (error == 0 && ((uint32_t)nseg) >= mpt->max_seg_cnt) {
error = EFBIG;
mpt_prt(mpt, "segment count %d too large (max %u)\n",
nseg, mpt->max_seg_cnt);
}
bad:
if (error != 0) {
if (error != EFBIG && error != ENOMEM) {
@ -1694,10 +1684,6 @@ mpt_execute_req(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error)
hdrp = req->req_vbuf;
mpt_off = req->req_vbuf;
if (error == 0 && ((uint32_t)nseg) >= mpt->max_seg_cnt) {
error = EFBIG;
}
if (error == 0) {
switch (hdrp->Function) {
case MPI_FUNCTION_SCSI_IO_REQUEST:
@ -1716,12 +1702,6 @@ mpt_execute_req(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error)
}
}
if (error == 0 && ((uint32_t)nseg) >= mpt->max_seg_cnt) {
error = EFBIG;
mpt_prt(mpt, "segment count %d too large (max %u)\n",
nseg, mpt->max_seg_cnt);
}
bad:
if (error != 0) {
if (error != EFBIG && error != ENOMEM) {