From b3b4702bcb6d7736466a09cd68c2c2af576b2517 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Wed, 23 Nov 2011 02:32:25 +0000 Subject: [PATCH] From Bart Van Assche : As Mikko Kortelainen explained on the SCST IRC channel, it's not necessary to replace the qla2xxx directory in the kernel source tree in order to build the SCST qla2x00t target driver. Also, if neither SCSI pass-through nor iSCSI will be used rebuilding the kernel tree can be skipped entirely. The patch below updates the qla2x00t howto accordingly, and also implements the following changes: - Fix everything the W3C HTML validator complains about: - Add DOCTYPE declaration. - Add charset declaration. - Change
into
since
is invalid. - Change one occurrence of & into &. - Use proper HTML constructs for numbered and unnumbered enumerations. - Use a fixed-sized font and the brown color for all computer output text (via inline CSS). - Use hyperlinks to refer to other steps. - Fix spelling errors. - Merge the Debian and non-Debian howto's because the differences are so small that it's not justified to maintain two different documents. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3936 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t/doc/qla2x00t-howto-debian.html | 363 ----------------- qla2x00t/doc/qla2x00t-howto.html | 514 +++++++++++++----------- www/index.html | 1 - 3 files changed, 278 insertions(+), 600 deletions(-) delete mode 100644 qla2x00t/doc/qla2x00t-howto-debian.html diff --git a/qla2x00t/doc/qla2x00t-howto-debian.html b/qla2x00t/doc/qla2x00t-howto-debian.html deleted file mode 100644 index 19feb2720..000000000 --- a/qla2x00t/doc/qla2x00t-howto-debian.html +++ /dev/null @@ -1,363 +0,0 @@ - - - - How to build and configure QLogic target driver for 22xx/23xx/24xx/25xx adapters on Ubuntu/Debian - - - -
- -
How to build and configure QLogic target driver for 22xx/23xx/24xx/25xx adapters on Ubuntu/Debian. A Step by step guide.
- -

-
- Author: Barry Schut, Internet Unie BV.
-

- You can email me with questions regarding this guide, suppliments or corrections. I might answer your email, I might not, on that I will and can not provide any waranty. -

- Copyrights 2011 SCST Project, released under the GNU GPL. -
- -
-
- Prerequisites: -
    -
  • Ubuntu/Debian 64bit base installation as minumum, fully updated.
  • -
  • Working internet/network connection from this installation (for apt).
  • -
  • Knowledge of configuring a Linux Kernel (a good base to work on is the configuration from the running kernel after installation)
  • -
  • Check if there are any patches for your kernel here
  • -
-
- -
-
- Note 1: I know this guide never builds a debian kernel package, i did not care about this, i only wanted to get the Generic SCSI Target Subsystem for Linux to work. I also know its not a good idea to compile anything as root, but again: i did not care about that either: the machine was a clean install, nobody will ever get hurt by me compiling a kernel or anything else as root. -
-
- Note 2: I have to thank the original creator of this guide. I can not find your name but i can say i would not have been able to make it work without it. I have based this document on that HowTo as a template.
-
-
-
ON TARGET
-
    -
  • Run the following apt command to install everything you might need or find usefull:
    - -
    - # apt-get install linux-source subversion patch libcunit1-ncurses libncurses5-dev screen cramfsprogs bootcd-mkinitramfs lsscsi -
  • - -
  • Get the appropiate firmware for your QLogic card from - ftp://ftp.qlogic.com/outgoing/linux/firmware/ and put it under /lib/firmware. - It is strongly recommended to use firmware version 5.x or higher for 24xx/25xx adapters. See - here - for more details why. - -

    - - Without a firmware image during boot or when you manually insert the QLogic module, you might - get the following error message in the logs (dmesg, /var/log/kern.log or /var/log/syslog) - -

    - - < snip >
    - - qla2xxx 0000:13:00.0: Firmware image unavailable.
    - qla2xxx 0000:13:00.0: Failed to initialize adapter
    - < snip >

    - - In this case I have a Qlogic AR312A/HP FC1242SR with a good firmware preloaded. -
  • - -
  • Unzip it in /usr/src/
    -
    - # tar jxvf linux-2.x.xxx.tar.bz2 -
  • - -
  • Create symlinks
    -
    - # pwd
    - /usr/src
    - # ln -s /usr/src/linux-2.x.xxx linux
    - # ln -s /usr/src/linux-2.x.xxx kernel -
  • - -
  • Get the SCST code. It is possibile either from the SCST downloads page - or from the SVN code base.

    - - Below we will consider the case of the downloaded from the SVN code. For the release code everything is the same. - You only need unpack all downloaded SCST archives in one directory. It then will contain similar content as - ~scst/trunk/ below.
    -
    - # svn co https://scst.svn.sourceforge.net/svnroot/scst -
    - If the command returns successfully then you'll have 'scst'
    - directory under your current directory ( here it is /root )
    -
  • -
  • Change directory to ~scst/trunk/
    -
    - # ls -1
    - AskingQuestions
    - doc
    - fcst
    - ibmvstgt
    - iscsi-scst
    - Makefile
    - mpt
    - mvsas_tgt
    - nightly
    - qla2x00t
    - qla_isp
    - qla_isp-release.patch
    - README
    - scripts
    - scst
    - scstadmin
    - scst_local
    - srpt
    - SVN_TAGS
    - usr
    - www -
    -
  • -
  • Patch the kernel (the kernel version you've downloaded in 'Target' step 1)
    -
    - # cp /root/scst/trunk/scst/kernel/scst_exec_req_fifo-2.x.xxx.patch /usr/src/linux/
    - # cd /usr/src/linux/
    - # patch -p1 < scst_exec_req_fifo-2.x.xxx.patch
    -
    -
  • -
  • Replace the QLogic FC driver code in the kernel source tree with the modified version - of QLogic FC driver code from scst code base.
    -
    - # pwd
    - /root/scst/trunk
    - # mv /usr/src/linux/drivers/scsi/qla2xxx /usr/src/linux/drivers/scsi/qla2xxx_orig
    - # ln -s /root/scst/trunk/qla2x00t /usr/src/linux/drivers/scsi/qla2xxx -
    -
  • -
  • Now build the kernel.

    - Make sure you disable kernel hacking feature, and enable - "Device Drivers->SCSI device support->SCSI low level drivers->Qlogic 2xxx target mode support"
    - (i.e. CONFIG_SCSI_QLA2XXX_TARGET=y)
    - Also turn OFF HIGHMEM4G|HIGHMEM64G, i.e.
    -
    - # grep -i highmem /usr/src/linux/.config
    - CONFIG_NOHIGHMEM=y
    - # CONFIG_HIGHMEM4G is not set
    - # CONFIG_HIGHMEM64G is not set -
    - If you have system with more than 1GB of memory, consider to change CONFIG_VMSPLIT option to the correspinding value.
    -
    - # pwd
    - /usr/src/linux
    - # make menuconfig
    - # make bzImage
    - # make modules
    - # make modules_install
    - # make install -
    -
  • -
  • Reboot the machine and during boot select the modified kernel to boot from.
  • -
  • Depending on your requirement (performance/debugging) apply the appropiate - patches that comes with choose the appropriate SCST build mode. By default SCST has debug build mode. - Here is how to switch to the release mode:
    -
    - # pwd
    - /root/scst/trunk
    - # make 2release -
    -
  • -
  • First make sure that the link "/lib/modules/`uname -r`/build"
    - points to the current running kernel sources. Now build the modules.
    - -
      -
    • Build scst.
      -
      - # cd /root/scst/trunk/scst/src
      - # make all (here I am building everything)
      - # make install -
      -
    • -
    • Build QLogic target driver
      -
      - # cd /root/scst/trunk/qla2x00t/qla2x00-target/
      - # make
      - # make install -
      -
    • -
    - -
  • -
  • Insert the modules.
    - The driver modules will be installed in '/lib/modules/`you_kernel_version`/extra'.
    - In addition, scst.h, scst_debug.h as well as Module.symvers or - Modules.symvers will be copied to '/usr/local/include/scst'.
    The first - file contains all SCST's public data definition, which are used by - target drivers. The other ones support debug messages logging and build process.
    -
    - # ls -l /lib/modules/`uname -r`/extra
    - total 232
    - drwxr-xr-x 2 root root 4096 Jun 20 18:43 dev_handlers
    - -rw-r--r-- 1 root root 36756 Jun 20 18:46 qla2x00tgt.ko
    - -rw-r--r-- 1 root root 160192 Jun 20 18:46 qla2xxx.ko
    - -rw-r--r-- 1 root root 190848 Jun 20 18:43 scst.ko

    - # ls -l /lib/modules/`uname -r`/extra/dev_handlers
    - total 192
    - -rw-r--r-- 1 root root 11757 Jun 20 18:43 scst_cdrom.ko
    - -rw-r--r-- 1 root root 10111 Jun 20 18:43 scst_changer.ko
    - -rw-r--r-- 1 root root 12420 Jun 20 18:43 scst_disk.ko
    - -rw-r--r-- 1 root root 12449 Jun 20 18:43 scst_modisk.ko
    - -rw-r--r-- 1 root root 10131 Jun 20 18:43 scst_processor.ko
    - -rw-r--r-- 1 root root 10081 Jun 20 18:43 scst_raid.ko
    - -rw-r--r-- 1 root root 12563 Jun 20 18:43 scst_tape.ko
    - -rw-r--r-- 1 root root 37937 Jun 20 18:43 scst_user.ko
    - -rw-r--r-- 1 root root 50194 Jun 20 18:43 scst_vdisk.ko -
    - Where:
    - - scst - SCST itself
    - - scst_disk - device handler for disks (type 0)
    - - scst_tape - device handler for tapes (type 1)
    - - scst_processor - device handler for processors (type 3)
    - - scst_cdrom - device handler for CDROMs (type 5)
    - - scst_modisk - device handler for MO disks (type 7)
    - - scst_changer - device handler for medium changers (type 8)
    - - scst_raid - device handler for storage array controller (e.g. raid) (type C)
    - - scst_vdisk - device handler for virtual disks (file, device or ISO CD image).
    - - scst_user - user space device handler

    - - You can insert any of these modules by 'modprobe' program, I've inserted all - the modules !!!
    -
    - # for _mod in scst qla2xxx qla2x00tgt scst_vdisk scst_user scst_disk [...etc snip]; do modprobe $_mod; done -

    - - < snip from dmesg >

    - - scst: SCST version 2.0.0 loaded successfully (max mem for commands 16251MB, per device 6500MB)
    - scst: Enabled features: TRACING
    - scst: Target template qla2x00tgt registered successfully
    - scst: Virtual device handler vdisk for type 0 registered successfully
    - scst: Virtual device handler "scst_user" registered successfully

    - - < snip from dmesg > -
  • -
  • Now let's create our virtual device:
    -
    - # dd if=/dev/zero of=/mnt/disk1 bs=1024k count=512
    - 512+0 records in
    - 512+0 records out
    - # ls -l /mnt/disk1
    - -rw-r--r-- 1 root root 536870912 Jun 23 13:27 /mnt/disk1
    - # file /mnt/disk1
    - /mnt/disk1: data -
    -
  • -
  • To see the device remotely, we have to add it to at least in the LUNs set for our target.
    - We must have LUN 0 (LUNs numeration must not start from, e.g., 1).

    - - The simplest way to do that is to write an scstadmin's config file:

    -
    - HANDLER vdisk_fileio {
    -   DEVICE disk1 {
    -    filename /mnt/disk1
    -   }
    - }

    - - TARGET_DRIVER qla2x00t {
    -   TARGET 25:00:00:f0:98:87:92:f3 {
    -    LUN 0 disk1

    - -    enabled 1
    -   }
    - } -

    - - To use it, we need to install scstadmin:

    - -
    - # pwd
    - /root/scst/trunk/scstadmin
    - # make
    - # make install -

    - - Let's save our config file as /etc/scst.conf

    - - Now run scstadmin:

    - -
    - # scstadmin -config /etc/scst.conf - - Collecting current configuration: done.

    - - -> Checking configuration file 'qq' for errors.
    - -> Done, 0 warnings found.

    - - -> Opening device 'disk1' using handler 'vdisk_fileio': done.
    - -> Adding device 'disk1' at LUN 0 to driver/target 'qla2x00t/25:00:00:f0:98:87:92:f3': done.
    - -> Enabling driver/target 'qla2x00t/25:00:00:f0:98:87:92:f3': done.

    - - All done. -

    - - The same can be done directly via SCST's sysfs interface:

    - -
    - # echo "add_device disk1 filename=/mnt/disk1" >/sys/kernel/scst_tgt/handlers/vdisk_fileio/mgmt
    - # echo "add disk1 0" >/sys/kernel/scst_tgt/targets/qla2x00t/25:00:00:f0:98:87:92:f3/luns/mgmt
    - # echo "1" >/sys/kernel/scst_tgt/targets/qla2x00t/25:00:00:f0:98:87:92:f3/enabled -
    -
  • -
- -
ON INITIATOR
- -
    -
  • < snip from README >
    - Without loading appropriate device handler, corresponding device - will be invisible for remote initiators, hence we have to - add them manully.
    - < snip from README >

    - - But as I've already loaded the device handler(scst_vdisk) on the target, - hence I don't need to perform 'Initiator' step 1.

    - -
  • -
  • After enabling the target mode on the target (see 'Target' step 15), - to see new targets and devices you need either to rescan - initiator(s) manually, for example, by rmmod/modprobe the - corresponding FC device module on the initiator, or reboot the initiator itself. - Automatic discovery isn't supported by all known initiators, - so you need a way to make SCSI subsystem on the initiator to do the new devices discovery and hence be able to see - the new devices attached.

    - - Alternatively, if your initiator already connected to the target and you simply added new devices to it, you can try to run - a manual rescan by:
    -
    - # echo "- - -" >/sys/class/scsi_host/hostX/scan -
    - Where X is the host number -
  • -
-
ALL DONE, YOU SHOULD NOW HAVE A WORKING TARGET!
-
- - \ No newline at end of file diff --git a/qla2x00t/doc/qla2x00t-howto.html b/qla2x00t/doc/qla2x00t-howto.html index 3d65c823b..d17f1ec73 100644 --- a/qla2x00t/doc/qla2x00t-howto.html +++ b/qla2x00t/doc/qla2x00t-howto.html @@ -1,295 +1,337 @@ + + + How to configure QLogic target driver for 22xx/23xx/24xx/25xx adapters + -
How to configure QLogic target driver for 22xx/23xx/24xx/25xx adapters. Step by step guide.

+
How to configure QLogic target driver for 22xx/23xx/24xx/25xx adapters. Step by step guide.

ON TARGET


-1: Get the Linux kernel sources for version >= 2.6.26 from kernel.org
-
I've downloaded kernel version 2.6.26
-
ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.26.tar.bz2


+
    +
  1. + Download the appropriate firmware for your QLogic card from + ftp://ftp.qlogic.com/outgoing/linux/firmware/ and save it in the + /lib/firmware directory. + It is strongly recommended to use firmware version 5.x or higher for + 24xx/25xx adapters. More information about this subject can be found in + the following thread on the scst-devel mailing list: + FC + session gets closed with qla2x00t. -2: Get the appropiate firmware for your QLogic card from - ftp://ftp.qlogic.com/outgoing/linux/firmware/ and put it under /lib/firmware. - It is strongly recommended to use firmware version 5.x or higher for 24xx/25xx adapters. See - here - for more details why. +

    -

    + If no firmware image is available when the QLogic kernel module is loaded, + the following error message will appear in the kernel log + (/var/log/messages): - Without a firmware image during boot or when you manually insert the QLogic module, you'll - get the following error mesage in the logs(/var/log/messages) +
    qla2xxx 0000:13:00.0: Firmware image unavailable.
    +qla2xxx 0000:13:00.0: Failed to initialize adapter
    -

    + In this case I had to download ql2300_fw.bin.


    +
  2. - < snip >
    +
  3. Install the necessary kernel development packages. On e.g. a Debian system +these packages can be installed as follows: +
    apt-get install gcc patch linux-headers libcunit1-ncurses libncurses5-dev cramfsprogs bootcd-mkinitramfs subversion lsscsi
    +

  4. - qla2xxx 0000:13:00.0: Firmware image unavailable.
    - qla2xxx 0000:13:00.0: Failed to initialize adapter
    - < snip >

    - - In this case I had to download ql2300_fw.bin


    - -3: Unzip it under /usr/src/
    - [root@proj src ] bunzip2 /usr/src/linux-2.6.26.tar.bz2
    - [root@server src ] tar -xvf /usr/src/linux-2.6.26.tar


    - -4: Create symlinks
    - [root@proj src ] pwd
    - /usr/src
    - [root@proj src ] ln -s /usr/src/linux-2.6.26 linux
    - [root@proj src ] ln -s /usr/src/linux-2.6.26 kernel


    - -5: Get the SCST code. It is possibile either from the SCST downloads page - or from the SVN code base.

    +
  5. + Download the SCST source code. That source code can be downloaded either + from the SCST + downloads page or from the SCST Subversion source code + repository.

    - Below we will consider the case of the downloaded from the SVN code. For the release code everything is the same. - You only need unpack all downloaded SCST archives in one directory. It then will contain similar content as - ~scst/trunk/ below.

    + In what follows it is assumed that the SCST trunk has been retrieved + via Subversion. Installing a released SCST version is identical to + installing the trunk after all downloaded SCST source code archives have + been extracted in a single directory. The structure of that directory will + be identical to that of the SCST trunk. - [root@proj ] svn co https://scst.svn.sourceforge.net/svnroot/scst
    - If the command returns successfully then you'll have 'scst'
    - directory under your current directory ( here it is /root )

    +
    [root@proj ] svn co https://scst.svn.sourceforge.net/svnroot/scst/trunk scst
    + + After the above command finished a directory called 'scst' will have been + created in the current directory, which is /root in this how-to. + +


    +
  6. + +
  7. +Find out whether you will need SCSI pass-through and/or the iSCSI +zero-copy optimization. If not, skip the kernel download, patch, rebuild +and reboot steps and continue with the SCST build step. +


    + +
  8. Decide whether you want to start from a vanilla Linux kernel source tree +or from the kernel source tree specific to your Linux distribution. Vanilla kernel sources can be downloaded from http://www.kernel.org/pub/linux/kernel/. Unzip the downloaded archive under /usr/src: +
    [root@proj src ] 
    +[root@proj src ] tar -xjf /usr/src/linux-2.6.26.tar.bz2
    +Instructions for obtaining a distribution-specific kernel source tree vary. An example for Debian: +
    [root@proj src ] apt-get install linux-source-2.6
    +[root@proj src ] tar xjf linux-source-2.6.32.tar.bz2
    +
  9. + +
  10. + Create the necessary symbolic links: +
    [root@proj src ] pwd
    +/usr/src
    +[root@proj src ] ln -s /usr/src/linux-2.6.26 linux
    +[root@proj src ] ln -s /usr/src/linux-2.6.26 kernel
    +
  11. + +
  12. + Patch the kernel that has just been downloaded: +
    [root@proj ] cd /usr/src/linux-2.6.26
    +[root@proj linux-2.6.26] patch -p1 < /root/scst/scst/kernel/scst_exec_req_fifo-2.6.26.patch
    +
  13. + +
  14. + Now build the kernel.

    - You need subversion (open source version control system) installed on - your Linux box.


    - -6: Change directory to ~scst/trunk/
    - [root@proj trunk]# pwd
    - /root/scst/trunk

    - - [root@proj trunk]# ls
    - AskingQuestions iscsi-release.patch mpt qla2x00t-release.patch scripts scst-full_perf.patch usr www - doc iscsi-scst qla2x00t qla_isp scst scst-release.patch usr-full_perf.patch - iscsi-full_perf.patch Makefile qla2x00t-full_perf.patch README scstadmin srpt usr-release.patch

    - -7: Patch the kernel (the kernel version you've downloaded in step 1)
    - [root@proj ] cp /root/scst/trunk/scst/kernel/scst_exec_req_fifo-2.6.26.patch /usr/src

    + Make sure you disable kernel hacking feature and HIGHMEM4G|HIGHMEM64G, i.e. +
    [root@proj ] grep -i highmem /usr/src/linux/.config
    +CONFIG_NOHIGHMEM=y
    +# CONFIG_HIGHMEM4G is not set
    +# CONFIG_HIGHMEM64G is not set
    - [root@proj ] cd /usr/src
    - [root@proj src] patch -p0 < scst_exec_req_fifo-2.6.26.patch


    - -8: Replace the QLogic FC driver code in the kernel source tree with the modified version - of QLogic FC driver code from scst code base.

    - [root@proj trunk] pwd
    - /root/scst/trunk
    - [root@proj trunk] mv /usr/src/linux/drivers/scsi/qla2xxx /usr/src/linux/drivers/scsi/qla2xxx_orig
    - [root@proj trunk] ln -s /root/scst/trunk/qla2x00t /usr/src/linux/drivers/scsi/qla2xxx


    + If you have a system with more than 1GB of memory, consider to change CONFIG_VMSPLIT option to the corresponding value. -9: Now build the kernel.

    +
    [root@proj linux ] pwd
    +/usr/src/linux
    +[root@proj linux ] make menuconfig
    +[root@proj linux ] make bzImage
    +[root@proj linux ] make modules
    +[root@proj linux ] make modules_install
    +[root@proj linux ] make install
    +
  15. + +
  16. + Reboot the system and during boot select the freshly built kernel to boot from.


    +
  17. + +
  18. + OPTIONAL step: clean up the kernel modules directory before building the + SCST kernel modules.
    This is only necessary if you encounter the + following error message: "scst: disagrees about version of symbol + struct_module".

    - Make sure you disable kernel hacking feature, and enable - "Device Drivers->SCSI device support->SCSI low level drivers->Qlogic 2xxx target mode support"
    - (i.e. CONFIG_SCSI_QLA2XXX_TARGET=y)
    - Also turn OFF HIGHMEM4G|HIGHMEM64G,
    - i.e.
    - [root@proj ] grep -i highmem /usr/src/linux/.config
    - CONFIG_NOHIGHMEM=y
    - # CONFIG_HIGHMEM4G is not set
    - # CONFIG_HIGHMEM64G is not set

    + That error message indicates that a kernel module + load was compiled against kernel headers that did not match the running + kernel. Doing a clean rebuild of the kernel and SCST should make the + above error go away. To make sure nothing of the old kernel is left, + do a clean rebuild of the Linux kernel and SCST as follows: - If you have system with more than 1GB of memory, consider to change CONFIG_VMSPLIT option to the correspinding value. -

    - [root@proj linux ] pwd
    - /usr/src/linux
    - [root@proj linux ] make menuconfig
    - [root@proj linux ] make bzImage
    - [root@proj linux ] make modules
    - [root@proj linux ] make modules_install
    - [root@proj linux ] make install


    +
    [root@proj linux ] pwd
    +/usr/src/linux
    +[root@proj linux ] make oldconfig
    +[root@proj linux ] make clean
    +[root@proj linux ] rm -rf /lib/modules/`uname -r`
    +[root@proj linux ] make modules
    +[root@proj linux ] make modules_install
    +[root@proj linux ] make install
    +[root@proj linux ] reboot
    +
  19. + +
  20. + Select a build mode that suits your needs, e.g. optimal performance or + debugging SCST. The default mode is debug mode. Here is how to switch to + release mode: +
    [root@proj trunk ] pwd
    +/root/scst
    +[root@proj trunk ] make 2release
    +
  21. + +
  22. + Now build the SCST kernel modules.
    + But first verify that the link "/lib/modules/`uname -r`/build"
    + points to the kernel headers of the currently running kernel.

    -10: Reboot the machine and during boot select the modified kernel to boot from.


    +
      +
    1. Build SCST. +
      [root@proj ] cd /root/scst/scst/src
      +[root@proj ] make all
      +[root@proj ] make install
      +
    2. -11:Depending on your requirement (performance/debugging) apply the appropiate - patches that comes with choose the appropriate SCST build mode. By default SCST has debug build mode. - Here is how to switch to the release mode:

      - [root@proj trunk ] pwd
      - /root/scst/trunk
      - [root@proj trunk ] make 2release


      +
    3. Build the QLogic target driver as follows:
      +
        +
      1. Remove the upstream qla2xxx initiator kernel module and any + previously installed SCST qla2xxx-related kernel modules: +
        rm -f /lib/modules/`uname -r`/{kernel/drivers/scsi/qla2xxx,extra}/qla2*
        +
      2. +
      3. Change the working directory to the SCST source tree. +
        [root@proj trunk] pwd
        +/root/scst
      4. +
      5. Install the qla2xxx initiator kernel module from the SCST tree: +
        [root@proj trunk] BUILD_2X_MODULE=y CONFIG_SCSI_QLA_FC=y CONFIG_SCSI_QLA2XXX_TARGET=y make -s -C qla2x00t/qla2x00-target install
        +
      6. +
      7. Verify that compilation and installation succeeded: +
        [root@proj trunk] ls -l /lib/modules/`uname -r`/extra/qla2*
        +-rw-r--r--  1 root root  36756 Jun 20 18:46 qla2x00tgt.ko
        +-rw-r--r--  1 root root 160192 Jun 20 18:46 qla2xxx_scst.ko   
        +
        +
      8. +
      +
    4. +
    +
  23. -12:OPTIONAL step: do the cleanup before building scst module
    - (Follow step 11 only if you get error "scst: disagrees about version of - symbol struct_module")

    +
  24. + Insert the kernel modules.
    The kernel modules have been installed in + '/lib/modules/`you_kernel_version`/extra'.
    In addition, scst.h, + scst_debug.h as well as Module.symvers or Modules.symvers have been copied + to '/usr/local/include/scst'.
    The first file contains all SCST's public + interfaces used by target drivers. The other files allow target drivers to + generate debug messages and support the kernel module build process. + +
    [root@proj scst]# ls -l /lib/modules/`uname -r`/extra
    +total 232
    +drwxr-xr-x  2 root root   4096 Jun 20 18:43 dev_handlers
    +-rw-r--r--  1 root root  36756 Jun 20 18:46 qla2x00tgt.ko
    +-rw-r--r--  1 root root 160192 Jun 20 18:46 qla2xxx_scst.ko   
    +-rw-r--r--  1 root root 190848 Jun 20 18:43 scst.ko
    +
    +[root@proj scst]# ls -l /lib/modules/`uname -r`/extra/dev_handlers
    +total 192
    +-rw-r--r--  1 root root 11757 Jun 20 18:43 scst_cdrom.ko
    +-rw-r--r--  1 root root 10111 Jun 20 18:43 scst_changer.ko
    +-rw-r--r--  1 root root 12420 Jun 20 18:43 scst_disk.ko
    +-rw-r--r--  1 root root 12449 Jun 20 18:43 scst_modisk.ko
    +-rw-r--r--  1 root root 10131 Jun 20 18:43 scst_processor.ko
    +-rw-r--r--  1 root root 10081 Jun 20 18:43 scst_raid.ko
    +-rw-r--r--  1 root root 12563 Jun 20 18:43 scst_tape.ko
    +-rw-r--r--  1 root root 37937 Jun 20 18:43 scst_user.ko
    +-rw-r--r--  1 root root 50194 Jun 20 18:43 scst_vdisk.ko
    - This error indicates that the kernel module the script was trying to - load was compiled against kernel headers that do not match the running - kernel. Doing a clean rebuild of the kernel and SCST should make the - above error go away. To make sure nothing of the old kernel is left, - Do clean rebuild of kernel and SCST :
    - Follow the step below:

    - - [root@proj linux ] pwd
    - /usr/src/linux
    - [root@proj linux ] make oldconfig
    - [root@proj linux ] make clean
    - [root@proj linux ] rm -rf /lib/modules/`uname -r`
    - [root@proj linux ] make modules
    - [root@proj linux ] make modules_install
    - [root@proj linux ] make install
    - [root@proj linux ] reboot


    +where: +
      +
    • scst - SCST itself.
    • +
    • scst_disk - device handler for disks (type 0).
    • +
    • scst_tape - device handler for tapes (type 1).
    • +
    • scst_processor - device handler for processors (type 3).
    • +
    • scst_cdrom - device handler for CDROMs (type 5).
    • +
    • scst_modisk - device handler for MO disks (type 7).
    • +
    • scst_changer - device handler for medium changers (type 8).
    • +
    • scst_raid - device handler for storage array controller (e.g. raid) (type C).
    • +
    • scst_vdisk - device handler for virtual disks (file, device or ISO CD image)..
    • +
    • scst_user - user space device handler.
    • +
    +
    -13:Now build the modules.
    - But first make sure that the link "/lib/modules/`uname -r`/build"
    - points to the current running kernel sources.

    - - a) Build scst.
    - [root@proj ] cd /root/scst/trunk/scst/src
    - [root@proj ] make all (here I am building everything)
    - [root@proj ] make install

    - + You can insert any of these kernel modules with the 'modprobe' program. As + you can see, I've inserted all SCST kernel modules !!! +
    [root@proj ] for _mod in scst qla2xxx qla2x00tgt scst_vdisk scst_user scst_disk ...; do modprobe $_mod; done
    - b) Build QLogic target driver
    - [root@proj ] cd /root/scst/trunk/qla2x00t/qla2x00-target/
    - root@proj ] make
    - [root@proj ] make install


    - - -14:Insert the modules.
    - The driver modules will be installed in '/lib/modules/`you_kernel_version`/extra'.
    - In addition, scst.h, scst_debug.h as well as Module.symvers or - Modules.symvers will be copied to '/usr/local/include/scst'.
    The first - file contains all SCST's public data definition, which are used by - target drivers. The other ones support debug messages logging and build process.

    - - [root@proj scst]# ls -l /lib/modules/`uname -r`/extra
    - total 232
    - drwxr-xr-x 2 root root 4096 Jun 20 18:43 dev_handlers
    - -rw-r--r-- 1 root root 36756 Jun 20 18:46 qla2x00tgt.ko
    - -rw-r--r-- 1 root root 160192 Jun 20 18:46 qla2xxx.ko
    - -rw-r--r-- 1 root root 190848 Jun 20 18:43 scst.ko

    - - [root@proj scst]# ls -l /lib/modules/`uname -r`/extra/dev_handlers
    - total 192
    - -rw-r--r-- 1 root root 11757 Jun 20 18:43 scst_cdrom.ko
    - -rw-r--r-- 1 root root 10111 Jun 20 18:43 scst_changer.ko
    - -rw-r--r-- 1 root root 12420 Jun 20 18:43 scst_disk.ko
    - -rw-r--r-- 1 root root 12449 Jun 20 18:43 scst_modisk.ko
    - -rw-r--r-- 1 root root 10131 Jun 20 18:43 scst_processor.ko
    - -rw-r--r-- 1 root root 10081 Jun 20 18:43 scst_raid.ko
    - -rw-r--r-- 1 root root 12563 Jun 20 18:43 scst_tape.ko
    - -rw-r--r-- 1 root root 37937 Jun 20 18:43 scst_user.ko
    - -rw-r--r-- 1 root root 50194 Jun 20 18:43 scst_vdisk.ko

    - - where:
    - - scst - SCST itself
    - - scst_disk - device handler for disks (type 0)
    - - scst_tape - device handler for tapes (type 1)
    - - scst_processor - device handler for processors (type 3)
    - - scst_cdrom - device handler for CDROMs (type 5)
    - - scst_modisk - device handler for MO disks (type 7)
    - - scst_changer - device handler for medium changers (type 8)
    - - scst_raid - device handler for storage array controller (e.g. raid) (type C)
    - - scst_vdisk - device handler for virtual disks (file, device or ISO CD image).
    - - scst_user - user space device handler

    + This will result in the following dmesg output: - You can insert any of these modules by 'modprobe' program, I've inserted all - the modules !!!
    - [root@proj ] for _mod in scst qla2xxx qla2x00tgt scst_vdisk scst_user - scst_disk....; do modprobe $_mod; done

    +
    scst: SCST version 2.0.0 loaded successfully (max mem for commands 16251MB, per device 6500MB)
    +scst: Enabled features: TRACING
    +scst: Target template qla2x00tgt registered successfully
    +scst: Virtual device handler vdisk for type 0 registered successfully
    +scst: Virtual device handler "scst_user" registered successfully
    +
  25. - < snip from dmesg >

    +
  26. +Now let's create our virtual device: - scst: SCST version 2.0.0 loaded successfully (max mem for commands 16251MB, per device 6500MB)
    - scst: Enabled features: TRACING
    - scst: Target template qla2x00tgt registered successfully
    - scst: Virtual device handler vdisk for type 0 registered successfully
    - scst: Virtual device handler "scst_user" registered successfully
    - --------
    - --------
    - < snip from dmesg >


    +
    [root@proj ] dd if=/dev/zero of=/mnt/disk1 bs=1024k count=512
    +512+0 records in
    +512+0 records out
     
    -15: Now let's create our virtual device:

    +[root@proj ] ls -l /mnt/disk1 +-rw-r--r-- 1 root root 536870912 Jun 23 13:27 /mnt/disk1 - - [root@proj ] dd if=/dev/zero of=/mnt/disk1 bs=1024k count=512
    - 512+0 records in
    - 512+0 records out

    - - [root@proj ] ls -l /mnt/disk1
    - -rw-r--r-- 1 root root 536870912 Jun 23 13:27 /mnt/disk1

    - - [root@proj ] file /mnt/disk1
    - /mnt/disk1: data

    +[root@proj ] file /mnt/disk1 +/mnt/disk1: data
    +
  27. +
  28. + To see the device on the initiator we have to add it in the LUNs set of our + target.
    We must have a LUN with number 0 (LUs numeration must not start + from, e.g., 1).

    -16:To see the device remotely, we have to add it to at least in the LUNs set for our target.
    - We must have LUN 0 (LUs numeration must not start from, e.g., 1).

    + The simplest way to do that is to write an scstadmin config file: - The simplest way to do that is to write an scstadmin's config file:

    +
    +HANDLER vdisk_fileio {
    +	DEVICE disk1 {
    +		filename /mnt/disk1
    +	}
    +}
     
    -HANDLER vdisk_fileio {
    -  DEVICE disk1 {
    -   filename /mnt/disk1
    -  }
    -}

    +TARGET_DRIVER qla2x00t { + TARGET 25:00:00:f0:98:87:92:f3 { + LUN 0 disk1 -TARGET_DRIVER qla2x00t {
    -  TARGET 25:00:00:f0:98:87:92:f3 {
    -   LUN 0 disk1

    + enabled 1 + } +}
    -   enabled 1
    -  }
    -}

    +Before we can apply that file we have to install scstadmin first: -To use it, we need to install scstadmin:

    +
    [root@proj ]# make -C scstadmin -s install
    -[root@proj ]# make
    -[root@proj ]# make install

    +Let's save our configuration file as /etc/scst.conf.

    -Let's save our config file as /etc/scst.conf

    +That file can be applied via scstadmin: -Now run scstadmin:

    +
    [root@proj ]# scstadmin -config /etc/scst.conf
     
    -[root@proj ]# scstadmin -config /etc/scst.conf

    +Collecting current configuration: done. -Collecting current configuration: done.

    - --> Checking configuration file 'qq' for errors.
    - -> Done, 0 warnings found.

    +-> Checking configuration file 'qq' for errors. + -> Done, 0 warnings found. - -> Opening device 'disk1' using handler 'vdisk_fileio': done.
    - -> Adding device 'disk1' at LUN 0 to driver/target 'qla2x00t/25:00:00:f0:98:87:92:f3': done.
    - -> Enabling driver/target 'qla2x00t/25:00:00:f0:98:87:92:f3': done.

    + -> Opening device 'disk1' using handler 'vdisk_fileio': done. + -> Adding device 'disk1' at LUN 0 to driver/target 'qla2x00t/25:00:00:f0:98:87:92:f3': done. + -> Enabling driver/target 'qla2x00t/25:00:00:f0:98:87:92:f3': done. - All done.

    + All done.
    -The same can be done directly via SCST's sysfs interface:

    +The same can be done directly via the sysfs interface of SCST: +
    +[root@proj ]# echo "add_device disk1 filename=/mnt/disk1" >/sys/kernel/scst_tgt/handlers/vdisk_fileio/mgmt
    +[root@proj ]# echo "add disk1 0" >/sys/kernel/scst_tgt/targets/qla2x00t/25:00:00:f0:98:87:92:f3/luns/mgmt
    +[root@proj ]# echo "1" >/sys/kernel/scst_tgt/targets/qla2x00t/25:00:00:f0:98:87:92:f3/enabled
    +
    +

    -[root@proj ]# echo "add_device disk1 filename=/mnt/disk1" >/sys/kernel/scst_tgt/handlers/vdisk_fileio/mgmt
    -[root@proj ]# echo "add disk1 0" >/sys/kernel/scst_tgt/targets/qla2x00t/25:00:00:f0:98:87:92:f3/luns/mgmt
    -[root@proj ]# echo "1" >/sys/kernel/scst_tgt/targets/qla2x00t/25:00:00:f0:98:87:92:f3/enabled

    +
    ON INITIATOR

    +
  29. -
    ON INITIATOR

    +
  30. + A quote from the SCST README:
    Without loading appropriate + device handler, corresponding device will be invisible for remote + initiators, hence we have to add them manually.
    But as + I've already loaded the device handler (scst_vdisk) on the target, I don't + have to perform any additional steps.

    +
  31. -17:< snip from README >
    - Without loading appropriate device handler, corresponding device - will be invisible for remote initiators, hence we have to - add them manully.
    - < snip from README >

    +
  32. + After enabling the target mode on the target, to + see new targets and devices on the initiator you need have to trigger a + rescan on the initiator. That is possible either by rebooting the initiator + or by unloading and reloading the initiator kernel module. Automatic + discovery isn't supported by all known initiators, so you need a way to make + SCSI subsystem on the initiator to do the new devices discovery and hence be + able to see the new devices attached.

    - But as I've already loaded the device handler(scst_vdisk) on the target, - hence I don't need to perform step 17.

    - + Alternatively, if your initiator already connected to the target and you + simply added new devices to it, you can try to run a manual rescan as follows: -18:After enabling the target mode on the target (see step 16), - to see new targets and devices you need either to rescan - initiator(s) manually, for example, by rmmod/modprobe the - corresponding FC device module on the initiator, or reboot the initiator itself. - Automatic discovery isn't supported by all known initiators, - so you need a way to make SCSI subsystem on the initiator to do the new devices discovery and hence be able to see - the new devices attached.

    +
    [root@initiator ] echo "- - -" >/sys/class/scsi_host/hostX/scan
    +where X is the host number. +
  33. - Alternatively, if your initiator already connected to the target and you simply added new devices to it, you can try to run - a manual rescan by:
    +
- [root@initiator ] echo "- - -" >/sys/class/scsi_host/hostX/scan
- where X: host number


- - diff --git a/www/index.html b/www/index.html index 16bf3b9d8..4946ae8f9 100644 --- a/www/index.html +++ b/www/index.html @@ -151,7 +151,6 @@

Gentoo HOWTO For iSCSI-SCST

Alpine Linux HOWTO

HOWTO For QLogic Target Driver

-

Ubuntu/Debian HOWTO For QLogic Target Driver

HOWTO For Emulex lpfc Target Driver

SCST SGV Cache Description

Articles