Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Dec 2021 10:37:11 GMT
From:      Ram Kishore Vegesna <ram@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 661875cecbf6 - stable/13 - ocs_fc: Increase maximum supported SG elements to support larger transfer sizes.
Message-ID:  <202112171037.1BHAbBa1092496@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by ram:

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

commit 661875cecbf6ed5894123cbd7c0ff217bea13370
Author:     Ram Kishore Vegesna <ram@FreeBSD.org>
AuthorDate: 2021-09-24 09:05:03 +0000
Commit:     Ram Kishore Vegesna <ram@FreeBSD.org>
CommitDate: 2021-12-17 10:31:05 +0000

    ocs_fc: Increase maximum supported SG elements to support larger transfer sizes.
    
    Reported by: ken@kdm.org
    Reviewed by: mav, ken
    
    (cherry picked from commit 322dbb8ce8f63fd6f542309fd38324664ce8dd3f)
---
 sys/dev/ocs_fc/ocs_cam.c    | 14 +++++++++-----
 sys/dev/ocs_fc/ocs_device.h |  2 +-
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/sys/dev/ocs_fc/ocs_cam.c b/sys/dev/ocs_fc/ocs_cam.c
index d3c275920c4b..53b53d1b696d 100644
--- a/sys/dev/ocs_fc/ocs_cam.c
+++ b/sys/dev/ocs_fc/ocs_cam.c
@@ -1704,7 +1704,7 @@ ocs_target_io(struct ocs_softc *ocs, union ccb *ccb)
 		rc = ocs_scsi_send_resp(io, 0, &resp, ocs_scsi_target_io_cb, ccb);
 
 	} else if (xferlen != 0) {
-		ocs_scsi_sgl_t sgl[OCS_FC_MAX_SGL];
+		ocs_scsi_sgl_t *sgl;
 		int32_t sgl_count = 0;
 
 		io->tgt_io.state = OCS_CAM_IO_DATA;
@@ -1712,7 +1712,9 @@ ocs_target_io(struct ocs_softc *ocs, union ccb *ccb)
 		if (sendstatus)
 			io->tgt_io.sendresp = 1;
 
-		sgl_count = ocs_build_scsi_sgl(ocs, ccb, io, sgl, ARRAY_SIZE(sgl));
+		sgl = io->sgl;
+
+		sgl_count = ocs_build_scsi_sgl(ocs, ccb, io, sgl, io->sgl_allocated);
 		if (sgl_count > 0) {
 			if (cam_dir == CAM_DIR_IN) {
 				rc = ocs_scsi_send_rd_data(io, 0, NULL, sgl,
@@ -1785,7 +1787,7 @@ ocs_initiator_io(struct ocs_softc *ocs, union ccb *ccb)
 	struct ccb_hdr *ccb_h = &csio->ccb_h;
 	ocs_node_t *node = NULL;
 	ocs_io_t *io = NULL;
-	ocs_scsi_sgl_t sgl[OCS_FC_MAX_SGL];
+	ocs_scsi_sgl_t *sgl;
 	int32_t flags, sgl_count;
 	ocs_fcport	*fcp;
 
@@ -1828,8 +1830,9 @@ ocs_initiator_io(struct ocs_softc *ocs, union ccb *ccb)
 
 	csio->ccb_h.ccb_ocs_ptr = ocs;
 	csio->ccb_h.ccb_io_ptr  = io;
+	sgl = io->sgl;
 
-	sgl_count = ocs_build_scsi_sgl(ocs, ccb, io, sgl, ARRAY_SIZE(sgl));
+	sgl_count = ocs_build_scsi_sgl(ocs, ccb, io, sgl, io->sgl_allocated);
 	if (sgl_count < 0) {
 		ocs_scsi_io_free(io);
 		device_printf(ocs->dev, "%s: building SGL failed\n", __func__);
@@ -2068,7 +2071,8 @@ ocs_action(struct cam_sim *sim, union ccb *ccb)
 
 		/* Calculate the max IO supported
 		 * Worst case would be an OS page per SGL entry */
-		cpi->maxio = PAGE_SIZE * 
+
+		cpi->maxio = PAGE_SIZE *
 			(ocs_scsi_get_property(ocs, OCS_SCSI_MAX_SGL) - 1);
 
 		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
diff --git a/sys/dev/ocs_fc/ocs_device.h b/sys/dev/ocs_fc/ocs_device.h
index f4c5baae0c54..b6d3a5d4897f 100644
--- a/sys/dev/ocs_fc/ocs_device.h
+++ b/sys/dev/ocs_fc/ocs_device.h
@@ -55,7 +55,7 @@
  * @brief Defines the number of SGLs allocated on each IO object
  */
 #ifndef OCS_FC_MAX_SGL
-#define OCS_FC_MAX_SGL		128
+#define OCS_FC_MAX_SGL		256
 #endif
 
 /***************************************************************************



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202112171037.1BHAbBa1092496>