summaryrefslogtreecommitdiffstats
path: root/sys/cam/ctl/ctl_error.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC r313744: No need to erase sense_data when sense_len is set to zero.mav2017-02-281-15/+0
|
* MFC r312291, r312669:mav2017-02-071-0/+12
| | | | | | | | | | | | | | Make CTL frontends report kern_data_resid for under-/overruns. 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 r310778, r310782: Improve use of I/O's private area.mav2017-01-261-1/+1
| | | | | | - Since I/Os are allocates from per-port pools, make allocations store pointer to CTL softc there, and use it where needed instead of global. - Created bunch of helper macros to access LUN, port and CTL softc.
* MFC r310524: Improve length handling when writing sense data.mav2017-01-051-17/+34
| | | | | | | - 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 r310366: Add support for SITUA bit in Logical Block Provisioning mode page.mav2017-01-051-0/+12
| | | | | | | | | | VMware tries to enable this bit to avoid multiple threshold notifications in case of multiple initiators connected to the same LUN. Unfortunately their code sends MODE SELECT(6) request with parameter length hardcoded for the page without any thresholds. Since we have four threshold and our page is bigger, this attempt fails, that is correct in my understanding. So all we can do about this now is to report proper error code and hope VMware fix their code one day.
* MFC r310285:mav2017-01-051-3/+9
| | | | | When reporting "Logical block address out of range" error, report the LBA in sense data INFORMATION field.
* MFC r310275: Fix typo in function name.mav2017-01-051-3/+3
|
* MFC r310265: Add set of macros to simplify code access to mode pages fields.mav2017-01-051-3/+1
|
* MFC r310257: Improve support for informational exceptions.mav2017-01-051-1/+7
| | | | | | | | | While CTL still has no real events to report in this way (like SMART), it is possible to trigger false event by manually setting TEST bit in Informational Exceptions Control mode page, that can be useful for initiator testing. This code supports all flavours of IE reporting: UNIT ATTENTION, RECOVERED ERROR and NO SENSE sense keys, REQUEST SENSE command and Informational Exceptions log page.
* Umplement media load/eject support for removable devices.mav2015-09-281-2/+32
| | | | | 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.
* Remove some dead code found by Clang analyzer.mav2015-09-251-3/+0
|
* When reporting TPT UA, report which of thresholds was reached.mav2015-09-171-12/+13
|
* Report proper medium error code for VERIFY commands.mav2015-09-171-2/+2
|
* Implement QUERY TASK, QUERY TASK SET and QUERY ASYNC EVENT.mav2015-09-141-68/+107
| | | | Now we support most of SAM-5 task management.
* Improve read-only support.mav2015-09-131-0/+12
|
* Report INQUIRY DATA HAS CHANGED for related LUNs on port on-/offline.mav2015-09-131-0/+5
|
* Reimplement CTL High Availability.mav2015-09-101-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* Small UA cleanup.mav2015-09-031-10/+0
|
* Drop "internal" CTL frontend.mav2015-08-151-1/+0
| | | | | | 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..
* Do not pre-allocate UNIT ATTENTIONs storage for every possible initiator.mav2014-12-031-6/+25
| | | | | | | | | | 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
* Add to CTL support for logical block provisioning threshold notifications.mav2014-11-061-0/+5
| | | | | | | | 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.
* Implement better handling for ENOSPC error for both CTL and CAM.mav2014-10-291-0/+12
| | | | | | | | 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.
* When reporting some major UNIT ATTENTION condition, like POWER ON OCCURREDmav2014-09-231-16/+15
| | | | | | | | | | 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
* Fix ASCQ for "Logical unit not ready, manual intervention required" error.mav2014-09-231-1/+1
|
* Enable TAS feature: notify initiator if its command was aborted by other.mav2014-07-081-0/+12
| | | | | | 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.
* Implement ABORT TASK SET and I_T NEXUS RESET task management functions.mav2014-07-071-0/+5
| | | | | Use the last one to terminate active commands on iSCSI session termination. Previous code was aborting only commands doing some data moves.
* Change the SCSI INQUIRY peripheral qualifier that CTL reports for LUNsken2012-04-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | that don't exist. Anecdotal evidence indicates that it is better to return 011b (bad LUN) than 001b (LUN offline). However, this change also gives the user a sysctl/tunable, kern.cam.ctl.inquiry_pq_no_lun, to override the change and return to the previous behavior. (The previous behavior was to return 001b, or LUN offline.) ctl.c: Change the default inquiry peripheral qualifier to 011b, and add a sysctl and tunable to allow the user to change it back to 001b if needed. Don't insert a Copan copyright statement in the inquiry data. The copyright statements on the files are sufficient. ctl_private.h: Add sysctl variable context to the CTL softc. ctl_cmd_table.c, ctl_frontend_internal.c, ctl_frontend.c, ctl_backend.c, ctl_error.c: Include sys/sysctl.h. MFC after: 3 days
* Add LUN resizing to CTL. Also make it possible to explicitly settrasz2012-03-061-0/+5
| | | | | | | size when creating file-backed or device-backed LUN. Reviewed by: ken (earlier version) Sponsored by: The FreeBSD Foundation
* Quiet some clang warnings when compiling CTL.ken2012-01-191-16/+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
* Add the CAM Target Layer (CTL).ken2012-01-121-0/+811
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
OpenPOWER on IntegriCloud