xref: /freebsd/share/man/man4/ctl.4 (revision 257e70f1d5ee61037c8c59b116538d3b6b1427a2)
1.\" Copyright (c) 2013 Edward Tomasz Napierala
2.\" Copyright (c) 2015-2017 Alexander Motin <mav@FreeBSD.org>
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.Dd March 29, 2017
26.Dt CTL 4
27.Os
28.Sh NAME
29.Nm ctl
30.Nd CAM Target Layer
31.Sh SYNOPSIS
32To compile this driver into the kernel,
33place the following line in your
34kernel configuration file:
35.Bd -ragged -offset indent
36.Cd "device ctl"
37.Ed
38.Pp
39Alternatively, to load the driver as a
40module at boot time, place the following line in
41.Xr loader.conf 5 :
42.Bd -literal -offset indent
43ctl_load="YES"
44.Ed
45.Sh DESCRIPTION
46The
47.Nm
48subsystem provides SCSI target devices emulation.
49It supports features such as:
50.Pp
51.Bl -bullet -compact
52.It
53Disk, CD-ROM and processor device emulation
54.It
55Tagged queueing
56.It
57SCSI task attribute support (ordered, head of queue, simple tags)
58.It
59SCSI implicit command ordering support
60.It
61Full task management support (abort, query, reset, etc.)
62.It
63Support for multiple ports, initiators, targets and backing stores
64.It
65Support for VMWare VAAI and Microsoft ODX offload (COMPARE AND WRITE,
66XCOPY, POPULATE TOKEN/WRITE USING TOKEN, WRITE SAME and UNMAP)
67.It
68Persistent reservation support
69.It
70Extensive VPD/mode/log pages support
71.It
72Featured error reporting, error injection and basic SMART support
73.It
74High Availability clustering support with ALUA
75.It
76All I/O handled in-kernel, no userland context switch overhead
77.El
78.Pp
79The
80.Nm
81subsystem includes multiple frontends to provide access using different
82transport protocols and implementations:
83.Bl -tag -width cfumass
84.It camsim
85Provides access for local system via virtual initiator mode
86.Xr CAM 4
87SIM.
88.It camtgt
89Provides access for remote systems via target mode
90.Xr CAM 4
91SIMs, such as Fibre Channel
92.Xr isp 4
93and
94.Xr mpt 4 .
95.It cfumass
96Provides access for remote systems via USB Mass Storage Class
97Bulk Only (BBB) Transport.
98.It ha
99Internal frontend used to receive requests from other node ports in
100High Availability cluster.
101.It ioctl
102Provides access for local user-level applications via
103.Xr ioctl 2
104based API.
105.It iscsi
106Provides access for remote systems via the iSCSI protocol using
107.Xr cfiscsi 4 .
108.It tpc
109Internal frontend used to receive requests from Third Party Copy engine,
110implementing copy offload operations.
111.El
112.Pp
113The
114.Nm
115subsystem includes two backends to create logical units using different
116kinds of backing stores:
117.Bl -tag -width ramdisk
118.It block
119Stores data in ZFS ZVOLs, files or raw block devices.
120.It ramdisk
121Stores data in RAM, that makes it mostly useful for performance testing.
122Depending on configured capacity can work as black hole, thin or thick
123provisioned disk.
124.El
125.Sh SYSCTL VARIABLES
126The following variables are available as both
127.Xr sysctl 8
128variables and
129.Xr loader 8
130tunables:
131.Bl -tag -width indent
132.It Va kern.cam.ctl.debug
133Bit mask of enabled CTL log levels:
134.Bl -tag -offset indent -compact
135.It 1
136log commands with errors;
137.It 2
138log all commands;
139.It 4
140log data for commands other then READ/WRITE.
141.El
142Defaults to 0.
143.It Va kern.cam.ctl.ha_id
144Specifies unique position of this node within High Availability cluster.
145Default is 0 -- no HA, 1 and 2 -- HA enabled at specified position.
146.It Va kern.cam.ctl.ha_mode
147Specifies High Availability cluster operation mode:
148.Bl -tag -offset indent -compact
149.It 0
150Active/Standby -- primary node has backend access and processes requests,
151while secondary can only do basic LUN discovery and reservation;
152.It 1
153Active/Active -- both nodes have backend access and process requests,
154while secondary node synchronizes processing with primary one;
155.It 2
156Active/Active -- primary node has backend access and processes requests,
157while secondary node forwards all requests and data to primary one;
158.El
159All above modes require established connection between HA cluster nodes.
160If connection is not configured, secondary node will report Unavailable
161state; if configured but not established -- Transitioning state.
162Defaults to 0.
163.It Va kern.cam.ctl.ha_peer
164String value, specifying method to establish connection to peer HA node.
165Can be "listen IP:port", "connect IP:port" or empty.
166.It Va kern.cam.ctl.ha_link
167Reports present state of connection between HA cluster nodes:
168.Bl -tag -offset indent -compact
169.It 0
170not configured;
171.It 1
172configured but not established;
173.It 2
174established.
175.El
176.It Va kern.cam.ctl.ha_role
177Specifies default role of this node:
178.Bl -tag -offset indent -compact
179.It 0
180primary;
181.It 1
182secondary.
183.El
184This role can be overridden on per-LUN basis using "ha_role" LUN option,
185so that for one LUN one node is primary, while for another -- another.
186Role change from primary to secondary for HA modes 0 and 2 closes backends,
187the opposite change -- opens.
188If there is no primary node (both nodes are secondary, or secondary node has
189no connection to primary one), secondary node(s) report Transitioning state.
190State with two primary nodes is illegal (split brain condition).
191.El
192.Sh TUNABLE VARIABLES
193The following variables are available as
194.Xr loader 8
195tunables:
196.Bl -tag -width indent
197.It Va kern.cam.ctl.max_luns
198Specifies the maximum number of LUNs we support, must be a power of 2.
199The default value is 1024.
200.It Va kern.cam.ctl.max_ports
201Specifies the maximum number of ports we support, must be a power of 2.
202The default value is 1024.
203.El
204.Sh SEE ALSO
205.Xr cfiscsi 4 ,
206.Xr cfumass 4 ,
207.Xr ctladm 8 ,
208.Xr ctld 8 ,
209.Xr ctlstat 8
210.Sh HISTORY
211The
212.Nm
213subsystem first appeared in
214.Fx 9.1 .
215.Sh AUTHORS
216The
217.Nm
218subsystem was originally written by
219.An Kenneth Merry Aq Mt ken@FreeBSD.org .
220Later work was done by
221.An Alexander Motin Aq Mt mav@FreeBSD.org .
222