Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Jul 2012 20:14:31 -0700
From:      Trent Nelson <trent@snakebite.org>
To:        "ken@freebsd.org" <ken@freebsd.org>
Cc:        "freebsd-scsi@freebsd.org" <freebsd-scsi@freebsd.org>
Subject:   CAM Target Layer and dev/isp
Message-ID:  <CC2A50D7.3264B%trent@snakebite.org>

next in thread | raw e-mail | index | archive | help
Hi Ken,

So, first off, nice work on CTL!  I accidentally stumbled onto this little
gem yesterday and was shocked I hadn't heard of it before.  (Although it
seems I'm not alone, even Google only seems to know about your original
mailing list posts -- `+freebsd +ctladm` returns surprisingly little.)

(Somewhat related question before I get into my main issue: `ctladm`
should remove the need for share/examples/scsi_target, right?  The CAM
Target Layer stuff encompasses all the original functionality exposed in
scsi_target?)

I'm not sure how to expose LUNs via my isp devices.  Here's what I've got
so far:

[root@s24/ttypts/1(../misc/isp/bin)#] for i in {0..3}; do; ./isp_getrole
/dev/isp$i; done
/dev/isp0 chan 0: role target
/dev/isp1 chan 0: role target
/dev/isp2 chan 0: role target
/dev/isp3 chan 0: role target

[root@s24/ttypts/1(../misc/isp/bin)#] ctladm devlist -v
LUN Backend       Size (Blocks)   BS Serial Number    Device ID
  0 ramdisk             2097152  512 MYSERIAL   0     MYDEVID   0
      lun_type=3D0

[root@s24/ttypts/1(../misc/isp/bin)#] ctladm port -l
Port Online Type     Name         pp vp WWNN               WWPN
 =20
0    YES    IOCTL    CTL ioctl    0  0  0                  0
 =20
1    YES    INTERNAL ctl2cam      0  0  0x5000000357375b00
0x5000000357375b02
2    YES    INTERNAL CTL internal 0  0  0                  0
 =20
3    YES    FC       isp0         0  0  0x200000e08b146178
0x210000e08b146178
4    YES    FC       isp1         1  0  0x400000007f000009
0x400000007f000009
5    YES    FC       isp2         2  0  0x200000e08b102f5b
0x210000e08b102f5b
6    YES    FC       isp3         3  0  0x200000e08b302f5b
0x210100e08b302f5b


It's not obvious from the docs how to export CTL LUNs through my isp
devices.  I tried passing -D /dev/isp[n] to `ctladm create`, but that
returns: 'ctladm: cctl_create_lun: error issuing CTL_LUN_REQ ioctl:
Inappropriate ioctl for device'.

Sample output from one of the switches on my fabric (s24's /dev/isp1 is
plugged into port 8 of sf1):

sf1:admin> switchshow
switchName:	sf1
switchType:	17.2
switchState:	Online
switchMode:	Native
switchRole:	Principal
switchDomain:	1
switchId:	fffc01
switchWwn:	10:00:00:60:69:5a:1a:40
switchBeacon:	OFF
Zoning:      	ON (cfg_2012_07_16)
port  0: id N2 Online         F-Port 50:06:0b:00:00:13:18:72
port  1: id N2 No_Light
port  2: id N2 Online         E-Port 10:00:00:60:69:5a:09:c0 "sf2"
(downstream)=20
port  3: id N2 No_Light
port  4: id N2 No_Light
port  5: id N2 Online         F-Port 21:01:00:e0:8b:ab:cf:be
port  6: id N2 Online         F-Port 21:01:00:e0:8b:a6:98:ca
port  7: id N2 Online         F-Port 21:01:00:e0:8b:30:2f:5b
port  8: id N1 Online         L-Port 1 public
port  9: id N2 No_Light
port 10: id N2 No_Light
port 11: id N2 Online         L-Port 8 public
port 12: id N2 Online         L-Port 8 public
port 13: id N2 Online         L-Port 8 public
port 14: id N2 Online         L-Port 8 public
port 15: id N2 No_Light
sf1:admin> portshow 8
portName:  =20
portHealth: No License
Authentication: None
portFlags:  0x223806b	portLbMod:  0x0	 PRESENT ACTIVE F_PORT L_PORT U_PORT
LOGIN NOELP LED ACCEPT WAS_EPORT
portType:   4.1
portState:  1	Online
portPhys:   6	In_Sync
portScn:    6	F_Port
portRegs:   0x81100000
portData:   0x102b8f40
portId:     010800
portWwn:    20:08:00:60:69:5a:1a:40
portWwn of device(s) connected: 	40:00:00:00:7f:00:00:09
Distance:   normal
Speed:      N1Gbps=20

Interrupts:        10126      Link_failure: 0          Frjt:         0
    =20
Unknown:           51         Loss_of_sync: 10058      Fbsy:         0
    =20
Lli:               10084      Loss_of_sig:  2          Lip_in:       1
    =20
Proc_rqrd:         21         Protocol_err: 0          Lip_out:      2
    =20
Timed_out:         0          Invalid_word: 0          Lip_rx:       F7,F7
Rx_flushed:        0          Invalid_crc:  0
Tx_unavail:        0          Delim_err:    0
Free_buffer:       0          Address_err:  1
Overrun:           0          Lr_in:        0
Suspended:         0          Lr_out:       0
Parity_err:        0          Ols_in:       0
                              Ols_out:      0
sf1:admin>=20



Ideally I'd like to be able to use CTL to export multiple ZFS zvols as
separate targets (i.e. all with unique WWNN/WWPNs), such that, from the
fabric's point of view, the port would look like just another FC-AL JBOD,
like, say, port 11:

sf1:admin> portshow 11
portName:  =20
portHealth: No License
Authentication: None
portFlags:  0x223806b	portLbMod:  0x0	 PRESENT ACTIVE F_PORT L_PORT U_PORT
LOGIN NOELP LED ACCEPT WAS_EPORT
portType:   4.1
portState:  1	Online
portPhys:   6	In_Sync
portScn:    6	F_Port
portRegs:   0x81130000
portData:   0x11dc6770
portId:     010b00
portWwn:    20:0b:00:60:69:5a:1a:40
portWwn of device(s) connected: 	21:00:00:14:c3:ca:23:ca
	21:00:00:14:c3:c1:9c:90
	21:00:00:14:c3:c4:41:9a
	21:00:00:14:c3:c1:23:6b
	21:00:00:14:c3:ca:23:df
	21:00:00:14:c3:c4:47:97
	21:00:00:14:c3:ca:20:0e
	21:00:00:14:c3:c4:40:ca


That'll allow me to zone the zvols just as if they were actual JBOD disks.
 Which will be awesome.

Is that possible?

Also, the HA stuff sounds bad-ass.  What's the best way to stay up to date
with CTL development?  Watch commits to sys/cam/ctl?  (There's no separate
list or anything for this stuff, right?)

Regards,

	Trent.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CC2A50D7.3264B%trent>