# SCST

SCST is a GPL licensed SCSI target software stack. The design goals of this software stack are high performance, high reliability, strict conformance to existing SCSI standards, being easy to extend and easy to use. SCST does not only support multiple SCSI protocols (iSCSI, FC, SRP, ...) but also supports multiple local storage interfaces (SCSI pass-through, block I/O and file I/O) and also storage drivers implemented in user-space via the scst_user driver.
In order to reach maximum performance SCST has been implemented as a set of kernel drivers. SCST is often combined with RAID, data deduplication and/or high-availability cluster software to augment its functionality. The SCST software stack is the basis software of many SAN systems. Several world records have been set with SAN systems based on SCST.
SCST competes with LIO Target for the same purpose of providing a generic SCSI target module inside the Linux kernel. For the narrower purpose providing a Linux iSCSI target, the older IET and STGT modules also enjoy industry support.
Between 2013 and 2017 SCST was primarily maintained by SanDisk personnel, after Fusion-io acquired the start-up ID7 in 2013, a driving force behind SCST and after SanDisk acquired Fusion-io in 2014.

## Architecture

SCST consists of three groups of modules:
* The SCST core, a protocol-independent engine for processing SCSI commands.
* Target drivers which receive SCSI commands from a SCSI initiator, pass these SCSI to the SCST core and send back replies to the initiator.
* Storage drivers a.k.a. device handlers which interact with the storage medium. The supported local storage interfaces are SCSI, block device, file and scst_user. scst_user is an SCST-specific protocol that allows efficient implementation of storage drivers in user space.
Configuration of all these modules happens via a sysfs interface. Although direct configuration of SCST via its sysfs interface is convenient, the tool called scstadmin allows to control SCST via its sysfs interface and also to save and restore the SCST configuration.
The following design aspects help SCST to reach the high performance this project is known for:
* The number of threads per storage device that processes SCSI commands is configurable.
* All target driver and storage driver functions invoked by the SCST core are asynchronous, at least when the Linux kernel allows this. It is e.g. not yet possible to perform asynchronous or direct I/O from inside the Linux kernel.
* One finite-state machine is associated with each SCSI command. This allows a single command thread to process multiple SCSI commands concurrently.
* Even when using multiple threads per storage device all these threads share the same I/O scheduler context. This sharing improves performance significantly when using e.g. the CFQ I/O scheduler.
* A scatter-gather vector cache. This cache avoids having to allocate memory via the kernel for each SCSI command.
* Lockless access to certain data structures needed to process SCSI commands. This also means that I/O has to be suspended before any of the data structures that are accessed without locking can be modified.
* SCSI commands can be submitted by a target driver to the SCST core from softirq context. This results in a lower number of context switches compared to having to submit SCSI commands from thread context.

## History

In the year 2000 a SCSI target framework was developed by the University of New Hampshire InterOperability Laboratory (UNH-IOL). Although the UNH-IOL SCSI target implementation only supports the iSCSI protocol, it was designed such that support for other storage protocols would be easy to add.
In 2004 the SCST project was announced, providing Fibre Channel and iSCSI support. The initial iSCSI target in SCST was based on the UNH-IOL iSCSI target implementation. Around that time an alternative iSCSI target software stack was developed by Ardis Technologies.
The iSCSI Enterprise Target software, announced in 2005, is a further evolution of the Ardis stack. Later in 2005 Chelsio announced an SCST iSCSI target driver for the Chelsio T2 Ethernet adapter family.
In 2006 a target driver for LSI/MPT cards was added. Later in this year the scstadmin tool was added. This tool allows to save and restore the SCST configuration from or to a file.
In 2007 the UNH-IOL iSCSI target patch in the SCST project was replaced by a fork of IET.
In 2008 an SRP target driver was donated by Mellanox. Later on this driver was optimized by Bart Van Assche.
In 2009 Marvell donated a target driver for their SAS cards.
Also in 2009 a target driver for Emulex Fibre Channel/FCoE adapter cards was announced by Emulex.
The same year a sysfs interface has been added to SCST next to the already existing procfs interface.
In 2010 an FCoE target driver was donated by Cisco and Bart Van Assche ported the IBM System p SCSI target driver to SCST.
In 2011 implicit ALUA support was added to the SCST core and to the scstadmin configuration tool. The three init scripts (scst, iscsi-scst and qla2x00t) were merged into a single init script, simplifying installation and management of SCST.
In 2013 support for QLogic InfiniBand HCA's was added in the SRP target driver.
In January 2014 Mellanox donated an iSER target driver implementation to the SCST project.
In May 2014 QLogic made a 16 Gbit/s QLogic target driver available and also announced to take over maintainership of the SCST QLogic target driver.
In 2016 support for asynchronous buffered and direct file I/O and also a more powerful latency measurement infrastructure were added.
In 2019 the SCST core was modified such that I/O keeps running at full speed if a LUN or storage device is added or removed.