#
25bad5a2 |
|
02-May-2024 |
John Baldwin <jhb@FreeBSD.org> |
ctl: Add NVMF port type and ioctls - Add CTL_PORT_NVMF as a new port type. - Define a new CTL_NVMF ioctl for NVMF-specific operations similar to CTL_ISCSI. This ioctl supports a command to handoff a single queue pair, a command to enumerate active associations, and a command to disconnect one or more active associations. Reviewed by: imp Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D44724
|
#
2ff63af9 |
|
16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: one-line .h pattern Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
|
#
4d846d26 |
|
10-May-2023 |
Warner Losh <imp@FreeBSD.org> |
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
|
#
0acc026d |
|
03-Dec-2022 |
Alexander Motin <mav@FreeBSD.org> |
CTL: Increase maximum SCSI tag size from 32 to 64 bits. SAM-5 specification states maximum size of command identifier (tag), defined by specific transports, should not be larger than 64 bits. While most of supported transports use 32 bits or less, it was reported that virtio-scsi uses 64 bits. Truncation to 32 bits in bhyve code caused false tag conflict errors reported and possibly other issues. This changes CTL ABI and HA protocol, so CTL_HA_VERSION is bumped. While we make HA protocol incompatible, increase default maximum number of ports in CTL from 256 to 1024, matching number of LUNs. There are many reports from people who need many iSCSI targets with only one LUN each. Increased memory consumption should be less of a problem these days. PR: 267539
|
#
0586be48 |
|
06-Sep-2022 |
Alexander Motin <mav@FreeBSD.org> |
CTL: Validate IOCTL parameters. It was possible to cause kernel panic by passing too large args_len or non-NULL result_nvl. Though since the /dev/cam/ctl device is accessible only by root and used only by limited number of tools it was not a big problem. PR: 266115 PR: 266136 Reported by: Robert Morris <rtm@lcs.mit.edu> MFC after: 1 week
|
#
7b02c1e8 |
|
18-Apr-2022 |
John Baldwin <jhb@FreeBSD.org> |
iscsi: Fetch limits based on a socket rather than assuming global limits. cxgbei needs the ability to return different limits based on the connection (e.g. if the connection is over a T5 adapter or a T6 adapter as well as factoring in the MTU). This change plumbs through the changes in the ioctls without changing any of the backends. The limits callback passed to icl_register now accepts a second socket argument which holds the integer file descriptor. To support ABI compatiblity for old binaries, the callback should return "global" values if the socket fd is zero. The CTL_ISCSI_LIMITS argument used with CTL_ISCSI by ctld(8) now accepts the socket fd in a field that was previously part of a reserved spare field. Old binaries zero this request which results in passing a socket fd of 0 to the limits callback. The ISCSIDREQUEST ioctl no longer returns limits. Instead, iscsid(8) invokes a new ISCSIDLIMITS ioctl after establishing the connection via connect(2). For ABI compat, if the old ISCSIDREQUEST is invoked, the global limits are still fetched (with a socket fd of 0) and returned. Reviewed by: mav Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D34928
|
#
dbcf7598 |
|
29-May-2020 |
Alexander Motin <mav@FreeBSD.org> |
Report STATUS_QUEUED/SENT in `ctladm dumpooa` output. MFC after: 2 weeks Sponsored by: iXsystems, Inc.
|
#
e806165b |
|
22-Feb-2019 |
Alexander Motin <mav@FreeBSD.org> |
Remove disabled CTL_LEGACY_STATS support. It was not only disabled for quite a while, but also appeared to be broken at r325517, when maximum number of ports was made configurable. MFC after: 1 week
|
#
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
|
#
bec9534d |
|
27-Nov-2017 |
Pedro F. Giffuni <pfg@FreeBSD.org> |
sys/cam: further adoption of SPDX licensing ID tags. Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts.
|
#
530fdf67 |
|
07-Nov-2017 |
Emmanuel Vadot <manu@FreeBSD.org> |
ctl: Make max_luns and max_ports tunable variables instead of hardcoded defines. Reviewed by: trasz (earlier version), bapt (earlier version), bcr (manpages) MFC after: 2 Weeks Sponsored by: Gandi.net Differential Revision: https://reviews.freebsd.org/D12836
|
#
b4b4b530 |
|
28-Jan-2017 |
Baptiste Daroussin <bapt@FreeBSD.org> |
Revert crap accidentally committed
|
#
814aaaa7 |
|
28-Jan-2017 |
Baptiste Daroussin <bapt@FreeBSD.org> |
Revert r312923 a better approach will be taken later
|
#
5ab1cf33 |
|
25-Jan-2017 |
Edward Tomasz Napierala <trasz@FreeBSD.org> |
Bring the ctl headers a bit closer to style(9). No functional changes.
|
#
bb8f9017 |
|
09-Jan-2017 |
Alexander Motin <mav@FreeBSD.org> |
Rewrite CTL statistics in more simple and scalable way. Instead of collecting statistics for each combination of ports and logical units, that consumed ~45KB per LU with present number of ports, collect separate statistics for every port and every logical unit separately, that consume only 176 bytes per each single LU/port. This reduces struct ctl_lun size down to just 6KB. Also new IOCTL API/ABI does not hardcode number of LUs/ports, and should allow handling of very large quantities. MFC after: 2 weeks (probably keeping old API enabled for some time)
|
#
a851d1fb |
|
03-Nov-2016 |
Edward Tomasz Napierala <trasz@FreeBSD.org> |
Check for lengths being <= 0. Note that this interface can only be accessed by root. It uses unsigned ints instead of size_t to preserve the ABI. PR: 207627 Submitted by: ryan@ryanday.net (with slight tweaks) MFC after: 1 month
|
#
97b84d34 |
|
24-Aug-2016 |
Navdeep Parhar <np@FreeBSD.org> |
Make the iSCSI parameter negotiation more flexible. Decouple the send and receive limits on the amount of data in a single iSCSI PDU. MaxRecvDataSegmentLength is declarative, not negotiated, and is direction-specific so there is no reason for both ends to limit themselves to the same min(initiator, target) value in both directions. Allow iSCSI drivers to report their send, receive, first burst, and max burst limits explicitly instead of using hardcoded values or trying to derive all of them from the receive limit (which was the only limit reported by the drivers prior to this change). Display the send and receive limits separately in the userspace iSCSI utilities. Reviewed by: jpaetzel@ (earlier version), trasz@ Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D7279
|
#
1ffe5851 |
|
29-Apr-2016 |
Pedro F. Giffuni <pfg@FreeBSD.org> |
sys/cam: spelling fixes in comments. No functional change.
|
#
9c887a4f |
|
26-Sep-2015 |
Alexander Motin <mav@FreeBSD.org> |
Remove some duplicate, legacy, dead and questionable code.
|
#
fb606eba |
|
10-Sep-2015 |
Alexander Motin <mav@FreeBSD.org> |
Remove unused target and initiator IDs.
|
#
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..
|
#
07b49a3e |
|
06-Feb-2015 |
Edward Tomasz Napierala <trasz@FreeBSD.org> |
Make it possible to set (via ctl.conf(5)) and query (via ctladm islist -v) target iSCSI offload. Add mechanism to query maximum receive data segment size supported by chosen hardware offload module, and use it in ctld(8) to determine the value to advertise to the other side. MFC after: 1 month Sponsored by: The FreeBSD Foundation
|
#
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.
|
#
ffe9621c |
|
03-Dec-2014 |
Alexander Motin <mav@FreeBSD.org> |
Increase CTL ports limit from 128 to 256 and LUNs limit from 256 to 1024. After recent optimizations this change is no longer blocked by CTL memory consumption. Those limits are still not free, but much cheaper now. MFC after: 1 week Relnotes: yes Sponsored by: iXsystems, Inc.
|
#
19720f41 |
|
10-Oct-2014 |
Alexander Motin <mav@FreeBSD.org> |
Make ctld start even if some LUNs are unable to open backing storage. Such LUNs will be visible to initiators, but return "not ready" status on media access commands. If backing storage become available later, `ctladm modify ...` or `service ctld reload` can trigger its reopen.
|
#
8cbf9eae |
|
17-Jul-2014 |
Alexander Motin <mav@FreeBSD.org> |
Increase maximal number of SCSI ports in CTL from 32 to 128. After I gave each iSCSI target its own port, the old limit appeared to be not so big. This change almost proportionally increases per-LUN memory use, but it is still three times better then it was before r268807. MFC after: 2 weeks
|
#
6d81c129 |
|
05-Jul-2014 |
Alexander Motin <mav@FreeBSD.org> |
Pass through iSCSI session ISID from LOGIN request to the CTL frontend. ISID is an important part of initiator transport ID for iSCSI. It is not used now, but should be to properly implement persistent reservation.
|
#
917d38fb |
|
05-Jul-2014 |
Alexander Motin <mav@FreeBSD.org> |
Create separate CTL port for every iSCSI target (and maybe portal group). Having single port for all iSCSI connections makes problematic implementing some more advanced SCSI functionality in CTL, that require proper ports enumeration and identification. This change extends CTL iSCSI API, making ctld daemon to control list of iSCSI ports in CTL. When new target is defined in config fine, ctld will create respective port in CTL. When target is removed -- port will be also removed after all active commands through that port properly aborted. This change require ctld to be rebuilt to match the kernel. As a minor side effect, this allows to have iSCSI targets without LUNs. While that may look odd and not very useful, that is not incorrect.
|
#
92782c33 |
|
04-Jul-2014 |
Alexander Motin <mav@FreeBSD.org> |
Introduce new IOCTL CTL_PORT_LIST reporting in more flexible XML format. Leave old CTL_GET_PORT_LIST in place so far. Garbage-collect it later.
|
#
8eab95d6 |
|
16-Apr-2014 |
Edward Tomasz Napierala <trasz@FreeBSD.org> |
Properly pass the initiator address when running in proxy mode. Sponsored by: The FreeBSD Foundation
|
#
8cab2ed4 |
|
16-Apr-2014 |
Edward Tomasz Napierala <trasz@FreeBSD.org> |
Properly identify target portal when running in proxy mode. While here, remove CTL_ISCSI_CLOSE, it wasn't used or implemented anyway. Sponsored by: The FreeBSD Foundation
|
#
2ebde326 |
|
16-Apr-2014 |
Edward Tomasz Napierala <trasz@FreeBSD.org> |
Add some stuff to make it easier to figure out for the system administrator whether the ICL_KERNEL_PROXY stuff got compiled in correctly. Sponsored by: The FreeBSD Foundation
|
#
ba3a2d31 |
|
16-Apr-2014 |
Edward Tomasz Napierala <trasz@FreeBSD.org> |
Make it possible for the iSCSI target side to operate in both normal and ICL_KERNEL_PROXY mode, and fix some bit rot so the latter actually works again. Sponsored by: The FreeBSD Foundation
|
#
ac873bb3 |
|
20-Sep-2013 |
Edward Tomasz Napierala <trasz@FreeBSD.org> |
Add some spare fields to structs used by the new iSCSI stack - some just in case, some for future MC/S support. This requires kernel and world rebuild. Approved by: re (blanket) 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
|
#
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
|