From 0f3f7be821e2e321110ecde70bf1944e6c898e72 Mon Sep 17 00:00:00 2001 From: Stanislaw Gruszka Date: Thu, 24 Apr 2008 12:50:51 +0000 Subject: [PATCH] - Update README.scst. - Add comment about overall isp_scst.c design. - Put some compile time selectable values in one place. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@357 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla_isp/README.scst | 151 +++++++++++++++++++++++++++++--------- qla_isp/linux/isp_linux.h | 9 +++ qla_isp/linux/isp_scst.c | 12 +++ 3 files changed, 137 insertions(+), 35 deletions(-) diff --git a/qla_isp/README.scst b/qla_isp/README.scst index 5b7ae7697..5f4ce52dc 100644 --- a/qla_isp/README.scst +++ b/qla_isp/README.scst @@ -1,78 +1,159 @@ -WARNING: This driver is not finished, USE ONLY FOR TESTING. +WARNING -This is SCST driver for ISP Qlogic chipsets commonly used in many SCSI and FC -host bus adapters. Supported chipset are listed in README file, incomplete -list of supported HBA's is in doc/Hardware.txt . +This driver is in beta stages, you may want to use it in production, but you +need test it for your hardware configuration. + +INTRODUCTION + +This is an SCST driver for ISP Qlogic chipsets commonly used in many SCSI and +FC host bus adapters. Supported chipsets are listed in the README file; an +incomplete list of supported HBAs can be found in doc/Hardware.txt . It is based on Matthew Jacob's multiplatform driver for ISP chipsets, -which can be download from ftp://ftp.feral.com/pub/isp/isp_dist.tgz. The -update for SCST was made and supported by Stanislaw Gruszka -. +which has its own page at http://www.feral.com/isp.html . The update for SCST +was made by Stanislaw Gruszka for Open-E Inc. -Driver operate same hardware as qla2x00tgt, but have one adventage over it: -support of 24xx series of Qlogic adapters. +Driver operates on the same hardware as qla2x00t, but has one notable +adventage over it: support of 24xx series of Qlogic adapters. -INSTALLATION: +INSTALLATION: QUICK START -Build driver with command -$ make +Build driver with the following command +$ make -Copy proper firmware image for your HBA from Qlogic FTP server -ftp://ftp.qlogic.com/outgoing/linux/firmware/ to one of linux firmware loader -directories (see udev/hotplug documentation for your distribution) +Copy the firmware image appropriate for your HBA from the Qlogic FTP server +ftp://ftp.qlogic.com/outgoing/linux/firmware/ to one of the Linux firmware +loader directories (e.g. /lib/firmware, see the udev/hotplug documentation +for your distribution). -Next step depends on you have other QLA modules installed. Note that you can't -load ISP driver when you build other Qlogic drivers in kernel (kerel oops may -occur). Other QLA modules are acceptable, but extra care is needed, firs copy -modules to some directory, ie: +The next step depends on whether you have other QLA modules installed. Note +that you can't load an ISP driver when you build other Qlogic drivers in the +kernel (kerel oops may occur). Other QLA modules are acceptable, but extra +care is needed, first copy modules to a directory, e.g.: $ mkdir /root/qla_isp $ cp linux-2.6/build/*.ko /root/qla_isp -Everytime you want to run qla_isp, unload all other qla modules +Each time you want to run qla_isp, unload all other qla modules +$ rmmod qla2x00tgt $ rmmod qla2x00tgt $ rmmod qla2400 $ rmmod qla2300 $ rmmod qla2200 $ rmmod qla2xxx -and load ISP modules directly from created directory, ie: +and load ISP modules directly from the created directory, e.g.: $ insmod /root/qla_isp/isp_scst.ko $ insmod /root/qla_isp/isp_mod.ko -If you have no others QLA drivers from SCST (qla2x00tgt) nor kernel (qla2xxx -and friends) you can install in standard /lib/modules directory: +If you have neither other QLA drivers from SCST (qla2x00tgt) nor kernel +(qla2xxx and friends) you can install in the standard /lib/modules directory: $ make install $ depmod -ea -Then first time load drivers by hand: +Then load the drivers manually the first time : $ modprobe isp_scst $ modprobe isp_mod -Now anytime the system boot and QLA card is plugged, modules will load -automatically. +Now whenever the system is booted and a QLA card is plugged, modules will load +automatically. -When driver is loaded, enable all channels for each HBA to work in -target mode. You need to write string "enable all" to procfs configuration file, ie: +When the driver is loaded, enable all channels for each HBA to work in target +mode. For Fibre Channel adapters you need to write the "enable all" string +into the procfs configuration file, e.g.: $ echo "enable all" > /proc/scsi_tgt/qla_isp/3 -To unload isp_mod.ko module you must disable target mode for all cards ie: +To unload the isp_mod.ko module you must disable target mode for all cards, +e.g.: $ echo "disable all" > /proc/scsi_tgt/qla_isp/3 $ echo "disable all" > /proc/scsi_tgt/qla_isp/4 -Enable/disable target mode is not the same as switching target/initiator role. -If you have more then one device, role of each you can set using isp_roles -parameter, like in example: +To attach logical units continue with normal SCST setup. -$ modprobe isp_mode isp_roles="b0300=initiator" +SELECTING FIRMWARE -Magic number "b0300" is DEVID value, which you can find in /proc/scsi/isp/X +The firmware loading interface allows for choosing the appropriate firmware. +However, some firmware images are not available from the Qlogic site, e.g. +firmware with multichannel support. That is why you can build a firmware +image into the isp_mod module. At the beginning of the isp_linux.h file you +need to comment out the following line: -To attach logical units continue with normal SCST setup +#define DISABLE_FW_LOADER 1 +Firmware from sources for 24xx supports multichannel (NPIV) + +SUPPORTED DEVICES + +You can disable support for selected chipsets by editing the isp_linux.h file. +In the following example, only the 2400 chipset is enabled: + +#define ISP_DISABLE_1080_SUPPORT 1 +#define ISP_DISABLE_12160_SUPPORT 1 +#define ISP_DISABLE_2100_SUPPORT 1 +#define ISP_DISABLE_2200_SUPPORT 1 +#define ISP_DISABLE_2300_SUPPORT 1 +#define ISP_DISABLE_2322_SUPPORT 1 +//#define ISP_DISABLE_2400_SUPPORT 1 + +TARGET/INITIATOR ROLES + +The driver can work as either a target or an initiator. Prior to performing +the compilation you can establish the default mode the driver will work in +by editing the file linux-2.6/build/Makefile - you need to set one of the +following values instead of ISP_ROLE_NONE +in -DISP_DEFAULT_ROLES=ISP_ROLE_NONE + +ISP_ROLE_TARGET +ISP_ROLE_INITIATOR +ISP_ROLE_BOTH + +You can also establish the driver role during module initialization using the +isp_roles option, e.g: + +$ modprobe isp_mod isp_roles="b0300=initiator" + +Number "b0300" is a DEVID value based on an address on the PCI bus, which you +can find in /proc/scsi/isp/N. Target role will be enabled automatically when +activating channels/LUNs in /proc/scsi_tgt/qla_isp/N . + +The driver can also work as both a target and an initiator simultaneously, but +this will probably only function for P2P connections. To make the driver work +as a target/initator on one port with a FC switch, you can use N_PORT ID +virtualization, as seen below. + +N_PORT ID VIRTUALIZATION + +You can add an isp_vports option to the ISP module. It denotes the number of +ports(channels) and cannot be greater than 127. Each vport has its own WWN. +From the driver point of view each vport is a separate channel. You can define +separate role for each of the channels. + +PROCFS INTERFACE + +Target configuration interface is located in the following file: +/proc/scsi_tgt/qla_isp/N ; where N is the Linux SCSI host number and +is the same as for proc/scsi/isp/N and /sys/class/scsi_host/hostN files. + +The process for enabling options for this file is different for FC and SPI +devices. For FC it is enabling/disabling channels, while SPI it is +enabling/disabling channels and logical units. For example: +FC: +$ echo "enable 5" > /proc/scsi_tgt/qla_isp/4 + +SPI: +$ echo "enable 0 1" > /proc/scsi_tgt/qla_isp/5 + +You may use the string "all" instead of a number e.g.: + +$echo "disable all all" > /proc/scsi_tgt/qla_isp/5 + +When all LUNs and channels are disabled, the target role will also become +inactive. For N_PORT ID virtualization, when enabling channels, you need to +first enable channel 0; when disabling channels, you need to disable channel +0 last. diff --git a/qla_isp/linux/isp_linux.h b/qla_isp/linux/isp_linux.h index ac6d3b313..eb949d263 100644 --- a/qla_isp/linux/isp_linux.h +++ b/qla_isp/linux/isp_linux.h @@ -59,6 +59,15 @@ #ifndef _ISP_LINUX_H #define _ISP_LINUX_H +//#define DISABLE_FW_LOADER 1 +//#define ISP_DISABLE_1080_SUPPORT 1 +//#define ISP_DISABLE_12160_SUPPORT 1 +//#define ISP_DISABLE_2100_SUPPORT 1 +//#define ISP_DISABLE_2200_SUPPORT 1 +//#define ISP_DISABLE_2300_SUPPORT 1 +//#define ISP_DISABLE_2322_SUPPORT 1 +//#define ISP_DISABLE_2400_SUPPORT 1 + #ifndef ISP_MODULE #define __NO_VERSION__ #endif diff --git a/qla_isp/linux/isp_scst.c b/qla_isp/linux/isp_scst.c index 84303d067..6c19d0c17 100644 --- a/qla_isp/linux/isp_scst.c +++ b/qla_isp/linux/isp_scst.c @@ -59,6 +59,18 @@ * Copyright (c) 2007, 2008 Open-E Inc */ +/* + * This file connects tpublic API from the low level ISP driver (see common/isp_tpublic.h) + * with the SCST target driver API. Such a design does have certain disadvantages as + * opposed to using SCST target API directly in the low level driver: + * - we need to maintain duplicate data structures which are already maintained in the low + * level driver (commands queue, initiator data), + * - processing takes additional cpu time for calling procedures and processing data. + * However, the performance/memory cost is not so big, and such a design is flexible, as we + * don't need to worry about low level details (e.g. if there is support for a new chipset + * added to the low level ISP driver this code will not need to be changed). + */ + #ifndef MODULE #error "this can only be built as a module" #endif