CAM SCSI layer

yuri mironoff (yuri@buster.rgti.com)
Wed, 17 Dec 1997 12:28:15 -0500 (EST)


Is something like this planned for Linux? (The FEATURES cause me to
salivate ;)) Can it be ported?

Y.

Subject: 971208 CAM Snapshot Available
Date: Mon, 08 Dec 1997 21:13:29 -0700
From: "Justin T. Gibbs" <gibbs@narnia.plutotech.com>
Bcc: Blind Distribution List: ;

Common Access Method SCSI layer Patches Available

[snip]

"What is CAM? and why would I want it?"

CAM is an ANSI ratified spec that defines a software interface for talking
to SCSI and ATAPI devices. This new SCSI layer for FreeBSD is not strictly
CAM compliant, but follows many of the precepts of CAM. More importantly,
this work addresses many of the short comings of the previous SCSI layer
and should provide better performance, reliability, and ease the task of
adding support for new controllers.

[snip]

Features:

Round-robin, per priority level scheduling of devices and their
resources.

I/O Completion, error recovery, and processing queued I/O is
performed in a separate software interrupt handler. The old
system had the potential of blocking out hardware interrupts
for lengthy periods as much of this processing occurred as the
result of a call from the controller's interrupt handler.

The generic SCSI layer now understands tagged I/O and exports
this functionality to the peripheral drivers. This allows drivers
like the "direct access" driver to perform ordered tagged
transactions for meta-data writes. Async, ordered, meta-data
writes are now enabled in vfs_bio.c

The "direct access" driver prevents "tag starvation" from occurring
by guaranteeing that at least one write in every 5 second period
to a tagged queuing device has an ordered tag. This removes the
need for individual controller drivers to worry about this problem.

Complete and controller independent handling of the "QUEUE FULL" and
"BUSY" status codes. The number of tags that are queued to a
device are dynamically adjusted by the generic layer.

Interrupt driven sub-device probing. At boot time, all buses are
probed in parallel yielding a much faster boot. As probing occurs
after all interrupt and timer services are available, no additional
(and often error prone) "polling" code is needed in each controller
driver.

Better error recovery. When an error occurs, the queue of
transactions to the erring device is "frozen", full status is
reported back to the peripheral driver, and the peripheral driver
can recover the device without perturbing queued up I/O. As
all transactions have an associated priority and generation count,
after recovery is complete, transactions that are retried are
automatically re-queued in their original order.

All error handling is performed based on a detected failure.
The old code would often perform actions "just in case" before
accessing a device as the error recovery mechanism was inadequate.
Now, for example, if your disk spins down, the system will properly
recover even if the device is already open.

Support for "high power" commands. Peripheral drivers can mark
actions that may tax a power supply as "high powered". Only a
certain number (default of 4, but configurable with the
CAM_MAX_HIGHPOWER kernel option) of these commands are allowed
to be active at a time. This allows a user to, for example,
disable spin-up on the drives in an enclosure and let the system
spin them up in a controlled fashion.

By default, all luns are scanned on devices during probe. In the
old SCSI layer, this was often problematic as it performed a
Test Unit Ready prior to performing an Identify. Many devices
that properly handle the Identify will hang the bus if you attempt
a different command to a high lun.

Transfer negotiations only occurs to devices that actually
support negotiations (based on their inquiry information).
This is performed in a controller independent fashion.

There is now a generic quirk mechanism that allows controllers,
peripheral drivers, or the CAM transport layer to define their
own quirks entries. Currently the CAM transport layer has
quirk entries that allow for modulation of tags and disabling
multi-lun probing. The AdvanSys driver uses quirk entries to
control some of the "hardware bug fixes" in the driver that only
apply to certain types of devices.

Hard-wiring of devices to specific unit numbers is supported
as it was in the old system.

Userland "pass-through" commands are supported. The interface is
different than from the old SCSI code, but sample code is
provided (including patches to XMCD), and we do plan to provide
a scsi.8 command in the future.

[snip]