git: f51c1d1dd595 - stable/13 - pvscsi: Advertise maxio of 256k.

From: Alexander Motin <mav_at_FreeBSD.org>
Date: Wed, 19 Oct 2022 18:05:59 UTC
The branch stable/13 has been updated by mav:

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

commit f51c1d1dd595ce51059489d7e1248ff6ba39664a
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2021-04-21 18:10:42 +0000
Commit:     Alexander Motin <mav@FreeBSD.org>
CommitDate: 2022-10-19 17:47:45 +0000

    pvscsi: Advertise maxio of 256k.
    
    While the PV SCSI SG list can handle 512k of SG entries, it can only do
    so for I/O that's aligned to 4k or better. newfs_msdos does unaligned
    I/O, so triggers too long for host errors in cam when a 512k I/O is
    attempted. Prefer power of 2 256k to the absolute maximum 508k, though
    that can be revisited should the latter show to give significant
    performance improvement.
    
    MFC After:              3 days
    Tested by:              darius on discord (508k version of patch)
    Sponsored by:           Netflix
    
    (cherry picked from commit 9a5a5c1576b4ce308a97e0bce887261701ae3edc)
---
 sys/dev/vmware/pvscsi/pvscsi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/dev/vmware/pvscsi/pvscsi.c b/sys/dev/vmware/pvscsi/pvscsi.c
index 3ca905313897..ad32d2ab4959 100644
--- a/sys/dev/vmware/pvscsi/pvscsi.c
+++ b/sys/dev/vmware/pvscsi/pvscsi.c
@@ -1423,7 +1423,8 @@ finish_ccb:
 		strlcpy(cpi->sim_vid, "VMware", SIM_IDLEN);
 		strlcpy(cpi->hba_vid, "VMware", HBA_IDLEN);
 		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
-		cpi->maxio = PVSCSI_MAX_SG_ENTRIES_PER_SEGMENT * PAGE_SIZE;
+		/* Limit I/O to 256k since we can't do 512k unaligned I/O */
+		cpi->maxio = (PVSCSI_MAX_SG_ENTRIES_PER_SEGMENT / 2) * PAGE_SIZE;
 		cpi->protocol = PROTO_SCSI;
 		cpi->protocol_version = SCSI_REV_SPC2;
 		cpi->transport = XPORT_SAS;