요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
=====================
SCSI Interfaces Guide
=====================
:Author: James Bottomley
:Author: Rob Landley
Introduction
============
Protocol vs bus
---------------
Once upon a time, the Small Computer Systems Interface defined both a
parallel I/O bus and a data protocol to connect a wide variety of
peripherals (disk drives, tape drives, modems, printers, scanners,
optical drives, test equipment, and medical devices) to a host computer.
Although the old parallel (fast/wide/ultra) SCSI bus has largely fallen
out of use, the SCSI command set is more widely used than ever to
communicate with devices over a number of different buses.
The `SCSI protocol <https://www.t10.org/scsi-3.htm>`__ is a big-endian
peer-to-peer packet based protocol. SCSI commands are 6, 10, 12, or 16
bytes long, often followed by an associated data payload.
SCSI commands can be transported over just about any kind of bus, and
are the default protocol for storage devices attached to USB, SATA, SAS,
Fibre Channel, FireWire, and ATAPI devices. SCSI packets are also
commonly exchanged over Infiniband,
TCP/IP (`iSCSI <https://en.wikipedia.org/wiki/ISCSI>`__), even `Parallel
ports <http://cyberelk.net/tim/parport/parscsi.html>`__.
Design of the Linux SCSI subsystem
----------------------------------
The SCSI subsystem uses a three layer design, with upper, mid, and low
layers. Every operation involving the SCSI subsystem (such as reading a
sector from a disk) uses one driver at each of the 3 levels: one upper
layer driver, one lower layer driver, and the SCSI midlayer.
The SCSI upper layer provides the interface between userspace and the
kernel, in the form of block and char device nodes for I/O and ioctl().
The SCSI lower layer contains drivers for specific hardware devices.
In between is the SCSI mid-layer, analogous to a network routing layer
such as the IPv4 stack. The SCSI mid-layer routes a packet based data
protocol between the upper layer's /dev nodes and the corresponding
devices in the lower layer. It manages command queues, provides error
handling and power management functions, and responds to ioctl()
requests.
SCSI upper layer
================
The upper layer supports the user-kernel interface by providing device
nodes.
sd (SCSI Disk)
--------------
sd (sd_mod.o)
sr (SCSI CD-ROM)
----------------
sr (sr_mod.o)
st (SCSI Tape)
--------------
st (st.o)
sg (SCSI Generic)
-----------------
sg (sg.o)
ch (SCSI Media Changer)
-----------------------
ch (ch.c)
SCSI mid layer
==============
SCSI midlayer implementation
----------------------------
include/scsi/scsi_device.h
~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. kernel-doc:: include/scsi/scsi_device.h
:internal:
drivers/scsi/scsi.c
~~~~~~~~~~~~~~~~~~~
Main file for the SCSI midlayer.
.. kernel-doc:: drivers/scsi/scsi.c
:export:
drivers/scsi/scsicam.c
~~~~~~~~~~~~~~~~~~~~~~
`SCSI Common Access
Method <http://www.t10.org/ftp/t10/drafts/cam/cam-r12b.pdf>`__ support
functions, for use with HDIO_GETGEO, etc.
.. kernel-doc:: drivers/scsi/scsicam.c
:export:
drivers/scsi/scsi_error.c
~~~~~~~~~~~~~~~~~~~~~~~~~~
Common SCSI error/timeout handling routines.
.. kernel-doc:: drivers/scsi/scsi_error.c
:export:
drivers/scsi/scsi_devinfo.c
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Manage scsi_dev_info_list, which tracks blacklisted and whitelisted
devices.
.. kernel-doc:: drivers/scsi/scsi_devinfo.c
:export:
drivers/scsi/scsi_ioctl.c
~~~~~~~~~~~~~~~~~~~~~~~~~~
Handle ioctl() calls for SCSI devices.
.. kernel-doc:: drivers/scsi/scsi_ioctl.c
:export:
drivers/scsi/scsi_lib.c
~~~~~~~~~~~~~~~~~~~~~~~~
SCSI queuing library.
.. kernel-doc:: drivers/scsi/scsi_lib.c
:export:
drivers/scsi/scsi_lib_dma.c
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SCSI library functions depending on DMA (map and unmap scatter-gather
lists).
.. kernel-doc:: drivers/scsi/scsi_lib_dma.c
:export:
drivers/scsi/scsi_proc.c
~~~~~~~~~~~~~~~~~~~~~~~~~
The functions in this file provide an interface between the PROC file
system and the SCSI device drivers It is mainly used for debugging,
statistics and to pass information directly to the lowlevel driver. I.E.
plumbing to manage /proc/scsi/\*
.. kernel-doc:: drivers/scsi/scsi_proc.c
drivers/scsi/scsi_netlink.c
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Infrastructure to provide async events from transports to userspace via
netlink, using a single NETLINK_SCSITRANSPORT protocol for all
transports. See `the original patch submission
<https://lore.kernel.org/linux-scsi/[email protected]/>`__
for more details.
.. kernel-doc:: drivers/scsi/scsi_netlink.c
:internal:
drivers/scsi/scsi_scan.c
~~~~~~~~~~~~~~~~~~~~~~~~~
Scan a host to determine which (if any) devices are attached. The
general scanning/probing algorithm is as follows, exceptions are made to
it depending on device specific flags, compilation options, and global
variable (boot or module load time) settings. A specific LUN is scanned
via an INQUIRY command; if the LUN has a device attached, a scsi_device
is allocated and setup for it. For every id of every channel on the
given host, start by scanning LUN 0. Skip hosts that don't respond at
all to a scan of LUN 0. Otherwise, if LUN 0 has a device attached,
allocate and setup a scsi_device for it. If target is SCSI-3 or up,
issue a REPORT LUN, and scan all of the LUNs returned by the REPORT LUN;
else, sequentially scan LUNs up until some maximum is reached, or a LUN
is seen that cannot have a device attached to it.
.. kernel-doc:: drivers/scsi/scsi_scan.c
:export:
drivers/scsi/scsi_sysctl.c
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Set up the sysctl entry: "/dev/scsi/logging_level"
(DEV_SCSI_LOGGING_LEVEL) which sets/returns scsi_logging_level.
drivers/scsi/scsi_sysfs.c
~~~~~~~~~~~~~~~~~~~~~~~~~~
SCSI sysfs interface routines.
.. kernel-doc:: drivers/scsi/scsi_sysfs.c
:export:
drivers/scsi/hosts.c
~~~~~~~~~~~~~~~~~~~~
mid to lowlevel SCSI driver interface
.. kernel-doc:: drivers/scsi/hosts.c
:export:
drivers/scsi/scsi_common.c
~~~~~~~~~~~~~~~~~~~~~~~~~~
general support functions
.. kernel-doc:: drivers/scsi/scsi_common.c
:export:
Transport classes
-----------------
Transport classes are service libraries for drivers in the SCSI lower
layer, which expose transport attributes in sysfs.
Fibre Channel transport
~~~~~~~~~~~~~~~~~~~~~~~
The file drivers/scsi/scsi_transport_fc.c defines transport attributes
for Fibre Channel.
.. kernel-doc:: drivers/scsi/scsi_transport_fc.c
:export:
iSCSI transport class
~~~~~~~~~~~~~~~~~~~~~
The file drivers/scsi/scsi_transport_iscsi.c defines transport
attributes for the iSCSI class, which sends SCSI packets over TCP/IP
connections.
.. kernel-doc:: drivers/scsi/scsi_transport_iscsi.c
:export:
Serial Attached SCSI (SAS) transport class
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The file drivers/scsi/scsi_transport_sas.c defines transport
attributes for Serial Attached SCSI, a variant of SATA aimed at large
high-end systems.
The SAS transport class contains common code to deal with SAS HBAs, an
approximated representation of SAS topologies in the driver model, and
various sysfs attributes to expose these topologies and management
interfaces to userspace.
In addition to the basic SCSI core objects this transport class
introduces two additional intermediate objects: The SAS PHY as
represented by struct sas_phy defines an "outgoing" PHY on a SAS HBA or
Expander, and the SAS remote PHY represented by struct sas_rphy defines
an "incoming" PHY on a SAS Expander or end device. Note that this is
purely a software concept, the underlying hardware for a PHY and a
remote PHY is the exactly the same.
There is no concept of a SAS port in this code, users can see what PHYs
form a wide port based on the port_identifier attribute, which is the
same for all PHYs in a port.
.. kernel-doc:: drivers/scsi/scsi_transport_sas.c
:export:
SATA transport class
~~~~~~~~~~~~~~~~~~~~
The SATA transport is handled by libata, which has its own book of
documentation in this directory.
Parallel SCSI (SPI) transport class
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The file drivers/scsi/scsi_transport_spi.c defines transport
attributes for traditional (fast/wide/ultra) SCSI buses.
.. kernel-doc:: drivers/scsi/scsi_transport_spi.c
:export:
SCSI RDMA (SRP) transport class
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The file drivers/scsi/scsi_transport_srp.c defines transport
attributes for SCSI over Remote Direct Memory Access.
.. kernel-doc:: drivers/scsi/scsi_transport_srp.c
:export:
SCSI lower layer
================
Host Bus Adapter transport types
--------------------------------
Many modern device controllers use the SCSI command set as a protocol to
communicate with their devices through many different types of physical
connections.
In SCSI language a bus capable of carrying SCSI commands is called a
"transport", and a controller connecting to such a bus is called a "host
bus adapter" (HBA).
Debug transport
~~~~~~~~~~~~~~~
The file drivers/scsi/scsi_debug.c simulates a host adapter with a
variable number of disks (or disk like devices) attached, sharing a
common amount of RAM. Does a lot of checking to make sure that we are
not getting blocks mixed up, and panics the kernel if anything out of
the ordinary is seen.
To be more realistic, the simulated devices have the transport
attributes of SAS disks.
For documentation see http://sg.danny.cz/sg/scsi_debug.html
todo
~~~~
Parallel (fast/wide/ultra) SCSI, USB, SATA, SAS, Fibre Channel,
FireWire, ATAPI devices, Infiniband, Parallel ports,
netlink...
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
SCSI Interfaces Guide 문서 정보
1-7이 문서는 Linux SCSI interface를 안내하며 저자는 James Bottomley와 Rob Landley입니다.
=====================
SCSI Interfaces Guide
=====================
:Author: James Bottomley
:Author: Rob Landley
SCSI protocol과 bus의 분리
8-33Small Computer Systems Interface는 처음에 host computer와 disk, tape, modem, printer, scanner, optical drive, test equipment, medical device 등 다양한 peripheral을 연결하는 parallel I/O bus와 data protocol을 함께 정의했습니다.
기존 parallel fast/wide/ultra SCSI bus는 대부분 사용되지 않지만, SCSI command set은 여러 bus를 통해 device와 통신하는 protocol로 과거보다 더 널리 쓰입니다.
SCSI protocol은 big-endian peer-to-peer packet protocol입니다. Command 길이는 6, 10, 12 또는 16 byte이며 뒤에 관련 data payload가 이어지는 경우가 많습니다.
SCSI command는 거의 모든 종류의 bus로 운반할 수 있습니다. USB, SATA, SAS, Fibre Channel, FireWire, ATAPI storage device의 기본 protocol이며 Infiniband, TCP/IP의 iSCSI, 심지어 parallel port에서도 SCSI packet을 교환합니다.
Command set은 특정 물리 bus와 분리되어 다양한 transport 위에서 동작합니다.
Introduction
============
Protocol vs bus
---------------
Once upon a time, the Small Computer Systems Interface defined both a
parallel I/O bus and a data protocol to connect a wide variety of
peripherals (disk drives, tape drives, modems, printers, scanners,
optical drives, test equipment, and medical devices) to a host computer.
Although the old parallel (fast/wide/ultra) SCSI bus has largely fallen
out of use, the SCSI command set is more widely used than ever to
communicate with devices over a number of different buses.
The `SCSI protocol <https://www.t10.org/scsi-3.htm>`__ is a big-endian
peer-to-peer packet based protocol. SCSI commands are 6, 10, 12, or 16
bytes long, often followed by an associated data payload.
SCSI commands can be transported over just about any kind of bus, and
are the default protocol for storage devices attached to USB, SATA, SAS,
Fibre Channel, FireWire, and ATAPI devices. SCSI packets are also
commonly exchanged over Infiniband,
TCP/IP (`iSCSI <https://en.wikipedia.org/wiki/ISCSI>`__), even `Parallel
ports <http://cyberelk.net/tim/parport/parscsi.html>`__.
Linux SCSI 3-layer 설계
34-52SCSI subsystem은 upper, mid, low의 세 layer로 설계됩니다. Disk sector 읽기 같은 모든 operation은 upper-layer driver 하나, lower-layer driver 하나, SCSI mid-layer를 모두 사용합니다.
Upper layer는 I/O와 `ioctl()`을 위한 block·character device node 형태로 userspace와 kernel 사이 interface를 제공합니다. Lower layer에는 특정 hardware device용 driver가 있습니다.
사이의 SCSI mid-layer는 IPv4 stack 같은 network routing layer와 유사합니다. Upper layer의 `/dev` node와 lower-layer device 사이에서 packet protocol을 route하고 command queue, error handling, power management를 관리하며 `ioctl()` 요청에 응답합니다.
각 operation은 userspace device class, 공통 mid-layer, hardware-specific lower driver를 모두 통과합니다.
Design of the Linux SCSI subsystem
----------------------------------
The SCSI subsystem uses a three layer design, with upper, mid, and low
layers. Every operation involving the SCSI subsystem (such as reading a
sector from a disk) uses one driver at each of the 3 levels: one upper
layer driver, one lower layer driver, and the SCSI midlayer.
The SCSI upper layer provides the interface between userspace and the
kernel, in the form of block and char device nodes for I/O and ioctl().
The SCSI lower layer contains drivers for specific hardware devices.
In between is the SCSI mid-layer, analogous to a network routing layer
such as the IPv4 stack. The SCSI mid-layer routes a packet based data
protocol between the upper layer's /dev nodes and the corresponding
devices in the lower layer. It manages command queues, provides error
handling and power management functions, and responds to ioctl()
requests.
SCSI upper-layer device class
53-83Upper layer는 device node를 제공해 user-kernel interface를 지원합니다.
주요 upper driver는 SCSI disk용 `sd`(`sd_mod.o`), CD-ROM용 `sr`(`sr_mod.o`), tape용 `st`(`st.o`), generic command용 `sg`(`sg.o`), media changer용 `ch`(`ch.c`)입니다.
SCSI upper layer
================
The upper layer supports the user-kernel interface by providing device
nodes.
sd (SCSI Disk)
--------------
sd (sd_mod.o)
sr (SCSI CD-ROM)
----------------
sr (sr_mod.o)
st (SCSI Tape)
--------------
st (st.o)
sg (SCSI Generic)
-----------------
sg (sg.o)
ch (SCSI Media Changer)
-----------------------
ch (ch.c)
Mid-layer core structure와 main file
84-103SCSI mid-layer 구현의 device abstraction은 `include/scsi/scsi_device.h`에 있으며 kernel-doc은 internal declaration을 가져옵니다.
`drivers/scsi/scsi.c`는 SCSI mid-layer의 main file이며 exported function을 문서화합니다.
SCSI mid layer
==============
SCSI midlayer implementation
----------------------------
include/scsi/scsi_device.h
~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. kernel-doc:: include/scsi/scsi_device.h
:internal:
drivers/scsi/scsi.c
~~~~~~~~~~~~~~~~~~~
Main file for the SCSI midlayer.
.. kernel-doc:: drivers/scsi/scsi.c
:export:
CAM support와 error handling
104-121`drivers/scsi/scsicam.c`는 `HDIO_GETGEO` 등에 사용하는 SCSI Common Access Method(CAM) support function을 제공하며 exported API를 문서화합니다.
`drivers/scsi/scsi_error.c`는 공통 SCSI error와 timeout handling routine을 제공하며 exported API를 문서화합니다.
drivers/scsi/scsicam.c
~~~~~~~~~~~~~~~~~~~~~~
`SCSI Common Access
Method <http://www.t10.org/ftp/t10/drafts/cam/cam-r12b.pdf>`__ support
functions, for use with HDIO_GETGEO, etc.
.. kernel-doc:: drivers/scsi/scsicam.c
:export:
drivers/scsi/scsi_error.c
~~~~~~~~~~~~~~~~~~~~~~~~~~
Common SCSI error/timeout handling routines.
.. kernel-doc:: drivers/scsi/scsi_error.c
:export:
Device info, ioctl과 queue library
122-145`drivers/scsi/scsi_devinfo.c`는 blacklist와 whitelist device를 추적하는 `scsi_dev_info_list`를 관리합니다.
`drivers/scsi/scsi_ioctl.c`는 SCSI device의 `ioctl()` call을 처리하고, `drivers/scsi/scsi_lib.c`는 SCSI queuing library를 제공합니다. 세 file의 exported API를 kernel-doc으로 가져옵니다.
drivers/scsi/scsi_devinfo.c
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Manage scsi_dev_info_list, which tracks blacklisted and whitelisted
devices.
.. kernel-doc:: drivers/scsi/scsi_devinfo.c
:export:
drivers/scsi/scsi_ioctl.c
~~~~~~~~~~~~~~~~~~~~~~~~~~
Handle ioctl() calls for SCSI devices.
.. kernel-doc:: drivers/scsi/scsi_ioctl.c
:export:
drivers/scsi/scsi_lib.c
~~~~~~~~~~~~~~~~~~~~~~~~
SCSI queuing library.
.. kernel-doc:: drivers/scsi/scsi_lib.c
:export:
DMA mapping과 /proc/scsi
146-165`drivers/scsi/scsi_lib_dma.c`는 scatter-gather list의 map·unmap처럼 DMA에 의존하는 SCSI library function을 제공합니다.
`drivers/scsi/scsi_proc.c`의 function은 PROC filesystem과 SCSI device driver 사이 interface를 제공합니다. 주로 debugging, statistics, low-level driver에 직접 정보 전달을 위해 사용하며 `/proc/scsi/*`를 관리하는 plumbing입니다.
drivers/scsi/scsi_lib_dma.c
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SCSI library functions depending on DMA (map and unmap scatter-gather
lists).
.. kernel-doc:: drivers/scsi/scsi_lib_dma.c
:export:
drivers/scsi/scsi_proc.c
~~~~~~~~~~~~~~~~~~~~~~~~~
The functions in this file provide an interface between the PROC file
system and the SCSI device drivers It is mainly used for debugging,
statistics and to pass information directly to the lowlevel driver. I.E.
plumbing to manage /proc/scsi/\*
.. kernel-doc:: drivers/scsi/scsi_proc.c
Transport async netlink event
166-177`drivers/scsi/scsi_netlink.c`는 transport의 asynchronous event를 netlink를 통해 userspace에 전달하는 infrastructure입니다.
모든 transport가 하나의 `NETLINK_SCSITRANSPORT` protocol을 사용합니다. 세부사항은 원래 patch submission에 있으며 kernel-doc은 file의 internal interface를 가져옵니다.
여러 transport의 async event가 공통 netlink protocol을 통해 userspace로 전달됩니다.
drivers/scsi/scsi_netlink.c
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Infrastructure to provide async events from transports to userspace via
netlink, using a single NETLINK_SCSITRANSPORT protocol for all
transports. See `the original patch submission
<https://lore.kernel.org/linux-scsi/[email protected]/>`__
for more details.
.. kernel-doc:: drivers/scsi/scsi_netlink.c
:internal:
Host scan과 LUN 탐색
178-196`drivers/scsi/scsi_scan.c`는 host에 연결된 device를 탐색합니다. 일반 algorithm은 device-specific flag, compile option, boot 또는 module load 시점의 global setting에 따라 예외가 생길 수 있습니다.
특정 LUN은 `INQUIRY` command로 scan하며 device가 있으면 `scsi_device`를 allocate하고 설정합니다. Host의 각 channel·ID에서 LUN 0부터 scan하고, LUN 0 scan에 전혀 응답하지 않는 host는 건너뜁니다.
LUN 0에 device가 있으면 `scsi_device`를 준비합니다. Target이 SCSI-3 이상이면 `REPORT LUN`을 발행해 반환된 모든 LUN을 scan합니다. 그보다 낮으면 maximum에 도달하거나 device를 붙일 수 없는 LUN이 나타날 때까지 LUN을 순차적으로 scan합니다.
LUN 0 응답과 target revision에 따라 REPORT LUN 또는 sequential scan 경로를 선택합니다.
drivers/scsi/scsi_scan.c
~~~~~~~~~~~~~~~~~~~~~~~~~
Scan a host to determine which (if any) devices are attached. The
general scanning/probing algorithm is as follows, exceptions are made to
it depending on device specific flags, compilation options, and global
variable (boot or module load time) settings. A specific LUN is scanned
via an INQUIRY command; if the LUN has a device attached, a scsi_device
is allocated and setup for it. For every id of every channel on the
given host, start by scanning LUN 0. Skip hosts that don't respond at
all to a scan of LUN 0. Otherwise, if LUN 0 has a device attached,
allocate and setup a scsi_device for it. If target is SCSI-3 or up,
issue a REPORT LUN, and scan all of the LUNs returned by the REPORT LUN;
else, sequentially scan LUNs up until some maximum is reached, or a LUN
is seen that cannot have a device attached to it.
.. kernel-doc:: drivers/scsi/scsi_scan.c
:export:
Logging, sysfs와 host interface
197-226`drivers/scsi/scsi_sysctl.c`는 `scsi_logging_level`을 설정하거나 반환하는 sysctl entry `/dev/scsi/logging_level`(`DEV_SCSI_LOGGING_LEVEL`)을 준비합니다.
`drivers/scsi/scsi_sysfs.c`는 SCSI sysfs interface routine을, `drivers/scsi/hosts.c`는 mid-layer와 low-level SCSI driver 사이 interface를, `drivers/scsi/scsi_common.c`는 일반 support function을 제공합니다.
drivers/scsi/scsi_sysctl.c
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Set up the sysctl entry: "/dev/scsi/logging_level"
(DEV_SCSI_LOGGING_LEVEL) which sets/returns scsi_logging_level.
drivers/scsi/scsi_sysfs.c
~~~~~~~~~~~~~~~~~~~~~~~~~~
SCSI sysfs interface routines.
.. kernel-doc:: drivers/scsi/scsi_sysfs.c
:export:
drivers/scsi/hosts.c
~~~~~~~~~~~~~~~~~~~~
mid to lowlevel SCSI driver interface
.. kernel-doc:: drivers/scsi/hosts.c
:export:
drivers/scsi/scsi_common.c
~~~~~~~~~~~~~~~~~~~~~~~~~~
general support functions
.. kernel-doc:: drivers/scsi/scsi_common.c
:export:
Transport class와 Fibre Channel
227-241Transport class는 SCSI lower-layer driver를 위한 service library이며 transport attribute를 sysfs에 노출합니다.
`drivers/scsi/scsi_transport_fc.c`는 Fibre Channel transport attribute를 정의하고 exported API를 제공합니다.
Transport-specific library가 lower driver의 topology와 attribute를 공통 sysfs model로 노출합니다.
Transport classes
-----------------
Transport classes are service libraries for drivers in the SCSI lower
layer, which expose transport attributes in sysfs.
Fibre Channel transport
~~~~~~~~~~~~~~~~~~~~~~~
The file drivers/scsi/scsi_transport_fc.c defines transport attributes
for Fibre Channel.
.. kernel-doc:: drivers/scsi/scsi_transport_fc.c
:export:
iSCSI transport class
242-251`drivers/scsi/scsi_transport_iscsi.c`는 TCP/IP connection으로 SCSI packet을 보내는 iSCSI class의 transport attribute를 정의합니다.
iSCSI transport class
~~~~~~~~~~~~~~~~~~~~~
The file drivers/scsi/scsi_transport_iscsi.c defines transport
attributes for the iSCSI class, which sends SCSI packets over TCP/IP
connections.
.. kernel-doc:: drivers/scsi/scsi_transport_iscsi.c
:export:
SAS transport topology model
252-278`drivers/scsi/scsi_transport_sas.c`는 대형 high-end system을 대상으로 한 SATA variant인 Serial Attached SCSI의 transport attribute를 정의합니다.
SAS transport class는 SAS HBA를 다루는 공통 code, driver model 안의 근사 SAS topology 표현, topology와 management interface를 userspace에 노출하는 여러 sysfs attribute를 포함합니다.
기본 SCSI core object 외에 두 intermediate object를 추가합니다. `struct sas_phy`의 SAS PHY는 HBA 또는 expander의 outgoing PHY를, `struct sas_rphy`의 SAS remote PHY는 expander 또는 end device의 incoming PHY를 나타냅니다. 이는 순수 software concept이며 PHY와 remote PHY의 실제 hardware는 완전히 같습니다.
이 code에는 SAS port object 개념이 없습니다. 사용자는 같은 port의 모든 PHY가 공유하는 `port_identifier` attribute로 wide port를 구성하는 PHY를 알 수 있습니다.
동일한 물리 PHY를 방향별 software object로 표현하고 port_identifier로 wide port membership을 노출합니다.
Serial Attached SCSI (SAS) transport class
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The file drivers/scsi/scsi_transport_sas.c defines transport
attributes for Serial Attached SCSI, a variant of SATA aimed at large
high-end systems.
The SAS transport class contains common code to deal with SAS HBAs, an
approximated representation of SAS topologies in the driver model, and
various sysfs attributes to expose these topologies and management
interfaces to userspace.
In addition to the basic SCSI core objects this transport class
introduces two additional intermediate objects: The SAS PHY as
represented by struct sas_phy defines an "outgoing" PHY on a SAS HBA or
Expander, and the SAS remote PHY represented by struct sas_rphy defines
an "incoming" PHY on a SAS Expander or end device. Note that this is
purely a software concept, the underlying hardware for a PHY and a
remote PHY is the exactly the same.
There is no concept of a SAS port in this code, users can see what PHYs
form a wide port based on the port_identifier attribute, which is the
same for all PHYs in a port.
.. kernel-doc:: drivers/scsi/scsi_transport_sas.c
:export:
SATA와 Parallel SCSI transport
279-293SATA transport는 libata가 처리하며 이 directory에 별도의 documentation book이 있습니다.
`drivers/scsi/scsi_transport_spi.c`는 전통적인 fast/wide/ultra SCSI bus의 Parallel SCSI(SPI) transport attribute를 정의하고 exported API를 제공합니다.
SATA transport class
~~~~~~~~~~~~~~~~~~~~
The SATA transport is handled by libata, which has its own book of
documentation in this directory.
Parallel SCSI (SPI) transport class
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The file drivers/scsi/scsi_transport_spi.c defines transport
attributes for traditional (fast/wide/ultra) SCSI buses.
.. kernel-doc:: drivers/scsi/scsi_transport_spi.c
:export:
SCSI RDMA transport
294-302`drivers/scsi/scsi_transport_srp.c`는 Remote Direct Memory Access 위에서 SCSI를 운반하는 SCSI RDMA(SRP) transport attribute를 정의합니다.
SCSI RDMA (SRP) transport class
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The file drivers/scsi/scsi_transport_srp.c defines transport
attributes for SCSI over Remote Direct Memory Access.
.. kernel-doc:: drivers/scsi/scsi_transport_srp.c
:export:
SCSI lower layer와 HBA
303-316많은 현대 device controller는 여러 종류의 물리 connection을 통해 device와 통신할 때 SCSI command set을 protocol로 사용합니다.
SCSI 용어에서 SCSI command를 운반할 수 있는 bus를 transport라 하고, 그런 bus에 연결되는 controller를 host bus adapter(HBA)라고 합니다.
Hardware-specific HBA가 물리 connection을 통해 SCSI command transport에 연결됩니다.
SCSI lower layer
================
Host Bus Adapter transport types
--------------------------------
Many modern device controllers use the SCSI command set as a protocol to
communicate with their devices through many different types of physical
connections.
In SCSI language a bus capable of carrying SCSI commands is called a
"transport", and a controller connecting to such a bus is called a "host
bus adapter" (HBA).
scsi_debug simulated host
317-330`drivers/scsi/scsi_debug.c`는 공통 RAM 영역을 공유하는 가변 개수의 disk 또는 disk-like device가 연결된 host adapter를 simulation합니다.
Block이 섞이지 않는지 광범위하게 검사하며 이상한 상태가 보이면 kernel panic을 발생시킵니다. 더 현실적인 simulation을 위해 device는 SAS disk transport attribute를 가집니다.
추가 문서는 `http://sg.danny.cz/sg/scsi_debug.html`을 참조합니다.
가상 HBA와 여러 disk가 공통 RAM을 사용하며 consistency check로 비정상 block mapping을 검출합니다.
Debug transport
~~~~~~~~~~~~~~~
The file drivers/scsi/scsi_debug.c simulates a host adapter with a
variable number of disks (or disk like devices) attached, sharing a
common amount of RAM. Does a lot of checking to make sure that we are
not getting blocks mixed up, and panics the kernel if anything out of
the ordinary is seen.
To be more realistic, the simulated devices have the transport
attributes of SAS disks.
For documentation see http://sg.danny.cz/sg/scsi_debug.html
문서화 TODO
331-336추가 문서화가 필요한 항목으로 parallel fast/wide/ultra SCSI, USB, SATA, SAS, Fibre Channel, FireWire, ATAPI, Infiniband, parallel port와 netlink가 나열되어 있습니다.
todo
~~~~
Parallel (fast/wide/ultra) SCSI, USB, SATA, SAS, Fibre Channel,
FireWire, ATAPI devices, Infiniband, Parallel ports,
netlink...
요약과 해설
scsi.rst:1-336Linux SCSI subsystem은 userspace device class, command routing과 queue·error·scan을 맡는 mid-layer, hardware HBA를 다루는 lower layer로 구성됩니다. Mid-layer source별 역할과 FC·iSCSI·SAS·SPI·SRP transport attribute, SAS topology object, `scsi_debug` simulation까지 원문 순서대로 정리합니다.