<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/sys/dev/isp/ispmbox.h, branch releng/12.2</title>
<subtitle>FreeBSD source tree</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<entry>
<title>MFC r345008:</title>
<updated>2019-05-17T14:29:56+00:00</updated>
<author>
<name>Kenneth D. Merry</name>
<email>ken@FreeBSD.org</email>
</author>
<published>2019-05-17T14:29:56+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=5d949247b7e2a50cd8bba156bf4d09db6176c5a3'/>
<id>5d949247b7e2a50cd8bba156bf4d09db6176c5a3</id>
<content type='text'>
  ------------------------------------------------------------------------
  r345008 | ken | 2019-03-11 10:21:14 -0400 (Mon, 11 Mar 2019) | 59 lines

  Fix CRN resets in the isp(4) driver in certain situations.

  The Command Reference Number (CRN) is part of the FC-Tape features
  that we enable when talking to tape drives.  It starts at 1, and
  goes to 255 and wraps around to 1.  There are a number of reset
  type conditions that result in the CRN getting reset to 1.  These
  are detailed in section 4.10 (table 8) of the FCP-4r02b specification.

  One of the conditions is when a PRLI (Process Login) is sent by
  the initiator, and the Establish Image Pair bit is set in Word 0
  of the PRLI.

  Previously, the isp(4) driver core sent a notification via
  isp_async() that the target had changed or stayed in place, but
  there was no indication of whether a PRLI was sent and whether the
  Establish Image Pair bit was set.

  The result of this was that in some situations, notably
  switching back and forth between a direct connection and a switch
  connection to a tape drive, the isp(4) driver would fail to reset
  the CRN in situations that require it according to the spec.  When
  the CRN isn't reset in a situation that requires it, the tape drive
  then rejects every subsequent command that is sent to the drive.
  It is assuming that the commands are being sent out of order.

  So, modify the isp(4) driver to include Word 0 of the PRLI command
  when it sends isp_async() notifications of target changes.  Look at
  the Establish Image Pair bit, and reset the CRN if that bit is set.

  With this change, I am able to switch a tape drive back and forth
  between a direct connection and a switch connection, and the isp(4)
  driver resets the CRN when it should.

  sys/dev/isp_stds.h:
  	Add bit definitions for PRLI Word 0.

  sys/dev/ispmbox.h:
  	Add PRLI Word 0 to the port database type, isp_pdb_t.

  sys/dev/ispvar.h
  	Add PRLI Word 0 to fcportdb_t.

  sys/dev/isp.c:
  	Populate the new prli_word0 parameter in the port database.

  	In isp_pdb_add_update(), add a check to see if the
  	Establish Image Pair bit is set in PRLI Word 0.  If it is,
  	then that is an additional reason to create a change
  	notification.

  sys/dev/isp_freebsd.c:
  	In isp_async(), if the device changed or stayed, look at
  	PRLI Word 0 to see if the Establish Image Pair bit is set.
  	If it is, reset the CRN if we haven't already.

  Sponsored by:	Spectra Logic

  ------------------------------------------------------------------------
Differential Revision:	https://reviews.freebsd.org/D19472
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
  ------------------------------------------------------------------------
  r345008 | ken | 2019-03-11 10:21:14 -0400 (Mon, 11 Mar 2019) | 59 lines

  Fix CRN resets in the isp(4) driver in certain situations.

  The Command Reference Number (CRN) is part of the FC-Tape features
  that we enable when talking to tape drives.  It starts at 1, and
  goes to 255 and wraps around to 1.  There are a number of reset
  type conditions that result in the CRN getting reset to 1.  These
  are detailed in section 4.10 (table 8) of the FCP-4r02b specification.

  One of the conditions is when a PRLI (Process Login) is sent by
  the initiator, and the Establish Image Pair bit is set in Word 0
  of the PRLI.

  Previously, the isp(4) driver core sent a notification via
  isp_async() that the target had changed or stayed in place, but
  there was no indication of whether a PRLI was sent and whether the
  Establish Image Pair bit was set.

  The result of this was that in some situations, notably
  switching back and forth between a direct connection and a switch
  connection to a tape drive, the isp(4) driver would fail to reset
  the CRN in situations that require it according to the spec.  When
  the CRN isn't reset in a situation that requires it, the tape drive
  then rejects every subsequent command that is sent to the drive.
  It is assuming that the commands are being sent out of order.

  So, modify the isp(4) driver to include Word 0 of the PRLI command
  when it sends isp_async() notifications of target changes.  Look at
  the Establish Image Pair bit, and reset the CRN if that bit is set.

  With this change, I am able to switch a tape drive back and forth
  between a direct connection and a switch connection, and the isp(4)
  driver resets the CRN when it should.

  sys/dev/isp_stds.h:
  	Add bit definitions for PRLI Word 0.

  sys/dev/ispmbox.h:
  	Add PRLI Word 0 to the port database type, isp_pdb_t.

  sys/dev/ispvar.h
  	Add PRLI Word 0 to fcportdb_t.

  sys/dev/isp.c:
  	Populate the new prli_word0 parameter in the port database.

  	In isp_pdb_add_update(), add a check to see if the
  	Establish Image Pair bit is set in PRLI Word 0.  If it is,
  	then that is an additional reason to create a change
  	notification.

  sys/dev/isp_freebsd.c:
  	In isp_async(), if the device changed or stayed, look at
  	PRLI Word 0 to see if the Establish Image Pair bit is set.
  	If it is, reset the CRN if we haven't already.

  Sponsored by:	Spectra Logic

  ------------------------------------------------------------------------
Differential Revision:	https://reviews.freebsd.org/D19472
</pre>
</div>
</content>
</entry>
<entry>
<title>Add support for Enhanced Gen 5 (16Gb) and Gen 6 (32Gb) QLogic FC HBAs.</title>
<updated>2018-02-28T16:24:32+00:00</updated>
<author>
<name>Alexander Motin</name>
<email>mav@FreeBSD.org</email>
</author>
<published>2018-02-28T16:24:32+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=14e084ada59512441c9bb701303aac337aade61c'/>
<id>14e084ada59512441c9bb701303aac337aade61c</id>
<content type='text'>
MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
</pre>
</div>
</content>
</entry>
<entry>
<title>sys/dev: further adoption of SPDX licensing ID tags.</title>
<updated>2017-11-27T14:52:40+00:00</updated>
<author>
<name>Pedro F. Giffuni</name>
<email>pfg@FreeBSD.org</email>
</author>
<published>2017-11-27T14:52:40+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=718cf2ccb9956613756ab15d7a0e28f2c8e91cab'/>
<id>718cf2ccb9956613756ab15d7a0e28f2c8e91cab</id>
<content type='text'>
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
</pre>
</div>
</content>
</entry>
<entry>
<title>Switch fabric scans from GID_FT to GID_PT+GFF_ID/GFT_ID.</title>
<updated>2017-07-03T15:56:45+00:00</updated>
<author>
<name>Alexander Motin</name>
<email>mav@FreeBSD.org</email>
</author>
<published>2017-07-03T15:56:45+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=a94fab67bb9c07d5837c9e2ad25d48b9b701643a'/>
<id>a94fab67bb9c07d5837c9e2ad25d48b9b701643a</id>
<content type='text'>
Instead of using GID_FT SNS request to get list of registered FCP ports,
use GID_PT to get list of all Nx_Ports, and then use GFF_ID and/or GFT_ID
requests to find whether they are FCP and target capable.

The problem with old approach is that GID_FT does not report ports without
FC-4 type registered.  In particular it was impossible to boot OS from
FreeBSD FC target using QLogic FC BIOS, since one does not register FC-4
type even on new cards and so ignored by old code as incompatible.

As a side bonus this allows initiator to skip pointless logins to other
initiators by fetching that information from SNS instead.

In case some switches do not implement GFF_ID/GFT_ID correctly, add sysctls
to disable that functionality.  I handled broken GFF_ID of my Brocade 200E,
but there may be other switches with different bugs.

Linux also uses GID_PT, but GFF_ID is disabled by default there, and GFT_ID
is not supported.

Sponsored by:	iXsystems, Inc.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Instead of using GID_FT SNS request to get list of registered FCP ports,
use GID_PT to get list of all Nx_Ports, and then use GFF_ID and/or GFT_ID
requests to find whether they are FCP and target capable.

The problem with old approach is that GID_FT does not report ports without
FC-4 type registered.  In particular it was impossible to boot OS from
FreeBSD FC target using QLogic FC BIOS, since one does not register FC-4
type even on new cards and so ignored by old code as incompatible.

As a side bonus this allows initiator to skip pointless logins to other
initiators by fetching that information from SNS instead.

In case some switches do not implement GFF_ID/GFT_ID correctly, add sysctls
to disable that functionality.  I handled broken GFF_ID of my Brocade 200E,
but there may be other switches with different bugs.

Linux also uses GID_PT, but GFF_ID is disabled by default there, and GFT_ID
is not supported.

Sponsored by:	iXsystems, Inc.
</pre>
</div>
</content>
</entry>
<entry>
<title>Slightly unify SNS requests for post- and pre-24xx.</title>
<updated>2017-07-02T14:59:41+00:00</updated>
<author>
<name>Alexander Motin</name>
<email>mav@FreeBSD.org</email>
</author>
<published>2017-07-02T14:59:41+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=3d792e6080306d6f546701c574e53c22a6925d78'/>
<id>3d792e6080306d6f546701c574e53c22a6925d78</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Correct loop mode CRN resets to adhere to FCP-4 section 4.10</title>
<updated>2017-05-03T13:17:01+00:00</updated>
<author>
<name>Kenneth D. Merry</name>
<email>ken@FreeBSD.org</email>
</author>
<published>2017-05-03T13:17:01+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=57b6261f94d5b633223299f7b1e12f6ec8275baa'/>
<id>57b6261f94d5b633223299f7b1e12f6ec8275baa</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
<entry>
<title>Add brackets to fix incorrect macro expansion.</title>
<updated>2017-03-24T16:26:11+00:00</updated>
<author>
<name>Alexander Motin</name>
<email>mav@FreeBSD.org</email>
</author>
<published>2017-03-24T16:26:11+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=00be964c0876bfda267f8e175d84b34065249f89'/>
<id>00be964c0876bfda267f8e175d84b34065249f89</id>
<content type='text'>
Reported by:	Andreas Hollmann / PVS-Studio
MFC after:	2 weeks
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reported by:	Andreas Hollmann / PVS-Studio
MFC after:	2 weeks
</pre>
</div>
</content>
</entry>
<entry>
<title>Add initial support for multiple MSI-X vectors.</title>
<updated>2017-03-19T19:11:40+00:00</updated>
<author>
<name>Alexander Motin</name>
<email>mav@FreeBSD.org</email>
</author>
<published>2017-03-19T19:11:40+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=08826086fe2c291dc322f6f3e50ee2826511e5b4'/>
<id>08826086fe2c291dc322f6f3e50ee2826511e5b4</id>
<content type='text'>
For 24xx and above use 2 vectors (default and response queue).
For 26xx and above use 3 vectors (default, response and ATIO queues).
Due to global lock interrupt hardlers never run simultaneously now, but
at least this allows to save one regitster read per interrupt.

MFC after:	2 weeks
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
For 24xx and above use 2 vectors (default and response queue).
For 26xx and above use 3 vectors (default, response and ATIO queues).
Due to global lock interrupt hardlers never run simultaneously now, but
at least this allows to save one regitster read per interrupt.

MFC after:	2 weeks
</pre>
</div>
</content>
</entry>
<entry>
<title>Register symbolic port/node names in FC name server.</title>
<updated>2016-04-09T14:50:47+00:00</updated>
<author>
<name>Alexander Motin</name>
<email>mav@FreeBSD.org</email>
</author>
<published>2016-04-09T14:50:47+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=7e53e7accc063b59d0d653d6b3229b71a2850228'/>
<id>7e53e7accc063b59d0d653d6b3229b71a2850228</id>
<content type='text'>
This is cosmetics that simplifies identification of new ports on FC switch.

It would be good to use target name from CTL here instead of hostname, but
it is not passed here through CAM now.

MFC after:	2 weeks
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is cosmetics that simplifies identification of new ports on FC switch.

It would be good to use target name from CTL here instead of hostname, but
it is not passed here through CAM now.

MFC after:	2 weeks
</pre>
</div>
</content>
</entry>
<entry>
<title>Some polishing for command timeouts handling.</title>
<updated>2015-12-24T14:53:29+00:00</updated>
<author>
<name>Alexander Motin</name>
<email>mav@FreeBSD.org</email>
</author>
<published>2015-12-24T14:53:29+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=a46709e2abcf7b5294f591c45e386b8407bdd8ba'/>
<id>a46709e2abcf7b5294f591c45e386b8407bdd8ba</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
