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