freebsd-dev/sys/dev/isp
Kenneth D. Merry fb4a43562a Fix Fibre Channel Command Reference Number handling in the isp(4) driver.
The Command Reference Number is used for precise delivery of
commands, and is part of the FC-Tape functionality set.  (This is
only enabled for devices that support precise delivery of commands.)
It is an 8-bit unsigned number that increments from 1 to 255.  The
commands sent by the initiator must be processed by the target in
CRN order if the CRN is non-zero.

There are certain scenarios where the Command Reference Number
sequence needs to be reset.  When the target is power cycled, for
instance, the initiator needs to reset the CRN to 1.  The initiator
will know this because it will see a LIP (when directly connected)
or get a logout/login event (when connected to a switch).

The isp(4) driver was not resetting the CRN when a target
went away and came back.  When it saw the target again after a
power cycle, it would continue the CRN sequence where it left off.
The target would ignore the command because the CRN sequence is
supposed to be reset to 1 after a power cycle or other similar
event.

The symptom that the user would see is that there would be lots of
aborted INQUIRY commands after a tape library was power cycled, and
the library would fail to probe.  The INQUIRY commands were being
ignored by the tape drive due to the CRN issue mentioned above.

isp_freebsd.c:
	Add a new function, isp_fcp_reset_crn().  This will reset
	all of the CRNs for a given port, or the CRNs for all LUNs
	on a target.

	Reset the CRNs for all targets on a port when we get a LIP,
	loop reset, or loop down event.

	Reset the CRN for a particular target when it arrives, is changed
	or departs.  This is less precise behavior than the
	clearing behavior specified in the FCP-4 spec (which says
	that it should be reset for PRLI, PRLO, PLOGI and LOGO),
	but this is the level of information we have here.  If this
	is insufficient, then we will need to add more precise
	notification from the lower level isp(4) code.

isp_freebsd.h:
	Add a prototype for isp_fcp_reset_crn().

Sponsored by:	Spectra Logic
MFC after:	1 week
2015-01-08 17:41:28 +00:00
..
DriverManual.txt
Hardware.txt
isp_freebsd.c Fix Fibre Channel Command Reference Number handling in the isp(4) driver. 2015-01-08 17:41:28 +00:00
isp_freebsd.h Fix Fibre Channel Command Reference Number handling in the isp(4) driver. 2015-01-08 17:41:28 +00:00
isp_ioctl.h
isp_library.c Make isp_find_pdb_by_*() search for targets in portdb in reverse order. 2014-11-26 12:25:00 +00:00
isp_library.h
isp_pci.c Add missing calls to bus_dmamap_unload() when freeing static DMA 2014-06-13 18:20:44 +00:00
isp_sbus.c
isp_stds.h
isp_target.c
isp_target.h
isp.c Fix incorrect check, blocking MULTIID functionality. 2014-11-26 15:03:21 +00:00
ispmbox.h Use the C99 flexible array construct to denote a variable amount of 2014-10-13 16:23:58 +00:00
ispreg.h
ispvar.h