Precompiled packages for COMSTAR are available for both Solaris sparc and Solaris x86 (Nevada only. At this point Solaris 10 is not supported).
COMSTAR is meant to be used with the latest Solaris Developer Express release available from http://opensolaris.org/os/downloads/ . While it is possible to add the package to a previous Solaris release like Solaris 10, most of the development and testing is done on Solaris Nevada code base.
Installing comstar is as simple as doing a pkgadd of the SUNWstmf package. If this is the first time you are installing COMSTAR on a system, a reboot will not be needed. But if you already had the drivers installed (from a previous installation) then a reboot will be needed to update the drivers. Also the 'stmf' service is disabled by default and you need to enable it after installation. See the Service model section for details on stmf service.
See the section on mptt.
One of the protocols which can be used with COMSTAR is Fibre Channel. The fibre channel port provider can use the same HBAs which are used for Fibre channel initiators. However a given FC HBA port can either be used as an initiator or as target but not both. The procedure below describes how to select individual ports or the entire HBAs to be used as targets.
We will use QLogic 4G HBAs as an example for this exercise. The driver for these HBAs on the initiator side is qlc, sometimes also known as the Qlogic leadville driver. qlc is initiator-only and is not used for target mode. The COMSTAR driver for Qlogic 4G HBAs is qlt. SInce the initiator mode and target mode use different drivers, selecting a HBA port to be an initiator or target is simply a matter of selecting which driver will attach to that port. This can be done based on the PCI device ID of the HBA or on a per HBA port basis. Both of these cases use the solaris update_drv(1M) command. Examples for both of these cases are given below. See the man page for update_drv(1M) for more details. Note that the installation of the SUNWstmf package adds the qlt driver to the system but by default it is not bound to any particular HBA port i.e. the installation uses add_drv -n qlt command.
Selecting all the HBA with a specific PCI device ID to be in target mode
This option will change all the ports on all the HBA of a specific PCI device ID e.g. all the Qlogic 4G PCI express HBAs, to be in target mode.
First lets see what is presently bound to the
qlc driver. This can be done using prtconf(1M) also but we will use mdb(1).
# mdb -k
Loading modules: [ unix krtld genunix specfs …
> ::devbindings -q qlc
30001617a08 pciex1077,2432, instance #0 (driver name: qlc)
300016177e0 pciex1077,2432, instance #1 (driver name: qlc)
> $q
So qlc is currently bound to pciex1077,2432. We have to remove this binding before adding the driver binding for qlt.
# update_drv -d -i '"pciex1077,2432"' qlc
Cannot unload module: qlc
Will be unloaded upon reboot.
Note: the use of both single quote and double quote. This is required.
Even though the driver is still loaded but this action has removed the bindings for qlc to pciex1077,2422. Now before we reboot, we can add the bindings for qlt.
# update_drv -a -i '"pciex1077,2432"' qlt
devfsadm: driver failed to attach: qlt
Warning: Driver (qlt) successfully added to system but failed to attach
The qlt driver failed to attach because the qlc driver is still attached to the node. But this will change after a reboot as the configuration files have been updated. Reboot the system and check the bindings again.
# reboot
…
# mdb -k
Loading modules: [ unix krtld genunix specfs dtrace …
> ::devbindings -q qlt
30001615a08 pciex1077,2432, instance #0 (driver name: qlt)
300016157e0 pciex1077,2432, instance #1 (driver name: qlt)
> $q
Now lets make sure that the target mode framework is able to the see the HBA ports.
# stmfadm list-target -v
Target: wwn.210100E08BA54E60
Operational Status: Offline
Provider Name : qlt(1)
Alias : -
Sessions : 0
Target: wwn.210000E08B854E60
Operational Status: Offline
Provider Name : qlt(0)
Alias : -
Sessions : 0
NOTE: If this method is used to select ports for target mode and if for some reason you are doing a pkgrm SUNWstmf i.e. removing the COMSTAR package, make sure you restore the driver bindings back to qlc before doing the pkgrm. Otherwise nothing will get attached to these HBAs i.e. pkgrm will not restore your original bindings to qlc driver.
Selecting specific HBA ports to be in target mode while other ports of the same HBA are in initiator mode.
This step uses something known as
Path Based Bindings. Basically you can take a specific device path and bind it to a different driver (different from what it is already bound to). Lets take the same example as above and start from the point where all the ports are bound to
qlc.
We can get a list of HBA ports by using
luxadm -e port command.
# luxadm -e port
/devices/pci@780/QLGC,qlc@0,1/fp@0,0:devctl CONNECTED
/devices/pci@780/QLGC,qlc@0/fp@0,0:devctl CONNECTED
The above shows the HBA ports and their respective device paths. As you can see this a single HBA with two ports. Now lets say we want the first port (top one in the list) to be in target mode. The 2nd port should stay in initiator mode. The following command will make that change.
# update_drv -a -i '/pci@780/QLGC,qlc@0,1' qlt
devfsadm: driver failed to attach: qlt
Warning: Driver (qlt) successfully added to system but failed to attach
Basically drop the initial /devices portion and take everything upto the /fp... Now the system knows which path to bind the qlt driver to. As in previous case a reboot will make the binding happen.
NOTE: If this method is used to select ports for target mode, nothing needs to be restored before a pkgrm SUNWstmf. After the package is removed, the bindings will automatically go back to qlc.