git: b62d492067ba - releng/13.0 - pms(4): Limit maximum I/O size to 256KB instead of 1MB.

Mark Johnston markj at FreeBSD.org
Wed May 26 20:37:46 UTC 2021


The branch releng/13.0 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=b62d492067ba38b93200e77bca69e89a9e887eb4

commit b62d492067ba38b93200e77bca69e89a9e887eb4
Author:     Alexander Motin <mav at FreeBSD.org>
AuthorDate: 2021-04-16 19:39:01 +0000
Commit:     Mark Johnston <markj at FreeBSD.org>
CommitDate: 2021-05-26 19:30:23 +0000

    pms(4): Limit maximum I/O size to 256KB instead of 1MB.
    
    There is a weird limit of AGTIAPI_MAX_DMA_SEGS (128) S/G segments per
    I/O since the initial driver import.  I don't know why it was added,
    can only guess some hardware limitation, but in worst case it means
    maximum I/O size of 508KB.  Respect it to be safe, rounding to 256KB.
    
    Approved by:    so
    Security:       EN-21:14.pms
    MFC after:      1 week
    Sponsored by:   iXsystems, Inc.
    
    (cherry picked from commit 3e347834200b5d91a33384e696793e4ac20a44d4)
    (cherry picked from commit 6514cb18d94e9ab46406b7077d207c8b1a551e6e)
---
 sys/dev/pms/freebsd/driver/ini/src/agdef.h   | 2 +-
 sys/dev/pms/freebsd/driver/ini/src/agtiapi.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/dev/pms/freebsd/driver/ini/src/agdef.h b/sys/dev/pms/freebsd/driver/ini/src/agdef.h
index 4c2ba2867f5f..b58741a434c7 100644
--- a/sys/dev/pms/freebsd/driver/ini/src/agdef.h
+++ b/sys/dev/pms/freebsd/driver/ini/src/agdef.h
@@ -62,7 +62,7 @@ EW     09-17-2004     1.0.0     Constant definitions
 #define AGTIAPI_MAX_DEVICE_7H       256 /*Max devices per channel in 7H */
 #define AGTIAPI_MAX_DEVICE_8H       512 /*Max devices per channel in 8H*/
 #define AGTIAPI_MAX_CAM_Q_DEPTH     1024
-#define AGTIAPI_NSEGS               (btoc(maxphys) + 1)
+#define AGTIAPI_NSEGS               (MIN(btoc(maxphys), 64) + 1)
 /*
 ** Adapter specific defines 
 */
diff --git a/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c b/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c
index 4ce32d0ce6c0..a2b20c9e9264 100644
--- a/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c
+++ b/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c
@@ -1834,7 +1834,7 @@ static void agtiapi_cam_action( struct cam_sim *sim, union ccb * ccb )
     cpi->max_target = maxTargets - 1;
     cpi->max_lun = AGTIAPI_MAX_LUN;
     /* Max supported I/O size, in bytes. */
-    cpi->maxio = ulmin(1024 * 1024, maxphys);
+    cpi->maxio = ctob(AGTIAPI_NSEGS - 1);
     cpi->initiator_id = 255;
     strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
     strlcpy(cpi->hba_vid, "PMC", HBA_IDLEN);


More information about the dev-commits-src-all mailing list