1*2f245829Sagc 2*2f245829Sagc--------------------------------------- 3*2f245829SagcIntel iSCSI v20 Reference Implementation 4*2f245829Sagc--------------------------------------- 5*2f245829Sagc 6*2f245829SagcThis is a software implementation of iSCSI v20. Included in this distribution 7*2f245829Sagcare both host and target mode drivers with built in conformance and performance 8*2f245829Sagctests, and sockets tests that can be used to simulate TCP traffic identical to 9*2f245829Sagcthat generated between a real iSCSI host and target. 10*2f245829Sagc 11*2f245829SagcSee PERFORMANCE for information regarding the expected performance of this 12*2f245829Sagcdistribution. 13*2f245829Sagc 14*2f245829SagcThis code has been successfully compiled and tested on Redhat 8.0 15*2f245829Sagc(kernel version 2.4.18-14) and Redhat 9.0 (kernel version 2.4.20) 16*2f245829Sagcwith UP and SMP configurations. 17*2f245829Sagc 18*2f245829Sagc------------------- 19*2f245829SagcStarting the System 20*2f245829Sagc------------------- 21*2f245829Sagc 22*2f245829Sagc1a) Modify the array in initiator.c to contain your target ip addresses and port 23*2f245829Sagc numbers. If you specify a TargetName there will be no discovery process. For 24*2f245829Sagc example, targets 0 and 2 below will first be discovered. Target 1 will not. 25*2f245829Sagc ISCSI_PORT is the default port defined in iscsi.h and currently set to 3260. 26*2f245829Sagc 27*2f245829Sagc static INITIATOR_TARGET_T g_target[CONFIG_INITIATOR_NUM_TARGETS] = { 28*2f245829Sagc {"192.168.10.10", ISCSI_PORT, "", NULL, 0}, 29*2f245829Sagc {"192.168.10.11", ISCSI_PORT, "iqn.com.intel.abc123", NULL, 0}, 30*2f245829Sagc {"192.168.10.12", ISCSI_PORT, "", NULL, 0}}; 31*2f245829Sagc 32*2f245829Sagc The initiator currently only connects to one of the discovered targets. If 33*2f245829Sagc multiple TargetNames and TargetAddresses are returned, all but 1 are ignored. 34*2f245829Sagc 35*2f245829Sagc1b) Alternately for the kernel mode driver you may specify ip addresses 36*2f245829Sagc in a file in the local directory called "./intel_iscsi_targets". This 37*2f245829Sagc file will also be looked for in the /etc directory or you may specify 38*2f245829Sagc the file name as a module parameter to the insmod command using the 39*2f245829Sagc "gfilename" argument, (insmod intel_iscsi.o gfilename="./targets"). 40*2f245829Sagc The format for the contents of of the file is: 41*2f245829Sagc ip=192.168.10.10 42*2f245829Sagc ip=192.168.10.11 name=iqn.com.intel.abc123 port=3260 43*2f245829Sagc ip=192.168.10.12 44*2f245829Sagc The name and port fields are optional. If name is not specified, there 45*2f245829Sagc will be a discovery process. If port is not specified, the default port 46*2f245829Sagc of 3260 will be used. 47*2f245829Sagc 48*2f245829Sagc1c) For the user mode intiator, if the first entry of the g_target array has ip 49*2f245829Sagc address "151.0.1.1", the initiator will prompt the user to enter the number 50*2f245829Sagc of targets and their ip addresses. 51*2f245829Sagc 52*2f245829Sagc2) Modify the following constant in initiator.h accordingly: 53*2f245829Sagc 54*2f245829Sagc #define CONFIG_INITIATOR_NUM_TARGETS 3 55*2f245829Sagc 56*2f245829Sagc3) Run "make" to build each of: 57*2f245829Sagc 58*2f245829Sagc intel_iscsi.o - kernel mode iSCSI initiator 59*2f245829Sagc kramdisk.o - kernel mode iSCSI target ramdisk 60*2f245829Sagc ufsdisk - user mode iSCSI target (disk stored as file in /tmp) 61*2f245829Sagc ufsdisk_mmap - same as ufsdisk, but uses mmap 62*2f245829Sagc uramdisk - user mode iSCSI ramdisk 63*2f245829Sagc utest - user mode iSCSI test suite 64*2f245829Sagc ktest - invokes same tests as utest, but from within device driver 65*2f245829Sagc usocktest - user mode sockets test that simulates iSCSI traffic 66*2f245829Sagc 67*2f245829Sagc4) Start a user level target (uramdisk, ufsdisk, ufsdisk_mmap) on each target 68*2f245829Sagc machine: 69*2f245829Sagc 70*2f245829Sagc Usage: -t <name> iSCSI TargetName (dflt "iqn.com.intel.abc123") 71*2f245829Sagc -p <port> Port Number (dflt 3260) 72*2f245829Sagc -b <block len> Block Length (dflt 512) 73*2f245829Sagc -n <num blocks> Number of Blocks (dflt 204800) 74*2f245829Sagc 75*2f245829Sagc 76*2f245829Sagc Or start the kernel level target (kramdisk.o): 77*2f245829Sagc 78*2f245829Sagc Usage: insmod kramdisk.o port=<port> 79*2f245829Sagc block_len=<block length> 80*2f245829Sagc num_blocks=<number of blocks> 81*2f245829Sagc 82*2f245829Sagc 83*2f245829Sagc With ufsdisk and ufsdisk_mmap you can directly access a device in /dev by 84*2f245829Sagc creating a symbolic link in /tmp to point to the appropriate device. For 85*2f245829Sagc example: 86*2f245829Sagc 87*2f245829Sagc "ln -s /dev/sdd /tmp/iqn.com.intel.abc123_3260_iscsi_disk_lun_0" 88*2f245829Sagc 89*2f245829Sagc And kramdisk.o only operates in ramdisk mode. 90*2f245829Sagc 91*2f245829Sagc5) Run utest. If you did not successfully connect to each target machine you 92*2f245829Sagc specified in initiator.c, then there was a problem. Make sure initiator.h 93*2f245829Sagc and initiator.c were correctly edited and all your targets had been started. 94*2f245829Sagc 95*2f245829Sagc6) As root, run "insmod ./intel_iscsi.o." You should see output similar to the 96*2f245829Sagc following when either viewing /var/log/messages or running dmesg: 97*2f245829Sagc 98*2f245829Sagc ********************************************* 99*2f245829Sagc * PARAMETERS NEGOTIATED * 100*2f245829Sagc * * 101*2f245829Sagc * InitiatorName: Intel * 102*2f245829Sagc * InitiatorAlias: Intel * 103*2f245829Sagc * SessionType: normal * 104*2f245829Sagc * TargetName: iqn.com.intel.abc12 * 105*2f245829Sagc ********************************************* 106*2f245829Sagc ********************************************* 107*2f245829Sagc * LOGIN SUCCESSFUL * 108*2f245829Sagc * * 109*2f245829Sagc * CID: 0 * 110*2f245829Sagc * ISID: 0 * 111*2f245829Sagc * TSID: 1 * 112*2f245829Sagc * CmdSN: 0 * 113*2f245829Sagc * MaxCmdSN: 0 * 114*2f245829Sagc * ExpStatSN: 0 * 115*2f245829Sagc ********************************************* 116*2f245829Sagc Vendor: Intel Model: Intel Labs iSCSI Rev: 2 117*2f245829Sagc Type: Direct-Access ANSI SCSI revision: 02 118*2f245829Sagc Detected scsi disk sdb at scsi2, channel 0, id 0, lun 0 119*2f245829Sagc SCSI device sdb: 204800 512-byte hdwr sectors (105 MB) 120*2f245829Sagc sdb: unknown partition table 121*2f245829Sagc 122*2f245829Sagc You can now use the device as you would any other SCSI device. You can also 123*2f245829Sagc view driver statistics by viewing the file in /proc/scsi/iscsi. Writing to 124*2f245829Sagc the file (e.g. echo reset > /proc/scsi/iscsi/1) will reset all counters. 125*2f245829Sagc 126*2f245829Sagc------------------ 127*2f245829SagcTesting the System 128*2f245829Sagc------------------ 129*2f245829Sagc 130*2f245829SagcOnce your targets and host have been started, you can test the installation 131*2f245829Sagcusing either a single target, or by creating a RAID volume over multiple 132*2f245829Sagctargets. 133*2f245829Sagc 134*2f245829SagcTo test a single target you can either directly read and write the device by 135*2f245829Sagcopening, for example, /dev/sdd. Or you can create a filesystem on the device: 136*2f245829Sagc 137*2f245829Sagc fdisk /dev/sdd 138*2f245829Sagc mkfs /dev/sdd1 139*2f245829Sagc mount -t ext2 /dev/sdd1 /mnt/iscsi_fs 140*2f245829Sagc 141*2f245829SagcTo test a multiple target installation, you can create a RAID volume, 142*2f245829Sagcvirtualizing multiple targets as one SCSI device. The Linux RAID modules 143*2f245829Sagcwill either need to be installed or compiled into the kernel. The file 144*2f245829Sagc/etc/raidtab must be created to reflect your targets. For example, 145*2f245829Sagc 146*2f245829Sagc raiddev /dev/md0 147*2f245829Sagc raid-level 0 148*2f245829Sagc nr-raid-disks 5 149*2f245829Sagc persistent-superblock 0 150*2f245829Sagc chunk-size 64 151*2f245829Sagc 152*2f245829Sagc device /dev/sdd 153*2f245829Sagc raid-disk 0 154*2f245829Sagc device /dev/sde 155*2f245829Sagc raid-disk 1 156*2f245829Sagc device /dev/sdf 157*2f245829Sagc raid-disk 2 158*2f245829Sagc device /dev/sdg 159*2f245829Sagc raid-disk 3 160*2f245829Sagc device /dev/sdh 161*2f245829Sagc raid-disk 4 162*2f245829Sagc 163*2f245829Sagc 164*2f245829SagcAfter initialized the raid device with "mkraid /dev/md0," you can use /dev/md0 165*2f245829Sagcas though it were a normal SCSI device. For example, 166*2f245829Sagc 167*2f245829Sagc mkfs /dev/md0 168*2f245829Sagc mount -t ext2 /dev/md0 /mnt/iscsi_fs 169*2f245829Sagc 170*2f245829Sagc-------------------- 171*2f245829SagcWhen Things Go Wrong 172*2f245829Sagc-------------------- 173*2f245829Sagc 174*2f245829SagcCheck the kernel error messages /var/log/messages or run the dmesg command to 175*2f245829Sagcsee any errors reported from the host driver. The targets will report target 176*2f245829Sagcerrors to standard output. 177*2f245829Sagc 178*2f245829SagcIf you need more fine grained debugging, modify the Makefile to turn on the 179*2f245829Sagccompilation flag CONFIG_ISCSI_DEBUG. Then run "make clean," and then "make." 180*2f245829SagcYou can select which type of debugging statements get printed by modifying 181*2f245829Sagciscsiutil.h 182*2f245829Sagc 183*2f245829Sagc------------------------------------- 184*2f245829SagcInteroperability with Cisco Initiator 185*2f245829Sagc------------------------------------- 186*2f245829Sagc 187*2f245829SagcThe target is tested to be interoperable with Cisco Initiator release 188*2f245829Sagc3.4.1.1 189