path: root/sys/cam/ctl/ctl_error.h
Commit message (Collapse)AuthorAgeFilesLines
* sys/cam: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=326265
* Make CTL frontends report kern_data_resid for under-/overruns.Alexander Motin2017-01-161-0/+1
| | | | | | | | | | | | | | | | | It seems like kern_data_resid was never really implemented. This change finally does it. Now frontends update this field while transferring data, while CTL/backends getting it can more flexibly handle the result. At this point behavior should not change significantly, still reporting errors on write overrun, but that may be changed later, if we decide so. CAM target frontend still does not properly handle overruns due to CAM API limitations. We may need to add some fields to struct ccb_accept_tio to pass information about initiator requested transfer size(s). MFC after: 2 weeks Notes: svn path=/head/; revision=312291
* Improve length handling when writing sense data.Alexander Motin2016-12-241-7/+8
| | | | | | | | | | | | - Allow maximal sense size limitation via Control Extension mode page. - When sense size limited, include descriptors atomically: whole or none. - Set new SDAT_OVFL bit if some descriptors don't fit the limit. - Report real written sense length instead of static maximal 252 bytes. MFC after: 2 weeks Notes: svn path=/head/; revision=310524
* When reporting "Logical block address out of range" error, report the LBAAlexander Motin2016-12-191-1/+1
| | | | | | | | | in sense data INFORMATION field. MFC after: 2 weeks Notes: svn path=/head/; revision=310285
* Umplement media load/eject support for removable devices.Alexander Motin2015-09-281-1/+4
| | | | | | | | In case of block backend eject really closes the backing store, while load tries to open it back. Failed store open is reported as no media. Notes: svn path=/head/; revision=288348
* Report proper medium error code for VERIFY commands.Alexander Motin2015-09-171-1/+1
| | | | Notes: svn path=/head/; revision=287912
* Implement QUERY TASK, QUERY TASK SET and QUERY ASYNC EVENT.Alexander Motin2015-09-141-0/+1
| | | | | | | Now we support most of SAM-5 task management. Notes: svn path=/head/; revision=287774
* Improve read-only support.Alexander Motin2015-09-131-0/+1
| | | | Notes: svn path=/head/; revision=287760
* Reimplement CTL High Availability.Alexander Motin2015-09-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | CTL HA functionality was originally implemented by Copan many years ago, but large part of the sources was never published. This change includes clean room implementation of the missing code and fixes for many bugs. This code supports dual-node HA with ALUA in four modes: - Active/Unavailable without interlink between nodes; - Active/Standby with second node handling only basic LUN discovery and reservation, synchronizing with the first node through the interlink; - Active/Active with both nodes processing commands and accessing the backing storage, synchronizing with the first node through the interlink; - Active/Active with second node working as proxy, transfering all commands to the first node for execution through the interlink. Unlike original Copan's implementation, depending on specific hardware, this code uses simple custom TCP-based protocol for interlink. It has no authentication, so it should never be enabled on public interfaces. The code may still need some polishing, but generally it is functional. Relnotes: yes Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=287621
* Do not pre-allocate UNIT ATTENTIONs storage for every possible initiator.Alexander Motin2014-12-031-2/+4
| | | | | | | | | | | | | Abusing ability of major UAs cover minor ones we may not account UAs for inactive ports. Allocate UAs storage for port and start accounting only after some initiator from that port fetched its first POWER ON OCCURRED. This reduces per-LUN CTL memory usage from >1MB to less then 100K. MFC after: 1 month Notes: svn path=/head/; revision=275458
* Implement better handling for ENOSPC error for both CTL and CAM.Alexander Motin2014-10-291-0/+1
| | | | | | | | | | | This makes VMWare VAAI Thin Provisioning Stun primitive activate, pausing the virtual machine, when backing storage (ZFS pool) is getting overflowed. MFC after: 1 week Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=273809
* When reporting some major UNIT ATTENTION condition, like POWER ON OCCURREDAlexander Motin2014-09-231-1/+1
| | | | | | | | | | | | | or I_T NEXUS LOSS, clear all minor UAs for the LUN, redundant in this case. All SAM specifications tell that target MAY do it, but libiscsi initiator seems require it to be done, terminating connection with error if some more UAs happen to be reported during iSCSI connection. MFC after: 3 days Notes: svn path=/head/; revision=272040
* Enable TAS feature: notify initiator if its command was aborted by other.Alexander Motin2014-07-081-0/+1
| | | | | | | | | That should make operation more kind to multi-initiator environment. Without this, other initiators may find out that something bad happened to their commands only via command timeout. Notes: svn path=/head/; revision=268418
* Quiet some clang warnings when compiling CTL.Kenneth D. Merry2012-01-191-8/+1
| | | | | | | | | | | | | | | | | | | | | | ctl_error.c, ctl_error.h: Take out the ctl_sense_format enumeration, and use scsi_sense_data_type instead. Remove ctl_get_sense_format() and switch ctl_build_ua() over to using scsi_sense_data_type. ctl_backend_ramdisk.c, ctl_backend_block.c: Use C99 structure initializers instead of GNU initializers. ctl.c: Switch over to using the SCSI sense format enumeration instead of the CTL-specific enumeration. Submitted by: dim (partially) MFC after: 1 month Notes: svn path=/head/; revision=230334
* Add the CAM Target Layer (CTL).Kenneth D. Merry2012-01-121-0/+92
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 Notes: svn path=/head/; revision=229997