History log of /freebsd-current/usr.sbin/ctladm/ctladm.8
Revision Date Author Comments
# 17c907dd 02-May-2024 John Baldwin <jhb@FreeBSD.org>

ctladm: Add nvterminate command to drop active NVMeoF associations

Reviewed by: imp
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D44729


# 4f9fa31c 02-May-2024 John Baldwin <jhb@FreeBSD.org>

ctladm: Add nvlist command to list active NVMeoF associations

Reviewed by: imp
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D44728


# f12d378f 27-Dec-2023 John Baldwin <jhb@FreeBSD.org>

cltadm.8: Correct documentation of -r arg to port command

-r does not take a target port argument

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D42932


# b2c76c41 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line nroff pattern

Remove /^\.\\"\s*\$FreeBSD\$$\n/


# ac503c19 06-Apr-2021 Alexander Motin <mav@FreeBSD.org>

Introduce "soft" serseq variant.

With new ZFS prefetcher improvements it is no longer needed to fully
serialize reads to reach decent prediction hit rate. Softer variant
only creates small time window to reduce races instead of completely
blocking following reads while previous is running. It much less
hurts the performance in case of prediction miss.

MFC after: 1 month


# 64cecc7a 23-Nov-2020 Edward Tomasz Napierala <trasz@FreeBSD.org>

Replace paths in ctladm(8) examples with something sensible.

PR: 251181
Reviewed by: 0mp, rm, ygy
MFC after: 2 weeks
Sponsored by: EPSRC
Differential Revision: https://reviews.freebsd.org/D27249


# 6d6d6c36 09-Oct-2020 Gordon Bergling <gbe@FreeBSD.org>

Fix a few mandoc issues

- no blank before trailing delimiter
- whitespace at end of input line
- sections out of conventional order
- normalizing date format
- AUTHORS section without An macro


# 8bdf81e4 06-Aug-2020 Alexander Motin <mav@FreeBSD.org>

Add CTL support for REPORT IDENTIFYING INFORMATION command.

It allows to report to initiator LU identifying information, preset via
"ident_info" and "text_ident_info" options.

Unfortunately it is impossible to implement SET IDENTIFYING INFORMATION,
since we have no persistent storage it requires, so the information is
read-only for initiator and has to be set out-of-band.

MFC after: 1 week
Sponsored by: iXsystems, Inc.


# ae8828ba 25-Jul-2019 Alexander Motin <mav@FreeBSD.org>

Add device temperature reporting into CTL.

The values to report can be set via LUN options. It can be useful for
testing, and also required for Drive Maintenance 2016 feature set.

MFC after: 2 weeks


# 8951f055 09-May-2018 Marcelo Araujo <araujo@FreeBSD.org>

Rework CTL frontend & backend options to use nv(3), allow creating multiple
ioctl frontend ports.

This revision introduces two changes to CTL:
- Changes the way options are passed to CTL_LUN_REQ and CTL_PORT_REQ ioctls.
Removes ctl_be_arg structure and associated logic and replaces it with
nv(3)-based logic for passing in and out arguments.
- Allows creating multiple ioctl frontend ports using either ctladm(8) or
ctld(8).
New frontend ports are represented by /dev/cam/ctl<pp>.<vp> nodes, eg /dev/cam/ctl5.3.
Those device nodes respond only to CTL_IO ioctl.

New command-line options for ctladm:
# creates new ioctl frontend port with using free pp and vp=0
ctladm port -c
# creates new ioctl frontend port with pp=10 and vp=0
ctladm port -c -O pp=10
# creates new ioctl frontend port with pp=11 and vp=12
ctladm port -c -O pp=11 -O vp=12
# removes port with number 4 (it's a "targ_port" number, not pp number)
ctladm port -r -p 4

New syntax for ctl.conf:
target ... {
port ioctl/<pp>
...
}

target ... {
port ioctl/<pp>/<vp>
...

Note: Most of this work was made by jceel@, thank you.

Submitted by: jceel
Reworked by: myself
Reviewed by: mav (earlier versions and recently during the rework)
Obtained from: FreeNAS and TrueOS
Relnotes: Yes
Sponsored by: iXsystems Inc.
Differential Revision: https://reviews.freebsd.org/D9299


# 4718651c 15-Jul-2017 Benedict Reuschling <bcr@FreeBSD.org>

The ctladm man page incorrectly duplicated the text for the
delete subcommand in the modify section. Rewrite the
modify description text in two places to say modify/modified
instead of remove/removed.

PR: 220710
Submitted by: sseekamp@risei.net
Reviewed by: mav@
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D11608


# b9b36cc0 03-Feb-2017 Warren Block <wblock@FreeBSD.org>

Replace Cyrillic characters with Latin (normal) ones.

PR: 216534
Submitted by: eborisch+FreeBSD@gmail.com
MFC after: 1 week
Sponsored by: iXsystems


# e7037673 23-Jan-2017 Alexander Motin <mav@FreeBSD.org>

Make CTL ramdisk backend a real RAM disk.

If "capacity" LU option is set, ramdisk backend now implements featured
thin provisioned disk, storing data in malloc(9) allocated memory blocks
of pblocksize bytes (default PAGE_SIZE or 4KB). Additionally ~0.2% of LU
size is used for indirection tree (bigger pblocksize reduce the overhead).
Backend supports all unmap and anchor operations. If configured capacity
is overflowed, proper error conditions are reported.

If "capacity" LU option is not set, the backend operates mostly the same
as before without allocating real storage: writes go to nowhere, reads
return zeroes, reporting that all LBAs are unmapped.

This backend is still mostly oriented on testing and benchmarking (it is
still a volatile RAM disk), but now it should allow to run real FS tests,
not only simple dumb dd.

MFC after: 2 weeks


# f383d6ef 21-Dec-2016 Alexander Motin <mav@FreeBSD.org>

Add support for locally assigned RFC 4122 UUID LUN identifiers.

MFC after: 2 weeks


# 4928a0c2 15-Oct-2016 Alexander Motin <mav@FreeBSD.org>

Add LU option to control reported provisioning type.

MFC after: 2 weeks


# 15fd2e24 15-Oct-2016 Alexander Motin <mav@FreeBSD.org>

Add LUN options to limit UNMAP and WRITE SAME sizes.

CTL itself has no limits on on UNMAP and WRITE SAME sizes. But depending
on backends large requests may take too much time. To avoid that new
configuration options allow to hint initiator maximal sizes it should not
exceed.

MFC after: 2 weeks


# d7ab4963 29-Feb-2016 Edward Tomasz Napierala <trasz@FreeBSD.org>

Fix typo.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation


# 91be33dc 27-Sep-2015 Alexander Motin <mav@FreeBSD.org>

Add to CTL initial support for CDROMs and removable devices.

Relnotes: yes


# 9c887a4f 26-Sep-2015 Alexander Motin <mav@FreeBSD.org>

Remove some duplicate, legacy, dead and questionable code.


# d36c6176 12-Sep-2015 Alexander Motin <mav@FreeBSD.org>

CTL documentation update, mostly for HA.


# fb606eba 10-Sep-2015 Alexander Motin <mav@FreeBSD.org>

Remove unused target and initiator IDs.


# a3977bea 06-Sep-2015 Alexander Motin <mav@FreeBSD.org>

Allow LUN options modification via CTL_LUNREQ_MODIFY.

Not all changes take effect, but that is a different question.


# 2f444d15 15-Aug-2015 Alexander Motin <mav@FreeBSD.org>

Drop "internal" CTL frontend.

Its idea was to be a simple initiator and execute several commands from
kernel level, but FreeBSD never had consumer for that functionality,
while its implementation polluted many unrelated places..


# 23902fd2 03-Jul-2015 Edward Tomasz Napierala <trasz@FreeBSD.org>

User proper terminology - iSCSI sessions, not iSCSI connections.

Sponsored by: The FreeBSD Foundation


# b853c718 22-May-2015 Edward Tomasz Napierala <trasz@FreeBSD.org>

Advertise ctlstat(8) a little better.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation


# 1ce31703 12-Feb-2015 Alexander Motin <mav@FreeBSD.org>

Fix man page to match real option names.

MFC after: 3 days


# 920c6cba 01-Feb-2015 Alexander Motin <mav@FreeBSD.org>

CTL LUN mapping rewrite.

Replace iSCSI-specific LUN mapping mechanism with new one, working for any
ports. By default all ports are created without LUN mapping, exposing all
CTL LUNs as before. But, if needed, LUN mapping can be manually set on
per-port basis via ctladm. For its iSCSI ports ctld does it via ioctl(2).
The next step will be to teach ctld to work with FibreChannel ports also.

Respecting additional flexibility of the new mechanism, ctl.conf now allows
alternative syntax for LUN definition. LUNs can now be defined in global
context, and then referenced from targets by unique name, as needed. It
allows same LUN to be exposed several times via multiple targets.

While there, increase limit for LUNs per target in ctld from 256 to 1024.
Some initiators do not support LUNs above 255, but that is not our problem.

Discussed with: trasz
MFC after: 2 weeks
Relnotes: yes
Sponsored by: iXsystems, Inc.


# 34961f40 17-Dec-2014 Alexander Motin <mav@FreeBSD.org>

Add configuration options to override physical and UNMAP blocks geometry.

While in most cases CTL should correctly fetch those values from backing
storages, there are some initiators (like MS SQL), that may not like large
physical block sizes, even if they are true. For such cases allow override
fetched values with supported ones (like 4K).

MFC after: 1 week


# bfbfc4a3 06-Dec-2014 Alexander Motin <mav@FreeBSD.org>

Count consecutive read requests as blocking in CTL for files and ZVOLs.

Technically read requests can be executed in any order or simultaneously
since they are not changing any data. But ZFS prefetcher goes crasy when
it receives consecutive requests from different threads. Since prefetcher
works on level of separate blocks, instead of two consecutive 128K requests
it may receive 32 8K requests in mixed order.

This patch is more workaround then a real fix, and it does not fix all of
prefetcher problems, but it improves sequential read speed by 3-4x times
in some configurations. On the other side it may hurt performance if
some backing store has no prefetch, that is why it is disabled by default
for raw devices.

MFC after: 2 weeks


# 001de973 04-Dec-2014 Alexander Motin <mav@FreeBSD.org>

Document r275481 changes.

MFC after: 2 weeks


# c3e7ba3e 05-Nov-2014 Alexander Motin <mav@FreeBSD.org>

Add to CTL support for logical block provisioning threshold notifications.

For ZVOL-backed LUNs this allows to inform initiators if storage's used or
available spaces get above/below the configured thresholds.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.


# 6f67ce91 26-Oct-2014 Alexander Motin <mav@FreeBSD.org>

Add "rpm" and "formfactor" LUN options to match istgt functionality.

MFC after: 1 week


# 555e99a3 12-Oct-2014 Alexander Motin <mav@FreeBSD.org>

Improve and document `ctladm portlist` subcommand.

Make this subcommand less FC-specific, reporting target and port addresses
in more generic way. Also make it report list of connected initiators in
unified way, working for both FC and iSCSI, and potentially others.

MFC after: 1 week


# 5396f4d2 07-Oct-2014 Alexander Motin <mav@FreeBSD.org>

Implement software (mode page) and hardware (config) write protection.


# ab55ae25 13-Sep-2014 Alexander Motin <mav@FreeBSD.org>

Implement control over command reordering via options and control mode page.

It allows to bypass range checks between UNMAP and READ/WRITE commands,
which may introduce additional delays while waiting for UNMAP parameters.
READ and WRITE commands are always processed in safe order since their
range checks are almost free.


# 8e6441d8 13-Sep-2014 Alexander Motin <mav@FreeBSD.org>

Add "readcache" and "writecache" LUN options to control default behavior.

Default values are "on". Disabling requires backend to support IO_DIRECT
and IO_SYNC flags respectively, or some alternatives.


# 984a2ea9 16-Jul-2014 Alexander Motin <mav@FreeBSD.org>

Add support for VMWare dialect of EXTENDED COPY command, aka VAAI Clone.

This allows to clone VMs and move them between LUNs inside one storage
host without generating extra network traffic to the initiator and back,
and without being limited by network bandwidth.

LUNs participating in copy operation should have UNIQUE NAA or EUI IDs set.
For LUNs without these IDs VMWare will use traditional copy operations.

Beware: the above LUN IDs explicitly set to values non-unique from the VM
cluster point of view may cause data corruption if wrong LUN is addressed!

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.


# 77381bd8 09-Jul-2014 Sergey Kandaurov <pluknet@FreeBSD.org>

Fix typos.


# 409a3c13 08-Jul-2014 Alexander Motin <mav@FreeBSD.org>

Add LUN options to specify 64-bit EUI and NAA identifiers.


# 027e5269 05-Jul-2014 Alexander Motin <mav@FreeBSD.org>

Burry devid port method, which was a gross hack.

Instead make ports provide wanted port and target IDs, and LUNs provide
wanted LUN IDs. After that core Device ID VPD code only had to link all
of them together and add relative port and port group numbers.

LUN ID for iSCSI LUNs no longer created by CTL, but by ctld, and passed
to CTL as "scsiname" LUN option. This makes LUNs to report the same set
of IDs, independently from the port through which it is accessed, as
required by SCSI specifications.


# 01c2b8ac 20-Jun-2014 Baptiste Daroussin <bapt@FreeBSD.org>

use .Mt to mark up email addresses consistently (part2)

PR: 191174
Submitted by: Franco Fichtner <franco@lastsummer.de>


# a7f17b07 15-Jun-2014 Joel Dahl <joel@FreeBSD.org>

mdoc: add missing width to Bl -tag.


# ca7a5557 15-Jun-2014 Alexander Motin <mav@FreeBSD.org>

Document additional LUN/backend options.


# 630e459e 30-Oct-2013 Edward Tomasz Napierala <trasz@FreeBSD.org>

Bump .Dd after r257379.

MFC after: 3 days


# abec6193 30-Oct-2013 Edward Tomasz Napierala <trasz@FreeBSD.org>

Rename '-h' option to '-p', and use "portal" instead of "host" or "address",
in order to be consistent with iSCSI terminology. Besides, calling the
option '-h' was just wrong.

This changes usage for newly added iscsictl(8), and two newly added
subcommands to ctladm(8). This breaks POLA between CURRENT and 10,
but since 10.0 has not been released yet, it's still ok to do.

MFC after: 3 days
Discussed with: re (glebius)
Sponsored by: FreeBSD Foundation


# 009ea47e 14-Sep-2013 Edward Tomasz Napierala <trasz@FreeBSD.org>

Bring in the new iSCSI target and initiator.

Reviewed by: ken (parts)
Approved by: re (delphij)
Sponsored by: FreeBSD Foundation


# b1edef17 11-Apr-2013 Joel Dahl <joel@FreeBSD.org>

Remove contractions.


# a1593396 02-Apr-2013 Edward Tomasz Napierala <trasz@FreeBSD.org>

Fix dates in manual pages modified in 249009.


# 32562145 02-Apr-2013 Edward Tomasz Napierala <trasz@FreeBSD.org>

Make it possible to build CTL as a module.

Reviewed by: ken
Sponsored by: FreeBSD Foundation


# 8972c8b6 03-Jun-2012 Joel Dahl <joel@FreeBSD.org>

Minor spelling fixes.


# 344c81a1 23-May-2012 Warren Block <wblock@FreeBSD.org>

Fixes to man8 groff mandoc style, usage mistakes, or typos.

PR: 168016
Submitted by: Nobuyuki Koganemaru
Approved by: gjb
MFC after: 3 days


# 50d675f7 28-Mar-2012 Eitan Adler <eadler@FreeBSD.org>

Remove trailing whitespace per mdoc lint warning

Disussed with: gavin
No objection from: doc
Approved by: joel
MFC after: 3 days


# c0cbd1c6 25-Mar-2012 Joel Dahl <joel@FreeBSD.org>

Remove superfluous paragraph macro.


# 81177295 06-Mar-2012 Edward Tomasz Napierala <trasz@FreeBSD.org>

Add LUN resizing to CTL. Also make it possible to explicitly set
size when creating file-backed or device-backed LUN.

Reviewed by: ken (earlier version)
Sponsored by: The FreeBSD Foundation


# 130f4520 11-Jan-2012 Kenneth D. Merry <ken@FreeBSD.org>

Add the CAM Target Layer (CTL).

CTL is a disk and processor device emulation subsystem originally written
for Copan Systems under Linux starting in 2003. It has been shipping in
Copan (now SGI) products since 2005.

It was ported to FreeBSD in 2008, and thanks to an agreement between SGI
(who acquired Copan's assets in 2010) and Spectra Logic in 2010, CTL is
available under a BSD-style license. The intent behind the agreement was
that Spectra would work to get CTL into the FreeBSD tree.

Some CTL features:

- Disk and processor device emulation.
- Tagged queueing
- SCSI task attribute support (ordered, head of queue, simple tags)
- SCSI implicit command ordering support. (e.g. if a read follows a mode
select, the read will be blocked until the mode select completes.)
- Full task management support (abort, LUN reset, target reset, etc.)
- Support for multiple ports
- Support for multiple simultaneous initiators
- Support for multiple simultaneous backing stores
- Persistent reservation support
- Mode sense/select support
- Error injection support
- High Availability support (1)
- All I/O handled in-kernel, no userland context switch overhead.

(1) HA Support is just an API stub, and needs much more to be fully
functional.

ctl.c: The core of CTL. Command handlers and processing,
character driver, and HA support are here.

ctl.h: Basic function declarations and data structures.

ctl_backend.c,
ctl_backend.h: The basic CTL backend API.

ctl_backend_block.c,
ctl_backend_block.h: The block and file backend. This allows for using
a disk or a file as the backing store for a LUN.
Multiple threads are started to do I/O to the
backing device, primarily because the VFS API
requires that to get any concurrency.

ctl_backend_ramdisk.c: A "fake" ramdisk backend. It only allocates a
small amount of memory to act as a source and sink
for reads and writes from an initiator. Therefore
it cannot be used for any real data, but it can be
used to test for throughput. It can also be used
to test initiators' support for extremely large LUNs.

ctl_cmd_table.c: This is a table with all 256 possible SCSI opcodes,
and command handler functions defined for supported
opcodes.

ctl_debug.h: Debugging support.

ctl_error.c,
ctl_error.h: CTL-specific wrappers around the CAM sense building
functions.

ctl_frontend.c,
ctl_frontend.h: These files define the basic CTL frontend port API.

ctl_frontend_cam_sim.c: This is a CTL frontend port that is also a CAM SIM.
This frontend allows for using CTL without any
target-capable hardware. So any LUNs you create in
CTL are visible in CAM via this port.

ctl_frontend_internal.c,
ctl_frontend_internal.h:
This is a frontend port written for Copan to do
some system-specific tasks that required sending
commands into CTL from inside the kernel. This
isn't entirely relevant to FreeBSD in general,
but can perhaps be repurposed.

ctl_ha.h: This is a stubbed-out High Availability API. Much
more is needed for full HA support. See the
comments in the header and the description of what
is needed in the README.ctl.txt file for more
details.

ctl_io.h: This defines most of the core CTL I/O structures.
union ctl_io is conceptually very similar to CAM's
union ccb.

ctl_ioctl.h: This defines all ioctls available through the CTL
character device, and the data structures needed
for those ioctls.

ctl_mem_pool.c,
ctl_mem_pool.h: Generic memory pool implementation used by the
internal frontend.

ctl_private.h: Private data structres (e.g. CTL softc) and
function prototypes. This also includes the SCSI
vendor and product names used by CTL.

ctl_scsi_all.c,
ctl_scsi_all.h: CTL wrappers around CAM sense printing functions.

ctl_ser_table.c: Command serialization table. This defines what
happens when one type of command is followed by
another type of command.

ctl_util.c,
ctl_util.h: CTL utility functions, primarily designed to be
used from userland. See ctladm for the primary
consumer of these functions. These include CDB
building functions.

scsi_ctl.c: CAM target peripheral driver and CTL frontend port.
This is the path into CTL for commands from
target-capable hardware/SIMs.

README.ctl.txt: CTL code features, roadmap, to-do list.

usr.sbin/Makefile: Add ctladm.

ctladm/Makefile,
ctladm/ctladm.8,
ctladm/ctladm.c,
ctladm/ctladm.h,
ctladm/util.c: ctladm(8) is the CTL management utility.
It fills a role similar to camcontrol(8).
It allow configuring LUNs, issuing commands,
injecting errors and various other control
functions.

usr.bin/Makefile: Add ctlstat.

ctlstat/Makefile
ctlstat/ctlstat.8,
ctlstat/ctlstat.c: ctlstat(8) fills a role similar to iostat(8).
It reports I/O statistics for CTL.

sys/conf/files: Add CTL files.

sys/conf/NOTES: Add device ctl.

sys/cam/scsi_all.h: To conform to more recent specs, the inquiry CDB
length field is now 2 bytes long.

Add several mode page definitions for CTL.

sys/cam/scsi_all.c: Handle the new 2 byte inquiry length.

sys/dev/ciss/ciss.c,
sys/dev/ata/atapi-cam.c,
sys/cam/scsi/scsi_targ_bh.c,
scsi_target/scsi_cmds.c,
mlxcontrol/interface.c: Update for 2 byte inquiry length field.

scsi_da.h: Add versions of the format and rigid disk pages
that are in a more reasonable format for CTL.

amd64/conf/GENERIC,
i386/conf/GENERIC,
ia64/conf/GENERIC,
sparc64/conf/GENERIC: Add device ctl.

i386/conf/PAE: The CTL frontend SIM at least does not compile
cleanly on PAE.

Sponsored by: Copan Systems, SGI and Spectra Logic
MFC after: 1 month