132562145SEdward Tomasz Napierala.\" Copyright (c) 2013 Edward Tomasz Napierala 2277681e1SAlexander Motin.\" Copyright (c) 2015-2017 Alexander Motin <mav@FreeBSD.org> 332562145SEdward Tomasz Napierala.\" All rights reserved. 432562145SEdward Tomasz Napierala.\" 532562145SEdward Tomasz Napierala.\" Redistribution and use in source and binary forms, with or without 632562145SEdward Tomasz Napierala.\" modification, are permitted provided that the following conditions 732562145SEdward Tomasz Napierala.\" are met: 832562145SEdward Tomasz Napierala.\" 1. Redistributions of source code must retain the above copyright 932562145SEdward Tomasz Napierala.\" notice, this list of conditions and the following disclaimer. 1032562145SEdward Tomasz Napierala.\" 2. Redistributions in binary form must reproduce the above copyright 1132562145SEdward Tomasz Napierala.\" notice, this list of conditions and the following disclaimer in the 1232562145SEdward Tomasz Napierala.\" documentation and/or other materials provided with the distribution. 1332562145SEdward Tomasz Napierala.\" 1432562145SEdward Tomasz Napierala.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1532562145SEdward Tomasz Napierala.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1632562145SEdward Tomasz Napierala.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1732562145SEdward Tomasz Napierala.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1832562145SEdward Tomasz Napierala.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1932562145SEdward Tomasz Napierala.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2032562145SEdward Tomasz Napierala.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2132562145SEdward Tomasz Napierala.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2232562145SEdward Tomasz Napierala.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2332562145SEdward Tomasz Napierala.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2432562145SEdward Tomasz Napierala.\" SUCH DAMAGE. 25653e7d63SEnji Cooper.Dd March 29, 2017 2632562145SEdward Tomasz Napierala.Dt CTL 4 2732562145SEdward Tomasz Napierala.Os 2832562145SEdward Tomasz Napierala.Sh NAME 2932562145SEdward Tomasz Napierala.Nm ctl 30653e7d63SEnji Cooper.Nd CAM Target Layer 3132562145SEdward Tomasz Napierala.Sh SYNOPSIS 322b665a98SAlexander MotinTo compile this driver into the kernel, 332b665a98SAlexander Motinplace the following line in your 3432562145SEdward Tomasz Napieralakernel configuration file: 3532562145SEdward Tomasz Napierala.Bd -ragged -offset indent 3632562145SEdward Tomasz Napierala.Cd "device ctl" 3732562145SEdward Tomasz Napierala.Ed 3832562145SEdward Tomasz Napierala.Pp 3932562145SEdward Tomasz NapieralaAlternatively, to load the driver as a 4032562145SEdward Tomasz Napieralamodule at boot time, place the following line in 4132562145SEdward Tomasz Napierala.Xr loader.conf 5 : 4232562145SEdward Tomasz Napierala.Bd -literal -offset indent 4332562145SEdward Tomasz Napieralactl_load="YES" 4432562145SEdward Tomasz Napierala.Ed 4532562145SEdward Tomasz Napierala.Sh DESCRIPTION 4632562145SEdward Tomasz NapieralaThe 4732562145SEdward Tomasz Napierala.Nm 482b665a98SAlexander Motinsubsystem provides SCSI target devices emulation. 4932562145SEdward Tomasz NapieralaIt supports features such as: 5032562145SEdward Tomasz Napierala.Pp 5132562145SEdward Tomasz Napierala.Bl -bullet -compact 5232562145SEdward Tomasz Napierala.It 532b665a98SAlexander MotinDisk, CD-ROM and processor device emulation 5432562145SEdward Tomasz Napierala.It 552b665a98SAlexander MotinTagged queueing 5632562145SEdward Tomasz Napierala.It 5732562145SEdward Tomasz NapieralaSCSI task attribute support (ordered, head of queue, simple tags) 5832562145SEdward Tomasz Napierala.It 599d66b6a5SEdward Tomasz NapieralaSCSI implicit command ordering support 6032562145SEdward Tomasz Napierala.It 61277681e1SAlexander MotinFull task management support (abort, query, reset, etc.) 6232562145SEdward Tomasz Napierala.It 63277681e1SAlexander MotinSupport for multiple ports, initiators, targets and backing stores 6432562145SEdward Tomasz Napierala.It 65277681e1SAlexander MotinSupport for VMWare VAAI and Microsoft ODX offload (COMPARE AND WRITE, 66277681e1SAlexander MotinXCOPY, POPULATE TOKEN/WRITE USING TOKEN, WRITE SAME and UNMAP) 679d66b6a5SEdward Tomasz Napierala.It 6832562145SEdward Tomasz NapieralaPersistent reservation support 6932562145SEdward Tomasz Napierala.It 70277681e1SAlexander MotinExtensive VPD/mode/log pages support 7132562145SEdward Tomasz Napierala.It 72277681e1SAlexander MotinFeatured error reporting, error injection and basic SMART support 7332562145SEdward Tomasz Napierala.It 74d36c6176SAlexander MotinHigh Availability clustering support with ALUA 75d36c6176SAlexander Motin.It 7632562145SEdward Tomasz NapieralaAll I/O handled in-kernel, no userland context switch overhead 7732562145SEdward Tomasz Napierala.El 78009ea47eSEdward Tomasz Napierala.Pp 79277681e1SAlexander MotinThe 80277681e1SAlexander Motin.Nm 81277681e1SAlexander Motinsubsystem includes multiple frontends to provide access using different 82277681e1SAlexander Motintransport protocols and implementations: 83277681e1SAlexander Motin.Bl -tag -width cfumass 84277681e1SAlexander Motin.It camsim 85277681e1SAlexander MotinProvides access for local system via virtual initiator mode 86277681e1SAlexander Motin.Xr CAM 4 87277681e1SAlexander MotinSIM. 88277681e1SAlexander Motin.It camtgt 89277681e1SAlexander MotinProvides access for remote systems via target mode 90277681e1SAlexander Motin.Xr CAM 4 91277681e1SAlexander MotinSIMs, such as Fibre Channel 92277681e1SAlexander Motin.Xr isp 4 93277681e1SAlexander Motinand 94277681e1SAlexander Motin.Xr mpt 4 . 95277681e1SAlexander Motin.It cfumass 96277681e1SAlexander MotinProvides access for remote systems via USB Mass Storage Class 97277681e1SAlexander MotinBulk Only (BBB) Transport. 98277681e1SAlexander Motin.It ha 99277681e1SAlexander MotinInternal frontend used to receive requests from other node ports in 100277681e1SAlexander MotinHigh Availability cluster. 101277681e1SAlexander Motin.It ioctl 102277681e1SAlexander MotinProvides access for local user-level applications via 103277681e1SAlexander Motin.Xr ioctl 2 104277681e1SAlexander Motinbased API. 105277681e1SAlexander Motin.It iscsi 106653e7d63SEnji CooperProvides access for remote systems via the iSCSI protocol using 107653e7d63SEnji Cooper.Xr cfiscsi 4 . 108277681e1SAlexander Motin.It tpc 109277681e1SAlexander MotinInternal frontend used to receive requests from Third Party Copy engine, 110277681e1SAlexander Motinimplementing copy offload operations. 111277681e1SAlexander Motin.El 112277681e1SAlexander Motin.Pp 113277681e1SAlexander MotinThe 114277681e1SAlexander Motin.Nm 115277681e1SAlexander Motinsubsystem includes two backends to create logical units using different 116277681e1SAlexander Motinkinds of backing stores: 117277681e1SAlexander Motin.Bl -tag -width ramdisk 118277681e1SAlexander Motin.It block 1192b665a98SAlexander MotinStores data in ZFS ZVOLs, files or raw block devices. 120277681e1SAlexander Motin.It ramdisk 121277681e1SAlexander MotinStores data in RAM, that makes it mostly useful for performance testing. 122277681e1SAlexander MotinDepending on configured capacity can work as black hole, thin or thick 123277681e1SAlexander Motinprovisioned disk. 124277681e1SAlexander Motin.El 1253723b8bfSEdward Tomasz Napierala.Sh SYSCTL VARIABLES 1263723b8bfSEdward Tomasz NapieralaThe following variables are available as both 1273723b8bfSEdward Tomasz Napierala.Xr sysctl 8 1283723b8bfSEdward Tomasz Napieralavariables and 1293723b8bfSEdward Tomasz Napierala.Xr loader 8 1303723b8bfSEdward Tomasz Napieralatunables: 1313723b8bfSEdward Tomasz Napierala.Bl -tag -width indent 132ff7b06dbSAlexander Motin.It Va kern.cam.ctl.debug 133ff7b06dbSAlexander MotinBit mask of enabled CTL log levels: 134ff7b06dbSAlexander Motin.Bl -tag -offset indent -compact 135ff7b06dbSAlexander Motin.It 1 136ff7b06dbSAlexander Motinlog commands with errors; 137ff7b06dbSAlexander Motin.It 2 138ff7b06dbSAlexander Motinlog all commands; 139ff7b06dbSAlexander Motin.It 4 140d36c6176SAlexander Motinlog data for commands other then READ/WRITE. 141ff7b06dbSAlexander Motin.El 142ff7b06dbSAlexander MotinDefaults to 0. 143d36c6176SAlexander Motin.It Va kern.cam.ctl.ha_id 144d36c6176SAlexander MotinSpecifies unique position of this node within High Availability cluster. 145d36c6176SAlexander MotinDefault is 0 -- no HA, 1 and 2 -- HA enabled at specified position. 146d36c6176SAlexander Motin.It Va kern.cam.ctl.ha_mode 147d36c6176SAlexander MotinSpecifies High Availability cluster operation mode: 148d36c6176SAlexander Motin.Bl -tag -offset indent -compact 149d36c6176SAlexander Motin.It 0 150d36c6176SAlexander MotinActive/Standby -- primary node has backend access and processes requests, 151d36c6176SAlexander Motinwhile secondary can only do basic LUN discovery and reservation; 152d36c6176SAlexander Motin.It 1 153d36c6176SAlexander MotinActive/Active -- both nodes have backend access and process requests, 154d36c6176SAlexander Motinwhile secondary node synchronizes processing with primary one; 155d36c6176SAlexander Motin.It 2 156d36c6176SAlexander MotinActive/Active -- primary node has backend access and processes requests, 157d36c6176SAlexander Motinwhile secondary node forwards all requests and data to primary one; 158d36c6176SAlexander Motin.El 159d36c6176SAlexander MotinAll above modes require established connection between HA cluster nodes. 160d36c6176SAlexander MotinIf connection is not configured, secondary node will report Unavailable 161d36c6176SAlexander Motinstate; if configured but not established -- Transitioning state. 162d36c6176SAlexander MotinDefaults to 0. 163d36c6176SAlexander Motin.It Va kern.cam.ctl.ha_peer 164d36c6176SAlexander MotinString value, specifying method to establish connection to peer HA node. 165d36c6176SAlexander MotinCan be "listen IP:port", "connect IP:port" or empty. 166d36c6176SAlexander Motin.It Va kern.cam.ctl.ha_link 167d36c6176SAlexander MotinReports present state of connection between HA cluster nodes: 168d36c6176SAlexander Motin.Bl -tag -offset indent -compact 169d36c6176SAlexander Motin.It 0 170d36c6176SAlexander Motinnot configured; 171d36c6176SAlexander Motin.It 1 172d36c6176SAlexander Motinconfigured but not established; 173d36c6176SAlexander Motin.It 2 174d36c6176SAlexander Motinestablished. 175d36c6176SAlexander Motin.El 176d36c6176SAlexander Motin.It Va kern.cam.ctl.ha_role 177d36c6176SAlexander MotinSpecifies default role of this node: 178d36c6176SAlexander Motin.Bl -tag -offset indent -compact 179d36c6176SAlexander Motin.It 0 180d36c6176SAlexander Motinprimary; 181d36c6176SAlexander Motin.It 1 182d36c6176SAlexander Motinsecondary. 183d36c6176SAlexander Motin.El 1842b665a98SAlexander MotinThis role can be overridden on per-LUN basis using "ha_role" LUN option, 185d36c6176SAlexander Motinso that for one LUN one node is primary, while for another -- another. 186d36c6176SAlexander MotinRole change from primary to secondary for HA modes 0 and 2 closes backends, 187d36c6176SAlexander Motinthe opposite change -- opens. 188d36c6176SAlexander MotinIf there is no primary node (both nodes are secondary, or secondary node has 189d36c6176SAlexander Motinno connection to primary one), secondary node(s) report Transitioning state. 190d36c6176SAlexander MotinState with two primary nodes is illegal (split brain condition). 191548afe2bSChristian Brueffer.El 192530fdf67SEmmanuel Vadot.Sh TUNABLE VARIABLES 193530fdf67SEmmanuel VadotThe following variables are available as 194530fdf67SEmmanuel Vadot.Xr loader 8 195530fdf67SEmmanuel Vadottunables: 196530fdf67SEmmanuel Vadot.Bl -tag -width indent 197530fdf67SEmmanuel Vadot.It Va kern.cam.ctl.max_luns 1988c9e0919SEmmanuel VadotSpecifies the maximum number of LUNs we support, must be a power of 2. 1998c9e0919SEmmanuel VadotThe default value is 1024. 200530fdf67SEmmanuel Vadot.It Va kern.cam.ctl.max_ports 2018c9e0919SEmmanuel VadotSpecifies the maximum number of ports we support, must be a power of 2. 202*0acc026dSAlexander MotinThe default value is 1024. 2031adc28f5SChristian Brueffer.El 20432562145SEdward Tomasz Napierala.Sh SEE ALSO 205653e7d63SEnji Cooper.Xr cfiscsi 4 , 206cc5bbcb2SEdward Tomasz Napierala.Xr cfumass 4 , 20732562145SEdward Tomasz Napierala.Xr ctladm 8 , 208009ea47eSEdward Tomasz Napierala.Xr ctld 8 , 20932562145SEdward Tomasz Napierala.Xr ctlstat 8 21032562145SEdward Tomasz Napierala.Sh HISTORY 21132562145SEdward Tomasz NapieralaThe 21232562145SEdward Tomasz Napierala.Nm 21332562145SEdward Tomasz Napieralasubsystem first appeared in 21432562145SEdward Tomasz Napierala.Fx 9.1 . 21532562145SEdward Tomasz Napierala.Sh AUTHORS 21632562145SEdward Tomasz NapieralaThe 21732562145SEdward Tomasz Napierala.Nm 218d36c6176SAlexander Motinsubsystem was originally written by 2196c899950SBaptiste Daroussin.An Kenneth Merry Aq Mt ken@FreeBSD.org . 220d36c6176SAlexander MotinLater work was done by 221d36c6176SAlexander Motin.An Alexander Motin Aq Mt mav@FreeBSD.org . 222