]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r345008:
authorken <ken@FreeBSD.org>
Thu, 16 May 2019 22:03:25 +0000 (22:03 +0000)
committerken <ken@FreeBSD.org>
Thu, 16 May 2019 22:03:25 +0000 (22:03 +0000)
commitfc03ac7246b2657f34e3bf5911c77a9d9184ac3e
tree4ce1f9a8c1462b5d55d8d14bf8ec317ab71ab0d8
parenta31130f8bb3bcbea161323dced1dbab2f19c990a
MFC r345008:
  ------------------------------------------------------------------------
  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

  ------------------------------------------------------------------------
sys/dev/isp/isp.c
sys/dev/isp/isp_freebsd.c
sys/dev/isp/isp_stds.h
sys/dev/isp/ispmbox.h
sys/dev/isp/ispvar.h