# 9.2R fiber channel target mode issues



## kmkramer71 (Feb 26, 2014)

I am struggling with getting this working. I've followed a few very simple how-to docs and just can't seem to get it going. I'm running the GENERIC kernel (9.2-RELEASE-p3). I'm using a Supermicro board with a dual-port Qlogic 2532 chipset dual-connected to a Qlogic 5600 that has been split into 2 zones. The internal storage of this server has 24 1 T_B_ Samsung SSD disks set[]up for now in a ZFS RAID-Z with 2 spares just for testing of this mode. We are thinking about using this host for a fast VMware datastore. Here are the steps I've tried.  Also I am wondering how to make the devices persist after they are set[]up and functional. Any help or pointers much appreciated.

loader.conf

```
ispfw_load="YES"
isp_load="YES"
ctl_load="YES"
```
/boot/device.hints

```
hint.isp.0.gone_device_time="0xB4"
hint.isp.1.gone_device_time="0xB4"
hint.isp.0.role="1"
hint.isp.1.role="1"
```
_A_fter reboot
`dmesg | grep isp`


```
ispfw: registered firmware <isp_1040>
ispfw: registered firmware <isp_1040_it>
ispfw: registered firmware <isp_1080>
ispfw: registered firmware <isp_1080_it>
ispfw: registered firmware <isp_12160>
ispfw: registered firmware <isp_12160_it>
ispfw: registered firmware <isp_2100>
ispfw: registered firmware <isp_2200>
ispfw: registered firmware <isp_2300>
ispfw: registered firmware <isp_2322>
ispfw: registered firmware <isp_2400>
ispfw: registered firmware <isp_2400_multi>
ispfw: registered firmware <isp_2500>
ispfw: registered firmware <isp_2500_multi>
isp0: <Qlogic ISP 2532 PCI FC-AL Adapter> port 0x6100-0x61ff mem 0xdf784000-0xdf787fff,0xdf600000-0xdf6fffff irq 40 at device 0.0 on pci6
isp0: setting role to 0x1
isp1: <Qlogic ISP 2532 PCI FC-AL Adapter> port 0x6000-0x60ff mem 0xdf780000-0xdf783fff,0xdf500000-0xdf5fffff irq 44 at device 0.1 on pci6
isp1: setting role to 0x1
vgapci0: <VGA-compatible display> mem 0xdd000000-0xddffffff,0xdf000000-0xdf003fff,0xde800000-0xdeffffff irq 16 at device 3.0 on pci9
isp0: Chan 0 Register FC4 Type CT Passthrough returned 0x6
[b]isp0: isp_fclink_test: register fc4 type failed[/b]
isp0: Chan 0 Register FC4 Type CT Passthrough returned 0x6
[b]isp0: isp_fclink_test: register fc4 type failed[/b]
isp0: Chan 0 Register FC4 Type CT Passthrough returned 0x6
[b]isp0: isp_fclink_test: register fc4 type failed[/b]
```

I don't know what the fc4 type failure is and can't find anything on it.

I think my main problem is that I can't seem to get my HBA in target mode. I don't believe this error occurs when I remove the device.hints for isp. I have tried using a ZVOL file on a ZFS filesystem and a RAM disk.

`ctladm port -l`

```
Port Online Type     Name         pp vp WWNN               WWPN
0    YES    IOCTL    CTL ioctl    0  0  0                  0
1    YES    INTERNAL CTL internal 0  0  0                  0
2    YES    INTERNAL ctl2cam      0  0  0x5000000f8486af00 0x5000000f8486af03
```
`ctladm devlist -v`

```
LUN Backend       Size (Blocks)   BS Serial Number    Device ID
  1 ramdisk          2048000000  512 MYSERIAL   0     MYDEVID   0
      lun_type=0
  0 block             209715200  512 MYSERIAL   0     MYDEVID   0
      lun_type=0
      num_threads=14
      file=/dev/zvol/SSDPOOL/zvol1

scbus11 on ctl2cam0 bus 0:
<FREEBSD CTLDISK 0001>             at scbus11 target 1 lun 0 (da24,pass26)
<FREEBSD CTLDISK 0001>             at scbus11 target 1 lun 1 (da25,pass27)
<>                                 at scbus11 target -1 lun -1 ()
```


----------



## Justin D Holcomb (Feb 27, 2016)

I am doing some FC target testing on Qlogic hardware too. I am in the process of converting over from a Solaris based SAN system. I am testing from 10.3-BETA3 however but this should still apply to you.

I was experiencing a similar issue. My QLogic QLE2460 would not go into target mode. I did the same changes to my config as you indicated above.

`root@freebsd:~ # sysctl dev.isp.`

```
dev.isp.0.topo: 0
dev.isp.0.loopstate: 0
dev.isp.0.fwstate: 0
dev.isp.0.linkstate: 0
dev.isp.0.speed: 0
dev.isp.0.role: 2
dev.isp.0.gone_device_time: 30
dev.isp.0.loop_down_limit: 60
dev.isp.0.wwpn: 2377900720011123387
dev.isp.0.wwnn: 2305843126012345677
dev.isp.0.%parent: pci4
dev.isp.0.%pnpinfo: vendor=0x1077 device=0x2432 subvendor=0x1077 subdevice=0x0137 class=0x0c0400
dev.isp.0.%location: pci0:4:0:0
dev.isp.0.%driver: isp
dev.isp.0.%desc: Qlogic ISP 2432 PCI FC-AL Adapter
dev.isp.%parent:
```
`root@freebsd:~ # sysctl dev.isp.0.role=1`

```
dev.isp.0.role: 2 -> 0
```
`root@freebsd:~ # sysctl dev.isp.0.role=2`

```
dev.isp.0.role: 0 -> 2
```
`root@freebsd:~ # sysctl dev.isp.0.role=1`

```
dev.isp.0.role: 2 -> 0
```
Notice how the mode refuses to go into mode "1" aka target mode. With mode "0" being no mode, "2" being initiator mode, and "3" being both.

I resolved it by copying the generic kernel configuration, adding the third line below, and building a new kernel. The last line is critical and will not enable the ability to change to target mode.


```
device          isp                     # Qlogic family
device          ispfw                   # Firmware for QLogic HBAs
options         ISP_TARGET_MODE         # Required for Target Mode
```

After rebuilding the generic kernel and a reboot you should be good to go. You can verify it is working by running:

`ctladm port -l`

```
Port Online Frontend Name     pp vp
0    YES    ioctl    ioctl    0  0
1    YES    tpc      tpc      0  0
2    NO     camsim   camsim   0  0  naa.5000000e6b5ddfff
3    YES    camtgt   isp0     0  0  naa.2100001b561eeeee
```

If you still do not have a working system I would look into this, the October–December, 2015 Status Report published on February 1st. Specifically this section.


> Target role support was fixed and tested for all FC cards from ancient 1Gbps 22xx to modern 16Gbps 26xx.



I do not specifically know what was changed, however it is safe to say it does not apply to 9.x. Checking the code commits might help you figure this one out.

Also, it is worth mentioning; in my search to get my own system running, I ran across two articles that indicated issues with using ZVOL backing on 9.x systems.


----------



## cellini (Feb 29, 2016)

i am running a FreeBSD 10.2 with qlogic fiber channel cards. 
i am running a custom kernel with the following options added to generic.


```
device isp
device ispfw
options  ISP_TARGET_MODE
options  ISP_DEFAULT_ROLES=1
```

i use zfs and create zvol that i export to a windows server 2012 that lives on the zvol.

this is my /etc/ctl.conf


```
target iqn.WINSRV:target0 {
  auth-group no-authentication
  #portal-group pg0

  port isp2
  lun 0 {
  path /dev/zvol/oceanpool/iscsi/1000G
  #unmap=on
  }
  lun 1 {
  path /dev/zvol/oceanpool/iscsi/MSSQLdisk
  #unmap=on
  }

}
```

And my /etc/rc.conf looks like this.


```
ctld_enable="yes"
```

And i think that is all.

Hope this helps.


----------

