Sbp2 - Linux-2.4
(import from http://wiki.linux1394.org/sbp2_linux-2.4, last edited 2007-12-31)
Latest revision as of 22:10, 7 August 2008
sbp2 implements the Serial Bus Protocol (SBP-2) for storage devices. It is essentially a tunnel for SCSI. Therefore, sbp2 is a Linux SCSI low-level driver. Ironically, most SBP-2 devices implement an IDE bridge.
After loading/compiling scsi support and loading the sbp2 module, one must choose a high-level SCSI driver to work with the particular device: sd_mod (disk), st (tape), sr_mod (CD-ROM), and sg (generic/disc burner/scanner).
There is Linux Hotplugging support in the form of loading the sbp2 module when a sbp2 is plugged in. However, at this time, hotplug does not fully extend through the SCSI stack to provide the plug-and-play ease most users expect. This issue is correctly and automatically handled in kernel 2.6.
After scanning for new SCSI devices (see NOTE below), you may access any attached SBP-2 storage devices as if they were SCSI devices (e.g. mount /dev/sda1, fdisk, mkfs, etc.).
Currently, the SCSI subsystem in 2.4 kernels does not support per-device hotplug. In order to actually make SCSI "detect" plugged or unplugged SBP-2 devices, you must either use the procfs add-single-device, remove-single-device, or a shell script such as rescan-scsi-bus.sh.
After unplugging a SBP-2 device, run rescan-scsi-bus.sh -r or unload the sbp2 driver.
There is a workaround available to make linux 2.4 support better per-device hotplugging. You need to apply the scsi add/rem patch to your linux-2.4.20 or newer tree, and then uncomment the SBP2_USE_SCSI_ADDREM_HACK define in sbp2.c.
 Logical Unit Support
Support for multiple LUN devices is available in recent versions of the drivers. It should support both types of SBP-2 LUN entries. Because of how SBP-2 interfaces with the SCSI subsystem, LUNs will not show up as actual SCSI LUNs, but will instead show as discrete devices on the bus. This should not affect operability.
- Force max speed allowed.
- (3 = 800mb, 2 = 400mb, 1 = 200mb, 0 = 100mb. default = 3)
- Reduce this to work around bad controllers, bad cables, etc.
- Serialize all I/O coming down from the scsi drivers.
- (0 = deserialized, 1 = serialized, default = 0 in old kernels, 1 in new kernels)
- Always use sbp2_serialize_io=1. There are bugs in sbp2 when running with sbp2_serialize_io=0.
- Change max sectors per I/O supported
- (default = 255)
- The default value is safe for older SBP-2 bridges. You may gain some performance by raising this value.
- (default = 1)
- Set to zero if you'd like to allow multiple hosts the ability to log in at the same time, e.g. modprobe sbp2 sbp2_exclusive_login=0. Sbp2 device must support this, and you must know what you're doing. Useful for clustered storage systems.
- Force SCSI inquiry hack
- (default = 0)
- Try this if the driver cannot login to a device. Give notice to the linux1394-devel mailing list if you find a device that requires this.
- SCSI support (scsi_mod)
- ohci1394 or pcilynx
See the SCSI HOWTO for more information.
Entries are added under /dev/scsi/host?/bus0/target0/lun0/ depending upon the high-level SCSI driver: e.g., generic, disc, part1, cd.
See the SCSI HOWTO for more information.
/proc/scsi/sbp2/0, /proc/scsi/sbp2/1, etc.
You may manually add/remove SBP-2 devices via the procfs with add-single-device <h> <b> <t> <l> or remove-single-device <h> <b> <t> <l>, where:
- <h> = host (starting at zero for first SCSI adapter)
- <b> = bus (normally zero)
- <t> = target (starting at zero for first SBP-2 device)
- <l> = lun (normally zero)
e.g. To manually add/detect a new SBP-2 device
echo "scsi add-single-device 0 0 0 0" > /proc/scsi/scsi
e.g. To manually remove a SBP-2 device after it's been unplugged
echo "scsi remove-single-device 0 0 0 0" > /proc/scsi/scsi
e.g. To check to see which SBP-2/SCSI devices are currently registered
 Known Problems
- Error Handling: SCSI aborts and bus reset requests are handled somewhat but the code needs additional debugging.
- Hot-plugging: Support for hotplug in 2.4 is not supported by the SCSI stack. See the hotplug section for details.
See the SCSI HOWTO.
Oracle is using Linux1394 sbp2 with its Oracle Cluster File System.