The Linux SCSI Target Wiki

(Difference between revisions)
Jump to: navigation, search
m (Configuration)
Line 186: Line 186:
The 32-bit package should be built in <code>/usr/src/packages/RPMS/</code>.
The 32-bit package should be built in <code>/usr/src/packages/RPMS/</code>.
=== Configuration ===
=== Configure from lio-utils ==
Please see [Lio-utils_HOWTO#Configuring_the_Target] for creating a /sys/kernel/config/target/core/$HBA/$DEV/ group using tcm_node for PSCSI, IBLOCK, FILEIO and RAMDISK_DR backends.
=== Configuration from RTSAdmin ===
If [[RTSadmin]] is installed:
If [[RTSadmin]] is installed:

Revision as of 21:38, 14 February 2011

LIO Target
RisingTide Systems
QLogic Fibre Channel fabric module
Original author(s) Nicholas Bellinger
Developer(s) RisingTide Systems LLC
Initial release July 21, 2012 (2012-07-21)
Stable release 4.1.0 / June 20, 2012;
8 years ago
Preview release 4.2.0-rc5 / June 28, 2012;
8 years ago
Development status Beta
Written in C
Operating system Linux
Type Fabric module
License GNU General Public License
Website datera.io
See Target for a complete overview over all fabric modules.
TCM_QLA2xxx running at line rate HW target mode from with PCIe device passthrough with MSI-X polled interrupts across Linux/SCSI qla2xxx LLD request and response rings
TCM v4.0 QLAXXX prototype using PCIe device passthrough for target mode MSI-X interrupts, and QEMU Megasas HBA emulation into Windows7 64-bit guest.

This is the Fibre Channel fabric module (tcm_qla2xxx.ko) for the QLogic qla2xxx series ASICs and HBAs, and the accompanying qla2xxx LLD target mode logic, using the Target core infrastructure.

The latest version of the tcm_qla2xxx fabric module (tcm_qla2xxx) is for the Linux kernel v2.6.37-rc3. The QLA2XXX LLD target mode logic was refactored from the SCST qla2x00t driver, and contains a number of long overdue fixes and performance optimizations, including a modern LLD port of the qla2x00t-target logic (qla_target.c).



The QLogic driver is currently being hardened in the QLogic test labs.

Here's an overview over the status:

Test setup:


This code won't be included in Linux before kernel v2.6.39. However using Linux v2.6.38, this and other HW target mode modules will be able to function. The installation and setup instructions are below. Please just contact us for RTSadmin.

Getting the sources

Initial build: git setup

git clone lio-core from git://git.kernel.org/pub/scm/linux/kernel/git/nab/lio-core-2.6.git as follows:

git clone
cd lio-core-2.6
git checkout --track -b tcm_qla2xxx origin/tcm_qla2xxx
git pull origin tcm_qla2xxx
cp <your_working_config_file> .config
make menuconfig

In menuconfig:

Verify the following entries in the .config file (or make the corresponding changes):


If CONFIGFS_FS=y is set, a manual mount is required after the kernel boots:

mount -t configfs configfs /sys/kernel/config

Subsequent builds: git pull

Go to the directory where your lio-core kernel is located, and:

cd <lio-core-2.6>
git pull origin tcm_qla2xxx
make clean
make oldconfig


Kernel and modules:

make modules
make modules_install
make install


New Linux kernel

Use lio-core-2.6 kernel:

Normally, the latter is optional. But if /proc/meminfo shows vmalloc <128k, it fixes an issue with fcport_lport_map allocation seen by dmesg or in </code>/var/log/messages</code>. Note that 128m may be ok but too low, and 512m may be too high.

Then reboot:


and verify that the life kernel is indeed your new lio-core kernel:

uname -a 

Loading LIO Target

Verify the presence of the following required modules with modprobe: tcm_qla2xxx, target_core_mod, qla2xxx, iscsi_target_mod, configfs, e.g.:

modprobe tcm_qla2xxx

Normally all these modules should be loaded. If one is missing, you can load it as follows:

insmod fs/configfs/configfs.ko
# Or do the mount command as shown above (if .config file has CONFIGFS_FS=y)
insmod /drivers/target/target_core_mod.ko
insmod /drivers/target/iscsi_target_mod.ko
modprobe tcm_qla2xxx

Starting LIO Target

The target will be automatically started if lio-utils/RTSadmin-frozen is installed. Otherwise, start the target manually:

/etc/init.d/target start

To stop target:

/etc/init.d/target stop

To check the target status:

/etc/init.d/target status

User-space tools

There are two options: lio-utils and the RTSadmin-frozen packages; at the very minimum, lio-utils is required. RTSadmin requires the libreadline6 package to be installed, too. The links for these rpm packages are:

You can also build lio-utils.git in-house as follows. Install rpmbuild and a libsnmp*-dev package, then:

make user_rpms

The 32-bit package should be built in /usr/src/packages/RPMS/.

= Configure from lio-utils

Please see [Lio-utils_HOWTO#Configuring_the_Target] for creating a /sys/kernel/config/target/core/$HBA/$DEV/ group using tcm_node for PSCSI, IBLOCK, FILEIO and RAMDISK_DR backends.

Configuration from RTSAdmin

If RTSadmin is installed:

<rtsadmin> create hba fileio
<rtsadmin> create storage <mylun_name> /tmp/<myfile_name> <size>

Where, e.g.:

<rtsadmin> cfspath
  Current context object lives in
<rtsadmin> saveconfig
<rtsadmin> quit

At this point, there are still a few manual steps required, which will soon be incorporated into rtsadmin:

modprobe tcm_qla2xxx (if not already done earlier)
mkdir -p /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:31:4c:48/tpgt_1/lun/lun_0/
ln -s /sys/kernel/config/target/core/fileio_0/my_file/ /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:31:4c:48/tpgt_1/lun/lun_0/tcm_qla2xxx_port
echo 1 > /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:31:4c:48/tpgt_1/enable

Substitute the WWN portname (21:00:00:24:ff:31:4c:48) with your actual portname of the qla2xxx ISP, which can be obtained by:

cat /sys/class/fc_host/<host#>/port_name


fileio0/my_file(/tmp/my_file)> ls attribute



See QLogic/configFS for the ConfigFS and kernel ringbuffer output of a working qla2xxx driver.


lsmod output:

Module                  Size  Used by
tcm_qla2xxx            14850  4 
qla2xxx               328141  1 tcm_qla2xxx
target_core_stgt        6549  0 
target_core_pscsi      11530  0 
target_core_file        6533  1 
target_core_iblock      6772  0 
target_core_mod       199609  17 tcm_qla2xxx,target_core_stgt,target_core_pscsi,target_core_file,target_core_iblock
configfs               19657  2 target_core_mod
ipv6                  241067  18 

Interrupt stats

MSI-X interrupt stats for target side operation:

lenny64guest0:/usr/src/lio-core-2.6.git# cat /proc/interrupts | head -n 1 ; cat /proc/interrupts | grep qla2xxx
            CPU0       CPU1       CPU2       CPU3       
  43:      11697      11610      11951      11906   PCI-MSI-edge      qla2xxx (default)
  44:      14836      14922      14582      14628   PCI-MSI-edge      qla2xxx (rsp_q)


Kernel ring buffer

Initiator side ring buffer output during initiator login:

scsi34 : qla2xxx
qla2xxx 0000:02:00.0: LIP reset occurred (f8f7).
qla2xxx 0000:02:00.0: LIP occurred (f8f7).
qla2xxx 0000:02:00.0: LOOP UP detected (8 Gbps).
scsi 34:0:0:0: Direct-Access     LIO-ORG  RAMDISK-MCP      4.0  PQ: 0 ANSI: 5
sd 34:0:0:0: Attached scsi generic sg2 type 0
sd 34:0:0:0: [sdb] 819200 512-byte logical blocks: (419 MB/400 MiB)
sd 34:0:0:0: [sdb] Write Protect is off
sd 34:0:0:0: [sdb] Mode Sense: 2f 00 00 00
sd 34:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
 sdb: unknown partition table
sd 34:0:0:0: [sdb] Attached SCSI disk

Device identifiers

sg_inq -i initiator side output for EVPD=0x83 device identifiers:

truelife:/usr/src/qemu-kvm.git# sg_inq -i /dev/sdb
VPD INQUIRY: Device Identification page
  Designation descriptor number 1, descriptor length: 20
    id_type: NAA,  code_set: Binary
    associated with the addressed logical unit
      NAA 6, IEEE Company_id: 0x1405
      Vendor Specific Identifier: 0x7bb168f6d
      Vendor Specific Identifier Extension: 0x32edd42b3d9e26df
  Designation descriptor number 2, descriptor length: 61
    id_type: T10 vendor identification,  code_set: ASCII
    associated with the addressed logical unit
      vendor id: LIO-ORG
      vendor specific: RAMDISK-MCP:7bb168f6-32ed-42b3-9e26-fe6aab35460a
  Designation descriptor number 3, descriptor length: 8
    transport: Fibre Channel (FCP-2)
    id_type: Relative target port,  code_set: Binary
    associated with the target port
      Relative target port: 0x1
  Designation descriptor number 4, descriptor length: 8
    transport: Fibre Channel (FCP-2)
    id_type: Target port group,  code_set: Binary
    associated with the target port
      Target port group: 0x0
  Designation descriptor number 5, descriptor length: 8
    id_type: Logical unit group,  code_set: Binary
      associated with the addressed logical unit
      Logical unit group: 0x0
  Designation descriptor number 6, descriptor length: 40
    transport: Fibre Channel (FCP-2)
    id_type: SCSI name string,  code_set: UTF-8
    associated with the target port
      SCSI name string:

Action Items


Kudos to the QLogic team, in particular Madhu Iyengar, for their excellent support and guidance in hardening and tuning the qla2xxx driver.

See also

External links

Personal tools
Google AdSense