freebsd-skq/sys/dev/isp
ken 50123e2eac Correct loop mode CRN resets to adhere to FCP-4 section 4.10
Prior to this change, the CRN (Command Reference Number) is reset on any
firmware LIP, LOOP DOWN, or LOOP RESET event in violation of FCP-4 which
specifies that the CRN should only be reset in response to a LIP Reset
(LIPyx) primitive. FCP-4 also indicates PLOGI/LOGO and PRLI/PRLO ELS
actions as conditions for resetting the CRN for the associated initiator
port.

These violations manifest themselves when the HBA is removed from the
loop, or a target device is removed (especially during an outstanding
command) without power cycling. If the HBA and and the target device
determine upon re-establishing the loop that no PLOGI or PRLI is
required, and the target does not issue a LIPxy to the initiator, the
CRN for the target will have been improperly reset by the isp driver. As
a result, the target port will silently ignore all FCP commands issued
during the device probe (which will time out) preventing the device from
attaching.

This change corrects thie CRN reset behavior in response to loop state
changes, also introduces CRN resets for the above mentioned ELS actions
as encountered through async PDB change events.

This change also adds cleanup of outstanding commands in isp_loop_dead()
that was previously missing.

sys/dev/isp/isp.c
	Add the last login state to debug output when syncing the pdb

sys/dev/isp/isp_freebsd.c
	Replace binary statement setting aborted ccb status in
	isp_watchdog() with the XS_SETERR macro used elsewhere

	In isp_loop_dead(), abort or complete pending commands as done
	in isp_watchdog()

	In isp_async(), segregate the ISPASYNC_LOOP_RESET action from
	ISPASYNC_LIP, ISPASYNC_LOOP_DOWN, and ISPASYNC_LOOP_UP
	fallthroughs, and only reset the CRN in the RESET case. Also add
	checks to handle false LOOP RESET actions that do not have a
	proper associated LIP primitive, and log the primitive in the
	debug messages

	In isp_async(), remove the goto from ISP_ASYNC_DEV_STAYED, and
	only reset the CRN in the DEV_CHANGED action

	In isp_async(), when processing an ISPASYNC_CHANGE_PDB status,
	reset CRN(s) for the associated nphdl (or all ports) if the
	change reason is some form of ELS login/logout. Also remove
	assignment to fc since it is not used in the scope

sys/dev/isp/ispmbox.h
	Add macro definition for the global N-Port handle, and correct a
	macro typo 'PDB24XX_AE_PRLI_DONJE'

sys/dev/isp/ispvar.h
	Add macros FCP_AL_DA_ALL, FCP_AL_PA, and FCP_IS_DEST_ALPD for
	more legible code when determining if an AL_PD port matches the
	portid for a given struct fcparam* by value or by virtue of the
	AL_PD port being 0xFF

Submitted by:	Reid Linnemann
Sponsored by:	Spectra Logic
MFC after:	1 week
2017-05-03 13:17:01 +00:00
..
DriverManual.txt sys/dev: minor spelling fixes. 2016-05-03 03:41:25 +00:00
Hardware.txt
isp_freebsd.c Correct loop mode CRN resets to adhere to FCP-4 section 4.10 2017-05-03 13:17:01 +00:00
isp_freebsd.h Unify initiator and target DMA setup and command sending. 2017-03-24 14:44:03 +00:00
isp_ioctl.h
isp_library.c Unify initiator and target DMA setup and command sending. 2017-03-24 14:44:03 +00:00
isp_library.h Unify initiator and target DMA setup and command sending. 2017-03-24 14:44:03 +00:00
isp_pci.c Unify initiator and target DMA setup and command sending. 2017-03-24 14:44:03 +00:00
isp_sbus.c Unify initiator and target DMA setup and command sending. 2017-03-24 14:44:03 +00:00
isp_stds.h Register symbolic port/node names in FC name server. 2016-04-09 14:50:47 +00:00
isp_target.c Remove hackish code delaying ATIOs to unknown virtual port. 2017-03-19 13:46:11 +00:00
isp_target.h Remove some dead stuff. 2017-03-19 09:36:43 +00:00
isp.c Correct loop mode CRN resets to adhere to FCP-4 section 4.10 2017-05-03 13:17:01 +00:00
ispmbox.h Correct loop mode CRN resets to adhere to FCP-4 section 4.10 2017-05-03 13:17:01 +00:00
ispreg.h Fix and improve error masking and reporting. 2015-10-29 16:48:12 +00:00
ispvar.h Correct loop mode CRN resets to adhere to FCP-4 section 4.10 2017-05-03 13:17:01 +00:00