git: 74575d14284f - main - ciss: Add sysctl/tunable hw.ciss and hw.ciss.base_transfer_speed

From: Warner Losh <imp_at_FreeBSD.org>
Date: Mon, 14 Oct 2024 05:40:52 UTC
The branch main has been updated by imp:

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

commit 74575d14284fde2c7617ad14fd9a8bac897b4427
Author:     Peter Eriksson <pen@lysator.liu.se>
AuthorDate: 2024-10-14 04:01:33 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-10-14 05:23:08 +0000

    ciss: Add sysctl/tunable hw.ciss and hw.ciss.base_transfer_speed
    
    Add a sysctl/tuneable to report a different base transfer speed than the
    default of 132*1024.
    
    PR: 246279
    Reviewed by: imp
    Tested by: Marek Zarychta
    Differential Revision: https://reviews.freebsd.org/D25155
---
 sys/dev/ciss/ciss.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/sys/dev/ciss/ciss.c b/sys/dev/ciss/ciss.c
index 866e67766818..06c7ed5f3318 100644
--- a/sys/dev/ciss/ciss.c
+++ b/sys/dev/ciss/ciss.c
@@ -242,6 +242,16 @@ static struct cdevsw ciss_cdevsw = {
 	.d_name =	"ciss",
 };
 
+SYSCTL_NODE(_hw, OID_AUTO, ciss, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "CISS sysctl tunables");
+
+/*
+ * This tunable can be used to force a specific value for transfer speed.
+ */
+static int ciss_base_transfer_speed = 132 * 1024;
+SYSCTL_INT(_hw_ciss, OID_AUTO, base_transfer_speed, CTLFLAG_RDTUN,
+	   &ciss_base_transfer_speed, 0,
+	   "force a specific base transfer_speed");
+
 /*
  * This tunable can be set at boot time and controls whether physical devices
  * that are marked hidden by the firmware should be exposed anyways.
@@ -3029,7 +3039,7 @@ ciss_cam_action(struct cam_sim *sim, union ccb *ccb)
 	strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 	cpi->unit_number = cam_sim_unit(sim);
 	cpi->bus_id = cam_sim_bus(sim);
-	cpi->base_transfer_speed = 132 * 1024;	/* XXX what to set this to? */
+	cpi->base_transfer_speed = ciss_base_transfer_speed;
 	cpi->transport = XPORT_SPI;
 	cpi->transport_version = 2;
 	cpi->protocol = PROTO_SCSI;